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