diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-12-09 22:54:41 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-12-10 00:27:13 +0400 |
commit | 66b7fe0a5cb2777a72b3bec6309f9d43daa51fea (patch) | |
tree | fc1662fa98bc16213fc19b01dee1c4f85b6e673f /src | |
parent | 57cd849cf71e6abdfedfea1d381d4e06581015d5 (diff) |
Using celt_inner_prod() for input sanity check.
Diffstat (limited to 'src')
-rw-r--r-- | src/opus_encoder.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c index dd4999b3..c819bb15 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -38,6 +38,7 @@ #include "float_cast.h" #include "opus.h" #include "arch.h" +#include "pitch.h" #include "opus_private.h" #include "os_support.h" #include "cpu_support.h" @@ -1447,9 +1448,8 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ #ifndef FIXED_POINT if (float_api) { - opus_val32 sum=0; - for (i=0;i<frame_size*st->channels;i++) - sum += pcm_buf[total_buffer*st->channels+i]*pcm_buf[total_buffer*st->channels+i]; + opus_val32 sum; + sum = celt_inner_prod(&pcm_buf[total_buffer*st->channels], &pcm_buf[total_buffer*st->channels], frame_size*st->channels); /* This should filter out both NaNs and ridiculous signals that could cause NaNs further down. */ if (!(sum < 1e9)) |