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/audio_fifo.h"
25 #include "libavutil/avstring.h"
26 #include "libavutil/opt.h"
27 #include "avfilter.h"
28 #include "audio.h"
29 #include "formats.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 #define SQR(x) ((x) * (x))
37 
38 typedef struct AudioNLMeansContext {
39  const AVClass *class;
40 
41  float a;
42  int64_t pd;
43  int64_t rd;
44  float m;
45  int om;
46 
49 
50  int K;
51  int S;
52  int N;
53  int H;
54 
55  int offset;
58 
59  int64_t pts;
60 
62  int eof_left;
63 
66 
67 enum OutModes {
72 };
73 
74 #define OFFSET(x) offsetof(AudioNLMeansContext, x)
75 #define AFT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
76 
77 static const AVOption anlmdn_options[] = {
78  { "strength", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10, AFT },
79  { "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10, AFT },
80  { "patch", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
81  { "p", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
82  { "research", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
83  { "r", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
84  { "output", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, "mode" },
85  { "o", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, "mode" },
86  { "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, AFT, "mode" },
87  { "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AFT, "mode" },
88  { "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE},0, 0, AFT, "mode" },
89  { "smooth", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 15, AFT },
90  { "m", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 15, AFT },
91  { NULL }
92 };
93 
94 AVFILTER_DEFINE_CLASS(anlmdn);
95 
97 {
98  static const enum AVSampleFormat sample_fmts[] = {
101  };
103  if (ret < 0)
104  return ret;
105 
107  if (ret < 0)
108  return ret;
109 
111 }
112 
113 static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)
114 {
115  float distance = 0.;
116 
117  for (int k = -K; k <= K; k++)
118  distance += SQR(f1[k] - f2[k]);
119 
120  return distance;
121 }
122 
123 static void compute_cache_c(float *cache, const float *f,
124  ptrdiff_t S, ptrdiff_t K,
125  ptrdiff_t i, ptrdiff_t jj)
126 {
127  int v = 0;
128 
129  for (int j = jj; j < jj + S; j++, v++)
130  cache[v] += -SQR(f[i - K - 1] - f[j - K - 1]) + SQR(f[i + K] - f[j + K]);
131 }
132 
134 {
137 
138  if (ARCH_X86)
139  ff_anlmdn_init_x86(dsp);
140 }
141 
143 {
144  AudioNLMeansContext *s = ctx->priv;
145  AVFilterLink *outlink = ctx->outputs[0];
146  int newK, newS, newH, newN;
147  AVFrame *new_in, *new_cache;
148 
149  newK = av_rescale(s->pd, outlink->sample_rate, AV_TIME_BASE);
150  newS = av_rescale(s->rd, outlink->sample_rate, AV_TIME_BASE);
151 
152  newH = newK * 2 + 1;
153  newN = newH + (newK + newS) * 2;
154 
155  av_log(ctx, AV_LOG_DEBUG, "K:%d S:%d H:%d N:%d\n", newK, newS, newH, newN);
156 
157  if (!s->cache || s->cache->nb_samples < newS * 2) {
158  new_cache = ff_get_audio_buffer(outlink, newS * 2);
159  if (new_cache) {
160  av_frame_free(&s->cache);
161  s->cache = new_cache;
162  } else {
163  return AVERROR(ENOMEM);
164  }
165  }
166  if (!s->cache)
167  return AVERROR(ENOMEM);
168 
169  s->pdiff_lut_scale = 1.f / s->m * WEIGHT_LUT_SIZE;
170  for (int i = 0; i < WEIGHT_LUT_SIZE; i++) {
171  float w = -i / s->pdiff_lut_scale;
172 
173  s->weight_lut[i] = expf(w);
174  }
175 
176  if (!s->in || s->in->nb_samples < newN) {
177  new_in = ff_get_audio_buffer(outlink, newN);
178  if (new_in) {
179  av_frame_free(&s->in);
180  s->in = new_in;
181  } else {
182  return AVERROR(ENOMEM);
183  }
184  }
185  if (!s->in)
186  return AVERROR(ENOMEM);
187 
188  s->K = newK;
189  s->S = newS;
190  s->H = newH;
191  s->N = newN;
192 
193  return 0;
194 }
195 
196 static int config_output(AVFilterLink *outlink)
197 {
198  AVFilterContext *ctx = outlink->src;
199  AudioNLMeansContext *s = ctx->priv;
200  int ret;
201 
202  s->eof_left = -1;
203  s->pts = AV_NOPTS_VALUE;
204 
205  ret = config_filter(ctx);
206  if (ret < 0)
207  return ret;
208 
209  s->fifo = av_audio_fifo_alloc(outlink->format, outlink->channels, s->N);
210  if (!s->fifo)
211  return AVERROR(ENOMEM);
212 
213  ret = av_audio_fifo_write(s->fifo, (void **)s->in->extended_data, s->K + s->S);
214  if (ret < 0)
215  return ret;
216 
217  ff_anlmdn_init(&s->dsp);
218 
219  return 0;
220 }
221 
222 static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
223 {
224  AudioNLMeansContext *s = ctx->priv;
225  AVFrame *out = arg;
226  const int S = s->S;
227  const int K = s->K;
228  const int om = s->om;
229  const float *f = (const float *)(s->in->extended_data[ch]) + K;
230  float *cache = (float *)s->cache->extended_data[ch];
231  const float sw = (65536.f / (4 * K + 2)) / sqrtf(s->a);
232  float *dst = (float *)out->extended_data[ch] + s->offset;
233  const float smooth = s->m;
234 
235  for (int i = S; i < s->H + S; i++) {
236  float P = 0.f, Q = 0.f;
237  int v = 0;
238 
239  if (i == S) {
240  for (int j = i - S; j <= i + S; j++) {
241  if (i == j)
242  continue;
243  cache[v++] = s->dsp.compute_distance_ssd(f + i, f + j, K);
244  }
245  } else {
246  s->dsp.compute_cache(cache, f, S, K, i, i - S);
247  s->dsp.compute_cache(cache + S, f, S, K, i, i + 1);
248  }
249 
250  for (int j = 0; j < 2 * S && !ctx->is_disabled; j++) {
251  const float distance = cache[j];
252  unsigned weight_lut_idx;
253  float w;
254 
255  if (distance < 0.f) {
256  cache[j] = 0.f;
257  continue;
258  }
259  w = distance * sw;
260  if (w >= smooth)
261  continue;
262  weight_lut_idx = w * s->pdiff_lut_scale;
263  av_assert2(weight_lut_idx < WEIGHT_LUT_SIZE);
264  w = s->weight_lut[weight_lut_idx];
265  P += w * f[i - S + j + (j >= S)];
266  Q += w;
267  }
268 
269  P += f[i];
270  Q += 1;
271 
272  switch (om) {
273  case IN_MODE: dst[i - S] = f[i]; break;
274  case OUT_MODE: dst[i - S] = P / Q; break;
275  case NOISE_MODE: dst[i - S] = f[i] - (P / Q); break;
276  }
277  }
278 
279  return 0;
280 }
281 
283 {
284  AVFilterContext *ctx = inlink->dst;
285  AVFilterLink *outlink = ctx->outputs[0];
286  AudioNLMeansContext *s = ctx->priv;
287  AVFrame *out = NULL;
288  int available, wanted, ret;
289 
290  if (s->pts == AV_NOPTS_VALUE)
291  s->pts = in->pts;
292 
293  ret = av_audio_fifo_write(s->fifo, (void **)in->extended_data,
294  in->nb_samples);
295  av_frame_free(&in);
296 
297  s->offset = 0;
298  available = av_audio_fifo_size(s->fifo);
299  wanted = (available / s->H) * s->H;
300 
301  if (wanted >= s->H && available >= s->N) {
302  out = ff_get_audio_buffer(outlink, wanted);
303  if (!out)
304  return AVERROR(ENOMEM);
305  }
306 
307  while (available >= s->N) {
308  ret = av_audio_fifo_peek(s->fifo, (void **)s->in->extended_data, s->N);
309  if (ret < 0)
310  break;
311 
313 
314  av_audio_fifo_drain(s->fifo, s->H);
315 
316  s->offset += s->H;
317  available -= s->H;
318  }
319 
320  if (out) {
321  out->pts = s->pts;
322  out->nb_samples = s->offset;
323  if (s->eof_left >= 0) {
324  out->nb_samples = FFMIN(s->eof_left, s->offset);
325  s->eof_left -= out->nb_samples;
326  }
327  s->pts += av_rescale_q(s->offset, (AVRational){1, outlink->sample_rate}, outlink->time_base);
328 
329  return ff_filter_frame(outlink, out);
330  }
331 
332  return ret;
333 }
334 
335 static int request_frame(AVFilterLink *outlink)
336 {
337  AVFilterContext *ctx = outlink->src;
338  AudioNLMeansContext *s = ctx->priv;
339  int ret;
340 
341  ret = ff_request_frame(ctx->inputs[0]);
342 
343  if (ret == AVERROR_EOF && s->eof_left != 0) {
344  AVFrame *in;
345 
346  if (s->eof_left < 0)
347  s->eof_left = av_audio_fifo_size(s->fifo) - (s->S + s->K);
348  if (s->eof_left <= 0)
349  return AVERROR_EOF;
350  in = ff_get_audio_buffer(outlink, s->H);
351  if (!in)
352  return AVERROR(ENOMEM);
353 
354  return filter_frame(ctx->inputs[0], in);
355  }
356 
357  return ret;
358 }
359 
360 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
361  char *res, int res_len, int flags)
362 {
363  int ret;
364 
365  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
366  if (ret < 0)
367  return ret;
368 
369  ret = config_filter(ctx);
370  if (ret < 0)
371  return ret;
372 
373  return 0;
374 }
375 
377 {
378  AudioNLMeansContext *s = ctx->priv;
379 
380  av_audio_fifo_free(s->fifo);
381  av_frame_free(&s->in);
382  av_frame_free(&s->cache);
383 }
384 
385 static const AVFilterPad inputs[] = {
386  {
387  .name = "default",
388  .type = AVMEDIA_TYPE_AUDIO,
389  .filter_frame = filter_frame,
390  },
391 };
392 
393 static const AVFilterPad outputs[] = {
394  {
395  .name = "default",
396  .type = AVMEDIA_TYPE_AUDIO,
397  .config_props = config_output,
398  .request_frame = request_frame,
399  },
400 };
401 
403  .name = "anlmdn",
404  .description = NULL_IF_CONFIG_SMALL("Reduce broadband noise from stream using Non-Local Means."),
405  .query_formats = query_formats,
406  .priv_size = sizeof(AudioNLMeansContext),
407  .priv_class = &anlmdn_class,
408  .uninit = uninit,
411  .process_command = process_command,
414 };
av_audio_fifo_free
void av_audio_fifo_free(AVAudioFifo *af)
Free an AVAudioFifo.
Definition: audio_fifo.c:45
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:88
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
ff_anlmdn_init
void ff_anlmdn_init(AudioNLMDNDSPContext *dsp)
Definition: af_anlmdn.c:133
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:282
out
FILE * out
Definition: movenc.c:54
OUT_MODE
@ OUT_MODE
Definition: af_anlmdn.c:69
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:1019
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:948
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
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:112
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:396
w
uint8_t w
Definition: llviddspenc.c:38
af_anlmdndsp.h
AVOption
AVOption.
Definition: opt.h:247
WEIGHT_LUT_SIZE
#define WEIGHT_LUT_SIZE
Definition: af_anlmdn.c:34
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: af_anlmdn.c:335
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:238
expf
#define expf(x)
Definition: libm.h:283
ff_request_frame
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:421
AudioNLMeansContext::N
int N
Definition: af_anlmdn.c:52
AudioNLMeansContext::S
int S
Definition: af_anlmdn.c:51
ff_set_common_all_samplerates
int ff_set_common_all_samplerates(AVFilterContext *ctx)
Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
Definition: formats.c:687
float.h
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_anlmdn.c:196
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
AudioNLMeansContext::pdiff_lut_scale
float pdiff_lut_scale
Definition: af_anlmdn.c:47
outputs
static const AVFilterPad outputs[]
Definition: af_anlmdn.c:393
AudioNLMeansContext::in
AVFrame * in
Definition: af_anlmdn.c:56
config_filter
static int config_filter(AVFilterContext *ctx)
Definition: af_anlmdn.c:142
formats.h
S
#define S(s, c, i)
Definition: flacdsp_template.c:46
AVAudioFifo
Context for an Audio FIFO Buffer.
Definition: audio_fifo.c:34
av_audio_fifo_drain
int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples)
Drain data from an AVAudioFifo.
Definition: audio_fifo.c:201
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
AudioNLMeansContext::om
int om
Definition: af_anlmdn.c:45
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
anlmdn_options
static const AVOption anlmdn_options[]
Definition: af_anlmdn.c:77
NOISE_MODE
@ NOISE_MODE
Definition: af_anlmdn.c:70
s
#define s(width, name)
Definition: cbs_vp9.c:257
AudioNLMeansContext::fifo
AVAudioFifo * fifo
Definition: af_anlmdn.c:61
AudioNLMeansContext::offset
int offset
Definition: af_anlmdn.c:55
AudioNLMeansContext::H
int H
Definition: af_anlmdn.c:53
av_audio_fifo_write
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
Write data to an AVAudioFifo.
Definition: audio_fifo.c:112
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
ff_set_common_formats_from_list
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:703
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
SQR
#define SQR(x)
Definition: af_anlmdn.c:36
AudioNLMeansContext
Definition: af_anlmdn.c:38
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:141
AudioNLMDNDSPContext
Definition: af_anlmdndsp.h:31
f
#define f(width, name)
Definition: cbs_vp9.c:255
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:152
arg
const char * arg
Definition: jacosubdec.c:67
if
if(ret)
Definition: filter_design.txt:179
AudioNLMeansContext::cache
AVFrame * cache
Definition: af_anlmdn.c:57
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
AudioNLMeansContext::dsp
AudioNLMDNDSPContext dsp
Definition: af_anlmdn.c:64
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:222
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_audio_fifo_alloc
AVAudioFifo * av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, int nb_samples)
Allocate an AVAudioFifo.
Definition: audio_fifo.c:59
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(anlmdn)
ff_set_common_all_channel_counts
int ff_set_common_all_channel_counts(AVFilterContext *ctx)
Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts())
Definition: formats.c:669
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
OutModes
OutModes
Definition: af_afftdn.c:37
ff_anlmdn_init_x86
void ff_anlmdn_init_x86(AudioNLMDNDSPContext *s)
Definition: af_anlmdn_init.c:28
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:44
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_anlmdn.c:376
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
compute_distance_ssd_c
static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)
Definition: af_anlmdn.c:113
AFT
#define AFT
Definition: af_anlmdn.c:75
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
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:883
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
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:360
AudioNLMeansContext::rd
int64_t rd
Definition: af_anlmdn.c:43
av_audio_fifo_size
int av_audio_fifo_size(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for reading.
Definition: audio_fifo.c:228
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
AudioNLMeansContext::weight_lut
float weight_lut[WEIGHT_LUT_SIZE]
Definition: af_anlmdn.c:48
AudioNLMeansContext::pts
int64_t pts
Definition: af_anlmdn.c:59
AudioNLMeansContext::pd
int64_t pd
Definition: af_anlmdn.c:42
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:369
i
int i
Definition: input.c:406
available
if no frame is available
Definition: filter_design.txt:166
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:350
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
audio_fifo.h
IN_MODE
@ IN_MODE
Definition: af_anlmdn.c:68
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
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:128
ff_af_anlmdn
const AVFilter ff_af_anlmdn
Definition: af_anlmdn.c:402
smooth
static float smooth(DeshakeOpenCLContext *deshake_ctx, float *gauss_kernel, int length, float max_val, AVFifoBuffer *values)
Definition: vf_deshake_opencl.c:903
AVFilter
Filter definition.
Definition: avfilter.h:149
ret
ret
Definition: filter_design.txt:187
NB_MODES
@ NB_MODES
Definition: af_anlmdn.c:71
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_anlmdn.c:96
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
AVFilterContext
An instance of a filter.
Definition: avfilter.h:346
OFFSET
#define OFFSET(x)
Definition: af_anlmdn.c:74
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:123
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:121
audio.h
AudioNLMeansContext::a
float a
Definition: af_anlmdn.c:41
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:153
distance
static float distance(float x, float y, int band)
Definition: nellymoserenc.c:233
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:138
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
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:143
av_audio_fifo_peek
int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples)
Peek data from an AVAudioFifo.
Definition: audio_fifo.c:138
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
AudioNLMeansContext::eof_left
int eof_left
Definition: af_anlmdn.c:62
AudioNLMeansContext::K
int K
Definition: af_anlmdn.c:50
inputs
static const AVFilterPad inputs[]
Definition: af_anlmdn.c:385