Commit ce3ad286 authored by Angie Chiang's avatar Angie Chiang
Browse files

Calculate the txfm stage range according to bd

Change-Id: Ie2f83f2f9369a22b70150ba44ddb6f82d6b6b514
parent 6f9cd946
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
static const int8_t fwd_shift_4[3] = { 2, 0, 0 }; static const int8_t fwd_shift_4[3] = { 2, 0, 0 };
// stage range // stage range
static const int8_t fwd_stage_range_col_dct_4[4] = { 15, 16, 17, 17 }; static const int8_t fwd_stage_range_col_dct_4[4] = { 0, 1, 2, 2 };
static const int8_t fwd_stage_range_row_dct_4[4] = { 17, 18, 18, 18 }; static const int8_t fwd_stage_range_row_dct_4[4] = { 2, 3, 3, 3 };
static const int8_t fwd_stage_range_col_adst_4[6] = { 15, 15, 16, 17, 17, 17 }; static const int8_t fwd_stage_range_col_adst_4[6] = { 0, 0, 1, 2, 2, 2 };
static const int8_t fwd_stage_range_row_adst_4[6] = { 17, 17, 17, 18, 18, 18 }; static const int8_t fwd_stage_range_row_adst_4[6] = { 2, 2, 2, 3, 3, 3 };
static const int8_t fwd_stage_range_idx_4[1] = { 18 }; static const int8_t fwd_stage_range_idx_4[1] = { 0 };
// cos bit // cos bit
static const int8_t fwd_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 }; static const int8_t fwd_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
...@@ -36,13 +36,11 @@ static const int8_t fwd_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 }; ...@@ -36,13 +36,11 @@ static const int8_t fwd_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_shift_8[3] = { 2, -1, 0 }; static const int8_t fwd_shift_8[3] = { 2, -1, 0 };
// stage range // stage range
static const int8_t fwd_stage_range_col_dct_8[6] = { 15, 16, 17, 18, 18, 18 }; static const int8_t fwd_stage_range_col_dct_8[6] = { 0, 1, 2, 3, 3, 3 };
static const int8_t fwd_stage_range_row_dct_8[6] = { 17, 18, 19, 19, 19, 19 }; static const int8_t fwd_stage_range_row_dct_8[6] = { 3, 4, 5, 5, 5, 5 };
static const int8_t fwd_stage_range_col_adst_8[8] = { 15, 15, 16, 17, static const int8_t fwd_stage_range_col_adst_8[8] = { 0, 0, 1, 2, 2, 3, 3, 3 };
17, 18, 18, 18 }; static const int8_t fwd_stage_range_row_adst_8[8] = { 3, 3, 3, 4, 4, 5, 5, 5 };
static const int8_t fwd_stage_range_row_adst_8[8] = { 17, 17, 17, 18, static const int8_t fwd_stage_range_idx_8[1] = { 0 };
18, 19, 19, 19 };
static const int8_t fwd_stage_range_idx_8[1] = { 19 };
// cos bit // cos bit
static const int8_t fwd_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 }; static const int8_t fwd_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
...@@ -59,15 +57,14 @@ static const int8_t fwd_cos_bit_row_adst_8[8] = { ...@@ -59,15 +57,14 @@ static const int8_t fwd_cos_bit_row_adst_8[8] = {
static const int8_t fwd_shift_16[3] = { 2, -2, 0 }; static const int8_t fwd_shift_16[3] = { 2, -2, 0 };
// stage range // stage range
static const int8_t fwd_stage_range_col_dct_16[8] = { 15, 16, 17, 18, static const int8_t fwd_stage_range_col_dct_16[8] = { 0, 1, 2, 3, 4, 4, 4, 4 };
19, 19, 19, 19 }; static const int8_t fwd_stage_range_row_dct_16[8] = { 4, 5, 6, 7, 7, 7, 7, 7 };
static const int8_t fwd_stage_range_row_dct_16[8] = { 17, 18, 19, 20, static const int8_t fwd_stage_range_col_adst_16[10] = { 0, 0, 1, 2, 2,
20, 20, 20, 20 }; 3, 3, 4, 4, 4 };
static const int8_t fwd_stage_range_col_adst_16[10] = { 15, 15, 16, 17, 17, static const int8_t fwd_stage_range_row_adst_16[10] = {
18, 18, 19, 19, 19 }; 4, 4, 4, 5, 5, 6, 6, 7, 7, 7,
static const int8_t fwd_stage_range_row_adst_16[10] = { 17, 17, 17, 18, 18, };
19, 19, 20, 20, 20 }; static const int8_t fwd_stage_range_idx_16[1] = { 0 };
static const int8_t fwd_stage_range_idx_16[1] = { 20 };
// cos bit // cos bit
static const int8_t fwd_cos_bit_col_dct_16[8] = { static const int8_t fwd_cos_bit_col_dct_16[8] = {
...@@ -86,17 +83,15 @@ static const int8_t fwd_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12, ...@@ -86,17 +83,15 @@ static const int8_t fwd_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
static const int8_t fwd_shift_32[3] = { 2, -4, 0 }; static const int8_t fwd_shift_32[3] = { 2, -4, 0 };
// stage range // stage range
static const int8_t fwd_stage_range_col_dct_32[10] = { 15, 16, 17, 18, 19, static const int8_t fwd_stage_range_col_dct_32[10] = { 0, 1, 2, 3, 4,
20, 20, 20, 20, 20 }; 5, 5, 5, 5, 5 };
static const int8_t fwd_stage_range_row_dct_32[10] = { 16, 17, 18, 19, 20, static const int8_t fwd_stage_range_row_dct_32[10] = { 5, 6, 7, 8, 9,
20, 20, 20, 20, 20 }; 9, 9, 9, 9, 9 };
static const int8_t fwd_stage_range_col_adst_32[12] = { static const int8_t fwd_stage_range_col_adst_32[12] = { 0, 0, 1, 2, 2, 3,
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20 3, 4, 4, 5, 5, 5 };
}; static const int8_t fwd_stage_range_row_adst_32[12] = { 5, 5, 5, 6, 6, 7,
static const int8_t fwd_stage_range_row_adst_32[12] = { 7, 8, 8, 9, 9, 9 };
16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20 static const int8_t fwd_stage_range_idx_32[1] = { 0 };
};
static const int8_t fwd_stage_range_idx_32[1] = { 20 };
// cos bit // cos bit
static const int8_t fwd_cos_bit_col_dct_32[10] = { 12, 12, 12, 12, 12, static const int8_t fwd_cos_bit_col_dct_32[10] = { 12, 12, 12, 12, 12,
...@@ -113,11 +108,11 @@ static const int8_t fwd_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12, ...@@ -113,11 +108,11 @@ static const int8_t fwd_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
static const int8_t fwd_shift_64[3] = { 0, -2, -2 }; static const int8_t fwd_shift_64[3] = { 0, -2, -2 };
// stage range // stage range
static const int8_t fwd_stage_range_col_dct_64[12] = { 13, 14, 15, 16, 17, 18, static const int8_t fwd_stage_range_col_dct_64[12] = { 0, 1, 2, 3, 4, 5,
19, 19, 19, 19, 19, 19 }; 6, 6, 6, 6, 6, 6 };
static const int8_t fwd_stage_range_row_dct_64[12] = { 17, 18, 19, 20, 21, 22, static const int8_t fwd_stage_range_row_dct_64[12] = { 6, 7, 8, 9, 10, 11,
22, 22, 22, 22, 22, 22 }; 11, 11, 11, 11, 11, 11 };
static const int8_t fwd_stage_range_idx_64[1] = { 22 }; static const int8_t fwd_stage_range_idx_64[1] = { 0 };
// cos bit // cos bit
static const int8_t fwd_cos_bit_col_dct_64[12] = { 15, 15, 15, 15, 15, 14, static const int8_t fwd_cos_bit_col_dct_64[12] = { 15, 15, 15, 15, 15, 14,
......
...@@ -38,9 +38,34 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) { ...@@ -38,9 +38,34 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
} }
} }
void av1_gen_fwd_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
const TXFM_2D_FLIP_CFG *cfg, int bd) {
// Note when assigning txfm_size_col, we use the txfm_size from the
// row configuration and vice versa. This is intentionally done to
// accurately perform rectangular transforms. When the transform is
// rectangular, the number of columns will be the same as the
// txfm_size stored in the row cfg struct. It will make no difference
// for square transforms.
const int txfm_size_col = cfg->row_cfg->txfm_size;
const int txfm_size_row = cfg->col_cfg->txfm_size;
// Take the shift from the larger dimension in the rectangular case.
const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift
: cfg->col_cfg->shift;
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
for (int i = 0; i < cfg->col_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) {
stage_range_col[i] = cfg->col_cfg->stage_range[i] + shift[0] + bd + 1;
}
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
for (int i = 0; i < cfg->row_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) {
stage_range_row[i] =
cfg->row_cfg->stage_range[i] + shift[0] + shift[1] + bd + 1;
}
}
static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output, static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output,
const int stride, const TXFM_2D_FLIP_CFG *cfg, const int stride, const TXFM_2D_FLIP_CFG *cfg,
int32_t *buf) { int32_t *buf, int bd) {
int c, r; int c, r;
// Note when assigning txfm_size_col, we use the txfm_size from the // Note when assigning txfm_size_col, we use the txfm_size from the
// row configuration and vice versa. This is intentionally done to // row configuration and vice versa. This is intentionally done to
...@@ -53,8 +78,12 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output, ...@@ -53,8 +78,12 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output,
// Take the shift from the larger dimension in the rectangular case. // Take the shift from the larger dimension in the rectangular case.
const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift
: cfg->col_cfg->shift; : cfg->col_cfg->shift;
const int8_t *stage_range_col = cfg->col_cfg->stage_range; int8_t stage_range_col[MAX_TXFM_STAGE_NUM];
const int8_t *stage_range_row = cfg->row_cfg->stage_range; int8_t stage_range_row[MAX_TXFM_STAGE_NUM];
assert(cfg->col_cfg->stage_num <= MAX_TXFM_STAGE_NUM);
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_col = cfg->col_cfg->cos_bit;
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit; const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->col_cfg->txfm_type); const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
...@@ -110,7 +139,6 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output, ...@@ -110,7 +139,6 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output,
void av1_fwd_txfm2d_4x8_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_4x8_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
#if CONFIG_TXMG #if CONFIG_TXMG
(void)bd;
int32_t txfm_buf[4 * 8]; int32_t txfm_buf[4 * 8];
int16_t rinput[4 * 8]; int16_t rinput[4 * 8];
int tx_size = TX_4X8; int tx_size = TX_4X8;
...@@ -122,13 +150,12 @@ void av1_fwd_txfm2d_4x8_c(const int16_t *input, int32_t *output, int stride, ...@@ -122,13 +150,12 @@ void av1_fwd_txfm2d_4x8_c(const int16_t *input, int32_t *output, int stride,
int rh = w; int rh = w;
transpose_int16(rinput, rw, input, stride, w, h); transpose_int16(rinput, rw, input, stride, w, h);
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size);
fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output); fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd);
transpose_int32(output, w, txfm_buf, rw, rw, rh); transpose_int32(output, w, txfm_buf, rw, rw, rh);
#else #else
int32_t txfm_buf[4 * 8]; int32_t txfm_buf[4 * 8];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X8); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X8);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
#endif #endif
} }
...@@ -136,14 +163,12 @@ void av1_fwd_txfm2d_8x4_c(const int16_t *input, int32_t *output, int stride, ...@@ -136,14 +163,12 @@ void av1_fwd_txfm2d_8x4_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[8 * 4]; int32_t txfm_buf[8 * 4];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X4); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X4);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
void av1_fwd_txfm2d_8x16_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_8x16_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
#if CONFIG_TXMG #if CONFIG_TXMG
(void)bd;
int32_t txfm_buf[8 * 16]; int32_t txfm_buf[8 * 16];
int16_t rinput[8 * 16]; int16_t rinput[8 * 16];
int tx_size = TX_8X16; int tx_size = TX_8X16;
...@@ -155,13 +180,12 @@ void av1_fwd_txfm2d_8x16_c(const int16_t *input, int32_t *output, int stride, ...@@ -155,13 +180,12 @@ void av1_fwd_txfm2d_8x16_c(const int16_t *input, int32_t *output, int stride,
int rh = w; int rh = w;
transpose_int16(rinput, rw, input, stride, w, h); transpose_int16(rinput, rw, input, stride, w, h);
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size);
fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output); fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd);
transpose_int32(output, w, txfm_buf, rw, rw, rh); transpose_int32(output, w, txfm_buf, rw, rw, rh);
#else #else
int32_t txfm_buf[8 * 16]; int32_t txfm_buf[8 * 16];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X16); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X16);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
#endif #endif
} }
...@@ -169,14 +193,12 @@ void av1_fwd_txfm2d_16x8_c(const int16_t *input, int32_t *output, int stride, ...@@ -169,14 +193,12 @@ void av1_fwd_txfm2d_16x8_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[16 * 8]; int32_t txfm_buf[16 * 8];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X8); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X8);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
void av1_fwd_txfm2d_16x32_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_16x32_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
#if CONFIG_TXMG #if CONFIG_TXMG
(void)bd;
int32_t txfm_buf[16 * 32]; int32_t txfm_buf[16 * 32];
int16_t rinput[16 * 32]; int16_t rinput[16 * 32];
int tx_size = TX_16X32; int tx_size = TX_16X32;
...@@ -188,13 +210,12 @@ void av1_fwd_txfm2d_16x32_c(const int16_t *input, int32_t *output, int stride, ...@@ -188,13 +210,12 @@ void av1_fwd_txfm2d_16x32_c(const int16_t *input, int32_t *output, int stride,
int rh = w; int rh = w;
transpose_int16(rinput, rw, input, stride, w, h); transpose_int16(rinput, rw, input, stride, w, h);
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(rtx_type, rtx_size);
fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output); fwd_txfm2d_c(rinput, txfm_buf, rw, &cfg, output, bd);
transpose_int32(output, w, txfm_buf, rw, rw, rh); transpose_int32(output, w, txfm_buf, rw, rw, rh);
#else #else
int32_t txfm_buf[16 * 32]; int32_t txfm_buf[16 * 32];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X32); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X32);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
#endif #endif
} }
...@@ -202,48 +223,42 @@ void av1_fwd_txfm2d_32x16_c(const int16_t *input, int32_t *output, int stride, ...@@ -202,48 +223,42 @@ void av1_fwd_txfm2d_32x16_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[32 * 16]; int32_t txfm_buf[32 * 16];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X16); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X16);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
void av1_fwd_txfm2d_4x4_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_4x4_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[4 * 4]; int32_t txfm_buf[4 * 4];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X4); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X4);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
void av1_fwd_txfm2d_8x8_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_8x8_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[8 * 8]; int32_t txfm_buf[8 * 8];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X8); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X8);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
void av1_fwd_txfm2d_16x16_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_16x16_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[16 * 16]; int32_t txfm_buf[16 * 16];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X16); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X16);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
void av1_fwd_txfm2d_32x32_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_32x32_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[32 * 32]; int32_t txfm_buf[32 * 32];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride, void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride,
int tx_type, int bd) { int tx_type, int bd) {
int32_t txfm_buf[64 * 64]; int32_t txfm_buf[64 * 64];
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type); TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type);
(void)bd; fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf, bd);
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
} }
static const TXFM_1D_CFG *fwd_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = { static const TXFM_1D_CFG *fwd_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
......
...@@ -13,16 +13,31 @@ ...@@ -13,16 +13,31 @@
#define AV1_INV_TXFM2D_CFG_H_ #define AV1_INV_TXFM2D_CFG_H_
#include "av1/common/av1_inv_txfm1d.h" #include "av1/common/av1_inv_txfm1d.h"
// sum of fwd_shift_##
#if CONFIG_CHROMA_2X2
#if CONFIG_TX64X64
static const int8_t fwd_shift_sum[TX_SIZES] = { 3, 2, 1, 0, -2, -4 };
#else // CONFIG_TX64X64
static const int8_t fwd_shift_sum[TX_SIZES] = { 3, 2, 1, 0, -2 };
#endif // CONFIG_TX64X64
#else // CONFIG_CHROMA_2X2
#if CONFIG_TX64X64
static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2, -4 };
#else // CONFIG_TX64X64
static const int8_t fwd_shift_sum[TX_SIZES] = { 2, 1, 0, -2 };
#endif // CONFIG_TX64X64
#endif // CONFIG_CHROMA_2X2
// ---------------- 4x4 1D config ----------------------- // ---------------- 4x4 1D config -----------------------
// shift // shift
static const int8_t inv_shift_4[2] = { 0, -4 }; static const int8_t inv_shift_4[2] = { 0, -4 };
// stage range // stage range
static const int8_t inv_stage_range_col_dct_4[4] = { 18, 18, 17, 17 }; static const int8_t inv_stage_range_col_dct_4[4] = { 3, 3, 2, 2 };
static const int8_t inv_stage_range_row_dct_4[4] = { 18, 18, 18, 18 }; static const int8_t inv_stage_range_row_dct_4[4] = { 3, 3, 3, 3 };
static const int8_t inv_stage_range_col_adst_4[6] = { 18, 18, 18, 18, 17, 17 }; static const int8_t inv_stage_range_col_adst_4[6] = { 3, 3, 3, 3, 2, 2 };
static const int8_t inv_stage_range_row_adst_4[6] = { 18, 18, 18, 18, 18, 18 }; static const int8_t inv_stage_range_row_adst_4[6] = { 3, 3, 3, 3, 3, 3 };
static const int8_t inv_stage_range_idx_4[1] = { 18 }; static const int8_t inv_stage_range_idx_4[1] = { 0 };
// cos bit // cos bit
static const int8_t inv_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 }; static const int8_t inv_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
...@@ -35,13 +50,11 @@ static const int8_t inv_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 }; ...@@ -35,13 +50,11 @@ static const int8_t inv_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_shift_8[2] = { 0, -5 }; static const int8_t inv_shift_8[2] = { 0, -5 };
// stage range // stage range
static const int8_t inv_stage_range_col_dct_8[6] = { 19, 19, 19, 19, 18, 18 }; static const int8_t inv_stage_range_col_dct_8[6] = { 5, 5, 5, 5, 4, 4 };
static const int8_t inv_stage_range_row_dct_8[6] = { 19, 19, 19, 19, 19, 19 }; static const int8_t inv_stage_range_row_dct_8[6] = { 5, 5, 5, 5, 5, 5 };
static const int8_t inv_stage_range_col_adst_8[8] = { 19, 19, 19, 19, static const int8_t inv_stage_range_col_adst_8[8] = { 5, 5, 5, 5, 5, 5, 4, 4 };
19, 19, 18, 18 }; static const int8_t inv_stage_range_row_adst_8[8] = { 5, 5, 5, 5, 5, 5, 5, 5 };
static const int8_t inv_stage_range_row_adst_8[8] = { 19, 19, 19, 19, static const int8_t inv_stage_range_idx_8[1] = { 0 };
19, 19, 19, 19 };
static const int8_t inv_stage_range_idx_8[1] = { 19 };
// cos bit // cos bit
static const int8_t inv_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 }; static const int8_t inv_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
...@@ -58,15 +71,13 @@ static const int8_t inv_cos_bit_row_adst_8[8] = { ...@@ -58,15 +71,13 @@ static const int8_t inv_cos_bit_row_adst_8[8] = {
static const int8_t inv_shift_16[2] = { -1, -5 }; static const int8_t inv_shift_16[2] = { -1, -5 };
// stage range // stage range
static const int8_t inv_stage_range_col_dct_16[8] = { 19, 19, 19, 19, static const int8_t inv_stage_range_col_dct_16[8] = { 7, 7, 7, 7, 7, 7, 6, 6 };
19, 19, 18, 18 }; static const int8_t inv_stage_range_row_dct_16[8] = { 7, 7, 7, 7, 7, 7, 7, 7 };
static const int8_t inv_stage_range_row_dct_16[8] = { 20, 20, 20, 20, static const int8_t inv_stage_range_col_adst_16[10] = { 7, 7, 7, 7, 7,
20, 20, 20, 20 }; 7, 7, 7, 6, 6 };
static const int8_t inv_stage_range_col_adst_16[10] = { 19, 19, 19, 19, 19, static const int8_t inv_stage_range_row_adst_16[10] = { 7, 7, 7, 7, 7,
19, 19, 19, 18, 18 }; 7, 7, 7, 7, 7 };
static const int8_t inv_stage_range_row_adst_16[10] = { 20, 20, 20, 20, 20, static const int8_t inv_stage_range_idx_16[1] = { 0 };
20, 20, 20, 20, 20 };
static const int8_t inv_stage_range_idx_16[1] = { 20 };
// cos bit // cos bit
static const int8_t inv_cos_bit_col_dct_16[8] = { static const int8_t inv_cos_bit_col_dct_16[8] = {
...@@ -85,17 +96,15 @@ static const int8_t inv_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12, ...@@ -85,17 +96,15 @@ static const int8_t inv_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
static const int8_t inv_shift_32[2] = { -1, -5 }; static const int8_t inv_shift_32[2] = { -1, -5 };
// stage range // stage range
static const int8_t inv_stage_range_col_dct_32[10] = { 19, 19, 19, 19, 19, static const int8_t inv_stage_range_col_dct_32[10] = { 9, 9, 9, 9, 9,
19, 19, 19, 18, 18 }; 9, 9, 9, 8, 8 };
static const int8_t inv_stage_range_row_dct_32[10] = { 20, 20, 20, 20, 20, static const int8_t inv_stage_range_row_dct_32[10] = { 9, 9, 9, 9, 9,
20, 20, 20, 20, 20 }; 9, 9, 9, 9, 9 };
static const int8_t inv_stage_range_col_adst_32[12] = { static const int8_t inv_stage_range_col_adst_32[12] = { 9, 9, 9, 9, 9, 9,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18 9, 9, 9, 9, 8, 8 };
}; static const int8_t inv_stage_range_row_adst_32[12] = { 9, 9, 9, 9, 9, 9,
static const int8_t inv_stage_range_row_adst_32[12] = { 9, 9, 9, 9, 9, 9 };
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 static const int8_t inv_stage_range_idx_32[1] = { 0 };
};
static const int8_t inv_stage_range_idx_32[1] = { 20 };
// cos bit // cos bit
static const int8_t inv_cos_bit_col_dct_32[10] = { 13, 13, 13, 13, 13, static const int8_t inv_cos_bit_col_dct_32[10] = { 13, 13, 13, 13, 13,
...@@ -112,11 +121,12 @@ static const int8_t inv_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12, ...@@ -112,11 +121,12 @@ static const int8_t inv_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
static const int8_t inv_shift_64[2] = { -1, -7 }; static const int8_t inv_shift_64[2] = { -1, -7 };
// stage range // stage range
static const int8_t inv_stage_range_col_dct_64[12] = { 19, 19, 19, 19, 19, 19, static const int8_t inv_stage_range_col_dct_64[12] = { 11, 11, 11, 11, 11, 11,
19, 19, 19, 19, 18, 18 }; 11, 11, 11, 11, 10, 10 };
static const int8_t inv_stage_range_row_dct_64[12] = { 20, 20, 20, 20, 20, 20, static const int8_t inv_stage_range_row_dct_64[12] = { 11, 11, 11, 11, 11, 11,
20, 20, 20, 20, 20, 20 }; 11, 11, 11, 11, 11, 11 };
static const int8_t inv_stage_range_idx_64[1] = { 20 };
static const int8_t inv_stage_range_idx_64[1] = { 0 };
// cos bit // cos bit
static const int8_t inv_cos_bit_col_dct_64[12] = { 13, 13, 13, 13, 13, 13, static const int8_t inv_cos_bit_col_dct_64[12] = { 13, 13, 13, 13, 13, 13,
......
...@@ -127,9 +127,35 @@ TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) { ...@@ -127,9 +127,35 @@ TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
return cfg; return cfg;
} }
void av1_gen_inv_stage_range(int8_t *stage_range_col, int8_t *stage_range_row,
const TXFM_2D_FLIP_CFG *cfg, int8_t fwd_shift,
int bd) {
// Note when assigning txfm_size_col, we use the txfm_size from the
// row configuration and vice versa. This is intentionally done to
// accurately perform rectangular transforms. When the transform is
// rectangular, the number of columns will be the same as the
// txfm_size stored in the row cfg struct. It will make no difference
// for square transforms.
const int txfm_size_col = cfg->row_cfg->txfm_size;
const int txfm_size_row = cfg->col_cfg->txfm_size;
// Take the shift from the larger dimension in the rectangular case.
const int8_t *shift = (txfm_size_col > txfm_size_row) ? cfg->row_cfg->shift
: cfg->col_cfg->shift;
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning
for (int i = 0; i < cfg->row_cfg->stage_num && i < MAX_TXFM_STAGE_NUM; ++i) {
stage_range_row[i] = cfg->row_cfg->stage_range[i] + fwd_shift + bd + 1;
}
// i < MAX_TXFM_STAGE_NUM will mute above array bounds warning