[FFmpeg-devel] [PATCH] simplify GET_UTF8 to use ff_log2_tab

Reimar Döffinger Reimar.Doeffinger
Sun Dec 9 11:09:25 CET 2007

currently GET_UTF8 calls av_log2 which is simply overkill,
since we only care about the lowest 8 bits.
This may be intentional since my suggestion would be problematic
if GET_UTF8 should become part of the public API, since ff_log2_tab
is not public.
A possibility would be to at least use av_log2_16bit or better add a
public av_log2_8bit.

Reimar D?ffinger
-------------- next part --------------
Index: libavutil/common.h
--- libavutil/common.h	(revision 11160)
+++ libavutil/common.h	(working copy)
@@ -236,7 +236,7 @@
 #define GET_UTF8(val, GET_BYTE, ERROR)\
     val= GET_BYTE;\
-        int ones= 7 - av_log2(val ^ 255);\
+        int ones= 7 - ff_log2_tab[(uint8_t)~val];\
         val&= 127>>ones;\

More information about the ffmpeg-devel mailing list