Commit 70259737 authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

opus_pvq: prevent division by 0

res was 0 and divided K which made it infinity which caused K to
overflow.
Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
parent e01c32f2
......@@ -397,7 +397,7 @@ static void celt_pvq_search(float *X, int *y, int K, int N)
for (i = 0; i < N; i++)
res += FFABS(X[i]);
res = K/res;
res = K/(res + FLT_EPSILON);
for (i = 0; i < N; i++) {
y[i] = lrintf(res*X[i]);
......
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