[FFmpeg-cvslog] r19747 - trunk/libavutil/common.h
jbr
subversion
Sun Aug 30 17:50:03 CEST 2009
Author: jbr
Date: Sun Aug 30 17:50:03 2009
New Revision: 19747
Log:
Add function to compute ceil(log2(x)).
Patch by Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
Modified:
trunk/libavutil/common.h
Modified: trunk/libavutil/common.h
==============================================================================
--- trunk/libavutil/common.h Sun Aug 30 12:54:16 2009 (r19746)
+++ trunk/libavutil/common.h Sun Aug 30 17:50:03 2009 (r19747)
@@ -225,6 +225,15 @@ static inline av_const float av_clipf(fl
else return a;
}
+/** Computes ceil(log2(x)).
+ * @param x value used to compute ceil(log2(x))
+ * @return computed ceiling of log2(x)
+ */
+static inline av_const int av_ceil_log2(int x)
+{
+ return av_log2((x - 1) << 1);
+}
+
#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-cvslog
mailing list