FFmpeg
af_anlmdn.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 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 #include <float.h>
22 
23 #include "libavutil/avassert.h"
24 #include "libavutil/opt.h"
25 #include "avfilter.h"
26 #include "audio.h"
27 #include "filters.h"
28 
29 #include "af_anlmdndsp.h"
30 
31 #define WEIGHT_LUT_NBITS 20
32 #define WEIGHT_LUT_SIZE (1<<WEIGHT_LUT_NBITS)
33 
34 typedef struct AudioNLMeansContext {
35  const AVClass *class;
36 
37  float a;
40  float m;
41  int om;
42 
45 
46  int K;
47  int S;
48  int N;
49  int H;
50 
54 
57 
58 enum OutModes {
63 };
64 
65 #define OFFSET(x) offsetof(AudioNLMeansContext, x)
66 #define AFT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
67 
68 static const AVOption anlmdn_options[] = {
69  { "strength", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10000, AFT },
70  { "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10000, AFT },
71  { "patch", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
72  { "p", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
73  { "research", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
74  { "r", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
75  { "output", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, .unit = "mode" },
76  { "o", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, .unit = "mode" },
77  { "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, AFT, .unit = "mode" },
78  { "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AFT, .unit = "mode" },
79  { "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE},0, 0, AFT, .unit = "mode" },
80  { "smooth", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 1000, AFT },
81  { "m", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 1000, AFT },
82  { NULL }
83 };
84 
85 AVFILTER_DEFINE_CLASS(anlmdn);
86 
87 static inline float sqrdiff(float x, float y)
88 {
89  const float diff = x - y;
90 
91  return diff * diff;
92 }
93 
94 static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)
95 {
96  float distance = 0.;
97 
98  for (int k = -K; k <= K; k++)
99  distance += sqrdiff(f1[k], f2[k]);
100 
101  return distance;
102 }
103 
104 static void compute_cache_c(float *cache, const float *f,
105  ptrdiff_t S, ptrdiff_t K,
106  ptrdiff_t i, ptrdiff_t jj)
107 {
108  int v = 0;
109 
110  for (int j = jj; j < jj + S; j++, v++)
111  cache[v] += -sqrdiff(f[i - K - 1], f[j - K - 1]) + sqrdiff(f[i + K], f[j + K]);
112 }
113 
115 {
118 
119 #if ARCH_X86
120  ff_anlmdn_init_x86(dsp);
121 #endif
122 }
123 
125 {
126  AudioNLMeansContext *s = ctx->priv;
127  AVFilterLink *outlink = ctx->outputs[0];
128  int newK, newS, newH, newN;
129 
130  newK = av_rescale(s->pd, outlink->sample_rate, AV_TIME_BASE);
131  newS = av_rescale(s->rd, outlink->sample_rate, AV_TIME_BASE);
132 
133  newH = newK * 2 + 1;
134  newN = newH + (newK + newS) * 2;
135 
136  av_log(ctx, AV_LOG_DEBUG, "K:%d S:%d H:%d N:%d\n", newK, newS, newH, newN);
137 
138  if (!s->cache || s->cache->nb_samples < newS * 2) {
139  AVFrame *new_cache = ff_get_audio_buffer(outlink, newS * 2);
140  if (new_cache) {
141  if (s->cache)
142  av_samples_copy(new_cache->extended_data, s->cache->extended_data, 0, 0,
143  s->cache->nb_samples, new_cache->ch_layout.nb_channels, new_cache->format);
144  av_frame_free(&s->cache);
145  s->cache = new_cache;
146  } else {
147  return AVERROR(ENOMEM);
148  }
149  }
150  if (!s->cache)
151  return AVERROR(ENOMEM);
152 
153  if (!s->window || s->window->nb_samples < newN) {
154  AVFrame *new_window = ff_get_audio_buffer(outlink, newN);
155  if (new_window) {
156  if (s->window)
157  av_samples_copy(new_window->extended_data, s->window->extended_data, 0, 0,
158  s->window->nb_samples, new_window->ch_layout.nb_channels, new_window->format);
159  av_frame_free(&s->window);
160  s->window = new_window;
161  } else {
162  return AVERROR(ENOMEM);
163  }
164  }
165  if (!s->window)
166  return AVERROR(ENOMEM);
167 
168  s->pdiff_lut_scale = 1.f / s->m * WEIGHT_LUT_SIZE;
169  for (int i = 0; i < WEIGHT_LUT_SIZE; i++) {
170  float w = -i / s->pdiff_lut_scale;
171 
172  s->weight_lut[i] = expf(w);
173  }
174 
175  s->K = newK;
176  s->S = newS;
177  s->H = newH;
178  s->N = newN;
179 
180  return 0;
181 }
182 
183 static int config_output(AVFilterLink *outlink)
184 {
185  AVFilterContext *ctx = outlink->src;
186  AudioNLMeansContext *s = ctx->priv;
187  int ret;
188 
189  ret = config_filter(ctx);
190  if (ret < 0)
191  return ret;
192 
193  ff_anlmdn_init(&s->dsp);
194 
195  return 0;
196 }
197 
198 static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
199 {
200  AudioNLMeansContext *s = ctx->priv;
201  AVFrame *out = arg;
202  const int S = s->S;
203  const int K = s->K;
204  const int N = s->N;
205  const int H = s->H;
206  const int om = s->om;
207  const float *f = (const float *)(s->window->extended_data[ch]) + K;
208  float *cache = (float *)s->cache->extended_data[ch];
209  const float sw = (65536.f / (4 * K + 2)) / sqrtf(s->a);
210  float *dst = (float *)out->extended_data[ch];
211  const float *const weight_lut = s->weight_lut;
212  const float pdiff_lut_scale = s->pdiff_lut_scale;
213  const float smooth = fminf(s->m, WEIGHT_LUT_SIZE / pdiff_lut_scale);
214  const int offset = N - H;
215  float *src = (float *)s->window->extended_data[ch];
216  const AVFrame *const in = s->in;
217 
218  memmove(src, &src[H], offset * sizeof(float));
219  memcpy(&src[offset], in->extended_data[ch], in->nb_samples * sizeof(float));
220  memset(&src[offset + in->nb_samples], 0, (H - in->nb_samples) * sizeof(float));
221 
222  for (int i = S; i < H + S; i++) {
223  float P = 0.f, Q = 0.f;
224  int v = 0;
225 
226  if (i == S) {
227  for (int j = i - S; j <= i + S; j++) {
228  if (i == j)
229  continue;
230  cache[v++] = s->dsp.compute_distance_ssd(f + i, f + j, K);
231  }
232  } else {
233  s->dsp.compute_cache(cache, f, S, K, i, i - S);
234  s->dsp.compute_cache(cache + S, f, S, K, i, i + 1);
235  }
236 
237  for (int j = 0; j < 2 * S && !ctx->is_disabled; j++) {
238  float distance = cache[j];
239  unsigned weight_lut_idx;
240  float w;
241 
242  if (distance < 0.f)
243  cache[j] = distance = 0.f;
244  w = distance * sw;
245  if (w >= smooth)
246  continue;
247  weight_lut_idx = w * pdiff_lut_scale;
248  av_assert2(weight_lut_idx < WEIGHT_LUT_SIZE);
249  w = weight_lut[weight_lut_idx];
250  P += w * f[i - S + j + (j >= S)];
251  Q += w;
252  }
253 
254  P += f[i];
255  Q += 1.f;
256 
257  switch (om) {
258  case IN_MODE: dst[i - S] = f[i]; break;
259  case OUT_MODE: dst[i - S] = P / Q; break;
260  case NOISE_MODE: dst[i - S] = f[i] - (P / Q); break;
261  }
262  }
263 
264  return 0;
265 }
266 
268 {
269  AVFilterContext *ctx = inlink->dst;
270  AVFilterLink *outlink = ctx->outputs[0];
271  AudioNLMeansContext *s = ctx->priv;
272  AVFrame *out;
273 
274  if (av_frame_is_writable(in)) {
275  out = in;
276  } else {
277  out = ff_get_audio_buffer(outlink, in->nb_samples);
278  if (!out) {
279  av_frame_free(&in);
280  return AVERROR(ENOMEM);
281  }
282 
283  out->pts = in->pts;
284  }
285 
286  s->in = in;
287  ff_filter_execute(ctx, filter_channel, out, NULL, inlink->ch_layout.nb_channels);
288 
289  if (out != in)
290  av_frame_free(&in);
291  return ff_filter_frame(outlink, out);
292 }
293 
295 {
296  AVFilterLink *inlink = ctx->inputs[0];
297  AVFilterLink *outlink = ctx->outputs[0];
298  AudioNLMeansContext *s = ctx->priv;
299  AVFrame *in = NULL;
300  int ret = 0, status;
301  int64_t pts;
302 
304 
305  ret = ff_inlink_consume_samples(inlink, s->H, s->H, &in);
306  if (ret < 0)
307  return ret;
308 
309  if (ret > 0) {
310  return filter_frame(inlink, in);
311  } else if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
312  ff_outlink_set_status(outlink, status, pts);
313  return 0;
314  } else {
315  if (ff_inlink_queued_samples(inlink) >= s->H) {
317  } else if (ff_outlink_frame_wanted(outlink)) {
319  }
320  return 0;
321  }
322 }
323 
324 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
325  char *res, int res_len, int flags)
326 {
327  int ret;
328 
329  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
330  if (ret < 0)
331  return ret;
332 
333  return config_filter(ctx);
334 }
335 
337 {
338  AudioNLMeansContext *s = ctx->priv;
339 
340  av_frame_free(&s->cache);
341  av_frame_free(&s->window);
342 }
343 
344 static const AVFilterPad outputs[] = {
345  {
346  .name = "default",
347  .type = AVMEDIA_TYPE_AUDIO,
348  .config_props = config_output,
349  },
350 };
351 
353  .name = "anlmdn",
354  .description = NULL_IF_CONFIG_SMALL("Reduce broadband noise from stream using Non-Local Means."),
355  .priv_size = sizeof(AudioNLMeansContext),
356  .priv_class = &anlmdn_class,
357  .activate = activate,
358  .uninit = uninit,
362  .process_command = process_command,
365 };
av_samples_copy
int av_samples_copy(uint8_t *const *dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Copy samples from src to dst.
Definition: samplefmt.c:222
ff_get_audio_buffer
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:97
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
ff_anlmdn_init
void ff_anlmdn_init(AudioNLMDNDSPContext *dsp)
Definition: af_anlmdn.c:114
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
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_anlmdn.c:267
out
FILE * out
Definition: movenc.c:54
OUT_MODE
@ OUT_MODE
Definition: af_anlmdn.c:60
AudioNLMeansContext::window
AVFrame * window
Definition: af_anlmdn.c:53
AudioNLMDNDSPContext::compute_distance_ssd
float(* compute_distance_ssd)(const float *f1, const float *f2, ptrdiff_t K)
Definition: af_anlmdndsp.h:32
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:175
int64_t
long long int64_t
Definition: coverity.c:34
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:130
OutModes
OutModes
Definition: af_aap.c:32
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:456
w
uint8_t w
Definition: llviddspenc.c:38
af_anlmdndsp.h
AVOption
AVOption.
Definition: opt.h:346
WEIGHT_LUT_SIZE
#define WEIGHT_LUT_SIZE
Definition: af_anlmdn.c:32
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:249
expf
#define expf(x)
Definition: libm.h:283
AudioNLMeansContext::N
int N
Definition: af_anlmdn.c:48
AudioNLMeansContext::S
int S
Definition: af_anlmdn.c:47
float.h
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_anlmdn.c:183
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
AudioNLMeansContext::pdiff_lut_scale
float pdiff_lut_scale
Definition: af_anlmdn.c:43
FF_FILTER_FORWARD_STATUS_BACK
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition: filters.h:199
outputs
static const AVFilterPad outputs[]
Definition: af_anlmdn.c:344
AudioNLMeansContext::in
AVFrame * in
Definition: af_anlmdn.c:51
config_filter
static int config_filter(AVFilterContext *ctx)
Definition: af_anlmdn.c:124
S
#define S(s, c, i)
Definition: flacdsp_template.c:46
Q
#define Q(x)
Definition: vvc_filter_template.c:433
AVFrame::ch_layout
AVChannelLayout ch_layout
Channel layout of the audio data.
Definition: frame.h:745
pts
static int64_t pts
Definition: transcode_aac.c:643
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
AudioNLMeansContext::om
int om
Definition: af_anlmdn.c:41
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
anlmdn_options
static const AVOption anlmdn_options[]
Definition: af_anlmdn.c:68
NOISE_MODE
@ NOISE_MODE
Definition: af_anlmdn.c:61
ff_outlink_set_status
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition: filters.h:189
ff_inlink_request_frame
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1571
s
#define s(width, name)
Definition: cbs_vp9.c:198
AudioNLMeansContext::H
int H
Definition: af_anlmdn.c:49
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
fminf
float fminf(float, float)
filters.h
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AudioNLMeansContext
Definition: af_anlmdn.c:34
AudioNLMDNDSPContext
Definition: af_anlmdndsp.h:31
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
arg
const char * arg
Definition: jacosubdec.c:67
AudioNLMeansContext::cache
AVFrame * cache
Definition: af_anlmdn.c:52
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
AudioNLMeansContext::dsp
AudioNLMDNDSPContext dsp
Definition: af_anlmdn.c:55
ff_inlink_consume_samples
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Definition: avfilter.c:1465
NULL
#define NULL
Definition: coverity.c:32
filter_channel
static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
Definition: af_anlmdn.c:198
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(anlmdn)
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:33
sqrtf
static __device__ float sqrtf(float a)
Definition: cuda_runtime.h:184
sqrdiff
static float sqrdiff(float x, float y)
Definition: af_anlmdn.c:87
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1392
ff_anlmdn_init_x86
void ff_anlmdn_init_x86(AudioNLMDNDSPContext *s)
Definition: af_anlmdn_init.c:28
f
f
Definition: af_crystalizer.c:121
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:106
P
#define P
AudioNLMeansContext::m
float m
Definition: af_anlmdn.c:40
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_anlmdn.c:336
compute_distance_ssd_c
static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)
Definition: af_anlmdn.c:94
AFT
#define AFT
Definition: af_anlmdn.c:66
AudioNLMDNDSPContext::compute_cache
void(* compute_cache)(float *cache, const float *f, ptrdiff_t S, ptrdiff_t K, ptrdiff_t i, ptrdiff_t jj)
Definition: af_anlmdndsp.h:33
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:615
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:431
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:890
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:164
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
H
#define H
Definition: pixlet.c:38
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_anlmdn.c:324
N
#define N
Definition: af_mcompand.c:53
AudioNLMeansContext::rd
int64_t rd
Definition: af_anlmdn.c:39
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
AudioNLMeansContext::weight_lut
float weight_lut[WEIGHT_LUT_SIZE]
Definition: af_anlmdn.c:44
AudioNLMeansContext::pd
int64_t pd
Definition: af_anlmdn.c:38
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:67
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:424
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AV_TIME_BASE
#define AV_TIME_BASE
Internal time base represented as integer.
Definition: avutil.h:254
AVFrame::extended_data
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:405
IN_MODE
@ IN_MODE
Definition: af_anlmdn.c:59
activate
static int activate(AVFilterContext *ctx)
Definition: af_anlmdn.c:294
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
ff_inlink_queued_samples
int ff_inlink_queued_samples(AVFilterLink *link)
Definition: avfilter.c:1420
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
ff_af_anlmdn
const AVFilter ff_af_anlmdn
Definition: af_anlmdn.c:352
AVFilter
Filter definition.
Definition: avfilter.h:166
ret
ret
Definition: filter_design.txt:187
NB_MODES
@ NB_MODES
Definition: af_anlmdn.c:62
status
ov_status_e status
Definition: dnn_backend_openvino.c:120
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
avfilter.h
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
OFFSET
#define OFFSET(x)
Definition: af_anlmdn.c:65
compute_cache_c
static void compute_cache_c(float *cache, const float *f, ptrdiff_t S, ptrdiff_t K, ptrdiff_t i, ptrdiff_t jj)
Definition: af_anlmdn.c:104
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
audio.h
AudioNLMeansContext::a
float a
Definition: af_anlmdn.c:37
smooth
static float smooth(DeshakeOpenCLContext *deshake_ctx, float *gauss_kernel, int length, float max_val, AVFifo *values)
Definition: vf_deshake_opencl.c:888
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
K
#define K
Definition: palette.c:25
distance
static float distance(float x, float y, int band)
Definition: nellymoserenc.c:230
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
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ff_outlink_frame_wanted
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
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
AudioNLMeansContext::K
int K
Definition: af_anlmdn.c:46
ff_filter_set_ready
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition: avfilter.c:234