summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-04-22 16:13:46 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-06-29 15:21:31 -0400
commit37570a7996b3f0a25a18aa33691abe3bfaf44fc1 (patch)
tree3948f684ddf5a8c661dca50395b5283b14aaf1aa
parentfb6292e8374d1db304c77b1d6d3bd5c4b21c20dd (diff)
downloadopus-37570a7996b3f0a25a18aa33691abe3bfaf44fc1.tar.gz
Re-enabling high-band attenuation for hybrid mode
The new attenuation is much smaller than previously.
-rw-r--r--src/opus_encoder.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index ef713ac8..c5c26e93 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1539,7 +1539,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
/* Distribute bits between SILK and CELT */
total_bitRate = 8 * bytes_target * frame_rate;
if( st->mode == MODE_HYBRID ) {
- int HB_gain_ref;
/* Base rate for SILK */
st->silk_mode.bitRate = compute_silk_rate_for_hybrid(total_bitRate,
curr_bandwidth, st->Fs == 50 * frame_size, st->use_vbr);
@@ -1547,10 +1546,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
{
/* 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 < (opus_val32)Q15ONE*6/7 ? HB_gain + Q15ONE/7 : Q15ONE;
- HB_gain = Q15ONE;
+ HB_gain = Q15ONE - SHR32(celt_exp2(-celt_rate * QCONST16(1.f/1024, 10)), 1);
}
} else {
/* SILK gets all bits */