FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
af_anlmdn.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "filters.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 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, DESIRED_MODE, OUT_MODE, NOISE_MODE,
  ERROR_MODE, NB_OMODES, IN_MODE, OUT_MODE,
  NOISE_MODE, NB_MODES, IN_MODE, OUT_MODE,
  NOISE_MODE, NB_MODES, IN_MODE, DESIRED_MODE,
  OUT_MODE, NOISE_MODE, ERROR_MODE, NB_OMODES,
  IN_MODE, DESIRED_MODE, OUT_MODE, NOISE_MODE,
  ERROR_MODE, NB_OMODES, IN_MODE, OUT_MODE,
  ESS_MODE, NB_MODES
}
 

Functions

 AVFILTER_DEFINE_CLASS (anlmdn)
 
static float sqrdiff (float x, float y)
 
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 activate (AVFilterContext *ctx)
 
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 outputs []
 
const AVFilter ff_af_anlmdn
 

Macro Definition Documentation

◆ WEIGHT_LUT_NBITS

#define WEIGHT_LUT_NBITS   20

Definition at line 31 of file af_anlmdn.c.

◆ WEIGHT_LUT_SIZE

#define WEIGHT_LUT_SIZE   (1<<WEIGHT_LUT_NBITS)

Definition at line 32 of file af_anlmdn.c.

◆ OFFSET

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

Definition at line 65 of file af_anlmdn.c.

◆ AFT

Definition at line 66 of file af_anlmdn.c.

Enumeration Type Documentation

◆ OutModes

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

Definition at line 58 of file af_anlmdn.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( anlmdn  )

◆ sqrdiff()

static float sqrdiff ( float  x,
float  y 
)
inlinestatic

Definition at line 87 of file af_anlmdn.c.

Referenced by compute_cache_c(), and compute_distance_ssd_c().

◆ compute_distance_ssd_c()

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

Definition at line 94 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 104 of file af_anlmdn.c.

Referenced by ff_anlmdn_init().

◆ ff_anlmdn_init()

void ff_anlmdn_init ( AudioNLMDNDSPContext dsp)

Definition at line 114 of file af_anlmdn.c.

Referenced by config_output().

◆ config_filter()

static int config_filter ( AVFilterContext ctx)
static

Definition at line 124 of file af_anlmdn.c.

Referenced by config_output(), and process_command().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 183 of file af_anlmdn.c.

◆ filter_channel()

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

Definition at line 198 of file af_anlmdn.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 267 of file af_anlmdn.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 294 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 324 of file af_anlmdn.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 336 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, 10000, AFT },
{ "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10000, 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, .unit = "mode" },
{ "o", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AFT, .unit = "mode" },
{ "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, AFT, .unit = "mode" },
{ "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AFT, .unit = "mode" },
{ "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE},0, 0, AFT, .unit = "mode" },
{ "smooth", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 1000, AFT },
{ "m", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 1000, AFT },
{ NULL }
}

Definition at line 68 of file af_anlmdn.c.

◆ outputs

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

Definition at line 344 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."),
.priv_size = sizeof(AudioNLMeansContext),
.priv_class = &anlmdn_class,
.process_command = process_command,
}

Definition at line 352 of file af_anlmdn.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
OUT_MODE
@ OUT_MODE
Definition: af_anlmdn.c:60
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition: opt.h:319
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_anlmdn.c:183
outputs
static const AVFilterPad outputs[]
Definition: af_anlmdn.c:344
NOISE_MODE
@ NOISE_MODE
Definition: af_anlmdn.c:61
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AudioNLMeansContext
Definition: af_anlmdn.c:34
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
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:34
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: filters.h:255
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:94
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_anlmdn.c:336
AFT
#define AFT
Definition: af_anlmdn.c:66
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:324
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
IN_MODE
@ IN_MODE
Definition: af_anlmdn.c:59
activate
static int activate(AVFilterContext *ctx)
Definition: af_anlmdn.c:294
NB_MODES
@ NB_MODES
Definition: af_anlmdn.c:62
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
OFFSET
#define OFFSET(x)
Definition: af_anlmdn.c:65
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:152
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:190
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299