mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
add proper prefix to extern mpeg audio data tables
Originally committed as revision 9061 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
4991c0516d
commit
677fe2e226
@ -211,10 +211,10 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
|
|||||||
lsf = sample_rate < (24000+32000)/2;
|
lsf = sample_rate < (24000+32000)/2;
|
||||||
mpeg25 = sample_rate < (12000+16000)/2;
|
mpeg25 = sample_rate < (12000+16000)/2;
|
||||||
sample_rate_index= (header>>10)&3;
|
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++){
|
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);
|
frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
|
||||||
if(frame_size == buf_size + 4)
|
if(frame_size == buf_size + 4)
|
||||||
break;
|
break;
|
||||||
|
@ -84,9 +84,9 @@ static int MPA_encode_init(AVCodecContext *avctx)
|
|||||||
/* encoding freq */
|
/* encoding freq */
|
||||||
s->lsf = 0;
|
s->lsf = 0;
|
||||||
for(i=0;i<3;i++) {
|
for(i=0;i<3;i++) {
|
||||||
if (mpa_freq_tab[i] == freq)
|
if (ff_mpa_freq_tab[i] == freq)
|
||||||
break;
|
break;
|
||||||
if ((mpa_freq_tab[i] / 2) == freq) {
|
if ((ff_mpa_freq_tab[i] / 2) == freq) {
|
||||||
s->lsf = 1;
|
s->lsf = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ static int MPA_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
/* encoding bitrate & frequency */
|
/* encoding bitrate & frequency */
|
||||||
for(i=0;i<15;i++) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
if (i == 15){
|
if (i == 15){
|
||||||
@ -121,8 +121,8 @@ static int MPA_encode_init(AVCodecContext *avctx)
|
|||||||
table = l2_select_table(bitrate, s->nb_channels, freq, s->lsf);
|
table = l2_select_table(bitrate, s->nb_channels, freq, s->lsf);
|
||||||
|
|
||||||
/* number of used subbands */
|
/* number of used subbands */
|
||||||
s->sblimit = sblimit_table[table];
|
s->sblimit = ff_mpa_sblimit_table[table];
|
||||||
s->alloc_table = alloc_tables[table];
|
s->alloc_table = ff_mpa_alloc_tables[table];
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
av_log(avctx, AV_LOG_DEBUG, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
|
av_log(avctx, AV_LOG_DEBUG, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
|
||||||
@ -134,7 +134,7 @@ static int MPA_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
for(i=0;i<257;i++) {
|
for(i=0;i<257;i++) {
|
||||||
int v;
|
int v;
|
||||||
v = mpa_enwindow[i];
|
v = ff_mpa_enwindow[i];
|
||||||
#if WFRAC_BITS != 16
|
#if WFRAC_BITS != 16
|
||||||
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
|
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
|
||||||
#endif
|
#endif
|
||||||
@ -174,7 +174,7 @@ static int MPA_encode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<17;i++) {
|
for(i=0;i<17;i++) {
|
||||||
v = quant_bits[i];
|
v = ff_mpa_quant_bits[i];
|
||||||
if (v < 0)
|
if (v < 0)
|
||||||
v = -v;
|
v = -v;
|
||||||
else
|
else
|
||||||
@ -688,7 +688,7 @@ static void encode_frame(MpegAudioContext *s,
|
|||||||
int qindex, steps, m, sample, bits;
|
int qindex, steps, m, sample, bits;
|
||||||
/* we encode 3 sub band samples of the same sub band at a time */
|
/* we encode 3 sub band samples of the same sub band at a time */
|
||||||
qindex = s->alloc_table[j+b];
|
qindex = s->alloc_table[j+b];
|
||||||
steps = quant_steps[qindex];
|
steps = ff_mpa_quant_steps[qindex];
|
||||||
for(m=0;m<3;m++) {
|
for(m=0;m<3;m++) {
|
||||||
sample = s->sb_samples[ch][k][l + m][i];
|
sample = s->sb_samples[ch][k][l + m][i];
|
||||||
/* divide by scale factor */
|
/* divide by scale factor */
|
||||||
@ -718,7 +718,7 @@ static void encode_frame(MpegAudioContext *s,
|
|||||||
q[m] = steps - 1;
|
q[m] = steps - 1;
|
||||||
assert(q[m] >= 0 && q[m] < steps);
|
assert(q[m] >= 0 && q[m] < steps);
|
||||||
}
|
}
|
||||||
bits = quant_bits[qindex];
|
bits = ff_mpa_quant_bits[qindex];
|
||||||
if (bits < 0) {
|
if (bits < 0) {
|
||||||
/* group the 3 values to save bits */
|
/* group the 3 values to save bits */
|
||||||
put_bits(p, -bits,
|
put_bits(p, -bits,
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "mpegaudiodata.h"
|
#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, 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, 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 } },
|
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
|
||||||
@ -37,11 +37,11 @@ const uint16_t mpa_bitrate_tab[2][3][15] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
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) */
|
/* 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,
|
0, -1, -1, -1, -1, -1, -1, -2,
|
||||||
-2, -2, -2, -3, -3, -4, -4, -5,
|
-2, -2, -2, -3, -3, -4, -4, -5,
|
||||||
-5, -6, -7, -7, -8, -9, -10, -11,
|
-5, -6, -7, -7, -8, -9, -10, -11,
|
||||||
@ -80,9 +80,9 @@ const int32_t mpa_enwindow[257] = {
|
|||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
/* layer 2 tables */
|
/* 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,
|
3, 5, 7, 9, 15,
|
||||||
31, 63, 127, 255, 511,
|
31, 63, 127, 255, 511,
|
||||||
1023, 2047, 4095, 8191, 16383,
|
1023, 2047, 4095, 8191, 16383,
|
||||||
@ -90,7 +90,7 @@ const int quant_steps[17] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* we use a negative value if grouped */
|
/* 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, -7, 3, -10, 4,
|
||||||
5, 6, 7, 8, 9,
|
5, 6, 7, 8, 9,
|
||||||
10, 11, 12, 13, 14,
|
10, 11, 12, 13, 14,
|
||||||
@ -221,5 +221,5 @@ static const unsigned char alloc_table_4[] = {
|
|||||||
2, 0, 1, 3,
|
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, };
|
{ alloc_table_0, alloc_table_1, alloc_table_2, alloc_table_3, alloc_table_4, };
|
||||||
|
@ -29,12 +29,12 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
extern const uint16_t mpa_bitrate_tab[2][3][15];
|
extern const uint16_t ff_mpa_bitrate_tab[2][3][15];
|
||||||
extern const uint16_t mpa_freq_tab[3];
|
extern const uint16_t ff_mpa_freq_tab[3];
|
||||||
extern const int32_t mpa_enwindow[257];
|
extern const int32_t ff_mpa_enwindow[257];
|
||||||
extern const int sblimit_table[5];
|
extern const int ff_mpa_sblimit_table[5];
|
||||||
extern const int quant_steps[17];
|
extern const int ff_mpa_quant_steps[17];
|
||||||
extern const int quant_bits[17];
|
extern const int ff_mpa_quant_bits[17];
|
||||||
extern const unsigned char *alloc_tables[5];
|
extern const unsigned char *ff_mpa_alloc_tables[5];
|
||||||
|
|
||||||
#endif /* MPEGAUDIODATA_H */
|
#endif /* MPEGAUDIODATA_H */
|
||||||
|
@ -825,7 +825,7 @@ void ff_mpa_synth_init(MPA_INT *window)
|
|||||||
/* max = 18760, max sum over all 16 coefs : 44736 */
|
/* max = 18760, max sum over all 16 coefs : 44736 */
|
||||||
for(i=0;i<257;i++) {
|
for(i=0;i<257;i++) {
|
||||||
int v;
|
int v;
|
||||||
v = mpa_enwindow[i];
|
v = ff_mpa_enwindow[i];
|
||||||
#if WFRAC_BITS < 16
|
#if WFRAC_BITS < 16
|
||||||
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
|
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
|
||||||
#endif
|
#endif
|
||||||
@ -1125,7 +1125,7 @@ static int decode_header(MPADecodeContext *s, uint32_t header)
|
|||||||
s->layer = 4 - ((header >> 17) & 3);
|
s->layer = 4 - ((header >> 17) & 3);
|
||||||
/* extract frequency */
|
/* extract frequency */
|
||||||
sample_rate_index = (header >> 10) & 3;
|
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);
|
sample_rate_index += 3 * (s->lsf + mpeg25);
|
||||||
s->sample_rate_index = sample_rate_index;
|
s->sample_rate_index = sample_rate_index;
|
||||||
s->error_protection = ((header >> 16) & 1) ^ 1;
|
s->error_protection = ((header >> 16) & 1) ^ 1;
|
||||||
@ -1146,7 +1146,7 @@ static int decode_header(MPADecodeContext *s, uint32_t header)
|
|||||||
s->nb_channels = 2;
|
s->nb_channels = 2;
|
||||||
|
|
||||||
if (bitrate_index != 0) {
|
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;
|
s->bit_rate = frame_size * 1000;
|
||||||
switch(s->layer) {
|
switch(s->layer) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -1327,8 +1327,8 @@ static int mp_decode_layer2(MPADecodeContext *s)
|
|||||||
/* select decoding table */
|
/* select decoding table */
|
||||||
table = l2_select_table(s->bit_rate / 1000, s->nb_channels,
|
table = l2_select_table(s->bit_rate / 1000, s->nb_channels,
|
||||||
s->sample_rate, s->lsf);
|
s->sample_rate, s->lsf);
|
||||||
sblimit = sblimit_table[table];
|
sblimit = ff_mpa_sblimit_table[table];
|
||||||
alloc_table = alloc_tables[table];
|
alloc_table = ff_mpa_alloc_tables[table];
|
||||||
|
|
||||||
if (s->mode == MPA_JSTEREO)
|
if (s->mode == MPA_JSTEREO)
|
||||||
bound = (s->mode_ext + 1) * 4;
|
bound = (s->mode_ext + 1) * 4;
|
||||||
@ -1432,11 +1432,11 @@ static int mp_decode_layer2(MPADecodeContext *s)
|
|||||||
if (b) {
|
if (b) {
|
||||||
scale = scale_factors[ch][i][k];
|
scale = scale_factors[ch][i][k];
|
||||||
qindex = alloc_table[j+b];
|
qindex = alloc_table[j+b];
|
||||||
bits = quant_bits[qindex];
|
bits = ff_mpa_quant_bits[qindex];
|
||||||
if (bits < 0) {
|
if (bits < 0) {
|
||||||
/* 3 values at the same time */
|
/* 3 values at the same time */
|
||||||
v = get_bits(&s->gb, -bits);
|
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] =
|
s->sb_samples[ch][k * 12 + l + 0][i] =
|
||||||
l2_unscale_group(steps, v % steps, scale);
|
l2_unscale_group(steps, v % steps, scale);
|
||||||
v = v / steps;
|
v = v / steps;
|
||||||
@ -1470,11 +1470,11 @@ static int mp_decode_layer2(MPADecodeContext *s)
|
|||||||
scale0 = scale_factors[0][i][k];
|
scale0 = scale_factors[0][i][k];
|
||||||
scale1 = scale_factors[1][i][k];
|
scale1 = scale_factors[1][i][k];
|
||||||
qindex = alloc_table[j+b];
|
qindex = alloc_table[j+b];
|
||||||
bits = quant_bits[qindex];
|
bits = ff_mpa_quant_bits[qindex];
|
||||||
if (bits < 0) {
|
if (bits < 0) {
|
||||||
/* 3 values at the same time */
|
/* 3 values at the same time */
|
||||||
v = get_bits(&s->gb, -bits);
|
v = get_bits(&s->gb, -bits);
|
||||||
steps = quant_steps[qindex];
|
steps = ff_mpa_quant_steps[qindex];
|
||||||
mant = v % steps;
|
mant = v % steps;
|
||||||
v = v / steps;
|
v = v / steps;
|
||||||
s->sb_samples[0][k * 12 + l + 0][i] =
|
s->sb_samples[0][k * 12 + l + 0][i] =
|
||||||
|
Loading…
Reference in New Issue
Block a user