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

github.com/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoen Vos <koen.vos@skype.net>2012-01-31 10:51:22 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-01-31 10:51:22 +0400
commit54518c879a6541eab749bc19628f1795daaad1e3 (patch)
tree3c2d0d08b9314dcb2d316e2ec4e477a6784b970b /silk/NLSF2A.c
parenta26b2be2f922502b821e81e2cb084393f1ccf405 (diff)
Last part of the LPC work stabilization work discussed at the last meeting
Also adds the encoder part of commit ee8adbe701 as well as a few minor cleanups.
Diffstat (limited to 'silk/NLSF2A.c')
-rw-r--r--silk/NLSF2A.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/silk/NLSF2A.c b/silk/NLSF2A.c
index b10c6901..e7fd5e67 100644
--- a/silk/NLSF2A.c
+++ b/silk/NLSF2A.c
@@ -137,7 +137,7 @@ void silk_NLSF2A(
idx = k;
}
}
- maxabs = silk_RSHIFT_ROUND( maxabs, QA + 1 - 12 ); /* QA+1 -> Q12 */
+ maxabs = silk_RSHIFT_ROUND( maxabs, QA + 1 - 12 ); /* QA+1 -> Q12 */
if( maxabs > silk_int16_MAX ) {
/* Reduce magnitude of prediction coefficients */
@@ -153,33 +153,26 @@ void silk_NLSF2A(
if( i == 10 ) {
/* Reached the last iteration, clip the coefficients */
for( k = 0; k < d; k++ ) {
- a_Q12[ k ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ) ); /* QA+1 -> Q12 */
+ a_Q12[ k ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ) ); /* QA+1 -> Q12 */
a32_QA1[ k ] = silk_LSHIFT( (opus_int32)a_Q12[ k ], QA + 1 - 12 );
}
} else {
for( k = 0; k < d; k++ ) {
- a_Q12[ k ] = (opus_int16)silk_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */
+ a_Q12[ k ] = (opus_int16)silk_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */
}
}
- for( i = 1; i <= MAX_LPC_STABILIZE_ITERATIONS; i++ ) {
+ for( i = 0; i < MAX_LPC_STABILIZE_ITERATIONS; i++ ) {
if( silk_LPC_inverse_pred_gain( a_Q12, d ) < SILK_FIX_CONST( 1.0 / MAX_PREDICTION_POWER_GAIN, 30 ) ) {
/* Prediction coefficients are (too close to) unstable; apply bandwidth expansion */
/* on the unscaled coefficients, convert to Q12 and measure again */
- silk_bwexpander_32( a32_QA1, d, 65536 - silk_SMULBB( 9 + i, i ) ); /* 10_Q16 = 0.00015 */
+ silk_bwexpander_32( a32_QA1, d, 65536 - silk_LSHIFT( 2, i ) );
for( k = 0; k < d; k++ ) {
- a_Q12[ k ] = (opus_int16)silk_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */
+ a_Q12[ k ] = (opus_int16)silk_RSHIFT_ROUND( a32_QA1[ k ], QA + 1 - 12 ); /* QA+1 -> Q12 */
}
} else {
break;
}
}
-
- if( i > MAX_LPC_STABILIZE_ITERATIONS ) {
- /* Reached the last iteration, set coefficients to zero */
- for( k = 0; k < d; k++ ) {
- a_Q12[ k ] = 0;
- }
- }
}