FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
af_anlmdn.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/audio_fifo.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "formats.h"
#include "af_anlmdndsp.h"

Go to the source code of this file.

Data Structures

struct  AudioNLMeansContext
 

Macros

#define WEIGHT_LUT_NBITS   20
 
#define WEIGHT_LUT_SIZE   (1<<WEIGHT_LUT_NBITS)
 
#define SQR(x)   ((x) * (x))
 
#define OFFSET(x)   offsetof(AudioNLMeansContext, x)
 
#define AFT   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Enumerations

enum  OutModes {
  IN_MODE, OUT_MODE, NOISE_MODE, NB_MODES,
  IN_MODE, OUT_MODE, NOISE_MODE, NB_MODES,
  IN_MODE, DESIRED_MODE, OUT_MODE, NOISE_MODE,
  NB_OMODES, IN_MODE, OUT_MODE, ESS_MODE,
  NB_MODES
}
 

Functions

 AVFILTER_DEFINE_CLASS (anlmdn)
 
static int query_formats (AVFilterContext *ctx)
 
static float compute_distance_ssd_c (const float *f1, const float *f2, ptrdiff_t K)
 
static void compute_cache_c (float *cache, const float *f, ptrdiff_t S, ptrdiff_t K, ptrdiff_t i, ptrdiff_t jj)
 
void ff_anlmdn_init (AudioNLMDNDSPContext *dsp)
 
static int config_filter (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_channel (AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int request_frame (AVFilterLink *outlink)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption anlmdn_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
const AVFilter ff_af_anlmdn
 

Macro Definition Documentation

◆ WEIGHT_LUT_NBITS

#define WEIGHT_LUT_NBITS   20

Definition at line 33 of file af_anlmdn.c.

◆ WEIGHT_LUT_SIZE

#define WEIGHT_LUT_SIZE   (1<<WEIGHT_LUT_NBITS)

Definition at line 34 of file af_anlmdn.c.

◆ SQR

#define SQR (   x)    ((x) * (x))

Definition at line 36 of file af_anlmdn.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(AudioNLMeansContext, x)

Definition at line 74 of file af_anlmdn.c.

◆ AFT

Definition at line 75 of file af_anlmdn.c.

Enumeration Type Documentation

◆ OutModes

enum OutModes
Enumerator
IN_MODE 
OUT_MODE 
NOISE_MODE 
NB_MODES 
IN_MODE 
OUT_MODE 
NOISE_MODE 
NB_MODES 
IN_MODE 
DESIRED_MODE 
OUT_MODE 
NOISE_MODE 
NB_OMODES 
IN_MODE 
OUT_MODE 
ESS_MODE 
NB_MODES 

Definition at line 67 of file af_anlmdn.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( anlmdn  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 96 of file af_anlmdn.c.

◆ compute_distance_ssd_c()

static float compute_distance_ssd_c ( const float *  f1,
const float *  f2,
ptrdiff_t  K 
)
static

Definition at line 125 of file af_anlmdn.c.

Referenced by ff_anlmdn_init().

◆ 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 
)
static

Definition at line 135 of file af_anlmdn.c.

Referenced by ff_anlmdn_init().

◆ ff_anlmdn_init()

void ff_anlmdn_init ( AudioNLMDNDSPContext dsp)

Definition at line 145 of file af_anlmdn.c.

Referenced by config_output().

◆ config_filter()

static int config_filter ( AVFilterContext ctx)
static

Definition at line 154 of file af_anlmdn.c.

Referenced by config_output(), and process_command().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 208 of file af_anlmdn.c.

◆ filter_channel()

static int filter_channel ( AVFilterContext ctx,
void *  arg,
int  ch,
int  nb_jobs 
)
static

Definition at line 234 of file af_anlmdn.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 294 of file af_anlmdn.c.

Referenced by request_frame().

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 347 of file af_anlmdn.c.

◆ process_command()

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  args,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 372 of file af_anlmdn.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 388 of file af_anlmdn.c.

Variable Documentation

◆ anlmdn_options

const AVOption anlmdn_options[]
static
Initial value:
= {
{ "strength", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10, AFT },
{ "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10, AFT },
{ "patch", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
{ "p", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AFT },
{ "research", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
{ "r", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AFT },
{ "output", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, "mode" },
{ "o", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, "mode" },
{ "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, AFT, "mode" },
{ "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AFT, "mode" },
{ "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE},0, 0, AFT, "mode" },
{ "smooth", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 15, AFT },
{ "m", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 15, AFT },
{ NULL }
}

Definition at line 77 of file af_anlmdn.c.

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}

Definition at line 397 of file af_anlmdn.c.

◆ outputs

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
.request_frame = request_frame,
},
{ NULL }
}

Definition at line 406 of file af_anlmdn.c.

◆ ff_af_anlmdn

const AVFilter ff_af_anlmdn
Initial value:
= {
.name = "anlmdn",
.description = NULL_IF_CONFIG_SMALL("Reduce broadband noise from stream using Non-Local Means."),
.query_formats = query_formats,
.priv_size = sizeof(AudioNLMeansContext),
.priv_class = &anlmdn_class,
}

Definition at line 416 of file af_anlmdn.c.

filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_anlmdn.c:294
OUT_MODE
@ OUT_MODE
Definition: af_anlmdn.c:69
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: af_anlmdn.c:347
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:238
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_anlmdn.c:208
outputs
static const AVFilterPad outputs[]
Definition: af_anlmdn.c:406
NOISE_MODE
@ NOISE_MODE
Definition: af_anlmdn.c:70
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AudioNLMeansContext
Definition: af_anlmdn.c:38
NULL
#define NULL
Definition: coverity.c:32
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:116
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_anlmdn.c:388
AFT
#define AFT
Definition: af_anlmdn.c:75
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:372
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
IN_MODE
@ IN_MODE
Definition: af_anlmdn.c:68
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
OFFSET
#define OFFSET(x)
Definition: af_anlmdn.c:74
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
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:134
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
inputs
static const AVFilterPad inputs[]
Definition: af_anlmdn.c:397