FFmpeg
Macros | Functions
ac3dsp_init.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/mem.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/ac3.h"
#include "libavcodec/ac3dsp.h"

Go to the source code of this file.

Macros

#define DOWNMIX_FUNC_OPT(ch, opt)
 
#define DOWNMIX_FUNCS(opt)
 
#define SET_DOWNMIX(ch, suf, SUF)
 
#define SET_DOWNMIX_ALL(suf, SUF)
 

Functions

void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs)
 
void ff_ac3_exponent_min_mmxext (uint8_t *exp, int num_reuse_blocks, int nb_coefs)
 
void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs)
 
int ff_ac3_max_msb_abs_int16_mmx (const int16_t *src, int len)
 
int ff_ac3_max_msb_abs_int16_mmxext (const int16_t *src, int len)
 
int ff_ac3_max_msb_abs_int16_sse2 (const int16_t *src, int len)
 
int ff_ac3_max_msb_abs_int16_ssse3 (const int16_t *src, int len)
 
void ff_ac3_lshift_int16_mmx (int16_t *src, unsigned int len, unsigned int shift)
 
void ff_ac3_lshift_int16_sse2 (int16_t *src, unsigned int len, unsigned int shift)
 
void ff_ac3_rshift_int32_mmx (int32_t *src, unsigned int len, unsigned int shift)
 
void ff_ac3_rshift_int32_sse2 (int32_t *src, unsigned int len, unsigned int shift)
 
void ff_float_to_fixed24_3dnow (int32_t *dst, const float *src, unsigned int len)
 
void ff_float_to_fixed24_sse (int32_t *dst, const float *src, unsigned int len)
 
void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int len)
 
int ff_ac3_compute_mantissa_size_sse2 (uint16_t mant_cnt[6][16])
 
void ff_ac3_extract_exponents_sse2 (uint8_t *exp, int32_t *coef, int nb_coefs)
 
void ff_ac3_extract_exponents_ssse3 (uint8_t *exp, int32_t *coef, int nb_coefs)
 
void ff_apply_window_int16_round_mmxext (int16_t *output, const int16_t *input, const int16_t *window, unsigned int len)
 
void ff_apply_window_int16_round_sse2 (int16_t *output, const int16_t *input, const int16_t *window, unsigned int len)
 
void ff_apply_window_int16_mmxext (int16_t *output, const int16_t *input, const int16_t *window, unsigned int len)
 
void ff_apply_window_int16_sse2 (int16_t *output, const int16_t *input, const int16_t *window, unsigned int len)
 
void ff_apply_window_int16_ssse3 (int16_t *output, const int16_t *input, const int16_t *window, unsigned int len)
 
void ff_apply_window_int16_ssse3_atom (int16_t *output, const int16_t *input, const int16_t *window, unsigned int len)
 
av_cold void ff_ac3dsp_init_x86 (AC3DSPContext *c, int bit_exact)
 
void ff_ac3dsp_set_downmix_x86 (AC3DSPContext *c)
 

Macro Definition Documentation

◆ DOWNMIX_FUNC_OPT

#define DOWNMIX_FUNC_OPT (   ch,
  opt 
)
Value:
void ff_ac3_downmix_ ## ch ## _to_1_ ## opt(float **samples, \
float **matrix, int len); \
void ff_ac3_downmix_ ## ch ## _to_2_ ## opt(float **samples, \
float **matrix, int len);

Definition at line 123 of file ac3dsp_init.c.

◆ DOWNMIX_FUNCS

#define DOWNMIX_FUNCS (   opt)
Value:
DOWNMIX_FUNC_OPT(3, opt) \
DOWNMIX_FUNC_OPT(4, opt) \
DOWNMIX_FUNC_OPT(5, opt) \
DOWNMIX_FUNC_OPT(6, opt)

Definition at line 129 of file ac3dsp_init.c.

◆ SET_DOWNMIX

#define SET_DOWNMIX (   ch,
  suf,
  SUF 
)
Value:
if (ch == c->in_channels) { \
if (EXTERNAL_ ## SUF (cpu_flags)) { \
if (c->out_channels == 1) \
c->downmix = ff_ac3_downmix_ ## ch ## _to_1_ ## suf; \
else \
c->downmix = ff_ac3_downmix_ ## ch ## _to_2_ ## suf; \
} \
}

◆ SET_DOWNMIX_ALL

#define SET_DOWNMIX_ALL (   suf,
  SUF 
)
Value:
SET_DOWNMIX(3, suf, SUF) \
SET_DOWNMIX(4, suf, SUF) \
SET_DOWNMIX(5, suf, SUF) \
SET_DOWNMIX(6, suf, SUF)

Function Documentation

◆ ff_ac3_exponent_min_mmx()

void ff_ac3_exponent_min_mmx ( uint8_t exp,
int  num_reuse_blocks,
int  nb_coefs 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_exponent_min_mmxext()

void ff_ac3_exponent_min_mmxext ( uint8_t exp,
int  num_reuse_blocks,
int  nb_coefs 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_exponent_min_sse2()

void ff_ac3_exponent_min_sse2 ( uint8_t exp,
int  num_reuse_blocks,
int  nb_coefs 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_max_msb_abs_int16_mmx()

int ff_ac3_max_msb_abs_int16_mmx ( const int16_t *  src,
int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_max_msb_abs_int16_mmxext()

int ff_ac3_max_msb_abs_int16_mmxext ( const int16_t *  src,
int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_max_msb_abs_int16_sse2()

int ff_ac3_max_msb_abs_int16_sse2 ( const int16_t *  src,
int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_max_msb_abs_int16_ssse3()

int ff_ac3_max_msb_abs_int16_ssse3 ( const int16_t *  src,
int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_lshift_int16_mmx()

void ff_ac3_lshift_int16_mmx ( int16_t *  src,
unsigned int  len,
unsigned int  shift 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_lshift_int16_sse2()

void ff_ac3_lshift_int16_sse2 ( int16_t *  src,
unsigned int  len,
unsigned int  shift 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_rshift_int32_mmx()

void ff_ac3_rshift_int32_mmx ( int32_t src,
unsigned int  len,
unsigned int  shift 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_rshift_int32_sse2()

void ff_ac3_rshift_int32_sse2 ( int32_t src,
unsigned int  len,
unsigned int  shift 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_float_to_fixed24_3dnow()

void ff_float_to_fixed24_3dnow ( int32_t dst,
const float *  src,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_float_to_fixed24_sse()

void ff_float_to_fixed24_sse ( int32_t dst,
const float *  src,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_float_to_fixed24_sse2()

void ff_float_to_fixed24_sse2 ( int32_t dst,
const float *  src,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_compute_mantissa_size_sse2()

int ff_ac3_compute_mantissa_size_sse2 ( uint16_t  mant_cnt[6][16])

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_extract_exponents_sse2()

void ff_ac3_extract_exponents_sse2 ( uint8_t exp,
int32_t coef,
int  nb_coefs 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3_extract_exponents_ssse3()

void ff_ac3_extract_exponents_ssse3 ( uint8_t exp,
int32_t coef,
int  nb_coefs 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_apply_window_int16_round_mmxext()

void ff_apply_window_int16_round_mmxext ( int16_t *  output,
const int16_t *  input,
const int16_t *  window,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_apply_window_int16_round_sse2()

void ff_apply_window_int16_round_sse2 ( int16_t *  output,
const int16_t *  input,
const int16_t *  window,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_apply_window_int16_mmxext()

void ff_apply_window_int16_mmxext ( int16_t *  output,
const int16_t *  input,
const int16_t *  window,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_apply_window_int16_sse2()

void ff_apply_window_int16_sse2 ( int16_t *  output,
const int16_t *  input,
const int16_t *  window,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_apply_window_int16_ssse3()

void ff_apply_window_int16_ssse3 ( int16_t *  output,
const int16_t *  input,
const int16_t *  window,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_apply_window_int16_ssse3_atom()

void ff_apply_window_int16_ssse3_atom ( int16_t *  output,
const int16_t *  input,
const int16_t *  window,
unsigned int  len 
)

Referenced by ff_ac3dsp_init_x86().

◆ ff_ac3dsp_init_x86()

av_cold void ff_ac3dsp_init_x86 ( AC3DSPContext c,
int  bit_exact 
)

Definition at line 66 of file ac3dsp_init.c.

Referenced by ff_ac3dsp_init().

◆ ff_ac3dsp_set_downmix_x86()

void ff_ac3dsp_set_downmix_x86 ( AC3DSPContext c)

Definition at line 139 of file ac3dsp_init.c.

Referenced by ff_ac3dsp_downmix().

ch
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_p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UNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:50
SET_DOWNMIX
#define SET_DOWNMIX(ch, suf, SUF)
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
len
int len
Definition: vorbis_enc_data.h:452
DOWNMIX_FUNC_OPT
#define DOWNMIX_FUNC_OPT(ch, opt)
Definition: ac3dsp_init.c:123
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8