#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
#include "mpegaudio.h"
#include "mpegaudiodecheader.h"
#include "mathops.h"
#include "mpegaudiodata.h"
#include "mpegaudiodectab.h"
#include "dct32.c"
#include "mpegaudio_tablegen.h"
#include "fft.h"
Go to the source code of this file.
Defines | |
#define | SHR(a, b) ((a)>>(b)) |
#define | compute_antialias compute_antialias_integer |
#define | FIXR_OLD(a) ((int)((a) * FRAC_ONE + 0.5)) |
#define | FIXR(a) ((int)((a) * FRAC_ONE + 0.5)) |
#define | FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) |
#define | MULH3(x, y, s) MULH((s)*(x), y) |
#define | MULLx(x, y, s) MULL(x,y,s) |
#define | RENAME(a) a |
#define | HEADER_SIZE 4 |
#define | SCALE_GEN(v) { FIXR_OLD(1.0 * (v)), FIXR_OLD(0.7937005259 * (v)), FIXR_OLD(0.6299605249 * (v)) } |
#define | DEV_ORDER 13 |
#define | POW_FRAC_BITS 24 |
#define | POW_FRAC_ONE (1 << POW_FRAC_BITS) |
#define | POW_FIX(a) ((int)((a) * POW_FRAC_ONE)) |
#define | POW_MULL(a, b) (((int64_t)(a) * (int64_t)(b)) >> POW_FRAC_BITS) |
#define | MACS(rt, ra, rb) MAC16(rt, ra, rb) |
#define | MULS(ra, rb) MUL16(ra, rb) |
#define | MLSS(rt, ra, rb) MLS16(rt, ra, rb) |
#define | SUM8(op, sum, w, p) |
#define | SUM8P2(sum1, op1, sum2, op2, w1, w2, p) |
#define | C3 FIXHR(0.86602540378443864676/2) |
#define | C1 FIXHR(0.98480775301220805936/2) |
#define | C2 FIXHR(0.93969262078590838405/2) |
#define | C3 FIXHR(0.86602540378443864676/2) |
#define | C4 FIXHR(0.76604444311897803520/2) |
#define | C5 FIXHR(0.64278760968653932632/2) |
#define | C6 FIXHR(0.5/2) |
#define | C7 FIXHR(0.34202014332566873304/2) |
#define | C8 FIXHR(0.17364817766693034885/2) |
#define | SPLIT(dst, sf, n) |
#define | READ_FLIP_SIGN(dst, src) |
#define | ISQRT2 FIXR(0.70710678118654752440) |
#define | INT_AA(j) |
Functions | |
static void | compute_antialias (MPADecodeContext *s, GranuleDef *g) |
static void | apply_window_mp3_c (MPA_INT *synth_buf, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr) |
DECLARE_ALIGNED (16, MPA_INT, ff_mpa_synth_window_TMPL)[512+256] | |
static void | ff_region_offset2size (GranuleDef *g) |
Convert region offsets to region sizes and truncate size to big_values. | |
static void | ff_init_short_region (MPADecodeContext *s, GranuleDef *g) |
static void | ff_init_long_region (MPADecodeContext *s, GranuleDef *g, int ra1, int ra2) |
static void | ff_compute_band_indexes (MPADecodeContext *s, GranuleDef *g) |
static int | l1_unscale (int n, int mant, int scale_factor) |
static int | l2_unscale_group (int steps, int mant, int scale_factor) |
static int | l3_unscale (int value, int exponent) |
static av_cold void | int_pow_init (void) |
static av_cold int | decode_init (AVCodecContext *avctx) |
static int | round_sample (int *sum) |
void av_cold | ff_mpa_synth_init_TMPL (MPA_INT *window) |
void | ff_mpa_synth_filter (MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, INTFLOAT sb_samples[SBLIMIT]) |
static void | imdct12 (INTFLOAT *out, INTFLOAT *in) |
static void | imdct36 (INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in, INTFLOAT *win) |
static int | mp_decode_layer1 (MPADecodeContext *s) |
static int | mp_decode_layer2 (MPADecodeContext *s) |
static av_always_inline void | lsf_sf_expand (int *slen, int sf, int n1, int n2, int n3) |
static void | exponents_from_scale_factors (MPADecodeContext *s, GranuleDef *g, int16_t *exponents) |
static int | get_bitsz (GetBitContext *s, int n) |
static void | switch_buffer (MPADecodeContext *s, int *pos, int *end_pos, int *end_pos2) |
static int | huffman_decode (MPADecodeContext *s, GranuleDef *g, int16_t *exponents, int end_pos2) |
static void | reorder_block (MPADecodeContext *s, GranuleDef *g) |
static void | compute_stereo (MPADecodeContext *s, GranuleDef *g0, GranuleDef *g1) |
static void | compute_antialias_integer (MPADecodeContext *s, GranuleDef *g) |
static void | compute_imdct (MPADecodeContext *s, GranuleDef *g, INTFLOAT *sb_samples, INTFLOAT *mdct_buf) |
static int | mp_decode_layer3 (MPADecodeContext *s) |
static int | mp_decode_frame (MPADecodeContext *s, OUT_INT *samples, const uint8_t *buf, int buf_size) |
static int | decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) |
static void | flush (AVCodecContext *avctx) |
Variables | |
static VLC | huff_vlc [16] |
static VLC_TYPE | huff_vlc_tables [0+128+128+128+130+128+154+166+142+204+190+170+542+460+662+414][2] |
static const int | huff_vlc_tables_sizes [16] |
static VLC | huff_quad_vlc [2] |
static VLC_TYPE | huff_quad_vlc_tables [128+16][2] |
static const int | huff_quad_vlc_tables_sizes [2] |
static uint16_t | band_index_long [9][23] |
static INTFLOAT | is_table [2][16] |
static INTFLOAT | is_table_lsf [2][2][16] |
static int32_t | csa_table [8][4] |
static float | csa_table_float [8][4] |
static INTFLOAT | mdct_win [8][36] |
static int16_t | division_tab3 [1<< 6] |
static int16_t | division_tab5 [1<< 8] |
static int16_t | division_tab9 [1<< 11] |
static int16_t *const | division_tabs [4] |
static uint16_t | scale_factor_modshift [64] |
static int32_t | scale_factor_mult [15][3] |
static const int32_t | scale_factor_mult2 [3][3] |
static int | dev_4_3_coefs [DEV_ORDER] |
static const INTFLOAT | icos36 [9] |
static const INTFLOAT | icos36h [9] |
Definition in file mpegaudiodec.c.
#define C1 FIXHR(0.98480775301220805936/2) |
Definition at line 810 of file mpegaudiodec.c.
Referenced by DECLARE_ASM_CONST(), idct4col_add(), idct4col_put(), and imdct36().
#define C2 FIXHR(0.93969262078590838405/2) |
Definition at line 811 of file mpegaudiodec.c.
Referenced by DECLARE_ASM_CONST(), idct4col_add(), idct4col_put(), and imdct36().
#define C3 FIXHR(0.86602540378443864676/2) |
Definition at line 812 of file mpegaudiodec.c.
#define C3 FIXHR(0.86602540378443864676/2) |
Definition at line 812 of file mpegaudiodec.c.
Referenced by DECLARE_ASM_CONST(), idct4col_add(), imdct12(), and imdct36().
#define C4 FIXHR(0.76604444311897803520/2) |
Definition at line 813 of file mpegaudiodec.c.
Referenced by DECLARE_ASM_CONST(), idct_col(), and imdct36().
#define C5 FIXHR(0.64278760968653932632/2) |
#define C6 FIXHR(0.5/2) |
#define C7 FIXHR(0.34202014332566873304/2) |
#define C8 FIXHR(0.17364817766693034885/2) |
#define compute_antialias compute_antialias_integer |
#define DEV_ORDER 13 |
#define FIXHR | ( | a | ) | ((int)((a) * (1LL<<32) + 0.5)) |
#define FIXR | ( | a | ) | ((int)((a) * FRAC_ONE + 0.5)) |
#define FIXR_OLD | ( | a | ) | ((int)((a) * FRAC_ONE + 0.5)) |
Definition at line 55 of file mpegaudiodec.c.
#define HEADER_SIZE 4 |
Definition at line 65 of file mpegaudiodec.c.
#define INT_AA | ( | j | ) |
Value:
tmp0 = ptr[-1-j];\ tmp1 = ptr[ j];\ tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\ ptr[-1-j] = 4*(tmp2 - MULH(tmp1, csa[2+4*j]));\ ptr[ j] = 4*(tmp2 + MULH(tmp0, csa[3+4*j]));
Referenced by compute_antialias_integer().
#define ISQRT2 FIXR(0.70710678118654752440) |
#define MACS | ( | rt, | |||
ra, | |||||
rb | ) | MAC16(rt, ra, rb) |
Definition at line 553 of file mpegaudiodec.c.
Referenced by apply_window_mp3(), and apply_window_mp3_c().
#define MLSS | ( | rt, | |||
ra, | |||||
rb | ) | MLS16(rt, ra, rb) |
Definition at line 558 of file mpegaudiodec.c.
Referenced by apply_window_mp3(), and apply_window_mp3_c().
#define MULH3 | ( | x, | |||
y, | |||||
s | ) | MULH((s)*(x), y) |
Definition at line 58 of file mpegaudiodec.c.
Referenced by compute_imdct(), imdct12(), and imdct36().
#define MULLx | ( | x, | |||
y, | |||||
s | ) | MULL(x,y,s) |
Definition at line 59 of file mpegaudiodec.c.
Referenced by compute_stereo(), decode_init(), and imdct36().
#define MULS | ( | ra, | |||
rb | ) | MUL16(ra, rb) |
Definition at line 556 of file mpegaudiodec.c.
#define POW_FIX | ( | a | ) | ((int)((a) * POW_FRAC_ONE)) |
#define POW_FRAC_BITS 24 |
Definition at line 243 of file mpegaudiodec.c.
#define POW_FRAC_ONE (1 << POW_FRAC_BITS) |
Definition at line 244 of file mpegaudiodec.c.
#define POW_MULL | ( | a, | |||
b | ) | (((int64_t)(a) * (int64_t)(b)) >> POW_FRAC_BITS) |
#define READ_FLIP_SIGN | ( | dst, | |||
src | ) |
#define RENAME | ( | a | ) | a |
Definition at line 60 of file mpegaudiodec.c.
Referenced by decode_init(), huffman_decode(), mp_decode_frame(), nv12ToUV_TMPL(), nv21ToUV_TMPL(), postProcess_TMPL(), rgb2rgb_init_TMPL(), uyvytoyuv420_TMPL(), uyvytoyuv422_TMPL(), yuv2yuvX_TMPL(), yuv422ptouyvy_TMPL(), yuv422ptoyuy2_TMPL(), yuyvtoyuv420_TMPL(), yuyvtoyuv422_TMPL(), yv12touyvy_TMPL(), and yv12toyuy2_TMPL().
#define SCALE_GEN | ( | v | ) | { FIXR_OLD(1.0 * (v)), FIXR_OLD(0.7937005259 * (v)), FIXR_OLD(0.6299605249 * (v)) } |
Definition at line 119 of file mpegaudiodec.c.
#define SHR | ( | a, | |||
b | ) | ((a)>>(b)) |
#define SPLIT | ( | dst, | |||
sf, | |||||
n | ) |
Value:
if(n==3){\ int m= (sf*171)>>9;\ dst= sf - 3*m;\ sf=m;\ }else if(n==4){\ dst= sf&3;\ sf>>=2;\ }else if(n==5){\ int m= (sf*205)>>10;\ dst= sf - 5*m;\ sf=m;\ }else if(n==6){\ int m= (sf*171)>>10;\ dst= sf - 6*m;\ sf=m;\ }else{\ dst=0;\ }
Definition at line 1155 of file mpegaudiodec.c.
Referenced by lsf_sf_expand().
#define SUM8 | ( | op, | |||
sum, | |||||
w, | |||||
p | ) |
Value:
{ \ op(sum, (w)[0 * 64], (p)[0 * 64]); \ op(sum, (w)[1 * 64], (p)[1 * 64]); \ op(sum, (w)[2 * 64], (p)[2 * 64]); \ op(sum, (w)[3 * 64], (p)[3 * 64]); \ op(sum, (w)[4 * 64], (p)[4 * 64]); \ op(sum, (w)[5 * 64], (p)[5 * 64]); \ op(sum, (w)[6 * 64], (p)[6 * 64]); \ op(sum, (w)[7 * 64], (p)[7 * 64]); \ }
Definition at line 575 of file mpegaudiodec.c.
Referenced by apply_window_mp3(), and apply_window_mp3_c().
#define SUM8P2 | ( | sum1, | |||
op1, | |||||
sum2, | |||||
op2, | |||||
w1, | |||||
w2, | |||||
p | ) |
Value:
{ \ INTFLOAT tmp;\ tmp = p[0 * 64];\ op1(sum1, (w1)[0 * 64], tmp);\ op2(sum2, (w2)[0 * 64], tmp);\ tmp = p[1 * 64];\ op1(sum1, (w1)[1 * 64], tmp);\ op2(sum2, (w2)[1 * 64], tmp);\ tmp = p[2 * 64];\ op1(sum1, (w1)[2 * 64], tmp);\ op2(sum2, (w2)[2 * 64], tmp);\ tmp = p[3 * 64];\ op1(sum1, (w1)[3 * 64], tmp);\ op2(sum2, (w2)[3 * 64], tmp);\ tmp = p[4 * 64];\ op1(sum1, (w1)[4 * 64], tmp);\ op2(sum2, (w2)[4 * 64], tmp);\ tmp = p[5 * 64];\ op1(sum1, (w1)[5 * 64], tmp);\ op2(sum2, (w2)[5 * 64], tmp);\ tmp = p[6 * 64];\ op1(sum1, (w1)[6 * 64], tmp);\ op2(sum2, (w2)[6 * 64], tmp);\ tmp = p[7 * 64];\ op1(sum1, (w1)[7 * 64], tmp);\ op2(sum2, (w2)[7 * 64], tmp);\ }
Definition at line 587 of file mpegaudiodec.c.
Referenced by apply_window_mp3_c().
static void apply_window_mp3_c | ( | MPA_INT * | synth_buf, | |
MPA_INT * | window, | |||
int * | dither_state, | |||
OUT_INT * | samples, | |||
int | incr | |||
) | [static] |
Definition at line 646 of file mpegaudiodec.c.
Referenced by decode_init(), and ff_mpa_synth_filter().
static void compute_antialias | ( | MPADecodeContext * | s, | |
GranuleDef * | g | |||
) | [static] |
static void compute_antialias_integer | ( | MPADecodeContext * | s, | |
GranuleDef * | g | |||
) | [static] |
Definition at line 1578 of file mpegaudiodec.c.
static void compute_imdct | ( | MPADecodeContext * | s, | |
GranuleDef * | g, | |||
INTFLOAT * | sb_samples, | |||
INTFLOAT * | mdct_buf | |||
) | [static] |
static void compute_stereo | ( | MPADecodeContext * | s, | |
GranuleDef * | g0, | |||
GranuleDef * | g1 | |||
) | [static] |
DECLARE_ALIGNED | ( | 16 | , | |
MPA_INT | , | |||
ff_mpa_synth_window_TMPL | ||||
) |
static int decode_frame | ( | AVCodecContext * | avctx, | |
void * | data, | |||
int * | data_size, | |||
AVPacket * | avpkt | |||
) | [static] |
Definition at line 2030 of file mpegaudiodec.c.
static av_cold int decode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 316 of file mpegaudiodec.c.
static void exponents_from_scale_factors | ( | MPADecodeContext * | s, | |
GranuleDef * | g, | |||
int16_t * | exponents | |||
) | [static] |
static void ff_compute_band_indexes | ( | MPADecodeContext * | s, | |
GranuleDef * | g | |||
) | [static] |
Definition at line 168 of file mpegaudiodec.c.
static void ff_init_long_region | ( | MPADecodeContext * | s, | |
GranuleDef * | g, | |||
int | ra1, | |||
int | ra2 | |||
) | [static] |
Definition at line 158 of file mpegaudiodec.c.
static void ff_init_short_region | ( | MPADecodeContext * | s, | |
GranuleDef * | g | |||
) | [static] |
Definition at line 144 of file mpegaudiodec.c.
void ff_mpa_synth_filter | ( | MPA_INT * | synth_buf_ptr, | |
int * | synth_buf_offset, | |||
MPA_INT * | window, | |||
int * | dither_state, | |||
OUT_INT * | samples, | |||
int | incr, | |||
INTFLOAT | sb_samples[SBLIMIT] | |||
) |
Definition at line 705 of file mpegaudiodec.c.
Referenced by mp_decode_frame(), mpc_synth(), and qdm2_synthesis_filter().
void av_cold ff_mpa_synth_init_TMPL | ( | MPA_INT * | window | ) |
Definition at line 616 of file mpegaudiodec.c.
static void ff_region_offset2size | ( | GranuleDef * | g | ) | [static] |
Convert region offsets to region sizes and truncate size to big_values.
Definition at line 134 of file mpegaudiodec.c.
Referenced by mp_decode_layer3().
static void flush | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 2085 of file mpegaudiodec.c.
static int get_bitsz | ( | GetBitContext * | s, | |
int | n | |||
) | [inline, static] |
static int huffman_decode | ( | MPADecodeContext * | s, | |
GranuleDef * | g, | |||
int16_t * | exponents, | |||
int | end_pos2 | |||
) | [static] |
static void imdct12 | ( | INTFLOAT * | out, | |
INTFLOAT * | in | |||
) | [static] |
static void imdct36 | ( | INTFLOAT * | out, | |
INTFLOAT * | buf, | |||
INTFLOAT * | in, | |||
INTFLOAT * | win | |||
) | [static] |
static av_cold void int_pow_init | ( | void | ) | [static] |
static int l1_unscale | ( | int | n, | |
int | mant, | |||
int | scale_factor | |||
) | [inline, static] |
Definition at line 194 of file mpegaudiodec.c.
Referenced by mp_decode_layer1(), and mp_decode_layer2().
static int l2_unscale_group | ( | int | steps, | |
int | mant, | |||
int | scale_factor | |||
) | [inline, static] |
static int l3_unscale | ( | int | value, | |
int | exponent | |||
) | [inline, static] |
static av_always_inline void lsf_sf_expand | ( | int * | slen, | |
int | sf, | |||
int | n1, | |||
int | n2, | |||
int | n3 | |||
) | [static] |
static int mp_decode_frame | ( | MPADecodeContext * | s, | |
OUT_INT * | samples, | |||
const uint8_t * | buf, | |||
int | buf_size | |||
) | [static] |
Definition at line 1955 of file mpegaudiodec.c.
static int mp_decode_layer1 | ( | MPADecodeContext * | s | ) | [static] |
static int mp_decode_layer2 | ( | MPADecodeContext * | s | ) | [static] |
static int mp_decode_layer3 | ( | MPADecodeContext * | s | ) | [static] |
static void reorder_block | ( | MPADecodeContext * | s, | |
GranuleDef * | g | |||
) | [static] |
static int round_sample | ( | int * | sum | ) | [inline, static] |
static void switch_buffer | ( | MPADecodeContext * | s, | |
int * | pos, | |||
int * | end_pos, | |||
int * | end_pos2 | |||
) | [static] |
uint16_t band_index_long[9][23] [static] |
Definition at line 96 of file mpegaudiodec.c.
Referenced by decode_init(), and ff_init_long_region().
int32_t csa_table[8][4] [static] |
Definition at line 101 of file mpegaudiodec.c.
Referenced by compute_antialias_integer(), and decode_init().
float csa_table_float[8][4] [static] |
Definition at line 102 of file mpegaudiodec.c.
Referenced by compute_antialias_float(), and decode_init().
int dev_4_3_coefs[DEV_ORDER] [static] |
Definition at line 248 of file mpegaudiodec.c.
int16_t division_tab3[1<< 6] [static] |
Definition at line 105 of file mpegaudiodec.c.
int16_t division_tab5[1<< 8] [static] |
Definition at line 106 of file mpegaudiodec.c.
int16_t division_tab9[1<< 11] [static] |
Definition at line 107 of file mpegaudiodec.c.
int16_t* const division_tabs[4] [static] |
Initial value:
Definition at line 109 of file mpegaudiodec.c.
Referenced by decode_init(), and mp_decode_layer2().
VLC huff_quad_vlc[2] [static] |
Definition at line 90 of file mpegaudiodec.c.
VLC_TYPE huff_quad_vlc_tables[128+16][2] [static] |
const int huff_quad_vlc_tables_sizes[2] [static] |
Initial value:
{ 128, 16 }
Definition at line 92 of file mpegaudiodec.c.
Referenced by decode_init().
Definition at line 81 of file mpegaudiodec.c.
VLC_TYPE huff_vlc_tables[0+128+128+128+130+128+154+166+142+204+190+170+542+460+662+414][2] [static] |
const int huff_vlc_tables_sizes[16] [static] |
Initial value:
{ 0, 128, 128, 128, 130, 128, 154, 166, 142, 204, 190, 170, 542, 460, 662, 414 }
Definition at line 86 of file mpegaudiodec.c.
Referenced by decode_init().
const INTFLOAT icos36[9] [static] |
Initial value:
{ FIXR(0.50190991877167369479), FIXR(0.51763809020504152469), FIXR(0.55168895948124587824), FIXR(0.61038729438072803416), FIXR(0.70710678118654752439), FIXR(0.87172339781054900991), FIXR(1.18310079157624925896), FIXR(1.93185165257813657349), FIXR(5.73685662283492756461), }
Definition at line 741 of file mpegaudiodec.c.
const INTFLOAT icos36h[9] [static] |
Initial value:
{ FIXHR(0.50190991877167369479/2), FIXHR(0.51763809020504152469/2), FIXHR(0.55168895948124587824/2), FIXHR(0.61038729438072803416/2), FIXHR(0.70710678118654752439/2), FIXHR(0.87172339781054900991/2), FIXHR(1.18310079157624925896/4), FIXHR(1.93185165257813657349/4), }
Definition at line 754 of file mpegaudiodec.c.
INTFLOAT is_table[2][16] [static] |
INTFLOAT is_table_lsf[2][2][16] [static] |
INTFLOAT mdct_win[8][36] [static] |
uint16_t scale_factor_modshift[64] [static] |
Definition at line 114 of file mpegaudiodec.c.
Referenced by decode_init(), l1_unscale(), and l2_unscale_group().
int32_t scale_factor_mult[15][3] [static] |
Definition at line 116 of file mpegaudiodec.c.
Referenced by decode_init(), encode_frame(), l1_unscale(), and MPA_encode_init().
const int32_t scale_factor_mult2[3][3] [static] |