aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/aacdec_hcr_bit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libAACdec/src/aacdec_hcr_bit.cpp')
-rw-r--r--libAACdec/src/aacdec_hcr_bit.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libAACdec/src/aacdec_hcr_bit.cpp b/libAACdec/src/aacdec_hcr_bit.cpp
index a53ef16..0198659 100644
--- a/libAACdec/src/aacdec_hcr_bit.cpp
+++ b/libAACdec/src/aacdec_hcr_bit.cpp
@@ -132,13 +132,14 @@ read direction. It is called very often, therefore it makes sense to inline it
return: - bit from bitstream
--------------------------------------------------------------------------------------------
*/
-UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pLeftStartOfSegment,
+UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
+ INT *pLeftStartOfSegment,
INT *pRightStartOfSegment, UCHAR readDirection) {
UINT bit;
INT readBitOffset;
if (readDirection == FROM_LEFT_TO_RIGHT) {
- readBitOffset = *pLeftStartOfSegment - FDKgetBitCnt(bs);
+ readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pLeftStartOfSegment;
if (readBitOffset) {
FDKpushBiDirectional(bs, readBitOffset);
}
@@ -147,7 +148,7 @@ UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pLeftStartOfSegment,
*pLeftStartOfSegment += 1;
} else {
- readBitOffset = *pRightStartOfSegment - FDKgetBitCnt(bs);
+ readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pRightStartOfSegment;
if (readBitOffset) {
FDKpushBiDirectional(bs, readBitOffset);
}