Skip to content
Snippets Groups Projects
Commit 7f3caf94 authored by Koen Vos's avatar Koen Vos Committed by Jean-Marc Valin
Browse files

Fixes another minor bug introduced in 43a0de4a

parent 56a3b953
No related branches found
No related tags found
No related merge requests found
...@@ -199,6 +199,15 @@ TOC(NSQ) ...@@ -199,6 +199,15 @@ TOC(NSQ)
} else if( gainsID == gainsID_upper ) { } else if( gainsID == gainsID_upper ) {
nBits = nBits_upper; nBits = nBits_upper;
} else { } 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 */ /* Noise shaping quantization */
/*****************************************/ /*****************************************/
...@@ -310,13 +319,6 @@ TOC(ENCODE_PULSES) ...@@ -310,13 +319,6 @@ TOC(ENCODE_PULSES)
/* Unique identifier of gains vector */ /* Unique identifier of gains vector */
gainsID = silk_gains_ID( psEnc->sCmn.indices.GainsIndices, psEnc->sCmn.nb_subfr ); 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;
} }
} }
......
...@@ -201,6 +201,15 @@ TOC(NSQ) ...@@ -201,6 +201,15 @@ TOC(NSQ)
} else if( gainsID == gainsID_upper ) { } else if( gainsID == gainsID_upper ) {
nBits = nBits_upper; nBits = nBits_upper;
} else { } 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 */ /* Noise shaping quantization */
/*****************************************/ /*****************************************/
...@@ -309,13 +318,6 @@ TOC(ENCODE_PULSES) ...@@ -309,13 +318,6 @@ TOC(ENCODE_PULSES)
for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) { for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) {
sEncCtrl.Gains[ i ] = pGains_Q16[ i ] / 65536.0f; 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;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment