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 "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 []
 
static const AVFilterPad outputs []
 
const AVFilter ff_af_dialoguenhance
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 55 of file af_dialoguenhance.c.

◆ FLAGS

Definition at line 56 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 67 of file af_dialoguenhance.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 84 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 127 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ sqrf()

static float sqrf ( float  x)
static

Definition at line 141 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 146 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ flux()

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

Definition at line 162 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 180 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 202 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 209 of file af_dialoguenhance.c.

Referenced by de_stereo().

◆ de_stereo()

static int de_stereo ( AVFilterContext ctx,
AVFrame out 
)
static

Definition at line 231 of file af_dialoguenhance.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 306 of file af_dialoguenhance.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 332 of file af_dialoguenhance.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 362 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 58 of file af_dialoguenhance.c.

◆ inputs

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

Definition at line 380 of file af_dialoguenhance.c.

◆ outputs

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

Definition at line 388 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 395 of file af_dialoguenhance.c.

inputs
static const AVFilterPad inputs[]
Definition: af_dialoguenhance.c:380
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:167
outputs
static const AVFilterPad outputs[]
Definition: af_dialoguenhance.c:388
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_dialoguenhance.c:362
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:56
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: af_dialoguenhance.c:55
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
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:873
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_dialoguenhance.c:84
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_dialoguenhance.c:67
activate
static int activate(AVFilterContext *ctx)
Definition: af_dialoguenhance.c:332
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
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:160