[FFmpeg-devel] [PATCH] Optimisations for av_log2 and integer clip functions
Thu Jan 14 00:29:52 CET 2010
Michael Niedermayer <michaelni at gmx.at> writes:
> 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?
With my version it would evaluate the argument twice. That's
obviously not an issue with yours. Does it matter much?
> especially av_log2_16bit() might be feeded with uint16_t and converting
> that to unsigned might have some speed penalty
I doubt that very much. We're not targeting 16-bit machines.
> 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
I couldn't think of a way with less of it.
mans at mansr.com
More information about the ffmpeg-devel