MIPS optimizations
[opus.git] / celt / pitch.h
index a1074ef..b199976 100644 (file)
 #include "x86/pitch_sse.h"
 #endif
 
+#if defined(MIPSr1_ASM)
+#include "mips/pitch_mipsr1.h"
+#endif
+
 #if defined(OPUS_ARM_ASM) && defined(FIXED_POINT)
 # include "arm/pitch_arm.h"
 #endif
@@ -61,6 +65,7 @@ static OPUS_INLINE void xcorr_kernel(const opus_val16 * x, const opus_val16 * y,
 {
    int j;
    opus_val16 y_0, y_1, y_2, y_3;
+   celt_assert(len>=3);
    y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
    y_0=*y++;
    y_1=*y++;
@@ -140,6 +145,18 @@ static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y
 }
 #endif
 
+#ifndef OVERRIDE_CELT_INNER_PROD
+static OPUS_INLINE opus_val32 celt_inner_prod(const opus_val16 *x, const opus_val16 *y,
+      int N)
+{
+   int i;
+   opus_val32 xy=0;
+   for (i=0;i<N;i++)
+      xy = MAC16_16(xy, x[i], y[i]);
+   return xy;
+}
+#endif
+
 #ifdef FIXED_POINT
 opus_val32
 #else
@@ -167,30 +184,6 @@ void
 #  define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
   ((void)(arch),celt_pitch_xcorr_c(_x, _y, xcorr, len, max_pitch))
 # endif
-#else
-
-/*static inline opus_val32 real_celt_pitch_xcorr(const opus_val16 *_x,
- const opus_val16 *_y,opus_val32 *xcorr,int len,int max_pitch,int arch){
-  opus_val32 *xcorr_tmp;
-  opus_val32  ret_tmp;
-  opus_val32  ret;
-  int         i;
-  xcorr_tmp=(opus_val32 *)malloc(max_pitch*sizeof(*xcorr));
-  ret_tmp=celt_pitch_xcorr_c(_x,_y,xcorr_tmp,len,max_pitch);
-  ret=celt_pitch_xcorr(_x,_y,xcorr,len,max_pitch,arch);
-  for(i=0;i<max_pitch;i++)if(xcorr[i]!=xcorr_tmp[i]){
-    fprintf(stderr,"xcorr[%i] (0x%08X) != xcorr_tmp[%i] (0x%08X)\n",
-     i,xcorr[i],i,xcorr_tmp[i]);
-  }
-  if(ret!=ret_tmp){
-    fprintf(stderr,"ret (0x%08X) != ret_tmp (0x%08X)\n",ret,ret_tmp);
-  }
-  return ret_tmp;
-}
-
-#undef celt_pitch_xcorr
-#define celt_pitch_xcorr real_celt_pitch_xcorr*/
-
 #endif
 
 #endif