[libav-devel] prores micro-opt suggestion
Måns Rullgård
mans at mansr.com
Thu Nov 24 15:18:10 CET 2011
Luca Barbato <lu_zero at gentoo.org> writes:
> On 24/11/11 12:03, Robert Nagy wrote:
>> Just scrolling through the prores code. And found a possible minor
>> optimization. Don't have a setup for compiling right now so I can't measure
>> the perf diff.
>>
>> In static inline int decode_vlc_codeword(GetBitContext *gb, uint8_t
>> codebook)
>>
>> Replace:
>>
>>> log = 31 - av_log2(buf) /* count prefix bits (zeroes) */
>>
>> with something like:
>>
>>> #ifdef X86
>>> #define NLZ(x) // use BSR instruction
>>> #else
>>> #define NLZ(x) 31 - av_log2_c(x)
>>> #endif
>>>
>>> log = NLZ(buf); /* count prefix bits (zeroes) */
>
> If the compiler doesn't do that for us, might be useful adding a
> mathop for it.
av_log2() already uses __builtin_clz() if available.
--
Måns Rullgård
mans at mansr.com
More information about the libav-devel
mailing list