FFmpeg
Loading...
Searching...
No Matches
vf_atadenoise.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Paul B Mahol
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21/**
22 * @file
23 * Adaptive Temporal Averaging Denoiser,
24 * based on paper "Video Denoising Based on Adaptive Temporal Averaging" by
25 * David Bartovčak and Miroslav Vrankić
26 */
27
28#include "libavutil/imgutils.h"
29#include "libavutil/opt.h"
30#include "libavutil/pixdesc.h"
31#include "avfilter.h"
32
33#define FF_BUFQUEUE_SIZE 129
34#include "bufferqueue.h"
35
36#include "atadenoise.h"
37#include "filters.h"
38#include "video.h"
39
40#define SIZE FF_BUFQUEUE_SIZE
41
42typedef struct ATADenoiseContext {
43 const AVClass *class;
44
45 float fthra[4], fthrb[4];
46 float sigma[4];
47 int thra[4], thrb[4];
49
50 int planes;
52 int planewidth[4];
54 int linesizes[4];
55
56 struct FFBufQueue q;
57 void *data[4][SIZE];
58 int linesize[4][SIZE];
59 float weights[4][SIZE];
62
63 int (*filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
64
67
68#define OFFSET(x) offsetof(ATADenoiseContext, x)
69#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
70#define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
71
72static const AVOption atadenoise_options[] = {
73 { "0a", "set threshold A for 1st plane", OFFSET(fthra[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
74 { "0b", "set threshold B for 1st plane", OFFSET(fthrb[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
75 { "1a", "set threshold A for 2nd plane", OFFSET(fthra[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
76 { "1b", "set threshold B for 2nd plane", OFFSET(fthrb[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
77 { "2a", "set threshold A for 3rd plane", OFFSET(fthra[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
78 { "2b", "set threshold B for 3rd plane", OFFSET(fthrb[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
79 { "s", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=9}, 5, SIZE, VF },
80 { "p", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=7}, 0, 15, FLAGS },
81 { "a", "set variant of algorithm", OFFSET(algorithm),AV_OPT_TYPE_INT, {.i64=PARALLEL}, 0, NB_ATAA-1, FLAGS, .unit = "a" },
82 { "p", "parallel", 0, AV_OPT_TYPE_CONST, {.i64=PARALLEL}, 0, 0, FLAGS, .unit = "a" },
83 { "s", "serial", 0, AV_OPT_TYPE_CONST, {.i64=SERIAL}, 0, 0, FLAGS, .unit = "a" },
84 { "0s", "set sigma for 1st plane", OFFSET(sigma[0]), AV_OPT_TYPE_FLOAT, {.dbl=INT16_MAX}, 0, INT16_MAX, FLAGS },
85 { "1s", "set sigma for 2nd plane", OFFSET(sigma[1]), AV_OPT_TYPE_FLOAT, {.dbl=INT16_MAX}, 0, INT16_MAX, FLAGS },
86 { "2s", "set sigma for 3rd plane", OFFSET(sigma[2]), AV_OPT_TYPE_FLOAT, {.dbl=INT16_MAX}, 0, INT16_MAX, FLAGS },
87 { NULL }
88};
89
91
121
123{
124 ATADenoiseContext *s = ctx->priv;
125
126 if (!(s->size & 1)) {
127 av_log(ctx, AV_LOG_WARNING, "size %d is invalid. Must be an odd value, setting it to %d.\n", s->size, s->size|1);
128 s->size |= 1;
129 }
130 s->radius = s->size / 2;
131 s->mid = s->radius;
132
133 return 0;
134}
135
136typedef struct ThreadData {
137 AVFrame *in, *out;
138} ThreadData;
139
140#define WFILTER_ROW(type, name) \
141static void fweight_row##name(const uint8_t *ssrc, uint8_t *ddst, \
142 const uint8_t *ssrcf[SIZE], \
143 int w, int mid, int size, \
144 int thra, int thrb, const float *weights) \
145{ \
146 const type *src = (const type *)ssrc; \
147 const type **srcf = (const type **)ssrcf; \
148 type *dst = (type *)ddst; \
149 \
150 for (int x = 0; x < w; x++) { \
151 const int srcx = src[x]; \
152 unsigned lsumdiff = 0, rsumdiff = 0; \
153 unsigned ldiff, rdiff; \
154 float sum = srcx; \
155 float wsum = 1.f; \
156 int srcjx, srcix; \
157 \
158 for (int j = mid - 1, i = mid + 1; j >= 0 && i < size; j--, i++) { \
159 srcjx = srcf[j][x]; \
160 \
161 ldiff = FFABS(srcx - srcjx); \
162 lsumdiff += ldiff; \
163 if (ldiff > thra || \
164 lsumdiff > thrb) \
165 break; \
166 sum += srcjx * weights[j]; \
167 wsum += weights[j]; \
168 \
169 srcix = srcf[i][x]; \
170 \
171 rdiff = FFABS(srcx - srcix); \
172 rsumdiff += rdiff; \
173 if (rdiff > thra || \
174 rsumdiff > thrb) \
175 break; \
176 sum += srcix * weights[i]; \
177 wsum += weights[i]; \
178 } \
179 \
180 dst[x] = lrintf(sum / wsum); \
181 } \
182}
183
184WFILTER_ROW(uint8_t, 8)
185WFILTER_ROW(uint16_t, 16)
186
187#define WFILTER_ROW_SERIAL(type, name) \
188static void fweight_row##name##_serial(const uint8_t *ssrc, uint8_t *ddst, \
189 const uint8_t *ssrcf[SIZE], \
190 int w, int mid, int size, \
191 int thra, int thrb, \
192 const float *weights) \
193{ \
194 const type *src = (const type *)ssrc; \
195 const type **srcf = (const type **)ssrcf; \
196 type *dst = (type *)ddst; \
197 \
198 for (int x = 0; x < w; x++) { \
199 const int srcx = src[x]; \
200 unsigned lsumdiff = 0, rsumdiff = 0; \
201 unsigned ldiff, rdiff; \
202 float sum = srcx; \
203 float wsum = 1.f; \
204 int srcjx, srcix; \
205 \
206 for (int j = mid - 1; j >= 0; j--) { \
207 srcjx = srcf[j][x]; \
208 \
209 ldiff = FFABS(srcx - srcjx); \
210 lsumdiff += ldiff; \
211 if (ldiff > thra || \
212 lsumdiff > thrb) \
213 break; \
214 sum += srcjx * weights[j]; \
215 wsum += weights[j]; \
216 } \
217 \
218 for (int i = mid + 1; i < size; i++) { \
219 srcix = srcf[i][x]; \
220 \
221 rdiff = FFABS(srcx - srcix); \
222 rsumdiff += rdiff; \
223 if (rdiff > thra || \
224 rsumdiff > thrb) \
225 break; \
226 sum += srcix * weights[i]; \
227 wsum += weights[i]; \
228 } \
229 \
230 dst[x] = lrintf(sum / wsum); \
231 } \
232}
233
234WFILTER_ROW_SERIAL(uint8_t, 8)
235WFILTER_ROW_SERIAL(uint16_t, 16)
236
237#define FILTER_ROW(type, name) \
238static void filter_row##name(const uint8_t *ssrc, uint8_t *ddst, \
239 const uint8_t *ssrcf[SIZE], \
240 int w, int mid, int size, \
241 int thra, int thrb, const float *weights) \
242{ \
243 const type *src = (const type *)ssrc; \
244 const type **srcf = (const type **)ssrcf; \
245 type *dst = (type *)ddst; \
246 \
247 for (int x = 0; x < w; x++) { \
248 const int srcx = src[x]; \
249 unsigned lsumdiff = 0, rsumdiff = 0; \
250 unsigned ldiff, rdiff; \
251 unsigned sum = srcx; \
252 int l = 0, r = 0; \
253 int srcjx, srcix; \
254 \
255 for (int j = mid - 1, i = mid + 1; j >= 0 && i < size; j--, i++) { \
256 srcjx = srcf[j][x]; \
257 \
258 ldiff = FFABS(srcx - srcjx); \
259 lsumdiff += ldiff; \
260 if (ldiff > thra || \
261 lsumdiff > thrb) \
262 break; \
263 l++; \
264 sum += srcjx; \
265 \
266 srcix = srcf[i][x]; \
267 \
268 rdiff = FFABS(srcx - srcix); \
269 rsumdiff += rdiff; \
270 if (rdiff > thra || \
271 rsumdiff > thrb) \
272 break; \
273 r++; \
274 sum += srcix; \
275 } \
276 \
277 dst[x] = (sum + ((r + l + 1) >> 1)) / (r + l + 1); \
278 } \
279}
280
281FILTER_ROW(uint8_t, 8)
282FILTER_ROW(uint16_t, 16)
283
284#define FILTER_ROW_SERIAL(type, name) \
285static void filter_row##name##_serial(const uint8_t *ssrc, uint8_t *ddst, \
286 const uint8_t *ssrcf[SIZE], \
287 int w, int mid, int size, \
288 int thra, int thrb, \
289 const float *weights) \
290{ \
291 const type *src = (const type *)ssrc; \
292 const type **srcf = (const type **)ssrcf; \
293 type *dst = (type *)ddst; \
294 \
295 for (int x = 0; x < w; x++) { \
296 const int srcx = src[x]; \
297 unsigned lsumdiff = 0, rsumdiff = 0; \
298 unsigned ldiff, rdiff; \
299 unsigned sum = srcx; \
300 int l = 0, r = 0; \
301 int srcjx, srcix; \
302 \
303 for (int j = mid - 1; j >= 0; j--) { \
304 srcjx = srcf[j][x]; \
305 \
306 ldiff = FFABS(srcx - srcjx); \
307 lsumdiff += ldiff; \
308 if (ldiff > thra || \
309 lsumdiff > thrb) \
310 break; \
311 l++; \
312 sum += srcjx; \
313 } \
314 \
315 for (int i = mid + 1; i < size; i++) { \
316 srcix = srcf[i][x]; \
317 \
318 rdiff = FFABS(srcx - srcix); \
319 rsumdiff += rdiff; \
320 if (rdiff > thra || \
321 rsumdiff > thrb) \
322 break; \
323 r++; \
324 sum += srcix; \
325 } \
326 \
327 dst[x] = (sum + ((r + l + 1) >> 1)) / (r + l + 1); \
328 } \
329}
330
331FILTER_ROW_SERIAL(uint8_t, 8)
332FILTER_ROW_SERIAL(uint16_t, 16)
333
334static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
335{
336 ATADenoiseContext *s = ctx->priv;
337 ThreadData *td = arg;
338 AVFrame *in = td->in;
339 AVFrame *out = td->out;
340 const int size = s->size;
341 const int mid = s->mid;
342 int p, y, i;
343
344 for (p = 0; p < s->nb_planes; p++) {
345 const float *weights = s->weights[p];
346 const int h = s->planeheight[p];
347 const int w = s->planewidth[p];
348 const int slice_start = ff_slice_pos(h, jobnr, nb_jobs);
349 const int slice_end = ff_slice_pos(h, jobnr + 1, nb_jobs);
350 const uint8_t *src = in->data[p] + slice_start * in->linesize[p];
351 uint8_t *dst = out->data[p] + slice_start * out->linesize[p];
352 const int thra = s->thra[p];
353 const int thrb = s->thrb[p];
354 const uint8_t **data = (const uint8_t **)s->data[p];
355 const int *linesize = (const int *)s->linesize[p];
356 const uint8_t *srcf[SIZE];
357
358 if (!((1 << p) & s->planes)) {
359 av_image_copy_plane(dst, out->linesize[p], src, in->linesize[p],
360 s->linesizes[p], slice_end - slice_start);
361 continue;
362 }
363
364 for (i = 0; i < size; i++)
365 srcf[i] = data[i] + slice_start * linesize[i];
366
367 for (y = slice_start; y < slice_end; y++) {
368 s->dsp.filter_row[p](src, dst, srcf, w, mid, size, thra, thrb, weights);
369
370 dst += out->linesize[p];
371 src += in->linesize[p];
372
373 for (i = 0; i < size; i++)
374 srcf[i] += linesize[i];
375 }
376 }
377
378 return 0;
379}
380
381static int config_input(AVFilterLink *inlink)
382{
384 AVFilterContext *ctx = inlink->dst;
385 ATADenoiseContext *s = ctx->priv;
386 int depth, ret;
387
388 s->nb_planes = desc->nb_components;
389
390 s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
391 s->planeheight[0] = s->planeheight[3] = inlink->h;
392 s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
393 s->planewidth[0] = s->planewidth[3] = inlink->w;
394
395 depth = desc->comp[0].depth;
396 s->filter_slice = filter_slice;
397
398 if ((ret = av_image_fill_linesizes(s->linesizes, inlink->format, inlink->w)) < 0)
399 return ret;
400
401 for (int p = 0; p < s->nb_planes; p++) {
402 if (depth == 8 && s->sigma[p] == INT16_MAX)
403 s->dsp.filter_row[p] = s->algorithm == PARALLEL ? filter_row8 : filter_row8_serial;
404 else if (s->sigma[p] == INT16_MAX)
405 s->dsp.filter_row[p] = s->algorithm == PARALLEL ? filter_row16 : filter_row16_serial;
406 else if (depth == 8 && s->sigma[p] < INT16_MAX)
407 s->dsp.filter_row[p] = s->algorithm == PARALLEL ? fweight_row8 : fweight_row8_serial;
408 else if (s->sigma[p] < INT16_MAX)
409 s->dsp.filter_row[p] = s->algorithm == PARALLEL ? fweight_row16 : fweight_row16_serial;
410 }
411
412 s->thra[0] = s->fthra[0] * (1 << depth) - 1;
413 s->thra[1] = s->fthra[1] * (1 << depth) - 1;
414 s->thra[2] = s->fthra[2] * (1 << depth) - 1;
415 s->thrb[0] = s->fthrb[0] * (1 << depth) - 1;
416 s->thrb[1] = s->fthrb[1] * (1 << depth) - 1;
417 s->thrb[2] = s->fthrb[2] * (1 << depth) - 1;
418
419 for (int p = 0; p < s->nb_planes; p++) {
420 float sigma = s->radius * s->sigma[p];
421
422 s->weights[p][s->radius] = 1.f;
423 for (int n = 1; n <= s->radius; n++) {
424 s->weights[p][s->radius + n] =
425 s->weights[p][s->radius - n] = expf(-0.5 * (n + 1) * (n + 1) / (sigma * sigma));
426 }
427 }
428
429#if ARCH_X86 && HAVE_X86ASM
430 ff_atadenoise_init_x86(&s->dsp, depth, s->algorithm, s->sigma);
431#endif
432
433 return 0;
434}
435
436static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
437{
438 AVFilterContext *ctx = inlink->dst;
439 AVFilterLink *outlink = ctx->outputs[0];
440 ATADenoiseContext *s = ctx->priv;
441 AVFrame *out, *in;
442 int i;
443
444 if (s->q.available != s->size) {
445 if (s->q.available < s->mid) {
446 for (i = 0; i < s->mid; i++) {
447 out = av_frame_clone(buf);
448 if (!out) {
449 av_frame_free(&buf);
450 return AVERROR(ENOMEM);
451 }
452 ff_bufqueue_add(ctx, &s->q, out);
453 }
454 }
455 if (s->q.available < s->size) {
456 ff_bufqueue_add(ctx, &s->q, buf);
457 s->available++;
458 }
459 return 0;
460 }
461
462 in = ff_bufqueue_peek(&s->q, s->mid);
463
464 if (!ctx->is_disabled) {
465 ThreadData td;
466
467 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
468 if (!out) {
469 av_frame_free(&buf);
470 return AVERROR(ENOMEM);
471 }
472
473 for (i = 0; i < s->size; i++) {
475
476 s->data[0][i] = frame->data[0];
477 s->data[1][i] = frame->data[1];
478 s->data[2][i] = frame->data[2];
479 s->linesize[0][i] = frame->linesize[0];
480 s->linesize[1][i] = frame->linesize[1];
481 s->linesize[2][i] = frame->linesize[2];
482 }
483
484 td.in = in; td.out = out;
485 ff_filter_execute(ctx, s->filter_slice, &td, NULL,
486 FFMIN3(s->planeheight[1],
487 s->planeheight[2],
490 } else {
491 out = av_frame_clone(in);
492 if (!out) {
493 av_frame_free(&buf);
494 return AVERROR(ENOMEM);
495 }
496 }
497
498 in = ff_bufqueue_get(&s->q);
499 av_frame_free(&in);
500 ff_bufqueue_add(ctx, &s->q, buf);
501
502 return ff_filter_frame(outlink, out);
503}
504
505static int request_frame(AVFilterLink *outlink)
506{
507 AVFilterContext *ctx = outlink->src;
508 ATADenoiseContext *s = ctx->priv;
509 int ret = 0;
510
511 ret = ff_request_frame(ctx->inputs[0]);
512
513 if (ret == AVERROR_EOF && !ctx->is_disabled && s->available) {
514 AVFrame *buf = av_frame_clone(ff_bufqueue_peek(&s->q, s->available));
515 if (!buf)
516 return AVERROR(ENOMEM);
517
518 ret = filter_frame(ctx->inputs[0], buf);
519 s->available--;
520 }
521
522 return ret;
523}
524
526{
527 ATADenoiseContext *s = ctx->priv;
528
530}
531
533 const char *cmd,
534 const char *arg,
535 char *res,
536 int res_len,
537 int flags)
538{
539 int ret = ff_filter_process_command(ctx, cmd, arg, res, res_len, flags);
540
541 if (ret < 0)
542 return ret;
543
544 return config_input(ctx->inputs[0]);
545}
546
547static const AVFilterPad inputs[] = {
548 {
549 .name = "default",
550 .type = AVMEDIA_TYPE_VIDEO,
551 .filter_frame = filter_frame,
552 .config_props = config_input,
553 },
554};
555
556static const AVFilterPad outputs[] = {
557 {
558 .name = "default",
559 .type = AVMEDIA_TYPE_VIDEO,
560 .request_frame = request_frame,
561 },
562};
563
565 .p.name = "atadenoise",
566 .p.description = NULL_IF_CONFIG_SMALL("Apply an Adaptive Temporal Averaging Denoiser."),
567 .p.priv_class = &atadenoise_class,
569 .priv_size = sizeof(ATADenoiseContext),
570 .init = init,
571 .uninit = uninit,
575 .process_command = process_command,
576};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static const AVFilterPad inputs[]
Definition af_aap.c:299
static const AVFilterPad outputs[]
Definition af_aap.c:310
static int config_input(AVFilterLink *inlink)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static int request_frame(AVFilterLink *outlink)
Definition af_aecho.c:272
const FFFilter ff_vf_atadenoise
static FILE * out
static AVFormatContext * ctx
@ NB_ATAA
Definition atadenoise.h:30
@ PARALLEL
Definition atadenoise.h:28
@ SERIAL
Definition atadenoise.h:29
void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int algorithm, const float *sigma)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
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:906
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition avfilter.c:483
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition avfilter.c:1696
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition avfilter.c:846
Main libavfilter public API header.
#define SIZE
static void ff_bufqueue_add(void *log, struct FFBufQueue *queue, AVFrame *buf)
Add a buffer to the queue.
Definition bufferqueue.h:71
static void ff_bufqueue_discard_all(struct FFBufQueue *queue)
Unref and remove all buffers from the queue.
static AVFrame * ff_bufqueue_peek(struct FFBufQueue *queue, unsigned index)
Get a buffer from the queue without altering it.
Definition bufferqueue.h:87
static AVFrame * ff_bufqueue_get(struct FFBufQueue *queue)
Get the first buffer from the queue and remove it.
Definition bufferqueue.h:98
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define FLAGS
Definition cmdutils.c:598
#define AV_CEIL_RSHIFT(a, b)
Definition common.h:60
#define NULL
Definition coverity.c:32
static AVFrame * frame
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition opt.h:254
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#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:204
#define AVERROR_EOF
End of file.
Definition error.h:57
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition frame.c:483
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
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
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition imgutils.c:89
static const int weights[]
Definition hevc_pel.c:32
misc image utilities
static av_cold void uninit(AVBitStreamFilterContext *ctx)
const char * arg
Definition jacosubdec.c:65
#define VF
Definition af_afir.c:733
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
Definition filters.h:763
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
#define expf(x)
Definition libm.h:285
const char * desc
Definition libsvtav1.c:83
static const struct @257111027162314367033347246032313251342043035002 planes[]
uint8_t w
Definition llvidencdsp.c:39
#define FFMIN3(a, b, c)
Definition macros.h:50
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
Definition mpeg12dec.c:1697
const char data[16]
Definition mxf.c:149
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_GBRAP12
Definition pixfmt.h:569
#define AV_PIX_FMT_YUV420P16
Definition pixfmt.h:556
#define AV_PIX_FMT_YUV444P12
Definition pixfmt.h:552
#define AV_PIX_FMT_YUV444P9
Definition pixfmt.h:544
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:545
#define AV_PIX_FMT_YUV440P12
Definition pixfmt.h:551
#define AV_PIX_FMT_GRAY9
Definition pixfmt.h:524
#define AV_PIX_FMT_GBRAP16
Definition pixfmt.h:571
#define AV_PIX_FMT_GBRP9
Definition pixfmt.h:563
#define AV_PIX_FMT_YUV422P9
Definition pixfmt.h:543
#define AV_PIX_FMT_YUVA444P10
Definition pixfmt.h:598
#define AV_PIX_FMT_YUVA420P16
Definition pixfmt.h:601
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:549
#define AV_PIX_FMT_YUVA420P10
Definition pixfmt.h:596
#define AV_PIX_FMT_YUVA422P9
Definition pixfmt.h:594
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:550
#define AV_PIX_FMT_GBRP10
Definition pixfmt.h:564
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_GRAY12
Definition pixfmt.h:526
#define AV_PIX_FMT_GBRP12
Definition pixfmt.h:565
#define AV_PIX_FMT_YUV420P9
Definition pixfmt.h:542
#define AV_PIX_FMT_YUVA420P9
Definition pixfmt.h:593
#define AV_PIX_FMT_YUVA422P10
Definition pixfmt.h:597
#define AV_PIX_FMT_YUV420P14
Definition pixfmt.h:553
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition pixfmt.h:107
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174
@ AV_PIX_FMT_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
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition pixfmt.h:86
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition pixfmt.h:87
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition pixfmt.h:85
#define AV_PIX_FMT_YUVA422P12
Definition pixfmt.h:599
#define AV_PIX_FMT_YUV422P14
Definition pixfmt.h:554
#define AV_PIX_FMT_GRAY10
Definition pixfmt.h:525
#define AV_PIX_FMT_GRAY14
Definition pixfmt.h:527
#define AV_PIX_FMT_YUV422P16
Definition pixfmt.h:557
#define AV_PIX_FMT_YUV440P10
Definition pixfmt.h:547
#define AV_PIX_FMT_GRAY16
Definition pixfmt.h:528
#define AV_PIX_FMT_GBRAP10
Definition pixfmt.h:568
#define AV_PIX_FMT_YUVA444P16
Definition pixfmt.h:603
#define AV_PIX_FMT_YUVA422P16
Definition pixfmt.h:602
#define AV_PIX_FMT_GBRP16
Definition pixfmt.h:567
#define AV_PIX_FMT_YUV444P14
Definition pixfmt.h:555
#define AV_PIX_FMT_YUVA444P9
Definition pixfmt.h:595
#define AV_PIX_FMT_GBRP14
Definition pixfmt.h:566
#define AV_PIX_FMT_YUVA444P12
Definition pixfmt.h:600
#define AV_PIX_FMT_YUV444P16
Definition pixfmt.h:558
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:548
int(* filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int linesize[4][SIZE]
float weights[4][SIZE]
struct FFBufQueue q
ATADenoiseDSPContext dsp
void * data[4][SIZE]
Describe the class of an AVClass context structure.
Definition log.h:76
An instance of a filter.
Definition avfilter.h:273
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:493
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:517
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
Structure holding the queue.
Definition bufferqueue.h:49
Used for passing data between threads.
Definition dsddec.c:71
AVFrame * out
#define av_log(a,...)
#define src
Definition vp8dsp.c:248
int size
static enum AVPixelFormat pixel_fmts[]
Definition vf_amplify.c:52
static int process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define FILTER_ROW(type, name)
#define FILTER_ROW_SERIAL(type, name)
#define WFILTER_ROW(type, name)
static int config_input(AVFilterLink *inlink)
#define SIZE
static int request_frame(AVFilterLink *outlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
static const AVOption atadenoise_options[]
static av_cold void uninit(AVFilterContext *ctx)
#define OFFSET(x)
#define WFILTER_ROW_SERIAL(type, name)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition dec.c:844