[Scummvm-cvs-logs] CVS: scummvm/sound adpcm.cpp,1.14,1.15
Max Horn
fingolfin at users.sourceforge.net
Sun Dec 11 05:19:03 CET 2005
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22047
Modified Files:
adpcm.cpp
Log Message:
Simplify ADPCM IMA decoding (based on IMA docs). The result will only be 99.9% identical, but the code should be faster on most modern machines
Index: adpcm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/adpcm.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- adpcm.cpp 9 Dec 2005 22:04:28 -0000 1.14
+++ adpcm.cpp 11 Dec 2005 13:18:27 -0000 1.15
@@ -143,16 +143,9 @@
// Decode Linear to ADPCM
int16 ADPCMInputStream::decodeOKI(byte code) {
- int16 diff, E, SS, samp;
+ int16 diff, E, samp;
- SS = okiStepSize[_status.stepIndex];
- E = SS/8;
- if (code & 0x01)
- E += SS/4;
- if (code & 0x02)
- E += SS/2;
- if (code & 0x04)
- E += SS;
+ E = (2 * (code & 0x7) + 1) * okiStepSize[_status.stepIndex] / 8;
diff = (code & 0x08) ? -E : E;
samp = _status.last + diff;
@@ -190,16 +183,9 @@
};
int16 ADPCMInputStream::decodeMSIMA(byte code) {
- int32 diff, E, SS, samp;
+ int32 diff, E, samp;
- SS = imaStepTable[_status.stepIndex];
- E = SS >> 3;
- if (code & 0x04)
- E += SS;
- if (code & 0x02)
- E += SS >> 1;
- if (code & 0x01)
- E += SS >> 2;
+ E = (2 * (code & 0x7) + 1) * imaStepTable[_status.stepIndex] / 8;
diff = (code & 0x08) ? -E : E;
samp = _status.last + diff;
More information about the Scummvm-git-logs
mailing list