Fixes two fixed-point overflow issues

One in SILK, one in CELT, none of them causing real harm in practice it seems
This commit is contained in:
Jean-Marc Valin 2012-05-10 12:36:46 -04:00
parent 9faea25d29
commit 1a9e8539d3
2 changed files with 5 additions and 4 deletions

View file

@ -865,8 +865,9 @@ static int stereo_analysis(const CELTMode *m, const celt_norm *X,
R = X[N0+j];
M = L+R;
S = L-R;
sumLR += EXTEND32(ABS16(L)) + EXTEND32(ABS16(R));
sumMS += EXTEND32(ABS16(M)) + EXTEND32(ABS16(S));
/* We cast to 32-bit first because of the -32768 case */
sumLR += ABS32(EXTEND32(L)) + ABS32(EXTEND32(R));
sumMS += ABS32(EXTEND32(M)) + ABS32(EXTEND32(S));
}
}
sumMS = MULT16_32_Q15(QCONST16(0.707107f, 15), sumMS);