Commit dc857593 authored by James Zern's avatar James Zern

av1_txfm: inline range_check_value, clamp_value

Change-Id: I972d0304c6ff495f5f484fe77270c420a0dfe376
parent ba575a09
......@@ -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);
......
......@@ -16,6 +16,7 @@
#include <math.h>
#include <stdio.h>
#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);
......
......@@ -12,7 +12,6 @@
#include <stdlib.h>
#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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment