aboutsummaryrefslogtreecommitdiffstats
path: root/libFDK
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-07 14:27:17 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-07 14:27:17 +0100
commit3eab23670d4d9fb2a8ee01c1be7b4acfc14c1552 (patch)
tree66307d4c7722477b8add1f133a84da311bb99470 /libFDK
parent89639e36b29a622c641c3de3a4737a4c848dc365 (diff)
parenta30bfced6b6d6d976c728552d247cb30dd86e238 (diff)
downloadfdk-aac-dabplus.tar.gz
fdk-aac-dabplus.tar.bz2
fdk-aac-dabplus.zip
Merge branch 'mstorjo/master' into dabplusHEADv0.1.6-dabdabplus
Diffstat (limited to 'libFDK')
-rw-r--r--libFDK/include/FDK_bitstream.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/libFDK/include/FDK_bitstream.h b/libFDK/include/FDK_bitstream.h
index d47a750..e75e570 100644
--- a/libFDK/include/FDK_bitstream.h
+++ b/libFDK/include/FDK_bitstream.h
@@ -245,7 +245,7 @@ FDK_INLINE UINT FDKreadBits(HANDLE_FDK_BITSTREAM hBitStream,
if (hBitStream->BitsInCache <= numberOfBits)
{
- const UINT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
+ const INT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
const INT freeBits = (CACHE_BITS-1) - hBitStream->BitsInCache ;
const INT bitsToRead = (freeBits <= validBits) ? freeBits : validBits ;
@@ -277,11 +277,15 @@ FDK_INLINE UINT FDKreadBit(HANDLE_FDK_BITSTREAM hBitStream)
hBitStream->CacheWord = FDK_get32 (&hBitStream->hBitBuf);
hBitStream->BitsInCache = CACHE_BITS;
}
- else
+ else if (validBits > 0)
{
hBitStream->CacheWord = FDK_get (&hBitStream->hBitBuf,validBits);
hBitStream->BitsInCache = validBits;
}
+ else
+ {
+ return 0;
+ }
}
hBitStream->BitsInCache--;
@@ -305,7 +309,7 @@ inline UINT FDKread2Bits(HANDLE_FDK_BITSTREAM hBitStream)
UINT BitsInCache = hBitStream->BitsInCache;
if (BitsInCache < 2) /* Comparison changed from 'less-equal' to 'less' */
{
- const UINT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
+ const INT validBits = FDK_getValidBits (&hBitStream->hBitBuf) ;
const INT freeBits = (CACHE_BITS-1) - BitsInCache ;
const INT bitsToRead = (freeBits <= validBits) ? freeBits : validBits ;