diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2015-11-01 12:31:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2015-11-01 12:31:19 +0300 |
commit | 4c1b47d9c44ae81e473ca4a743071e94f0bad5b0 (patch) | |
tree | 0bd2d6719eae1bc9e05a73daddb8538e540b6cc4 | |
parent | 592b4bd68f3eb9d1cdbcda74feaffc7b1d5f0485 (diff) | |
download | atracdenc-4c1b47d9c44ae81e473ca4a743071e94f0bad5b0.tar.gz |
fix: stop iteration to find shift constant in case of shiftMax approximately
equal to shiftMix
-rw-r--r-- | src/atrac/atrac1_bitalloc.cpp | 5 |
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) { |