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

Michael Niedermayer michaelni
Sun Aug 23 05:31:56 CEST 2009


On Sat, Aug 22, 2009 at 11:39:24PM +0200, Thilo Borgmann wrote:
> As in $subject, adds a new helper function to libavutil/common.h.
> 
> Regards,
> Thilo

>  common.h |    8 ++++++++
>  1 file changed, 8 insertions(+)
> f4d037267d363cf4dbd5c1900fc77fbccfc7322f  ceillog2.patch
> 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) {
> +    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


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090823/08f1b4df/attachment.pgp>



More information about the ffmpeg-devel mailing list