shithub: opus

Download patch

ref: 702458ac82fed18aff23c50ca5a8986fe7c8ca86
parent: f22af9cfcb0898af019cf1e0bb33fb4740a3e4e2
author: Jean-Marc Valin <[email protected]>
date: Mon Nov 5 19:24:46 EST 2012

Should make celt_maxabs*() slightly faster

shorter dependencies

--- a/celt/mathops.h
+++ b/celt/mathops.h
@@ -48,9 +48,13 @@
 {
    int i;
    opus_val16 maxval = 0;
+   opus_val16 minval = 0;
    for (i=0;i<len;i++)
-      maxval = MAX16(maxval, ABS16(x[i]));
-   return maxval;
+   {
+      maxval = MAX16(maxval, x[i]);
+      minval = MIN16(minval, x[i]);
+   }
+   return MAX16(maxval,-minval);
 }
 #endif
 
@@ -60,9 +64,13 @@
 {
    int i;
    opus_val32 maxval = 0;
+   opus_val32 minval = 0;
    for (i=0;i<len;i++)
-      maxval = MAX32(maxval, ABS32(x[i]));
-   return maxval;
+   {
+      maxval = MAX32(maxval, x[i]);
+      minval = MIN32(minval, x[i]);
+   }
+   return MAX32(maxval, -minval);
 }
 #else
 #define celt_maxabs32(x,len) celt_maxabs16(x,len)