shithub: opus

Download patch

ref: 83006eec60ee90fe85081c8d7edcfe16aa5db50e
parent: 983f6387e05311b59b60467353d0794e1a5be2f3
author: Jean-Marc Valin <[email protected]>
date: Fri Mar 21 06:40:43 EDT 2008

fixed-point: using TI intrinsic for celt_ilog2() if available.

--- a/libcelt/fixed_c5x.h
+++ b/libcelt/fixed_c5x.h
@@ -59,4 +59,7 @@
 #undef MULT_16_16
 #define MULT_16_16(a,b) _lmpy(a,b)
 
+#define celt_ilog2(x) (30 - _lnorm(x))
+#define OVERRIDE_CELT_ILOG2
+
 #endif /* FIXED_C5X_H */
--- a/libcelt/mathops.h
+++ b/libcelt/mathops.h
@@ -55,6 +55,7 @@
 #include "entcode.h"
 #include "os_support.h"
 
+#ifndef OVERRIDE_CELT_ILOG2
 /** Integer log in base2. Undefined for zero and negative numbers */
 static inline celt_int16_t celt_ilog2(celt_word32_t x)
 {
@@ -61,6 +62,8 @@
    celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers");
    return EC_ILOG(x)-1;
 }
+#endif
+
 
 /** Integer log in base2. Defined for zero, but not for negative numbers */
 static inline celt_int16_t celt_zlog2(celt_word32_t x)