mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 17:13:37 +00:00
winemp3: Remove global mpstr pointer.
This commit is contained in:
parent
cfe289e69d
commit
fa969d169b
|
@ -31,22 +31,20 @@
|
|||
#include "mpg123.h"
|
||||
#include "mpglib.h"
|
||||
|
||||
extern struct mpstr *gmp;
|
||||
|
||||
/* old WRITE_SAMPLE */
|
||||
#define WRITE_SAMPLE(samples,sum,clip) \
|
||||
if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \
|
||||
else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \
|
||||
else { *(samples) = sum; }
|
||||
|
||||
int synth_1to1_mono(real *bandPtr,unsigned char *samples,int *pnt)
|
||||
int synth_1to1_mono(struct mpstr *mp,real *bandPtr,unsigned char *samples,int *pnt)
|
||||
{
|
||||
short samples_tmp[64];
|
||||
short *tmp1 = samples_tmp;
|
||||
int i,ret;
|
||||
int pnt1 = 0;
|
||||
|
||||
ret = synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1);
|
||||
ret = synth_1to1(mp,bandPtr,0,(unsigned char *) samples_tmp,&pnt1);
|
||||
samples += *pnt;
|
||||
|
||||
for(i=0;i<32;i++) {
|
||||
|
@ -60,7 +58,7 @@ int synth_1to1_mono(real *bandPtr,unsigned char *samples,int *pnt)
|
|||
}
|
||||
|
||||
|
||||
int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
|
||||
int synth_1to1(struct mpstr *mp,real *bandPtr,int channel,unsigned char *out,int *pnt)
|
||||
{
|
||||
static const int step = 2;
|
||||
int bo;
|
||||
|
@ -70,16 +68,16 @@ int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
|
|||
int clip = 0;
|
||||
int bo1;
|
||||
|
||||
bo = gmp->synth_bo;
|
||||
bo = mp->synth_bo;
|
||||
|
||||
if(!channel) {
|
||||
bo--;
|
||||
bo &= 0xf;
|
||||
buf = gmp->synth_buffs[0];
|
||||
buf = mp->synth_buffs[0];
|
||||
}
|
||||
else {
|
||||
samples++;
|
||||
buf = gmp->synth_buffs[1];
|
||||
buf = mp->synth_buffs[1];
|
||||
}
|
||||
|
||||
if(bo & 0x1) {
|
||||
|
@ -93,7 +91,7 @@ int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt)
|
|||
dct64(buf[0]+bo,buf[1]+bo+1,bandPtr);
|
||||
}
|
||||
|
||||
gmp->synth_bo = bo;
|
||||
mp->synth_bo = bo;
|
||||
|
||||
{
|
||||
register int j;
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
#include "mpg123.h"
|
||||
#include "mpglib.h"
|
||||
|
||||
/* Global mp .. it's a hack */
|
||||
struct mpstr *gmp;
|
||||
|
||||
|
||||
BOOL InitMP3(struct mpstr *mp)
|
||||
{
|
||||
|
@ -39,6 +36,7 @@ BOOL InitMP3(struct mpstr *mp)
|
|||
mp->fr.single = -1;
|
||||
mp->bsnum = 0;
|
||||
mp->synth_bo = 1;
|
||||
mp->fr.mp = mp;
|
||||
|
||||
if(!init) {
|
||||
init = 1;
|
||||
|
@ -152,8 +150,6 @@ int decodeMP3(struct mpstr *mp,const unsigned char *in,int isize,unsigned char *
|
|||
{
|
||||
int len;
|
||||
|
||||
gmp = mp;
|
||||
|
||||
if(osize < 4608) {
|
||||
fprintf(stderr,"To less out space\n");
|
||||
return MP3_ERR;
|
||||
|
@ -224,17 +220,17 @@ int decodeMP3(struct mpstr *mp,const unsigned char *in,int isize,unsigned char *
|
|||
return MP3_OK;
|
||||
}
|
||||
|
||||
int set_pointer(long backstep)
|
||||
int set_pointer(struct mpstr *mp, long backstep)
|
||||
{
|
||||
unsigned char *bsbufold;
|
||||
if(gmp->fsizeold < 0 && backstep > 0) {
|
||||
if(mp->fsizeold < 0 && backstep > 0) {
|
||||
fprintf(stderr,"Can't step back %ld!\n",backstep);
|
||||
return MP3_ERR;
|
||||
}
|
||||
bsbufold = gmp->bsspace[gmp->bsnum] + 512;
|
||||
bsbufold = mp->bsspace[mp->bsnum] + 512;
|
||||
wordpointer -= backstep;
|
||||
if (backstep)
|
||||
memcpy(wordpointer,bsbufold+gmp->fsizeold-backstep,backstep);
|
||||
memcpy(wordpointer,bsbufold+mp->fsizeold-backstep,backstep);
|
||||
bitindex = 0;
|
||||
return MP3_OK;
|
||||
}
|
||||
|
|
|
@ -146,12 +146,12 @@ int do_layer1(struct frame *fr,unsigned char *pcm_sample,int *pcm_point)
|
|||
I_step_two(fraction,balloc,scale_index,fr);
|
||||
|
||||
if(single >= 0) {
|
||||
clip += synth_1to1_mono( (real*)fraction[single],pcm_sample,pcm_point);
|
||||
clip += synth_1to1_mono(fr->mp,(real*)fraction[single],pcm_sample,pcm_point);
|
||||
}
|
||||
else {
|
||||
int p1 = *pcm_point;
|
||||
clip += synth_1to1( (real*)fraction[0],0,pcm_sample,&p1);
|
||||
clip += synth_1to1( (real*)fraction[1],1,pcm_sample,pcm_point);
|
||||
clip += synth_1to1(fr->mp,(real*)fraction[0],0,pcm_sample,&p1);
|
||||
clip += synth_1to1(fr->mp,(real*)fraction[1],1,pcm_sample,pcm_point);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,12 +286,12 @@ int do_layer2(struct frame *fr,unsigned char *pcm_sample,int *pcm_point)
|
|||
II_step_two(bit_alloc,fraction,scale,fr,i>>2);
|
||||
for (j=0;j<3;j++) {
|
||||
if(single >= 0) {
|
||||
clip += synth_1to1_mono(fraction[0][j],pcm_sample,pcm_point);
|
||||
clip += synth_1to1_mono(fr->mp,fraction[0][j],pcm_sample,pcm_point);
|
||||
}
|
||||
else {
|
||||
int p1 = *pcm_point;
|
||||
clip += synth_1to1(fraction[0][j],0,pcm_sample,&p1);
|
||||
clip += synth_1to1(fraction[1][j],1,pcm_sample,pcm_point);
|
||||
clip += synth_1to1(fr->mp,fraction[0][j],0,pcm_sample,&p1);
|
||||
clip += synth_1to1(fr->mp,fraction[1][j],1,pcm_sample,pcm_point);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include "mpglib.h"
|
||||
#include "huffman.h"
|
||||
|
||||
extern struct mpstr *gmp;
|
||||
|
||||
#define MPEG1
|
||||
|
||||
|
||||
|
@ -1830,11 +1828,11 @@ static void dct12(real *in,real *rawout1,real *rawout2,register real *wi,registe
|
|||
* III_hybrid
|
||||
*/
|
||||
static void III_hybrid(real fsIn[SBLIMIT][SSLIMIT],real tsOut[SSLIMIT][SBLIMIT],
|
||||
int ch,struct gr_info_s *gr_info)
|
||||
int ch,struct gr_info_s *gr_info,struct mpstr *mp)
|
||||
{
|
||||
real *tspnt = (real *) tsOut;
|
||||
real (*block)[2][SBLIMIT*SSLIMIT] = gmp->hybrid_block;
|
||||
int *blc = gmp->hybrid_blc;
|
||||
real (*block)[2][SBLIMIT*SSLIMIT] = mp->hybrid_block;
|
||||
int *blc = mp->hybrid_blc;
|
||||
real *rawout1,*rawout2;
|
||||
int bt;
|
||||
int sb = 0;
|
||||
|
@ -1923,7 +1921,7 @@ int do_layer3(struct frame *fr,unsigned char *pcm_sample,int *pcm_point)
|
|||
#endif
|
||||
}
|
||||
|
||||
if(set_pointer(sideinfo.main_data_begin) == MP3_ERR)
|
||||
if(set_pointer(fr->mp,sideinfo.main_data_begin) == MP3_ERR)
|
||||
return -1;
|
||||
|
||||
for (gr=0;gr<granules;gr++)
|
||||
|
@ -2006,17 +2004,17 @@ int do_layer3(struct frame *fr,unsigned char *pcm_sample,int *pcm_point)
|
|||
for(ch=0;ch<stereo1;ch++) {
|
||||
struct gr_info_s *gr_info = &(sideinfo.ch[ch].gr[gr]);
|
||||
III_antialias(hybridIn[ch],gr_info);
|
||||
III_hybrid(hybridIn[ch], hybridOut[ch], ch,gr_info);
|
||||
III_hybrid(hybridIn[ch], hybridOut[ch], ch,gr_info, fr->mp);
|
||||
}
|
||||
|
||||
for(ss=0;ss<SSLIMIT;ss++) {
|
||||
if(single >= 0) {
|
||||
clip += synth_1to1_mono(hybridOut[0][ss],pcm_sample,pcm_point);
|
||||
clip += synth_1to1_mono(fr->mp,hybridOut[0][ss],pcm_sample,pcm_point);
|
||||
}
|
||||
else {
|
||||
int p1 = *pcm_point;
|
||||
clip += synth_1to1(hybridOut[0][ss],0,pcm_sample,&p1);
|
||||
clip += synth_1to1(hybridOut[1][ss],1,pcm_sample,pcm_point);
|
||||
clip += synth_1to1(fr->mp,hybridOut[0][ss],0,pcm_sample,&p1);
|
||||
clip += synth_1to1(fr->mp,hybridOut[1][ss],1,pcm_sample,pcm_point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,8 @@ struct frame {
|
|||
/* layer2 stuff */
|
||||
int II_sblimit;
|
||||
const struct al_table *alloc;
|
||||
|
||||
struct mpstr *mp;
|
||||
};
|
||||
|
||||
struct parameter {
|
||||
|
@ -117,7 +119,7 @@ struct parameter {
|
|||
extern unsigned int get1bit(void);
|
||||
extern unsigned int getbits(int);
|
||||
extern unsigned int getbits_fast(int);
|
||||
extern int set_pointer(long);
|
||||
extern int set_pointer(struct mpstr *,long);
|
||||
|
||||
extern unsigned char *wordpointer;
|
||||
extern int bitindex;
|
||||
|
@ -160,9 +162,9 @@ struct III_sideinfo
|
|||
} ch[2];
|
||||
};
|
||||
|
||||
extern int synth_1to1 (real *,int,unsigned char *,int *);
|
||||
extern int synth_1to1 (struct mpstr *,real *,int,unsigned char *,int *);
|
||||
extern int synth_1to1_8bit (real *,int,unsigned char *,int *);
|
||||
extern int synth_1to1_mono (real *,unsigned char *,int *);
|
||||
extern int synth_1to1_mono (struct mpstr *,real *,unsigned char *,int *);
|
||||
extern int synth_1to1_mono2stereo (real *,unsigned char *,int *);
|
||||
extern int synth_1to1_8bit_mono (real *,unsigned char *,int *);
|
||||
extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *,int *);
|
||||
|
|
Loading…
Reference in a new issue