FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
af_anlmdn.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "formats.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, 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 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 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.

◆ OFFSET

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

Definition at line 67 of file af_anlmdn.c.

◆ AFT

Definition at line 68 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 60 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 89 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 96 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 106 of file af_anlmdn.c.

Referenced by ff_anlmdn_init().

◆ ff_anlmdn_init()

void ff_anlmdn_init ( AudioNLMDNDSPContext dsp)

Definition at line 116 of file af_anlmdn.c.

Referenced by config_output().

◆ config_filter()

static int config_filter ( AVFilterContext ctx)
static

Definition at line 126 of file af_anlmdn.c.

Referenced by config_output(), and process_command().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 185 of file af_anlmdn.c.

◆ filter_channel()

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

Definition at line 200 of file af_anlmdn.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 269 of file af_anlmdn.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

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

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 338 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, "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, 1000, AFT },
{ "m", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 1000, AFT },
{ NULL }
}

Definition at line 70 of file af_anlmdn.c.

◆ inputs

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

Definition at line 346 of file af_anlmdn.c.

◆ outputs

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

Definition at line 353 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 361 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:62
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:187
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:239
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_anlmdn.c:185
outputs
static const AVFilterPad outputs[]
Definition: af_anlmdn.c:353
NOISE_MODE
@ NOISE_MODE
Definition: af_anlmdn.c:63
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AudioNLMeansContext
Definition: af_anlmdn.c:36
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
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:115
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_anlmdn.c:338
AFT
#define AFT
Definition: af_anlmdn.c:68
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:326
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
IN_MODE
@ IN_MODE
Definition: af_anlmdn.c:61
activate
static int activate(AVFilterContext *ctx)
Definition: af_anlmdn.c:296
NB_MODES
@ NB_MODES
Definition: af_anlmdn.c:64
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
OFFSET
#define OFFSET(x)
Definition: af_anlmdn.c:67
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
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195
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:150
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
inputs
static const AVFilterPad inputs[]
Definition: af_anlmdn.c:346