summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_enc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-03-27 07:37:29 +0200
committerAnton Khirnov <anton@khirnov.net>2023-04-13 15:11:56 +0200
commit83da6d3f54fc85784e0ef843ee6e0c03e338722e (patch)
treedb254145569eb2e9445acd5056a4f1e713b6f0d4 /fftools/ffmpeg_enc.c
parent87ae84e4afb2d137b1e229250b576226b1433a79 (diff)
downloadffmpeg-83da6d3f54fc85784e0ef843ee6e0c03e338722e.tar.gz
fftools/ffmpeg: move OutputStream.last_nb0_frames to Encoder
It is video encoding-only and does not need to be visible outside of ffmpeg_enc.c Also, rename the variable to frames_prev_hist to be consistent with the naming in do_video_out().
Diffstat (limited to 'fftools/ffmpeg_enc.c')
-rw-r--r--fftools/ffmpeg_enc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 5c56ad0325..7f6bd76f10 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -50,6 +50,10 @@ struct Encoder {
AVFrame *last_frame;
/* number of frames emitted by the video-encoding sync code */
int64_t vsync_frame_number;
+ /* history of nb_frames_prev, i.e. the number of times the
+ * previous frame was duplicated by vsync code in recent
+ * do_video_out() calls */
+ int64_t frames_prev_hist[3];
AVFrame *sq_frame;
};
@@ -999,18 +1003,18 @@ static void do_video_out(OutputFile *of,
if (!next_picture) {
//end, flushing
- nb_frames_prev = nb_frames = mid_pred(ost->last_nb0_frames[0],
- ost->last_nb0_frames[1],
- ost->last_nb0_frames[2]);
+ nb_frames_prev = nb_frames = mid_pred(e->frames_prev_hist[0],
+ e->frames_prev_hist[1],
+ e->frames_prev_hist[2]);
} else {
video_sync_process(of, ost, next_picture, duration,
&nb_frames, &nb_frames_prev);
}
- memmove(ost->last_nb0_frames + 1,
- ost->last_nb0_frames,
- sizeof(ost->last_nb0_frames[0]) * (FF_ARRAY_ELEMS(ost->last_nb0_frames) - 1));
- ost->last_nb0_frames[0] = nb_frames_prev;
+ memmove(e->frames_prev_hist + 1,
+ e->frames_prev_hist,
+ sizeof(e->frames_prev_hist[0]) * (FF_ARRAY_ELEMS(e->frames_prev_hist) - 1));
+ e->frames_prev_hist[0] = nb_frames_prev;
if (nb_frames_prev == 0 && ost->last_dropped) {
nb_frames_drop++;