ref: 5eef264f3e264950e6ce5483fa9930c62c529a8c
parent: 4117ff027515f0a85ac88e9b87385efcfa4cad99
author: Jean-Marc Valin <[email protected]>
date: Wed Aug 6 19:06:31 EDT 2008
Solved an encoder/decoder mismatch happening when there's no pulse in the first band
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -286,9 +286,14 @@
const int C = CHANNELS(m);
int id = N0 % (C*B);
/* Here, we assume that id will never be greater than N0, i.e. that
- no band is wider than N0. */
- for (j=0;j<C*N;j++)
- P[j] = Y[id++];
+ no band is wider than N0. In the unlikely case it happens, we set
+ everything to zero */
+ if (id+C*N>N0)
+ for (j=0;j<C*N;j++)
+ P[j] = 0;
+ else
+ for (j=0;j<C*N;j++)
+ P[j] = Y[id++];
}
#define KGAIN 6