[FFmpeg-devel] [PATCH] Add ceil(log2(x)) to libavutil/common.h

Thilo Borgmann thilo.borgmann
Sun Aug 23 13:07:49 CEST 2009


M?ns Rullg?rd schrieb:
> Thilo Borgmann <thilo.borgmann at googlemail.com> writes:
> 
>>>> +/** Computes ceil(log2(x)) using av_log2.
>>>> + * @param x value used to compute ceil(log2(x))
>>>> + * @param computed ceiling of log2(x)
>>>> + */
>>>> +static inline int ceil_log2(int x) {
>>>> +    return x > 1 ? av_log2((x - 1) << 1) : 0;
>>>> +}
>>> if its just ceil(log2(x)) then the x >1 check should not be needed
>>> and "using av_log2()" should be kept more seperate, i mean
>>> API interface vs. implementation
>> Please elaborate "to keep it more separate" in that case... what I it
>> tells me is to duplicate the use of ff_log2_tab - what I think you don't
>> mean with that.
> 
> He means you shouldn't mention av_log2 in the comment.  How the
> calculation happens is irrelevant.
> 
Ok, thanks!

-Thilo



More information about the ffmpeg-devel mailing list