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

Go to the source code of this file.

Data Structures

struct  AudioDialogueEnhancementContext
 

Macros

#define OFFSET(x)   offsetof(AudioDialogueEnhanceContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (dialoguenhance)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static void apply_window (AudioDialogueEnhanceContext *s, const float *in_frame, float *out_frame, const int add_to_out_frame)
 
static float sqrf (float x)
 
static void get_centere (AVComplexFloat *left, AVComplexFloat *right, AVComplexFloat *center, int N)
 
static float flux (float *curf, float *prevf, int N)
 
static float fluxlr (float *lf, float *lpf, float *rf, float *rpf, int N)
 
static float calc_vad (float fc, float flr, float a)
 
static void get_final (float *c, float *l, float *r, float vad, int N, float original, float enhance)
 
static int de_stereo (AVFilterContext *ctx, AVFrame *out)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption dialoguenhance_options []
 
static const AVFilterPad inputs []
 
const AVFilter ff_af_dialoguenhance
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 56 of file af_dialoguenhance.c.

◆ FLAGS

Definition at line 57 of file af_dialoguenhance.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( dialoguenhance  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 68 of file af_dialoguenhance.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 85 of file af_dialoguenhance.c.

◆ apply_window()

static void apply_window ( AudioDialogueEnhanceContext *  s,
const float in_frame,
float out_frame,
const int  add_to_out_frame 
)
static

Definition at line 128 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ sqrf()

static float sqrf ( float  x)
static

Definition at line 142 of file af_dialoguenhance.c.

Referenced by flux(), fluxlr(), get_centere(), and get_final().

◆ get_centere()

static void get_centere ( AVComplexFloat left,
AVComplexFloat right,
AVComplexFloat center,
int  N 
)
static

Definition at line 147 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ flux()

static float flux ( float curf,
float prevf,
int  N 
)
static

Definition at line 163 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ fluxlr()

static float fluxlr ( float lf,
float lpf,
float rf,
float rpf,
int  N 
)
static

Definition at line 181 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ calc_vad()

static float calc_vad ( float  fc,
float  flr,
float  a 
)
static

Definition at line 203 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ get_final()

static void get_final ( float c,
float l,
float r,
float  vad,
int  N,
float  original,
float  enhance 
)
static

Definition at line 210 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ de_stereo()

static int de_stereo ( AVFilterContext ctx,
AVFrame out 
)
static

Definition at line 232 of file af_dialoguenhance.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 307 of file af_dialoguenhance.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 333 of file af_dialoguenhance.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 363 of file af_dialoguenhance.c.

Variable Documentation

◆ dialoguenhance_options

const AVOption dialoguenhance_options[]
static
Initial value:
= {
{ "original", "set original center factor", OFFSET(original), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS },
{ "enhance", "set dialogue enhance factor",OFFSET(enhance), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 3, FLAGS },
{ "voice", "set voice detection factor", OFFSET(voice), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 2,32, FLAGS },
{NULL}
}

Definition at line 59 of file af_dialoguenhance.c.

◆ inputs

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

Definition at line 381 of file af_dialoguenhance.c.

◆ ff_af_dialoguenhance

const AVFilter ff_af_dialoguenhance
Initial value:
= {
.name = "dialoguenhance",
.description = NULL_IF_CONFIG_SMALL("Audio Dialogue Enhancement."),
.priv_size = sizeof(AudioDialogueEnhanceContext),
.priv_class = &dialoguenhance_class,
.activate = activate,
.process_command = ff_filter_process_command,
}

Definition at line 389 of file af_dialoguenhance.c.

inputs
static const AVFilterPad inputs[]
Definition: af_dialoguenhance.c:381
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:169
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_dialoguenhance.c:363
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FLAGS
#define FLAGS
Definition: af_dialoguenhance.c:57
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:192
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: af_dialoguenhance.c:56
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: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:106
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:851
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_dialoguenhance.c:85
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_dialoguenhance.c:68
activate
static int activate(AVFilterContext *ctx)
Definition: af_dialoguenhance.c:333
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:193
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:155