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 AF   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  OutModes {
  IN_MODE, OUT_MODE, NOISE_MODE, NB_MODES,
  IN_MODE, OUT_MODE, NOISE_MODE, NB_MODES,
  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_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 av_cold void uninit (AVFilterContext *ctx)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 

Variables

static const AVOption anlmdn_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
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.

◆ AF

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 
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 91 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 120 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 130 of file af_anlmdn.c.

Referenced by ff_anlmdn_init().

◆ ff_anlmdn_init()

void ff_anlmdn_init ( AudioNLMDNDSPContext dsp)

Definition at line 140 of file af_anlmdn.c.

Referenced by config_output().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 149 of file af_anlmdn.c.

◆ filter_channel()

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

Definition at line 195 of file af_anlmdn.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 255 of file af_anlmdn.c.

Referenced by request_frame().

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 308 of file af_anlmdn.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

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

Variable Documentation

◆ anlmdn_options

const AVOption anlmdn_options[]
static
Initial value:
= {
{ "s", "set denoising strength", OFFSET(a), AV_OPT_TYPE_FLOAT, {.dbl=0.00001},0.00001, 10, AF },
{ "p", "set patch duration", OFFSET(pd), AV_OPT_TYPE_DURATION, {.i64=2000}, 1000, 100000, AF },
{ "r", "set research duration", OFFSET(rd), AV_OPT_TYPE_DURATION, {.i64=6000}, 2000, 300000, AF },
{ "o", "set output mode", OFFSET(om), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_MODES-1, AF, "mode" },
{ "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, AF, "mode" },
{ "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AF, "mode" },
{ "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE},0, 0, AF, "mode" },
{ "m", "set smooth factor", OFFSET(m), AV_OPT_TYPE_FLOAT, {.dbl=11.}, 1, 15, AF },
{ 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 365 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 374 of file af_anlmdn.c.

◆ ff_af_anlmdn

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 384 of file af_anlmdn.c.

filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_anlmdn.c:255
OUT_MODE
@ OUT_MODE
Definition: af_anlmdn.c:69
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: af_anlmdn.c:308
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:237
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_anlmdn.c:149
outputs
static const AVFilterPad outputs[]
Definition: af_anlmdn.c:374
AF
#define AF
Definition: af_anlmdn.c:75
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:188
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_anlmdn.c:333
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:342
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
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:91
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
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:116
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:133
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
inputs
static const AVFilterPad inputs[]
Definition: af_anlmdn.c:365