ref: c6d0c43df7836e59e34b07ea5c8077718593e708
parent: eab134c813725976181d6d66608d55597cea1e6f
author: Jean-Marc Valin <[email protected]>
date: Mon Oct 14 13:33:53 EDT 2013
Fixes weird LFE bug The LFE encoder would first decide to switch to SILK, and allocated redundancy bytes. Then, it would force CELT because of LFE, but keep the redundancy allocation, and end up with too few bytes, that would end up being padded to the desired size for CBR.
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1195,6 +1195,8 @@
/* Override the chosen mode to make sure we meet the requested frame size */
if (st->mode != MODE_CELT_ONLY && frame_size < st->Fs/100)
st->mode = MODE_CELT_ONLY;
+ if (st->lfe)
+ st->mode = MODE_CELT_ONLY;
if (st->stream_channels == 1 && st->prev_channels ==2 && st->silk_mode.toMono==0
&& st->mode != MODE_CELT_ONLY && st->prev_mode != MODE_CELT_ONLY)
@@ -1357,10 +1359,7 @@
if (st->mode == MODE_CELT_ONLY && st->bandwidth == OPUS_BANDWIDTH_MEDIUMBAND)
st->bandwidth = OPUS_BANDWIDTH_WIDEBAND;
if (st->lfe)
- {
st->bandwidth = OPUS_BANDWIDTH_NARROWBAND;
- st->mode = MODE_CELT_ONLY;
- }
/* Can't support higher than wideband for >20 ms frames */
if (frame_size > st->Fs/50 && (st->mode == MODE_CELT_ONLY || st->bandwidth > OPUS_BANDWIDTH_WIDEBAND))