Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/silk
diff options
context:
space:
mode:
authorKoen Vos <koen.vos@skype.net>2011-09-23 21:05:22 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2011-09-23 21:05:22 +0400
commit44ce46dc129f136c93da492299562c1f0fcd519d (patch)
tree7b542fe9974a10399263955f641469defde6c07f /silk
parent2557750095863a1f038b85700a4131d3e29a7405 (diff)
Fixes a decoder overflow on random input
Also some MSVC build fixes
Diffstat (limited to 'silk')
-rw-r--r--silk/decode_core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/silk/decode_core.c b/silk/decode_core.c
index 91ebc7f1..6a07ee1a 100644
--- a/silk/decode_core.c
+++ b/silk/decode_core.c
@@ -44,7 +44,7 @@ void silk_decode_core(
opus_int i, j, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType;
opus_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ];
opus_int16 sLTP[ MAX_FRAME_LENGTH ];
- opus_int32 LTP_pred_Q14, LPC_pred_Q10, Gain_Q16, inv_gain_Q16, inv_gain_Q32, gain_adj_Q16, rand_seed, offset_Q10;
+ opus_int32 LTP_pred_Q14, LPC_pred_Q10, Gain_Q10, inv_gain_Q16, inv_gain_Q32, gain_adj_Q16, rand_seed, offset_Q10;
opus_int32 *pred_lag_ptr, *pexc_Q10, *pres_Q10;
opus_int32 res_Q10[ MAX_SUB_FRAME_LENGTH ];
opus_int32 vec_Q10[ MAX_SUB_FRAME_LENGTH ];
@@ -91,10 +91,10 @@ void silk_decode_core(
/* Preload LPC coeficients to array on stack. Gives small performance gain */
silk_memcpy( A_Q12_tmp, A_Q12, psDec->LPC_order * sizeof( opus_int16 ) );
B_Q14 = &psDecCtrl->LTPCoef_Q14[ k * LTP_ORDER ];
- Gain_Q16 = psDecCtrl->Gains_Q16[ k ];
+ Gain_Q10 = silk_RSHIFT( psDecCtrl->Gains_Q16[ k ], 6 );
signalType = psDec->indices.signalType;
- inv_gain_Q16 = silk_INVERSE32_varQ( silk_max( Gain_Q16, 1 ), 32 );
+ inv_gain_Q16 = silk_INVERSE32_varQ( Gain_Q10, 26 );
inv_gain_Q16 = silk_min( inv_gain_Q16, silk_int16_MAX );
/* Calculate Gain adjustment factor */
@@ -209,7 +209,7 @@ void silk_decode_core(
/* Scale with Gain */
for( i = 0; i < psDec->subfr_length; i++ ) {
- pxq[ i ] = ( opus_int16 )silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( vec_Q10[ i ], Gain_Q16 ), 10 ) );
+ pxq[ i ] = ( opus_int16 )silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( vec_Q10[ i ], Gain_Q10 ), 4 ) );
}
/* Update LPC filter state */