Commit d4327bce authored by Angie Chiang's avatar Angie Chiang Committed by Sebastien Alaiwan

Simplify cos_bit setting in txfm

Move cos_bit from txfm 1d cfg to 2d cfg
Each txfm stage only uses one cos_bit

This is a lossless change and it speeds up encoder by 2%

Change-Id: I45d398761e4729b8c4c37729571fe3765cb0c83f
parent dc3d916b
This diff is collapsed.
......@@ -18,38 +18,38 @@
extern "C" {
#endif
void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
void av1_idct4_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
void av1_idct8_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_idct16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_idct32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_idct16_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_idct32_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#if CONFIG_TX64X64
void av1_idct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_idct64_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#endif // CONFIG_TX64X64
void av1_iadst4_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iadst8_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iadst4_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_iadst8_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_iadst16_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_iadst32_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_iidentity4_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_iidentity8_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_iidentity16_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_iidentity32_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#if CONFIG_TX64X64
void av1_iidentity64_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity64_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#endif // CONFIG_TX64X64
#ifdef __cplusplus
......
This diff is collapsed.
......@@ -287,6 +287,18 @@ const int8_t *inv_txfm_shift_ls[TX_SIZES_ALL] = {
#endif // CONFIG_TX64X64
};
const int8_t inv_cos_bit_col[5 /*row*/][5 /*col*/] = { { 13, 13, 13, 0, 0 },
{ 13, 13, 13, 13, 0 },
{ 13, 13, 13, 13, 13 },
{ 0, 13, 13, 13, 13 },
{ 0, 0, 13, 13, 13 } };
const int8_t inv_cos_bit_row[5 /*row*/][5 /*col*/] = { { 13, 13, 13, 0, 0 },
{ 13, 13, 12, 12, 0 },
{ 12, 12, 12, 12, 12 },
{ 0, 12, 12, 12, 12 },
{ 0, 0, 12, 12, 12 } };
void av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
TXFM_2D_FLIP_CFG *cfg) {
assert(cfg != NULL);
......@@ -296,6 +308,10 @@ void av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
cfg->col_cfg = inv_txfm_col_cfg_ls[tx_type_col][tx_size];
cfg->row_cfg = inv_txfm_row_cfg_ls[tx_type_row][tx_size];
cfg->shift = inv_txfm_shift_ls[tx_size];
const int txw_idx = tx_size_wide_log2[tx_size] - tx_size_wide_log2[0];
const int txh_idx = tx_size_high_log2[tx_size] - tx_size_high_log2[0];
cfg->cos_bit_col = inv_cos_bit_col[txw_idx][txh_idx];
cfg->cos_bit_row = inv_cos_bit_row[txw_idx][txh_idx];
}
void av1_gen_inv_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
......@@ -335,8 +351,8 @@ static INLINE void inv_txfm2d_add_c(const int32_t *input, uint16_t *output,
assert(cfg->col_cfg->stage_num <= MAX_TXFM_STAGE_NUM);
av1_gen_inv_stage_range(stage_range_col, stage_range_row, cfg, tx_size, bd);
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
const int8_t cos_bit_col = cfg->cos_bit_col;
const int8_t cos_bit_row = cfg->cos_bit_row;
const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->col_cfg->txfm_type);
const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->row_cfg->txfm_type);
......
......@@ -104,8 +104,8 @@ static INLINE int32_t half_btf(int32_t w0, int32_t in0, int32_t w1, int32_t in1,
return round_shift(result_32, bit);
}
typedef void (*TxfmFunc)(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
typedef void (*TxfmFunc)(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
typedef enum TXFM_TYPE {
TXFM_TYPE_DCT4,
......@@ -129,7 +129,6 @@ typedef struct TXFM_1D_CFG {
const int stage_num;
const int8_t *stage_range;
const int8_t *cos_bit;
const TXFM_TYPE txfm_type;
} TXFM_1D_CFG;
......@@ -137,6 +136,8 @@ typedef struct TXFM_2D_FLIP_CFG {
int ud_flip; // flip upside down
int lr_flip; // flip left to right
const int8_t *shift;
int8_t cos_bit_col;
int8_t cos_bit_row;
const TXFM_1D_CFG *col_cfg;
const TXFM_1D_CFG *row_cfg;
} TXFM_2D_FLIP_CFG;
......
......@@ -88,17 +88,21 @@ static void ihalfright32_c(const tran_low_t *input, tran_low_t *output) {
#if CONFIG_TX64X64 && (!CONFIG_DAALA_TX32 || !CONFIG_DAALA_TX64)
static void idct64_col_c(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
const int txw_idx = tx_size_wide_log2[TX_64X64] - tx_size_wide_log2[0];
const int txh_idx = tx_size_high_log2[TX_64X64] - tx_size_high_log2[0];
for (int i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
av1_idct64_new(in, out, inv_cos_bit_col_dct_64, inv_stage_range_col_dct_64);
av1_idct64_new(in, out, inv_cos_bit_col[txw_idx][txh_idx],
inv_stage_range_col_dct_64);
for (int i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
static void idct64_row_c(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
const int txw_idx = tx_size_wide_log2[TX_64X64] - tx_size_wide_log2[0];
const int txh_idx = tx_size_high_log2[TX_64X64] - tx_size_high_log2[0];
for (int i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
av1_idct64_new(in, out, inv_cos_bit_row_dct_64, inv_stage_range_row_dct_64);
av1_idct64_new(in, out, inv_cos_bit_row[txw_idx][txh_idx],
inv_stage_range_row_dct_64);
for (int i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
......
......@@ -601,20 +601,18 @@ static void idct32_avx2(__m256i *in, __m256i *out, int bit) {
void av1_inv_txfm2d_add_32x32_avx2(const int32_t *coeff, uint16_t *output,
int stride, TX_TYPE tx_type, int bd) {
__m256i in[128], out[128];
const TXFM_1D_CFG *row_cfg = NULL;
const TXFM_1D_CFG *col_cfg = NULL;
const int8_t *shift = inv_txfm_shift_ls[TX_32X32];
const int txw_idx = tx_size_wide_log2[TX_32X32] - tx_size_wide_log2[0];
const int txh_idx = tx_size_high_log2[TX_32X32] - tx_size_high_log2[0];
switch (tx_type) {
case DCT_DCT:
row_cfg = &inv_txfm_1d_row_cfg_dct_32;
col_cfg = &inv_txfm_1d_col_cfg_dct_32;
load_buffer_32x32(coeff, in);
transpose_32x32(in, out);
idct32_avx2(out, in, row_cfg->cos_bit[2]);
idct32_avx2(out, in, inv_cos_bit_row[txw_idx][txh_idx]);
round_shift_32x32(in, -shift[0]);
transpose_32x32(in, out);
idct32_avx2(out, in, col_cfg->cos_bit[2]);
idct32_avx2(out, in, inv_cos_bit_col[txw_idx][txh_idx]);
write_buffer_32x32(in, output, stride, 0, 0, -shift[1], bd);
break;
default: assert(0);
......
This diff is collapsed.
This diff is collapsed.
......@@ -18,38 +18,38 @@
extern "C" {
#endif
void av1_fdct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
void av1_fdct4_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
void av1_fdct8_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fdct16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fdct32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fdct16_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fdct32_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#if CONFIG_TX64X64
void av1_fdct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fdct64_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#endif // CONFIG_TX64X64
void av1_fadst4_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fadst8_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fadst4_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fadst8_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fadst16_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fadst32_new(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fidentity4_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fidentity8_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fidentity16_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
void av1_fidentity32_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#if CONFIG_TX64X64
void av1_fidentity64_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity64_c(const int32_t *input, int32_t *output, int8_t cos_bit,
const int8_t *stage_range);
#endif // CONFIG_TX64X64
#ifdef __cplusplus
......
This diff is collapsed.
......@@ -82,8 +82,8 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output,
assert(cfg->row_cfg->stage_num <= MAX_TXFM_STAGE_NUM);
av1_gen_fwd_stage_range(stage_range_col, stage_range_row, cfg, bd);
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
const int8_t cos_bit_col = cfg->cos_bit_col;
const int8_t cos_bit_row = cfg->cos_bit_row;
const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->row_cfg->txfm_type);
......@@ -658,6 +658,18 @@ const int8_t *fwd_txfm_shift_ls[TX_SIZES_ALL] = {
#endif // CONFIG_TX64X64
};
const int8_t fwd_cos_bit_col[5 /*row*/][5 /*col*/] = { { 13, 13, 13, 0, 0 },
{ 13, 13, 13, 12, 0 },
{ 13, 13, 13, 12, 13 },
{ 0, 13, 13, 12, 13 },
{ 0, 0, 13, 12, 13 } };
const int8_t fwd_cos_bit_row[5 /*row*/][5 /*col*/] = { { 13, 13, 13, 0, 0 },
{ 13, 13, 13, 12, 0 },
{ 13, 13, 12, 13, 12 },
{ 0, 12, 13, 12, 11 },
{ 0, 0, 12, 11, 10 } };
void av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
TXFM_2D_FLIP_CFG *cfg) {
assert(cfg != NULL);
......@@ -667,4 +679,8 @@ void av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
cfg->col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size];
cfg->row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size];
cfg->shift = fwd_txfm_shift_ls[tx_size];
int txw_idx = tx_size_wide_log2[tx_size] - tx_size_wide_log2[0];
int txh_idx = tx_size_high_log2[tx_size] - tx_size_high_log2[0];
cfg->cos_bit_col = fwd_cos_bit_col[txw_idx][txh_idx];
cfg->cos_bit_row = fwd_cos_bit_row[txw_idx][txh_idx];
}
......@@ -2285,16 +2285,22 @@ static void fhalfright64(const tran_low_t *input, tran_low_t *output) {
static void fdct64_col(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
int i;
const int txw_idx = tx_size_wide_log2[TX_64X64] - tx_size_wide_log2[0];
const int txh_idx = tx_size_high_log2[TX_64X64] - tx_size_high_log2[0];
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
av1_fdct64_new(in, out, fwd_cos_bit_col_dct_64, fwd_stage_range_col_dct_64);
av1_fdct64_new(in, out, fwd_cos_bit_col[txw_idx][txh_idx],
fwd_stage_range_col_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
static void fdct64_row(const tran_low_t *input, tran_low_t *output) {
int32_t in[64], out[64];
int i;
const int txw_idx = tx_size_wide_log2[TX_64X64] - tx_size_wide_log2[0];
const int txh_idx = tx_size_high_log2[TX_64X64] - tx_size_high_log2[0];
for (i = 0; i < 64; ++i) in[i] = (int32_t)input[i];
av1_fdct64_new(in, out, fwd_cos_bit_row_dct_64, fwd_stage_range_row_dct_64);
av1_fdct64_new(in, out, fwd_cos_bit_row[txw_idx][txh_idx],
fwd_stage_range_row_dct_64);
for (i = 0; i < 64; ++i) output[i] = (tran_low_t)out[i];
}
......
This diff is collapsed.
......@@ -25,7 +25,7 @@ static INLINE void int16_array_with_stride_to_int32_array_without_stride(
}
typedef void (*TxfmFuncSSE2)(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
static INLINE TxfmFuncSSE2 fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
switch (txfm_type) {
......@@ -50,8 +50,8 @@ static INLINE void fwd_txfm2d_sse4_1(const int16_t *input, int32_t *output,
const int8_t *shift = cfg->shift;
const int8_t *stage_range_col = cfg->col_cfg->stage_range;
const int8_t *stage_range_row = cfg->row_cfg->stage_range;
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
const int8_t cos_bit_col = cfg->cos_bit_col;
const int8_t cos_bit_row = cfg->cos_bit_row;
const TxfmFuncSSE2 txfm_func_col =
fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
const TxfmFuncSSE2 txfm_func_row =
......
......@@ -10,44 +10,44 @@ extern "C" {
#endif
void av1_fdct4_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fdct8_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fdct16_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fdct32_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fdct64_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fadst4_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fadst8_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fadst16_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_fadst32_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_idct4_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_idct8_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_idct16_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_idct32_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_idct64_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_iadst4_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_iadst8_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_iadst16_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
void av1_iadst32_new_sse4_1(const __m128i *input, __m128i *output,
const int8_t *cos_bit, const int8_t *stage_range);
const int8_t cos_bit, const int8_t *stage_range);
static INLINE void transpose_32_4x4(int stride, const __m128i *input,
__m128i *output) {
......
This diff is collapsed.
......@@ -48,7 +48,7 @@ const TxfmFunc fwd_txfm_func_ls[][txfm_type_num] = {
};
// the maximum stage number of fwd/inv 1d dct/adst txfm is 12
const int8_t cos_bit[12] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 };
const int8_t cos_bit = 14;
const int8_t range_bit[12] = { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
TEST(av1_fwd_txfm1d, round_shift) {
......
......@@ -199,10 +199,10 @@ TEST(AV1FwdTxfm2d, CfgTest) {
const TXFM_1D_CFG *col_cfg = cfg.col_cfg;
const TXFM_1D_CFG *row_cfg = cfg.row_cfg;
libaom_test::txfm_stage_range_check(stage_range_col, col_cfg->stage_num,
col_cfg->cos_bit, low_range,
cfg.cos_bit_col, low_range,
high_range);
libaom_test::txfm_stage_range_check(stage_range_row, row_cfg->stage_num,
row_cfg->cos_bit, low_range,
cfg.cos_bit_row, low_range,
high_range);
}
}
......
......@@ -49,7 +49,7 @@ const TxfmFunc inv_txfm_func_ls[][txfm_type_num] = {
};
// the maximum stage number of fwd/inv 1d dct/adst txfm is 12
const int8_t cos_bit[12] = { 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 };
const int8_t cos_bit = 13;
const int8_t range_bit[12] = { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
void reference_idct_1d_int(const int32_t *in, int32_t *out, int size) {
......
......@@ -206,10 +206,10 @@ TEST(AV1InvTxfm2d, CfgTest) {
const TXFM_1D_CFG *col_cfg = cfg.col_cfg;
const TXFM_1D_CFG *row_cfg = cfg.row_cfg;
libaom_test::txfm_stage_range_check(stage_range_col, col_cfg->stage_num,
col_cfg->cos_bit, low_range,
cfg.cos_bit_col, low_range,
high_range);
libaom_test::txfm_stage_range_check(stage_range_row, row_cfg->stage_num,
row_cfg->cos_bit, low_range,
cfg.cos_bit_row, low_range,
high_range);
}
}
......
......@@ -363,19 +363,14 @@ int8_t low_range_arr[BD_NUM] = { 16, 32, 32 };
int8_t high_range_arr[BD_NUM] = { 32, 32, 32 };
void txfm_stage_range_check(const int8_t *stage_range, int stage_num,
const int8_t *cos_bit, int low_range,
int high_range) {
int8_t cos_bit, int low_range, int high_range) {
for (int i = 0; i < stage_num; ++i) {
EXPECT_LE(stage_range[i], low_range);
if (cos_bit != NULL) {
ASSERT_LE(stage_range[i] + cos_bit[i], high_range) << "stage = " << i;
}
ASSERT_LE(stage_range[i] + cos_bit, high_range) << "stage = " << i;
}
for (int i = 0; i < stage_num - 1; ++i) {
// make sure there is no overflow while doing half_btf()
if (cos_bit != NULL) {
ASSERT_LE(stage_range[i + 1] + cos_bit[i], high_range) << "stage = " << i;
}
ASSERT_LE(stage_range[i + 1] + cos_bit, high_range) << "stage = " << i;
}
}
} // namespace libaom_test
This diff is collapsed.
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