ref: b370a938ca09e5d97ae54159cab779c1b34db8f7
parent: 5ead149cf49cc8d2fd0e1fb3c7cd564ecbbce100
author: Jean-Marc Valin <[email protected]>
date: Fri Jun 17 16:58:30 EDT 2016
Fixes an overflow in the constrained VBR code for bitrate>64000
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1281,12 +1281,15 @@
if ((!has_surround_mask||lfe) && (constrained_vbr || bitrate<64000))
{
- opus_val16 rate_factor;
+ opus_val16 rate_factor = Q15ONE;
+ if (bitrate < 64000)
+ {
#ifdef FIXED_POINT
- rate_factor = MAX16(0,(bitrate-32000));
+ rate_factor = MAX16(0,(bitrate-32000));
#else
- rate_factor = MAX16(0,(1.f/32768)*(bitrate-32000));
+ rate_factor = MAX16(0,(1.f/32768)*(bitrate-32000));
#endif
+ }
if (constrained_vbr)
rate_factor = MIN16(rate_factor, QCONST16(0.67f, 15));
target = base_target + (opus_int32)MULT16_32_Q15(rate_factor, target-base_target);