[FFmpeg-devel] [PATCH] simplify GET_UTF8 to use ff_log2_tab
Sun Dec 9 15:50:03 CET 2007
On Sun, Dec 09, 2007 at 03:38:14PM +0100, Michael Niedermayer wrote:
> On Sun, Dec 09, 2007 at 11:09:25AM +0100, Reimar D?ffinger wrote:
> > 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.
> > Comments?
> put a extern whatever ff_log2_tab; in GET_UTF8()
Done, but I just realized that's a bit stupid, common.h already does
extern const uint8_t ff_log2_tab;
so it is actually redundant as long as GET_UTF8 is in that file and
causes redeclaration compiler warnings.
Unless we'd want to move that extern into the av_log2 and av_log2_16bit
functions, but I doubt that is a good idea either.
-------------- next part --------------
--- libavutil/common.h (revision 11199)
+++ libavutil/common.h (working copy)
@@ -236,7 +236,8 @@
#define GET_UTF8(val, GET_BYTE, ERROR)\
- int ones= 7 - av_log2(val ^ 255);\
+ extern const uint8_t ff_log2_tab;\
+ int ones= 7 - ff_log2_tab[(uint8_t)~val];\
More information about the ffmpeg-devel