diff options
author | Koen Vos <koen.vos@skype.net> | 2011-10-25 01:19:29 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-10-25 01:19:29 -0400 |
commit | d39bccb0e17ad5352ec4eed4fb266c15837db2e0 (patch) | |
tree | 95363f5d655bb61e1a4f1873773310765345016a /silk/float | |
parent | 9ba1743594ee9ba72c6247dec3bce53b80403456 (diff) | |
download | opus-d39bccb0e17ad5352ec4eed4fb266c15837db2e0.tar.gz |
Fixes a minor bug introduced in 43a0de4af15
Diffstat (limited to 'silk/float')
-rw-r--r-- | silk/float/encode_frame_FLP.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/silk/float/encode_frame_FLP.c b/silk/float/encode_frame_FLP.c index 2330476a..635b964b 100644 --- a/silk/float/encode_frame_FLP.c +++ b/silk/float/encode_frame_FLP.c @@ -243,13 +243,16 @@ TOC(ENCODE_PULSES) } if( nBits > maxBits ) { - found_upper = 1; - nBits_upper = nBits; - gainMult_upper = gainMult_Q8; - gainsID_upper = gainsID; if( found_lower == 0 && iter >= 2 ) { - /* Adjust the quantizer's rate/distortion tradeoff */ + /* Adjust the quantizer's rate/distortion tradeoff and discard previous "upper" results */ sEncCtrl.Lambda *= 1.5f; + found_upper = 0; + gainsID_upper = -1; + } else { + found_upper = 1; + nBits_upper = nBits; + gainMult_upper = gainMult_Q8; + gainsID_upper = gainsID; } } else if( nBits < maxBits - 5 ) { found_lower = 1; @@ -273,7 +276,7 @@ TOC(ENCODE_PULSES) /* Adjust gain according to high-rate rate/distortion curve */ opus_int32 gain_factor_Q16; gain_factor_Q16 = silk_log2lin( silk_LSHIFT( nBits - maxBits, 7 ) / psEnc->sCmn.frame_length + SILK_FIX_CONST( 16, 7 ) ); - gain_factor_Q16 = silk_min_32(gain_factor_Q16, SILK_FIX_CONST( 2, 16 ) ); + gain_factor_Q16 = silk_min_32( gain_factor_Q16, SILK_FIX_CONST( 2, 16 ) ); if( nBits > maxBits ) { gain_factor_Q16 = silk_max_32( gain_factor_Q16, SILK_FIX_CONST( 1.3, 16 ) ); } |