ref: 7f3caf941e1c3cdcf09491a16c857a0cfc3a8415
parent: 56a3b9534399e5be3d5514dfec787bb6c9ca8bad
author: Koen Vos <[email protected]>
date: Wed Oct 26 04:03:31 EDT 2011
Fixes another minor bug introduced in 43a0de4af15
--- a/silk/fixed/encode_frame_FIX.c
+++ b/silk/fixed/encode_frame_FIX.c
@@ -199,6 +199,15 @@
} else if( gainsID == gainsID_upper ) {
nBits = nBits_upper;
} else {
+ /* Restore part of the input state */
+ if( iter > 0 ) {
+ silk_memcpy( psRangeEnc, &sRangeEnc_copy, sizeof( ec_enc ) );
+ silk_memcpy( &psEnc->sCmn.sNSQ, &sNSQ_copy, sizeof( silk_nsq_state ) );
+ psEnc->sCmn.indices.Seed = seed_copy;
+ psEnc->sCmn.ec_prevLagIndex = ec_prevLagIndex_copy;
+ psEnc->sCmn.ec_prevSignalType = ec_prevSignalType_copy;
+ }
+
/*****************************************/
/* Noise shaping quantization */
/*****************************************/
@@ -310,13 +319,6 @@
/* Unique identifier of gains vector */
gainsID = silk_gains_ID( psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr );
-
- /* Restore part of the input state */
- silk_memcpy( psRangeEnc, &sRangeEnc_copy, sizeof( ec_enc ) );
- silk_memcpy( &psEnc->sCmn.sNSQ, &sNSQ_copy, sizeof( silk_nsq_state ) );
- psEnc->sCmn.indices.Seed = seed_copy;
- psEnc->sCmn.ec_prevLagIndex = ec_prevLagIndex_copy;
- psEnc->sCmn.ec_prevSignalType = ec_prevSignalType_copy;
}
}
--- a/silk/float/encode_frame_FLP.c
+++ b/silk/float/encode_frame_FLP.c
@@ -201,6 +201,15 @@
} else if( gainsID == gainsID_upper ) {
nBits = nBits_upper;
} else {
+ /* Restore part of the input state */
+ if( iter > 0 ) {
+ silk_memcpy( psRangeEnc, &sRangeEnc_copy, sizeof( ec_enc ) );
+ silk_memcpy( &psEnc->sCmn.sNSQ, &sNSQ_copy, sizeof( silk_nsq_state ) );
+ psEnc->sCmn.indices.Seed = seed_copy;
+ psEnc->sCmn.ec_prevLagIndex = ec_prevLagIndex_copy;
+ psEnc->sCmn.ec_prevSignalType = ec_prevSignalType_copy;
+ }
+
/*****************************************/
/* Noise shaping quantization */
/*****************************************/
@@ -309,13 +318,6 @@
for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) {
sEncCtrl.Gains[ i ] = pGains_Q16[ i ] / 65536.0f;
}
-
- /* Restore part of the input state */
- silk_memcpy( psRangeEnc, &sRangeEnc_copy, sizeof( ec_enc ) );
- silk_memcpy( &psEnc->sCmn.sNSQ, &sNSQ_copy, sizeof( silk_nsq_state ) );
- psEnc->sCmn.indices.Seed = seed_copy;
- psEnc->sCmn.ec_prevLagIndex = ec_prevLagIndex_copy;
- psEnc->sCmn.ec_prevSignalType = ec_prevSignalType_copy;
}
}