diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-09-10 15:39:35 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-09-12 02:37:31 +0000 |
commit | 349970a67a1911cd522ee133daa7476b6301e323 (patch) | |
tree | 4652b4e713907d7838f3e8b272fe740165f417f0 /libavfilter/vf_framerate.c | |
parent | 2b77034565993e8c0bd8902127e7b2e1a000fa86 (diff) | |
download | ffmpeg-349970a67a1911cd522ee133daa7476b6301e323.tar.gz |
avfilter/vf_framerate: calculate delta from scaled pts instead of unscaled
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/vf_framerate.c')
-rw-r--r-- | libavfilter/vf_framerate.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c index ccd6647774..f4ff481adb 100644 --- a/libavfilter/vf_framerate.c +++ b/libavfilter/vf_framerate.c @@ -476,28 +476,23 @@ static void set_work_frame_pts(AVFilterContext *ctx) average_srce_pts_delta = s->average_srce_pts_dest_delta; ff_dlog(ctx, "set_work_frame_pts() initial average srce pts:%"PRId64"\n", average_srce_pts_delta); + set_srce_frame_dest_pts(ctx); + // calculate the PTS delta - if ((pts = (s->srce[s->next]->pts - s->srce[s->crnt]->pts))) { + if ((pts = (s->srce_pts_dest[s->next] - s->srce_pts_dest[s->crnt]))) { average_srce_pts_delta = average_srce_pts_delta?((average_srce_pts_delta+pts)>>1):pts; - } else if (s->srce[s->prev] && (pts = (s->srce[s->crnt]->pts - s->srce[s->prev]->pts))) { + } else if (s->srce[s->prev] && (pts = (s->srce_pts_dest[s->crnt] - s->srce_pts_dest[s->prev]))) { average_srce_pts_delta = average_srce_pts_delta?((average_srce_pts_delta+pts)>>1):pts; } - s->average_srce_pts_dest_delta = av_rescale_q(average_srce_pts_delta, s->srce_time_base, s->dest_time_base); + s->average_srce_pts_dest_delta = average_srce_pts_delta; ff_dlog(ctx, "set_work_frame_pts() average srce pts:%"PRId64"\n", average_srce_pts_delta); ff_dlog(ctx, "set_work_frame_pts() average srce pts:%"PRId64" at dest time base:%u/%u\n", s->average_srce_pts_dest_delta, s->dest_time_base.num, s->dest_time_base.den); - set_srce_frame_dest_pts(ctx); - if (ctx->inputs[0] && !s->average_dest_pts_delta) { - int64_t d = av_q2d(av_inv_q(av_mul_q(s->srce_time_base, s->dest_frame_rate))); - if (d == 0) { // FIXME - av_log(ctx, AV_LOG_WARNING, "Buggy path reached, use settb filter before this filter!\n"); - d = av_q2d(av_mul_q(ctx->inputs[0]->time_base, s->dest_frame_rate)); - } - s->average_dest_pts_delta = av_rescale_q(d, s->srce_time_base, s->dest_time_base); - ff_dlog(ctx, "set_frame_pts() average output pts from input timebase\n"); + int64_t d = av_q2d(av_inv_q(av_mul_q(s->dest_time_base, s->dest_frame_rate))); + s->average_dest_pts_delta = d; ff_dlog(ctx, "set_work_frame_pts() average dest pts delta:%"PRId64"\n", s->average_dest_pts_delta); } |