diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-24 23:59:09 -0500 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-25 00:03:31 -0500 |
commit | a47d6f308ffe7a002cb9d903b2d5466854fa05fb (patch) | |
tree | 3c4df9fa042e5f030135a6442fb754d499132607 | |
parent | f4d2c034a629726cf5978fdcac7f60c0af2e3add (diff) | |
download | opus-a47d6f308ffe7a002cb9d903b2d5466854fa05fb.tar.gz |
Intensity stereo update, partially based on Monty's listening
Intensity stereo is now based on equiv_rate and should no longer oscillate
in hybrid mode. Also, there is now a separate set of thresholds for
surround tuned by Monty. The non-surround thresholds were also updated at
low bitrate to be closer to what Monty found for surround.
-rw-r--r-- | celt/celt_encoder.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index 330e7867..a424aae6 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -1804,25 +1804,21 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, if (C==2) { - int effectiveRate; - - static const opus_val16 intensity_thresholds[21]= + int surround; + static const opus_val16 intensity_thresholds[2][21]= /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 off*/ - { 16,21,23,25,27,29,31,33,35,38,42,46,50,54,58,63,68,75,84,102,130}; + {{ 1, 2, 3, 4, 5, 6, 7,20,26,30,36,44,50,56,62,67,72,79,88,106,134}, + { 1, 2, 3, 4, 5, 6, 7,12,16,18,24,30,36,42,48,54,60,66,80, 98,120}}; static const opus_val16 intensity_histeresis[21]= - { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 8, 12}; + { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 5, 6, 8, 8}; /* Always use MS for 2.5 ms frames until we can do a better analysis */ if (LM!=0) dual_stereo = stereo_analysis(mode, X, LM, N); - /* Account for coarse energy */ - effectiveRate = (8*effectiveBytes - 80)>>LM; - - /* effectiveRate in kb/s */ - effectiveRate = 2*effectiveRate/5; - - st->intensity = hysteresis_decision((opus_val16)effectiveRate, intensity_thresholds, intensity_histeresis, 21, st->intensity); + surround = st->energy_mask!=NULL; + st->intensity = hysteresis_decision((opus_val16)equiv_rate/1000, + intensity_thresholds[surround], intensity_histeresis, 21, st->intensity); st->intensity = IMIN(st->end,IMAX(st->start, st->intensity)); } |