diff options
Diffstat (limited to 'libAACdec/src')
-rw-r--r-- | libAACdec/src/channelinfo.h | 2 | ||||
-rw-r--r-- | libAACdec/src/usacdec_acelp.cpp | 10 | ||||
-rw-r--r-- | libAACdec/src/usacdec_const.h | 1 | ||||
-rw-r--r-- | libAACdec/src/usacdec_fac.cpp | 14 | ||||
-rw-r--r-- | libAACdec/src/usacdec_fac.h | 2 | ||||
-rw-r--r-- | libAACdec/src/usacdec_lpd.cpp | 1 |
6 files changed, 15 insertions, 15 deletions
diff --git a/libAACdec/src/channelinfo.h b/libAACdec/src/channelinfo.h index 45a288f..4523400 100644 --- a/libAACdec/src/channelinfo.h +++ b/libAACdec/src/channelinfo.h @@ -359,7 +359,7 @@ typedef struct { shouldBeUnion { struct { FIXP_DBL fac_data0[LFAC]; - UCHAR fac_data_e[4]; + SCHAR fac_data_e[4]; FIXP_DBL *fac_data[4]; /* Pointers to unused parts of pSpectralCoefficient */ diff --git a/libAACdec/src/usacdec_acelp.cpp b/libAACdec/src/usacdec_acelp.cpp index af1f488..9fecebf 100644 --- a/libAACdec/src/usacdec_acelp.cpp +++ b/libAACdec/src/usacdec_acelp.cpp @@ -579,11 +579,11 @@ void Syn_filt(const FIXP_LPC a[], /* (i) : a[m] prediction coefficients Q12 */ L_tmp = (FIXP_DBL)0; for (j = 0; j < M_LP_FILTER_ORDER; j++) { - L_tmp -= fMultDiv2(a[j], y[i - (j + 1)]); + L_tmp -= fMultDiv2(a[j], y[i - (j + 1)]) >> (LP_FILTER_SCALE - 1); } - L_tmp = scaleValue(L_tmp, a_exp + 1); - y[i] = L_tmp + x[i]; + L_tmp = scaleValue(L_tmp, a_exp + LP_FILTER_SCALE); + y[i] = fAddSaturate(L_tmp, x[i]); } return; @@ -631,10 +631,10 @@ void E_UTIL_residu(const FIXP_LPC *a, const INT a_exp, FIXP_DBL *x, FIXP_DBL *y, s = (FIXP_DBL)0; for (j = 0; j < M_LP_FILTER_ORDER; j++) { - s += fMultDiv2(a[j], x[i - j - 1]); + s += fMultDiv2(a[j], x[i - j - 1]) >> (LP_FILTER_SCALE - 1); } - s = scaleValue(s, a_exp + 1); + s = scaleValue(s, a_exp + LP_FILTER_SCALE); y[i] = fAddSaturate(s, x[i]); } diff --git a/libAACdec/src/usacdec_const.h b/libAACdec/src/usacdec_const.h index c7dbae7..f68e808 100644 --- a/libAACdec/src/usacdec_const.h +++ b/libAACdec/src/usacdec_const.h @@ -115,6 +115,7 @@ amm-info@iis.fraunhofer.de /* definitions which are independent of coreCoderFrameLength */ #define M_LP_FILTER_ORDER 16 /* LP filter order */ +#define LP_FILTER_SCALE 4 /* LP filter scale */ #define PIT_MIN_12k8 34 /* Minimum pitch lag with resolution 1/4 */ #define PIT_MAX_12k8 231 /* Maximum pitch lag for fs=12.8kHz */ diff --git a/libAACdec/src/usacdec_fac.cpp b/libAACdec/src/usacdec_fac.cpp index 71ce4a9..c10a3fe 100644 --- a/libAACdec/src/usacdec_fac.cpp +++ b/libAACdec/src/usacdec_fac.cpp @@ -142,7 +142,7 @@ FIXP_DBL *CLpd_FAC_GetMemory(CAacDecoderChannelInfo *pAacDecoderChannelInfo, return ptr; } -int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, UCHAR *pFacScale, +int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, SCHAR *pFacScale, int length, int use_gain, int frame) { FIXP_DBL fac_gain; int fac_gain_e = 0; @@ -191,13 +191,11 @@ static void Syn_filt_zero(const FIXP_LPC a[], const INT a_exp, INT length, L_tmp = (FIXP_DBL)0; for (j = 0; j < fMin(i, M_LP_FILTER_ORDER); j++) { - L_tmp -= fMultDiv2(a[j], x[i - (j + 1)]); + L_tmp -= fMultDiv2(a[j], x[i - (j + 1)]) >> (LP_FILTER_SCALE - 1); } - L_tmp = scaleValue(L_tmp, a_exp + 1); - - x[i] = scaleValueSaturate((x[i] >> 1) + (L_tmp >> 1), - 1); /* Avoid overflow issues and saturate. */ + L_tmp = scaleValue(L_tmp, a_exp + LP_FILTER_SCALE); + x[i] = fAddSaturate(x[i], L_tmp); } } @@ -538,7 +536,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec, if (total_gain != (FIXP_DBL)0) { scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[0] + scale); } else { - scaleValues(pSpec, tl, spec_scale[0] + scale); + scaleValuesSaturate(pSpec, tl, spec_scale[0] + scale); } pOut1 += fl / 2 - 1; @@ -627,7 +625,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec, if (total_gain != (FIXP_DBL)0) { scaleValuesWithFactor(pSpec, total_gain, tl, spec_scale[w] + scale); } else { - scaleValues(pSpec, tl, spec_scale[w] + scale); + scaleValuesSaturate(pSpec, tl, spec_scale[w] + scale); } if (noOutSamples <= nrSamples) { diff --git a/libAACdec/src/usacdec_fac.h b/libAACdec/src/usacdec_fac.h index bf13552..100a6fa 100644 --- a/libAACdec/src/usacdec_fac.h +++ b/libAACdec/src/usacdec_fac.h @@ -131,7 +131,7 @@ FIXP_DBL *CLpd_FAC_GetMemory(CAacDecoderChannelInfo *pAacDecoderChannelInfo, * Always 0 for FD case. * \return 0 on success, -1 on error. */ -int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, UCHAR *pFacScale, +int CLpd_FAC_Read(HANDLE_FDK_BITSTREAM hBs, FIXP_DBL *pFac, SCHAR *pFacScale, int length, int use_gain, int frame); /** diff --git a/libAACdec/src/usacdec_lpd.cpp b/libAACdec/src/usacdec_lpd.cpp index fde34ef..2110172 100644 --- a/libAACdec/src/usacdec_lpd.cpp +++ b/libAACdec/src/usacdec_lpd.cpp @@ -418,6 +418,7 @@ void CLpd_AdaptLowFreqDeemph(FIXP_DBL x[], int lg, FIXP_DBL alfd_gains[], FIXP_DBL tmp_pow2[32]; s = s * 2 + ALFDPOW2_SCALE; + s = fMin(31, s); k = 8; i_max = lg / 4; /* ALFD range = 1600Hz (lg = 6400Hz) */ |