FFmpeg
Data Structures | Macros | Functions | Variables
af_surround.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/tx.h"
#include "avfilter.h"
#include "audio.h"
#include "filters.h"
#include "internal.h"
#include "formats.h"
#include "window_func.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_transform (float *x, float *y, float angle)
 
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, int lfe_mode)
 
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_6_0 (AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
 
static void upmix_6_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_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 av_cold 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 activate (AVFilterContext *ctx)
 
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 []
 
const AVFilter ff_af_surround
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 1673 of file af_surround.c.

◆ FLAGS

Definition at line 1674 of file af_surround.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 158 of file af_surround.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 193 of file af_surround.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 262 of file af_surround.c.

◆ stereo_transform()

static void stereo_transform ( float x,
float y,
float  angle 
)
static

Definition at line 322 of file af_surround.c.

Referenced by filter_2_1(), filter_stereo(), and filter_surround().

◆ stereo_position()

static void stereo_position ( float  a,
float  p,
float x,
float y 
)
static

◆ get_lfe()

static void get_lfe ( int  output_lfe,
int  n,
float  lowcut,
float  highcut,
float lfe_mag,
float mag_total,
int  lfe_mode 
)
inlinestatic

◆ upmix_1_0()

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 363 of file af_surround.c.

Referenced by init().

◆ upmix_stereo()

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 382 of file af_surround.c.

Referenced by init().

◆ upmix_2_1()

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 406 of file af_surround.c.

Referenced by init().

◆ upmix_3_0()

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 436 of file af_surround.c.

Referenced by init().

◆ upmix_3_1()

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 465 of file af_surround.c.

Referenced by init().

◆ upmix_3_1_surround()

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 500 of file af_surround.c.

Referenced by init().

◆ upmix_4_0()

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 535 of file af_surround.c.

Referenced by init().

◆ upmix_4_1()

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 569 of file af_surround.c.

Referenced by init().

◆ upmix_5_0_back()

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 609 of file af_surround.c.

Referenced by init().

◆ upmix_5_1_back()

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 648 of file af_surround.c.

Referenced by init().

◆ upmix_6_0()

static void upmix_6_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 693 of file af_surround.c.

Referenced by init().

◆ upmix_6_1()

static void upmix_6_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 737 of file af_surround.c.

Referenced by init().

◆ upmix_5_1_back_surround()

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 787 of file af_surround.c.

Referenced by init().

◆ upmix_5_1_back_2_1()

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 833 of file af_surround.c.

Referenced by init().

◆ upmix_7_0()

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 879 of file af_surround.c.

Referenced by init().

◆ upmix_7_1()

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 929 of file af_surround.c.

Referenced by init().

◆ upmix_7_1_5_0_side()

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 985 of file af_surround.c.

Referenced by init().

◆ upmix_7_1_5_1()

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 1045 of file af_surround.c.

Referenced by init().

◆ filter_stereo()

static void filter_stereo ( AVFilterContext ctx)
static

Definition at line 1101 of file af_surround.c.

Referenced by init().

◆ filter_surround()

static void filter_surround ( AVFilterContext ctx)
static

Definition at line 1134 of file af_surround.c.

Referenced by init().

◆ filter_2_1()

static void filter_2_1 ( AVFilterContext ctx)
static

Definition at line 1170 of file af_surround.c.

Referenced by init().

◆ filter_5_0_side()

static void filter_5_0_side ( AVFilterContext ctx)
static

Definition at line 1205 of file af_surround.c.

Referenced by init().

◆ filter_5_1_side()

static void filter_5_1_side ( AVFilterContext ctx)
static

Definition at line 1262 of file af_surround.c.

Referenced by init().

◆ filter_5_1_back()

static void filter_5_1_back ( AVFilterContext ctx)
static

Definition at line 1321 of file af_surround.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 1380 of file af_surround.c.

◆ fft_channel()

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

Definition at line 1541 of file af_surround.c.

Referenced by filter_frame().

◆ ifft_channel()

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

Definition at line 1563 of file af_surround.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 1592 of file af_surround.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 1616 of file af_surround.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1651 of file af_surround.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( surround  )

Variable Documentation

◆ surround_options

const AVOption surround_options[]
static

Definition at line 1676 of file af_surround.c.

◆ inputs

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

Definition at line 1732 of file af_surround.c.

◆ outputs

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

Definition at line 1740 of file af_surround.c.

◆ ff_af_surround

const AVFilter ff_af_surround
Initial value:
= {
.name = "surround",
.description = NULL_IF_CONFIG_SMALL("Apply audio surround upmix filter."),
.priv_size = sizeof(AudioSurroundContext),
.priv_class = &surround_class,
.init = init,
}

Definition at line 1748 of file af_surround.c.

AudioSurroundContext
Definition: af_surround.c:32
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:167
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_surround.c:1651
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_surround.c:158
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
outputs
static const AVFilterPad outputs[]
Definition: af_surround.c:1740
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
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
activate
static int activate(AVFilterContext *ctx)
Definition: af_surround.c:1616
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_surround.c:262
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_surround.c:193
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:127
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_surround.c:1380
inputs
static const AVFilterPad inputs[]
Definition: af_surround.c:1732