diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-15 01:41:12 -0500 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-15 01:41:12 -0500 |
commit | d7aadd808fd2d6f2d8f4a5daf8b3ec32a0968e8e (patch) | |
tree | 7aa57d0a29ddb4d5708190fc4510c32cc8784a34 /src | |
parent | c5635d284b489c7705c2357cc4f0601587416b78 (diff) | |
download | libopus-d7aadd808fd2d6f2d8f4a5daf8b3ec32a0968e8e.tar.gz |
Fixes a bug where the encoder was trying to use redundancy in CELT mode
The problem was that forcing CELT-mode for low bitrate CBR was done too late,
after the encoder had decided to use SILK. This was causing redundancy
to be allocated because the encoder didn't realize it was going to keep
using CELT.
Diffstat (limited to 'src')
-rw-r--r-- | src/opus_encoder.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 4304db4a..d2066f04 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1165,6 +1165,9 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ st->mode = MODE_CELT_ONLY; if (st->lfe) st->mode = MODE_CELT_ONLY; + /* If max_data_bytes represents less than 8 kb/s, switch to CELT-only mode */ + if (max_data_bytes < (frame_rate > 50 ? 12000 : 8000)*frame_size / (st->Fs * 8)) + 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) @@ -1319,10 +1322,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ #endif celt_encoder_ctl(celt_enc, OPUS_SET_LSB_DEPTH(lsb_depth)); - /* If max_data_bytes represents less than 8 kb/s, switch to CELT-only mode */ - if (max_data_bytes < (frame_rate > 50 ? 12000 : 8000)*frame_size / (st->Fs * 8)) - st->mode = MODE_CELT_ONLY; - /* CELT mode doesn't support mediumband, use wideband instead */ if (st->mode == MODE_CELT_ONLY && st->bandwidth == OPUS_BANDWIDTH_MEDIUMBAND) st->bandwidth = OPUS_BANDWIDTH_WIDEBAND; |