FFmpeg
vf_fftdnoiz.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <float.h>
20 
21 #include "libavutil/avassert.h"
22 #include "libavutil/common.h"
23 #include "libavutil/imgutils.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/pixdesc.h"
26 #include "internal.h"
27 #include "libavcodec/avfft.h"
28 
34 };
35 
36 typedef struct PlaneContext {
38  int nox, noy;
39  int b;
40  int o;
41  float n;
42 
43  float *buffer[BSIZE];
47 
49 } PlaneContext;
50 
51 typedef struct FFTdnoizContext {
52  const AVClass *class;
53 
54  float sigma;
55  float amount;
57  float overlap;
58  int nb_prev;
59  int nb_next;
60  int planesf;
61 
63 
64  int depth;
65  int nb_planes;
67 
68  void (*import_row)(FFTComplex *dst, uint8_t *src, int rw);
69  void (*export_row)(FFTComplex *src, uint8_t *dst, int rw, float scale, int depth);
71 
72 #define OFFSET(x) offsetof(FFTdnoizContext, x)
73 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
74 static const AVOption fftdnoiz_options[] = {
75  { "sigma", "set denoise strength",
76  OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 30, .flags = FLAGS },
77  { "amount", "set amount of denoising",
78  OFFSET(amount), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0.01, 1, .flags = FLAGS },
79  { "block", "set block log2(size)",
80  OFFSET(block_bits), AV_OPT_TYPE_INT, {.i64=4}, 3, 6, .flags = FLAGS },
81  { "overlap", "set block overlap",
82  OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0.2, 0.8, .flags = FLAGS },
83  { "prev", "set number of previous frames for temporal denoising",
84  OFFSET(nb_prev), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = FLAGS },
85  { "next", "set number of next frames for temporal denoising",
86  OFFSET(nb_next), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = FLAGS },
87  { "planes", "set planes to filter",
88  OFFSET(planesf), AV_OPT_TYPE_INT, {.i64=7}, 0, 15, .flags = FLAGS },
89  { NULL }
90 };
91 
92 AVFILTER_DEFINE_CLASS(fftdnoiz);
93 
95 {
96  FFTdnoizContext *s = ctx->priv;
97  int i;
98 
99  for (i = 0; i < 4; i++) {
100  PlaneContext *p = &s->planes[i];
101 
102  p->fft = av_fft_init(s->block_bits, 0);
103  p->ifft = av_fft_init(s->block_bits, 1);
104  if (!p->fft || !p->ifft)
105  return AVERROR(ENOMEM);
106  }
107 
108  return 0;
109 }
110 
112 {
113  static const enum AVPixelFormat pix_fmts[] = {
138  };
140  if (!fmts_list)
141  return AVERROR(ENOMEM);
142  return ff_set_common_formats(ctx, fmts_list);
143 }
144 
145 typedef struct ThreadData {
146  float *src, *dst;
147 } ThreadData;
148 
149 static void import_row8(FFTComplex *dst, uint8_t *src, int rw)
150 {
151  int j;
152 
153  for (j = 0; j < rw; j++) {
154  dst[j].re = src[j];
155  dst[j].im = 0;
156  }
157 }
158 
159 static void export_row8(FFTComplex *src, uint8_t *dst, int rw, float scale, int depth)
160 {
161  int j;
162 
163  for (j = 0; j < rw; j++)
164  dst[j] = av_clip_uint8(lrintf(src[j].re * scale));
165 }
166 
167 static void import_row16(FFTComplex *dst, uint8_t *srcp, int rw)
168 {
169  uint16_t *src = (uint16_t *)srcp;
170  int j;
171 
172  for (j = 0; j < rw; j++) {
173  dst[j].re = src[j];
174  dst[j].im = 0;
175  }
176 }
177 
178 static void export_row16(FFTComplex *src, uint8_t *dstp, int rw, float scale, int depth)
179 {
180  uint16_t *dst = (uint16_t *)dstp;
181  int j;
182 
183  for (j = 0; j < rw; j++)
184  dst[j] = av_clip_uintp2_c(src[j].re * scale + 0.5f, depth);
185 }
186 
188 {
189  AVFilterContext *ctx = inlink->dst;
190  const AVPixFmtDescriptor *desc;
191  FFTdnoizContext *s = ctx->priv;
192  int i;
193 
194  desc = av_pix_fmt_desc_get(inlink->format);
195  s->depth = desc->comp[0].depth;
196 
197  if (s->depth <= 8) {
198  s->import_row = import_row8;
199  s->export_row = export_row8;
200  } else {
201  s->import_row = import_row16;
202  s->export_row = export_row16;
203  s->sigma *= 1 << (s->depth - 8) * (1 + s->nb_prev + s->nb_next);
204  }
205 
206  s->planes[1].planewidth = s->planes[2].planewidth = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
207  s->planes[0].planewidth = s->planes[3].planewidth = inlink->w;
208  s->planes[1].planeheight = s->planes[2].planeheight = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
209  s->planes[0].planeheight = s->planes[3].planeheight = inlink->h;
210 
211  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
212 
213  for (i = 0; i < s->nb_planes; i++) {
214  PlaneContext *p = &s->planes[i];
215  int size;
216 
217  p->b = 1 << s->block_bits;
218  p->n = 1.f / (p->b * p->b);
219  p->o = p->b * s->overlap;
220  size = p->b - p->o;
221  p->nox = (p->planewidth + (size - 1)) / size;
222  p->noy = (p->planeheight + (size - 1)) / size;
223 
224  av_log(ctx, AV_LOG_DEBUG, "nox:%d noy:%d size:%d\n", p->nox, p->noy, size);
225 
226  p->buffer_linesize = p->b * p->nox * sizeof(FFTComplex);
227  p->buffer[CURRENT] = av_calloc(p->b * p->noy, p->buffer_linesize);
228  if (!p->buffer[CURRENT])
229  return AVERROR(ENOMEM);
230  if (s->nb_prev > 0) {
231  p->buffer[PREV] = av_calloc(p->b * p->noy, p->buffer_linesize);
232  if (!p->buffer[PREV])
233  return AVERROR(ENOMEM);
234  }
235  if (s->nb_next > 0) {
236  p->buffer[NEXT] = av_calloc(p->b * p->noy, p->buffer_linesize);
237  if (!p->buffer[NEXT])
238  return AVERROR(ENOMEM);
239  }
240  p->data_linesize = 2 * p->b * sizeof(float);
241  p->hdata = av_calloc(p->b, p->data_linesize);
242  p->vdata = av_calloc(p->b, p->data_linesize);
243  if (!p->hdata || !p->vdata)
244  return AVERROR(ENOMEM);
245  }
246 
247  return 0;
248 }
249 
251  uint8_t *srcp, int src_linesize,
252  float *buffer, int buffer_linesize, int plane)
253 {
254  PlaneContext *p = &s->planes[plane];
255  const int width = p->planewidth;
256  const int height = p->planeheight;
257  const int block = p->b;
258  const int overlap = p->o;
259  const int size = block - overlap;
260  const int nox = p->nox;
261  const int noy = p->noy;
262  const int bpp = (s->depth + 7) / 8;
263  const int data_linesize = p->data_linesize / sizeof(FFTComplex);
264  FFTComplex *hdata = p->hdata;
265  FFTComplex *vdata = p->vdata;
266  int x, y, i, j;
267 
268  buffer_linesize /= sizeof(float);
269  for (y = 0; y < noy; y++) {
270  for (x = 0; x < nox; x++) {
271  const int rh = FFMIN(block, height - y * size);
272  const int rw = FFMIN(block, width - x * size);
273  uint8_t *src = srcp + src_linesize * y * size + x * size * bpp;
274  float *bdst = buffer + buffer_linesize * y * block + x * block * 2;
275  FFTComplex *ssrc, *dst = hdata;
276 
277  for (i = 0; i < rh; i++) {
278  s->import_row(dst, src, rw);
279  for (j = rw; j < block; j++) {
280  dst[j].re = dst[block - j - 1].re;
281  dst[j].im = 0;
282  }
283  av_fft_permute(p->fft, dst);
284  av_fft_calc(p->fft, dst);
285 
286  src += src_linesize;
287  dst += data_linesize;
288  }
289 
290  dst = hdata;
291  for (; i < block; i++) {
292  for (j = 0; j < block; j++) {
293  dst[j].re = dst[(block - i - 1) * data_linesize + j].re;
294  dst[j].im = dst[(block - i - 1) * data_linesize + j].im;
295  }
296  }
297 
298  ssrc = hdata;
299  dst = vdata;
300  for (i = 0; i < block; i++) {
301  for (j = 0; j < block; j++)
302  dst[j] = ssrc[j * data_linesize + i];
303  av_fft_permute(p->fft, dst);
304  av_fft_calc(p->fft, dst);
305  memcpy(bdst, dst, block * sizeof(FFTComplex));
306 
307  dst += data_linesize;
308  bdst += buffer_linesize;
309  }
310  }
311  }
312 }
313 
315  uint8_t *dstp, int dst_linesize,
316  float *buffer, int buffer_linesize, int plane)
317 {
318  PlaneContext *p = &s->planes[plane];
319  const int depth = s->depth;
320  const int bpp = (depth + 7) / 8;
321  const int width = p->planewidth;
322  const int height = p->planeheight;
323  const int block = p->b;
324  const int overlap = p->o;
325  const int hoverlap = overlap / 2;
326  const int size = block - overlap;
327  const int nox = p->nox;
328  const int noy = p->noy;
329  const int data_linesize = p->data_linesize / sizeof(FFTComplex);
330  const float scale = 1.f / (block * block);
331  FFTComplex *hdata = p->hdata;
332  FFTComplex *vdata = p->vdata;
333  int x, y, i, j;
334 
335  buffer_linesize /= sizeof(float);
336  for (y = 0; y < noy; y++) {
337  for (x = 0; x < nox; x++) {
338  const int woff = x == 0 ? 0 : hoverlap;
339  const int hoff = y == 0 ? 0 : hoverlap;
340  const int rw = x == 0 ? block : FFMIN(size, width - x * size - woff);
341  const int rh = y == 0 ? block : FFMIN(size, height - y * size - hoff);
342  float *bsrc = buffer + buffer_linesize * y * block + x * block * 2;
343  uint8_t *dst = dstp + dst_linesize * (y * size + hoff) + (x * size + woff) * bpp;
344  FFTComplex *hdst, *ddst = vdata;
345 
346  hdst = hdata;
347  for (i = 0; i < block; i++) {
348  memcpy(ddst, bsrc, block * sizeof(FFTComplex));
349  av_fft_permute(p->ifft, ddst);
350  av_fft_calc(p->ifft, ddst);
351  for (j = 0; j < block; j++) {
352  hdst[j * data_linesize + i] = ddst[j];
353  }
354 
355  ddst += data_linesize;
356  bsrc += buffer_linesize;
357  }
358 
359  hdst = hdata + hoff * data_linesize;
360  for (i = 0; i < rh; i++) {
361  av_fft_permute(p->ifft, hdst);
362  av_fft_calc(p->ifft, hdst);
363  s->export_row(hdst + woff, dst, rw, scale, depth);
364 
365  hdst += data_linesize;
366  dst += dst_linesize;
367  }
368  }
369  }
370 }
371 
372 static void filter_plane3d2(FFTdnoizContext *s, int plane, float *pbuffer, float *nbuffer)
373 {
374  PlaneContext *p = &s->planes[plane];
375  const int block = p->b;
376  const int nox = p->nox;
377  const int noy = p->noy;
378  const int buffer_linesize = p->buffer_linesize / sizeof(float);
379  const float sigma = s->sigma * s->sigma * block * block;
380  const float limit = 1.f - s->amount;
381  float *cbuffer = p->buffer[CURRENT];
382  const float cfactor = sqrtf(3.f) * 0.5f;
383  const float scale = 1.f / 3.f;
384  int y, x, i, j;
385 
386  for (y = 0; y < noy; y++) {
387  for (x = 0; x < nox; x++) {
388  float *cbuff = cbuffer + buffer_linesize * y * block + x * block * 2;
389  float *pbuff = pbuffer + buffer_linesize * y * block + x * block * 2;
390  float *nbuff = nbuffer + buffer_linesize * y * block + x * block * 2;
391 
392  for (i = 0; i < block; i++) {
393  for (j = 0; j < block; j++) {
394  float sumr, sumi, difr, difi, mpr, mpi, mnr, mni;
395  float factor, power, sumpnr, sumpni;
396 
397  sumpnr = pbuff[2 * j ] + nbuff[2 * j ];
398  sumpni = pbuff[2 * j + 1] + nbuff[2 * j + 1];
399  sumr = cbuff[2 * j ] + sumpnr;
400  sumi = cbuff[2 * j + 1] + sumpni;
401  difr = cfactor * (nbuff[2 * j ] - pbuff[2 * j ]);
402  difi = cfactor * (pbuff[2 * j + 1] - nbuff[2 * j + 1]);
403  mpr = cbuff[2 * j ] - 0.5f * sumpnr + difi;
404  mnr = mpr - difi - difi;
405  mpi = cbuff[2 * j + 1] - 0.5f * sumpni + difr;
406  mni = mpi - difr - difr;
407  power = sumr * sumr + sumi * sumi + 1e-15f;
408  factor = FFMAX((power - sigma) / power, limit);
409  sumr *= factor;
410  sumi *= factor;
411  power = mpr * mpr + mpi * mpi + 1e-15f;
412  factor = FFMAX((power - sigma) / power, limit);
413  mpr *= factor;
414  mpi *= factor;
415  power = mnr * mnr + mni * mni + 1e-15f;
416  factor = FFMAX((power - sigma) / power, limit);
417  mnr *= factor;
418  mni *= factor;
419  cbuff[2 * j ] = (sumr + mpr + mnr) * scale;
420  cbuff[2 * j + 1] = (sumi + mpi + mni) * scale;
421 
422  }
423 
424  cbuff += buffer_linesize;
425  pbuff += buffer_linesize;
426  nbuff += buffer_linesize;
427  }
428  }
429  }
430 }
431 
432 static void filter_plane3d1(FFTdnoizContext *s, int plane, float *pbuffer)
433 {
434  PlaneContext *p = &s->planes[plane];
435  const int block = p->b;
436  const int nox = p->nox;
437  const int noy = p->noy;
438  const int buffer_linesize = p->buffer_linesize / sizeof(float);
439  const float sigma = s->sigma * s->sigma * block * block;
440  const float limit = 1.f - s->amount;
441  float *cbuffer = p->buffer[CURRENT];
442  int y, x, i, j;
443 
444  for (y = 0; y < noy; y++) {
445  for (x = 0; x < nox; x++) {
446  float *cbuff = cbuffer + buffer_linesize * y * block + x * block * 2;
447  float *pbuff = pbuffer + buffer_linesize * y * block + x * block * 2;
448 
449  for (i = 0; i < block; i++) {
450  for (j = 0; j < block; j++) {
451  float factor, power, re, im, pre, pim;
452  float sumr, sumi, difr, difi;
453 
454  re = cbuff[j * 2 ];
455  pre = pbuff[j * 2 ];
456  im = cbuff[j * 2 + 1];
457  pim = pbuff[j * 2 + 1];
458 
459  sumr = re + pre;
460  sumi = im + pim;
461  difr = re - pre;
462  difi = im - pim;
463 
464  power = sumr * sumr + sumi * sumi + 1e-15f;
465  factor = FFMAX(limit, (power - sigma) / power);
466  sumr *= factor;
467  sumi *= factor;
468  power = difr * difr + difi * difi + 1e-15f;
469  factor = FFMAX(limit, (power - sigma) / power);
470  difr *= factor;
471  difi *= factor;
472 
473  cbuff[j * 2 ] = (sumr + difr) * 0.5f;
474  cbuff[j * 2 + 1] = (sumi + difi) * 0.5f;
475  }
476 
477  cbuff += buffer_linesize;
478  pbuff += buffer_linesize;
479  }
480  }
481  }
482 }
483 
484 static void filter_plane2d(FFTdnoizContext *s, int plane)
485 {
486  PlaneContext *p = &s->planes[plane];
487  const int block = p->b;
488  const int nox = p->nox;
489  const int noy = p->noy;
490  const int buffer_linesize = p->buffer_linesize / 4;
491  const float sigma = s->sigma * s->sigma * block * block;
492  const float limit = 1.f - s->amount;
493  float *buffer = p->buffer[CURRENT];
494  int y, x, i, j;
495 
496  for (y = 0; y < noy; y++) {
497  for (x = 0; x < nox; x++) {
498  float *buff = buffer + buffer_linesize * y * block + x * block * 2;
499 
500  for (i = 0; i < block; i++) {
501  for (j = 0; j < block; j++) {
502  float factor, power, re, im;
503 
504  re = buff[j * 2 ];
505  im = buff[j * 2 + 1];
506  power = re * re + im * im + 1e-15f;
507  factor = FFMAX(limit, (power - sigma) / power);
508  buff[j * 2 ] *= factor;
509  buff[j * 2 + 1] *= factor;
510  }
511 
512  buff += buffer_linesize;
513  }
514  }
515  }
516 }
517 
519 {
520  AVFilterContext *ctx = inlink->dst;
521  FFTdnoizContext *s = ctx->priv;
522  AVFilterLink *outlink = ctx->outputs[0];
523  int direct, plane;
524  AVFrame *out;
525 
526  if (s->nb_next > 0 && s->nb_prev > 0) {
527  av_frame_free(&s->prev);
528  s->prev = s->cur;
529  s->cur = s->next;
530  s->next = in;
531 
532  if (!s->prev && s->cur) {
533  s->prev = av_frame_clone(s->cur);
534  if (!s->prev)
535  return AVERROR(ENOMEM);
536  }
537  if (!s->cur)
538  return 0;
539  } else if (s->nb_next > 0) {
540  av_frame_free(&s->cur);
541  s->cur = s->next;
542  s->next = in;
543 
544  if (!s->cur)
545  return 0;
546  } else if (s->nb_prev > 0) {
547  av_frame_free(&s->prev);
548  s->prev = s->cur;
549  s->cur = in;
550 
551  if (!s->prev)
552  s->prev = av_frame_clone(s->cur);
553  if (!s->prev)
554  return AVERROR(ENOMEM);
555  } else {
556  s->cur = in;
557  }
558 
559  if (av_frame_is_writable(in) && s->nb_next == 0 && s->nb_prev == 0) {
560  direct = 1;
561  out = in;
562  } else {
563  direct = 0;
564  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
565  if (!out)
566  return AVERROR(ENOMEM);
567  av_frame_copy_props(out, s->cur);
568  }
569 
570  for (plane = 0; plane < s->nb_planes; plane++) {
571  PlaneContext *p = &s->planes[plane];
572 
573  if (!((1 << plane) & s->planesf) || ctx->is_disabled) {
574  if (!direct)
575  av_image_copy_plane(out->data[plane], out->linesize[plane],
576  s->cur->data[plane], s->cur->linesize[plane],
577  p->planewidth, p->planeheight);
578  continue;
579  }
580 
581  if (s->next) {
582  import_plane(s, s->next->data[plane], s->next->linesize[plane],
583  p->buffer[NEXT], p->buffer_linesize, plane);
584  }
585 
586  if (s->prev) {
587  import_plane(s, s->prev->data[plane], s->prev->linesize[plane],
588  p->buffer[PREV], p->buffer_linesize, plane);
589  }
590 
591  import_plane(s, s->cur->data[plane], s->cur->linesize[plane],
592  p->buffer[CURRENT], p->buffer_linesize, plane);
593 
594  if (s->next && s->prev) {
595  filter_plane3d2(s, plane, p->buffer[PREV], p->buffer[NEXT]);
596  } else if (s->next) {
597  filter_plane3d1(s, plane, p->buffer[NEXT]);
598  } else if (s->prev) {
599  filter_plane3d1(s, plane, p->buffer[PREV]);
600  } else {
601  filter_plane2d(s, plane);
602  }
603 
604  export_plane(s, out->data[plane], out->linesize[plane],
605  p->buffer[CURRENT], p->buffer_linesize, plane);
606  }
607 
608  if (s->nb_next == 0 && s->nb_prev == 0) {
609  if (direct) {
610  s->cur = NULL;
611  } else {
612  av_frame_free(&s->cur);
613  }
614  }
615  return ff_filter_frame(outlink, out);
616 }
617 
618 static int request_frame(AVFilterLink *outlink)
619 {
620  AVFilterContext *ctx = outlink->src;
621  FFTdnoizContext *s = ctx->priv;
622  int ret = 0;
623 
624  ret = ff_request_frame(ctx->inputs[0]);
625 
626  if (ret == AVERROR_EOF && (s->nb_next > 0)) {
627  AVFrame *buf;
628 
629  if (s->next && s->nb_next > 0)
630  buf = av_frame_clone(s->next);
631  else if (s->cur)
632  buf = av_frame_clone(s->cur);
633  else
634  buf = av_frame_clone(s->prev);
635  if (!buf)
636  return AVERROR(ENOMEM);
637 
638  ret = filter_frame(ctx->inputs[0], buf);
639  if (ret < 0)
640  return ret;
641  ret = AVERROR_EOF;
642  }
643 
644  return ret;
645 }
646 
648 {
649  FFTdnoizContext *s = ctx->priv;
650  int i;
651 
652  for (i = 0; i < 4; i++) {
653  PlaneContext *p = &s->planes[i];
654 
655  av_freep(&p->hdata);
656  av_freep(&p->vdata);
657  av_freep(&p->buffer[PREV]);
658  av_freep(&p->buffer[CURRENT]);
659  av_freep(&p->buffer[NEXT]);
660  av_fft_end(p->fft);
661  av_fft_end(p->ifft);
662  }
663 
664  av_frame_free(&s->prev);
665  av_frame_free(&s->cur);
666  av_frame_free(&s->next);
667 }
668 
669 static const AVFilterPad fftdnoiz_inputs[] = {
670  {
671  .name = "default",
672  .type = AVMEDIA_TYPE_VIDEO,
673  .filter_frame = filter_frame,
674  .config_props = config_input,
675  },
676  { NULL }
677 };
678 
679 static const AVFilterPad fftdnoiz_outputs[] = {
680  {
681  .name = "default",
682  .type = AVMEDIA_TYPE_VIDEO,
683  .request_frame = request_frame,
684  },
685  { NULL }
686 };
687 
689  .name = "fftdnoiz",
690  .description = NULL_IF_CONFIG_SMALL("Denoise frames using 3D FFT."),
691  .priv_size = sizeof(FFTdnoizContext),
692  .init = init,
693  .uninit = uninit,
697  .priv_class = &fftdnoiz_class,
699 };
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:99
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:442
CURRENT
@ CURRENT
Definition: vf_fftdnoiz.c:30
av_fft_end
av_cold void av_fft_end(FFTContext *s)
Definition: avfft.c:48
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:421
direct
static void direct(const float *in, const FFTComplex *ir, int len, float *out)
Definition: af_afir.c:60
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
PlaneContext::buffer_linesize
int buffer_linesize
Definition: vf_fftdnoiz.c:46
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
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: vf_fftdnoiz.c:618
ff_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:286
out
FILE * out
Definition: movenc.c:54
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1096
FFTdnoizContext::nb_next
int nb_next
Definition: vf_fftdnoiz.c:59
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:55
bsrc
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t const uint8_t const uint8_t * bsrc
Definition: input.c:399
block_bits
static const uint8_t block_bits[]
Definition: imm4.c:103
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
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:434
filter_plane2d
static void filter_plane2d(FFTdnoizContext *s, int plane)
Definition: vf_fftdnoiz.c:484
im
float im
Definition: fft.c:82
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
pixdesc.h
av_clip_uintp2_c
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
Clip a signed integer to an unsigned power of two range.
Definition: common.h:302
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:441
export_plane
static void export_plane(FFTdnoizContext *s, uint8_t *dstp, int dst_linesize, float *buffer, int buffer_linesize, int plane)
Definition: vf_fftdnoiz.c:314
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:436
AVOption
AVOption.
Definition: opt.h:248
PlaneContext::b
int b
Definition: vf_fftdnoiz.c:39
fftdnoiz_outputs
static const AVFilterPad fftdnoiz_outputs[]
Definition: vf_fftdnoiz.c:679
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:399
FFTdnoizContext::sigma
float sigma
Definition: vf_fftdnoiz.c:54
ff_request_frame
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:408
av_fft_permute
void av_fft_permute(FFTContext *s, FFTComplex *z)
Do the permutation needed BEFORE calling ff_fft_calc().
Definition: avfft.c:38
PlaneContext::vdata
FFTComplex * vdata
Definition: vf_fftdnoiz.c:44
float.h
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:149
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:437
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:379
av_image_copy_plane
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition: imgutils.c:373
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:65
FFTdnoizContext::cur
AVFrame * cur
Definition: vf_fftdnoiz.c:62
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2613
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:433
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:417
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
PlaneContext::planeheight
int planeheight
Definition: vf_fftdnoiz.c:37
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:415
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:443
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:397
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:383
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:54
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:402
AV_PIX_FMT_YUVJ411P
@ 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
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:411
ff_set_common_formats
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
FFTdnoizContext::overlap
float overlap
Definition: vf_fftdnoiz.c:57
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:79
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:419
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:420
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
PlaneContext::ifft
FFTContext * ifft
Definition: vf_fftdnoiz.c:48
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:412
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:309
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:440
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:396
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:215
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:410
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:382
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:540
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:66
f
#define f(width, name)
Definition: cbs_vp9.c:255
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:80
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:380
ThreadData::dst
AVFrame * dst
Definition: vf_blend.c:56
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:418
FFTdnoizContext::next
AVFrame * next
Definition: vf_fftdnoiz.c:62
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
NULL
#define NULL
Definition: coverity.c:32
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:658
PlaneContext::planewidth
int planewidth
Definition: vf_fftdnoiz.c:37
ThreadData::src
const uint8_t * src
Definition: vf_bm3d.c:56
FFTdnoizContext
Definition: vf_fftdnoiz.c:51
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:78
FFTdnoizContext::prev
AVFrame * prev
Definition: vf_fftdnoiz.c:62
src
#define src
Definition: vp8dsp.c:255
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:401
PlaneContext
Definition: ffv1.h:67
PlaneContext::data_linesize
int data_linesize
Definition: vf_fftdnoiz.c:45
avfft.h
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:400
PlaneContext::fft
FFTContext * fft
Definition: vf_fftdnoiz.c:48
inputs
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 inputs
Definition: filter_design.txt:243
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:414
FFTdnoizContext::depth
int depth
Definition: vf_fftdnoiz.c:64
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_fftdnoiz.c:187
FFTComplex
void FFTComplex
Definition: tx_priv.h:46
BSIZE
@ BSIZE
Definition: vf_fftdnoiz.c:33
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:117
FFMAX
#define FFMAX(a, b)
Definition: common.h:103
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_fftdnoiz.c:94
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:404
size
int size
Definition: twinvq_data.h:10344
PlaneContext::o
int o
Definition: vf_fftdnoiz.c:40
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:406
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:594
FLAGS
#define FLAGS
Definition: vf_fftdnoiz.c:73
FFTComplex::im
FFTSample im
Definition: avfft.h:38
FFTComplex::re
FFTSample re
Definition: avfft.h:38
PREV
@ PREV
Definition: vf_fftdnoiz.c:31
FFTdnoizContext::import_row
void(* import_row)(FFTComplex *dst, uint8_t *src, int rw)
Definition: vf_fftdnoiz.c:68
export_row16
static void export_row16(FFTComplex *src, uint8_t *dstp, int rw, float scale, int depth)
Definition: vf_fftdnoiz.c:178
height
#define height
FFTdnoizContext::block_bits
int block_bits
Definition: vf_fftdnoiz.c:56
FFMIN
#define FFMIN(a, b)
Definition: common.h:105
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:438
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_fftdnoiz.c:111
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
filter_plane3d2
static void filter_plane3d2(FFTdnoizContext *s, int plane, float *pbuffer, float *nbuffer)
Definition: vf_fftdnoiz.c:372
PlaneContext::buffer
float * buffer[BSIZE]
Definition: vf_fftdnoiz.c:43
in
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Definition: audio_convert.c:326
FFTdnoizContext::amount
float amount
Definition: vf_fftdnoiz.c:55
FFTdnoizContext::nb_planes
int nb_planes
Definition: vf_fftdnoiz.c:65
FFTdnoizContext::planes
PlaneContext planes[4]
Definition: vf_fftdnoiz.c:66
FFTContext
Definition: fft.h:83
i
int i
Definition: input.c:407
lrintf
#define lrintf(x)
Definition: libm_mips.h:70
export_row8
static void export_row8(FFTComplex *src, uint8_t *dst, int rw, float scale, int depth)
Definition: vf_fftdnoiz.c:159
FFTdnoizContext::planesf
int planesf
Definition: vf_fftdnoiz.c:60
import_row8
static void import_row8(FFTComplex *dst, uint8_t *src, int rw)
Definition: vf_fftdnoiz.c:149
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:416
common.h
PlaneContext::nox
int nox
Definition: vf_fftdnoiz.c:38
ThreadData
Used for passing data between threads.
Definition: dsddec.c:67
import_row16
static void import_row16(FFTComplex *dst, uint8_t *srcp, int rw)
Definition: vf_fftdnoiz.c:167
AV_PIX_FMT_YUVJ440P
@ 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
uint8_t
uint8_t
Definition: audio_convert.c:194
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:60
OFFSET
#define OFFSET(x)
Definition: vf_fftdnoiz.c:72
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:398
NEXT
@ NEXT
Definition: vf_fftdnoiz.c:32
AVFilter
Filter definition.
Definition: avfilter.h:145
FFTdnoizContext::nb_prev
int nb_prev
Definition: vf_fftdnoiz.c:58
ret
ret
Definition: filter_design.txt:187
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fftdnoiz.c:647
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:435
fftdnoiz_inputs
static const AVFilterPad fftdnoiz_inputs[]
Definition: vf_fftdnoiz.c:669
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:403
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:408
av_fft_init
FFTContext * av_fft_init(int nbits, int inverse)
Set up a complex FFT.
Definition: avfft.c:28
PlaneContext::noy
int noy
Definition: vf_fftdnoiz.c:38
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:245
import_plane
static void import_plane(FFTdnoizContext *s, uint8_t *srcp, int src_linesize, float *buffer, int buffer_linesize, int plane)
Definition: vf_fftdnoiz.c:250
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:439
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
av_clip_uint8
#define av_clip_uint8
Definition: common.h:128
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:71
AVFilterContext
An instance of a filter.
Definition: avfilter.h:341
factor
static const int factor[16]
Definition: vf_pp7.c:77
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
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:70
filter_plane3d1
static void filter_plane3d1(FFTdnoizContext *s, int plane, float *pbuffer)
Definition: vf_fftdnoiz.c:432
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_fftdnoiz.c:518
PlaneContext::n
float n
Definition: vf_fftdnoiz.c:41
ff_vf_fftdnoiz
AVFilter ff_vf_fftdnoiz
Definition: vf_fftdnoiz.c:688
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#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
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
PlaneContext::hdata
FFTComplex * hdata
Definition: vf_fftdnoiz.c:44
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:405
FFTdnoizContext::export_row
void(* export_row)(FFTComplex *src, uint8_t *dst, int rw, float scale, int depth)
Definition: vf_fftdnoiz.c:69
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:409
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(fftdnoiz)
fftdnoiz_options
static const AVOption fftdnoiz_options[]
Definition: vf_fftdnoiz.c:74
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:381
av_fft_calc
void av_fft_calc(FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in av_fft_init().
Definition: avfft.c:43
BufferTypes
BufferTypes
Definition: vf_fftdnoiz.c:29
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:407
FFTComplex
Definition: avfft.h:37
re
float re
Definition: fft.c:82