ref: ca5bf5b0496137bc57e3a0dfd0fa829a53736728
parent: 43a287fd758b1e67235f3c1054095749249ff13d
author: Jean-Marc Valin <[email protected]>
date: Mon Nov 18 18:00:36 EST 2013
Don't attenuate hybrid high-band for surround
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1476,11 +1476,14 @@
if( st->silk_mode.bitRate > total_bitRate * 4/5 ) {
st->silk_mode.bitRate = total_bitRate * 4/5;
}
- /* Increasingly attenuate high band when it gets allocated fewer bits */
- 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 < Q15ONE*6/7 ? HB_gain + Q15ONE/7 : Q15ONE;
+ if (!st->energy_masking)
+ {
+ /* Increasingly attenuate high band when it gets allocated fewer bits */
+ 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 < Q15ONE*6/7 ? HB_gain + Q15ONE/7 : Q15ONE;
+ }
} else {
/* SILK gets all bits */
st->silk_mode.bitRate = total_bitRate;