FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
af_surround.c File Reference
#include "libavutil/audio_fifo.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#include "avfilter.h"
#include "audio.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  AudioSurroundContext
 

Macros

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

Functions

static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static void stereo_position (float a, float p, float *x, float *y)
 
static void get_lfe (int output_lfe, int n, float lowcut, float highcut, float *lfe_mag, float *mag_total)
 
static void upmix_1_0 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_stereo (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_2_1 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_3_0 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_3_1 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_3_1_surround (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float c_mag, float mag_total, float x, float y, int n)
 
static void upmix_4_0 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_4_1 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_5_0_back (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_5_1_back (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_5_1_back_surround (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float c_mag, float mag_total, float x, float y, int n)
 
static void upmix_5_1_back_2_1 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float lfe_re, float lfe_im, float x, float y, int n)
 
static void upmix_7_0 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_7_1 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_7_1_5_0_side (AVFilterContext *ctx, float c_re, float c_im, float mag_totall, float mag_totalr, float fl_phase, float fr_phase, float bl_phase, float br_phase, float sl_phase, float sr_phase, float xl, float yl, float xr, float yr, int n)
 
static void upmix_7_1_5_1 (AVFilterContext *ctx, float c_re, float c_im, float lfe_re, float lfe_im, float mag_totall, float mag_totalr, float fl_phase, float fr_phase, float bl_phase, float br_phase, float sl_phase, float sr_phase, float xl, float yl, float xr, float yr, int n)
 
static void filter_stereo (AVFilterContext *ctx)
 
static void filter_surround (AVFilterContext *ctx)
 
static void filter_2_1 (AVFilterContext *ctx)
 
static void filter_5_0_side (AVFilterContext *ctx)
 
static void filter_5_1_side (AVFilterContext *ctx)
 
static void filter_5_1_back (AVFilterContext *ctx)
 
static int init (AVFilterContext *ctx)
 
static int fft_channel (AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
 
static int ifft_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)
 
 AVFILTER_DEFINE_CLASS (surround)
 

Variables

static const AVOption surround_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_af_surround
 

Macro Definition Documentation

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

Definition at line 1437 of file af_surround.c.

Definition at line 1438 of file af_surround.c.

Function Documentation

static int query_formats ( AVFilterContext ctx)
static

Definition at line 114 of file af_surround.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 152 of file af_surround.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 194 of file af_surround.c.

static void stereo_position ( float  a,
float  p,
float *  x,
float *  y 
)
static
static void get_lfe ( int  output_lfe,
int  n,
float  lowcut,
float  highcut,
float *  lfe_mag,
float *  mag_total 
)
inlinestatic
static void upmix_1_0 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 248 of file af_surround.c.

Referenced by init().

static void upmix_stereo ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 267 of file af_surround.c.

Referenced by init().

static void upmix_2_1 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 291 of file af_surround.c.

Referenced by init().

static void upmix_3_0 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 321 of file af_surround.c.

Referenced by init().

static void upmix_3_1 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 350 of file af_surround.c.

Referenced by init().

static void upmix_3_1_surround ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  c_mag,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 385 of file af_surround.c.

Referenced by init().

static void upmix_4_0 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 420 of file af_surround.c.

Referenced by init().

static void upmix_4_1 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 454 of file af_surround.c.

Referenced by init().

static void upmix_5_0_back ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 494 of file af_surround.c.

Referenced by init().

static void upmix_5_1_back ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 533 of file af_surround.c.

Referenced by init().

static void upmix_5_1_back_surround ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  c_mag,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 578 of file af_surround.c.

Referenced by init().

static void upmix_5_1_back_2_1 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  lfe_re,
float  lfe_im,
float  x,
float  y,
int  n 
)
static

Definition at line 624 of file af_surround.c.

Referenced by init().

static void upmix_7_0 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 670 of file af_surround.c.

Referenced by init().

static void upmix_7_1 ( AVFilterContext ctx,
float  l_phase,
float  r_phase,
float  c_phase,
float  mag_total,
float  x,
float  y,
int  n 
)
static

Definition at line 720 of file af_surround.c.

Referenced by init().

static void upmix_7_1_5_0_side ( AVFilterContext ctx,
float  c_re,
float  c_im,
float  mag_totall,
float  mag_totalr,
float  fl_phase,
float  fr_phase,
float  bl_phase,
float  br_phase,
float  sl_phase,
float  sr_phase,
float  xl,
float  yl,
float  xr,
float  yr,
int  n 
)
static

Definition at line 776 of file af_surround.c.

Referenced by init().

static void upmix_7_1_5_1 ( AVFilterContext ctx,
float  c_re,
float  c_im,
float  lfe_re,
float  lfe_im,
float  mag_totall,
float  mag_totalr,
float  fl_phase,
float  fr_phase,
float  bl_phase,
float  br_phase,
float  sl_phase,
float  sr_phase,
float  xl,
float  yl,
float  xr,
float  yr,
int  n 
)
static

Definition at line 836 of file af_surround.c.

Referenced by init().

static void filter_stereo ( AVFilterContext ctx)
static

Definition at line 892 of file af_surround.c.

Referenced by init().

static void filter_surround ( AVFilterContext ctx)
static

Definition at line 923 of file af_surround.c.

Referenced by init().

static void filter_2_1 ( AVFilterContext ctx)
static

Definition at line 957 of file af_surround.c.

Referenced by init().

static void filter_5_0_side ( AVFilterContext ctx)
static

Definition at line 990 of file af_surround.c.

Referenced by init().

static void filter_5_1_side ( AVFilterContext ctx)
static

Definition at line 1045 of file af_surround.c.

Referenced by init().

static void filter_5_1_back ( AVFilterContext ctx)
static

Definition at line 1102 of file af_surround.c.

Referenced by init().

static int init ( AVFilterContext ctx)
static

Definition at line 1159 of file af_surround.c.

static int fft_channel ( AVFilterContext ctx,
void arg,
int  ch,
int  nb_jobs 
)
static

Definition at line 1299 of file af_surround.c.

Referenced by filter_frame().

static int ifft_channel ( AVFilterContext ctx,
void arg,
int  ch,
int  nb_jobs 
)
static

Definition at line 1318 of file af_surround.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 1348 of file af_surround.c.

Referenced by request_frame().

static int request_frame ( AVFilterLink outlink)
static

Definition at line 1393 of file af_surround.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1414 of file af_surround.c.

AVFILTER_DEFINE_CLASS ( surround  )

Variable Documentation

const AVOption surround_options[]
static
Initial value:
= {
{ "chl_out", "set output channel layout", OFFSET(out_channel_layout_str), AV_OPT_TYPE_STRING, {.str="5.1"}, 0, 0, FLAGS },
{ "chl_in", "set input channel layout", OFFSET(in_channel_layout_str), AV_OPT_TYPE_STRING, {.str="stereo"},0, 0, FLAGS },
{ "level_in", "set input level", OFFSET(level_in), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
{ "level_out", "set output level", OFFSET(level_out), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
{ "lfe", "output LFE", OFFSET(output_lfe), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
{ "lfe_low", "LFE low cut off", OFFSET(lowcutf), AV_OPT_TYPE_INT, {.i64=128}, 0, 256, FLAGS },
{ "lfe_high", "LFE high cut off", OFFSET(highcutf), AV_OPT_TYPE_INT, {.i64=256}, 0, 512, FLAGS },
{ "fc_in", "set front center channel input level", OFFSET(fc_in), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
{ "fc_out", "set front center channel output level", OFFSET(fc_out), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
{ "lfe_in", "set lfe channel input level", OFFSET(lfe_in), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
{ "lfe_out", "set lfe channel output level", OFFSET(lfe_out), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: af_surround.c:1437
#define FLAGS
Definition: af_surround.c:1438

Definition at line 1440 of file af_surround.c.

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
Definition: af_surround.c:152
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_surround.c:1348

Definition at line 1457 of file af_surround.c.

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
.config_props = config_output,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int request_frame(AVFilterLink *outlink)
Definition: af_surround.c:1393
static int config_output(AVFilterLink *outlink)
Definition: af_surround.c:194

Definition at line 1467 of file af_surround.c.

AVFilter ff_af_surround
Initial value:
= {
.name = "surround",
.description = NULL_IF_CONFIG_SMALL("Apply audio surround upmix filter."),
.query_formats = query_formats,
.priv_size = sizeof(AudioSurroundContext),
.priv_class = &surround_class,
.init = init,
}
static int init(AVFilterContext *ctx)
Definition: af_surround.c:1159
static int query_formats(AVFilterContext *ctx)
Definition: af_surround.c:114
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_surround.c:1414
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
static const AVFilterPad outputs[]
Definition: af_surround.c:1467
#define flags(name, subs,...)
Definition: cbs_av1.c:596
static const AVFilterPad inputs[]
Definition: af_surround.c:1457

Definition at line 1477 of file af_surround.c.