Fixes the stereo_analysis() fixed-point overflow issue properly
This commit is contained in:
parent
7143b2d0ff
commit
14d63d1879
2 changed files with 8 additions and 8 deletions
14
celt/celt.c
14
celt/celt.c
|
@ -860,14 +860,14 @@ static int stereo_analysis(const CELTMode *m, const celt_norm *X,
|
|||
int j;
|
||||
for (j=m->eBands[i]<<LM;j<m->eBands[i+1]<<LM;j++)
|
||||
{
|
||||
opus_val16 L, R, M, S;
|
||||
L = X[j];
|
||||
R = X[N0+j];
|
||||
M = L+R;
|
||||
S = L-R;
|
||||
opus_val32 L, R, M, 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));
|
||||
L = EXTEND32(X[j]);
|
||||
R = EXTEND32(X[N0+j]);
|
||||
M = ADD32(L, R);
|
||||
S = SUB32(L, R);
|
||||
sumLR = ADD32(sumLR, ADD32(ABS32(L), ABS32(R)));
|
||||
sumMS = ADD32(sumMS, ADD32(ABS32(M), ABS32(S)));
|
||||
}
|
||||
}
|
||||
sumMS = MULT16_32_Q15(QCONST16(0.707107f, 15), sumMS);
|
||||
|
|
|
@ -69,7 +69,7 @@ struct OpusDecoder {
|
|||
#ifdef FIXED_POINT
|
||||
static inline opus_int16 SAT16(opus_int32 x) {
|
||||
return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue