FFmpeg
|
#include <stdint.h>
#include "libavutil/common.h"
#include "libavutil/libm.h"
#include "libavutil/samplefmt.h"
#include "avresample.h"
#include "internal.h"
#include "audio_data.h"
#include "audio_mix.h"
Go to the source code of this file.
Data Structures | |
struct | AudioMix |
Macros | |
#define | MIX_FUNC_NAME(fmt, cfmt) mix_any_ ## fmt ##_## cfmt ##_c |
#define | MIX_FUNC_GENERIC(fmt, cfmt, stype, ctype, sumtype, expr) |
#define | GET_MATRIX_CONVERT(suffix, scale) |
#define | CONVERT_MATRIX(type, expr) |
Functions | |
void | ff_audio_mix_set_func (AudioMix *am, enum AVSampleFormat fmt, enum AVMixCoeffType coeff_type, int in_channels, int out_channels, int ptr_align, int samples_align, const char *descr, void *mix_func) |
Set mixing function if the parameters match. More... | |
MIX_FUNC_GENERIC (S16P, FLT, int16_t, float, float, av_clip_int16(lrintf(sum))) | |
static void | mix_2_to_1_s16p_flt_c (int16_t **samples, float **matrix, int len, int out_ch, int in_ch) |
static void | mix_2_to_1_s16p_q8_c (int16_t **samples, int16_t **matrix, int len, int out_ch, int in_ch) |
static void | mix_1_to_2_fltp_flt_c (float **samples, float **matrix, int len, int out_ch, int in_ch) |
static void | mix_6_to_2_fltp_flt_c (float **samples, float **matrix, int len, int out_ch, int in_ch) |
static void | mix_2_to_6_fltp_flt_c (float **samples, float **matrix, int len, int out_ch, int in_ch) |
static av_cold int | mix_function_init (AudioMix *am) |
AudioMix * | ff_audio_mix_alloc (AVAudioResampleContext *avr) |
Allocate and initialize an AudioMix context. More... | |
void | ff_audio_mix_free (AudioMix **am_p) |
Free an AudioMix context. More... | |
int | ff_audio_mix (AudioMix *am, AudioData *src) |
Apply channel mixing to audio data using the current mixing matrix. More... | |
int | ff_audio_mix_get_matrix (AudioMix *am, double *matrix, int stride) |
Get the current mixing matrix. More... | |
static void | reduce_matrix (AudioMix *am, const double *matrix, int stride) |
int | ff_audio_mix_set_matrix (AudioMix *am, const double *matrix, int stride) |
Set the current mixing matrix. More... | |
Variables | |
static const char *const | coeff_type_names [] = { "q8", "q15", "flt" } |
Definition at line 99 of file audio_mix.c.
#define MIX_FUNC_GENERIC | ( | fmt, | |
cfmt, | |||
stype, | |||
ctype, | |||
sumtype, | |||
expr | |||
) |
Definition at line 101 of file audio_mix.c.
#define GET_MATRIX_CONVERT | ( | suffix, | |
scale | |||
) |
#define CONVERT_MATRIX | ( | type, | |
expr | |||
) |
void ff_audio_mix_set_func | ( | AudioMix * | am, |
enum AVSampleFormat | fmt, | ||
enum AVMixCoeffType | coeff_type, | ||
int | in_channels, | ||
int | out_channels, | ||
int | ptr_align, | ||
int | samples_align, | ||
const char * | descr, | ||
void * | mix_func | ||
) |
Set mixing function if the parameters match.
This compares the parameters of the mixing function to the parameters in the AudioMix context. If the parameters do not match, no changes are made to the active functions. If the parameters do match and the alignment is not constrained, the function is set as the generic mixing function. If the parameters match and the alignment is constrained, the function is set as the optimized mixing function.
am | AudioMix context |
fmt | input/output sample format |
coeff_type | mixing coefficient type |
in_channels | number of input channels, or 0 for any number of channels |
out_channels | number of output channels, or 0 for any number of channels |
ptr_align | buffer pointer alignment, in bytes |
samples_align | buffer size alignment, in samples |
descr | function type description (e.g. "C" or "SSE") |
mix_func | mixing function pointer |
Definition at line 61 of file audio_mix.c.
Referenced by ff_audio_mix_init_x86(), and mix_function_init().
MIX_FUNC_GENERIC | ( | S16P | , |
FLT | , | ||
int16_t | , | ||
float | , | ||
float | , | ||
av_clip_int16(lrintf(sum)) | |||
) |
Definition at line 120 of file audio_mix.c.
|
static |
Definition at line 148 of file audio_mix.c.
Referenced by mix_function_init().
|
static |
Definition at line 170 of file audio_mix.c.
Referenced by mix_function_init().
|
static |
Definition at line 192 of file audio_mix.c.
Referenced by mix_function_init().
|
static |
Definition at line 225 of file audio_mix.c.
Referenced by mix_function_init().
|
static |
Definition at line 259 of file audio_mix.c.
Referenced by mix_function_init().
Definition at line 285 of file audio_mix.c.
Referenced by ff_audio_mix_set_matrix().
AudioMix* ff_audio_mix_alloc | ( | AVAudioResampleContext * | avr | ) |
Allocate and initialize an AudioMix context.
The parameters in the AVAudioResampleContext are used to initialize the AudioMix context.
avr | AVAudioResampleContext |
Definition at line 341 of file audio_mix.c.
Referenced by avresample_open().
void ff_audio_mix_free | ( | AudioMix ** | am_p | ) |
Free an AudioMix context.
Definition at line 409 of file audio_mix.c.
Referenced by avresample_close().
Apply channel mixing to audio data using the current mixing matrix.
Definition at line 428 of file audio_mix.c.
Referenced by avresample_convert().
Get the current mixing matrix.
Definition at line 483 of file audio_mix.c.
Referenced by avresample_get_matrix().
Definition at line 530 of file audio_mix.c.
Referenced by ff_audio_mix_set_matrix().
Set the current mixing matrix.
Definition at line 653 of file audio_mix.c.
Referenced by avresample_set_matrix(), and ff_audio_mix_alloc().
|
static |
Definition at line 31 of file audio_mix.c.
Referenced by ff_audio_mix_set_func(), and mix_function_init().