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

Alex Converse alex.converse
Sun Aug 23 00:44:05 CEST 2009


On Sat, Aug 22, 2009 at 5:39 PM, Thilo
Borgmann<thilo.borgmann at googlemail.com> wrote:
> [...]
> Index: libavutil/common.h
> ===================================================================
> --- libavutil/common.h ?(revision 19681)
> +++ libavutil/common.h ?(working copy)
> @@ -225,6 +225,14 @@
> ? ? else ? ? ? ? ? ? ? return a;
> ?}
>
> +/** 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) {

An av_const attribute might be helpful?

> + ? ?return x > 1 ? av_log2((x - 1) << 1) : 0;
> +}
> +
> ?#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
> ?#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))



More information about the ffmpeg-devel mailing list