diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-06-08 09:33:56 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-06-08 09:33:56 +0300 |
commit | 7a669094e9c4766b5e48a257f4d9218874da5fb7 (patch) | |
tree | 28ab0d3502a366048dd69332960e9f404c6a5a75 | |
parent | 36373cb8256b407f07aa376593ba0678dd259c62 (diff) |
Fixes equiv_rate for CBR
-rw-r--r-- | celt/celt_encoder.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index 52c2b7dd..c2fb61b5 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -1365,7 +1365,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, opus_val16 surround_masking=0; opus_val16 temporal_vbr=0; opus_val16 surround_trim = 0; - opus_int32 equiv_rate = 510000; + opus_int32 equiv_rate; int hybrid; VARDECL(opus_val16, surround_dynalloc); ALLOC_STACK; @@ -1461,8 +1461,9 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, (tmp+4*mode->Fs)/(8*mode->Fs)-!!st->signalling)); effectiveBytes = nbCompressedBytes - nbFilledBytes; } + equiv_rate = ((opus_int32)nbCompressedBytes*8*50 >> (3-LM)) - (40*C+20)*((400>>LM) - 50); if (st->bitrate != OPUS_BITRATE_MAX) - equiv_rate = st->bitrate - (40*C+20)*((400>>LM) - 50); + equiv_rate = IMIN(equiv_rate, st->bitrate - (40*C+20)*((400>>LM) - 50)); if (enc==NULL) { |