diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-05-17 14:15:31 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-05-17 14:15:31 -0400 |
commit | 6e277c629183ac2c8cf79fc1422e566f68b5df3e (patch) | |
tree | 77f54b98203604b9d2ec56d64488ab4ac51d2dd0 | |
parent | 278389defeeb9ea26100ca8f4783f44c9b446fa5 (diff) | |
download | opus-6e277c629183ac2c8cf79fc1422e566f68b5df3e.tar.gz |
Conservative use of bandwidth detection in CELT
Takes into account the bitrate.
-rw-r--r-- | celt/celt_encoder.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index 7347cb31..cb0cec20 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -1736,7 +1736,20 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, signalBandwidth = st->end-1; #ifndef FIXED_POINT if (st->analysis.valid) - signalBandwidth = st->analysis.bandwidth; + { + int min_bandwidth; + if (st->bitrate < (opus_int32)32000*C) + min_bandwidth = 13; + else if (st->bitrate < (opus_int32)48000*C) + min_bandwidth = 16; + else if (st->bitrate < (opus_int32)60000*C) + min_bandwidth = 18; + else if (st->bitrate < (opus_int32)80000*C) + min_bandwidth = 19; + else + min_bandwidth = 20; + signalBandwidth = IMAX(st->analysis.bandwidth, min_bandwidth); + } #endif codedBands = compute_allocation(mode, st->start, st->end, offsets, cap, alloc_trim, &st->intensity, &dual_stereo, bits, &balance, pulses, |