Fixes folding
diff --git a/celt/bands.c b/celt/bands.c
index a283b43..f0cc19b 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -1460,6 +1460,8 @@
/* 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);
+ if (C==2)
+ OPUS_COPY(&norm2[n1], &norm2[2*n1 - n2], n2-n1);
}
tf_change = tf_res[i];
ctx.tf_change = tf_change;
@@ -1485,7 +1487,7 @@
fold_start = lowband_offset;
while(M*eBands[--fold_start] > effective_lowband+norm_offset);
fold_end = lowband_offset-1;
- while(M*eBands[++fold_end] < effective_lowband+norm_offset+N);
+ while(++fold_end < i && M*eBands[fold_end] < effective_lowband+norm_offset+N);
x_cm = y_cm = 0;
fold_i = fold_start; do {
x_cm |= collapse_masks[fold_i*C+0];