diff options
author | Thilo Borgmann <thilo.borgmann@googlemail.com> | 2009-08-30 15:50:03 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2009-08-30 15:50:03 +0000 |
commit | c6dbbc4576dd024b97919b8ee0d51a11cf9dbdaa (patch) | |
tree | 5402ece5c0edfeb38cf7c7e1e80676d1b33aaa66 /libavutil/common.h | |
parent | 1369582777bcfd41308225f6f119a75e4a391ddf (diff) | |
download | ffmpeg-c6dbbc4576dd024b97919b8ee0d51a11cf9dbdaa.tar.gz |
Add function to compute ceil(log2(x)).
Patch by Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
Originally committed as revision 19747 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/common.h')
-rw-r--r-- | libavutil/common.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index 9fac1c0aa4..0797a79ac0 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -225,6 +225,15 @@ static inline av_const float av_clipf(float a, float amin, float amax) 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)) |