Go to the documentation of this file.
46 #define BACKSTEP_SIZE 512
48 #define LAST_BUF_SIZE 2 * BACKSTEP_SIZE + EXTRABYTES
101 0 + 128 + 128 + 128 + 130 + 128 + 154 + 166 +
102 142 + 204 + 190 + 170 + 542 + 460 + 662 + 414
105 0, 128, 128, 128, 130, 128, 154, 166,
106 142, 204, 190, 170, 542, 460, 662, 414
133 #define SCALE_GEN(v) \
134 { FIXR_OLD(1.0 * (v)), FIXR_OLD(0.7937005259 * (v)), FIXR_OLD(0.6299605249 * (v)) }
149 g->region_size[2] = 576 / 2;
150 for (
i = 0;
i < 3;
i++) {
151 k =
FFMIN(
g->region_size[
i],
g->big_values);
152 g->region_size[
i] = k - j;
159 if (
g->block_type == 2) {
160 if (
s->sample_rate_index != 8)
161 g->region_size[0] = (36 / 2);
163 g->region_size[0] = (72 / 2);
165 if (
s->sample_rate_index <= 2)
166 g->region_size[0] = (36 / 2);
167 else if (
s->sample_rate_index != 8)
168 g->region_size[0] = (54 / 2);
170 g->region_size[0] = (108 / 2);
172 g->region_size[1] = (576 / 2);
181 l =
FFMIN(ra1 + ra2 + 2, 22);
187 if (
g->block_type == 2) {
188 if (
g->switch_point) {
189 if(
s->sample_rate_index == 8)
194 if (
s->sample_rate_index <= 2)
256 m = (m + ((1U << e)>>1)) >> e;
267 for (
i = 0;
i < 64;
i++) {
276 for (
i = 0;
i < 15;
i++) {
279 norm = ((INT64_C(1) <<
n) *
FRAC_ONE) / ((1 <<
n) - 1);
283 ff_dlog(
NULL,
"%d: norm=%x s=%"PRIx32
" %"PRIx32
" %"PRIx32
"\n",
i,
294 for (
i = 1;
i < 16;
i++) {
297 uint8_t tmp_bits [512] = { 0 };
298 uint16_t tmp_codes[512] = { 0 };
303 for (x = 0; x < xsize; x++) {
304 for (y = 0; y < xsize; y++) {
305 tmp_bits [(x << 5) | y | ((x&&y)<<4)]=
h->bits [j ];
306 tmp_codes[(x << 5) | y | ((x&&y)<<4)]=
h->codes[j++];
314 tmp_bits, 1, 1, tmp_codes, 2, 2,
321 for (
i = 0;
i < 2;
i++) {
331 for (
i = 0;
i < 9;
i++) {
333 for (j = 0; j < 22; j++) {
344 for (
i = 0;
i < 4;
i++) {
347 int val1, val2, val3, steps;
360 for (
i = 0;
i < 7;
i++) {
364 f = tan((
double)
i *
M_PI / 12.0);
373 for (
i = 7;
i < 16;
i++)
376 for (
i = 0;
i < 16;
i++) {
380 for (j = 0; j < 2; j++) {
381 e = -(j + 1) * ((
i + 1) >> 1);
392 for (
i = 0;
i < 8;
i++) {
395 cs = 1.0 / sqrt(1.0 + ci * ci);
423 static int initialized_tables = 0;
426 if (!initialized_tables) {
428 initialized_tables = 1;
454 #define C3 FIXHR(0.86602540378443864676/2)
455 #define C4 FIXHR(0.70710678118654752439/2) //0.5 / cos(pi*(9)/36)
456 #define C5 FIXHR(0.51763809020504152469/2) //0.5 / cos(pi*(5)/36)
457 #define C6 FIXHR(1.93185165257813657349/4) //0.5 / cos(pi*(15)/36)
466 in1 =
in[1*3] +
in[0*3];
467 in2 =
in[2*3] +
in[1*3];
468 in3 =
in[3*3] +
in[2*3];
469 in4 =
in[4*3] +
in[3*3];
470 in5 =
in[5*3] +
in[4*3];
510 bound = (
s->mode_ext + 1) * 4;
516 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
525 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
526 if (allocation[
ch][
i])
531 if (allocation[0][
i]) {
538 for (j = 0; j < 12; j++) {
540 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
541 n = allocation[
ch][
i];
548 s->sb_samples[
ch][j][
i] = v;
552 n = allocation[0][
i];
556 s->sb_samples[0][j][
i] = v;
558 s->sb_samples[1][j][
i] = v;
560 s->sb_samples[0][j][
i] = 0;
561 s->sb_samples[1][j][
i] = 0;
576 int scale, qindex,
bits, steps, k, l, m,
b;
580 s->sample_rate,
s->lsf);
585 bound = (
s->mode_ext + 1) * 4;
599 for (
ch = 0;
ch <
s->nb_channels;
ch++)
601 j += 1 << bit_alloc_bits;
608 j += 1 << bit_alloc_bits;
612 for (
i = 0;
i < sblimit;
i++) {
613 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
620 for (
i = 0;
i < sblimit;
i++) {
621 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
623 sf = scale_factors[
ch][
i];
624 switch (scale_code[
ch][
i]) {
652 for (k = 0; k < 3; k++) {
653 for (l = 0; l < 12; l += 3) {
657 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
660 scale = scale_factors[
ch][
i][k];
670 s->sb_samples[
ch][k * 12 + l + 0][
i] =
672 s->sb_samples[
ch][k * 12 + l + 1][
i] =
674 s->sb_samples[
ch][k * 12 + l + 2][
i] =
677 for (m = 0; m < 3; m++) {
680 s->sb_samples[
ch][k * 12 + l + m][
i] = v;
684 s->sb_samples[
ch][k * 12 + l + 0][
i] = 0;
685 s->sb_samples[
ch][k * 12 + l + 1][
i] = 0;
686 s->sb_samples[
ch][k * 12 + l + 2][
i] = 0;
690 j += 1 << bit_alloc_bits;
697 int mant, scale0, scale1;
698 scale0 = scale_factors[0][
i][k];
699 scale1 = scale_factors[1][
i][k];
708 s->sb_samples[0][k * 12 + l + 0][
i] =
710 s->sb_samples[1][k * 12 + l + 0][
i] =
714 s->sb_samples[0][k * 12 + l + 1][
i] =
716 s->sb_samples[1][k * 12 + l + 1][
i] =
718 s->sb_samples[0][k * 12 + l + 2][
i] =
720 s->sb_samples[1][k * 12 + l + 2][
i] =
723 for (m = 0; m < 3; m++) {
725 s->sb_samples[0][k * 12 + l + m][
i] =
727 s->sb_samples[1][k * 12 + l + m][
i] =
732 s->sb_samples[0][k * 12 + l + 0][
i] = 0;
733 s->sb_samples[0][k * 12 + l + 1][
i] = 0;
734 s->sb_samples[0][k * 12 + l + 2][
i] = 0;
735 s->sb_samples[1][k * 12 + l + 0][
i] = 0;
736 s->sb_samples[1][k * 12 + l + 1][
i] = 0;
737 s->sb_samples[1][k * 12 + l + 2][
i] = 0;
740 j += 1 << bit_alloc_bits;
744 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
745 s->sb_samples[
ch][k * 12 + l + 0][
i] = 0;
746 s->sb_samples[
ch][k * 12 + l + 1][
i] = 0;
747 s->sb_samples[
ch][k * 12 + l + 2][
i] = 0;
755 #define SPLIT(dst,sf,n) \
757 int m = (sf * 171) >> 9; \
760 } else if (n == 4) { \
763 } else if (n == 5) { \
764 int m = (sf * 205) >> 10; \
767 } else if (n == 6) { \
768 int m = (sf * 171) >> 10; \
778 SPLIT(slen[3], sf, n3)
779 SPLIT(slen[2], sf, n2)
780 SPLIT(slen[1], sf, n1)
792 gain =
g->global_gain - 210;
793 shift =
g->scalefac_scale + 1;
797 for (
i = 0;
i <
g->long_end;
i++) {
798 v0 = gain - ((
g->scale_factors[
i] + pretab[
i]) <<
shift) + 400;
800 for (j =
len; j > 0; j--)
804 if (
g->short_start < 13) {
806 gains[0] = gain - (
g->subblock_gain[0] << 3);
807 gains[1] = gain - (
g->subblock_gain[1] << 3);
808 gains[2] = gain - (
g->subblock_gain[2] << 3);
810 for (
i =
g->short_start;
i < 13;
i++) {
812 for (l = 0; l < 3; l++) {
813 v0 = gains[l] - (
g->scale_factors[k++] <<
shift) + 400;
814 for (j =
len; j > 0; j--)
824 if (
s->in_gb.buffer && *pos >=
s->gb.size_in_bits -
s->extrasize * 8) {
826 s->in_gb.buffer =
NULL;
843 #define READ_FLIP_SIGN(dst,src) \
844 v = AV_RN32A(src) ^ (get_bits1(&s->gb) << 31); \
847 #define READ_FLIP_SIGN(dst,src) \
848 v = -get_bits1(&s->gb); \
849 *(dst) = (*(src) ^ v) - v;
853 int16_t *exponents,
int end_pos2)
857 int last_pos, bits_left;
859 int end_pos =
FFMIN(end_pos2,
s->gb.size_in_bits -
s->extrasize * 8);
863 for (
i = 0;
i < 3;
i++) {
864 int j, k, l, linbits;
865 j =
g->region_size[
i];
869 k =
g->table_select[
i];
875 memset(&
g->sb_hybrid[s_index], 0,
sizeof(*
g->sb_hybrid) * 2 * j);
894 g->sb_hybrid[s_index ] =
895 g->sb_hybrid[s_index+1] = 0;
900 exponent= exponents[s_index];
902 ff_dlog(
s->avctx,
"region=%d n=%d y=%d exp=%d\n",
903 i,
g->region_size[
i] - j, y, exponent);
914 g->sb_hybrid[s_index] = v;
923 g->sb_hybrid[s_index+1] = v;
936 g->sb_hybrid[s_index+!!y] = v;
938 g->sb_hybrid[s_index + !y] = 0;
947 while (s_index <= 572) {
950 if (pos >= end_pos) {
951 if (pos > end_pos2 && last_pos) {
956 av_log(
s->avctx,
AV_LOG_INFO,
"overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos);
968 ff_dlog(
s->avctx,
"t=%d code=%d\n",
g->count1table_select,
code);
969 g->sb_hybrid[s_index+0] =
970 g->sb_hybrid[s_index+1] =
971 g->sb_hybrid[s_index+2] =
972 g->sb_hybrid[s_index+3] = 0;
974 static const int idxtab[16] = { 3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0 };
976 int pos = s_index + idxtab[
code];
991 memset(&
g->sb_hybrid[s_index], 0,
sizeof(*
g->sb_hybrid) * (576 - s_index));
1009 if (
g->block_type != 2)
1012 if (
g->switch_point) {
1013 if (
s->sample_rate_index != 8)
1014 ptr =
g->sb_hybrid + 36;
1016 ptr =
g->sb_hybrid + 72;
1021 for (
i =
g->short_start;
i < 13;
i++) {
1025 for (j =
len; j > 0; j--) {
1026 *dst++ = ptr[0*
len];
1027 *dst++ = ptr[1*
len];
1028 *dst++ = ptr[2*
len];
1032 memcpy(ptr1,
tmp,
len * 3 *
sizeof(*ptr1));
1036 #define ISQRT2 FIXR(0.70710678118654752440)
1041 int sf_max, sf,
len, non_zero_found;
1044 int non_zero_found_short[3];
1059 non_zero_found_short[0] = 0;
1060 non_zero_found_short[1] = 0;
1061 non_zero_found_short[2] = 0;
1068 for (l = 2; l >= 0; l--) {
1071 if (!non_zero_found_short[l]) {
1073 for (j = 0; j <
len; j++) {
1075 non_zero_found_short[l] = 1;
1085 for (j = 0; j <
len; j++) {
1095 for (j = 0; j <
len; j++) {
1106 non_zero_found = non_zero_found_short[0] |
1107 non_zero_found_short[1] |
1108 non_zero_found_short[2];
1115 if (!non_zero_found) {
1116 for (j = 0; j <
len; j++) {
1123 k = (
i == 21) ? 20 :
i;
1129 for (j = 0; j <
len; j++) {
1139 for (j = 0; j <
len; j++) {
1157 for (
i = 0;
i < 576;
i++) {
1160 tab0[
i] = tmp0 + tmp1;
1161 tab1[
i] = tmp0 - tmp1;
1177 #ifndef compute_antialias
1179 #define AA(j) do { \
1180 float tmp0 = ptr[-1-j]; \
1181 float tmp1 = ptr[ j]; \
1182 ptr[-1-j] = tmp0 * csa_table[j][0] - tmp1 * csa_table[j][1]; \
1183 ptr[ j] = tmp0 * csa_table[j][1] + tmp1 * csa_table[j][0]; \
1186 #define AA(j) do { \
1187 SUINT tmp0 = ptr[-1-j]; \
1188 SUINT tmp1 = ptr[ j]; \
1189 SUINT tmp2 = MULH(tmp0 + tmp1, csa_table[j][0]); \
1190 ptr[-1-j] = 4 * (tmp2 - MULH(tmp1, csa_table[j][2])); \
1191 ptr[ j] = 4 * (tmp2 + MULH(tmp0, csa_table[j][3])); \
1201 if (
g->block_type == 2) {
1202 if (!
g->switch_point)
1210 ptr =
g->sb_hybrid + 18;
1211 for (
i =
n;
i > 0;
i--) {
1231 int i, j, mdct_long_end, sblimit;
1234 ptr =
g->sb_hybrid + 576;
1235 ptr1 =
g->sb_hybrid + 2 * 18;
1236 while (ptr >= ptr1) {
1240 if (p[0] | p[1] | p[2] | p[3] | p[4] | p[5])
1243 sblimit = ((ptr -
g->sb_hybrid) / 18) + 1;
1245 if (
g->block_type == 2) {
1247 if (
g->switch_point)
1252 mdct_long_end = sblimit;
1255 s->mpadsp.RENAME(imdct36_blocks)(sb_samples, mdct_buf,
g->sb_hybrid,
1256 mdct_long_end,
g->switch_point,
1259 buf = mdct_buf + 4*18*(mdct_long_end >> 2) + (mdct_long_end & 3);
1260 ptr =
g->sb_hybrid + 18 * mdct_long_end;
1262 for (j = mdct_long_end; j < sblimit; j++) {
1264 win =
RENAME(ff_mdct_win)[2 + (4 & -(j & 1))];
1265 out_ptr = sb_samples + j;
1267 for (
i = 0;
i < 6;
i++) {
1268 *out_ptr =
buf[4*
i];
1272 for (
i = 0;
i < 6;
i++) {
1278 for (
i = 0;
i < 6;
i++) {
1284 for (
i = 0;
i < 6;
i++) {
1287 buf[4*(
i + 6*2)] = 0;
1290 buf += (j&3) != 3 ? 1 : (4*18-3);
1293 for (j = sblimit; j <
SBLIMIT; j++) {
1295 out_ptr = sb_samples + j;
1296 for (
i = 0;
i < 18;
i++) {
1297 *out_ptr =
buf[4*
i];
1301 buf += (j&3) != 3 ? 1 : (4*18-3);
1308 int nb_granules, main_data_begin;
1309 int gr,
ch, blocksplit_flag,
i, j, k,
n, bits_pos;
1311 int16_t exponents[576];
1320 if (
s->nb_channels == 2)
1325 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
1326 s->granules[
ch][0].scfsi = 0;
1331 for (gr = 0; gr < nb_granules; gr++) {
1332 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
1333 ff_dlog(
s->avctx,
"gr=%d ch=%d: side_info\n", gr,
ch);
1334 g = &
s->granules[
ch][gr];
1337 if (
g->big_values > 288) {
1347 g->global_gain -= 2;
1353 if (blocksplit_flag) {
1355 if (
g->block_type == 0) {
1360 for (
i = 0;
i < 2;
i++)
1362 for (
i = 0;
i < 3;
i++)
1366 int region_address1, region_address2;
1368 g->switch_point = 0;
1369 for (
i = 0;
i < 3;
i++)
1374 ff_dlog(
s->avctx,
"region1=%d region2=%d\n",
1375 region_address1, region_address2);
1386 ff_dlog(
s->avctx,
"block_type=%d switch_point=%d\n",
1387 g->block_type,
g->switch_point);
1398 ff_dlog(
s->avctx,
"seekback:%d, lastbuf:%d\n",
1399 main_data_begin,
s->last_buf_size);
1401 memcpy(
s->last_buf +
s->last_buf_size, ptr,
s->extrasize);
1404 s->last_buf_size <<= 3;
1405 for (gr = 0; gr < nb_granules && (
s->last_buf_size >> 3) < main_data_begin; gr++) {
1406 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
1407 g = &
s->granules[
ch][gr];
1408 s->last_buf_size +=
g->part2_3_length;
1409 memset(
g->sb_hybrid, 0,
sizeof(
g->sb_hybrid));
1413 skip =
s->last_buf_size - 8 * main_data_begin;
1414 if (skip >=
s->gb.size_in_bits -
s->extrasize * 8 &&
s->in_gb.buffer) {
1417 s->in_gb.buffer =
NULL;
1427 for (; gr < nb_granules; gr++) {
1428 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
1429 g = &
s->granules[
ch][gr];
1434 int slen, slen1, slen2;
1439 ff_dlog(
s->avctx,
"slen1=%d slen2=%d\n", slen1, slen2);
1440 if (
g->block_type == 2) {
1441 n =
g->switch_point ? 17 : 18;
1444 for (
i = 0;
i <
n;
i++)
1445 g->scale_factors[j++] =
get_bits(&
s->gb, slen1);
1447 for (
i = 0;
i <
n;
i++)
1448 g->scale_factors[j++] = 0;
1451 for (
i = 0;
i < 18;
i++)
1452 g->scale_factors[j++] =
get_bits(&
s->gb, slen2);
1453 for (
i = 0;
i < 3;
i++)
1454 g->scale_factors[j++] = 0;
1456 for (
i = 0;
i < 21;
i++)
1457 g->scale_factors[j++] = 0;
1460 sc =
s->granules[
ch][0].scale_factors;
1462 for (k = 0; k < 4; k++) {
1464 if ((
g->scfsi & (0x8 >> k)) == 0) {
1465 slen = (k < 2) ? slen1 : slen2;
1467 for (
i = 0;
i <
n;
i++)
1468 g->scale_factors[j++] =
get_bits(&
s->gb, slen);
1470 for (
i = 0;
i <
n;
i++)
1471 g->scale_factors[j++] = 0;
1475 for (
i = 0;
i <
n;
i++) {
1476 g->scale_factors[j] = sc[j];
1481 g->scale_factors[j++] = 0;
1484 int tindex, tindex2, slen[4], sl, sf;
1487 if (
g->block_type == 2)
1488 tindex =
g->switch_point ? 2 : 1;
1492 sf =
g->scalefac_compress;
1499 }
else if (sf < 244) {
1511 }
else if (sf < 500) {
1522 for (k = 0; k < 4; k++) {
1526 for (
i = 0;
i <
n;
i++)
1527 g->scale_factors[j++] =
get_bits(&
s->gb, sl);
1529 for (
i = 0;
i <
n;
i++)
1530 g->scale_factors[j++] = 0;
1535 g->scale_factors[j] = 0;
1547 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
1548 g = &
s->granules[
ch][gr];
1557 return nb_granules * 18;
1563 int i, nb_frames,
ch,
ret;
1569 if (
s->error_protection)
1574 s->avctx->frame_size = 384;
1578 s->avctx->frame_size = 1152;
1582 s->avctx->frame_size =
s->lsf ? 576 : 1152;
1587 if (
s->in_gb.buffer) {
1596 s->in_gb.buffer =
NULL;
1608 av_assert1(i <= buf_size - HEADER_SIZE && i >= 0);
1609 memcpy(
s->last_buf +
s->last_buf_size,
s->gb.buffer + buf_size -
HEADER_SIZE -
i,
i);
1610 s->last_buf_size +=
i;
1619 s->frame->nb_samples =
s->avctx->frame_size;
1626 for (
ch = 0;
ch <
s->nb_channels;
ch++) {
1633 sample_stride =
s->nb_channels;
1635 for (
i = 0;
i < nb_frames;
i++) {
1636 RENAME(ff_mpa_synth_filter)(&
s->mpadsp,
s->synth_buf[
ch],
1637 &(
s->synth_buf_offset[
ch]),
1638 RENAME(ff_mpa_synth_window),
1639 &
s->dither_state, samples_ptr,
1640 sample_stride,
s->sb_samples[
ch][
i]);
1641 samples_ptr += 32 * sample_stride;
1645 return nb_frames * 32 *
sizeof(
OUT_INT) *
s->nb_channels;
1652 int buf_size = avpkt->
size;
1658 while(buf_size && !*
buf){
1670 return buf_size + skipped;
1676 }
else if (
ret == 1) {
1687 if (
s->frame_size <= 0) {
1690 }
else if (
s->frame_size < buf_size) {
1692 buf_size=
s->frame_size;
1715 return buf_size + skipped;
1720 memset(
ctx->synth_buf, 0,
sizeof(
ctx->synth_buf));
1721 memset(
ctx->mdct_buf, 0,
sizeof(
ctx->mdct_buf));
1722 ctx->last_buf_size = 0;
1723 ctx->dither_state = 0;
1731 #if CONFIG_MP3ADU_DECODER || CONFIG_MP3ADUFLOAT_DECODER
1733 int *got_frame_ptr,
AVPacket *avpkt)
1736 int buf_size = avpkt->
size;
1769 s->frame_size =
len;
1785 #if CONFIG_MP3ON4_DECODER || CONFIG_MP3ON4FLOAT_DECODER
1790 typedef struct MP3On4DecodeContext {
1795 } MP3On4DecodeContext;
1802 static const uint8_t mp3Frames[8] = { 0, 1, 1, 2, 3, 3, 4, 5 };
1805 static const uint8_t chan_offset[8][5] = {
1817 static const int16_t chan_layout[8] = {
1833 if (
s->mp3decctx[0])
1836 for (
i = 0;
i <
s->frames;
i++)
1866 s->syncword = 0xffe00000;
1868 s->syncword = 0xfff00000;
1877 if (!
s->mp3decctx[0])
1884 s->mp3decctx[0]->adu_mode = 1;
1889 for (
i = 1;
i <
s->frames;
i++) {
1891 if (!
s->mp3decctx[
i])
1893 s->mp3decctx[
i]->adu_mode = 1;
1894 s->mp3decctx[
i]->avctx = avctx;
1895 s->mp3decctx[
i]->mpadsp =
s->mp3decctx[0]->mpadsp;
1896 s->mp3decctx[
i]->fdsp =
s->mp3decctx[0]->fdsp;
1901 decode_close_mp3on4(avctx);
1911 for (
i = 0;
i <
s->frames;
i++)
1917 int *got_frame_ptr,
AVPacket *avpkt)
1921 int buf_size = avpkt->
size;
1943 for (fr = 0; fr <
s->frames; fr++) {
1946 m =
s->mp3decctx[fr];
1962 s->coff[fr] + m->nb_channels > avctx->
channels) {
1967 ch += m->nb_channels;
1969 outptr[0] = out_samples[
s->coff[fr]];
1970 if (m->nb_channels > 1)
1971 outptr[1] = out_samples[
s->coff[fr] + 1];
1976 if (m->nb_channels > 1)
int frame_size
Number of samples per channel in an audio frame.
uint8_t scale_factors[40]
MPA_DECODE_HEADER uint8_t last_buf[LAST_BUF_SIZE]
static void compute_band_indexes(MPADecodeContext *s, GranuleDef *g)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static int l3_unscale(int value, int exponent)
static void init_short_region(MPADecodeContext *s, GranuleDef *g)
int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf)
static const uint8_t mpa_quad_bits[2][16]
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static VLC huff_quad_vlc[2]
uint64_t channel_layout
Audio channel layout.
int sample_rate
samples per second
GranuleDef granules[2][2]
static const uint8_t lsf_nsf_table[6][3][4]
static int l1_unscale(int n, int mant, int scale_factor)
static INTFLOAT is_table[2][16]
#define AV_CH_LAYOUT_MONO
static void mp_flush(MPADecodeContext *ctx)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
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_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(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
static int get_bits_count(const GetBitContext *s)
av_cold void ff_mpadsp_init(MPADSPContext *s)
This structure describes decoded (raw) audio or video data.
int adu_mode
0 for standard mp3, 1 for adu formatted mp3
#define init_vlc(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
static const uint16_t table[]
static const uint8_t mpa_quad_codes[2][16]
static const int huff_vlc_tables_sizes[16]
static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples, const uint8_t *buf, int buf_size)
static void compute_antialias(MPADecodeContext *s, GranuleDef *g)
static int8_t table_4_3_exp[TABLE_4_3_SIZE]
static INTFLOAT is_table_lsf[2][2][16]
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
const int ff_mpa_quant_bits[17]
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
#define AV_EF_BUFFER
detect improper bitstream length
static int16_t *const division_tabs[4]
static VLC_TYPE huff_vlc_tables[0+128+128+128+130+128+154+166+142+204+190+170+542+460+662+414][2]
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static float win(SuperEqualizerContext *s, float n, int N)
static av_cold void mpegaudio_tableinit(void)
const uint8_t ff_mpeg4audio_channels[8]
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g, int16_t *exponents)
static void reorder_block(MPADecodeContext *s, GranuleDef *g)
static int mp_decode_layer3(MPADecodeContext *s)
if it could not because there are no more frames
int flags
AV_CODEC_FLAG_*.
#define AV_CH_LAYOUT_STEREO
static int bit_alloc(AC3EncodeContext *s, int snr_offset)
Run the bit allocation with a given SNR offset.
#define AV_EF_BITSTREAM
detect bitstream specification deviations
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const int ff_mpa_quant_steps[17]
static void compute_imdct(MPADecodeContext *s, GranuleDef *g, INTFLOAT *sb_samples, INTFLOAT *mdct_buf)
static void imdct12(INTFLOAT *out, SUINTFLOAT *in)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
#define MODE_EXT_MS_STEREO
static const uint8_t slen_table[2][16]
static int16_t division_tab3[1<< 6]
static const uint8_t band_size_long[9][22]
static const float ci_table[8]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static const uint8_t band_size_short[9][13]
static int64_t fsize(FILE *f)
static av_cold int decode_close(AVCodecContext *avctx)
const unsigned char *const ff_mpa_alloc_tables[5]
#define SPLIT(dst, sf, n)
static void compute_stereo(MPADecodeContext *s, GranuleDef *g0, GranuleDef *g1)
static const int huff_quad_vlc_tables_sizes[2]
static int huffman_decode(MPADecodeContext *s, GranuleDef *g, int16_t *exponents, int end_pos2)
Used to store optimal huffman encoding results.
int64_t bit_rate
the average bitrate
int sb_hybrid[SBLIMIT *18]
static unsigned int get_bits1(GetBitContext *s)
static int mp_decode_layer1(MPADecodeContext *s)
#define AV_CH_LAYOUT_5POINT1
#define INIT_VLC_USE_NEW_STATIC
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static av_always_inline void lsf_sf_expand(int *slen, int sf, int n1, int n2, int n3)
enum AVSampleFormat sample_fmt
audio sample format
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
#define READ_FLIP_SIGN(dst, src)
const char const char void * val
static const uint8_t header[24]
uint32_t free_format_next_header
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
enum AVSampleFormat request_sample_fmt
desired sample format
static av_cold void decode_init_static(void)
static int16_t division_tab9[1<< 11]
#define AV_LOG_INFO
Standard information.
static int32_t scale_factor_mult[15][3]
int channels
number of audio channels
static const uint8_t mpa_huff_data[32][2]
#define DECLARE_ALIGNED(n, t, v)
#define AV_CH_LAYOUT_5POINT0
static void switch_buffer(MPADecodeContext *s, int *pos, int *end_pos, int *end_pos2)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
const int ff_mpa_sblimit_table[5]
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define AV_CH_LAYOUT_7POINT1
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
MPA_INT synth_buf[MPA_MAX_CHANNELS][512 *2]
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static const uint8_t mpa_pretab[2][22]
static int alloc_table(VLC *vlc, int size, int use_static)
static double bound(const double threshold, const double val)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define AV_CH_LAYOUT_SURROUND
static const uint8_t * align_get_bits(GetBitContext *s)
#define FF_ARRAY_ELEMS(a)
main external API structure.
int synth_buf_offset[MPA_MAX_CHANNELS]
static VLC_TYPE huff_quad_vlc_tables[128+16][2]
static void region_offset2size(GranuleDef *g)
Convert region offsets to region sizes and truncate size to big_values.
static void init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int ra2)
#define MODE_EXT_I_STEREO
static INTFLOAT csa_table[8][4]
static void flush(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio samples
static int l2_unscale_group(int steps, int mant, int scale_factor)
static uint16_t scale_factor_modshift[64]
#define AV_EF_AGGRESSIVE
consider things that a sane encoder should not do as an error
static int shift(int a, int b)
int sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]
uint8_t count1table_select
static uint16_t band_index_long[9][23]
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define avpriv_request_sample(...)
This structure stores compressed data.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
static av_cold int decode_init(AVCodecContext *avctx)
#define AV_CH_LAYOUT_4POINT0
static const int32_t scale_factor_mult2[3][3]
static const HuffTable mpa_huff_tables[16]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT *18]
#define MPA_MAX_CODED_FRAME_SIZE
int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int bit_size, int sync_extension)
Parse MPEG-4 systems extradata from a raw buffer to retrieve audio configuration.
VLC_TYPE(* table)[2]
code, bits
static int16_t division_tab5[1<< 8]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
static uint32_t table_4_3_value[TABLE_4_3_SIZE]
static int mp_decode_layer2(MPADecodeContext *s)