diff options
Diffstat (limited to 'libAACdec/src')
-rw-r--r-- | libAACdec/src/aacdecoder.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index b15fc80..6b5a86c 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -3388,7 +3388,8 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( * LR) */ if ((aacChannels == 2) && bsPseudoLr) { int i, offset2; - const FIXP_SGL invSqrt2 = FL2FXCONST_SGL(0.707106781186547f); + const FIXP_SGL invSqrt2 = + FL2FXCONST_SGL(0.353553390593273f); /* scaled by -1 */ FIXP_PCM *pTD = pTimeData; offset2 = timeDataChannelOffset; @@ -3399,11 +3400,14 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( L = fMult(L, invSqrt2); R = fMult(R, invSqrt2); #if (SAMPLE_BITS == 16) - pTD[0] = FX_DBL2FX_PCM(fAddSaturate(L + R, (FIXP_DBL)0x8000)); - pTD[offset2] = FX_DBL2FX_PCM(fAddSaturate(L - R, (FIXP_DBL)0x8000)); + pTD[0] = (FIXP_SGL)SATURATE_RIGHT_SHIFT(L + R + (FIXP_DBL)(1 << 14), + 15, FRACT_BITS); + pTD[offset2] = (FIXP_SGL)SATURATE_RIGHT_SHIFT( + L - R + (FIXP_DBL)(1 << 14), 15, FRACT_BITS); #else - pTD[0] = FX_DBL2FX_PCM(L + R); - pTD[offset2] = FX_DBL2FX_PCM(L - R); + pTD[0] = SATURATE_LEFT_SHIFT(FX_DBL2FX_PCM(L + R), 1, DFRACT_BITS); + pTD[offset2] = + SATURATE_LEFT_SHIFT(FX_DBL2FX_PCM(L - R), 1, DFRACT_BITS); #endif pTD++; } |