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.
This commit is contained in:
parent
eab134c813
commit
c6d0c43df7
1 changed files with 2 additions and 3 deletions
|
@ -1195,6 +1195,8 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
|
||||||
/* Override the chosen mode to make sure we meet the requested frame size */
|
/* Override the chosen mode to make sure we meet the requested frame size */
|
||||||
if (st->mode != MODE_CELT_ONLY && frame_size < st->Fs/100)
|
if (st->mode != MODE_CELT_ONLY && frame_size < st->Fs/100)
|
||||||
st->mode = MODE_CELT_ONLY;
|
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
|
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)
|
&& st->mode != MODE_CELT_ONLY && st->prev_mode != MODE_CELT_ONLY)
|
||||||
|
@ -1357,10 +1359,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
|
||||||
if (st->mode == MODE_CELT_ONLY && st->bandwidth == OPUS_BANDWIDTH_MEDIUMBAND)
|
if (st->mode == MODE_CELT_ONLY && st->bandwidth == OPUS_BANDWIDTH_MEDIUMBAND)
|
||||||
st->bandwidth = OPUS_BANDWIDTH_WIDEBAND;
|
st->bandwidth = OPUS_BANDWIDTH_WIDEBAND;
|
||||||
if (st->lfe)
|
if (st->lfe)
|
||||||
{
|
|
||||||
st->bandwidth = OPUS_BANDWIDTH_NARROWBAND;
|
st->bandwidth = OPUS_BANDWIDTH_NARROWBAND;
|
||||||
st->mode = MODE_CELT_ONLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Can't support higher than wideband for >20 ms frames */
|
/* 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))
|
if (frame_size > st->Fs/50 && (st->mode == MODE_CELT_ONLY || st->bandwidth > OPUS_BANDWIDTH_WIDEBAND))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue