ref: 39fb193238fb9a203cc5ce99a544aa906eb07058
parent: cc14cdf87515d3923875ffa3087fa13d4fb025da
author: Jean-Marc Valin <[email protected]>
date: Fri Jul 8 05:21:14 EDT 2011
Forcing clamping the pitch lag within the limits of the buffer
--- a/silk/silk_decode_pitch.c
+++ b/silk/silk_decode_pitch.c
@@ -39,7 +39,7 @@
const SKP_int nb_subfr /* I number of sub frames */
)
{
- SKP_int lag, k, min_lag, cbk_size;
+ SKP_int lag, k, min_lag, max_lag, cbk_size;
const SKP_int8 *Lag_CB_ptr;
if( Fs_kHz == 8 ) {
@@ -63,9 +63,11 @@
}
min_lag = SKP_SMULBB( PE_MIN_LAG_MS, Fs_kHz );
+ max_lag = SKP_SMULBB( PE_MAX_LAG_MS, Fs_kHz );
lag = min_lag + lagIndex;
for( k = 0; k < nb_subfr; k++ ) {
pitch_lags[ k ] = lag + matrix_ptr( Lag_CB_ptr, k, contourIndex, cbk_size );
+ pitch_lags[ k ] = SKP_LIMIT( pitch_lags[ k ], min_lag, max_lag );
}
}
\ No newline at end of file