Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2011-11-07 23:58:20 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-03-06 05:45:02 +0400
commite7f1a911c0ed423914433218af2cc2b33190f4ed (patch)
tree4c632194e39ebabb9e72af4dbe28e3c9dda653c5
parent873fc5b04b25d44d4d4276e7842be0a827ce832b (diff)
Unconstrained VBR no longer attempt to hit an average rate
-rw-r--r--celt/celt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/celt/celt.c b/celt/celt.c
index 44732a20..d008417f 100644
--- a/celt/celt.c
+++ b/celt/celt.c
@@ -1384,7 +1384,9 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f
opus_int32 min_allowed;
int lm_diff = st->mode->maxLM - LM;
- target = vbr_rate + (st->vbr_offset>>lm_diff) - ((40*C+20)<<BITRES);
+ target = vbr_rate - ((40*C+20)<<BITRES);
+ if (st->constrained_vbr)
+ target += (st->vbr_offset>>lm_diff);
/* Shortblocks get a large boost in bitrate, but since they
are uncommon long blocks are not greatly affected */
@@ -1438,8 +1440,11 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f
/*printf ("%d\n", st->vbr_reservoir);*/
/* Compute the offset we need to apply in order to reach the target */
- st->vbr_drift += (opus_int32)MULT16_32_Q15(alpha,(delta*(1<<lm_diff))-st->vbr_offset-st->vbr_drift);
- st->vbr_offset = -st->vbr_drift;
+ if (st->constrained_vbr)
+ {
+ st->vbr_drift += (opus_int32)MULT16_32_Q15(alpha,(delta*(1<<lm_diff))-st->vbr_offset-st->vbr_drift);
+ st->vbr_offset = -st->vbr_drift;
+ }
/*printf ("%d\n", st->vbr_drift);*/
if (st->constrained_vbr && st->vbr_reservoir < 0)