summaryrefslogtreecommitdiff
path: root/silk/float/encode_frame_FLP.c
diff options
context:
space:
mode:
Diffstat (limited to 'silk/float/encode_frame_FLP.c')
-rw-r--r--silk/float/encode_frame_FLP.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/silk/float/encode_frame_FLP.c b/silk/float/encode_frame_FLP.c
index b654ddc6..59efcb44 100644
--- a/silk/float/encode_frame_FLP.c
+++ b/silk/float/encode_frame_FLP.c
@@ -192,6 +192,9 @@ opus_int silk_encode_frame_FLP(
/****************************************/
silk_encode_indices( &psEnc->sCmn, psRangeEnc, psEnc->sCmn.nFramesEncoded, 0, condCoding );
+ if ( iter == maxIter && !found_lower ) {
+ silk_memcpy( &sRangeEnc_copy2, psRangeEnc, sizeof( ec_enc ) );
+ }
/****************************************/
/* Encode Excitation Signal */
/****************************************/
@@ -200,6 +203,16 @@ opus_int silk_encode_frame_FLP(
nBits = ec_tell( psRangeEnc );
+ if ( iter == maxIter && !found_lower && nBits > maxBits ) {
+ silk_memcpy( psRangeEnc, &sRangeEnc_copy2, sizeof( ec_enc ) );
+ for ( i = 0; i < psEnc->sCmn.frame_length; i++ ) {
+ psEnc->sCmn.pulses[ i ] = 0;
+ }
+ silk_encode_pulses( psRangeEnc, psEnc->sCmn.indices.signalType, psEnc->sCmn.indices.quantOffsetType,
+ psEnc->sCmn.pulses, psEnc->sCmn.frame_length );
+ nBits = ec_tell( psRangeEnc );
+ }
+
if( useCBR == 0 && iter == 0 && nBits <= maxBits ) {
break;
}