Use the Daala implementation of OD_ILOG().

The Daala implementation of OD_ILOG(x) computes the number of bits
 necessary to represent the unsigned integer x in two's compliment.
We adjust the computation in od_dering.c to better approximate the
 log base 2 and match the previous OD_ILOG() definition.
This commit makes no change to the bitstream.

Change-Id: Ib75c2f47dca7027b3cfc40b110f2d493f9690c9c
diff --git a/vp10/common/od_dering.c b/vp10/common/od_dering.c
index 8b410e1..cc16d7e 100644
--- a/vp10/common/od_dering.c
+++ b/vp10/common/od_dering.c
@@ -236,7 +236,7 @@
       v1 = OD_MINI(32767, var[by][bx] >> 6);
       v2 = OD_MINI(32767, sb_var/(OD_BSIZE_MAX*OD_BSIZE_MAX));
       thresh[by][bx] = threshold*OD_THRESH_TABLE_Q8[OD_CLAMPI(0,
-       OD_ILOG(v1*v2) - 9, 17)] >> 8;
+       OD_ILOG(v1*v2) - 10, 17)] >> 8;
     }
   }
 }
diff --git a/vp10/common/odintrin.h b/vp10/common/odintrin.h
index 80e6e72..38ffa6b 100644
--- a/vp10/common/odintrin.h
+++ b/vp10/common/odintrin.h
@@ -24,11 +24,13 @@
 #define OD_MINI VPXMIN
 #define OD_CLAMPI(min, val, max) clamp((val), (min), (max))
 
-#  define OD_ILOG_NZ(x) get_msb(x)
+# define OD_CLZ0 (1)
+# define OD_CLZ(x) (-get_msb(x))
+# define OD_ILOG_NZ(x) (OD_CLZ0 - OD_CLZ(x))
 /*Note that __builtin_clz is not defined when x == 0, according to the gcc
- *    documentation (and that of the x86 BSR instruction that implements it), so
- *       we have to special-case it.
- *         We define a special version of the macro to use when x can be zero.*/
-#  define OD_ILOG(x) ((x) ? OD_ILOG_NZ(x) : 0)
+   documentation (and that of the x86 BSR instruction that implements it), so
+   we have to special-case it.
+  We define a special version of the macro to use when x can be zero.*/
+# define OD_ILOG(x) (OD_ILOG_NZ(x) & -!!(x))
 
 #endif
diff --git a/vp10/vp10_common.mk b/vp10/vp10_common.mk
index b01ffd4..92338f5 100644
--- a/vp10/vp10_common.mk
+++ b/vp10/vp10_common.mk
@@ -66,6 +66,7 @@
 VP10_COMMON_SRCS-yes += common/od_dering.h
 VP10_COMMON_SRCS-yes += common/dering.c
 VP10_COMMON_SRCS-yes += common/dering.h
+VP10_COMMON_SRCS-yes += common/odintrin.h
 
 ifneq ($(CONFIG_VPX_HIGHBITDEPTH),yes)
 VP10_COMMON_SRCS-$(HAVE_DSPR2)  += common/mips/dspr2/itrans4_dspr2.c