[x264-devel] commit: Fix x264_clz on inputs > 1<<31 (Loren Merritt )

git version control git at videolan.org
Thu Jan 14 04:05:52 CET 2010


x264 | branch: master | Loren Merritt <pengvado at akuvian.org> | Thu Jan 14 03:07:30 2010 +0000| [b9823cafed9e0cbc887e5fbc27b78a892cb43de1] | committer: Loren Merritt 

Fix x264_clz on inputs > 1<<31
(though x264 never generates such inputs)

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=b9823cafed9e0cbc887e5fbc27b78a892cb43de1
---

 common/osdep.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/osdep.h b/common/osdep.h
index 14f06a8..0c8623e 100644
--- a/common/osdep.h
+++ b/common/osdep.h
@@ -203,7 +203,7 @@ static ALWAYS_INLINE uint16_t endian_fix16( uint16_t x )
 static int ALWAYS_INLINE x264_clz( uint32_t x )
 {
     static uint8_t lut[16] = {4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};
-    int y, z = ((x - 0x10000) >> 27) & 16;
+    int y, z = (((x >> 16) - 1) >> 27) & 16;
     x >>= z^16;
     z += y = ((x - 0x100) >> 28) & 8;
     x >>= y^8;



More information about the x264-devel mailing list