diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2015-12-03 14:12:01 -0500 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2015-12-04 13:45:57 -0500 |
commit | eda57aa3868c6606eacb3580e0cf75fe48e2a26d (patch) | |
tree | 2f5fa5d61f05802e4eba6b074b53105a9acde799 | |
parent | 60fcfd59541bab7189cc416f2f5692bfbb534f32 (diff) | |
download | opus-eda57aa3868c6606eacb3580e0cf75fe48e2a26d.tar.gz |
Fixes the transient detector on silence
Previously silence would cause the divide approximation on 0/0 to return a
very large value, which would be interpreted as a transient
-rw-r--r-- | celt/celt_encoder.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index 1c9dbcb2..1bb46800 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -343,9 +343,9 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int { int id; #ifdef FIXED_POINT - id = IMAX(0,IMIN(127,MULT16_32_Q15(tmp[i],norm))); /* Do not round to nearest */ + id = MAX32(0,MIN32(127,MULT16_32_Q15(tmp[i]+EPSILON,norm))); /* Do not round to nearest */ #else - id = IMAX(0,IMIN(127,(int)floor(64*norm*tmp[i]))); /* Do not round to nearest */ + id = (int)MAX32(0,MIN32(127,floor(64*norm*(tmp[i]+EPSILON)))); /* Do not round to nearest */ #endif unmask += inv_table[id]; } |