From dc85759301e48b34c94924fca26e5933834acb27 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 1 Feb 2018 19:21:48 -0800 Subject: [PATCH] av1_txfm: inline range_check_value, clamp_value Change-Id: I972d0304c6ff495f5f484fe77270c420a0dfe376 --- av1/common/av1_inv_txfm1d.c | 16 +--------------- av1/common/av1_txfm.h | 15 +++++++++++++++ av1/encoder/av1_fwd_txfm1d.c | 1 - 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/av1/common/av1_inv_txfm1d.c b/av1/common/av1_inv_txfm1d.c index 80dd9785f..811b3846d 100644 --- a/av1/common/av1_inv_txfm1d.c +++ b/av1/common/av1_inv_txfm1d.c @@ -13,20 +13,6 @@ #include "aom_dsp/inv_txfm.h" #include "av1/common/av1_inv_txfm1d.h" -int32_t range_check_value(int32_t value, int8_t bit) { -#if CONFIG_COEFFICIENT_RANGE_CHECKING - const int64_t maxValue = (1LL << (bit - 1)) - 1; - const int64_t minValue = -(1LL << (bit - 1)); - if (value < minValue || value > maxValue) { - fprintf(stderr, "coeff out of bit range, value: %d bit %d\n", value, bit); - assert(0); - } -#else - (void)bit; -#endif - return value; -} - #if CONFIG_COEFFICIENT_RANGE_CHECKING void range_check_func(int32_t stage, const int32_t *input, const int32_t *buf, int32_t size, int8_t bit) { @@ -86,7 +72,7 @@ static INLINE void clamp_buf(int32_t *buf, int32_t size, int8_t bit) { } #endif -int32_t clamp_value(int32_t value, int8_t bit) { +static INLINE int32_t clamp_value(int32_t value, int8_t bit) { if (bit <= 16) { const int32_t maxValue = (1 << 15) - 1; const int32_t minValue = -(1 << 15); diff --git a/av1/common/av1_txfm.h b/av1/common/av1_txfm.h index 409dc714c..1c6daa450 100644 --- a/av1/common/av1_txfm.h +++ b/av1/common/av1_txfm.h @@ -16,6 +16,7 @@ #include #include +#include "./aom_config.h" #include "av1/common/enums.h" #include "av1/common/blockd.h" #include "aom/aom_integer.h" @@ -92,6 +93,20 @@ static INLINE const int32_t *sinpi_arr(int n) { return sinpi_arr_data[n - cos_bit_min]; } +static INLINE int32_t range_check_value(int32_t value, int8_t bit) { +#if CONFIG_COEFFICIENT_RANGE_CHECKING + const int64_t maxValue = (1LL << (bit - 1)) - 1; + const int64_t minValue = -(1LL << (bit - 1)); + if (value < minValue || value > maxValue) { + fprintf(stderr, "coeff out of bit range, value: %d bit %d\n", value, bit); + assert(0); + } +#else + (void)bit; +#endif + return value; +} + static INLINE int32_t round_shift(int32_t value, int bit) { assert(bit >= 1); return (int32_t)(((int64_t)value + (1ll << (bit - 1))) >> bit); diff --git a/av1/encoder/av1_fwd_txfm1d.c b/av1/encoder/av1_fwd_txfm1d.c index 11beeb3e0..3c531efdf 100644 --- a/av1/encoder/av1_fwd_txfm1d.c +++ b/av1/encoder/av1_fwd_txfm1d.c @@ -12,7 +12,6 @@ #include #include "aom_dsp/inv_txfm.h" #include "av1/encoder/av1_fwd_txfm1d.h" -int32_t range_check_value(int32_t value, int8_t bit); #if CONFIG_COEFFICIENT_RANGE_CHECKING void range_check_func(int32_t stage, const int32_t *input, const int32_t *buf, -- GitLab