winemp3.acm: Make some variables static and/or const.

This commit is contained in:
Alexandre Julliard 2006-06-12 13:40:34 +02:00
parent b79a53e959
commit b5878798fd
8 changed files with 65 additions and 63 deletions

View file

@ -29,9 +29,9 @@
#include "mpg123.h"
struct parameter param = { 1 , 1 , 0 , 0 };
const struct parameter param = { 1 , 1 , 0 , 0 };
int tabsel_123[2][3][16] = {
static const int tabsel_123[2][3][16] = {
{ {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,} },
@ -41,7 +41,7 @@ int tabsel_123[2][3][16] = {
{0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} }
};
long freqs[9] = { 44100, 48000, 32000,
const long freqs[9] = { 44100, 48000, 32000,
22050, 24000, 16000 ,
11025 , 12000 , 8000 };

View file

@ -25,46 +25,46 @@
struct newhuff
{
unsigned int linbits;
short *table;
const short *table;
};
static short tab0[] =
static const short tab0[] =
{
0
};
static short tab1[] =
static const short tab1[] =
{
-5, -3, -1, 17, 1, 16, 0
};
static short tab2[] =
static const short tab2[] =
{
-15, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 17, -1, 1,
16, 0
};
static short tab3[] =
static const short tab3[] =
{
-13, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 16, 17, -1,
1, 0
};
static short tab5[] =
static const short tab5[] =
{
-29, -25, -23, -15, -7, -5, -3, -1, 51, 35, 50, 49, -3, -1, 19,
3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, 17, -1, 1, 16,
0
};
static short tab6[] =
static const short tab6[] =
{
-25, -19, -13, -9, -5, -3, -1, 51, 3, 35, -1, 50, 48, -1, 19,
49, -3, -1, 34, 2, 18, -3, -1, 33, 32, 1, -1, 17, -1, 16,
0
};
static short tab7[] =
static const short tab7[] =
{
-69, -65, -57, -39, -29, -17, -11, -7, -3, -1, 85, 69, -1, 84, 83,
-1, 53, 68, -3, -1, 37, 82, 21, -5, -1, 81, -1, 5, 52, -1,
@ -73,7 +73,7 @@ static short tab7[] =
-5, -1, 33, -1, 2, 32, 17, -1, 1, 16, 0
};
static short tab8[] =
static const short tab8[] =
{
-65, -63, -59, -45, -31, -19, -13, -7, -5, -3, -1, 85, 84, 69, 83,
-3, -1, 53, 68, 37, -3, -1, 82, 5, 21, -5, -1, 81, -1, 52,
@ -82,7 +82,7 @@ static short tab8[] =
2, 32, -1, 18, 33, 17, -3, -1, 1, 16, 0
};
static short tab9[] =
static const short tab9[] =
{
-63, -53, -41, -29, -19, -11, -5, -3, -1, 85, 69, 53, -1, 83, -1,
84, 5, -3, -1, 68, 37, -1, 82, 21, -3, -1, 81, 52, -1, 67,
@ -91,7 +91,7 @@ static short tab9[] =
18, -1, 33, 32, -3, -1, 17, 1, -1, 16, 0
};
static short tab10[] =
static const short tab10[] =
{
-125,-121,-111, -83, -55, -35, -21, -13, -7, -3, -1, 119, 103, -1, 118,
87, -3, -1, 117, 102, 71, -3, -1, 116, 86, -1, 101, 55, -9, -3,
@ -104,7 +104,7 @@ static short tab10[] =
2, 32, 17, -1, 1, 16, 0
};
static short tab11[] =
static const short tab11[] =
{
-121,-113, -89, -59, -43, -27, -17, -7, -3, -1, 119, 103, -1, 118, 117,
-3, -1, 102, 71, -1, 116, -1, 87, 85, -5, -3, -1, 86, 101, 55,
@ -117,7 +117,7 @@ static short tab11[] =
32, 17, -3, -1, 1, 16, 0
};
static short tab12[] =
static const short tab12[] =
{
-115, -99, -73, -45, -27, -17, -9, -5, -3, -1, 119, 103, 118, -1, 87,
117, -3, -1, 102, 71, -1, 116, 101, -3, -1, 86, 55, -3, -1, 115,
@ -130,7 +130,7 @@ static short tab12[] =
2, 32, 0, 17, -1, 1, 16
};
static short tab13[] =
static const short tab13[] =
{
-509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13, -9,
-7, -5, -3, -1, 254, 252, 253, 237, 255, -1, 239, 223, -3, -1, 238,
@ -169,7 +169,7 @@ static short tab13[] =
0
};
static short tab15[] =
static const short tab15[] =
{
-495,-445,-355,-263,-183,-115, -77, -43, -27, -13, -7, -3, -1, 255, 239,
-1, 254, 223, -1, 238, -1, 253, 207, -7, -3, -1, 252, 222, -1, 237,
@ -208,7 +208,7 @@ static short tab15[] =
0
};
static short tab16[] =
static const short tab16[] =
{
-509,-503,-461,-323,-103, -37, -27, -15, -7, -3, -1, 239, 254, -1, 223,
253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 175, -1, 250, 159, -3,
@ -247,7 +247,7 @@ static short tab16[] =
0
};
static short tab24[] =
static const short tab24[] =
{
-451,-117, -43, -25, -15, -7, -3, -1, 239, 254, -1, 223, 253, -3, -1,
207, 252, -1, 191, 251, -5, -1, 250, -1, 175, 159, -1, 249, 248, -9,
@ -286,14 +286,14 @@ static short tab24[] =
0
};
static short tab_c0[] =
static const short tab_c0[] =
{
-29, -21, -13, -7, -3, -1, 11, 15, -1, 13, 14, -3, -1, 7, 5,
9, -3, -1, 6, 3, -1, 10, 12, -3, -1, 2, 1, -1, 4, 8,
0
};
static short tab_c1[] =
static const short tab_c1[] =
{
-15, -7, -3, -1, 15, 14, -1, 13, 12, -3, -1, 11, 10, -1, 9,
8, -7, -3, -1, 7, 6, -1, 5, 4, -3, -1, 3, 2, -1, 1,
@ -302,7 +302,7 @@ static short tab_c1[] =
static struct newhuff ht[] =
static const struct newhuff ht[] =
{
{ /* 0 */ 0 , tab0 } ,
{ /* 2 */ 0 , tab1 } ,
@ -339,7 +339,7 @@ static struct newhuff ht[] =
{ /* 16 */ 13, tab24 }
};
static struct newhuff htc[] =
static const struct newhuff htc[] =
{
{ /* 1 , 1 , */ 0 , tab_c0 } ,
{ /* 1 , 1 , */ 0 , tab_c1 }

View file

@ -27,7 +27,7 @@ struct al_table
short d;
};
struct al_table alloc_0[] = {
static const struct al_table alloc_0[] = {
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
@ -67,7 +67,7 @@ struct al_table alloc_0[] = {
{2,0},{5,3},{7,5},{16,-32767},
{2,0},{5,3},{7,5},{16,-32767} };
struct al_table alloc_1[] = {
static const struct al_table alloc_1[] = {
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767},
{4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511},
@ -110,7 +110,7 @@ struct al_table alloc_1[] = {
{2,0},{5,3},{7,5},{16,-32767},
{2,0},{5,3},{7,5},{16,-32767} };
struct al_table alloc_2[] = {
static const struct al_table alloc_2[] = {
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
@ -122,7 +122,7 @@ struct al_table alloc_2[] = {
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
struct al_table alloc_3[] = {
static const struct al_table alloc_3[] = {
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},
{4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},
@ -138,7 +138,7 @@ struct al_table alloc_3[] = {
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},
{3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} };
struct al_table alloc_4[] = {
static const struct al_table alloc_4[] = {
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},
{9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},
{4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},

View file

@ -30,20 +30,20 @@ real muls[27][64]; /* also used by layer 1 */
void init_layer2(void)
{
static double mulmul[27] = {
static const double mulmul[27] = {
0.0 , -2.0/3.0 , 2.0/3.0 ,
2.0/7.0 , 2.0/15.0 , 2.0/31.0, 2.0/63.0 , 2.0/127.0 , 2.0/255.0 ,
2.0/511.0 , 2.0/1023.0 , 2.0/2047.0 , 2.0/4095.0 , 2.0/8191.0 ,
2.0/16383.0 , 2.0/32767.0 , 2.0/65535.0 ,
-4.0/5.0 , -2.0/5.0 , 2.0/5.0, 4.0/5.0 ,
-8.0/9.0 , -4.0/9.0 , -2.0/9.0 , 2.0/9.0 , 4.0/9.0 , 8.0/9.0 };
static int base[3][9] = {
static const int base[3][9] = {
{ 1 , 0, 2 , } ,
{ 17, 18, 0 , 19, 20 , } ,
{ 21, 1, 22, 23, 0, 24, 25, 2, 26 } };
int i,j,k,l,len;
real *table;
static int tablen[3] = { 3 , 5 , 9 };
static const int tablen[3] = { 3 , 5 , 9 };
static int *itable,*tables[3] = { grp_3tab , grp_5tab , grp_9tab };
for(i=0;i<3;i++)
@ -77,7 +77,7 @@ void II_step_one(unsigned int *bit_alloc,int *scale,struct frame *fr)
int sblimit = fr->II_sblimit;
int jsbound = fr->jsbound;
int sblimit2 = fr->II_sblimit<<stereo;
struct al_table *alloc1 = fr->alloc;
const struct al_table *alloc1 = fr->alloc;
int i;
static unsigned int scfsi_buf[64];
unsigned int *scfsi,*bita;
@ -150,7 +150,7 @@ void II_step_two(unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale
int stereo = fr->stereo;
int sblimit = fr->II_sblimit;
int jsbound = fr->jsbound;
struct al_table *alloc2,*alloc1 = fr->alloc;
const struct al_table *alloc2,*alloc1 = fr->alloc;
unsigned int *bita=bit_alloc;
int d1,step;
@ -238,7 +238,7 @@ void II_step_two(unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale
static void II_select_table(struct frame *fr)
{
static int translate[3][2][16] =
static const int translate[3][2][16] =
{ { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,
{ 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } ,
{ { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,
@ -247,9 +247,9 @@ static void II_select_table(struct frame *fr)
{ 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } };
int table,sblim;
static struct al_table *tables[5] =
static const struct al_table *tables[5] =
{ alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 };
static int sblims[5] = { 27 , 30 , 8, 12 , 30 };
static const int sblims[5] = { 27 , 30 , 8, 12 , 30 };
if(fr->lsf)
table = 4;

View file

@ -51,7 +51,7 @@ struct bandInfoStruct {
int longLimit[9][23];
int shortLimit[9][14];
struct bandInfoStruct bandInfo[9] = {
static const struct bandInfoStruct bandInfo[9] = {
/* MPEG 1.0 */
{ {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576},
@ -126,7 +126,7 @@ void init_layer3(int down_sample_sblimit)
for (i=0;i<8;i++)
{
static double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037};
static const double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037};
double sq=sqrt(1.0+Ci[i]*Ci[i]);
aa_cs[i] = 1.0/sq;
aa_ca[i] = Ci[i]/sq;
@ -165,7 +165,7 @@ void init_layer3(int down_sample_sblimit)
}
for(j=0;j<4;j++) {
static int len[4] = { 36,36,12,36 };
static const int len[4] = { 36,36,12,36 };
for(i=0;i<len[j];i+=2)
win1[j][i] = + win[j][i];
for(i=1;i<len[j];i+=2)
@ -198,10 +198,10 @@ void init_layer3(int down_sample_sblimit)
for(j=0;j<9;j++)
{
struct bandInfoStruct *bi = &bandInfo[j];
const struct bandInfoStruct *bi = &bandInfo[j];
int *mp;
int cb,lwin;
short *bdf;
const short *bdf;
mp = map[j][0] = mapbuf0[j];
bdf = bi->longDiff;
@ -555,13 +555,13 @@ static int III_get_scale_factors_1(int *scf,struct gr_info_s *gr_info)
static int III_get_scale_factors_2(int *scf,struct gr_info_s *gr_info,int i_stereo)
{
unsigned char *pnt;
const unsigned char *pnt;
int i,j;
unsigned int slen;
int n = 0;
int numbits = 0;
static unsigned char stab[3][6][4] = {
static const unsigned char stab[3][6][4] = {
{ { 6, 5, 5,5 } , { 6, 5, 7,3 } , { 11,10,0,0} ,
{ 7, 7, 7,0 } , { 6, 6, 6,3 } , { 8, 8,5,0} } ,
{ { 9, 9, 9,9 } , { 9, 9,12,6 } , { 18,18,0,0} ,
@ -606,8 +606,8 @@ static int III_get_scale_factors_2(int *scf,struct gr_info_s *gr_info,int i_ster
return numbits;
}
static int pretab1[22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0};
static int pretab2[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static const int pretab1[22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0};
static const int pretab2[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
/*
* don't forget to apply the same changes to III_dequantize_sample_ms() !!!
@ -670,7 +670,7 @@ static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
mc = 0;
for(i=0;i<2;i++) {
int lp = l[i];
struct newhuff *h = ht+gr_info->table_select[i];
const struct newhuff *h = ht+gr_info->table_select[i];
for(;lp;lp--,mc--) {
register int x,y;
if( (!mc) ) {
@ -688,7 +688,7 @@ static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
}
}
{
register short *val = h->table;
register const short *val = h->table;
while((y=*val++)<0) {
if (get1bit())
val -= y;
@ -740,8 +740,9 @@ static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
}
}
for(;l3 && (part2remain > 0);l3--) {
struct newhuff *h = htc+gr_info->count1table_select;
register short *val = h->table,a;
const struct newhuff *h = htc+gr_info->count1table_select;
const short *val = h->table;
short a;
while((a=*val++)<0) {
part2remain--;
@ -828,7 +829,7 @@ static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
/*
* decoding with 'long' BandIndex table (block_type != 2)
*/
int *pretab = gr_info->preflag ? pretab1 : pretab2;
const int *pretab = gr_info->preflag ? pretab1 : pretab2;
int i,max = -1;
int cb = 0;
register int *m = map[sfreq][2];
@ -843,7 +844,7 @@ static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
*/
for(i=0;i<3;i++) {
int lp = l[i];
struct newhuff *h = ht+gr_info->table_select[i];
const struct newhuff *h = ht+gr_info->table_select[i];
for(;lp;lp--,mc--) {
int x,y;
@ -854,7 +855,7 @@ static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
cb = *m++;
}
{
register short *val = h->table;
register const short *val = h->table;
while((y=*val++)<0) {
if (get1bit())
val -= y;
@ -909,8 +910,9 @@ static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
* short (count1table) values
*/
for(;l3 && (part2remain > 0);l3--) {
struct newhuff *h = htc+gr_info->count1table_select;
register short *val = h->table,a;
const struct newhuff *h = htc+gr_info->count1table_select;
const short *val = h->table;
short a;
while((a=*val++)<0) {
part2remain--;
@ -1393,7 +1395,7 @@ static void III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT],int *scalefac,
struct gr_info_s *gr_info,int sfreq,int ms_stereo,int lsf)
{
real (*xr)[SBLIMIT*SSLIMIT] = (real (*)[SBLIMIT*SSLIMIT] ) xr_buf;
struct bandInfoStruct *bi = &bandInfo[sfreq];
const struct bandInfoStruct *bi = &bandInfo[sfreq];
real *tab1,*tab2;
if(lsf) {

View file

@ -71,7 +71,7 @@ typedef struct
int rate;
} Format;
static Format PCM_Formats[] =
static const Format PCM_Formats[] =
{
{1, 8, 8000}, {2, 8, 8000}, {1, 16, 8000}, {2, 16, 8000},
{1, 8, 11025}, {2, 8, 11025}, {1, 16, 11025}, {2, 16, 11025},
@ -79,7 +79,7 @@ static Format PCM_Formats[] =
{1, 8, 44100}, {2, 8, 44100}, {1, 16, 44100}, {2, 16, 44100},
};
static Format MPEG3_Formats[] =
static const Format MPEG3_Formats[] =
{
{1, 0, 8000}, {2, 0, 8000}, {1, 0, 11025}, {2, 0, 11025},
{1, 0, 22050}, {2, 0, 22050}, {1, 0, 44100}, {2, 0, 44100},
@ -94,7 +94,7 @@ static Format MPEG3_Formats[] =
static DWORD MPEG3_GetFormatIndex(LPWAVEFORMATEX wfx)
{
int i, hi;
Format* fmts;
const Format *fmts;
switch (wfx->wFormatTag)
{

View file

@ -104,7 +104,7 @@ struct frame {
/* layer2 stuff */
int II_sblimit;
void *alloc;
const struct al_table *alloc;
};
struct parameter {
@ -201,9 +201,9 @@ extern void dct64(real *,real *,real *);
extern void synth_ntom_set_step(long,long);
extern unsigned char *conv16to8;
extern long freqs[9];
extern const long freqs[9];
extern real muls[27][64];
extern real decwin[512+32];
extern real *pnts[5];
extern struct parameter param;
extern const struct parameter param;

View file

@ -29,7 +29,7 @@ static unsigned char *conv16to8_buf = NULL;
unsigned char *conv16to8;
#endif
static long intwinbase[] = {
static const long intwinbase[] = {
0, -1, -1, -1, -1, -1, -1, -2, -2, -2,
-2, -3, -3, -4, -4, -5, -5, -6, -7, -7,
-8, -9, -10, -11, -13, -14, -16, -17, -19, -21,