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

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy B. Terriberry <tterribe@xiph.org>2011-02-01 12:55:01 +0300
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2011-02-01 14:35:14 +0300
commit411a84faeada5092e2e94d8116b8adba45808183 (patch)
treeee132bb65182fc2f1c31b11bf79e20c1754bfb2c
parent4499263b444645cba4b616e0d8cc85d280695933 (diff)
Add a seprate qtheta offset for two-phase stereo.
9b34bd83 caused serious regressions for 240-sample frame stereo, because the previous qb limit was _always_ hit for two-phase stereo. Two-phase stereo really does operate with a different model (for example, the single bit allocated to the side should really probably be thought of as a sign bit for qtheta, but we don't count it as part of qtheta's allocation). The old code was equivalent to a separate two-phase offset of 12, however Greg Maxwell's testing demonstrates that 16 performs best.
-rw-r--r--libcelt/bands.c2
-rw-r--r--libcelt/rate.c2
-rw-r--r--libcelt/rate.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/libcelt/bands.c b/libcelt/bands.c
index 2102dfd..64e53fd 100644
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -769,7 +769,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c
/* Decide on the resolution to give to the split parameter theta */
pulse_cap = m->logN[i]+(LM<<BITRES);
- offset = (pulse_cap>>1) - (stereo ? QTHETA_OFFSET_STEREO : QTHETA_OFFSET);
+ offset = (pulse_cap>>1) - (stereo&&N==2 ? QTHETA_OFFSET_TWOPHASE : QTHETA_OFFSET);
qn = compute_qn(N, b, offset, pulse_cap, stereo);
if (stereo && i>=intensity)
qn = 1;
diff --git a/libcelt/rate.c b/libcelt/rate.c
index 2235013..15f1a88 100644
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -212,7 +212,7 @@ void compute_pulse_cache(CELTMode *m, int LM)
if (C==2)
{
max_bits <<= 1;
- offset = (m->logN[j]+(i<<BITRES)>>1)-QTHETA_OFFSET_STEREO;
+ offset = (m->logN[j]+(i<<BITRES)>>1)-(N==2?QTHETA_OFFSET_TWOPHASE:QTHETA_OFFSET);
ndof = 2*N-1-(N==2);
/* The average measured cost for theta with the step PDF is
0.95164 times qb, approximated here as 487/512. */
diff --git a/libcelt/rate.h b/libcelt/rate.h
index eabba93..d5f188d 100644
--- a/libcelt/rate.h
+++ b/libcelt/rate.h
@@ -43,7 +43,7 @@
#define BITRES 3
#define FINE_OFFSET 21
#define QTHETA_OFFSET 4
-#define QTHETA_OFFSET_STEREO 4
+#define QTHETA_OFFSET_TWOPHASE 16
#define BITOVERFLOW 30000