diff --git a/programs/media/ac97snd/trunk/ac97.sln b/programs/media/ac97snd/trunk/ac97.sln index 5d014c2e95..42b490dc6e 100644 --- a/programs/media/ac97snd/trunk/ac97.sln +++ b/programs/media/ac97snd/trunk/ac97.sln @@ -8,6 +8,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pow_test", "pow_test\pow_test.vcproj", "{9FE40739-2ADC-4241-8182-20E1B3C661A7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ac97", "ac97\ac97.vcproj", "{1C94A897-DA4F-45B2-B8A6-B97AD837828E}" + ProjectSection(ProjectDependencies) = postProject + {CF807B93-2860-41DF-A4D2-5B92B52DFD96} = {CF807B93-2860-41DF-A4D2-5B92B52DFD96} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpg", "mpg\mpg.vcproj", "{CF807B93-2860-41DF-A4D2-5B92B52DFD96}" EndProject diff --git a/programs/media/ac97snd/trunk/ac97wav.c b/programs/media/ac97snd/trunk/ac97wav.c index d3415ceaa4..dc74bb4a56 100644 --- a/programs/media/ac97snd/trunk/ac97wav.c +++ b/programs/media/ac97snd/trunk/ac97wav.c @@ -182,9 +182,9 @@ int main(int argc, char *argv[]) //int argc, char *argv[]) outbuf = UserAlloc(outremain); touch(outbuf, outremain); make_decode_tables(32767); - init_layer2(); - init_layer3(SBLIMIT); - fr.single = -1; + init_layer2(); + init_layer3(32); + fr.single = -1; }; status = ST_PLAY; @@ -266,14 +266,21 @@ void play_mp3() int totalout; int outcount; - set_reader(&rd, first_sync); + // memset(&fr,0,sizeof(fr)); + fr.down_sample_sblimit = 32; + fr.single = -1; + reset_mpg(); outPtr = outbuf; totalout=0; done = 0; + outremain=0x40000; - memset(outbuf,0,0x10000); - SetBuffer(hSound,hBuff,outbuf,0,0x10000); + memset(outbuf,0,0x40000); + + set_reader(&rd, 0); //;first_sync); + SetBuffer(hSound,hBuff,outbuf,0,0x8000); + SetBuffer(hSound,hBuff,outbuf,0x8000,0x8000); PlayBuffer(hSound, hBuff); while(1) @@ -339,6 +346,7 @@ void play_wave() // read_file (fname,outbuf,offset,32*1024,0); // offset+=32*1024; + set_reader(&rd,44); stream_read_raw(&rd,outbuf,32768); SetBuffer(hSound,hBuff,outbuf,0,0x8000); stream_read_raw(&rd,outbuf,32768); diff --git a/programs/media/ac97snd/trunk/crt.h b/programs/media/ac97snd/trunk/crt.h index 0c00649423..99cf9e16f1 100644 --- a/programs/media/ac97snd/trunk/crt.h +++ b/programs/media/ac97snd/trunk/crt.h @@ -4,7 +4,7 @@ typedef unsigned __int8 Byte; typedef unsigned __int32 size_t; -extern char *__argv; +extern char *__argv[2]; void crtStartUp(); int __cdecl _purecall(); diff --git a/programs/media/ac97snd/trunk/mpg/decode_i386.c b/programs/media/ac97snd/trunk/mpg/decode_i386.c index 2c066c53cb..c11ffef9d6 100644 --- a/programs/media/ac97snd/trunk/mpg/decode_i386.c +++ b/programs/media/ac97snd/trunk/mpg/decode_i386.c @@ -133,12 +133,22 @@ int synth_1to1_mono2stereo(real *bandPtr,unsigned char *samples,int *pnt) return ret; } + +static real buffs[2][2][0x110]; +static const int step = 2; +static int bo = 1; + +void init_dct() +{ + bo = 1; + memset(buffs,0, sizeof(buffs)); + +}; + + int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt) { #ifndef PENTIUM_OPT - static real buffs[2][2][0x110]; - static const int step = 2; - static int bo = 1; short *samples = (short *) (out + *pnt); real *b0,(*buf)[0x110]; diff --git a/programs/media/ac97snd/trunk/mpg/layer3.c b/programs/media/ac97snd/trunk/mpg/layer3.c index 25f74d3757..c127b6a249 100644 --- a/programs/media/ac97snd/trunk/mpg/layer3.c +++ b/programs/media/ac97snd/trunk/mpg/layer3.c @@ -220,6 +220,20 @@ void layer3_gapless_buffercheck() * init tables for layer-3 */ +real hybridIn [2][SBLIMIT][SSLIMIT]; +real hybridOut[2][SSLIMIT][SBLIMIT]; +static real block[2][2][SBLIMIT*SSLIMIT] = { { { 0, } } }; +static int blc[2]={0,0}; + +void reset_mpg() +{ + memset(block,0,sizeof(block)); + blc[0]=0; + blc[1]=0; + init_dct(); +}; + + #pragma warning(disable:4244) void init_layer3(int down_sample_sblimit) { @@ -601,7 +615,7 @@ static int III_get_scale_factors_2(int *scf,struct gr_info_s *gr_info,int i_ster int i,j,n=0,numbits=0; unsigned int slen; - 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} , @@ -1727,10 +1741,7 @@ static void III_hybrid(real fsIn[SBLIMIT][SSLIMIT],real tsOut[SSLIMIT][SBLIMIT], int ch,struct gr_info_s *gr_info) #endif { - static real block[2][2][SBLIMIT*SSLIMIT] = { { { 0, } } }; - static int blc[2]={0,0}; - - real *tspnt = (real *) tsOut; + real *tspnt = (real *) tsOut; real *rawout1,*rawout2; int bt,sb = 0; @@ -1782,9 +1793,6 @@ static void III_hybrid(real fsIn[SBLIMIT][SSLIMIT],real tsOut[SSLIMIT][SBLIMIT], } } -real hybridIn [2][SBLIMIT][SSLIMIT]; -real hybridOut[2][SSLIMIT][SBLIMIT]; - int do_layer3(struct frame *fr,byte *pcm_sample,int *pcm_point) { int gr, ch, ss,clip=0; diff --git a/programs/media/ac97snd/trunk/mpg/mpg123.h b/programs/media/ac97snd/trunk/mpg/mpg123.h index d97db75424..3183083dcd 100644 --- a/programs/media/ac97snd/trunk/mpg/mpg123.h +++ b/programs/media/ac97snd/trunk/mpg/mpg123.h @@ -352,7 +352,8 @@ int __stdcall decode_header(struct frame *fr,unsigned long newhead); int __stdcall set_reader(struct reader *rd, unsigned int filepos); double pow_test(double, double); void * __cdecl mem_cpy(void * dst,const void * src,size_t count); - +void init_dct(); +void reset_mpg(); #ifdef __cplusplus } #endif diff --git a/programs/media/ac97snd/trunk/mpg/readers.c b/programs/media/ac97snd/trunk/mpg/readers.c index ab7a34f9d9..27d4a25417 100644 --- a/programs/media/ac97snd/trunk/mpg/readers.c +++ b/programs/media/ac97snd/trunk/mpg/readers.c @@ -111,7 +111,16 @@ int __stdcall set_reader(struct reader *rd, unsigned int filepos) rd->stream = rd->buffer; rd->strremain=bytes; rd->filepos=filepos+bytes; - rd->strpos = 0; + rd->strpos = 0; + + fsizeold=0; + firsthead=0; + bsbufold = 0; + bsbuf = bsspace[1]; + bsnum = 0; + ssize=0; + oldhead=0; + memset(bsspace,0,sizeof(bsspace)); return 1; }; @@ -715,8 +724,8 @@ init_resync: } - #if 0 + static int stream_back_bytes(struct reader *rds, off_t bytes) { if(stream_lseek(rds,-bytes,SEEK_CUR) < 0)