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

Thilo Borgmann thilo.borgmann
Sun Aug 23 12:26:02 CEST 2009


>> +/** 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.

-Thilo



More information about the ffmpeg-devel mailing list