FFmpeg  4.4.8
vf_identity.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * Caculate the Identity between two input videos.
24  */
25 
26 #include "libavutil/avstring.h"
27 #include "libavutil/opt.h"
28 #include "libavutil/pixdesc.h"
29 #include "avfilter.h"
30 #include "filters.h"
31 #include "drawutils.h"
32 #include "formats.h"
33 #include "framesync.h"
34 #include "internal.h"
35 #include "video.h"
36 #include "scene_sad.h"
37 
38 typedef struct IdentityContext {
39  const AVClass *class;
42  uint64_t nb_frames;
43  int is_rgb;
44  int is_msad;
46  int max[4];
47  char comps[4];
50  int planewidth[4];
51  int planeheight[4];
52  uint64_t **scores;
53  unsigned (*filter_line)(const uint8_t *buf, const uint8_t *ref, int w);
55  int jobnr, int nb_jobs);
58 
59 #define OFFSET(x) offsetof(IdentityContext, x)
60 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
61 
62 static unsigned identity_line_8bit(const uint8_t *main_line, const uint8_t *ref_line, int outw)
63 {
64  unsigned score = 0;
65 
66  for (int j = 0; j < outw; j++)
67  score += main_line[j] == ref_line[j];
68 
69  return score;
70 }
71 
72 static unsigned identity_line_16bit(const uint8_t *mmain_line, const uint8_t *rref_line, int outw)
73 {
74  const uint16_t *main_line = (const uint16_t *)mmain_line;
75  const uint16_t *ref_line = (const uint16_t *)rref_line;
76  unsigned score = 0;
77 
78  for (int j = 0; j < outw; j++)
79  score += main_line[j] == ref_line[j];
80 
81  return score;
82 }
83 
84 typedef struct ThreadData {
85  const uint8_t *main_data[4];
86  const uint8_t *ref_data[4];
87  int main_linesize[4];
88  int ref_linesize[4];
89  int planewidth[4];
90  int planeheight[4];
91  uint64_t **score;
93 } ThreadData;
94 
95 static
97  int jobnr, int nb_jobs)
98 {
99  IdentityContext *s = ctx->priv;
100  ThreadData *td = arg;
101  uint64_t *score = td->score[jobnr];
102 
103  for (int c = 0; c < td->nb_components; c++) {
104  const int outw = td->planewidth[c];
105  const int outh = td->planeheight[c];
106  const int slice_start = ff_slice_pos(outh, jobnr, nb_jobs);
107  const int slice_end = ff_slice_pos(outh, jobnr + 1, nb_jobs);
108  const int ref_linesize = td->ref_linesize[c];
109  const int main_linesize = td->main_linesize[c];
110  const uint8_t *main_line = td->main_data[c] + main_linesize * slice_start;
111  const uint8_t *ref_line = td->ref_data[c] + ref_linesize * slice_start;
112  uint64_t m = 0;
113 
114  s->sad(main_line, main_linesize, ref_line, ref_linesize,
115  outw, slice_end - slice_start, &m);
116 
117  score[c] = m;
118  }
119 
120  return 0;
121 }
122 
123 static
125  int jobnr, int nb_jobs)
126 {
127  IdentityContext *s = ctx->priv;
128  ThreadData *td = arg;
129  uint64_t *score = td->score[jobnr];
130 
131  for (int c = 0; c < td->nb_components; c++) {
132  const int outw = td->planewidth[c];
133  const int outh = td->planeheight[c];
134  const int slice_start = ff_slice_pos(outh, jobnr, nb_jobs);
135  const int slice_end = ff_slice_pos(outh, jobnr + 1, nb_jobs);
136  const int ref_linesize = td->ref_linesize[c];
137  const int main_linesize = td->main_linesize[c];
138  const uint8_t *main_line = td->main_data[c] + main_linesize * slice_start;
139  const uint8_t *ref_line = td->ref_data[c] + ref_linesize * slice_start;
140  uint64_t m = 0;
141 
142  for (int i = slice_start; i < slice_end; i++) {
143  m += s->filter_line(main_line, ref_line, outw);
144  ref_line += ref_linesize;
145  main_line += main_linesize;
146  }
147  score[c] = m;
148  }
149 
150  return 0;
151 }
152 
154  AVDictionary **metadata, const char *key, char comp, float d)
155 {
156  char value[128];
157  snprintf(value, sizeof(value), "%f", d);
158  if (comp) {
159  char key2[128];
160  snprintf(key2, sizeof(key2), "lavfi.%s.%s%s%c",
161  ctx->filter->name, ctx->filter->name, key, comp);
162  av_dict_set(metadata, key2, value, 0);
163  } else {
164  char key2[128];
165  snprintf(key2, sizeof(key2), "lavfi.%s.%s%s",
166  ctx->filter->name, ctx->filter->name, key);
167  av_dict_set(metadata, key2, value, 0);
168  }
169 }
170 
172 {
173  AVFilterContext *ctx = fs->parent;
174  IdentityContext *s = ctx->priv;
175  AVFrame *master, *ref;
176  double comp_score[4], score = 0.;
177  uint64_t comp_sum[4] = { 0 };
178  AVDictionary **metadata;
179  ThreadData td;
180  int ret;
181 
183  if (ret < 0)
184  return ret;
185  if (ctx->is_disabled || !ref)
186  return ff_filter_frame(ctx->outputs[0], master);
187  metadata = &master->metadata;
188 
189  td.nb_components = s->nb_components;
190  td.score = s->scores;
191  for (int c = 0; c < s->nb_components; c++) {
192  td.main_data[c] = master->data[c];
193  td.ref_data[c] = ref->data[c];
194  td.main_linesize[c] = master->linesize[c];
195  td.ref_linesize[c] = ref->linesize[c];
196  td.planewidth[c] = s->planewidth[c];
197  td.planeheight[c] = s->planeheight[c];
198  }
199 
200  ctx->internal->execute(ctx, s->filter_slice, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads));
201 
202  for (int j = 0; j < s->nb_threads; j++) {
203  for (int c = 0; c < s->nb_components; c++)
204  comp_sum[c] += s->scores[j][c];
205  }
206 
207  for (int c = 0; c < s->nb_components; c++)
208  comp_score[c] = comp_sum[c] / ((double)s->planewidth[c] * s->planeheight[c]);
209 
210  for (int c = 0; c < s->nb_components && s->is_msad; c++)
211  comp_score[c] /= (double)s->max[c];
212 
213  for (int c = 0; c < s->nb_components; c++)
214  score += comp_score[c];
215  score /= s->nb_components;
216 
217  s->min_score = FFMIN(s->min_score, score);
218  s->max_score = FFMAX(s->max_score, score);
219 
220  s->score += score;
221 
222  for (int j = 0; j < s->nb_components; j++)
223  s->score_comp[j] += comp_score[j];
224  s->nb_frames++;
225 
226  for (int j = 0; j < s->nb_components; j++) {
227  int c = s->is_rgb ? s->rgba_map[j] : j;
228  set_meta(ctx, metadata, ".", s->comps[j], comp_score[c]);
229  }
230  set_meta(ctx, metadata, "_avg", 0, score);
231 
232  return ff_filter_frame(ctx->outputs[0], master);
233 }
234 
236 {
237  IdentityContext *s = ctx->priv;
238 
239  s->fs.on_event = do_identity;
240 
241  return 0;
242 }
243 
245 {
246  static const enum AVPixelFormat pix_fmts[] = {
248 #define PF_NOALPHA(suf) AV_PIX_FMT_YUV420##suf, AV_PIX_FMT_YUV422##suf, AV_PIX_FMT_YUV444##suf
249 #define PF_ALPHA(suf) AV_PIX_FMT_YUVA420##suf, AV_PIX_FMT_YUVA422##suf, AV_PIX_FMT_YUVA444##suf
250 #define PF(suf) PF_NOALPHA(suf), PF_ALPHA(suf)
251  PF(P), PF(P9), PF(P10), PF_NOALPHA(P12), PF_NOALPHA(P14), PF(P16),
259  };
260 
262  if (!fmts_list)
263  return AVERROR(ENOMEM);
264  return ff_set_common_formats(ctx, fmts_list);
265 }
266 
267 static int config_input_ref(AVFilterLink *inlink)
268 {
270  AVFilterContext *ctx = inlink->dst;
271  IdentityContext *s = ctx->priv;
272 
273  s->nb_threads = ff_filter_get_nb_threads(ctx);
274  s->nb_components = desc->nb_components;
275  if (ctx->inputs[0]->w != ctx->inputs[1]->w ||
276  ctx->inputs[0]->h != ctx->inputs[1]->h) {
277  av_log(ctx, AV_LOG_ERROR, "Width and height of input videos must be same.\n");
278  return AVERROR(EINVAL);
279  }
280  if (ctx->inputs[0]->format != ctx->inputs[1]->format) {
281  av_log(ctx, AV_LOG_ERROR, "Inputs must be of same pixel format.\n");
282  return AVERROR(EINVAL);
283  }
284 
285  s->is_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0;
286  s->comps[0] = s->is_rgb ? 'R' : 'Y' ;
287  s->comps[1] = s->is_rgb ? 'G' : 'U' ;
288  s->comps[2] = s->is_rgb ? 'B' : 'V' ;
289  s->comps[3] = 'A';
290 
291  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
292  s->planeheight[0] = s->planeheight[3] = inlink->h;
293  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
294  s->planewidth[0] = s->planewidth[3] = inlink->w;
295 
296  s->scores = av_calloc(s->nb_threads, sizeof(*s->scores));
297  if (!s->scores)
298  return AVERROR(ENOMEM);
299 
300  for (int t = 0; t < s->nb_threads && s->scores; t++) {
301  s->scores[t] = av_calloc(s->nb_components, sizeof(*s->scores[0]));
302  if (!s->scores[t])
303  return AVERROR(ENOMEM);
304  }
305 
306  s->min_score = +INFINITY;
307  s->max_score = -INFINITY;
308 
309  s->max[0] = (1 << desc->comp[0].depth) - 1;
310  s->max[1] = (1 << desc->comp[1].depth) - 1;
311  s->max[2] = (1 << desc->comp[2].depth) - 1;
312  s->max[3] = (1 << desc->comp[3].depth) - 1;
313 
314  s->is_msad = !strcmp(ctx->filter->name, "msad");
315  s->filter_slice = !s->is_msad ? compute_images_identity : compute_images_msad;
316  s->filter_line = desc->comp[0].depth > 8 ? identity_line_16bit : identity_line_8bit;
317 
318  s->sad = ff_scene_sad_get_fn(desc->comp[0].depth <= 8 ? 8 : 16);
319  if (!s->sad)
320  return AVERROR(EINVAL);
321 
322  return 0;
323 }
324 
325 static int config_output(AVFilterLink *outlink)
326 {
327  AVFilterContext *ctx = outlink->src;
328  IdentityContext *s = ctx->priv;
329  AVFilterLink *mainlink = ctx->inputs[0];
330  int ret;
331 
332  ret = ff_framesync_init_dualinput(&s->fs, ctx);
333  if (ret < 0)
334  return ret;
335  outlink->w = mainlink->w;
336  outlink->h = mainlink->h;
337  outlink->time_base = mainlink->time_base;
338  outlink->sample_aspect_ratio = mainlink->sample_aspect_ratio;
339  outlink->frame_rate = mainlink->frame_rate;
340  if ((ret = ff_framesync_configure(&s->fs)) < 0)
341  return ret;
342 
343  outlink->time_base = s->fs.time_base;
344 
345  if (av_cmp_q(mainlink->time_base, outlink->time_base) ||
346  av_cmp_q(ctx->inputs[1]->time_base, outlink->time_base))
347  av_log(ctx, AV_LOG_WARNING, "not matching timebases found between first input: %d/%d and second input %d/%d, results may be incorrect!\n",
348  mainlink->time_base.num, mainlink->time_base.den,
349  ctx->inputs[1]->time_base.num, ctx->inputs[1]->time_base.den);
350 
351  return 0;
352 }
353 
355 {
356  IdentityContext *s = ctx->priv;
357  return ff_framesync_activate(&s->fs);
358 }
359 
361 {
362  IdentityContext *s = ctx->priv;
363 
364  if (s->nb_frames > 0) {
365  char buf[256];
366 
367  buf[0] = 0;
368  for (int j = 0; j < s->nb_components; j++) {
369  int c = s->is_rgb ? s->rgba_map[j] : j;
370  av_strlcatf(buf, sizeof(buf), " %c:%f", s->comps[j], s->score_comp[c] / s->nb_frames);
371  }
372 
373  av_log(ctx, AV_LOG_INFO, "%s%s average:%f min:%f max:%f\n",
374  ctx->filter->name,
375  buf,
376  s->score / s->nb_frames,
377  s->min_score,
378  s->max_score);
379  }
380 
381  ff_framesync_uninit(&s->fs);
382  for (int t = 0; t < s->nb_threads && s->scores; t++)
383  av_freep(&s->scores[t]);
384  av_freep(&s->scores);
385 }
386 
387 static const AVFilterPad identity_inputs[] = {
388  {
389  .name = "main",
390  .type = AVMEDIA_TYPE_VIDEO,
391  },{
392  .name = "reference",
393  .type = AVMEDIA_TYPE_VIDEO,
394  .config_props = config_input_ref,
395  },
396  { NULL }
397 };
398 
399 static const AVFilterPad identity_outputs[] = {
400  {
401  .name = "default",
402  .type = AVMEDIA_TYPE_VIDEO,
403  .config_props = config_output,
404  },
405  { NULL }
406 };
407 
408 static const AVOption options[] = {
409  { NULL }
410 };
411 
412 #if CONFIG_IDENTITY_FILTER
413 
414 #define identity_options options
416 
418  .name = "identity",
419  .description = NULL_IF_CONFIG_SMALL("Calculate the Identity between two video streams."),
420  .preinit = identity_framesync_preinit,
421  .init = init,
422  .uninit = uninit,
423  .query_formats = query_formats,
424  .activate = activate,
425  .priv_size = sizeof(IdentityContext),
426  .priv_class = &identity_class,
430 };
431 
432 #endif /* CONFIG_IDENTITY_FILTER */
433 
434 #if CONFIG_MSAD_FILTER
435 
436 #define msad_options options
438 
440  .name = "msad",
441  .description = NULL_IF_CONFIG_SMALL("Calculate the MSAD between two video streams."),
442  .preinit = msad_framesync_preinit,
443  .init = init,
444  .uninit = uninit,
445  .query_formats = query_formats,
446  .activate = activate,
447  .priv_size = sizeof(IdentityContext),
448  .priv_class = &msad_class,
452 };
453 
454 #endif /* CONFIG_MSAD_FILTER */
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
AVFilter ff_vf_identity
AVFilter ff_vf_msad
#define av_cold
Definition: attributes.h:88
uint8_t
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1096
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
Main libavfilter public API header.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:101
#define flags(name, subs,...)
Definition: cbs_av1.c:572
#define s(width, name)
Definition: cbs_vp9.c:257
#define fs(width, name, subs,...)
Definition: cbs_vp9.c:259
#define FFMIN(a, b)
Definition: common.h:105
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
#define FFMAX(a, b)
Definition: common.h:103
#define NULL
Definition: coverity.c:32
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
Definition: drawutils.c:35
misc drawing utilities
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition: eamad.c:85
double value
Definition: eval.c:100
int
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
Definition: filters.h:271
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:587
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:286
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Definition: framesync.c:124
int ff_framesync_dualinput_get(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
Definition: framesync.c:376
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
Definition: framesync.c:341
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
Definition: framesync.c:358
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
Definition: framesync.c:290
#define FRAMESYNC_DEFINE_CLASS(name, context, field)
Definition: framesync.h:302
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:134
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:70
#define AVERROR(e)
Definition: error.h:43
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
#define AV_LOG_INFO
Standard information.
Definition: log.h:205
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:245
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
for(j=16;j >0;--j)
const char * key
int i
Definition: input.c:407
const char * arg
Definition: jacosubdec.c:66
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:309
const char * desc
Definition: libsvtav1.c:79
uint8_t w
Definition: llviddspenc.c:39
#define INFINITY
Definition: mathematics.h:67
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2033
#define P
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:420
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:379
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:414
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:415
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:381
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:416
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
@ 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:100
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
@ 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:79
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
@ 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:80
@ 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:78
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:380
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:382
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:383
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:419
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:418
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:417
#define td
Definition: regdef.h:70
ff_scene_sad_fn ff_scene_sad_get_fn(int depth)
Definition: scene_sad.c:59
Scene SAD functions.
void(* ff_scene_sad_fn)(SCENE_SAD_PARAMS)
Definition: scene_sad.h:34
#define snprintf
Definition: snprintf.h:34
Describe the class of an AVClass context structure.
Definition: log.h:67
An instance of a filter.
Definition: avfilter.h:341
A list of supported formats for one end of a filter link.
Definition: formats.h:65
A filter pad used for either input or output.
Definition: internal.h:54
const char * name
Pad name.
Definition: internal.h:60
Filter definition.
Definition: avfilter.h:145
const char * name
Filter name.
Definition: avfilter.h:149
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1699
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
AVOption.
Definition: opt.h:248
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
int num
Numerator.
Definition: rational.h:59
int den
Denominator.
Definition: rational.h:60
Frame sync structure.
Definition: framesync.h:146
unsigned(* filter_line)(const uint8_t *buf, const uint8_t *ref, int w)
Definition: vf_identity.c:53
double min_score
Definition: vf_identity.c:41
ff_scene_sad_fn sad
Definition: vf_identity.c:56
uint64_t ** scores
Definition: vf_identity.c:52
int(* filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_identity.c:54
double score_comp[4]
Definition: vf_identity.c:41
FFFrameSync fs
Definition: vf_identity.c:40
int planeheight[4]
Definition: vf_identity.c:51
double max_score
Definition: vf_identity.c:41
uint8_t rgba_map[4]
Definition: vf_identity.c:45
uint64_t nb_frames
Definition: vf_identity.c:42
int planewidth[4]
Definition: vf_identity.c:50
Used for passing data between threads.
Definition: dsddec.c:67
int nb_components
Definition: vf_identity.c:92
int planeheight[4]
Definition: vf_identity.c:90
uint64_t ** score
Definition: vf_identity.c:91
const uint8_t * ref_data[4]
Definition: vf_identity.c:86
int main_linesize[4]
Definition: vf_identity.c:87
int planewidth[4]
Definition: vf_identity.c:89
const uint8_t * main_data[4]
Definition: vf_identity.c:85
int ref_linesize
Definition: vf_bm3d.c:59
#define av_freep(p)
#define av_log(a,...)
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:107
AVFormatContext * ctx
Definition: movenc.c:48
const char * master
Definition: vf_curves.c:120
static int do_identity(FFFrameSync *fs)
Definition: vf_identity.c:171
#define PF_NOALPHA(suf)
static const AVOption options[]
Definition: vf_identity.c:408
static int compute_images_identity(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_identity.c:124
static int query_formats(AVFilterContext *ctx)
Definition: vf_identity.c:244
static const AVFilterPad identity_inputs[]
Definition: vf_identity.c:387
static unsigned identity_line_16bit(const uint8_t *mmain_line, const uint8_t *rref_line, int outw)
Definition: vf_identity.c:72
static int compute_images_msad(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_identity.c:96
static void set_meta(AVFilterContext *ctx, AVDictionary **metadata, const char *key, char comp, float d)
Definition: vf_identity.c:153
static int config_input_ref(AVFilterLink *inlink)
Definition: vf_identity.c:267
#define PF(suf)
static const AVFilterPad identity_outputs[]
Definition: vf_identity.c:399
static int activate(AVFilterContext *ctx)
Definition: vf_identity.c:354
static av_cold int init(AVFilterContext *ctx)
Definition: vf_identity.c:235
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_identity.c:360
static int config_output(AVFilterLink *outlink)
Definition: vf_identity.c:325
static unsigned identity_line_8bit(const uint8_t *main_line, const uint8_t *ref_line, int outw)
Definition: vf_identity.c:62
static double c[64]