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/common.h"
22 #include "libavutil/imgutils.h"
23 #include "libavutil/mem.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/pixdesc.h"
26 #include "libavutil/tx.h"
27 #include "internal.h"
28 #include "video.h"
29 #include "window_func.h"
30 
31 #define MAX_BLOCK 256
32 #define MAX_THREADS 32
33 
39 };
40 
41 typedef struct PlaneContext {
43  int nox, noy;
44  int b;
45  int o;
46  float n;
47 
53 } PlaneContext;
54 
55 typedef struct FFTdnoizContext {
56  const AVClass *class;
57 
58  float sigma;
59  float amount;
61  float overlap;
62  int method;
63  int window;
64  int nb_prev;
65  int nb_next;
66  int planesf;
67 
69 
70  int depth;
71  int nb_planes;
75 
78 
81 
82  void (*import_row)(AVComplexFloat *dst, uint8_t *src, int rw, float scale, float *win, int off);
83  void (*export_row)(AVComplexFloat *src, uint8_t *dst, int rw, int depth, float *win);
85 
86 #define OFFSET(x) offsetof(FFTdnoizContext, x)
87 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
88 #define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
89 static const AVOption fftdnoiz_options[] = {
90  { "sigma", "set denoise strength",
91  OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 100, .flags = TFLAGS },
92  { "amount", "set amount of denoising",
93  OFFSET(amount), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0.01, 1, .flags = TFLAGS },
94  { "block", "set block size",
95  OFFSET(block_size), AV_OPT_TYPE_INT, {.i64=32}, 8, MAX_BLOCK, .flags = FLAGS },
96  { "overlap", "set block overlap",
97  OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0.2, 0.8, .flags = FLAGS },
98  { "method", "set method of denoising",
99  OFFSET(method), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = TFLAGS, .unit = "method" },
100  { "wiener", "wiener method",
101  0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = TFLAGS, .unit = "method" },
102  { "hard", "hard thresholding",
103  0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = TFLAGS, .unit = "method" },
104  { "prev", "set number of previous frames for temporal denoising",
105  OFFSET(nb_prev), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = FLAGS },
106  { "next", "set number of next frames for temporal denoising",
107  OFFSET(nb_next), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = FLAGS },
108  { "planes", "set planes to filter",
109  OFFSET(planesf), AV_OPT_TYPE_INT, {.i64=7}, 0, 15, .flags = TFLAGS },
111  { NULL }
112 };
113 
114 AVFILTER_DEFINE_CLASS(fftdnoiz);
115 
116 static const enum AVPixelFormat pix_fmts[] = {
141 };
142 
143 typedef struct ThreadData {
144  float *src, *dst;
145 } ThreadData;
146 
147 static void import_row8(AVComplexFloat *dst, uint8_t *src, int rw,
148  float scale, float *win, int off)
149 {
150  for (int j = 0; j < rw; j++) {
151  const int i = abs(j + off);
152  dst[j].re = src[i] * scale * win[j];
153  dst[j].im = 0.f;
154  }
155 }
156 
157 static void export_row8(AVComplexFloat *src, uint8_t *dst, int rw, int depth, float *win)
158 {
159  for (int j = 0; j < rw; j++)
160  dst[j] = av_clip_uint8(lrintf(src[j].re / win[j]));
161 }
162 
163 static void import_row16(AVComplexFloat *dst, uint8_t *srcp, int rw,
164  float scale, float *win, int off)
165 {
166  uint16_t *src = (uint16_t *)srcp;
167 
168  for (int j = 0; j < rw; j++) {
169  const int i = abs(j + off);
170  dst[j].re = src[i] * scale * win[j];
171  dst[j].im = 0;
172  }
173 }
174 
175 static void export_row16(AVComplexFloat *src, uint8_t *dstp, int rw, int depth, float *win)
176 {
177  uint16_t *dst = (uint16_t *)dstp;
178 
179  for (int j = 0; j < rw; j++)
180  dst[j] = av_clip_uintp2_c(lrintf(src[j].re / win[j]), depth);
181 }
182 
184 {
185  AVFilterContext *ctx = inlink->dst;
186  const AVPixFmtDescriptor *desc;
187  FFTdnoizContext *s = ctx->priv;
188  float lut[MAX_BLOCK + 1];
189  float overlap;
190  int i;
191 
192  desc = av_pix_fmt_desc_get(inlink->format);
193  s->depth = desc->comp[0].depth;
194 
195  if (s->depth <= 8) {
196  s->import_row = import_row8;
197  s->export_row = export_row8;
198  } else {
199  s->import_row = import_row16;
200  s->export_row = export_row16;
201  }
202 
203  s->planes[1].planewidth = s->planes[2].planewidth = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
204  s->planes[0].planewidth = s->planes[3].planewidth = inlink->w;
205  s->planes[1].planeheight = s->planes[2].planeheight = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
206  s->planes[0].planeheight = s->planes[3].planeheight = inlink->h;
207 
208  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
210 
211  for (int i = 0; i < s->nb_threads; i++) {
212  float scale = 1.f, iscale = 1.f;
213  int ret;
214 
215  if ((ret = av_tx_init(&s->fft[i], &s->tx_fn, AV_TX_FLOAT_FFT,
216  0, s->block_size, &scale, 0)) < 0 ||
217  (ret = av_tx_init(&s->ifft[i], &s->itx_fn, AV_TX_FLOAT_FFT,
218  1, s->block_size, &iscale, 0)) < 0 ||
219  (ret = av_tx_init(&s->fft_r[i], &s->tx_r_fn, AV_TX_FLOAT_FFT,
220  0, 1 + s->nb_prev + s->nb_next, &scale, 0)) < 0 ||
221  (ret = av_tx_init(&s->ifft_r[i], &s->itx_r_fn, AV_TX_FLOAT_FFT,
222  1, 1 + s->nb_prev + s->nb_next, &iscale, 0)) < 0)
223  return ret;
224  }
225 
226  for (i = 0; i < s->nb_planes; i++) {
227  PlaneContext *p = &s->planes[i];
228  int size;
229 
230  p->b = s->block_size;
231  p->n = 1.f / (p->b * p->b);
232  p->o = lrintf(p->b * s->overlap);
233  size = p->b - p->o;
234  p->nox = (p->planewidth + (size - 1)) / size;
235  p->noy = (p->planeheight + (size - 1)) / size;
236 
237  av_log(ctx, AV_LOG_DEBUG, "nox:%d noy:%d size:%d\n", p->nox, p->noy, size);
238 
239  p->buffer_linesize = p->b * sizeof(AVComplexFloat);
240  p->data_linesize = 2 * p->b * sizeof(float);
241  for (int j = 0; j < s->nb_threads; j++) {
242  p->hdata[j] = av_calloc(p->b, p->data_linesize);
243  p->hdata_out[j] = av_calloc(p->b, p->data_linesize);
244  p->vdata[j] = av_calloc(p->b, p->data_linesize);
245  p->vdata_out[j] = av_calloc(p->b, p->data_linesize);
246  p->buffer[j][CURRENT] = av_calloc(p->b, p->buffer_linesize);
247  if (!p->buffer[j][CURRENT])
248  return AVERROR(ENOMEM);
249  if (s->nb_prev > 0) {
250  p->buffer[j][PREV] = av_calloc(p->b, p->buffer_linesize);
251  if (!p->buffer[j][PREV])
252  return AVERROR(ENOMEM);
253  }
254  if (s->nb_next > 0) {
255  p->buffer[j][NEXT] = av_calloc(p->b, p->buffer_linesize);
256  if (!p->buffer[j][NEXT])
257  return AVERROR(ENOMEM);
258  }
259  if (!p->hdata[j] || !p->vdata[j] ||
260  !p->hdata_out[j] || !p->vdata_out[j])
261  return AVERROR(ENOMEM);
262  }
263  }
264 
265  generate_window_func(lut, s->block_size + 1, s->window, &overlap);
266 
267  for (int y = 0; y < s->block_size; y++) {
268  for (int x = 0; x < s->block_size; x++)
269  s->win[y][x] = lut[y] * lut[x];
270  }
271 
272  return 0;
273 }
274 
276  uint8_t *srcp, int src_linesize,
277  float *buffer, int buffer_linesize, int plane,
278  int jobnr, int y, int x)
279 {
280  PlaneContext *p = &s->planes[plane];
281  const int width = p->planewidth;
282  const int height = p->planeheight;
283  const int block = p->b;
284  const int overlap = p->o;
285  const int hoverlap = overlap / 2;
286  const int size = block - overlap;
287  const int bpp = (s->depth + 7) / 8;
288  const int data_linesize = p->data_linesize / sizeof(AVComplexFloat);
289  const float scale = 1.f / ((1.f + s->nb_prev + s->nb_next) * s->block_size * s->block_size);
290  AVComplexFloat *hdata = p->hdata[jobnr];
291  AVComplexFloat *hdata_out = p->hdata_out[jobnr];
292  AVComplexFloat *vdata_out = p->vdata_out[jobnr];
293  const int woff = -hoverlap;
294  const int hoff = -hoverlap;
295  const int rh = FFMIN(block, height - y * size + hoverlap);
296  const int rw = FFMIN(block, width - x * size + hoverlap);
297  AVComplexFloat *ssrc, *ddst, *dst = hdata, *dst_out = hdata_out;
298  float *bdst = buffer;
299 
300  buffer_linesize /= sizeof(float);
301 
302  for (int i = 0; i < rh; i++) {
303  uint8_t *src = srcp + src_linesize * abs(y * size + i + hoff) + x * size * bpp;
304 
305  s->import_row(dst, src, rw, scale, s->win[i], woff);
306  for (int j = rw; j < block; j++) {
307  dst[j].re = dst[rw - 1].re;
308  dst[j].im = 0.f;
309  }
310  s->tx_fn(s->fft[jobnr], dst_out, dst, sizeof(AVComplexFloat));
311 
312  ddst = dst_out;
313  dst += data_linesize;
314  dst_out += data_linesize;
315  }
316 
317  dst = dst_out;
318  for (int i = rh; i < block; i++) {
319  for (int j = 0; j < block; j++) {
320  dst[j].re = ddst[j].re;
321  dst[j].im = ddst[j].im;
322  }
323 
324  dst += data_linesize;
325  }
326 
327  ssrc = hdata_out;
328  dst = vdata_out;
329  for (int i = 0; i < block; i++) {
330  for (int j = 0; j < block; j++)
331  dst[j] = ssrc[j * data_linesize + i];
332  s->tx_fn(s->fft[jobnr], bdst, dst, sizeof(AVComplexFloat));
333 
334  dst += data_linesize;
335  bdst += buffer_linesize;
336  }
337 }
338 
340  uint8_t *dstp, int dst_linesize,
341  float *buffer, int buffer_linesize, int plane,
342  int jobnr, int y, int x)
343 {
344  PlaneContext *p = &s->planes[plane];
345  const int depth = s->depth;
346  const int bpp = (depth + 7) / 8;
347  const int width = p->planewidth;
348  const int height = p->planeheight;
349  const int block = p->b;
350  const int overlap = p->o;
351  const int hoverlap = overlap / 2;
352  const int size = block - overlap;
353  const int data_linesize = p->data_linesize / sizeof(AVComplexFloat);
354  AVComplexFloat *hdata = p->hdata[jobnr];
355  AVComplexFloat *hdata_out = p->hdata_out[jobnr];
356  AVComplexFloat *vdata_out = p->vdata_out[jobnr];
357  const int rw = FFMIN(size, width - x * size);
358  const int rh = FFMIN(size, height - y * size);
359  AVComplexFloat *hdst, *vdst = vdata_out, *hdst_out = hdata_out;
360  float *bsrc = buffer;
361 
362  hdst = hdata;
363  buffer_linesize /= sizeof(float);
364 
365  for (int i = 0; i < block; i++) {
366  s->itx_fn(s->ifft[jobnr], vdst, bsrc, sizeof(AVComplexFloat));
367  for (int j = 0; j < block; j++)
368  hdst[j * data_linesize + i] = vdst[j];
369 
370  vdst += data_linesize;
371  bsrc += buffer_linesize;
372  }
373 
374  hdst = hdata + hoverlap * data_linesize;
375  for (int i = 0; i < rh && (y * size + i) < height; i++) {
376  uint8_t *dst = dstp + dst_linesize * (y * size + i) + x * size * bpp;
377 
378  s->itx_fn(s->ifft[jobnr], hdst_out, hdst, sizeof(AVComplexFloat));
379  s->export_row(hdst_out + hoverlap, dst, rw, depth, s->win[i + hoverlap] + hoverlap);
380 
381  hdst += data_linesize;
382  hdst_out += data_linesize;
383  }
384 }
385 
386 static void filter_block3d2(FFTdnoizContext *s, int plane, float *pbuffer, float *nbuffer,
387  int jobnr)
388 {
389  PlaneContext *p = &s->planes[plane];
390  const int block = p->b;
391  const int buffer_linesize = p->buffer_linesize / sizeof(float);
392  const float depthx = (1 << (s->depth - 8)) * (1 << (s->depth - 8));
393  const float sigma = s->sigma * depthx / (3.f * s->block_size * s->block_size);
394  const float limit = 1.f - s->amount;
395  float *cbuffer = p->buffer[jobnr][CURRENT];
396  const int method = s->method;
397  float *cbuff = cbuffer;
398  float *pbuff = pbuffer;
399  float *nbuff = nbuffer;
400 
401  for (int i = 0; i < block; i++) {
402  for (int j = 0; j < block; j++) {
404  AVComplexFloat outbuffer[BSIZE];
405 
406  buffer[0].re = pbuff[2 * j ];
407  buffer[0].im = pbuff[2 * j + 1];
408 
409  buffer[1].re = cbuff[2 * j ];
410  buffer[1].im = cbuff[2 * j + 1];
411 
412  buffer[2].re = nbuff[2 * j ];
413  buffer[2].im = nbuff[2 * j + 1];
414 
415  s->tx_r_fn(s->fft_r[jobnr], outbuffer, buffer, sizeof(AVComplexFloat));
416 
417  for (int z = 0; z < 3; z++) {
418  const float re = outbuffer[z].re;
419  const float im = outbuffer[z].im;
420  const float power = re * re + im * im;
421  float factor;
422 
423  switch (method) {
424  case 0:
425  factor = fmaxf(limit, (power - sigma) / (power + 1e-15f));
426  break;
427  case 1:
428  factor = power < sigma ? limit : 1.f;
429  break;
430  }
431 
432  outbuffer[z].re *= factor;
433  outbuffer[z].im *= factor;
434  }
435 
436  s->itx_r_fn(s->ifft_r[jobnr], buffer, outbuffer, sizeof(AVComplexFloat));
437 
438  cbuff[2 * j + 0] = buffer[1].re;
439  cbuff[2 * j + 1] = buffer[1].im;
440  }
441 
442  cbuff += buffer_linesize;
443  pbuff += buffer_linesize;
444  nbuff += buffer_linesize;
445  }
446 }
447 
448 static void filter_block3d1(FFTdnoizContext *s, int plane, float *pbuffer,
449  int jobnr)
450 {
451  PlaneContext *p = &s->planes[plane];
452  const int block = p->b;
453  const int buffer_linesize = p->buffer_linesize / sizeof(float);
454  const float depthx = (1 << (s->depth - 8)) * (1 << (s->depth - 8));
455  const float sigma = s->sigma * depthx / (2.f * s->block_size * s->block_size);
456  const float limit = 1.f - s->amount;
457  float *cbuffer = p->buffer[jobnr][CURRENT];
458  const int method = s->method;
459  float *cbuff = cbuffer;
460  float *pbuff = pbuffer;
461 
462  for (int i = 0; i < block; i++) {
463  for (int j = 0; j < block; j++) {
465  AVComplexFloat outbuffer[BSIZE];
466 
467  buffer[0].re = pbuff[2 * j ];
468  buffer[0].im = pbuff[2 * j + 1];
469 
470  buffer[1].re = cbuff[2 * j ];
471  buffer[1].im = cbuff[2 * j + 1];
472 
473  s->tx_r_fn(s->fft_r[jobnr], outbuffer, buffer, sizeof(AVComplexFloat));
474 
475  for (int z = 0; z < 2; z++) {
476  const float re = outbuffer[z].re;
477  const float im = outbuffer[z].im;
478  const float power = re * re + im * im;
479  float factor;
480 
481  switch (method) {
482  case 0:
483  factor = fmaxf(limit, (power - sigma) / (power + 1e-15f));
484  break;
485  case 1:
486  factor = power < sigma ? limit : 1.f;
487  break;
488  }
489 
490  outbuffer[z].re *= factor;
491  outbuffer[z].im *= factor;
492  }
493 
494  s->itx_r_fn(s->ifft_r[jobnr], buffer, outbuffer, sizeof(AVComplexFloat));
495 
496  cbuff[2 * j + 0] = buffer[1].re;
497  cbuff[2 * j + 1] = buffer[1].im;
498  }
499 
500  cbuff += buffer_linesize;
501  pbuff += buffer_linesize;
502  }
503 }
504 
505 static void filter_block2d(FFTdnoizContext *s, int plane,
506  int jobnr)
507 {
508  PlaneContext *p = &s->planes[plane];
509  const int block = p->b;
510  const int method = s->method;
511  const int buffer_linesize = p->buffer_linesize / sizeof(float);
512  const float depthx = (1 << (s->depth - 8)) * (1 << (s->depth - 8));
513  const float sigma = s->sigma * depthx / (s->block_size * s->block_size);
514  const float limit = 1.f - s->amount;
515  float *buff = p->buffer[jobnr][CURRENT];
516 
517  for (int i = 0; i < block; i++) {
518  for (int j = 0; j < block; j++) {
519  float factor, power, re, im;
520 
521  re = buff[j * 2 ];
522  im = buff[j * 2 + 1];
523  power = re * re + im * im;
524  switch (method) {
525  case 0:
526  factor = fmaxf(limit, (power - sigma) / (power + 1e-15f));
527  break;
528  case 1:
529  factor = power < sigma ? limit : 1.f;
530  break;
531  }
532 
533  buff[j * 2 ] *= factor;
534  buff[j * 2 + 1] *= factor;
535  }
536 
537  buff += buffer_linesize;
538  }
539 }
540 
541 static int denoise(AVFilterContext *ctx, void *arg,
542  int jobnr, int nb_jobs)
543 {
544  FFTdnoizContext *s = ctx->priv;
545  AVFrame *out = arg;
546 
547  for (int plane = 0; plane < s->nb_planes; plane++) {
548  PlaneContext *p = &s->planes[plane];
549  const int nox = p->nox;
550  const int noy = p->noy;
551  const int slice_start = (noy * jobnr) / nb_jobs;
552  const int slice_end = (noy * (jobnr+1)) / nb_jobs;
553 
554  if (!((1 << plane) & s->planesf) || ctx->is_disabled)
555  continue;
556 
557  for (int y = slice_start; y < slice_end; y++) {
558  for (int x = 0; x < nox; x++) {
559  if (s->next) {
560  import_block(s, s->next->data[plane], s->next->linesize[plane],
561  p->buffer[jobnr][NEXT], p->buffer_linesize, plane,
562  jobnr, y, x);
563  }
564 
565  if (s->prev) {
566  import_block(s, s->prev->data[plane], s->prev->linesize[plane],
567  p->buffer[jobnr][PREV], p->buffer_linesize, plane,
568  jobnr, y, x);
569  }
570 
571  import_block(s, s->cur->data[plane], s->cur->linesize[plane],
572  p->buffer[jobnr][CURRENT], p->buffer_linesize, plane,
573  jobnr, y, x);
574 
575  if (s->next && s->prev) {
576  filter_block3d2(s, plane, p->buffer[jobnr][PREV], p->buffer[jobnr][NEXT], jobnr);
577  } else if (s->next) {
578  filter_block3d1(s, plane, p->buffer[jobnr][NEXT], jobnr);
579  } else if (s->prev) {
580  filter_block3d1(s, plane, p->buffer[jobnr][PREV], jobnr);
581  } else {
582  filter_block2d(s, plane, jobnr);
583  }
584 
585  export_block(s, out->data[plane], out->linesize[plane],
586  p->buffer[jobnr][CURRENT], p->buffer_linesize, plane,
587  jobnr, y, x);
588  }
589  }
590  }
591 
592  return 0;
593 }
594 
596 {
597  AVFilterContext *ctx = inlink->dst;
598  FFTdnoizContext *s = ctx->priv;
599  AVFilterLink *outlink = ctx->outputs[0];
600  int direct, plane;
601  AVFrame *out;
602 
603  if (s->nb_next > 0 && s->nb_prev > 0) {
604  av_frame_free(&s->prev);
605  s->prev = s->cur;
606  s->cur = s->next;
607  s->next = in;
608 
609  if (!s->prev && s->cur) {
610  s->prev = av_frame_clone(s->cur);
611  if (!s->prev)
612  return AVERROR(ENOMEM);
613  }
614  if (!s->cur)
615  return 0;
616  } else if (s->nb_next > 0) {
617  av_frame_free(&s->cur);
618  s->cur = s->next;
619  s->next = in;
620 
621  if (!s->cur)
622  return 0;
623  } else if (s->nb_prev > 0) {
624  av_frame_free(&s->prev);
625  s->prev = s->cur;
626  s->cur = in;
627 
628  if (!s->prev)
629  s->prev = av_frame_clone(s->cur);
630  if (!s->prev)
631  return AVERROR(ENOMEM);
632  } else {
633  s->cur = in;
634  }
635 
636  if (av_frame_is_writable(in) && s->nb_next == 0 && s->nb_prev == 0) {
637  direct = 1;
638  out = in;
639  } else {
640  direct = 0;
641  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
642  if (!out)
643  return AVERROR(ENOMEM);
644  av_frame_copy_props(out, s->cur);
645  }
646 
648  FFMIN(s->planes[0].noy, s->nb_threads));
649 
650  for (plane = 0; plane < s->nb_planes; plane++) {
651  PlaneContext *p = &s->planes[plane];
652 
653  if (!((1 << plane) & s->planesf) || ctx->is_disabled) {
654  if (!direct)
655  av_image_copy_plane(out->data[plane], out->linesize[plane],
656  s->cur->data[plane], s->cur->linesize[plane],
657  p->planewidth * (1 + (s->depth > 8)), p->planeheight);
658  continue;
659  }
660  }
661 
662  if (s->nb_next == 0 && s->nb_prev == 0) {
663  if (direct) {
664  s->cur = NULL;
665  } else {
666  av_frame_free(&s->cur);
667  }
668  }
669  return ff_filter_frame(outlink, out);
670 }
671 
672 static int request_frame(AVFilterLink *outlink)
673 {
674  AVFilterContext *ctx = outlink->src;
675  FFTdnoizContext *s = ctx->priv;
676  int ret = 0;
677 
678  ret = ff_request_frame(ctx->inputs[0]);
679 
680  if (ret == AVERROR_EOF && (s->nb_next > 0)) {
681  AVFrame *buf;
682 
683  if (s->next && s->nb_next > 0)
684  buf = av_frame_clone(s->next);
685  else if (s->cur)
686  buf = av_frame_clone(s->cur);
687  else
688  buf = av_frame_clone(s->prev);
689  if (!buf)
690  return AVERROR(ENOMEM);
691 
692  ret = filter_frame(ctx->inputs[0], buf);
693  if (ret < 0)
694  return ret;
695  ret = AVERROR_EOF;
696  }
697 
698  return ret;
699 }
700 
702 {
703  FFTdnoizContext *s = ctx->priv;
704  int i;
705 
706  for (i = 0; i < 4; i++) {
707  PlaneContext *p = &s->planes[i];
708 
709  for (int j = 0; j < s->nb_threads; j++) {
710  av_freep(&p->hdata[j]);
711  av_freep(&p->vdata[j]);
712  av_freep(&p->hdata_out[j]);
713  av_freep(&p->vdata_out[j]);
714  av_freep(&p->buffer[j][PREV]);
715  av_freep(&p->buffer[j][CURRENT]);
716  av_freep(&p->buffer[j][NEXT]);
717  }
718  }
719 
720  for (i = 0; i < s->nb_threads; i++) {
721  av_tx_uninit(&s->fft[i]);
722  av_tx_uninit(&s->ifft[i]);
723  av_tx_uninit(&s->fft_r[i]);
724  av_tx_uninit(&s->ifft_r[i]);
725  }
726 
727  av_frame_free(&s->prev);
728  av_frame_free(&s->cur);
729  av_frame_free(&s->next);
730 }
731 
732 static const AVFilterPad fftdnoiz_inputs[] = {
733  {
734  .name = "default",
735  .type = AVMEDIA_TYPE_VIDEO,
736  .filter_frame = filter_frame,
737  .config_props = config_input,
738  },
739 };
740 
741 static const AVFilterPad fftdnoiz_outputs[] = {
742  {
743  .name = "default",
744  .type = AVMEDIA_TYPE_VIDEO,
745  .request_frame = request_frame,
746  },
747 };
748 
750  .name = "fftdnoiz",
751  .description = NULL_IF_CONFIG_SMALL("Denoise frames using 3D FFT."),
752  .priv_size = sizeof(FFTdnoizContext),
753  .uninit = uninit,
757  .priv_class = &fftdnoiz_class,
760  .process_command = ff_filter_process_command,
761 };
filter_block2d
static void filter_block2d(FFTdnoizContext *s, int plane, int jobnr)
Definition: vf_fftdnoiz.c:505
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:112
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:522
CURRENT
@ CURRENT
Definition: vf_fftdnoiz.c:35
denoise
static int denoise(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_fftdnoiz.c:541
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:501
FFTdnoizContext::import_row
void(* import_row)(AVComplexFloat *dst, uint8_t *src, int rw, float scale, float *win, int off)
Definition: vf_fftdnoiz.c:82
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
PlaneContext::buffer_linesize
int buffer_linesize
Definition: vf_fftdnoiz.c:52
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:672
MAX_THREADS
#define MAX_THREADS
Definition: vf_fftdnoiz.c:32
out
FILE * out
Definition: movenc.c:55
FFTdnoizContext::window
int window
Definition: vf_fftdnoiz.c:63
FFTdnoizContext::export_row
void(* export_row)(AVComplexFloat *src, uint8_t *dst, int rw, int depth, float *win)
Definition: vf_fftdnoiz.c:83
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
FFTdnoizContext::nb_next
int nb_next
Definition: vf_fftdnoiz.c:65
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
PlaneContext::buffer
float * buffer[MAX_THREADS][BSIZE]
Definition: vf_fftdnoiz.c:48
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
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
import_row16
static void import_row16(AVComplexFloat *dst, uint8_t *srcp, int rw, float scale, float *win, int off)
Definition: vf_fftdnoiz.c:163
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:514
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:375
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:279
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:521
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:516
AVOption
AVOption.
Definition: opt.h:346
PlaneContext::b
int b
Definition: vf_fftdnoiz.c:44
fftdnoiz_outputs
static const AVFilterPad fftdnoiz_outputs[]
Definition: vf_fftdnoiz.c:741
FFTdnoizContext::ifft
AVTXContext * ifft[MAX_THREADS]
Definition: vf_fftdnoiz.c:76
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
FFTdnoizContext::sigma
float sigma
Definition: vf_fftdnoiz.c:58
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:463
float.h
AVComplexFloat
Definition: tx.h:27
WIN_FUNC_OPTION
#define WIN_FUNC_OPTION(win_func_opt_name, win_func_offset, flag, default_window_func)
Definition: window_func.h:37
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:517
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
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:458
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:374
win
static float win(SuperEqualizerContext *s, float n, int N)
Definition: af_superequalizer.c:120
FFTdnoizContext::cur
AVFrame * cur
Definition: vf_fftdnoiz.c:68
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3005
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:513
AVComplexFloat::im
float im
Definition: tx.h:28
window
static SDL_Window * window
Definition: ffplay.c:361
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:496
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
PlaneContext::planeheight
int planeheight
Definition: vf_fftdnoiz.c:42
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:494
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:523
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
import_block
static void import_block(FFTdnoizContext *s, uint8_t *srcp, int src_linesize, float *buffer, int buffer_linesize, int plane, int jobnr, int y, int x)
Definition: vf_fftdnoiz.c:275
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:462
TFLAGS
#define TFLAGS
Definition: vf_fftdnoiz.c:88
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
MAX_BLOCK
#define MAX_BLOCK
Definition: vf_fftdnoiz.c:31
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
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:283
PlaneContext::vdata
AVComplexFloat * vdata[MAX_THREADS]
Definition: vf_fftdnoiz.c:49
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
FFTdnoizContext::overlap
float overlap
Definition: vf_fftdnoiz.c:61
FFTdnoizContext::itx_r_fn
av_tx_fn itx_r_fn
Definition: vf_fftdnoiz.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
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:498
float
float
Definition: af_crystalizer.c:121
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:499
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:108
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:59
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:1730
AV_TX_FLOAT_FFT
@ AV_TX_FLOAT_FFT
Standard complex to complex FFT with sample data type of AVComplexFloat, AVComplexDouble or AVComplex...
Definition: tx.h:47
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:520
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:475
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
FFTdnoizContext::win
float win[MAX_BLOCK][MAX_BLOCK]
Definition: vf_fftdnoiz.c:74
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:489
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:461
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:593
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_fftdnoiz.c:116
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
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
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
ThreadData::dst
AVFrame * dst
Definition: vf_blend.c:57
PlaneContext::hdata
AVComplexFloat * hdata[MAX_THREADS]
Definition: vf_fftdnoiz.c:49
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:497
FFTdnoizContext::next
AVFrame * next
Definition: vf_fftdnoiz.c:68
FFTdnoizContext::tx_fn
av_tx_fn tx_fn
Definition: vf_fftdnoiz.c:79
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
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:709
PlaneContext::planewidth
int planewidth
Definition: vf_fftdnoiz.c:42
ThreadData::src
const uint8_t * src
Definition: vf_bm3d.c:55
FFTdnoizContext::fft_r
AVTXContext * fft_r[MAX_THREADS]
Definition: vf_fftdnoiz.c:77
FFTdnoizContext
Definition: vf_fftdnoiz.c:55
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
FFTdnoizContext::prev
AVFrame * prev
Definition: vf_fftdnoiz.c:68
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:480
PlaneContext
Definition: ffv1.h:62
generate_window_func
static void generate_window_func(float *lut, int N, int win_func, float *overlap)
Definition: window_func.h:63
PlaneContext::data_linesize
int data_linesize
Definition: vf_fftdnoiz.c:51
abs
#define abs(x)
Definition: cuda_runtime.h:35
WFUNC_HANNING
@ WFUNC_HANNING
Definition: window_func.h:29
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
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:493
FFTdnoizContext::nb_threads
int nb_threads
Definition: vf_fftdnoiz.c:72
FFTdnoizContext::depth
int depth
Definition: vf_fftdnoiz.c:70
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_fftdnoiz.c:183
filter_block3d2
static void filter_block3d2(FFTdnoizContext *s, int plane, float *pbuffer, float *nbuffer, int jobnr)
Definition: vf_fftdnoiz.c:386
f
f
Definition: af_crystalizer.c:121
BSIZE
@ BSIZE
Definition: vf_fftdnoiz.c:38
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
fmaxf
float fmaxf(float, float)
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:483
size
int size
Definition: twinvq_data.h:10344
AVComplexFloat::re
float re
Definition: tx.h:28
PlaneContext::o
int o
Definition: vf_fftdnoiz.c:45
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:485
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:645
FLAGS
#define FLAGS
Definition: vf_fftdnoiz.c:87
FFTdnoizContext::tx_r_fn
av_tx_fn tx_r_fn
Definition: vf_fftdnoiz.c:80
PREV
@ PREV
Definition: vf_fftdnoiz.c:36
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:887
height
#define height
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:174
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:518
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
filter_block3d1
static void filter_block3d1(FFTdnoizContext *s, int plane, float *pbuffer, int jobnr)
Definition: vf_fftdnoiz.c:448
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
FFTdnoizContext::amount
float amount
Definition: vf_fftdnoiz.c:59
FFTdnoizContext::nb_planes
int nb_planes
Definition: vf_fftdnoiz.c:71
FFTdnoizContext::planes
PlaneContext planes[4]
Definition: vf_fftdnoiz.c:73
PlaneContext::vdata_out
AVComplexFloat * vdata_out[MAX_THREADS]
Definition: vf_fftdnoiz.c:50
lrintf
#define lrintf(x)
Definition: libm_mips.h:72
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
FFTdnoizContext::planesf
int planesf
Definition: vf_fftdnoiz.c:66
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:495
common.h
PlaneContext::nox
int nox
Definition: vf_fftdnoiz.c:43
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:827
ThreadData
Used for passing data between threads.
Definition: dsddec.c:71
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
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:107
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
OFFSET
#define OFFSET(x)
Definition: vf_fftdnoiz.c:86
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
limit
static double limit(double x)
Definition: vf_pseudocolor.c:142
NEXT
@ NEXT
Definition: vf_fftdnoiz.c:37
FFTdnoizContext::itx_fn
av_tx_fn itx_fn
Definition: vf_fftdnoiz.c:79
AVFilter
Filter definition.
Definition: avfilter.h:166
FFTdnoizContext::nb_prev
int nb_prev
Definition: vf_fftdnoiz.c:64
ret
ret
Definition: filter_design.txt:187
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fftdnoiz.c:701
export_block
static void export_block(FFTdnoizContext *s, uint8_t *dstp, int dst_linesize, float *buffer, int buffer_linesize, int plane, int jobnr, int y, int x)
Definition: vf_fftdnoiz.c:339
FFTdnoizContext::ifft_r
AVTXContext * ifft_r[MAX_THREADS]
Definition: vf_fftdnoiz.c:77
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:515
fftdnoiz_inputs
static const AVFilterPad fftdnoiz_inputs[]
Definition: vf_fftdnoiz.c:732
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:482
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:487
window_func.h
PlaneContext::hdata_out
AVComplexFloat * hdata_out[MAX_THREADS]
Definition: vf_fftdnoiz.c:50
power
static float power(float r, float g, float b, float max)
Definition: preserve_color.h:45
PlaneContext::noy
int noy
Definition: vf_fftdnoiz.c:43
ff_vf_fftdnoiz
const AVFilter ff_vf_fftdnoiz
Definition: vf_fftdnoiz.c:749
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:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:519
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
slice_start
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition: dec.c:688
export_row16
static void export_row16(AVComplexFloat *src, uint8_t *dstp, int rw, int depth, float *win)
Definition: vf_fftdnoiz.c:175
av_clip_uint8
#define av_clip_uint8
Definition: common.h:105
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:407
factor
static const int factor[16]
Definition: vf_pp7.c:79
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
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:117
desc
const char * desc
Definition: libsvtav1.c:75
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
import_row8
static void import_row8(AVComplexFloat *dst, uint8_t *src, int rw, float scale, float *win, int off)
Definition: vf_fftdnoiz.c:147
FFTdnoizContext::block_size
int block_size
Definition: vf_fftdnoiz.c:60
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
FFTdnoizContext::fft
AVTXContext * fft[MAX_THREADS]
Definition: vf_fftdnoiz.c:76
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_fftdnoiz.c:595
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: intra.c:291
PlaneContext::n
float n
Definition: vf_fftdnoiz.c:46
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
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:80
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:155
imgutils.h
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:79
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:27
export_row8
static void export_row8(AVComplexFloat *src, uint8_t *dst, int rw, int depth, float *win)
Definition: vf_fftdnoiz.c:157
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:484
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:488
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(fftdnoiz)
fftdnoiz_options
static const AVOption fftdnoiz_options[]
Definition: vf_fftdnoiz.c:89
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:460
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:134
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
BufferTypes
BufferTypes
Definition: vf_fftdnoiz.c:34
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:173
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:486
tx.h
FFTdnoizContext::method
int method
Definition: vf_fftdnoiz.c:62