From a158f5d74742a50399dc7ba75843675127bfb9b6 Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Tue, 8 May 2001 21:49:00 +0000 Subject: applied 'fakemono' patch by Bryan Chan scorpio@acm.org git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@733 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mp3lib/decod386.c | 34 ++++++++++++++++++++++++++++++++++ mp3lib/mp3.h | 4 ++++ mp3lib/sr1.c | 13 +++++++++++++ 3 files changed, 51 insertions(+) (limited to 'mp3lib') diff --git a/mp3lib/decod386.c b/mp3lib/decod386.c index f1a7e26b76..0dceb11a71 100644 --- a/mp3lib/decod386.c +++ b/mp3lib/decod386.c @@ -72,6 +72,40 @@ static int synth_1to1_mono2stereo(real *bandPtr,unsigned char *samples,int *pnt) } +#ifdef USE_FAKE_MONO +static int synth_1to1_l(real *bandPtr,int channel,unsigned char *out,int *pnt) +{ + int i,ret; + + ret = synth_1to1(bandPtr,channel,out,pnt); + out = out + *pnt - 128; + + for(i=0;i<32;i++) { + ((short *)out)[1] = ((short *)out)[0]; + out+=4; + } + + return ret; +} + + +static int synth_1to1_r(real *bandPtr,int channel,unsigned char *out,int *pnt) +{ + int i,ret; + + ret = synth_1to1(bandPtr,channel,out,pnt); + out = out + *pnt - 128; + + for(i=0;i<32;i++) { + ((short *)out)[0] = ((short *)out)[1]; + out+=4; + } + + return ret; +} +#endif + + static int synth_1to1(real *bandPtr,int channel,unsigned char *out,int *pnt) { static real buffs[2][2][0x110]; diff --git a/mp3lib/mp3.h b/mp3lib/mp3.h index c89833fff2..308c8187af 100644 --- a/mp3lib/mp3.h +++ b/mp3lib/mp3.h @@ -1,7 +1,11 @@ /* MP3 Player Library 2.0 (C) 1999 A'rpi/Astral&ESP-team */ /* decoder level: */ +#ifdef USE_FAKE_MONO +extern void MP3_Init(int fakemono); +#else extern void MP3_Init(); +#endif extern int MP3_Open(char *filename,int buffsize); extern void MP3_SeekFrame(int num,int dir); extern void MP3_SeekForward(int num); diff --git a/mp3lib/sr1.c b/mp3lib/sr1.c index 0829bc0c4a..f983763a04 100644 --- a/mp3lib/sr1.c +++ b/mp3lib/sr1.c @@ -348,7 +348,11 @@ retry1: static int tables_done_flag=0; // Init decoder tables. Call first, once! +#ifdef USE_FAKE_MONO +void MP3_Init(int fakemono){ +#else void MP3_Init(){ +#endif _CpuID=CpuDetect(); _i586=ipentium(); #ifdef HAVE_3DNOW @@ -362,7 +366,16 @@ void MP3_Init(){ #endif make_decode_tables(outscale); +#ifdef USE_FAKE_MONO + if (fakemono == 1) + fr.synth=synth_1to1_l; + else if (fakemono == 2) + fr.synth=synth_1to1_r; + else + fr.synth=synth_1to1; +#else fr.synth=synth_1to1; +#endif fr.synth_mono=synth_1to1_mono2stereo; fr.down_sample=0; fr.down_sample_sblimit = SBLIMIT>>(fr.down_sample); -- cgit v1.2.3