FFmpeg
Data Structures | Macros | Functions | Variables
af_replaygain.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  ReplayGainFreqInfo
 
struct  ReplayGainContext
 

Macros

#define HISTOGRAM_SLOTS   12000
 
#define BUTTER_ORDER   2
 
#define YULE_ORDER   10
 
#define OFFSET(x)   offsetof(ReplayGainContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_EXPORT|AV_OPT_FLAG_READONLY
 

Functions

static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int config_input (AVFilterLink *inlink)
 
static void calc_stereo_peak (const float *samples, int nb_samples, float *peak_p)
 
static double calc_stereo_rms (const float *samples, int nb_samples)
 
static void butter_filter_stereo_samples (ReplayGainContext *s, float *samples, int nb_samples)
 
static void yule_filter_stereo_samples (ReplayGainContext *s, const float *src, float *dst, int nb_samples)
 
static float calc_replaygain (uint32_t *histogram)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int request_frame (AVFilterLink *outlink)
 
 AVFILTER_DEFINE_CLASS (replaygain)
 

Variables

static const ReplayGainFreqInfo freqinfos []
 
static const AVFilterPad replaygain_inputs []
 
static const AVFilterPad replaygain_outputs []
 
static const AVOption replaygain_options []
 
const AVFilter ff_af_replaygain
 

Detailed Description

ReplayGain scanner

Definition in file af_replaygain.c.

Macro Definition Documentation

◆ HISTOGRAM_SLOTS

#define HISTOGRAM_SLOTS   12000

Definition at line 36 of file af_replaygain.c.

◆ BUTTER_ORDER

#define BUTTER_ORDER   2

Definition at line 37 of file af_replaygain.c.

◆ YULE_ORDER

#define YULE_ORDER   10

Definition at line 38 of file af_replaygain.c.

◆ OFFSET

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

Definition at line 635 of file af_replaygain.c.

◆ FLAGS

Definition at line 636 of file af_replaygain.c.

Function Documentation

◆ query_formats()

static int query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 329 of file af_replaygain.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 363 of file af_replaygain.c.

◆ calc_stereo_peak()

static void calc_stereo_peak ( const float samples,
int  nb_samples,
float peak_p 
)
static

Definition at line 392 of file af_replaygain.c.

Referenced by filter_frame().

◆ calc_stereo_rms()

static double calc_stereo_rms ( const float samples,
int  nb_samples 
)
static

Definition at line 419 of file af_replaygain.c.

Referenced by filter_frame().

◆ butter_filter_stereo_samples()

static void butter_filter_stereo_samples ( ReplayGainContext s,
float samples,
int  nb_samples 
)
static

Definition at line 435 of file af_replaygain.c.

Referenced by filter_frame().

◆ yule_filter_stereo_samples()

static void yule_filter_stereo_samples ( ReplayGainContext s,
const float src,
float dst,
int  nb_samples 
)
static

Definition at line 484 of file af_replaygain.c.

Referenced by filter_frame().

◆ calc_replaygain()

static float calc_replaygain ( uint32_t *  histogram)
static

Definition at line 551 of file af_replaygain.c.

Referenced by request_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 569 of file af_replaygain.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 600 of file af_replaygain.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( replaygain  )

Variable Documentation

◆ freqinfos

const ReplayGainFreqInfo freqinfos[]
static

Definition at line 48 of file af_replaygain.c.

Referenced by config_input(), and query_formats().

◆ replaygain_inputs

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

Definition at line 618 of file af_replaygain.c.

◆ replaygain_outputs

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

Definition at line 627 of file af_replaygain.c.

◆ replaygain_options

const AVOption replaygain_options[]
static
Initial value:
= {
{ "track_gain", "track gain (dB)", OFFSET(gain), AV_OPT_TYPE_FLOAT,{.dbl=0}, -FLT_MAX, FLT_MAX, FLAGS },
{ "track_peak", "track peak", OFFSET(peak), AV_OPT_TYPE_FLOAT,{.dbl=0}, -FLT_MAX, FLT_MAX, FLAGS },
{ NULL }
}

Definition at line 638 of file af_replaygain.c.

◆ ff_af_replaygain

const AVFilter ff_af_replaygain
Initial value:
= {
.name = "replaygain",
.description = NULL_IF_CONFIG_SMALL("ReplayGain scanner."),
.priv_size = sizeof(ReplayGainContext),
.priv_class = &replaygain_class,
}

Definition at line 646 of file af_replaygain.c.

request_frame
static int request_frame(AVFilterLink *outlink)
Definition: af_replaygain.c:600
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
ReplayGainContext
Definition: af_replaygain.c:312
query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: af_replaygain.c:329
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_replaygain.c:569
NULL
#define NULL
Definition: coverity.c:32
replaygain_inputs
static const AVFilterPad replaygain_inputs[]
Definition: af_replaygain.c:618
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_replaygain.c:363
OFFSET
#define OFFSET(x)
Definition: af_replaygain.c:635
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
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
replaygain_outputs
static const AVFilterPad replaygain_outputs[]
Definition: af_replaygain.c:627
FLAGS
#define FLAGS
Definition: af_replaygain.c:636
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:168
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482