summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-06-06 13:44:01 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-06-06 13:44:01 -0400
commit8b0ceaf9390145c65ecf6f8dfa7742abdedef8ef (patch)
treeb43d0be7a2c851bd0ee973b732e91bbfc1ab28ce
parentd896a97ea6a143e09458e3e61b98e8facfa6e7b4 (diff)
downloadopus-8b0ceaf9390145c65ecf6f8dfa7742abdedef8ef.tar.gz
Bitstream change: prevent noise injection in hybrid mode
This makes it possible to use folding rather than LCG noise in the second CELT band (9.6 to 12 kHz) in hybrid mode.
-rw-r--r--celt/bands.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/celt/bands.c b/celt/bands.c
index 22a0034b..43a8b0be 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -1445,9 +1445,17 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
b = 0;
}
- if (resynth && M*eBands[i]-N >= M*eBands[start] && (update_lowband || lowband_offset==0))
+ if (resynth && (M*eBands[i]-N >= M*eBands[start] || i==start+1) && (update_lowband || lowband_offset==0))
lowband_offset = i;
-
+ if (i == start+1)
+ {
+ int n1, n2;
+ n1 = M*(eBands[start+1]-eBands[start]);
+ n2 = M*(eBands[start+2]-eBands[start+1]);
+ /* Duplicate enough of the first band folding data to be able to fold the second band.
+ Copies no data for CELT-only mode. */
+ OPUS_COPY(&norm[n1], &norm[2*n1 - n2], n2-n1);
+ }
tf_change = tf_res[i];
ctx.tf_change = tf_change;
if (i>=m->effEBands)