aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-11-06 09:03:05 +0200
committerMartin Storsjo <martin@martin.st>2018-11-06 09:03:05 +0200
commit2326faaf8f2cdf2c3a9108ccdaf1d7551aec543e (patch)
tree7ac3c60ef46b78be193be301adb272d1fae735c7 /libAACdec
parent4d4845e1dbc7fa7e1bdf4eeb1e19056d089eb500 (diff)
parenta4d6ca7b07569aac07d50f894f3757b58dd2d6eb (diff)
downloadfdk-aac-2326faaf8f2cdf2c3a9108ccdaf1d7551aec543e.tar.gz
fdk-aac-2326faaf8f2cdf2c3a9108ccdaf1d7551aec543e.tar.bz2
fdk-aac-2326faaf8f2cdf2c3a9108ccdaf1d7551aec543e.zip
Merge remote-tracking branch 'aosp/master'
Diffstat (limited to 'libAACdec')
-rw-r--r--libAACdec/src/block.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/libAACdec/src/block.cpp b/libAACdec/src/block.cpp
index 1280215..b3d09a6 100644
--- a/libAACdec/src/block.cpp
+++ b/libAACdec/src/block.cpp
@@ -127,9 +127,11 @@ amm-info@iis.fraunhofer.de
The function reads the escape sequence from the bitstream,
if the absolute value of the quantized coefficient has the
value 16.
- A limitation is implemented to maximal 31 bits to prevent endless loops.
- If it strikes, MAX_QUANTIZED_VALUE + 1 is returned, independent of the sign of
- parameter q.
+ A limitation is implemented to maximal 21 bits according to
+ ISO/IEC 14496-3:2009(E) 4.6.3.3.
+ This limits the escape prefix to a maximum of eight 1's.
+ If more than eight 1's are read, MAX_QUANTIZED_VALUE + 1 is
+ returned, independent of the sign of parameter q.
\return quantized coefficient
*/
@@ -139,12 +141,11 @@ LONG CBlock_GetEscape(HANDLE_FDK_BITSTREAM bs, /*!< pointer to bitstream */
if (fAbs(q) != 16) return (q);
LONG i, off;
- for (i = 4; i < 32; i++) {
+ for (i = 4; i < 13; i++) {
if (FDKreadBit(bs) == 0) break;
}
- /* (1 << i) will shift into the sign bit if i >= 31 */
- if (i >= 31) return (MAX_QUANTIZED_VALUE + 1);
+ if (i == 13) return (MAX_QUANTIZED_VALUE + 1);
off = FDKreadBits(bs, i);
i = off + (1 << i);