shithub: opus

Download patch

ref: 66b7fe0a5cb2777a72b3bec6309f9d43daa51fea
parent: 57cd849cf71e6abdfedfea1d381d4e06581015d5
author: Jean-Marc Valin <[email protected]>
date: Mon Dec 9 08:54:41 EST 2013

Using celt_inner_prod() for input sanity check.

--- 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 @@
 #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))