FFmpeg
Loading...
Searching...
No Matches
vf_mpdecimate.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003 Rich Felker
3 * Copyright (c) 2012 Stefano Sabatini
4 * Copyright (c) 2026 Dawid Stachowiak
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23/**
24 * @file mpdecimate filter, ported from libmpcodecs/vf_decimate.c by
25 * Rich Felker.
26 */
27
28#include "config.h"
29
30#include "libavutil/bprint.h"
31#include "libavutil/opt.h"
32#include "libavutil/pixdesc.h"
34#include "libavutil/timestamp.h"
35#include "avfilter.h"
36#include "filters.h"
37#include "mpdecimate.h"
38#include "video.h"
39
40typedef enum {
41 DECIMATE_DROP, ///< similar frame, past keep threshold — drop it
42 DECIMATE_KEEP_UPDATE, ///< keep frame and update reference (frame is different, or first frame)
43 DECIMATE_KEEP_NO_UPDATE,///< keep frame without updating reference (similar frame under keep threshold, or forced keep due to max_drop_count)
45
46typedef struct DecimateContext {
47 const AVClass *class;
48 int mode; ///< 0: drop similar frames, 1: drop similar and unique frames
49 int lo, hi; ///< lower and higher threshold number of differences
50 ///< values for 8x8 blocks
51
52 float frac; ///< threshold of changed pixels over the total fraction
53
54 int max_drop_count; ///< for mode 0: if positive: maximum number of sequential frames to drop
55 ///< for mode 0: if negative: minimum number of frames between two drops
56
57 int drop_count; ///< if positive: number of frames sequentially dropped
58 ///< if negative: number of sequential frames which were not dropped
59
60 int max_keep_count; ///< for mode 0: number of similar frames to ignore before to start dropping them
61 int keep_count; ///< for mode 0: number of similar frames already ignored
62
63 int min_dup_count; ///< for mode 1: minimum number of previous frames that need to be duplicated to keep frame
64 int dup_count; ///< for mode 1: number of duplicated frames
65
66 int hsub, vsub; ///< chroma subsampling values
67 int bpp; ///< bytes per sample
68 int hi_thr, lo_thr; ///< hi and lo scaled to the input bit depth
69 AVFrame *ref; ///< reference picture
70 av_pixelutils_sad_fn sad; ///< sum of absolute difference function
72
73#define OFFSET(x) offsetof(DecimateContext, x)
74#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
75
76static const AVOption mpdecimate_options[] = {
77 { "max", "for mode 0: set the maximum number of consecutive dropped frames (positive), or the minimum interval between dropped frames (negative)",
78 OFFSET(max_drop_count), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX, FLAGS },
79 { "keep", "for mode 0: set the number of similar consecutive frames to be kept before starting to drop similar frames",
80 OFFSET(max_keep_count), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
81 { "hi", "set high dropping threshold", OFFSET(hi), AV_OPT_TYPE_INT, {.i64=64*12}, INT_MIN, INT_MAX, FLAGS },
82 { "lo", "set low dropping threshold", OFFSET(lo), AV_OPT_TYPE_INT, {.i64=64*5}, INT_MIN, INT_MAX, FLAGS },
83 { "frac", "set fraction dropping threshold", OFFSET(frac), AV_OPT_TYPE_FLOAT, {.dbl=0.33}, 0, 1, FLAGS },
84 { "mode", "0: drop similar frames, 1: drop similar and unique frames", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },
85 { "min", "for mode 1: set minimum number of previous frames that need to be duplicated to keep current frame",
86 OFFSET(min_dup_count), AV_OPT_TYPE_INT, {.i64=1}, 1, INT_MAX, FLAGS },
87 { NULL }
88};
89
91
92static int sad_8x8_16(const uint8_t *src1, ptrdiff_t stride1,
93 const uint8_t *src2, ptrdiff_t stride2)
94{
95 int sum = 0;
96
97 for (int y = 0; y < 8; y++) {
98 const uint16_t *s1 = (const uint16_t *)(src1 + y * stride1);
99 const uint16_t *s2 = (const uint16_t *)(src2 + y * stride2);
100 for (int x = 0; x < 8; x++)
101 sum += FFABS(s1[x] - s2[x]);
102 }
103
104 return sum;
105}
106
108{
110
111#if ARCH_X86 && HAVE_X86ASM
113#endif
114
115 return sad ? sad : sad_8x8_16;
116}
117
118/**
119 * Return 1 if the two planes are different, 0 otherwise.
120 * The reason is appended to bp, which the caller prints with the frame's
121 * keep/drop decision in a single av_log() call.
122 */
124 uint8_t *cur, int cur_linesize,
125 uint8_t *ref, int ref_linesize,
126 int w, int h, int bpp)
127{
128 DecimateContext *decimate = ctx->priv;
129
130 int x, y;
131 int d, c = 0;
132 int t = (w/16)*(h/16)*decimate->frac;
133 int hi_thr = decimate->hi_thr, lo_thr = decimate->lo_thr;
134
135 /* compute difference for blocks of 8x8 samples */
136 for (y = 0; y < h-7; y += 4) {
137 for (x = 8; x < w-7; x += 4) {
138 d = decimate->sad(cur + y*cur_linesize + x*bpp, cur_linesize,
139 ref + y*ref_linesize + x*bpp, ref_linesize);
140 if (d > hi_thr) {
141 av_bprintf(bp, "%d>=hi ", d);
142 return 1;
143 }
144 if (d > lo_thr) {
145 c++;
146 if (c > t) {
147 av_bprintf(bp, "lo:%d>=%d ", c, t);
148 return 1;
149 }
150 }
151 }
152 }
153
154 av_bprintf(bp, "lo:%d<%d ", c, t);
155 return 0;
156}
157
158static int diff_planes_8(AVFilterContext *ctx, AVBPrint *bp,
159 uint8_t *cur, int cur_linesize,
160 uint8_t *ref, int ref_linesize, int w, int h)
161{
162 return diff_planes(ctx, bp, cur, cur_linesize, ref, ref_linesize, w, h, 1);
163}
164
165static int diff_planes_16(AVFilterContext *ctx, AVBPrint *bp,
166 uint8_t *cur, int cur_linesize,
167 uint8_t *ref, int ref_linesize, int w, int h)
168{
169 return diff_planes(ctx, bp, cur, cur_linesize, ref, ref_linesize, w, h, 2);
170}
171
172/**
173 * Tell if the frame is different with respect to the reference frame ref.
174 */
175static int is_frame_different(AVFilterContext *ctx, AVBPrint *bp,
176 AVFrame *cur, AVFrame *ref)
177{
178 DecimateContext *decimate = ctx->priv;
179 int (*diff)(AVFilterContext *ctx, AVBPrint *bp,
180 uint8_t *cur, int cur_linesize,
181 uint8_t *ref, int ref_linesize, int w, int h) =
182 decimate->bpp == 2 ? diff_planes_16 : diff_planes_8;
183 int plane;
184
185 for (plane = 0; ref->data[plane] && ref->linesize[plane]; plane++) {
186 /* use 8x8 SAD even on subsampled planes. The blocks won't match up with
187 * luma blocks, but hopefully nobody is depending on this to catch
188 * localized chroma changes that wouldn't exceed the thresholds when
189 * diluted by using what's effectively a larger block size.
190 */
191 int vsub = plane == 1 || plane == 2 ? decimate->vsub : 0;
192 int hsub = plane == 1 || plane == 2 ? decimate->hsub : 0;
193 if (diff(ctx, bp,
194 cur->data[plane], cur->linesize[plane],
195 ref->data[plane], ref->linesize[plane],
196 AV_CEIL_RSHIFT(ref->width, hsub),
197 AV_CEIL_RSHIFT(ref->height, vsub)))
198 return 1;
199 }
200
201 return 0;
202}
203
204/**
205 * Tell if the frame should be decimated, for example if it is no much
206 * different with respect to the reference frame ref.
207 */
209 AVFrame *cur, AVFrame *ref)
210{
211 DecimateContext *decimate = ctx->priv;
212 int is_similar = is_frame_different(ctx, bp, cur, ref) == 0;
213
214 if (!is_similar) {
216 }
217 /* Frame is similar - check if we must keep it due to drop limits */
218 if (decimate->max_drop_count > 0 &&
219 decimate->drop_count >= decimate->max_drop_count)
221 if (decimate->max_drop_count < 0 &&
222 (decimate->drop_count - 1) > decimate->max_drop_count)
224
225 /* Frame is similar - check if we must keep it due to keep option */
226 if (decimate->max_keep_count > 0 && decimate->keep_count > -1 &&
227 decimate->keep_count < decimate->max_keep_count) {
228 decimate->keep_count++;
230 }
231 return DECIMATE_DROP;
232}
233
235{
236 DecimateContext *decimate = ctx->priv;
237 av_frame_free(&decimate->ref);
238}
239
270
271static int config_input(AVFilterLink *inlink)
272{
273 AVFilterContext *ctx = inlink->dst;
274 DecimateContext *decimate = ctx->priv;
275 const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
276 int depth = pix_desc->comp[0].depth;
277 /* hi and lo are expressed in 8-bit units */
278 int64_t scale = 1LL << (depth - 8);
279
280 decimate->hsub = pix_desc->log2_chroma_w;
281 decimate->vsub = pix_desc->log2_chroma_h;
282 decimate->bpp = depth > 8 ? 2 : 1;
283 /* an 8x8 SAD is at most 64 * 65535, so clipping to int keeps the decisions */
284 decimate->hi_thr = av_clip64(decimate->hi * scale, INT_MIN, INT_MAX);
285 decimate->lo_thr = av_clip64(decimate->lo * scale, INT_MIN, INT_MAX);
286
287 if (depth > 8)
288 decimate->sad = ff_mpdecimate_get_sad16_fn();
289 else
290 decimate->sad = av_pixelutils_get_sad_fn(3, 3, 0, ctx); // 8x8, not aligned on blocksize
291 if (!decimate->sad)
292 return AVERROR(EINVAL);
293
294 av_log(ctx, AV_LOG_VERBOSE, "%s:%d depth:%d hi:%"PRId64" lo:%"PRId64" frac:%f\n",
295 decimate->mode == 1 ? "min_dup_count" : "max_drop_count",
296 decimate->mode == 1 ? decimate->min_dup_count : decimate->max_drop_count,
297 depth, decimate->hi * scale, decimate->lo * scale, decimate->frac);
298
299 return 0;
300}
301
302static int filter_frame_mode_0(AVFilterLink *inlink, AVFrame *cur)
303{
304 DecimateContext *decimate = inlink->dst->priv;
305 AVFilterLink *outlink = inlink->dst->outputs[0];
306 AVFrame *out = NULL;
307 int ret;
308 AVBPrint bp;
309 DecimateResult result;
310
312 result = decimate->ref ? decimate_frame(inlink->dst, &bp, cur, decimate->ref) : DECIMATE_KEEP_UPDATE;
313
314 switch (result) {
315 case DECIMATE_DROP:
316 decimate->drop_count = FFMAX(1, decimate->drop_count+1);
317 decimate->keep_count = -1;
318 break;
320 decimate->drop_count = FFMIN(-1, decimate->drop_count-1);
321 out = cur;
322 break;
324 out = av_frame_clone(cur);
325 if (!out) {
327 av_frame_free(&cur);
328 return AVERROR(ENOMEM);
329 }
330 av_frame_free(&decimate->ref);
331 decimate->ref = cur;
332 decimate->drop_count = FFMIN(-1, decimate->drop_count-1);
333 decimate->keep_count = 0;
334 break;
335 }
336
337 av_log(inlink->dst, AV_LOG_DEBUG,
338 "%s%s pts:%s pts_time:%s drop_count:%d keep_count:%d\n",
339 bp.str, result == DECIMATE_DROP ? "drop" : "keep",
340 av_ts2str(cur->pts), av_ts2timestr(cur->pts, &inlink->time_base),
341 decimate->drop_count,
342 decimate->keep_count);
344
345 if (result == DECIMATE_DROP) {
346 av_frame_free(&cur);
347 return 0;
348 }
349
350 ret = ff_filter_frame(outlink, out);
351 if (ret < 0)
352 return ret;
353
354 return 0;
355}
356
357static int filter_frame_mode_1(AVFilterLink *inlink, AVFrame *cur)
358{
359 DecimateContext *decimate = inlink->dst->priv;
360 AVFilterLink *outlink = inlink->dst->outputs[0];
361 int ret;
362 AVFrame *out = NULL;
363 AVBPrint bp;
364
366 if (!decimate->ref || is_frame_different(inlink->dst, &bp, cur, decimate->ref)) {
367 AVFrame *ref = av_frame_clone(cur);
368 if (!ref) {
370 av_frame_free(&cur);
371 return AVERROR(ENOMEM);
372 }
373 av_frame_free(&decimate->ref);
374 decimate->ref = ref;
375 decimate->dup_count = 0;
376 } else {
377 decimate->dup_count++;
378 }
379
380 av_log(inlink->dst, AV_LOG_DEBUG,
381 "%s%s pts:%s pts_time:%s dup_count:%d\n",
382 bp.str, decimate->dup_count ==
383 decimate->min_dup_count ? "keep" : "drop", av_ts2str(cur->pts),
384 av_ts2timestr(cur->pts, &inlink->time_base),
385 decimate->dup_count);
387
388 if (decimate->dup_count == decimate->min_dup_count) {
389 out = av_frame_clone(decimate->ref);
390 if (!out) {
391 av_frame_free(&cur);
392 return AVERROR(ENOMEM);
393 }
394 ret = ff_filter_frame(outlink, out);
395 if (ret < 0) {
396 av_frame_free(&cur);
397 return ret;
398 }
399 }
400 av_frame_free(&cur);
401
402 return 0;
403}
404
405static int filter_frame(AVFilterLink *inlink, AVFrame *cur)
406{
407 DecimateContext *decimate = inlink->dst->priv;
408 return decimate->mode == 0 ? filter_frame_mode_0(inlink, cur) : filter_frame_mode_1(inlink, cur);
409}
410
412 {
413 .name = "default",
414 .type = AVMEDIA_TYPE_VIDEO,
415 .config_props = config_input,
416 .filter_frame = filter_frame,
417 },
418};
419
421 .p.name = "mpdecimate",
422 .p.description = NULL_IF_CONFIG_SMALL("Remove near-duplicate frames."),
423 .p.priv_class = &mpdecimate_class,
424 .uninit = uninit,
425 .priv_size = sizeof(DecimateContext),
429};
static int config_input(AVFilterLink *inlink)
const FFFilter ff_vf_mpdecimate
static FILE * out
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1112
Main libavfilter public API header.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition bprint.c:121
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition bprint.c:68
AVBPrint public header.
#define AV_BPRINT_SIZE_AUTOMATIC
#define FLAGS
Definition cmdutils.c:596
#define AV_CEIL_RSHIFT(a, b)
Definition common.h:60
#define av_clip64
Definition common.h:103
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition common.h:74
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
int ret
Definition ffplay.c:391
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition bprint.c:234
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:65
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:486
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
const pixel * src2
static av_always_inline void scale(vec_s32 res[4], vec_s16 res_packed[2], const int shift)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:279
#define FILTER_OUTPUTS(array)
Definition filters.h:280
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:259
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:493
static const AVOption mpdecimate_options[]
DecimateResult
@ DECIMATE_KEEP_NO_UPDATE
keep frame without updating reference (similar frame under keep threshold, or forced keep due to max_...
@ DECIMATE_KEEP_UPDATE
keep frame and update reference (frame is different, or first frame)
@ DECIMATE_DROP
similar frame, past keep threshold — drop it
static int diff_planes_16(AVFilterContext *ctx, AVBPrint *bp, uint8_t *cur, int cur_linesize, uint8_t *ref, int ref_linesize, int w, int h)
static int diff_planes_8(AVFilterContext *ctx, AVBPrint *bp, uint8_t *cur, int cur_linesize, uint8_t *ref, int ref_linesize, int w, int h)
static av_always_inline int diff_planes(AVFilterContext *ctx, AVBPrint *bp, uint8_t *cur, int cur_linesize, uint8_t *ref, int ref_linesize, int w, int h, int bpp)
Return 1 if the two planes are different, 0 otherwise.
av_pixelutils_sad_fn ff_mpdecimate_get_sad16_fn(void)
Get the SAD function for 8x8 blocks of 16-bit samples.
static int filter_frame(AVFilterLink *inlink, AVFrame *cur)
static int config_input(AVFilterLink *inlink)
static int filter_frame_mode_1(AVFilterLink *inlink, AVFrame *cur)
static const AVFilterPad mpdecimate_inputs[]
static int filter_frame_mode_0(AVFilterLink *inlink, AVFrame *cur)
static av_cold void uninit(AVFilterContext *ctx)
static int is_frame_different(AVFilterContext *ctx, AVBPrint *bp, AVFrame *cur, AVFrame *ref)
Tell if the frame is different with respect to the reference frame ref.
#define OFFSET(x)
static DecimateResult decimate_frame(AVFilterContext *ctx, AVBPrint *bp, AVFrame *cur, AVFrame *ref)
Tell if the frame should be decimated, for example if it is no much different with respect to the ref...
static int sad_8x8_16(const uint8_t *src1, ptrdiff_t stride1, const uint8_t *src2, ptrdiff_t stride2)
#define av_always_inline
Definition attributes.h:72
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:97
av_pixelutils_sad_fn av_pixelutils_get_sad_fn(int w_bits, int h_bits, int aligned, void *log_ctx)
Get a potentially optimized pointer to a Sum-of-absolute-differences function (see the av_pixelutils_...
Definition pixelutils.c:82
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
uint8_t w
Definition llvidencdsp.c:39
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
av_pixelutils_sad_fn ff_mpdecimate_get_sad16_fn_x86(void)
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3484
int(* av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, const uint8_t *src2, ptrdiff_t stride2)
Sum of abs(src1[x] - src2[x])
Definition pixelutils.h:28
#define AV_PIX_FMT_YUV420P16
Definition pixfmt.h:559
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:555
#define AV_PIX_FMT_YUV444P9
Definition pixfmt.h:547
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:548
#define AV_PIX_FMT_YUV440P12
Definition pixfmt.h:554
#define AV_PIX_FMT_GBRP9
Definition pixfmt.h:566
#define AV_PIX_FMT_YUV422P9
Definition pixfmt.h:546
#define AV_PIX_FMT_YUVA444P10
Definition pixfmt.h:601
#define AV_PIX_FMT_YUVA420P16
Definition pixfmt.h:604
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:552
#define AV_PIX_FMT_YUVA420P10
Definition pixfmt.h:599
#define AV_PIX_FMT_YUVA422P9
Definition pixfmt.h:597
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:553
#define AV_PIX_FMT_GBRP10
Definition pixfmt.h:567
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:549
#define AV_PIX_FMT_GBRP12
Definition pixfmt.h:568
#define AV_PIX_FMT_YUV420P9
Definition pixfmt.h:545
#define AV_PIX_FMT_YUVA420P9
Definition pixfmt.h:596
#define AV_PIX_FMT_YUVA422P10
Definition pixfmt.h:600
#define AV_PIX_FMT_YUV420P14
Definition pixfmt.h:556
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition pixfmt.h:107
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition pixfmt.h:86
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition pixfmt.h:87
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition pixfmt.h:85
#define AV_PIX_FMT_YUVA422P12
Definition pixfmt.h:602
#define AV_PIX_FMT_YUV422P14
Definition pixfmt.h:557
#define AV_PIX_FMT_YUV422P16
Definition pixfmt.h:560
#define AV_PIX_FMT_YUV440P10
Definition pixfmt.h:550
#define AV_PIX_FMT_YUVA444P16
Definition pixfmt.h:606
#define AV_PIX_FMT_YUVA422P16
Definition pixfmt.h:605
#define AV_PIX_FMT_GBRP16
Definition pixfmt.h:570
#define AV_PIX_FMT_YUV444P14
Definition pixfmt.h:558
#define AV_PIX_FMT_YUVA444P9
Definition pixfmt.h:598
#define AV_PIX_FMT_GBRP14
Definition pixfmt.h:569
#define AV_PIX_FMT_YUVA444P12
Definition pixfmt.h:603
#define AV_PIX_FMT_YUV444P16
Definition pixfmt.h:561
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:551
int depth
Number of bits in the component.
Definition pixdesc.h:57
An instance of a filter.
Definition avfilter.h:279
void * priv
private data for use by the filter
Definition avfilter.h:294
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:291
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:581
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:500
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition frame.h:524
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition pixdesc.h:105
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition pixdesc.h:80
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition pixdesc.h:89
float frac
threshold of changed pixels over the total fraction
AVFrame * ref
reference picture
int max_drop_count
for mode 0: if positive: maximum number of sequential frames to drop for mode 0: if negative: minimum...
int bpp
bytes per sample
int dup_count
for mode 1: number of duplicated frames
int min_dup_count
for mode 1: minimum number of previous frames that need to be duplicated to keep frame
int drop_count
if positive: number of frames sequentially dropped if negative: number of sequential frames which wer...
int mode
0: drop similar frames, 1: drop similar and unique frames
av_pixelutils_sad_fn sad
sum of absolute difference function
int lo_thr
hi and lo scaled to the input bit depth
int max_keep_count
for mode 0: number of similar frames to ignore before to start dropping them
int hi
lower and higher threshold number of differences values for 8x8 blocks
int keep_count
for mode 0: number of similar frames already ignored
int vsub
chroma subsampling values
Definition vf_decimate.c:49
Definition swscale.c:85
#define av_log(a,...)
#define src1
Definition h264pred.c:141
static int ref[MAX_W *MAX_W]
timestamp utils, mostly useful for debugging/logging purposes
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition timestamp.h:54
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition timestamp.h:83
static void hsub(htype *dst, const htype *src, int bins)
Definition vf_median.c:74
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37
static double c[64]