[Scummvm-cvs-logs] scummvm master -> 765813f750affd7b8883700b489aff0353fc8693
digitall
digitall at scummvm.org
Tue Jul 19 03:10:58 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
765813f750 CODECS: Replaced Integer log2 in QDM2 with Common::Math implementation.
Commit: 765813f750affd7b8883700b489aff0353fc8693
https://github.com/scummvm/scummvm/commit/765813f750affd7b8883700b489aff0353fc8693
Author: D G Turner (digitall at scummvm.org)
Date: 2011-07-18T18:07:15-07:00
Commit Message:
CODECS: Replaced Integer log2 in QDM2 with Common::Math implementation.
Changed paths:
audio/decoders/qdm2.cpp
diff --git a/audio/decoders/qdm2.cpp b/audio/decoders/qdm2.cpp
index ec2911e..842ca58 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;
More information about the Scummvm-git-logs
mailing list