lsf = sample_rate < (24000+32000)/2;
mpeg25 = sample_rate < (12000+16000)/2;
sample_rate_index= (header>>10)&3;
- sample_rate= mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
+ sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
for(bitrate_index=2; bitrate_index<30; bitrate_index++){
- frame_size = mpa_bitrate_tab[lsf][2][bitrate_index>>1];
+ frame_size = ff_mpa_bitrate_tab[lsf][2][bitrate_index>>1];
frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
if(frame_size == buf_size + 4)
break;
/* encoding freq */
s->lsf = 0;
for(i=0;i<3;i++) {
- if (mpa_freq_tab[i] == freq)
+ if (ff_mpa_freq_tab[i] == freq)
break;
- if ((mpa_freq_tab[i] / 2) == freq) {
+ if ((ff_mpa_freq_tab[i] / 2) == freq) {
s->lsf = 1;
break;
}
/* encoding bitrate & frequency */
for(i=0;i<15;i++) {
- if (mpa_bitrate_tab[s->lsf][1][i] == bitrate)
+ if (ff_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
break;
}
if (i == 15){
table = l2_select_table(bitrate, s->nb_channels, freq, s->lsf);
/* number of used subbands */
- s->sblimit = sblimit_table[table];
- s->alloc_table = alloc_tables[table];
+ s->sblimit = ff_mpa_sblimit_table[table];
+ s->alloc_table = ff_mpa_alloc_tables[table];
#ifdef DEBUG
av_log(avctx, AV_LOG_DEBUG, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
for(i=0;i<257;i++) {
int v;
- v = mpa_enwindow[i];
+ v = ff_mpa_enwindow[i];
#if WFRAC_BITS != 16
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
#endif
}
for(i=0;i<17;i++) {
- v = quant_bits[i];
+ v = ff_mpa_quant_bits[i];
if (v < 0)
v = -v;
else
int qindex, steps, m, sample, bits;
/* we encode 3 sub band samples of the same sub band at a time */
qindex = s->alloc_table[j+b];
- steps = quant_steps[qindex];
+ steps = ff_mpa_quant_steps[qindex];
for(m=0;m<3;m++) {
sample = s->sb_samples[ch][k][l + m][i];
/* divide by scale factor */
q[m] = steps - 1;
assert(q[m] >= 0 && q[m] < steps);
}
- bits = quant_bits[qindex];
+ bits = ff_mpa_quant_bits[qindex];
if (bits < 0) {
/* group the 3 values to save bits */
put_bits(p, -bits,
#include "mpegaudiodata.h"
-const uint16_t mpa_bitrate_tab[2][3][15] = {
+const uint16_t ff_mpa_bitrate_tab[2][3][15] = {
{ {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
}
};
-const uint16_t mpa_freq_tab[3] = { 44100, 48000, 32000 };
+const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 };
/*******************************************************/
/* half mpeg encoding window (full precision) */
-const int32_t mpa_enwindow[257] = {
+const int32_t ff_mpa_enwindow[257] = {
0, -1, -1, -1, -1, -1, -1, -2,
-2, -2, -2, -3, -3, -4, -4, -5,
-5, -6, -7, -7, -8, -9, -10, -11,
/*******************************************************/
/* layer 2 tables */
-const int sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
+const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
-const int quant_steps[17] = {
+const int ff_mpa_quant_steps[17] = {
3, 5, 7, 9, 15,
31, 63, 127, 255, 511,
1023, 2047, 4095, 8191, 16383,
};
/* we use a negative value if grouped */
-const int quant_bits[17] = {
+const int ff_mpa_quant_bits[17] = {
-5, -7, 3, -10, 4,
5, 6, 7, 8, 9,
10, 11, 12, 13, 14,
2, 0, 1, 3,
};
-const unsigned char *alloc_tables[5] =
+const unsigned char *ff_mpa_alloc_tables[5] =
{ alloc_table_0, alloc_table_1, alloc_table_2, alloc_table_3, alloc_table_4, };
#include "common.h"
-extern const uint16_t mpa_bitrate_tab[2][3][15];
-extern const uint16_t mpa_freq_tab[3];
-extern const int32_t mpa_enwindow[257];
-extern const int sblimit_table[5];
-extern const int quant_steps[17];
-extern const int quant_bits[17];
-extern const unsigned char *alloc_tables[5];
+extern const uint16_t ff_mpa_bitrate_tab[2][3][15];
+extern const uint16_t ff_mpa_freq_tab[3];
+extern const int32_t ff_mpa_enwindow[257];
+extern const int ff_mpa_sblimit_table[5];
+extern const int ff_mpa_quant_steps[17];
+extern const int ff_mpa_quant_bits[17];
+extern const unsigned char *ff_mpa_alloc_tables[5];
#endif /* MPEGAUDIODATA_H */
/* max = 18760, max sum over all 16 coefs : 44736 */
for(i=0;i<257;i++) {
int v;
- v = mpa_enwindow[i];
+ v = ff_mpa_enwindow[i];
#if WFRAC_BITS < 16
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
#endif
s->layer = 4 - ((header >> 17) & 3);
/* extract frequency */
sample_rate_index = (header >> 10) & 3;
- sample_rate = mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
+ sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
sample_rate_index += 3 * (s->lsf + mpeg25);
s->sample_rate_index = sample_rate_index;
s->error_protection = ((header >> 16) & 1) ^ 1;
s->nb_channels = 2;
if (bitrate_index != 0) {
- frame_size = mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
+ frame_size = ff_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
s->bit_rate = frame_size * 1000;
switch(s->layer) {
case 1:
/* select decoding table */
table = l2_select_table(s->bit_rate / 1000, s->nb_channels,
s->sample_rate, s->lsf);
- sblimit = sblimit_table[table];
- alloc_table = alloc_tables[table];
+ sblimit = ff_mpa_sblimit_table[table];
+ alloc_table = ff_mpa_alloc_tables[table];
if (s->mode == MPA_JSTEREO)
bound = (s->mode_ext + 1) * 4;
if (b) {
scale = scale_factors[ch][i][k];
qindex = alloc_table[j+b];
- bits = quant_bits[qindex];
+ bits = ff_mpa_quant_bits[qindex];
if (bits < 0) {
/* 3 values at the same time */
v = get_bits(&s->gb, -bits);
- steps = quant_steps[qindex];
+ steps = ff_mpa_quant_steps[qindex];
s->sb_samples[ch][k * 12 + l + 0][i] =
l2_unscale_group(steps, v % steps, scale);
v = v / steps;
scale0 = scale_factors[0][i][k];
scale1 = scale_factors[1][i][k];
qindex = alloc_table[j+b];
- bits = quant_bits[qindex];
+ bits = ff_mpa_quant_bits[qindex];
if (bits < 0) {
/* 3 values at the same time */
v = get_bits(&s->gb, -bits);
- steps = quant_steps[qindex];
+ steps = ff_mpa_quant_steps[qindex];
mant = v % steps;
v = v / steps;
s->sb_samples[0][k * 12 + l + 0][i] =