shithub: opus

Download patch

ref: 933a2754fcc724d218b6fa041aa7281cd759dafa
parent: 5a6e7c8b2f40cf13f74f061422fc29710beccfb3
author: Koen Vos <[email protected]>
date: Mon Mar 11 09:30:47 EDT 2013

High-band attenuation tuning for hybrid mode

Signed-off-by: Jean-Marc Valin <[email protected]>

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1364,8 +1364,9 @@
             }
             /* 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) ? 2000 : 2400;
-            HB_gain = SHL32((opus_val32)celt_rate, 9) / SHR32((opus_val32)celt_rate + st->stream_channels*HB_gain_ref, 6);
+            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;