aboutsummaryrefslogtreecommitdiff
path: root/audio/decoders
diff options
context:
space:
mode:
authorD G Turner2011-07-19 02:07:15 +0100
committerD G Turner2011-07-19 02:07:15 +0100
commit765813f750affd7b8883700b489aff0353fc8693 (patch)
tree33fe7b79405128193c097632667fd48ffe86eb7d /audio/decoders
parent45f1f1275c31de8dd2a61de49f20747e442165d4 (diff)
downloadscummvm-rg350-765813f750affd7b8883700b489aff0353fc8693.tar.gz
scummvm-rg350-765813f750affd7b8883700b489aff0353fc8693.tar.bz2
scummvm-rg350-765813f750affd7b8883700b489aff0353fc8693.zip
CODECS: Replaced Integer log2 in QDM2 with Common::Math implementation.
Diffstat (limited to 'audio/decoders')
-rw-r--r--audio/decoders/qdm2.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/audio/decoders/qdm2.cpp b/audio/decoders/qdm2.cpp
index ec2911ef20..842ca58654 100644
--- a/audio/decoders/qdm2.cpp
+++ b/audio/decoders/qdm2.cpp
@@ -34,6 +34,7 @@
#include "common/array.h"
#include "common/debug.h"
+#include "common/math.h"
#include "common/stream.h"
#include "common/textconsole.h"
@@ -289,21 +290,6 @@ private:
typedef signed long long int int64_t;
#endif
-// Integer log2 function. This is much faster than invoking
-// double precision C99 log2 math functions or equivalent, since
-// this is only used to determine maximum number of bits needed
-// i.e. only non-fractional part is needed. Also, the double
-// version is incorrect for exact cases due to floating point
-// rounding errors.
-static inline int scummvm_log2(int n) {
- int ret = -1;
- while(n != 0) {
- n /= 2;
- ret++;
- }
- return ret;
-}
-
#define QDM2_LIST_ADD(list, size, packet) \
do { \
if (size > 0) \
@@ -1836,11 +1822,11 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::F
warning("QDM2Stream::QDM2Stream() u4 field not 0");
}
- _fftOrder = scummvm_log2(_frameSize) + 1;
+ _fftOrder = log2(_frameSize) + 1;
_fftFrameSize = 2 * _frameSize; // complex has two floats
// something like max decodable tones
- _groupOrder = scummvm_log2(_blockSize) + 1;
+ _groupOrder = log2(_blockSize) + 1;
_sFrameSize = _blockSize / 16; // 16 iterations per super block
_subSampling = _fftOrder - 7;