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/avstring.h"
25 #include "libavutil/opt.h"
26 #include "avfilter.h"
27 #include "audio.h"
28 #include "formats.h"
29 #include "filters.h"
30 
31 #include "af_anlmdndsp.h"
32 
33 #define WEIGHT_LUT_NBITS 20
34 #define WEIGHT_LUT_SIZE (1<<WEIGHT_LUT_NBITS)
35 
36 typedef struct AudioNLMeansContext {
37  const AVClass *class;
38 
39  float a;
40  int64_t pd;
41  int64_t rd;
42  float m;
43  int om;
44 
47 
48  int K;
49  int S;
50  int N;
51  int H;
52 
56 
59 
60 enum OutModes {
65 };
66 
67 #define OFFSET(x) offsetof(AudioNLMeansContext, x)
68 #define AFT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
69 
70 static const AVOption anlmdn_options[] = {
71  { "strength", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10000, AFT },
72  { "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10000, AFT },
73  { "patch", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
74  { "p", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
75  { "research", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
76  { "r", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
77  { "output", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, "mode" },
78  { "o", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, "mode" },
79  { "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, AFT, "mode" },
80  { "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AFT, "mode" },
81  { "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE},0, 0, AFT, "mode" },
82  { "smooth", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 1000, AFT },
83  { "m", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 1000, AFT },
84  { NULL }
85 };
86 
87 AVFILTER_DEFINE_CLASS(anlmdn);
88 
89 static inline float sqrdiff(float x, float y)
90 {
91  const float diff = x - y;
92 
93  return diff * diff;
94 }
95 
96 static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)
97 {
98  float distance = 0.;
99 
100  for (int k = -K; k <= K; k++)
101  distance += sqrdiff(f1[k], f2[k]);
102 
103  return distance;
104 }
105 
106 static void compute_cache_c(float *cache, const float *f,
107  ptrdiff_t S, ptrdiff_t K,
108  ptrdiff_t i, ptrdiff_t jj)
109 {
110  int v = 0;
111 
112  for (int j = jj; j < jj + S; j++, v++)
113  cache[v] += -sqrdiff(f[i - K - 1], f[j - K - 1]) + sqrdiff(f[i + K], f[j + K]);
114 }
115 
117 {
120 
121 #if ARCH_X86
122  ff_anlmdn_init_x86(dsp);
123 #endif
124 }
125 
127 {
128  AudioNLMeansContext *s = ctx->priv;
129  AVFilterLink *outlink = ctx->outputs[0];
130  int newK, newS, newH, newN;
131 
132  newK = av_rescale(s->pd, outlink->sample_rate, AV_TIME_BASE);
133  newS = av_rescale(s->rd, outlink->sample_rate, AV_TIME_BASE);
134 
135  newH = newK * 2 + 1;
136  newN = newH + (newK + newS) * 2;
137 
138  av_log(ctx, AV_LOG_DEBUG, "K:%d S:%d H:%d N:%d\n", newK, newS, newH, newN);
139 
140  if (!s->cache || s->cache->nb_samples < newS * 2) {
141  AVFrame *new_cache = ff_get_audio_buffer(outlink, newS * 2);
142  if (new_cache) {
143  if (s->cache)
144  av_samples_copy(new_cache->extended_data, s->cache->extended_data, 0, 0,
145  s->cache->nb_samples, new_cache->ch_layout.nb_channels, new_cache->format);
146  av_frame_free(&s->cache);
147  s->cache = new_cache;
148  } else {
149  return AVERROR(ENOMEM);
150  }
151  }
152  if (!s->cache)
153  return AVERROR(ENOMEM);
154 
155  if (!s->window || s->window->nb_samples < newN) {
156  AVFrame *new_window = ff_get_audio_buffer(outlink, newN);
157  if (new_window) {
158  if (s->window)
159  av_samples_copy(new_window->extended_data, s->window->extended_data, 0, 0,
160  s->window->nb_samples, new_window->ch_layout.nb_channels, new_window->format);
161  av_frame_free(&s->window);
162  s->window = new_window;
163  } else {
164  return AVERROR(ENOMEM);
165  }
166  }
167  if (!s->window)
168  return AVERROR(ENOMEM);
169 
170  s->pdiff_lut_scale = 1.f / s->m * WEIGHT_LUT_SIZE;
171  for (int i = 0; i < WEIGHT_LUT_SIZE; i++) {
172  float w = -i / s->pdiff_lut_scale;
173 
174  s->weight_lut[i] = expf(w);
175  }
176 
177  s->K = newK;
178  s->S = newS;
179  s->H = newH;
180  s->N = newN;
181 
182  return 0;
183 }
184 
185 static int config_output(AVFilterLink *outlink)
186 {
187  AVFilterContext *ctx = outlink->src;
188  AudioNLMeansContext *s = ctx->priv;
189  int ret;
190 
191  ret = config_filter(ctx);
192  if (ret < 0)
193  return ret;
194 
195  ff_anlmdn_init(&s->dsp);
196 
197  return 0;
198 }
199 
200 static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
201 {
202  AudioNLMeansContext *s = ctx->priv;
203  AVFrame *out = arg;
204  const int S = s->S;
205  const int K = s->K;
206  const int N = s->N;
207  const int H = s->H;
208  const int om = s->om;
209  const float *f = (const float *)(s->window->extended_data[ch]) + K;
210  float *cache = (float *)s->cache->extended_data[ch];
211  const float sw = (65536.f / (4 * K + 2)) / sqrtf(s->a);
212  float *dst = (float *)out->extended_data[ch];
213  const float *const weight_lut = s->weight_lut;
214  const float pdiff_lut_scale = s->pdiff_lut_scale;
215  const float smooth = fminf(s->m, WEIGHT_LUT_SIZE / pdiff_lut_scale);
216  const int offset = N - H;
217  float *src = (float *)s->window->extended_data[ch];
218  const AVFrame *const in = s->in;
219 
220  memmove(src, &src[H], offset * sizeof(float));
221  memcpy(&src[offset], in->extended_data[ch], in->nb_samples * sizeof(float));
222  memset(&src[offset + in->nb_samples], 0, (H - in->nb_samples) * sizeof(float));
223 
224  for (int i = S; i < H + S; i++) {
225  float P = 0.f, Q = 0.f;
226  int v = 0;
227 
228  if (i == S) {
229  for (int j = i - S; j <= i + S; j++) {
230  if (i == j)
231  continue;
232  cache[v++] = s->dsp.compute_distance_ssd(f + i, f + j, K);
233  }
234  } else {
235  s->dsp.compute_cache(cache, f, S, K, i, i - S);
236  s->dsp.compute_cache(cache + S, f, S, K, i, i + 1);
237  }
238 
239  for (int j = 0; j < 2 * S && !ctx->is_disabled; j++) {
240  float distance = cache[j];
241  unsigned weight_lut_idx;
242  float w;
243 
244  if (distance < 0.f)
245  cache[j] = distance = 0.f;
246  w = distance * sw;
247  if (w >= smooth)
248  continue;
249  weight_lut_idx = w * pdiff_lut_scale;
250  av_assert2(weight_lut_idx < WEIGHT_LUT_SIZE);
251  w = weight_lut[weight_lut_idx];
252  P += w * f[i - S + j + (j >= S)];
253  Q += w;
254  }
255 
256  P += f[i];
257  Q += 1.f;
258 
259  switch (om) {
260  case IN_MODE: dst[i - S] = f[i]; break;
261  case OUT_MODE: dst[i - S] = P / Q; break;
262  case NOISE_MODE: dst[i - S] = f[i] - (P / Q); break;
263  }
264  }
265 
266  return 0;
267 }
268 
270 {
271  AVFilterContext *ctx = inlink->dst;
272  AVFilterLink *outlink = ctx->outputs[0];
273  AudioNLMeansContext *s = ctx->priv;
274  AVFrame *out;
275 
276  if (av_frame_is_writable(in)) {
277  out = in;
278  } else {
279  out = ff_get_audio_buffer(outlink, in->nb_samples);
280  if (!out) {
281  av_frame_free(&in);
282  return AVERROR(ENOMEM);
283  }
284 
285  out->pts = in->pts;
286  }
287 
288  s->in = in;
289  ff_filter_execute(ctx, filter_channel, out, NULL, inlink->ch_layout.nb_channels);
290 
291  if (out != in)
292  av_frame_free(&in);
293  return ff_filter_frame(outlink, out);
294 }
295 
297 {
298  AVFilterLink *inlink = ctx->inputs[0];
299  AVFilterLink *outlink = ctx->outputs[0];
300  AudioNLMeansContext *s = ctx->priv;
301  AVFrame *in = NULL;
302  int ret = 0, status;
303  int64_t pts;
304 
306 
307  ret = ff_inlink_consume_samples(inlink, s->H, s->H, &in);
308  if (ret < 0)
309  return ret;
310 
311  if (ret > 0) {
312  return filter_frame(inlink, in);
313  } else if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
314  ff_outlink_set_status(outlink, status, pts);
315  return 0;
316  } else {
317  if (ff_inlink_queued_samples(inlink) >= s->H) {
319  } else if (ff_outlink_frame_wanted(outlink)) {
321  }
322  return 0;
323  }
324 }
325 
326 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
327  char *res, int res_len, int flags)
328 {
329  int ret;
330 
331  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
332  if (ret < 0)
333  return ret;
334 
335  return config_filter(ctx);
336 }
337 
339 {
340  AudioNLMeansContext *s = ctx->priv;
341 
342  av_frame_free(&s->cache);
343  av_frame_free(&s->window);
344 }
345 
346 static const AVFilterPad inputs[] = {
347  {
348  .name = "default",
349  .type = AVMEDIA_TYPE_AUDIO,
350  },
351 };
352 
353 static const AVFilterPad outputs[] = {
354  {
355  .name = "default",
356  .type = AVMEDIA_TYPE_AUDIO,
357  .config_props = config_output,
358  },
359 };
360 
362  .name = "anlmdn",
363  .description = NULL_IF_CONFIG_SMALL("Reduce broadband noise from stream using Non-Local Means."),
364  .priv_size = sizeof(AudioNLMeansContext),
365  .priv_class = &anlmdn_class,
366  .activate = activate,
367  .uninit = uninit,
371  .process_command = process_command,
374 };
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:100
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
status
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
ff_anlmdn_init
void ff_anlmdn_init(AudioNLMDNDSPContext *dsp)
Definition: af_anlmdn.c:116
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:269
out
FILE * out
Definition: movenc.c:54
OUT_MODE
@ OUT_MODE
Definition: af_anlmdn.c:62
AudioNLMeansContext::window
AVFrame * window
Definition: af_anlmdn.c:55
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:999
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:183
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:111
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:432
w
uint8_t w
Definition: llviddspenc.c:38
af_anlmdndsp.h
AVOption
AVOption.
Definition: opt.h:251
WEIGHT_LUT_SIZE
#define WEIGHT_LUT_SIZE
Definition: af_anlmdn.c:34
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:239
expf
#define expf(x)
Definition: libm.h:283
AudioNLMeansContext::N
int N
Definition: af_anlmdn.c:50
AudioNLMeansContext::S
int S
Definition: af_anlmdn.c:49
float.h
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_anlmdn.c:185
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:175
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:300
AudioNLMeansContext::pdiff_lut_scale
float pdiff_lut_scale
Definition: af_anlmdn.c:45
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:353
AudioNLMeansContext::in
AVFrame * in
Definition: af_anlmdn.c:53
config_filter
static int config_filter(AVFilterContext *ctx)
Definition: af_anlmdn.c:126
formats.h
S
#define S(s, c, i)
Definition: flacdsp_template.c:46
AVFrame::ch_layout
AVChannelLayout ch_layout
Channel layout of the audio data.
Definition: frame.h:704
pts
static int64_t pts
Definition: transcode_aac.c:654
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
AudioNLMeansContext::om
int om
Definition: af_anlmdn.c:43
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
anlmdn_options
static const AVOption anlmdn_options[]
Definition: af_anlmdn.c:70
NOISE_MODE
@ NOISE_MODE
Definition: af_anlmdn.c:63
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:1511
s
#define s(width, name)
Definition: cbs_vp9.c:256
AudioNLMeansContext::H
int H
Definition: af_anlmdn.c:51
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:36
AudioNLMDNDSPContext
Definition: af_anlmdndsp.h:31
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
arg
const char * arg
Definition: jacosubdec.c:67
AudioNLMeansContext::cache
AVFrame * cache
Definition: af_anlmdn.c:54
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
AudioNLMeansContext::dsp
AudioNLMDNDSPContext dsp
Definition: af_anlmdn.c:57
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:1413
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:200
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(anlmdn)
sqrdiff
static float sqrdiff(float x, float y)
Definition: af_anlmdn.c:89
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:1348
OutModes
OutModes
Definition: af_afftdn.c:43
ff_anlmdn_init_x86
void ff_anlmdn_init_x86(AudioNLMDNDSPContext *s)
Definition: af_anlmdn_init.c:28
f
f
Definition: af_crystalizer.c:122
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
P
#define P
AudioNLMeansContext::m
float m
Definition: af_anlmdn.c:42
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_anlmdn.c:338
compute_distance_ssd_c
static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)
Definition: af_anlmdn.c:96
AFT
#define AFT
Definition: af_anlmdn.c:68
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:523
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:412
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:863
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:40
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:326
N
#define N
Definition: af_mcompand.c:53
AudioNLMeansContext::rd
int64_t rd
Definition: af_anlmdn.c:41
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
AudioNLMeansContext::weight_lut
float weight_lut[WEIGHT_LUT_SIZE]
Definition: af_anlmdn.c:46
AudioNLMeansContext::pd
int64_t pd
Definition: af_anlmdn.c:40
av_samples_copy
int av_samples_copy(uint8_t **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
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:405
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
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:386
IN_MODE
@ IN_MODE
Definition: af_anlmdn.c:61
activate
static int activate(AVFilterContext *ctx)
Definition: af_anlmdn.c:296
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:55
ff_inlink_queued_samples
int ff_inlink_queued_samples(AVFilterLink *link)
Definition: avfilter.c:1373
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:361
AVFilter
Filter definition.
Definition: avfilter.h:171
ret
ret
Definition: filter_design.txt:187
NB_MODES
@ NB_MODES
Definition: af_anlmdn.c:64
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avfilter.h
AVFilterContext
An instance of a filter.
Definition: avfilter.h:408
OFFSET
#define OFFSET(x)
Definition: af_anlmdn.c:67
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:106
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:127
audio.h
AudioNLMeansContext::a
float a
Definition: af_anlmdn.c:39
diff
static av_always_inline int diff(const uint32_t a, const uint32_t b)
Definition: vf_palettegen.c:139
smooth
static float smooth(DeshakeOpenCLContext *deshake_ctx, float *gauss_kernel, int length, float max_val, AVFifo *values)
Definition: vf_deshake_opencl.c:889
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
distance
static float distance(float x, float y, int band)
Definition: nellymoserenc.c:228
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:160
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
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
avstring.h
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:142
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
AudioNLMeansContext::K
int K
Definition: af_anlmdn.c:48
inputs
static const AVFilterPad inputs[]
Definition: af_anlmdn.c:346
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:191