libavresample/audio_mix.c File Reference

#include <stdint.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.

Defines

#define MIX_FUNC_NAME(fmt, cfmt)   mix_any_ ## fmt ##_## cfmt ##_c
#define MIX_FUNC_GENERIC(fmt, cfmt, stype, ctype, sumtype, 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.
 MIX_FUNC_GENERIC (MIX_FUNC_GENERIC(S16P, FLT, MIX_FUNC_GENERIC(int16_t, float, float, av_clip_int16(lrintf(sum)))
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 int mix_function_init (AudioMix *am)
int ff_audio_mix_init (AVAudioResampleContext *avr)
 Initialize the AudioMix context in the AVAudioResampleContext.
void ff_audio_mix_close (AudioMix *am)
 Close an AudioMix context.
int ff_audio_mix (AudioMix *am, AudioData *src)
 Apply channel mixing to audio data using the current mixing matrix.

Variables

static const char * coeff_type_names [] = { "q8", "q15", "flt" }


Define Documentation

#define MIX_FUNC_GENERIC ( fmt,
cfmt,
stype,
ctype,
sumtype,
expr   ) 

Value:

static void MIX_FUNC_NAME(fmt, cfmt)(stype **samples, ctype **matrix,       \
                                     int len, int out_ch, int in_ch)        \
{                                                                           \
    int i, in, out;                                                         \
    stype temp[AVRESAMPLE_MAX_CHANNELS];                                    \
    for (i = 0; i < len; i++) {                                             \
        for (out = 0; out < out_ch; out++) {                                \
            sumtype sum = 0;                                                \
            for (in = 0; in < in_ch; in++)                                  \
                sum += samples[in][i] * matrix[out][in];                    \
            temp[out] = expr;                                               \
        }                                                                   \
        for (out = 0; out < out_ch; out++)                                  \
            samples[out][i] = temp[out];                                    \
    }                                                                       \
}

Definition at line 71 of file audio_mix.c.

#define MIX_FUNC_NAME ( fmt,
cfmt   )     mix_any_ ## fmt ##_## cfmt ##_c

Definition at line 69 of file audio_mix.c.

Referenced by mix_function_init().


Function Documentation

int ff_audio_mix ( AudioMix am,
AudioData src 
)

Apply channel mixing to audio data using the current mixing matrix.

Definition at line 328 of file audio_mix.c.

Referenced by avresample_convert().

void ff_audio_mix_close ( AudioMix am  ) 

Close an AudioMix context.

This clears and frees the mixing matrix arrays.

Definition at line 315 of file audio_mix.c.

Referenced by avresample_close().

int ff_audio_mix_init ( AVAudioResampleContext avr  ) 

Initialize the AudioMix context in the AVAudioResampleContext.

The parameters in the AVAudioResampleContext are used to initialize the AudioMix context and set the mixing matrix.

Parameters:
avr AVAudioResampleContext
Returns:
0 on success, negative AVERROR code on failure

Definition at line 254 of file audio_mix.c.

Referenced by avresample_open().

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.

Parameters:
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
sample_align buffer size alignment, in samples
descr function type description (e.g. "C" or "SSE")
mix_func mixing function pointer

Definition at line 32 of file audio_mix.c.

Referenced by ff_audio_mix_init_x86(), and mix_function_init().

static void mix_1_to_2_fltp_flt_c ( float **  samples,
float **  matrix,
int  len,
int  out_ch,
int  in_ch 
) [static]

Definition at line 118 of file audio_mix.c.

Referenced by mix_function_init().

static void mix_2_to_6_fltp_flt_c ( float **  samples,
float **  matrix,
int  len,
int  out_ch,
int  in_ch 
) [static]

Definition at line 185 of file audio_mix.c.

Referenced by mix_function_init().

static void mix_6_to_2_fltp_flt_c ( float **  samples,
float **  matrix,
int  len,
int  out_ch,
int  in_ch 
) [static]

Definition at line 151 of file audio_mix.c.

Referenced by mix_function_init().

MIX_FUNC_GENERIC ( MIX_FUNC_GENERIC(  S16P,
FLT  ,
MIX_FUNC_GENERIC(  int16_t,
float  ,
float  ,
av_clip_int16(lrintf(sum))   
)

Definition at line 90 of file audio_mix.c.

static int mix_function_init ( AudioMix am  )  [static]

Definition at line 211 of file audio_mix.c.

Referenced by ff_audio_mix_init().


Variable Documentation

const char* coeff_type_names[] = { "q8", "q15", "flt" } [static]

Definition at line 30 of file audio_mix.c.

Referenced by ff_audio_mix_set_func(), and mix_function_init().


Generated on Fri Oct 26 02:48:02 2012 for FFmpeg by  doxygen 1.5.8