aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2015-11-01 12:31:19 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2015-11-01 12:31:19 +0300
commit4c1b47d9c44ae81e473ca4a743071e94f0bad5b0 (patch)
tree0bd2d6719eae1bc9e05a73daddb8538e540b6cc4 /src
parent592b4bd68f3eb9d1cdbcda74feaffc7b1d5f0485 (diff)
downloadatracdenc-4c1b47d9c44ae81e473ca4a743071e94f0bad5b0.tar.gz
fix: stop iteration to find shift constant in case of shiftMax approximately
equal to shiftMix
Diffstat (limited to 'src')
-rw-r--r--src/atrac/atrac1_bitalloc.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/atrac/atrac1_bitalloc.cpp b/src/atrac/atrac1_bitalloc.cpp
index 7193b1a..d80ea9a 100644
--- a/src/atrac/atrac1_bitalloc.cpp
+++ b/src/atrac/atrac1_bitalloc.cpp
@@ -71,7 +71,12 @@ uint32_t TAtrac1SimpleBitAlloc::Write(const std::vector<TScaledBlock>& scaledBlo
bitsUsed += SpecsPerBlock[i] * tmpAlloc[i];
}
+ //std::cout << spread << " bitsUsed: " << bitsUsed << " min " << minBits << " max " << maxBits << endl;
if (bitsUsed < minBits) {
+ if (maxShift - minShift < 0.1) {
+ bitsPerEachBlock = tmpAlloc;
+ break;
+ }
maxShift = shift;
shift -= (shift - minShift) / 2;
} else if (bitsUsed > maxBits) {