[FFmpeg-devel] [PATCH] Optimisations for av_log2 and integer clip functions

Michael Niedermayer michaelni
Thu Jan 14 00:10:58 CET 2010


On Wed, Jan 13, 2010 at 07:27:59PM +0000, Mans Rullgard wrote:
> 10% faster flac decoding on x86 and ARM.
[...]
> +#if AV_GCC_VERSION_AT_LEAST(3,4)
> +
> +#ifndef av_log2
> +
> +#define av_log2 av_log2
> +static inline av_const int av_log2(unsigned int v)
> +{
> +    return v? 31 - __builtin_clz(v) : 0;
> +}

isnt that the same as 31 - __builtin_clz(v|1)

also why isnt it a macro?
especially av_log2_16bit() might be feeded with uint16_t and converting
that to unsigned might have some speed penalty

and there is a lot of #ifdefery, not a complaint as i dont know how to
avoid it but i dont really like the amount of it

[..]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100114/7e3620d3/attachment.pgp>



More information about the ffmpeg-devel mailing list