43 #define BACKSTEP_SIZE 512
45 #define LAST_BUF_SIZE 2 * BACKSTEP_SIZE + EXTRABYTES
90 # define SHR(a,b) ((a)*(1.0f/(1<<(b))))
91 # define FIXR_OLD(a) ((int)((a) * FRAC_ONE + 0.5))
92 # define FIXR(x) ((float)(x))
93 # define FIXHR(x) ((float)(x))
94 # define MULH3(x, y, s) ((s)*(y)*(x))
95 # define MULLx(x, y, s) ((y)*(x))
96 # define RENAME(a) a ## _float
97 # define OUT_FMT AV_SAMPLE_FMT_FLT
98 # define OUT_FMT_P AV_SAMPLE_FMT_FLTP
100 # define SHR(a,b) ((a)>>(b))
102 # define FIXR_OLD(a) ((int)((a) * FRAC_ONE + 0.5))
103 # define FIXR(a) ((int)((a) * FRAC_ONE + 0.5))
104 # define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
105 # define MULH3(x, y, s) MULH((s)*(x), y)
106 # define MULLx(x, y, s) MULL(x,y,s)
107 # define RENAME(a) a ## _fixed
108 # define OUT_FMT AV_SAMPLE_FMT_S16
109 # define OUT_FMT_P AV_SAMPLE_FMT_S16P
114 #define HEADER_SIZE 4
122 0 + 128 + 128 + 128 + 130 + 128 + 154 + 166 +
123 142 + 204 + 190 + 170 + 542 + 460 + 662 + 414
126 0, 128, 128, 128, 130, 128, 154, 166,
127 142, 204, 190, 170, 542, 460, 662, 414
154 #define SCALE_GEN(v) \
155 { FIXR_OLD(1.0 * (v)), FIXR_OLD(0.7937005259 * (v)), FIXR_OLD(0.6299605249 * (v)) }
171 for (i = 0; i < 3; i++) {
181 if (s->sample_rate_index != 8)
186 if (s->sample_rate_index <= 2)
188 else if (s->sample_rate_index != 8)
201 l =
FFMIN(ra1 + ra2 + 2, 22);
212 if (s->sample_rate_index <= 2)
230 static inline int l1_unscale(
int n,
int mant,
int scale_factor)
241 return (
int)((val + (1LL << (shift - 1))) >> shift);
255 val = (val + (1 << (shift - 1))) >> shift;
271 m = (m + (1 << (e - 1))) >> e;
282 for (i = 0; i < 64; i++) {
291 for (i = 0; i < 15; i++) {
294 norm = ((INT64_C(1) << n) *
FRAC_ONE) / ((1 << n) - 1);
308 for (i = 1; i < 16; i++) {
311 uint8_t tmp_bits [512] = { 0 };
312 uint16_t tmp_codes[512] = { 0 };
317 for (x = 0; x < xsize; x++) {
318 for (y = 0; y < xsize; y++) {
319 tmp_bits [(x << 5) | y | ((x&&y)<<4)]= h->
bits [j ];
320 tmp_codes[(x << 5) | y | ((x&&y)<<4)]= h->
codes[j++];
328 tmp_bits, 1, 1, tmp_codes, 2, 2,
335 for (i = 0; i < 2; i++) {
338 init_vlc(&huff_quad_vlc[i], i == 0 ? 7 : 4, 16,
345 for (i = 0; i < 9; i++) {
347 for (j = 0; j < 22; j++) {
358 for (i = 0; i < 4; i++) {
361 int val1, val2, val3, steps;
374 for (i = 0; i < 7; i++) {
378 f = tan((
double)i * M_PI / 12.0);
379 v =
FIXR(f / (1.0 + f));
387 for (i = 7; i < 16; i++)
390 for (i = 0; i < 16; i++) {
394 for (j = 0; j < 2; j++) {
395 e = -(j + 1) * ((i + 1) >> 1);
396 f = pow(2.0, e / 4.0);
406 for (i = 0; i < 8; i++) {
409 cs = 1.0 / sqrt(1.0 + ci * ci);
427 static int initialized_tables = 0;
430 if (!initialized_tables) {
432 initialized_tables = 1;
456 #define C3 FIXHR(0.86602540378443864676/2)
457 #define C4 FIXHR(0.70710678118654752439/2) //0.5 / cos(pi*(9)/36)
458 #define C5 FIXHR(0.51763809020504152469/2) //0.5 / cos(pi*(5)/36)
459 #define C6 FIXHR(1.93185165257813657349/4) //0.5 / cos(pi*(15)/36)
468 in1 = in[1*3] + in[0*3];
469 in2 = in[2*3] + in[1*3];
470 in3 = in[3*3] + in[2*3];
471 in4 = in[4*3] + in[3*3];
472 in5 = in[5*3] + in[4*3];
507 int bound, i, v, n, ch, j, mant;
512 bound = (s->mode_ext + 1) * 4;
517 for (i = 0; i < bound; i++) {
518 for (ch = 0; ch < s->nb_channels; ch++) {
522 for (i = bound; i <
SBLIMIT; i++)
526 for (i = 0; i < bound; i++) {
527 for (ch = 0; ch < s->nb_channels; ch++) {
528 if (allocation[ch][i])
532 for (i = bound; i <
SBLIMIT; i++) {
533 if (allocation[0][i]) {
540 for (j = 0; j < 12; j++) {
541 for (i = 0; i < bound; i++) {
542 for (ch = 0; ch < s->nb_channels; ch++) {
543 n = allocation[ch][i];
546 v =
l1_unscale(n, mant, scale_factors[ch][i]);
553 for (i = bound; i <
SBLIMIT; i++) {
554 n = allocation[0][i];
574 int table, bit_alloc_bits, i, j, ch, bound, v;
582 s->sample_rate, s->lsf);
587 bound = (s->mode_ext + 1) * 4;
591 av_dlog(s->
avctx,
"bound=%d sblimit=%d\n", bound, sblimit);
599 for (i = 0; i < bound; i++) {
600 bit_alloc_bits = alloc_table[j];
601 for (ch = 0; ch < s->nb_channels; ch++)
602 bit_alloc[ch][i] =
get_bits(&s->
gb, bit_alloc_bits);
603 j += 1 << bit_alloc_bits;
605 for (i = bound; i < sblimit; i++) {
606 bit_alloc_bits = alloc_table[j];
610 j += 1 << bit_alloc_bits;
614 for (i = 0; i < sblimit; i++) {
615 for (ch = 0; ch < s->nb_channels; ch++) {
616 if (bit_alloc[ch][i])
622 for (i = 0; i < sblimit; i++) {
623 for (ch = 0; ch < s->nb_channels; ch++) {
624 if (bit_alloc[ch][i]) {
625 sf = scale_factors[ch][i];
626 switch (scale_code[ch][i]) {
654 for (k = 0; k < 3; k++) {
655 for (l = 0; l < 12; l += 3) {
657 for (i = 0; i < bound; i++) {
658 bit_alloc_bits = alloc_table[j];
659 for (ch = 0; ch < s->nb_channels; ch++) {
660 b = bit_alloc[ch][i];
662 scale = scale_factors[ch][i][k];
663 qindex = alloc_table[j+
b];
679 for (m = 0; m < 3; m++) {
692 j += 1 << bit_alloc_bits;
695 for (i = bound; i < sblimit; i++) {
696 bit_alloc_bits = alloc_table[j];
699 int mant, scale0, scale1;
700 scale0 = scale_factors[0][i][k];
701 scale1 = scale_factors[1][i][k];
702 qindex = alloc_table[j+
b];
725 for (m = 0; m < 3; m++) {
742 j += 1 << bit_alloc_bits;
745 for (i = sblimit; i <
SBLIMIT; i++) {
746 for (ch = 0; ch < s->nb_channels; ch++) {
757 #define SPLIT(dst,sf,n) \
759 int m = (sf * 171) >> 9; \
762 } else if (n == 4) { \
765 } else if (n == 5) { \
766 int m = (sf * 205) >> 10; \
769 } else if (n == 6) { \
770 int m = (sf * 171) >> 10; \
780 SPLIT(slen[3], sf, n3)
781 SPLIT(slen[2], sf, n2)
782 SPLIT(slen[1], sf, n1)
790 int len, i, j, k, l,
v0, shift, gain, gains[3];
800 v0 = gain - ((g->
scale_factors[i] + pretab[i]) << shift) + 400;
802 for (j = len; j > 0; j--)
814 for (l = 0; l < 3; l++) {
816 for (j = len; j > 0; j--)
851 #define READ_FLIP_SIGN(dst,src) \
852 v = AV_RN32A(src) ^ (get_bits1(&s->gb) << 31); \
855 #define READ_FLIP_SIGN(dst,src) \
856 v = -get_bits1(&s->gb); \
857 *(dst) = (*(src) ^ v) - v;
861 int16_t *exponents,
int end_pos2)
865 int last_pos, bits_left;
871 for (i = 0; i < 3; i++) {
872 int j, k, l, linbits;
908 exponent= exponents[s_index];
955 while (s_index <= 572) {
958 if (pos >= end_pos) {
959 if (pos > end_pos2 && last_pos) {
964 av_log(s->
avctx,
AV_LOG_INFO,
"overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos);
982 static const int idxtab[16] = { 3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0 };
984 int pos = s_index + idxtab[code];
985 code ^= 8 >> idxtab[code];
1021 if (s->sample_rate_index != 8)
1033 for (j = len; j > 0; j--) {
1034 *dst++ = ptr[0*
len];
1035 *dst++ = ptr[1*
len];
1036 *dst++ = ptr[2*
len];
1040 memcpy(ptr1, tmp, len * 3 *
sizeof(*ptr1));
1044 #define ISQRT2 FIXR(0.70710678118654752440)
1049 int sf_max, sf,
len, non_zero_found;
1050 INTFLOAT (*is_tab)[16], *tab0, *
tab1, tmp0, tmp1, v1, v2;
1051 int non_zero_found_short[3];
1066 non_zero_found_short[0] = 0;
1067 non_zero_found_short[1] = 0;
1068 non_zero_found_short[2] = 0;
1075 for (l = 2; l >= 0; l--) {
1078 if (!non_zero_found_short[l]) {
1080 for (j = 0; j <
len; j++) {
1082 non_zero_found_short[l] = 1;
1092 for (j = 0; j <
len; j++) {
1102 for (j = 0; j <
len; j++) {
1113 non_zero_found = non_zero_found_short[0] |
1114 non_zero_found_short[1] |
1115 non_zero_found_short[2];
1117 for (i = g1->
long_end - 1;i >= 0;i--) {
1122 if (!non_zero_found) {
1123 for (j = 0; j <
len; j++) {
1130 k = (i == 21) ? 20 : i;
1136 for (j = 0; j <
len; j++) {
1146 for (j = 0; j <
len; j++) {
1164 for (i = 0; i < 576; i++) {
1167 tab0[i] = tmp0 + tmp1;
1168 tab1[i] = tmp0 - tmp1;
1175 #define AA(j) do { \
1176 float tmp0 = ptr[-1-j]; \
1177 float tmp1 = ptr[ j]; \
1178 ptr[-1-j] = tmp0 * csa_table[j][0] - tmp1 * csa_table[j][1]; \
1179 ptr[ j] = tmp0 * csa_table[j][1] + tmp1 * csa_table[j][0]; \
1182 #define AA(j) do { \
1183 int tmp0 = ptr[-1-j]; \
1184 int tmp1 = ptr[ j]; \
1185 int tmp2 = MULH(tmp0 + tmp1, csa_table[j][0]); \
1186 ptr[-1-j] = 4 * (tmp2 - MULH(tmp1, csa_table[j][2])); \
1187 ptr[ j] = 4 * (tmp2 + MULH(tmp0, csa_table[j][3])); \
1207 for (i = n; i > 0; i--) {
1224 INTFLOAT *win, *out_ptr, *ptr, *buf, *ptr1;
1226 int i, j, mdct_long_end, sblimit;
1231 while (ptr >= ptr1) {
1235 if (p[0] | p[1] | p[2] | p[3] | p[4] | p[5])
1238 sblimit = ((ptr - g->
sb_hybrid) / 18) + 1;
1247 mdct_long_end = sblimit;
1254 buf = mdct_buf + 4*18*(mdct_long_end >> 2) + (mdct_long_end & 3);
1255 ptr = g->
sb_hybrid + 18 * mdct_long_end;
1257 for (j = mdct_long_end; j < sblimit; j++) {
1259 win =
RENAME(ff_mdct_win)[2 + (4 & -(j & 1))];
1260 out_ptr = sb_samples + j;
1262 for (i = 0; i < 6; i++) {
1263 *out_ptr = buf[4*i];
1267 for (i = 0; i < 6; i++) {
1268 *out_ptr =
MULH3(out2[i ], win[i ], 1) + buf[4*(i + 6*1)];
1269 buf[4*(i + 6*2)] =
MULH3(out2[i + 6], win[i + 6], 1);
1273 for (i = 0; i < 6; i++) {
1274 *out_ptr =
MULH3(out2[i ], win[i ], 1) + buf[4*(i + 6*2)];
1275 buf[4*(i + 6*0)] =
MULH3(out2[i + 6], win[i + 6], 1);
1279 for (i = 0; i < 6; i++) {
1280 buf[4*(i + 6*0)] =
MULH3(out2[i ], win[i ], 1) + buf[4*(i + 6*0)];
1281 buf[4*(i + 6*1)] =
MULH3(out2[i + 6], win[i + 6], 1);
1282 buf[4*(i + 6*2)] = 0;
1285 buf += (j&3) != 3 ? 1 : (4*18-3);
1288 for (j = sblimit; j <
SBLIMIT; j++) {
1290 out_ptr = sb_samples + j;
1291 for (i = 0; i < 18; i++) {
1292 *out_ptr = buf[4*i];
1296 buf += (j&3) != 3 ? 1 : (4*18-3);
1303 int nb_granules, main_data_begin;
1304 int gr, ch, blocksplit_flag, i, j, k, n, bits_pos;
1306 int16_t exponents[576];
1315 if (s->nb_channels == 2)
1320 for (ch = 0; ch < s->nb_channels; ch++) {
1326 for (gr = 0; gr < nb_granules; gr++) {
1327 for (ch = 0; ch < s->nb_channels; ch++) {
1348 if (blocksplit_flag) {
1355 for (i = 0; i < 2; i++)
1357 for (i = 0; i < 3; i++)
1361 int region_address1, region_address2;
1364 for (i = 0; i < 3; i++)
1370 region_address1, region_address2);
1399 #if !UNCHECKED_BITSTREAM_READER
1400 s->
gb.size_in_bits_plus8 += extrasize * 8;
1403 for (gr = 0; gr < nb_granules && (s->
last_buf_size >> 3) < main_data_begin; gr++) {
1404 for (ch = 0; ch < s->nb_channels; ch++) {
1423 for (; gr < nb_granules; gr++) {
1424 for (ch = 0; ch < s->nb_channels; ch++) {
1430 int slen, slen1, slen2;
1435 av_dlog(s->
avctx,
"slen1=%d slen2=%d\n", slen1, slen2);
1440 for (i = 0; i < n; i++)
1443 for (i = 0; i < n; i++)
1447 for (i = 0; i < 18; i++)
1449 for (i = 0; i < 3; i++)
1452 for (i = 0; i < 21; i++)
1458 for (k = 0; k < 4; k++) {
1460 if ((g->
scfsi & (0x8 >> k)) == 0) {
1461 slen = (k < 2) ? slen1 : slen2;
1463 for (i = 0; i < n; i++)
1466 for (i = 0; i < n; i++)
1471 for (i = 0; i < n; i++) {
1480 int tindex, tindex2, slen[4], sl, sf;
1495 }
else if (sf < 244) {
1507 }
else if (sf < 500) {
1518 for (k = 0; k < 4; k++) {
1522 for (i = 0; i < n; i++)
1525 for (i = 0; i < n; i++)
1543 for (ch = 0; ch < s->nb_channels; ch++) {
1553 return nb_granules * 18;
1557 const uint8_t *buf,
int buf_size)
1559 int i, nb_frames, ch, ret;
1565 if (s->error_protection)
1607 assert(i <= buf_size - HEADER_SIZE && i >= 0);
1623 for (ch = 0; ch < s->nb_channels; ch++) {
1626 samples_ptr = samples[ch];
1629 samples_ptr = samples[0] + ch;
1630 sample_stride = s->nb_channels;
1632 for (i = 0; i < nb_frames; i++) {
1635 RENAME(ff_mpa_synth_window),
1638 samples_ptr += 32 * sample_stride;
1642 return nb_frames * 32 *
sizeof(
OUT_INT) * s->nb_channels;
1649 int buf_size = avpkt->
size;
1674 if (s->frame_size <= 0 || s->frame_size > buf_size) {
1677 }
else if (s->frame_size < buf_size) {
1678 buf_size= s->frame_size;
1713 #if CONFIG_MP3ADU_DECODER || CONFIG_MP3ADUFLOAT_DECODER
1715 int *got_frame_ptr,
AVPacket *avpkt)
1718 int buf_size = avpkt->
size;
1736 header =
AV_RB32(buf) | 0xffe00000;
1750 s->frame_size =
len;
1765 #if CONFIG_MP3ON4_DECODER || CONFIG_MP3ON4FLOAT_DECODER
1770 typedef struct MP3On4DecodeContext {
1776 } MP3On4DecodeContext;
1783 static const uint8_t mp3Frames[8] = { 0, 1, 1, 2, 3, 3, 4, 5 };
1786 static const uint8_t chan_offset[8][5] = {
1798 static const int16_t chan_layout[8] = {
1811 MP3On4DecodeContext *s = avctx->
priv_data;
1814 for (i = 0; i < s->frames; i++)
1823 MP3On4DecodeContext *s = avctx->
priv_data;
1844 s->syncword = 0xffe00000;
1846 s->syncword = 0xfff00000;
1855 if (!s->mp3decctx[0])
1863 s->mp3decctx[0]->adu_mode = 1;
1868 for (i = 1; i < s->frames; i++) {
1870 if (!s->mp3decctx[i])
1872 s->mp3decctx[i]->adu_mode = 1;
1873 s->mp3decctx[i]->avctx = avctx;
1874 s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp;
1879 decode_close_mp3on4(avctx);
1887 MP3On4DecodeContext *s = avctx->
priv_data;
1889 for (i = 0; i < s->frames; i++)
1894 static int decode_frame_mp3on4(
AVCodecContext *avctx,
void *data,
1895 int *got_frame_ptr,
AVPacket *avpkt)
1898 int buf_size = avpkt->
size;
1899 MP3On4DecodeContext *s = avctx->
priv_data;
1901 int fsize, len = buf_size, out_size = 0;
1913 out_samples = (
OUT_INT **)s->frame->extended_data;
1922 for (fr = 0; fr < s->frames; fr++) {
1925 m = s->mp3decctx[fr];
1932 header = (
AV_RB32(buf) & 0x000fffff) | s->syncword;
1939 if (ch + m->nb_channels > avctx->
channels ||
1940 s->coff[fr] + m->nb_channels > avctx->
channels) {
1945 ch += m->nb_channels;
1947 outptr[0] = out_samples[s->coff[fr]];
1948 if (m->nb_channels > 1)
1949 outptr[1] = out_samples[s->coff[fr] + 1];
1962 avctx->
sample_rate = s->mp3decctx[0]->sample_rate;
1964 s->frame->nb_samples = out_size / (avctx->
channels *
sizeof(
OUT_INT));
1973 #if CONFIG_MP1_DECODER
1989 #if CONFIG_MP2_DECODER
2005 #if CONFIG_MP3_DECODER
2021 #if CONFIG_MP3ADU_DECODER
2028 .
decode = decode_frame_adu,
2037 #if CONFIG_MP3ON4_DECODER
2042 .priv_data_size =
sizeof(MP3On4DecodeContext),
2043 .
init = decode_init_mp3on4,
2044 .
close = decode_close_mp3on4,
2045 .
decode = decode_frame_mp3on4,
2047 .
flush = flush_mp3on4,
#define MPA_MAX_CODED_FRAME_SIZE
#define AV_CH_LAYOUT_7POINT1
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
static uint32_t table_4_3_value[TABLE_4_3_SIZE]
static const uint8_t lsf_nsf_table[6][3][4]
This structure describes decoded (raw) audio or video data.
static int l1_unscale(int n, int mant, int scale_factor)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CH_LAYOUT_SURROUND
static void skip_bits_long(GetBitContext *s, int n)
AVFrame * coded_frame
the picture in the bitstream
#define READ_FLIP_SIGN(dst, src)
static int8_t table_4_3_exp[TABLE_4_3_SIZE]
static void align_get_bits(GetBitContext *s)
static void compute_stereo(MPADecodeContext *s, GranuleDef *g0, GranuleDef *g1)
struct MPADecodeContext MPADecodeContext
const int ff_mpa_quant_bits[17]
static const uint8_t mpa_pretab[2][22]
#define AV_CH_LAYOUT_4POINT0
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
#define AV_CH_LAYOUT_STEREO
static av_cold void decode_init_static(void)
uint8_t scale_factors[40]
#define AV_CH_LAYOUT_5POINT0
mpeg audio layer common tables.
static const int huff_vlc_tables_sizes[16]
static const uint8_t slen_table[2][16]
static av_always_inline void lsf_sf_expand(int *slen, int sf, int n1, int n2, int n3)
static int16_t division_tab5[1<< 8]
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
enum AVSampleFormat sample_fmt
audio sample format
static av_cold int decode_init(AVCodecContext *avctx)
static int mp_decode_layer2(MPADecodeContext *s)
static int32_t scale_factor_mult[15][3]
av_cold void RENAME() ff_mpa_synth_init(MPA_INT *window)
const int ff_mpa_quant_steps[17]
static void mpegaudio_tableinit(void)
const unsigned char *const ff_mpa_alloc_tables[5]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static const uint8_t mpa_huff_data[32][2]
static const uint8_t mpa_quad_codes[2][16]
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
static int bit_alloc(AC3EncodeContext *s, int snr_offset)
Run the bit allocation with a given SNR offset.
static int init(AVCodecParserContext *s)
static int16_t division_tab3[1<< 6]
#define AV_CH_LAYOUT_5POINT1
static int get_bits_left(GetBitContext *gb)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static INTFLOAT csa_table[8][4]
#define MODE_EXT_MS_STEREO
static VLC_TYPE huff_quad_vlc_tables[128+16][2]
enum AVSampleFormat request_sample_fmt
Used to request a sample format from the decoder.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
preferred ID for decoding MPEG audio layer 1, 2 or 3
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static int mp_decode_layer1(MPADecodeContext *s)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static const int32_t scale_factor_mult2[3][3]
uint64_t channel_layout
Audio channel layout.
void ff_mpadsp_init(MPADSPContext *s)
static int huffman_decode(MPADecodeContext *s, GranuleDef *g, int16_t *exponents, int end_pos2)
int bit_rate
the average bitrate
audio channel layout utility functions
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static void switch_buffer(MPADecodeContext *s, int *pos, int *end_pos, int *end_pos2)
static int mp_decode_layer3(MPADecodeContext *s)
static int16_t division_tab9[1<< 11]
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
uint32_t free_format_next_header
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static int16_t *const division_tabs[4]
static int l2_unscale_group(int steps, int mant, int scale_factor)
static int l3_unscale(int value, int exponent)
#define INIT_VLC_USE_NEW_STATIC
static const uint8_t mpa_quad_bits[2][16]
static uint16_t band_index_long[9][23]
int frame_size
Number of samples per channel in an audio frame.
static const int huff_quad_vlc_tables_sizes[2]
static INTFLOAT is_table_lsf[2][2][16]
int sb_hybrid[SBLIMIT *18]
int sample_rate
samples per second
MPA_INT synth_buf[MPA_MAX_CHANNELS][512 *2]
main external API structure.
static void close(AVCodecParserContext *s)
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
static unsigned int get_bits1(GetBitContext *s)
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
uint8_t count1table_select
static void skip_bits(GetBitContext *s, int n)
static void ff_region_offset2size(GranuleDef *g)
Convert region offsets to region sizes and truncate size to big_values.
#define FF_ARRAY_ELEMS(a)
static void compute_imdct(MPADecodeContext *s, GranuleDef *g, INTFLOAT *sb_samples, INTFLOAT *mdct_buf)
static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples, const uint8_t *buf, int buf_size)
#define MODE_EXT_I_STEREO
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g, int16_t *exponents)
static const uint8_t band_size_long[9][22]
static const uint16_t scale[4]
#define DECLARE_ALIGNED(n, t, v)
static void compute_antialias(MPADecodeContext *s, GranuleDef *g)
#define SPLIT(dst, sf, n)
static VLC huff_quad_vlc[2]
common internal api header.
static uint16_t scale_factor_modshift[64]
static void ff_init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int ra2)
#define AVERROR_INVALIDDATA
static INTFLOAT is_table[2][16]
AVSampleFormat
Audio Sample Formats.
static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g)
void RENAME() ff_mpa_synth_filter(MPADSPContext *s, MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, MPA_INT *sb_samples)
mpeg audio declarations for both encoder and decoder.
static void imdct12(INTFLOAT *out, INTFLOAT *in)
static void reorder_block(MPADecodeContext *s, GranuleDef *g)
const int ff_mpa_sblimit_table[5]
int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int bit_size, int sync_extension)
Parse MPEG-4 systems extradata to retrieve audio configuration.
INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT *18]
int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf)
int channels
number of audio channels
const uint8_t ff_mpeg4audio_channels[8]
MPA_DECODE_HEADER uint8_t last_buf[LAST_BUF_SIZE]
VLC_TYPE(* table)[2]
code, bits
static VLC_TYPE huff_vlc_tables[0+128+128+128+130+128+154+166+142+204+190+170+542+460+662+414][2]
struct GranuleDef GranuleDef
int synth_buf_offset[MPA_MAX_CHANNELS]
static int get_bitsz(GetBitContext *s, int n)
mpeg audio layer decoder tables.
int sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]
static const HuffTable mpa_huff_tables[16]
static void flush(AVCodecContext *avctx)
static const float ci_table[8]
uint8_t ** extended_data
pointers to the data planes/channels.
#define AV_CH_LAYOUT_MONO
static void ff_init_short_region(MPADecodeContext *s, GranuleDef *g)
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int alloc_table(VLC *vlc, int size, int use_static)
static const uint8_t band_size_short[9][13]
int adu_mode
0 for standard mp3, 1 for adu formatted mp3
static void mp_flush(MPADecodeContext *ctx)
GranuleDef granules[2][2]
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)