Fixes floating-point bug introduced in be9e747bcc542c277d30f6c78a57b0940e0c5b5e
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 22 Apr 2016 19:10:13 +0000 (15:10 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 22 Apr 2016 19:11:48 +0000 (15:11 -0400)
The effect was to always set HB_gain to 1.

src/opus_encoder.c

index 24d8f89..e7b2f93 100644 (file)
@@ -1513,7 +1513,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
                celt_rate = total_bitRate - st->silk_mode.bitRate;
                HB_gain_ref = (curr_bandwidth == OPUS_BANDWIDTH_SUPERWIDEBAND) ? 3000 : 3600;
                HB_gain = SHL32((opus_val32)celt_rate, 9) / SHR32((opus_val32)celt_rate + st->stream_channels * HB_gain_ref, 6);
-               HB_gain = HB_gain < (opus_int32)Q15ONE*6/7 ? HB_gain + Q15ONE/7 : Q15ONE;
+               HB_gain = HB_gain < (opus_val32)Q15ONE*6/7 ? HB_gain + Q15ONE/7 : Q15ONE;
             }
         } else {
             /* SILK gets all bits */