diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-05-18 23:33:48 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-05-18 23:52:18 -0400 |
commit | b7bd4c20acfd951ba46647e07411285997d952f4 (patch) | |
tree | 62938a5bce642bc1ac25e638a2b3427ee48d8b06 /celt/mathops.h | |
parent | 359306985b69086e260bb4cc9b053ba00f3125d1 (diff) | |
download | opus-b7bd4c20acfd951ba46647e07411285997d952f4.tar.gz |
celt_maxabs16() now returns an opus_val32 to avoid problems with -32768
Diffstat (limited to 'celt/mathops.h')
-rw-r--r-- | celt/mathops.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/celt/mathops.h b/celt/mathops.h index cb0b9c86..18a66be1 100644 --- a/celt/mathops.h +++ b/celt/mathops.h @@ -44,7 +44,7 @@ unsigned isqrt32(opus_uint32 _val); #ifndef OVERRIDE_CELT_MAXABS16 -static inline opus_val16 celt_maxabs16(const opus_val16 *x, int len) +static inline opus_val32 celt_maxabs16(const opus_val16 *x, int len) { int i; opus_val16 maxval = 0; @@ -54,7 +54,7 @@ static inline opus_val16 celt_maxabs16(const opus_val16 *x, int len) maxval = MAX16(maxval, x[i]); minval = MIN16(minval, x[i]); } - return MAX16(maxval,-minval); + return MAX32(EXTEND32(maxval),-EXTEND32(minval)); } #endif |