diff options
Diffstat (limited to 'webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c')
-rw-r--r-- | webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c b/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c index bc65396..6692a51 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c @@ -17,19 +17,19 @@ */ -#include "entropy_coding.h" -#include "settings.h" -#include "arith_routines.h" -#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" -#include "spectrum_ar_model_tables.h" -#include "lpc_tables.h" -#include "pitch_gain_tables.h" -#include "pitch_lag_tables.h" -#include "encode_lpc_swb.h" -#include "lpc_shape_swb12_tables.h" -#include "lpc_shape_swb16_tables.h" -#include "lpc_gain_swb_tables.h" -#include "os_specific_inline.h" +#include "common_audio/signal_processing/include/signal_processing_library.h" +#include "modules/audio_coding/codecs/isac/main/source/entropy_coding.h" +#include "modules/audio_coding/codecs/isac/main/source/settings.h" +#include "modules/audio_coding/codecs/isac/main/source/arith_routines.h" +#include "modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.h" +#include "modules/audio_coding/codecs/isac/main/source/lpc_tables.h" +#include "modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.h" +#include "modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.h" +#include "modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.h" +#include "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h" +#include "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h" +#include "modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h" +#include "modules/audio_coding/codecs/isac/main/source/os_specific_inline.h" #include <math.h> #include <string.h> @@ -42,7 +42,7 @@ static const uint16_t kOneBitEqualProbCdf[3] = { 0, 32768, 65535 }; /* Pointer to cdf array for encoder bandwidth (12 vs 16 kHz) indicator. */ -static const uint16_t* kOneBitEqualProbCdf_ptr[1] = { +static const uint16_t* const kOneBitEqualProbCdf_ptr[1] = { kOneBitEqualProbCdf }; /* @@ -96,7 +96,7 @@ static void FindInvArSpec(const int16_t* ARCoefQ12, const int32_t gainQ10, int32_t* CurveQ16) { int32_t CorrQ11[AR_ORDER + 1]; - int32_t sum, tmpGain; + int64_t sum, tmpGain; int32_t diffQ16[FRAMESAMPLES / 8]; const int16_t* CS_ptrQ9; int k, n; @@ -162,9 +162,9 @@ static void FindInvArSpec(const int16_t* ARCoefQ12, } for (k = 0; k < FRAMESAMPLES / 8; k++) { - CurveQ16[FRAMESAMPLES_QUARTER - 1 - k] = CurveQ16[k] - - (diffQ16[k] << shftVal); - CurveQ16[k] += diffQ16[k] << shftVal; + int32_t diff_q16_shifted = (int32_t)((uint32_t)(diffQ16[k]) << shftVal); + CurveQ16[FRAMESAMPLES_QUARTER - 1 - k] = CurveQ16[k] - diff_q16_shifted; + CurveQ16[k] += diff_q16_shifted; } } @@ -182,13 +182,13 @@ static void GenerateDitherQ7Lb(int16_t* bufQ7, uint32_t seed, /* Fixed-point dither sample between -64 and 64 (Q7). */ /* dither = seed * 128 / 4294967295 */ - dither1_Q7 = (int16_t)(((int)seed + 16777216) >> 25); + dither1_Q7 = (int16_t)(((int32_t)(seed + 16777216)) >> 25); /* New random unsigned int. */ seed = (seed * 196314165) + 907633515; /* Fixed-point dither sample between -64 and 64. */ - dither2_Q7 = (int16_t)(((int)seed + 16777216) >> 25); + dither2_Q7 = (int16_t)(((int32_t)(seed + 16777216)) >> 25); shft = (seed >> 25) & 15; if (shft < 5) { @@ -214,7 +214,7 @@ static void GenerateDitherQ7Lb(int16_t* bufQ7, uint32_t seed, seed = (seed * 196314165) + 907633515; /* Fixed-point dither sample between -64 and 64. */ - dither1_Q7 = (int16_t)(((int)seed + 16777216) >> 25); + dither1_Q7 = (int16_t)(((int32_t)(seed + 16777216)) >> 25); /* Dither sample is placed in either even or odd index. */ shft = (seed >> 25) & 1; /* Either 0 or 1 */ @@ -254,7 +254,7 @@ static void GenerateDitherQ7LbUB( /* Fixed-point dither sample between -64 and 64 (Q7). */ /* bufQ7 = seed * 128 / 4294967295 */ - bufQ7[k] = (int16_t)(((int)seed + 16777216) >> 25); + bufQ7[k] = (int16_t)(((int32_t)(seed + 16777216)) >> 25); /* Scale by 0.35. */ bufQ7[k] = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(bufQ7[k], 2048, 13); @@ -1843,7 +1843,7 @@ static const uint16_t kBwCdf[25] = { 62804, 65535 }; /* pointer to cdf array for estimated bandwidth */ -static const uint16_t* kBwCdfPtr[1] = { kBwCdf }; +static const uint16_t* const kBwCdfPtr[1] = { kBwCdf }; /* initial cdf index for decoder of estimated bandwidth*/ static const uint16_t kBwInitIndex[1] = { 7 }; |