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

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-06-03 22:49:11 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-19 23:11:50 +0300
commit4e75dd071180999673d27e11a9126a0f2e9de0eb (patch)
tree06639173883cd43afba034647c073e9fad64cc80 /silk/float
parent6e124863320ae29a9fb342922fcc937ef2066493 (diff)
Set pulses to zero if we can't meet rate target
Diffstat (limited to 'silk/float')
-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;
}