Skip to content
Snippets Groups Projects
Commit 49ca22aa authored by Nathan Egge's avatar Nathan Egge Committed by Yaowu Xu
Browse files

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
parent 85187243
No related branches found
No related tags found
No related merge requests found
......@@ -236,7 +236,7 @@ static void od_compute_thresh(int thresh[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS],
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;
}
}
}
......
......@@ -24,11 +24,13 @@ typedef int16_t dering_in;
#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
......@@ -66,6 +66,7 @@ VP10_COMMON_SRCS-yes += common/od_dering.c
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment