FFmpeg
Loading...
Searching...
No Matches
vf_hqdn3d.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003 Daniel Moreno <comac AT comac DOT darktech DOT org>
3 * Copyright (c) 2010 Baptiste Coudurier
4 * Copyright (c) 2012 Loren Merritt
5 *
6 * This file is part of FFmpeg, ported from MPlayer.
7 *
8 * FFmpeg is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23/**
24 * @file
25 * high quality 3d video denoiser, ported from MPlayer
26 * libmpcodecs/vf_hqdn3d.c.
27 */
28
29#include <float.h>
30
31#include "config.h"
33#include "libavutil/common.h"
34#include "libavutil/mem.h"
35#include "libavutil/pixdesc.h"
37#include "libavutil/opt.h"
38
39#include "avfilter.h"
40#include "filters.h"
41#include "video.h"
42#include "vf_hqdn3d.h"
43
44#define LUT_BITS (depth==16 ? 8 : 4)
45#define LOAD(x) (((depth == 8 ? src[x] : AV_RN16A(src + (x) * 2)) << (16 - depth))\
46 + (((1 << (16 - depth)) - 1) >> 1))
47#define STORE(x,val) (depth == 8 ? dst[x] = (val) >> (16 - depth) : \
48 AV_WN16A(dst + (x) * 2, (val) >> (16 - depth)))
49
51static uint32_t lowpass(int prev, int cur, int16_t *coef, int depth)
52{
53 int d = (prev - cur) >> (8 - LUT_BITS);
54 return cur + coef[d];
55}
56
58static void denoise_temporal(uint8_t *src, uint8_t *dst,
59 uint16_t *frame_ant,
60 int w, int h, int sstride, int dstride,
61 int16_t *temporal, int depth)
62{
63 long x, y;
64 uint32_t tmp;
65
66 temporal += 256 << LUT_BITS;
67
68 for (y = 0; y < h; y++) {
69 for (x = 0; x < w; x++) {
70 frame_ant[x] = tmp = lowpass(frame_ant[x], LOAD(x), temporal, depth);
71 STORE(x, tmp);
72 }
73 src += sstride;
74 dst += dstride;
75 frame_ant += w;
76 }
77}
78
81 uint8_t *src, uint8_t *dst,
82 uint16_t *line_ant, uint16_t *frame_ant,
83 int w, int h, int sstride, int dstride,
84 int16_t *spatial, int16_t *temporal, int depth)
85{
86 long x, y;
87 uint32_t pixel_ant;
88 uint32_t tmp;
89
90 spatial += 256 << LUT_BITS;
91 temporal += 256 << LUT_BITS;
92
93 /* First line has no top neighbor. Only left one for each tmp and
94 * last frame */
95 pixel_ant = LOAD(0);
96 for (x = 0; x < w; x++) {
97 line_ant[x] = tmp = pixel_ant = lowpass(pixel_ant, LOAD(x), spatial, depth);
98 frame_ant[x] = tmp = lowpass(frame_ant[x], tmp, temporal, depth);
99 STORE(x, tmp);
100 }
101
102 for (y = 1; y < h; y++) {
103 src += sstride;
104 dst += dstride;
105 frame_ant += w;
106 if (s->denoise_row[depth]) {
107 s->denoise_row[depth](src, dst, line_ant, frame_ant, w, spatial, temporal);
108 continue;
109 }
110 pixel_ant = LOAD(0);
111 for (x = 0; x < w-1; x++) {
112 line_ant[x] = tmp = lowpass(line_ant[x], pixel_ant, spatial, depth);
113 pixel_ant = lowpass(pixel_ant, LOAD(x+1), spatial, depth);
114 frame_ant[x] = tmp = lowpass(frame_ant[x], tmp, temporal, depth);
115 STORE(x, tmp);
116 }
117 line_ant[x] = tmp = lowpass(line_ant[x], pixel_ant, spatial, depth);
118 frame_ant[x] = tmp = lowpass(frame_ant[x], tmp, temporal, depth);
119 STORE(x, tmp);
120 }
121}
122
125 uint8_t *src, uint8_t *dst,
126 uint16_t *line_ant, uint16_t **frame_ant_ptr,
127 int w, int h, int sstride, int dstride,
128 int16_t *spatial, int16_t *temporal, int depth)
129{
130 // FIXME: For 16-bit depth, frame_ant could be a pointer to the previous
131 // filtered frame rather than a separate buffer.
132 long x, y;
133 uint16_t *frame_ant = *frame_ant_ptr;
134 if (!frame_ant) {
135 uint8_t *frame_src = src;
136 *frame_ant_ptr = frame_ant = av_malloc_array(w, h*sizeof(uint16_t));
137 if (!frame_ant)
138 return AVERROR(ENOMEM);
139 for (y = 0; y < h; y++, src += sstride, frame_ant += w)
140 for (x = 0; x < w; x++)
141 frame_ant[x] = LOAD(x);
142 src = frame_src;
143 frame_ant = *frame_ant_ptr;
144 }
145
146 if (spatial[0])
147 denoise_spatial(s, src, dst, line_ant, frame_ant,
148 w, h, sstride, dstride, spatial, temporal, depth);
149 else
150 denoise_temporal(src, dst, frame_ant,
151 w, h, sstride, dstride, temporal, depth);
152 return 0;
153}
154
155#define denoise(...) \
156 do { \
157 int ret = AVERROR_BUG; \
158 switch (s->depth) { \
159 case 8: ret = denoise_depth(__VA_ARGS__, 8); break; \
160 case 9: ret = denoise_depth(__VA_ARGS__, 9); break; \
161 case 10: ret = denoise_depth(__VA_ARGS__, 10); break; \
162 case 12: ret = denoise_depth(__VA_ARGS__, 12); break; \
163 case 14: ret = denoise_depth(__VA_ARGS__, 14); break; \
164 case 16: ret = denoise_depth(__VA_ARGS__, 16); break; \
165 } \
166 if (ret < 0) \
167 return ret; \
168 } while (0)
169
170static void precalc_coefs(double dist25, int depth, int16_t *ct)
171{
172 int i;
173 double gamma, simil, C;
174
175 gamma = log(0.25) / log(1.0 - FFMIN(dist25,252.0)/255.0 - 0.00001);
176
177 for (i = -(256<<LUT_BITS); i < 256<<LUT_BITS; i++) {
178 double f = (i * (1 << (9-LUT_BITS)) + (1<<(8-LUT_BITS)) - 1) / 512.0; // midpoint of the bin
179 simil = FFMAX(0, 1.0 - fabs(f) / 255.0);
180 C = pow(simil, gamma) * 256.0 * f;
181 ct[(256<<LUT_BITS)+i] = lrint(C);
182 }
183
184 ct[0] = !!dist25;
185}
186
187#define PARAM1_DEFAULT 4.0
188#define PARAM2_DEFAULT 3.0
189#define PARAM3_DEFAULT 6.0
190
192{
193 HQDN3DContext *s = ctx->priv;
194
195 if (!s->strength[LUMA_SPATIAL])
196 s->strength[LUMA_SPATIAL] = PARAM1_DEFAULT;
197 if (!s->strength[CHROMA_SPATIAL])
198 s->strength[CHROMA_SPATIAL] = PARAM2_DEFAULT * s->strength[LUMA_SPATIAL] / PARAM1_DEFAULT;
199 if (!s->strength[LUMA_TMP])
200 s->strength[LUMA_TMP] = PARAM3_DEFAULT * s->strength[LUMA_SPATIAL] / PARAM1_DEFAULT;
201 if (!s->strength[CHROMA_TMP])
202 s->strength[CHROMA_TMP] = s->strength[LUMA_TMP] * s->strength[CHROMA_SPATIAL] / s->strength[LUMA_SPATIAL];
203
204 av_log(ctx, AV_LOG_VERBOSE, "ls:%f cs:%f lt:%f ct:%f\n",
205 s->strength[LUMA_SPATIAL], s->strength[CHROMA_SPATIAL],
206 s->strength[LUMA_TMP], s->strength[CHROMA_TMP]);
207
208 return 0;
209}
210
212{
213 HQDN3DContext *s = ctx->priv;
214
215 av_freep(&s->coefs[0]);
216 av_freep(&s->coefs[1]);
217 av_freep(&s->coefs[2]);
218 av_freep(&s->coefs[3]);
219 av_freep(&s->line[0]);
220 av_freep(&s->line[1]);
221 av_freep(&s->line[2]);
222 av_freep(&s->frame_prev[0]);
223 av_freep(&s->frame_prev[1]);
224 av_freep(&s->frame_prev[2]);
225}
226
240
242{
243 HQDN3DContext *s = ctx->priv;
244
245 for (int i = 0; i < 4; i++)
246 precalc_coefs(s->strength[i], s->depth, s->coefs[i]);
247}
248
249static int config_input(AVFilterLink *inlink)
250{
251 AVFilterContext *ctx = inlink->dst;
252 HQDN3DContext *s = inlink->dst->priv;
254 int i, depth;
255
256 uninit(inlink->dst);
257
258 s->hsub = desc->log2_chroma_w;
259 s->vsub = desc->log2_chroma_h;
260 s->depth = depth = desc->comp[0].depth;
261
262 for (i = 0; i < 3; i++) {
263 s->line[i] = av_malloc_array(inlink->w, sizeof(*s->line[i]));
264 if (!s->line[i])
265 return AVERROR(ENOMEM);
266 }
267
268 for (i = 0; i < 4; i++) {
269 s->coefs[i] = av_malloc((512<<LUT_BITS) * sizeof(int16_t));
270 if (!s->coefs[i])
271 return AVERROR(ENOMEM);
272 }
273
275
276#if ARCH_X86 && HAVE_X86ASM
278#endif
279
280 s->format = inlink->format;
281 s->width = inlink->w;
282 s->height = inlink->h;
283
284 return 0;
285}
286
287typedef struct ThreadData {
288 AVFrame *in, *out;
289} ThreadData;
290
291static int do_denoise(AVFilterContext *ctx, void *data, int job_nr, int n_jobs)
292{
293 HQDN3DContext *s = ctx->priv;
294 const ThreadData *td = data;
295 AVFrame *out = td->out;
296 AVFrame *in = td->in;
297
298 denoise(s, in->data[job_nr], out->data[job_nr],
299 s->line[job_nr], &s->frame_prev[job_nr],
300 AV_CEIL_RSHIFT(in->width, (!!job_nr * s->hsub)),
301 AV_CEIL_RSHIFT(in->height, (!!job_nr * s->vsub)),
302 in->linesize[job_nr], out->linesize[job_nr],
303 s->coefs[job_nr ? CHROMA_SPATIAL : LUMA_SPATIAL],
304 s->coefs[job_nr ? CHROMA_TMP : LUMA_TMP]);
305
306 return 0;
307}
308
309static int filter_frame(AVFilterLink *inlink, AVFrame *in)
310{
311 AVFilterContext *ctx = inlink->dst;
312 AVFilterLink *outlink = ctx->outputs[0];
313 HQDN3DContext *s = ctx->priv;
314
315 AVFrame *out;
316 int direct = av_frame_is_writable(in) && !ctx->is_disabled;
317 ThreadData td;
318 int err, ret[3];
319
320 if (in->format != s->format) {
321 av_frame_free(&in);
322 return AVERROR(EINVAL);
323 }
324
325 if (in->width != s->width || in->height != s->height) {
326 inlink->w = in->width;
327 inlink->h = in->height;
328 if ((err = config_input(inlink)) < 0) {
329 av_frame_free(&in);
330 return err;
331 }
332 outlink->w = in->width;
333 outlink->h = in->height;
334 }
335
336 if (direct) {
337 out = in;
338 } else {
339 out = ff_get_video_buffer(outlink, in->width, in->height);
340 if (!out) {
341 av_frame_free(&in);
342 return AVERROR(ENOMEM);
343 }
344
346 }
347
348 td.in = in;
349 td.out = out;
350 /* one thread per plane */
351 ff_filter_execute(ctx, do_denoise, &td, ret, 3);
352 for (int i = 0; i < FF_ARRAY_ELEMS(ret); i++) {
353 if (ret[i] < 0) {
355 if (!direct)
356 av_frame_free(&in);
357 return ret[i];
358 }
359 }
360
361 if (ctx->is_disabled) {
363 return ff_filter_frame(outlink, in);
364 }
365
366 if (!direct)
367 av_frame_free(&in);
368
369 return ff_filter_frame(outlink, out);
370}
371
372static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
373 char *res, int res_len, int flags)
374{
375 int ret;
376
377 ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
378 if (ret < 0)
379 return ret;
380
382
383 return 0;
384}
385
386#define OFFSET(x) offsetof(HQDN3DContext, x)
387#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
388static const AVOption hqdn3d_options[] = {
389 { "luma_spatial", "spatial luma strength", OFFSET(strength[LUMA_SPATIAL]), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 0, DBL_MAX, FLAGS },
390 { "chroma_spatial", "spatial chroma strength", OFFSET(strength[CHROMA_SPATIAL]), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 0, DBL_MAX, FLAGS },
391 { "luma_tmp", "temporal luma strength", OFFSET(strength[LUMA_TMP]), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 0, DBL_MAX, FLAGS },
392 { "chroma_tmp", "temporal chroma strength", OFFSET(strength[CHROMA_TMP]), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 0, DBL_MAX, FLAGS },
393 { NULL }
394};
395
397
399 {
400 .name = "default",
401 .type = AVMEDIA_TYPE_VIDEO,
402 .config_props = config_input,
403 .filter_frame = filter_frame,
404 },
405};
406
407
409 .p.name = "hqdn3d",
410 .p.description = NULL_IF_CONFIG_SMALL("Apply a High Quality 3D Denoiser."),
411 .p.priv_class = &hqdn3d_class,
413 .priv_size = sizeof(HQDN3DContext),
414 .init = init,
415 .uninit = uninit,
419 .process_command = process_command,
420};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
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)
@ lowpass
Definition af_biquads.c:87
const FFFilter ff_vf_hqdn3d
Definition vf_hqdn3d.c:408
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_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition avfilter.c:1696
Main libavfilter public API header.
#define LUT_BITS
Definition bgmc.c:39
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
#define FLAGS
Definition cmdutils.c:598
common internal and external API header
#define AV_CEIL_RSHIFT(a, b)
Definition common.h:60
#define NULL
Definition coverity.c:32
static __device__ float fabs(float a)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
#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(e)
Definition error.h:45
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition frame.c:535
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
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define C
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
Macro definitions for various function/variable attributes.
#define av_always_inline
Definition attributes.h:72
#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
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
const char * desc
Definition libsvtav1.c:83
uint8_t w
Definition llvidencdsp.c:39
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
Memory handling functions.
const char data[16]
Definition mxf.c:149
#define av_malloc(s)
Definition ops_static.c:52
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#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_YUV422P9
Definition pixfmt.h:543
#define AV_PIX_FMT_YUV420P12
Definition pixfmt.h:549
#define AV_PIX_FMT_YUV422P12
Definition pixfmt.h:550
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_YUV420P9
Definition pixfmt.h:542
#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_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_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_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_YUV422P14
Definition pixfmt.h:554
#define AV_PIX_FMT_YUV422P16
Definition pixfmt.h:557
#define AV_PIX_FMT_YUV440P10
Definition pixfmt.h:547
#define AV_PIX_FMT_YUV444P14
Definition pixfmt.h:555
#define AV_PIX_FMT_YUV444P16
Definition pixfmt.h:558
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:548
#define FF_ARRAY_ELEMS(a)
An instance of a filter.
Definition avfilter.h:273
void * priv
private data for use by the filter
Definition avfilter.h:288
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 width
Definition frame.h:544
int height
Definition frame.h:544
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
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition frame.h:559
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
Used for passing data between threads.
Definition dsddec.c:71
AVFrame * out
#define lrint
Definition tablegen.h:53
#define av_malloc_array(a, b)
#define av_freep(p)
#define av_log(a,...)
static uint8_t tmp[40]
Definition aes_ctr.c:52
#define src
Definition vp8dsp.c:248
static FILE * out
Definition movenc.c:55
static AVFormatContext * ctx
Definition movenc.c:49
#define PARAM1_DEFAULT
Definition vf_hqdn3d.c:187
static av_always_inline void denoise_spatial(HQDN3DContext *s, uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, int w, int h, int sstride, int dstride, int16_t *spatial, int16_t *temporal, int depth)
Definition vf_hqdn3d.c:80
#define LOAD(x)
Definition vf_hqdn3d.c:45
static void calc_coefs(AVFilterContext *ctx)
Definition vf_hqdn3d.c:241
#define STORE(x, val)
Definition vf_hqdn3d.c:47
#define PARAM3_DEFAULT
Definition vf_hqdn3d.c:189
#define PARAM2_DEFAULT
Definition vf_hqdn3d.c:188
static av_always_inline int denoise_depth(HQDN3DContext *s, uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t **frame_ant_ptr, int w, int h, int sstride, int dstride, int16_t *spatial, int16_t *temporal, int depth)
Definition vf_hqdn3d.c:124
static int config_input(AVFilterLink *inlink)
Definition vf_hqdn3d.c:249
static int do_denoise(AVFilterContext *ctx, void *data, int job_nr, int n_jobs)
Definition vf_hqdn3d.c:291
static const AVFilterPad avfilter_vf_hqdn3d_inputs[]
Definition vf_hqdn3d.c:398
static void precalc_coefs(double dist25, int depth, int16_t *ct)
Definition vf_hqdn3d.c:170
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition vf_hqdn3d.c:309
static const AVOption hqdn3d_options[]
Definition vf_hqdn3d.c:388
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition vf_hqdn3d.c:372
static av_cold void uninit(AVFilterContext *ctx)
Definition vf_hqdn3d.c:211
#define OFFSET(x)
Definition vf_hqdn3d.c:386
static av_always_inline void denoise_temporal(uint8_t *src, uint8_t *dst, uint16_t *frame_ant, int w, int h, int sstride, int dstride, int16_t *temporal, int depth)
Definition vf_hqdn3d.c:58
#define denoise(...)
Definition vf_hqdn3d.c:155
#define CHROMA_SPATIAL
Definition vf_hqdn3d.h:46
void ff_hqdn3d_init_x86(HQDN3DContext *hqdn3d)
#define LUMA_TMP
Definition vf_hqdn3d.h:45
#define CHROMA_TMP
Definition vf_hqdn3d.h:47
#define LUMA_SPATIAL
Definition vf_hqdn3d.h:44
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37
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