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>2012-12-13 00:16:27 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-12-13 00:30:23 +0400
commit1122d299ab7427c43f6dd7f549d6d39eafe97a86 (patch)
tree6ae33374527c1561becaa5f7361e490ca78e02b8
parentb33db8f3182e847bfef28360962625a024875d5f (diff)
Makes "stereo savings" less aggressive on mono or near-mono.
The max reduction now depends on intensity threshold too.
-rw-r--r--celt/celt_encoder.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c
index fd4a821a..d9fb2a51 100644
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1548,11 +1548,15 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
{
int coded_stereo_bands;
int coded_stereo_dof;
+ opus_val16 max_frac;
coded_stereo_bands = IMIN(st->intensity, coded_bands);
coded_stereo_dof = (eBands[coded_stereo_bands]<<LM)-coded_stereo_bands;
+ /* Maximum fraction of the bits we can save if the signal is mono. */
+ max_frac = DIV32_16(MULT16_16(QCONST16(0.8f, 15), coded_stereo_dof), coded_bins);
/*printf("%d %d %d ", coded_stereo_dof, coded_bins, tot_boost);*/
- target -= MIN32(target/3, SHR16(MULT16_16(st->stereo_saving,(coded_stereo_dof<<BITRES)),8));
- target += MULT16_16_Q15(QCONST16(0.035,15),coded_stereo_dof<<BITRES);
+ target -= MIN32(MULT16_32_Q15(max_frac,target),
+ SHR16(MULT16_16(st->stereo_saving,(coded_stereo_dof<<BITRES)),8));
+ target += MULT16_16_Q15(QCONST16(0.1f,15),coded_stereo_dof<<BITRES);
}
/* Limits starving of other bands when using dynalloc */
target += tot_boost;