FFmpeg
Data Structures | Macros | Functions | Variables
af_mcompand.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/ffmath.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "audio.h"
#include "avfilter.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  CompandSegment
 
struct  CompandT
 
struct  PrevCrossover
 
struct  Crossover
 
struct  CompBand
 
struct  MCompandContext
 

Macros

#define N   4
 
#define OFFSET(x)   offsetof(MCompandContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define S(x)   s->segments[2 * ((x) + 1)]
 
#define S(x)   s->segments[2 * (x)]
 
#define L(x)   s->segments[i - (x)]
 
#define CONVOLVE   _ _ _ _
 
#define _
 
#define _
 

Functions

 AVFILTER_DEFINE_CLASS (mcompand)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static void count_items (char *item_str, int *nb_items, char delimiter)
 
static void update_volume (CompBand *cb, double in, int ch)
 
static double get_volume (CompandT *s, double in_lin)
 
static int parse_points (char *points, int nb_points, double radius, CompandT *s, AVFilterContext *ctx)
 
static void square_quadratic (double const *x, double *y)
 
static int crossover_setup (AVFilterLink *outlink, Crossover *p, double frequency)
 
static int config_output (AVFilterLink *outlink)
 
static void crossover (int ch, Crossover *p, double *ibuf, double *obuf_low, double *obuf_high, size_t len)
 
static int mcompand_channel (MCompandContext *c, CompBand *l, double *ibuf, double *obuf, int len, int ch)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int request_frame (AVFilterLink *outlink)
 

Variables

static const AVOption mcompand_options []
 
static const AVFilterPad mcompand_inputs []
 
static const AVFilterPad mcompand_outputs []
 
const AVFilter ff_af_mcompand
 

Detailed Description

audio multiband compand filter

Definition in file af_mcompand.c.

Macro Definition Documentation

◆ N

#define N   4

Definition at line 53 of file af_mcompand.c.

◆ OFFSET

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

Definition at line 93 of file af_mcompand.c.

◆ A

Definition at line 94 of file af_mcompand.c.

◆ S [1/2]

#define S (   x)    s->segments[2 * ((x) + 1)]

◆ S [2/2]

#define S (   x)    s->segments[2 * (x)]

◆ L

#define L (   x)    s->segments[i - (x)]

◆ CONVOLVE

#define CONVOLVE   _ _ _ _

Definition at line 466 of file af_mcompand.c.

◆ _ [1/2]

#define _
Value:
out_low += p->coefs[j] * p->previous[ch][p->pos + j].in \
- p->coefs[2*N+2 + j] * p->previous[ch][p->pos + j].out_low, j++;

◆ _ [2/2]

#define _
Value:
out_high += p->coefs[j+N+1] * p->previous[ch][p->pos + j].in \
- p->coefs[2*N+2 + j] * p->previous[ch][p->pos + j].out_high, j++;

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( mcompand  )

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 103 of file af_mcompand.c.

◆ count_items()

static void count_items ( char *  item_str,
int nb_items,
char  delimiter 
)
static

Definition at line 125 of file af_mcompand.c.

Referenced by config_output().

◆ update_volume()

static void update_volume ( CompBand cb,
double  in,
int  ch 
)
static

Definition at line 136 of file af_mcompand.c.

Referenced by mcompand_channel().

◆ get_volume()

static double get_volume ( CompandT s,
double  in_lin 
)
static

Definition at line 146 of file af_mcompand.c.

Referenced by mcompand_channel().

◆ parse_points()

static int parse_points ( char *  points,
int  nb_points,
double  radius,
CompandT s,
AVFilterContext ctx 
)
static

Definition at line 167 of file af_mcompand.c.

Referenced by config_output().

◆ square_quadratic()

static void square_quadratic ( double const *  x,
double y 
)
static

Definition at line 269 of file af_mcompand.c.

Referenced by crossover_setup().

◆ crossover_setup()

static int crossover_setup ( AVFilterLink outlink,
Crossover p,
double  frequency 
)
static

Definition at line 278 of file af_mcompand.c.

Referenced by config_output().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 312 of file af_mcompand.c.

◆ crossover()

static void crossover ( int  ch,
Crossover p,
double ibuf,
double obuf_low,
double obuf_high,
size_t  len 
)
static

Definition at line 468 of file af_mcompand.c.

Referenced by filter_frame().

◆ mcompand_channel()

static int mcompand_channel ( MCompandContext c,
CompBand l,
double ibuf,
double obuf,
int  len,
int  ch 
)
static

Definition at line 499 of file af_mcompand.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 552 of file af_mcompand.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 608 of file af_mcompand.c.

Variable Documentation

◆ mcompand_options

const AVOption mcompand_options[]
static
Initial value:
= {
{ "args", "set parameters for each band", OFFSET(args), AV_OPT_TYPE_STRING, { .str = "0.005,0.1 6 -47/-40,-34/-34,-17/-33 100 | 0.003,0.05 6 -47/-40,-34/-34,-17/-33 400 | 0.000625,0.0125 6 -47/-40,-34/-34,-15/-33 1600 | 0.0001,0.025 6 -47/-40,-34/-34,-31/-31,-0/-30 6400 | 0,0.025 6 -38/-31,-28/-28,-0/-25 22000" }, 0, 0, A },
{ NULL }
}

Definition at line 96 of file af_mcompand.c.

◆ mcompand_inputs

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

Definition at line 618 of file af_mcompand.c.

◆ mcompand_outputs

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

Definition at line 626 of file af_mcompand.c.

◆ ff_af_mcompand

const AVFilter ff_af_mcompand
Initial value:
= {
.name = "mcompand",
.description = NULL_IF_CONFIG_SMALL(
"Multiband Compress or expand audio dynamic range."),
.priv_size = sizeof(MCompandContext),
.priv_class = &mcompand_class,
}

Definition at line 636 of file af_mcompand.c.

request_frame
static int request_frame(AVFilterLink *outlink)
Definition: af_mcompand.c:608
mcompand_outputs
static const AVFilterPad mcompand_outputs[]
Definition: af_mcompand.c:626
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:183
OFFSET
#define OFFSET(x)
Definition: af_mcompand.c:93
mcompand_inputs
static const AVFilterPad mcompand_inputs[]
Definition: af_mcompand.c:618
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_mcompand.c:312
MCompandContext
Definition: af_mcompand.c:81
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
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:117
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_mcompand.c:552
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_mcompand.c:103
N
#define N
Definition: af_mcompand.c:53
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
A
#define A
Definition: af_mcompand.c:94
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229