FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
af_sofalizer.c File Reference
#include <math.h>
#include <netcdf.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  NCSofa
 
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 NCSofa *sofa)
 
static int load_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 max_delay (struct NCSofa *sofa)
 
static int find_m (SOFAlizerContext *s, int azim, int elev, float radius)
 
static int compensate_volume (AVFilterContext *ctx)
 
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)
 
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

#define TIME_DOMAIN   0

Definition at line 41 of file af_sofalizer.c.

Referenced by config_input(), filter_frame(), and load_data().

#define FREQUENCY_DOMAIN   1

Definition at line 42 of file af_sofalizer.c.

Referenced by config_input().

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

Definition at line 1187 of file af_sofalizer.c.

Definition at line 1188 of file af_sofalizer.c.

Function Documentation

static int close_sofa ( struct NCSofa sofa)
static

Definition at line 109 of file af_sofalizer.c.

Referenced by load_sofa().

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

Definition at line 122 of file af_sofalizer.c.

Referenced by init().

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

Definition at line 376 of file af_sofalizer.c.

Referenced by parse_speaker_pos().

static void parse_speaker_pos ( AVFilterContext ctx,
int64_t  in_channel_layout 
)
static

Definition at line 401 of file af_sofalizer.c.

Referenced by get_speaker_pos().

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

Definition at line 434 of file af_sofalizer.c.

Referenced by config_input().

static int max_delay ( struct NCSofa sofa)
static

Definition at line 509 of file af_sofalizer.c.

Referenced by config_input(), and output_packet().

static int find_m ( SOFAlizerContext s,
int  azim,
int  elev,
float  radius 
)
static

Definition at line 521 of file af_sofalizer.c.

Referenced by compensate_volume(), and load_data().

static int compensate_volume ( AVFilterContext ctx)
static

Definition at line 549 of file af_sofalizer.c.

Referenced by config_input().

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

Definition at line 597 of file af_sofalizer.c.

Referenced by filter_frame().

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

Definition at line 683 of file af_sofalizer.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 801 of file af_sofalizer.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 839 of file af_sofalizer.c.

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

Definition at line 877 of file af_sofalizer.c.

Referenced by config_input().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 1018 of file af_sofalizer.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 1053 of file af_sofalizer.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1155 of file af_sofalizer.c.

AVFILTER_DEFINE_CLASS ( sofalizer  )

Variable Documentation

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 },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
GLint GLenum type
Definition: opengl_enc.c:105
#define OFFSET(x)

Definition at line 1190 of file af_sofalizer.c.

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:801
static int config_input(AVFilterLink *inlink)

Definition at line 1205 of file af_sofalizer.c.

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

Definition at line 1215 of file af_sofalizer.c.

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:57
static int query_formats(AVFilterContext *ctx)
Definition: af_sofalizer.c:839
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
#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[]
static const AVFilterPad inputs[]
static av_cold int init(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)

Definition at line 1223 of file af_sofalizer.c.