diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2017-12-31 15:29:28 -0500 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2017-12-31 15:29:28 -0500 |
commit | 693421ea238175e67211ce8a0be8d1db450a9698 (patch) | |
tree | 227f7411927a7471aa09e3479ec1156c5f527d73 | |
parent | ff6532c3be8cc1f7873ee2335869340cc98a525f (diff) | |
download | opus-693421ea238175e67211ce8a0be8d1db450a9698.tar.gz |
Fixes NaN issues in compute_stereo_width()
-rw-r--r-- | src/opus_encoder.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c index f7212336..b89b874b 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -699,6 +699,12 @@ opus_val16 compute_stereo_width(const opus_val16 *pcm, int frame_size, opus_int3 xy += SHR32(pxy, 10); yy += SHR32(pyy, 10); } +#ifndef FIXED_POINT + if (!(xx < 1e9f) || celt_isnan(xx) || !(yy < 1e9f) || celt_isnan(yy)) + { + xy = xx = yy = 0; + } +#endif mem->XX += MULT16_32_Q15(short_alpha, xx-mem->XX); mem->XY += MULT16_32_Q15(short_alpha, xy-mem->XY); mem->YY += MULT16_32_Q15(short_alpha, yy-mem->YY); |