FFmpeg
vf_fftfilt.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Arwa Arif <arwaarif1994@gmail.com>
3  * Copyright (c) 2017 Paul B Mahol
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published
9  * by the Free Software Foundation; either version 2.1 of the License,
10  * or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * FFT domain filtering.
25  */
26 
27 #include "filters.h"
28 #include "video.h"
29 #include "libavutil/common.h"
30 #include "libavutil/cpu.h"
31 #include "libavutil/mem.h"
32 #include "libavutil/opt.h"
33 #include "libavutil/pixdesc.h"
34 #include "libavutil/tx.h"
35 #include "libavutil/eval.h"
36 
37 #define MAX_THREADS 32
38 #define MAX_PLANES 4
39 
40 enum EvalMode {
44 };
45 
46 typedef struct FFTFILTContext {
47  const AVClass *class;
48 
49  int eval_mode;
50  int depth;
51  int nb_planes;
55 
60 
63 
74 
75  int dc[MAX_PLANES];
78  double *weight[MAX_PLANES];
79 
80  int (*rdft_horizontal)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
81  int (*irdft_horizontal)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
83 
84 static const char *const var_names[] = { "X", "Y", "W", "H", "N", "WS", "HS", NULL };
86 
87 enum { Y = 0, U, V };
88 
89 #define OFFSET(x) offsetof(FFTFILTContext, x)
90 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
91 
92 static const AVOption fftfilt_options[] = {
93  { "dc_Y", "adjust gain in Y plane", OFFSET(dc[Y]), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1000, FLAGS },
94  { "dc_U", "adjust gain in U plane", OFFSET(dc[U]), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1000, FLAGS },
95  { "dc_V", "adjust gain in V plane", OFFSET(dc[V]), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1000, FLAGS },
96  { "weight_Y", "set luminance expression in Y plane", OFFSET(weight_str[Y]), AV_OPT_TYPE_STRING, {.str = "1"}, 0, 0, FLAGS },
97  { "weight_U", "set chrominance expression in U plane", OFFSET(weight_str[U]), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
98  { "weight_V", "set chrominance expression in V plane", OFFSET(weight_str[V]), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
99  { "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_INIT}, 0, EVAL_MODE_NB-1, FLAGS, .unit = "eval" },
100  { "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" },
101  { "frame", "eval expressions per-frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
102  {NULL},
103 };
104 
105 AVFILTER_DEFINE_CLASS(fftfilt);
106 
107 static inline double lum(void *priv, double x, double y, int plane)
108 {
109  FFTFILTContext *s = priv;
110  return s->rdft_vdata_out[plane][(int)x * s->rdft_vstride[plane] + (int)y];
111 }
112 
113 static double weight_Y(void *priv, double x, double y) { return lum(priv, x, y, Y); }
114 static double weight_U(void *priv, double x, double y) { return lum(priv, x, y, U); }
115 static double weight_V(void *priv, double x, double y) { return lum(priv, x, y, V); }
116 
117 static void copy_rev(float *dest, int w, int w2)
118 {
119  int i;
120 
121  for (i = w; i < w + (w2-w)/2; i++)
122  dest[i] = dest[2*w - i - 1];
123 
124  for (; i < w2; i++)
125  dest[i] = dest[w2 - i];
126 }
127 
128 static int rdft_horizontal8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
129 {
130  FFTFILTContext *s = ctx->priv;
131  AVFrame *in = arg;
132 
133  for (int plane = 0; plane < s->nb_planes; plane++) {
134  const int w = s->planewidth[plane];
135  const int h = s->planeheight[plane];
136  const int slice_start = (h * jobnr) / nb_jobs;
137  const int slice_end = (h * (jobnr+1)) / nb_jobs;
138 
139  for (int i = slice_start; i < slice_end; i++) {
140  const uint8_t *src = in->data[plane] + i * in->linesize[plane];
141  float *hdata_in = s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane];
142 
143  for (int j = 0; j < w; j++)
144  hdata_in[j] = src[j];
145 
146  copy_rev(s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane], w, s->rdft_hlen[plane]);
147  }
148 
149  for (int i = slice_start; i < slice_end; i++)
150  s->htx_fn(s->hrdft[jobnr][plane],
151  s->rdft_hdata_out[plane] + i * s->rdft_hstride[plane],
152  s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane],
153  sizeof(float));
154  }
155 
156  return 0;
157 }
158 
159 static int rdft_horizontal16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
160 {
161  FFTFILTContext *s = ctx->priv;
162  AVFrame *in = arg;
163 
164  for (int plane = 0; plane < s->nb_planes; plane++) {
165  const int w = s->planewidth[plane];
166  const int h = s->planeheight[plane];
167  const int slice_start = (h * jobnr) / nb_jobs;
168  const int slice_end = (h * (jobnr+1)) / nb_jobs;
169 
170  for (int i = slice_start; i < slice_end; i++) {
171  const uint16_t *src = (const uint16_t *)(in->data[plane] + i * in->linesize[plane]);
172  float *hdata_in = s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane];
173 
174  for (int j = 0; j < w; j++)
175  hdata_in[j] = src[j];
176 
177  copy_rev(s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane], w, s->rdft_hlen[plane]);
178  }
179 
180  for (int i = slice_start; i < slice_end; i++)
181  s->htx_fn(s->hrdft[jobnr][plane],
182  s->rdft_hdata_out[plane] + i * s->rdft_hstride[plane],
183  s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane],
184  sizeof(float));
185  }
186 
187  return 0;
188 }
189 
190 static int irdft_horizontal8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
191 {
192  FFTFILTContext *s = ctx->priv;
193  AVFrame *out = arg;
194 
195  for (int plane = 0; plane < s->nb_planes; plane++) {
196  const int w = s->planewidth[plane];
197  const int h = s->planeheight[plane];
198  const int slice_start = (h * jobnr) / nb_jobs;
199  const int slice_end = (h * (jobnr+1)) / nb_jobs;
200 
201  for (int i = slice_start; i < slice_end; i++)
202  s->ihtx_fn(s->ihrdft[jobnr][plane],
203  s->rdft_hdata_out[plane] + i * s->rdft_hstride[plane],
204  s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane],
205  sizeof(AVComplexFloat));
206 
207  for (int i = slice_start; i < slice_end; i++) {
208  const float scale = 1.f / (s->rdft_hlen[plane] * s->rdft_vlen[plane]);
209  const float *src = s->rdft_hdata_out[plane] + i * s->rdft_hstride[plane];
210  uint8_t *dst = out->data[plane] + i * out->linesize[plane];
211 
212  for (int j = 0; j < w; j++)
213  dst[j] = av_clip_uint8(lrintf(src[j] * scale));
214  }
215  }
216 
217  return 0;
218 }
219 
220 static int irdft_horizontal16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
221 {
222  FFTFILTContext *s = ctx->priv;
223  AVFrame *out = arg;
224 
225  for (int plane = 0; plane < s->nb_planes; plane++) {
226  int max = (1 << s->depth) - 1;
227  const int w = s->planewidth[plane];
228  const int h = s->planeheight[plane];
229  const int slice_start = (h * jobnr) / nb_jobs;
230  const int slice_end = (h * (jobnr+1)) / nb_jobs;
231 
232  for (int i = slice_start; i < slice_end; i++)
233  s->ihtx_fn(s->ihrdft[jobnr][plane],
234  s->rdft_hdata_out[plane] + i * s->rdft_hstride[plane],
235  s->rdft_hdata_in[plane] + i * s->rdft_hstride[plane],
236  sizeof(AVComplexFloat));
237 
238  for (int i = slice_start; i < slice_end; i++) {
239  const float scale = 1.f / (s->rdft_hlen[plane] * s->rdft_vlen[plane]);
240  const float *src = s->rdft_hdata_out[plane] + i * s->rdft_hstride[plane];
241  uint16_t *dst = (uint16_t *)(out->data[plane] + i * out->linesize[plane]);
242 
243  for (int j = 0; j < w; j++)
244  dst[j] = av_clip(lrintf(src[j] * scale), 0, max);
245  }
246  }
247 
248  return 0;
249 }
250 
252 {
253  FFTFILTContext *s = ctx->priv;
254  int ret = 0, plane;
255 
256  if (!s->dc[U] && !s->dc[V]) {
257  s->dc[U] = s->dc[Y];
258  s->dc[V] = s->dc[Y];
259  } else {
260  if (!s->dc[U]) s->dc[U] = s->dc[V];
261  if (!s->dc[V]) s->dc[V] = s->dc[U];
262  }
263 
264  if (!s->weight_str[U] && !s->weight_str[V]) {
265  s->weight_str[U] = av_strdup(s->weight_str[Y]);
266  s->weight_str[V] = av_strdup(s->weight_str[Y]);
267  } else {
268  if (!s->weight_str[U]) s->weight_str[U] = av_strdup(s->weight_str[V]);
269  if (!s->weight_str[V]) s->weight_str[V] = av_strdup(s->weight_str[U]);
270  }
271 
272  for (plane = 0; plane < 3; plane++) {
273  static double (*p[])(void *, double, double) = { weight_Y, weight_U, weight_V };
274  const char *const func2_names[] = {"weight_Y", "weight_U", "weight_V", NULL };
275  double (*func2[])(void *, double, double) = { weight_Y, weight_U, weight_V, p[plane], NULL };
276 
277  ret = av_expr_parse(&s->weight_expr[plane], s->weight_str[plane], var_names,
278  NULL, NULL, func2_names, func2, 0, ctx);
279  if (ret < 0)
280  break;
281  }
282  return ret;
283 }
284 
285 static void do_eval(FFTFILTContext *s, AVFilterLink *inlink, int plane)
286 {
288  double values[VAR_VARS_NB];
289  int i, j;
290 
292  values[VAR_W] = s->planewidth[plane];
293  values[VAR_H] = s->planeheight[plane];
294  values[VAR_WS] = s->rdft_hlen[plane];
295  values[VAR_HS] = s->rdft_vlen[plane];
296 
297  for (i = 0; i < s->rdft_hlen[plane]; i++) {
298  values[VAR_X] = i;
299  for (j = 0; j < s->rdft_vlen[plane]; j++) {
300  values[VAR_Y] = j;
301  s->weight[plane][i * s->rdft_vlen[plane] + j] =
302  av_expr_eval(s->weight_expr[plane], values, s);
303  }
304  }
305 }
306 
308 {
309  FFTFILTContext *s = inlink->dst->priv;
310  const AVPixFmtDescriptor *desc;
311  int ret, i, plane;
312 
313  desc = av_pix_fmt_desc_get(inlink->format);
314  s->depth = desc->comp[0].depth;
315  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
316  s->planewidth[0] = s->planewidth[3] = inlink->w;
317  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
318  s->planeheight[0] = s->planeheight[3] = inlink->h;
319 
320  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
321  s->nb_threads = FFMIN(32, ff_filter_get_nb_threads(inlink->dst));
322 
323  for (i = 0; i < desc->nb_components; i++) {
324  int w = s->planewidth[i];
325  int h = s->planeheight[i];
326 
327  /* RDFT - Array initialization for Horizontal pass*/
328  s->rdft_hlen[i] = 1 << (32 - ff_clz(w));
329  s->rdft_hstride[i] = FFALIGN(s->rdft_hlen[i] + 2, av_cpu_max_align());
330  s->rdft_hbits[i] = av_log2(s->rdft_hlen[i]);
331  if (!(s->rdft_hdata_in[i] = av_calloc(h, s->rdft_hstride[i] * sizeof(float))))
332  return AVERROR(ENOMEM);
333 
334  if (!(s->rdft_hdata_out[i] = av_calloc(h, s->rdft_hstride[i] * sizeof(float))))
335  return AVERROR(ENOMEM);
336 
337  for (int j = 0; j < s->nb_threads; j++) {
338  float scale = 1.f, iscale = 1.f;
339 
340  ret = av_tx_init(&s->hrdft[j][i], &s->htx_fn, AV_TX_FLOAT_RDFT,
341  0, 1 << s->rdft_hbits[i], &scale, 0);
342  if (ret < 0)
343  return ret;
344  ret = av_tx_init(&s->ihrdft[j][i], &s->ihtx_fn, AV_TX_FLOAT_RDFT,
345  1, 1 << s->rdft_hbits[i], &iscale, 0);
346  if (ret < 0)
347  return ret;
348  }
349 
350  /* RDFT - Array initialization for Vertical pass*/
351  s->rdft_vlen[i] = 1 << (32 - ff_clz(h));
352  s->rdft_vstride[i] = FFALIGN(s->rdft_vlen[i] + 2, av_cpu_max_align());
353  s->rdft_vbits[i] = av_log2(s->rdft_vlen[i]);
354  if (!(s->rdft_vdata_in[i] = av_calloc(s->rdft_hstride[i], s->rdft_vstride[i] * sizeof(float))))
355  return AVERROR(ENOMEM);
356 
357  if (!(s->rdft_vdata_out[i] = av_calloc(s->rdft_hstride[i], s->rdft_vstride[i] * sizeof(float))))
358  return AVERROR(ENOMEM);
359 
360  for (int j = 0; j < s->nb_threads; j++) {
361  float scale = 1.f, iscale = 1.f;
362 
363  ret = av_tx_init(&s->vrdft[j][i], &s->vtx_fn, AV_TX_FLOAT_RDFT,
364  0, 1 << s->rdft_vbits[i], &scale, 0);
365  if (ret < 0)
366  return ret;
367  ret = av_tx_init(&s->ivrdft[j][i], &s->ivtx_fn, AV_TX_FLOAT_RDFT,
368  1, 1 << s->rdft_vbits[i], &iscale, 0);
369  if (ret < 0)
370  return ret;
371  }
372  }
373 
374  /*Luminance value - Array initialization*/
375  for (plane = 0; plane < 3; plane++) {
376  if(!(s->weight[plane] = av_calloc(s->rdft_hlen[plane], s->rdft_vlen[plane] * sizeof(double))))
377  return AVERROR(ENOMEM);
378 
379  if (s->eval_mode == EVAL_MODE_INIT)
380  do_eval(s, inlink, plane);
381  }
382 
383  if (s->depth <= 8) {
384  s->rdft_horizontal = rdft_horizontal8;
385  s->irdft_horizontal = irdft_horizontal8;
386  } else {
387  s->rdft_horizontal = rdft_horizontal16;
388  s->irdft_horizontal = irdft_horizontal16;
389  }
390  return 0;
391 }
392 
393 static int multiply_data(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
394 {
395  FFTFILTContext *s = ctx->priv;
396 
397  for (int plane = 0; plane < s->nb_planes; plane++) {
398  const int height = s->rdft_hlen[plane];
399  const int slice_start = (height * jobnr) / nb_jobs;
400  const int slice_end = (height * (jobnr+1)) / nb_jobs;
401  /*Change user defined parameters*/
402  for (int i = slice_start; i < slice_end; i++) {
403  const double *weight = s->weight[plane] + i * s->rdft_vlen[plane];
404  float *vdata = s->rdft_vdata_out[plane] + i * s->rdft_vstride[plane];
405 
406  for (int j = 0; j < s->rdft_vlen[plane]; j++)
407  vdata[j] *= weight[j];
408  }
409  }
410 
411  return 0;
412 }
413 
414 static int copy_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
415 {
416  FFTFILTContext *s = ctx->priv;
417 
418  for (int plane = 0; plane < s->nb_planes; plane++) {
419  const int hlen = s->rdft_hlen[plane];
420  const int vlen = s->rdft_vlen[plane];
421  const int hstride = s->rdft_hstride[plane];
422  const int vstride = s->rdft_vstride[plane];
423  const int slice_start = (hlen * jobnr) / nb_jobs;
424  const int slice_end = (hlen * (jobnr+1)) / nb_jobs;
425  const int h = s->planeheight[plane];
426  float *hdata = s->rdft_hdata_out[plane];
427  float *vdata = s->rdft_vdata_in[plane];
428 
429  for (int i = slice_start; i < slice_end; i++) {
430  for (int j = 0; j < h; j++)
431  vdata[i * vstride + j] = hdata[j * hstride + i];
432  copy_rev(vdata + i * vstride, h, vlen);
433  }
434  }
435 
436  return 0;
437 }
438 
439 static int rdft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
440 {
441  FFTFILTContext *s = ctx->priv;
442 
443  for (int plane = 0; plane < s->nb_planes; plane++) {
444  const int height = s->rdft_hlen[plane];
445  const int slice_start = (height * jobnr) / nb_jobs;
446  const int slice_end = (height * (jobnr+1)) / nb_jobs;
447 
448  for (int i = slice_start; i < slice_end; i++)
449  s->vtx_fn(s->vrdft[jobnr][plane],
450  s->rdft_vdata_out[plane] + i * s->rdft_vstride[plane],
451  s->rdft_vdata_in[plane] + i * s->rdft_vstride[plane],
452  sizeof(float));
453  }
454 
455  return 0;
456 }
457 
458 static int irdft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
459 {
460  FFTFILTContext *s = ctx->priv;
461 
462  for (int plane = 0; plane < s->nb_planes; plane++) {
463  const int height = s->rdft_hlen[plane];
464  const int slice_start = (height * jobnr) / nb_jobs;
465  const int slice_end = (height * (jobnr+1)) / nb_jobs;
466 
467  for (int i = slice_start; i < slice_end; i++)
468  s->ivtx_fn(s->ivrdft[jobnr][plane],
469  s->rdft_vdata_in[plane] + i * s->rdft_vstride[plane],
470  s->rdft_vdata_out[plane] + i * s->rdft_vstride[plane],
471  sizeof(AVComplexFloat));
472  }
473 
474  return 0;
475 }
476 
477 static int copy_horizontal(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
478 {
479  FFTFILTContext *s = ctx->priv;
480 
481  for (int plane = 0; plane < s->nb_planes; plane++) {
482  const int hlen = s->rdft_hlen[plane];
483  const int hstride = s->rdft_hstride[plane];
484  const int vstride = s->rdft_vstride[plane];
485  const int slice_start = (hlen * jobnr) / nb_jobs;
486  const int slice_end = (hlen * (jobnr+1)) / nb_jobs;
487  const int h = s->planeheight[plane];
488  float *hdata = s->rdft_hdata_in[plane];
489  float *vdata = s->rdft_vdata_in[plane];
490 
491  for (int i = slice_start; i < slice_end; i++)
492  for (int j = 0; j < h; j++)
493  hdata[j * hstride + i] = vdata[i * vstride + j];
494  }
495 
496  return 0;
497 }
498 
500 {
501  AVFilterContext *ctx = inlink->dst;
502  AVFilterLink *outlink = inlink->dst->outputs[0];
503  FFTFILTContext *s = ctx->priv;
504  AVFrame *out;
505 
506  out = ff_get_video_buffer(outlink, inlink->w, inlink->h);
507  if (!out) {
508  av_frame_free(&in);
509  return AVERROR(ENOMEM);
510  }
511 
513 
514  ff_filter_execute(ctx, s->rdft_horizontal, in, NULL,
515  FFMIN(s->planeheight[1], s->nb_threads));
516 
518  FFMIN(s->planeheight[1], s->nb_threads));
519 
521  FFMIN(s->planeheight[1], s->nb_threads));
522 
523  for (int plane = 0; plane < s->nb_planes; plane++) {
524  if (s->eval_mode == EVAL_MODE_FRAME)
525  do_eval(s, inlink, plane);
526  }
527 
529  FFMIN(s->planeheight[1], s->nb_threads));
530 
531  for (int plane = 0; plane < s->nb_planes; plane++)
532  s->rdft_vdata_out[plane][0] += s->rdft_hlen[plane] * s->rdft_vlen[plane] * s->dc[plane] * (1 << (s->depth - 8));
533 
535  FFMIN(s->planeheight[1], s->nb_threads));
536 
538  FFMIN(s->planeheight[1], s->nb_threads));
539 
540  ff_filter_execute(ctx, s->irdft_horizontal, out, NULL,
541  FFMIN(s->planeheight[1], s->nb_threads));
542 
543  av_frame_free(&in);
544  return ff_filter_frame(outlink, out);
545 }
546 
548 {
549  FFTFILTContext *s = ctx->priv;
550 
551  for (int i = 0; i < MAX_PLANES; i++) {
552  av_freep(&s->rdft_hdata_in[i]);
553  av_freep(&s->rdft_vdata_in[i]);
554  av_freep(&s->rdft_hdata_out[i]);
555  av_freep(&s->rdft_vdata_out[i]);
556  av_expr_free(s->weight_expr[i]);
557  av_freep(&s->weight[i]);
558  for (int j = 0; j < s->nb_threads; j++) {
559  av_tx_uninit(&s->hrdft[j][i]);
560  av_tx_uninit(&s->ihrdft[j][i]);
561  av_tx_uninit(&s->vrdft[j][i]);
562  av_tx_uninit(&s->ivrdft[j][i]);
563  }
564  }
565 }
566 
567 static const enum AVPixelFormat pixel_fmts_fftfilt[] = {
584 };
585 
586 static const AVFilterPad fftfilt_inputs[] = {
587  {
588  .name = "default",
589  .type = AVMEDIA_TYPE_VIDEO,
590  .config_props = config_props,
591  .filter_frame = filter_frame,
592  },
593 };
594 
596  .name = "fftfilt",
597  .description = NULL_IF_CONFIG_SMALL("Apply arbitrary expressions to pixels in frequency domain."),
598  .priv_size = sizeof(FFTFILTContext),
599  .priv_class = &fftfilt_class,
603  .init = initialize,
604  .uninit = uninit,
606 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:116
FFTFILTContext::hrdft
AVTXContext * hrdft[MAX_THREADS][MAX_PLANES]
Definition: vf_fftfilt.c:56
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
av_clip
#define av_clip
Definition: common.h:100
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
rdft_horizontal8
static int rdft_horizontal8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:128
rdft_vertical
static int rdft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:439
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
out
FILE * out
Definition: movenc.c:55
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1023
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
config_props
static int config_props(AVFilterLink *inlink)
Definition: vf_fftfilt.c:307
FFTFILTContext::rdft_vdata_in
float * rdft_vdata_in[MAX_PLANES]
Definition: vf_fftfilt.c:71
irdft_vertical
static int irdft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:458
AVTXContext
Definition: tx_priv.h:235
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
FFTFILTContext::ivtx_fn
av_tx_fn ivtx_fn
Definition: vf_fftfilt.c:62
ff_clz
#define ff_clz
Definition: intmath.h:143
U
@ U
Definition: vf_fftfilt.c:87
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:162
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
pixdesc.h
w
uint8_t w
Definition: llviddspenc.c:38
FFTFILTContext::rdft_vbits
int rdft_vbits[MAX_PLANES]
Definition: vf_fftfilt.c:65
AVOption
AVOption.
Definition: opt.h:429
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
irdft_horizontal16
static int irdft_horizontal16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:220
AVComplexFloat
Definition: tx.h:27
VAR_N
@ VAR_N
Definition: vf_fftfilt.c:85
max
#define max(a, b)
Definition: cuda_runtime.h:33
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
video.h
av_tx_init
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
Definition: tx.c:903
func2_names
static const char *const func2_names[]
Definition: af_afftfilt.c:98
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:458
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:410
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fftfilt.c:547
FFTFILTContext::irdft_horizontal
int(* irdft_horizontal)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:81
av_expr_parse
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
Definition: eval.c:710
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3005
FFTFILTContext::nb_threads
int nb_threads
Definition: vf_fftfilt.c:52
EVAL_MODE_FRAME
@ EVAL_MODE_FRAME
Definition: vf_fftfilt.c:42
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
Definition: mpeg12dec.c:1719
do_eval
static void do_eval(FFTFILTContext *s, AVFilterLink *inlink, int plane)
Definition: vf_fftfilt.c:285
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
MAX_THREADS
#define MAX_THREADS
Definition: vf_fftfilt.c:37
weight
const h264_weight_func weight
Definition: h264dsp_init.c:33
FFTFILTContext::rdft_vstride
size_t rdft_vstride[MAX_PLANES]
Definition: vf_fftfilt.c:67
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:462
av_expr_free
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:358
copy_rev
static void copy_rev(float *dest, int w, int w2)
Definition: vf_fftfilt.c:117
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
FFTFILTContext::planewidth
int planewidth[MAX_PLANES]
Definition: vf_fftfilt.c:53
FFTFILTContext::eval_mode
int eval_mode
Definition: vf_fftfilt.c:49
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
VAR_VARS_NB
@ VAR_VARS_NB
Definition: vf_fftfilt.c:85
func2
static double(*const func2[])(void *, double, double)
Definition: af_afftfilt.c:99
FFTFILTContext::ivrdft
AVTXContext * ivrdft[MAX_THREADS][MAX_PLANES]
Definition: vf_fftfilt.c:59
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:490
av_tx_fn
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
Definition: tx.h:151
ff_video_default_filterpad
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
FFTFILTContext::rdft_horizontal
int(* rdft_horizontal)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:80
AV_PIX_FMT_YUVJ422P
@ 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
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:491
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
FFTFILTContext::rdft_vlen
size_t rdft_vlen[MAX_PLANES]
Definition: vf_fftfilt.c:69
FFTFILTContext::dc
int dc[MAX_PLANES]
Definition: vf_fftfilt.c:75
filters.h
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:475
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:489
ctx
AVFormatContext * ctx
Definition: movenc.c:49
av_expr_eval
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:792
MAX_PLANES
#define MAX_PLANES
Definition: vf_fftfilt.c:38
OFFSET
#define OFFSET(x)
Definition: vf_fftfilt.c:89
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:461
FFTFILTContext::depth
int depth
Definition: vf_fftfilt.c:50
AVExpr
Definition: eval.c:158
VAR_Y
@ VAR_Y
Definition: vf_fftfilt.c:85
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
ff_vf_fftfilt
const AVFilter ff_vf_fftfilt
Definition: vf_fftfilt.c:595
V
@ V
Definition: vf_fftfilt.c:87
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AV_PIX_FMT_YUVJ444P
@ 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
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:459
FFTFILTContext::ihtx_fn
av_tx_fn ihtx_fn
Definition: vf_fftfilt.c:61
irdft_horizontal8
static int irdft_horizontal8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:190
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
FFTFILTContext::planeheight
int planeheight[MAX_PLANES]
Definition: vf_fftfilt.c:54
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:713
FFTFILTContext::rdft_hlen
size_t rdft_hlen[MAX_PLANES]
Definition: vf_fftfilt.c:68
AV_PIX_FMT_YUVJ420P
@ 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
copy_horizontal
static int copy_horizontal(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:477
double
double
Definition: af_crystalizer.c:132
av_cpu_max_align
size_t av_cpu_max_align(void)
Get the maximum data alignment that may be required by FFmpeg.
Definition: cpu.c:276
FFTFILTContext::htx_fn
av_tx_fn htx_fn
Definition: vf_fftfilt.c:61
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
initialize
static av_cold int initialize(AVFilterContext *ctx)
Definition: vf_fftfilt.c:251
fftfilt_options
static const AVOption fftfilt_options[]
Definition: vf_fftfilt.c:92
ff_filter_link
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition: filters.h:197
VAR_X
@ VAR_X
Definition: vf_fftfilt.c:85
eval.h
Y
@ Y
Definition: vf_fftfilt.c:87
FFTFILTContext::rdft_vdata_out
float * rdft_vdata_out[MAX_PLANES]
Definition: vf_fftfilt.c:73
FFTFILTContext::weight_str
char * weight_str[MAX_PLANES]
Definition: vf_fftfilt.c:76
dc
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff) *mv_scale Intra DC Prediction block[y][x] dc[1]
Definition: snow.txt:400
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
height
#define height
Definition: dsp.h:85
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
cpu.h
FFTFILTContext
Definition: vf_fftfilt.c:46
FFTFILTContext::vtx_fn
av_tx_fn vtx_fn
Definition: vf_fftfilt.c:62
VAR_WS
@ VAR_WS
Definition: vf_fftfilt.c:85
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:483
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:485
copy_vertical
static int copy_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:414
av_tx_uninit
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
Definition: tx.c:295
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:182
VAR_W
@ VAR_W
Definition: vf_fftfilt.c:85
lrintf
#define lrintf(x)
Definition: libm_mips.h:72
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
FFTFILTContext::rdft_hbits
int rdft_hbits[MAX_PLANES]
Definition: vf_fftfilt.c:64
FFTFILTContext::rdft_hdata_out
float * rdft_hdata_out[MAX_PLANES]
Definition: vf_fftfilt.c:72
common.h
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:834
EvalMode
EvalMode
Definition: af_volume.h:39
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
VAR_HS
@ VAR_HS
Definition: vf_fftfilt.c:85
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(fftfilt)
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
var_names
static const char *const var_names[]
Definition: vf_fftfilt.c:84
FFTFILTContext::weight_expr
AVExpr * weight_expr[MAX_PLANES]
Definition: vf_fftfilt.c:77
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:264
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:477
weight_U
static double weight_U(void *priv, double x, double y)
Definition: vf_fftfilt.c:114
slice_start
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition: dec.c:737
AVFilter
Filter definition.
Definition: avfilter.h:201
FFTFILTContext::vrdft
AVTXContext * vrdft[MAX_THREADS][MAX_PLANES]
Definition: vf_fftfilt.c:57
FFTFILTContext::weight
double * weight[MAX_PLANES]
Definition: vf_fftfilt.c:78
ret
ret
Definition: filter_design.txt:187
fftfilt_inputs
static const AVFilterPad fftfilt_inputs[]
Definition: vf_fftfilt.c:586
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:482
AV_TX_FLOAT_RDFT
@ AV_TX_FLOAT_RDFT
Real to complex and complex to real DFTs.
Definition: tx.h:90
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:487
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_fftfilt.c:499
FFTFILTContext::rdft_hdata_in
float * rdft_hdata_in[MAX_PLANES]
Definition: vf_fftfilt.c:70
ff_filter_execute
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: avfilter.c:1651
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
values
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return values
Definition: filter_design.txt:263
rdft_horizontal16
static int rdft_horizontal16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:159
pixel_fmts_fftfilt
static enum AVPixelFormat pixel_fmts_fftfilt[]
Definition: vf_fftfilt.c:567
av_clip_uint8
#define av_clip_uint8
Definition: common.h:106
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
weight_V
static double weight_V(void *priv, double x, double y)
Definition: vf_fftfilt.c:115
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:152
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:272
desc
const char * desc
Definition: libsvtav1.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
mem.h
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
EVAL_MODE_INIT
@ EVAL_MODE_INIT
Definition: vf_fftfilt.c:41
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: intra.c:291
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
lum
static double lum(void *priv, double x, double y, int plane)
Definition: vf_fftfilt.c:107
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
AVFrame::linesize
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:434
FFTFILTContext::rdft_hstride
size_t rdft_hstride[MAX_PLANES]
Definition: vf_fftfilt.c:66
weight_Y
static double weight_Y(void *priv, double x, double y)
Definition: vf_fftfilt.c:113
h
h
Definition: vp9dsp_template.c:2070
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:488
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
FLAGS
#define FLAGS
Definition: vf_fftfilt.c:90
EVAL_MODE_NB
@ EVAL_MODE_NB
Definition: vf_fftfilt.c:43
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:460
FFTFILTContext::nb_planes
int nb_planes
Definition: vf_fftfilt.c:51
FFTFILTContext::ihrdft
AVTXContext * ihrdft[MAX_THREADS][MAX_PLANES]
Definition: vf_fftfilt.c:58
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
VAR_H
@ VAR_H
Definition: vf_fftfilt.c:85
src
#define src
Definition: vp8dsp.c:248
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:486
tx.h
multiply_data
static int multiply_data(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftfilt.c:393