From fa4fbd822c3a840d024bcb2ef24549c49b84d423 Mon Sep 17 00:00:00 2001 From: ChenHengming Date: Mon, 17 Aug 2015 09:24:09 +0000 Subject: [PATCH] [osal]: add mpp_ceil_log2 and mpp_clip function git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@115 6e48237b-75ef-9749-8fc9-41990f28c85a --- osal/inc/mpp_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osal/inc/mpp_common.h b/osal/inc/mpp_common.h index c4d98be4..6eaf3c1e 100644 --- a/osal/inc/mpp_common.h +++ b/osal/inc/mpp_common.h @@ -47,6 +47,18 @@ extern "C" { RK_S32 mpp_log2(RK_U32 v); RK_S32 mpp_log2_16bit(RK_U32 v); +static inline RK_S32 mpp_ceil_log2(RK_S32 x) +{ + return mpp_log2((x - 1) << 1); +} + +static inline RK_S32 mpp_clip(RK_S32 a, RK_S32 amin, RK_S32 amax) +{ + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + #ifdef __cplusplus } #endif