Commit cf89d2a6 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Adding a tiny amount of noise when folding to prevent/reduce numerical issues

parent 1111db31
......@@ -1084,7 +1084,14 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c
} else {
/* Folded spectrum */
for (j=0;j<N;j++)
X[j] = lowband[j];
{
celt_word16 tmp;
*seed = lcg_rand(*seed);
/* About 48 dB below the "normal" folding level */
tmp = QCONST16(1.0f/256, 10);
tmp = (*seed)&0x8000 ? tmp : -tmp;
X[j] = lowband[j]+tmp;
}
cm = fill;
}
renormalise_vector(X, N, gain);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment