FFmpeg  4.0
Data Structures | Macros | Functions | Variables
af_sofalizer.c File Reference
#include <math.h>
#include <mysofa.h>
#include "libavcodec/avfft.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/intmath.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"
#include "audio.h"

Go to the source code of this file.

Data Structures

struct  MySofa
 
struct  VirtualSpeaker
 
struct  SOFAlizerContext
 
struct  ThreadData
 

Macros

#define TIME_DOMAIN   0
 
#define FREQUENCY_DOMAIN   1
 
#define OFFSET(x)   offsetof(SOFAlizerContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static int close_sofa (struct MySofa *sofa)
 
static int preload_sofa (AVFilterContext *ctx, char *filename, int *samplingrate)
 
static int parse_channel_name (char **arg, int *rchannel, char *buf)
 
static void parse_speaker_pos (AVFilterContext *ctx, int64_t in_channel_layout)
 
static int get_speaker_pos (AVFilterContext *ctx, float *speaker_azim, float *speaker_elev)
 
static int sofalizer_convolute (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int sofalizer_fast_convolute (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int query_formats (AVFilterContext *ctx)
 
static int load_data (AVFilterContext *ctx, int azim, int elev, float radius, int sample_rate)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (sofalizer)
 

Variables

static const AVOption sofalizer_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_af_sofalizer
 

Macro Definition Documentation

◆ TIME_DOMAIN

#define TIME_DOMAIN   0

Definition at line 41 of file af_sofalizer.c.

Referenced by filter_frame(), and load_data().

◆ FREQUENCY_DOMAIN

#define FREQUENCY_DOMAIN   1

Definition at line 42 of file af_sofalizer.c.

Referenced by config_input(), and load_data().

◆ OFFSET

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

Definition at line 866 of file af_sofalizer.c.

◆ FLAGS

Definition at line 867 of file af_sofalizer.c.

Function Documentation

◆ close_sofa()

static int close_sofa ( struct MySofa sofa)
static

Definition at line 104 of file af_sofalizer.c.

Referenced by uninit().

◆ preload_sofa()

static int preload_sofa ( AVFilterContext ctx,
char *  filename,
int samplingrate 
)
static

Definition at line 112 of file af_sofalizer.c.

Referenced by init().

◆ parse_channel_name()

static int parse_channel_name ( char **  arg,
int rchannel,
char *  buf 
)
static

Definition at line 133 of file af_sofalizer.c.

Referenced by parse_speaker_pos().

◆ parse_speaker_pos()

static void parse_speaker_pos ( AVFilterContext ctx,
int64_t  in_channel_layout 
)
static

Definition at line 158 of file af_sofalizer.c.

Referenced by get_speaker_pos().

◆ get_speaker_pos()

static int get_speaker_pos ( AVFilterContext ctx,
float *  speaker_azim,
float *  speaker_elev 
)
static

Definition at line 191 of file af_sofalizer.c.

Referenced by load_data().

◆ sofalizer_convolute()

static int sofalizer_convolute ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 277 of file af_sofalizer.c.

Referenced by filter_frame().

◆ sofalizer_fast_convolute()

static int sofalizer_fast_convolute ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 363 of file af_sofalizer.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 481 of file af_sofalizer.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 519 of file af_sofalizer.c.

◆ load_data()

static int load_data ( AVFilterContext ctx,
int  azim,
int  elev,
float  radius,
int  sample_rate 
)
static

Definition at line 557 of file af_sofalizer.c.

Referenced by config_input().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 782 of file af_sofalizer.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 813 of file af_sofalizer.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 840 of file af_sofalizer.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( sofalizer  )

Variable Documentation

◆ sofalizer_options

const AVOption sofalizer_options[]
static
Initial value:
= {
{ "sofa", "sofa filename", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "gain", "set gain in dB", OFFSET(gain), AV_OPT_TYPE_FLOAT, {.dbl=0}, -20, 40, .flags = FLAGS },
{ "rotation", "set rotation" , OFFSET(rotation), AV_OPT_TYPE_FLOAT, {.dbl=0}, -360, 360, .flags = FLAGS },
{ "elevation", "set elevation", OFFSET(elevation), AV_OPT_TYPE_FLOAT, {.dbl=0}, -90, 90, .flags = FLAGS },
{ "radius", "set radius", OFFSET(radius), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 3, .flags = FLAGS },
{ "type", "set processing", OFFSET(type), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, .flags = FLAGS, "type" },
{ "time", "time domain", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = FLAGS, "type" },
{ "freq", "frequency domain", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = FLAGS, "type" },
{ "speakers", "set speaker custom positions", OFFSET(speakers_pos), AV_OPT_TYPE_STRING, {.str=0}, 0, 0, .flags = FLAGS },
{ "lfegain", "set lfe gain", OFFSET(lfe_gain), AV_OPT_TYPE_FLOAT, {.dbl=0}, -9, 9, .flags = FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: af_sofalizer.c:867
cl_device_type type
#define OFFSET(x)
Definition: af_sofalizer.c:866

Definition at line 869 of file af_sofalizer.c.

◆ inputs

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

Definition at line 885 of file af_sofalizer.c.

◆ outputs

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 895 of file af_sofalizer.c.

◆ ff_af_sofalizer

AVFilter ff_af_sofalizer
Initial value:
= {
.name = "sofalizer",
.description = NULL_IF_CONFIG_SMALL("SOFAlizer (Spatially Oriented Format for Acoustics)."),
.priv_size = sizeof(SOFAlizerContext),
.priv_class = &sofalizer_class,
.init = init,
}
static int flags
Definition: log.c:55
static int query_formats(AVFilterContext *ctx)
Definition: af_sofalizer.c:519
#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_sofalizer.c:895
static const AVFilterPad inputs[]
Definition: af_sofalizer.c:885
static av_cold int init(AVFilterContext *ctx)
Definition: af_sofalizer.c:782
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_sofalizer.c:840

Definition at line 903 of file af_sofalizer.c.