diff options
author | Nicolas George <george@nsup.org> | 2015-10-24 19:43:55 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2016-01-03 15:50:51 +0100 |
commit | 962727acb4e3c4dff856b48460ddcf747fcfda93 (patch) | |
tree | db6fd291557fbe73dc0844e76d615f7ac869eb39 | |
parent | 35b0c7efda525acb7054f40e934cd487c90139c3 (diff) | |
download | ffmpeg-962727acb4e3c4dff856b48460ddcf747fcfda93.tar.gz |
lavfi/vf_decimate: do not compare the first frame to itself.
This is a waste of computing power and will result to 0,
making it always dropped.
Use maximum difference values instead.
-rw-r--r-- | libavfilter/vf_decimate.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index cd374c3116..8b950b496c 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -167,9 +167,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) if (in) { /* update frame metrics */ prv = dm->fid ? dm->queue[dm->fid - 1].frame : dm->last; - if (!prv) - prv = in; - calc_diffs(dm, &dm->queue[dm->fid], prv, in); + if (!prv) { + dm->queue[dm->fid].maxbdiff = INT64_MAX; + dm->queue[dm->fid].totdiff = INT64_MAX; + } else { + calc_diffs(dm, &dm->queue[dm->fid], prv, in); + } if (++dm->fid != dm->cycle) return 0; av_frame_free(&dm->last); |