diff options
Diffstat (limited to 'vp9/common/vp9_idct.h')
-rw-r--r-- | vp9/common/vp9_idct.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vp9/common/vp9_idct.h b/vp9/common/vp9_idct.h index 430cec083..3e0ee4b63 100644 --- a/vp9/common/vp9_idct.h +++ b/vp9/common/vp9_idct.h @@ -13,6 +13,13 @@ #include "./vpx_config.h" +#define ROUND_POWER_OF_TWO(value, n) (((value) + (1 << ((n) - 1))) >> (n)) + +/* If we don't want to use ROUND_POWER_OF_TWO macro +static INLINE int16_t round_power_of_two(int16_t value, int n) { + return (value + (1 << (n - 1))) >> n; +}*/ + // Constants and Macros used by all idct/dct functions #define DCT_CONST_BITS 14 #define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1)) @@ -61,4 +68,11 @@ static INLINE int dct_const_round_shift(int input) { assert(INT16_MIN <= rv && rv <= INT16_MAX); return rv; } + +static INLINE int dct_32_round(int input) { + int rv = (input + DCT_CONST_ROUNDING) >> DCT_CONST_BITS; + assert(-131072 <= rv && rv <= 131071); + return rv; +} + #endif |