Commit 33b39f01 authored by Frederic Barbier's avatar Frederic Barbier Committed by Sebastien Alaiwan

[idct] Fix initialization of tx_set_type

Previous assumption on reduced_tx_set_used=0 led to many assertion
failures and prevented signalling reduced_tx_set_used equal to 1.

BUG=aomedia:1053

Change-Id: If9a9dff8d01ba3ec942e06559c153f06d34555f9
parent d0179a6b
......@@ -2460,7 +2460,8 @@ void av1_inv_txfm_add_txmg(const tran_low_t *dqcoeff, uint8_t *dst, int stride,
#endif
static void init_txfm_param(const MACROBLOCKD *xd, int plane, TX_SIZE tx_size,
TX_TYPE tx_type, int eob, TxfmParam *txfm_param) {
TX_TYPE tx_type, int eob, int reduced_tx_set,
TxfmParam *txfm_param) {
txfm_param->tx_type = tx_type;
txfm_param->tx_size = tx_size;
txfm_param->eob = eob;
......@@ -2470,11 +2471,9 @@ static void init_txfm_param(const MACROBLOCKD *xd, int plane, TX_SIZE tx_size,
const struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE plane_bsize =
get_plane_block_size(xd->mi[0]->mbmi.sb_type, pd);
// TODO(sarahparker) This assumes reduced_tx_set_used == 0. I will do a
// follow up refactor to make the actual value of reduced_tx_set_used
// within this function.
txfm_param->tx_set_type = get_ext_tx_set_type(
txfm_param->tx_size, plane_bsize, is_inter_block(&xd->mi[0]->mbmi), 0);
txfm_param->tx_set_type =
get_ext_tx_set_type(txfm_param->tx_size, plane_bsize,
is_inter_block(&xd->mi[0]->mbmi), reduced_tx_set);
#if CONFIG_ADAPT_SCAN
txfm_param->eob_threshold =
(const int16_t *)&xd->eob_threshold_md[tx_size][tx_type][0];
......@@ -2499,13 +2498,15 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd,
uint8_t *mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
int plane, TX_TYPE tx_type, TX_SIZE tx_size,
uint8_t *dst, int stride, int eob) {
uint8_t *dst, int stride, int eob,
int reduced_tx_set) {
if (!eob) return;
assert(eob <= av1_get_max_eob(tx_size));
TxfmParam txfm_param;
init_txfm_param(xd, plane, tx_size, tx_type, eob, &txfm_param);
init_txfm_param(xd, plane, tx_size, tx_type, eob, reduced_tx_set,
&txfm_param);
#if CONFIG_MRC_TX
txfm_param.is_inter = is_inter_block(&xd->mi[0]->mbmi);
#endif // CONFIG_MRC_TX
......
......@@ -58,7 +58,8 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd,
uint8_t *mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
int plane, TX_TYPE tx_type, TX_SIZE tx_size,
uint8_t *dst, int stride, int eob);
uint8_t *dst, int stride, int eob,
int reduced_tx_set);
void av1_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
int eob, int bd);
......
......@@ -154,14 +154,16 @@ static REFERENCE_MODE read_frame_reference_mode(
static void inverse_transform_block(MACROBLOCKD *xd, int plane,
const TX_TYPE tx_type,
const TX_SIZE tx_size, uint8_t *dst,
int stride, int16_t scan_line, int eob) {
int stride, int16_t scan_line, int eob,
int reduced_tx_set) {
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *const dqcoeff = pd->dqcoeff;
av1_inverse_transform_block(xd, dqcoeff,
#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
xd->mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
plane, tx_type, tx_size, dst, stride, eob);
plane, tx_type, tx_size, dst, stride, eob,
reduced_tx_set);
memset(dqcoeff, 0, (scan_line + 1) * sizeof(dqcoeff[0]));
}
......@@ -217,7 +219,7 @@ static void predict_and_reconstruct_intra_block(
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
max_scan_line, eob);
max_scan_line, eob, cm->reduced_tx_set_used);
}
}
#if CONFIG_CFL
......@@ -276,10 +278,11 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
++cm->txb_count;
#endif
inverse_transform_block(xd, plane, tx_type, plane_tx_size,
&pd->dst.buf[(blk_row * pd->dst.stride + blk_col)
<< tx_size_wide_log2[0]],
pd->dst.stride, max_scan_line, eob);
inverse_transform_block(
xd, plane, tx_type, plane_tx_size,
&pd->dst
.buf[(blk_row * pd->dst.stride + blk_col) << tx_size_wide_log2[0]],
pd->dst.stride, max_scan_line, eob, cm->reduced_tx_set_used);
*eob_total += eob;
} else {
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
......
......@@ -689,7 +689,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
plane, tx_type, tx_size, dst, pd->dst.stride,
p->eobs[block]);
p->eobs[block], cm->reduced_tx_set_used);
}
}
......@@ -943,7 +943,8 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
plane, tx_type, tx_size, dst, dst_stride, *eob);
plane, tx_type, tx_size, dst, dst_stride, *eob,
cm->reduced_tx_set_used);
if (*eob) *(args->skip) = 0;
......
......@@ -2509,7 +2509,8 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
a, l, 1);
av1_inverse_transform_block_facade(xd, plane, block, blk_row, blk_col,
x->plane[plane].eobs[block]);
x->plane[plane].eobs[block],
cm->reduced_tx_set_used);
}
return best_rd;
}
......
......@@ -1890,7 +1890,8 @@ int av1_count_colors_highbd(const uint8_t *src8, int stride, int rows, int cols,
#endif // CONFIG_HIGHBITDEPTH
void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
int blk_row, int blk_col, int eob) {
int blk_row, int blk_col, int eob,
int reduced_tx_set) {
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
......@@ -1907,7 +1908,8 @@ void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
#if CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
plane, tx_type, tx_size, dst, dst_stride, eob);
plane, tx_type, tx_size, dst, dst_stride, eob,
reduced_tx_set);
}
void av1_dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
......@@ -2029,7 +2031,7 @@ void av1_dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
plane, tx_type, tx_size, recon, MAX_TX_SIZE,
eob);
eob, cpi->common.reduced_tx_set_used);
#if CONFIG_DIST_8X8
if (x->using_dist_8x8 && plane == 0 && (bsw < 8 || bsh < 8)) {
......@@ -2166,7 +2168,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
if (!is_inter_block(mbmi)) {
struct macroblock_plane *const p = &x->plane[plane];
av1_inverse_transform_block_facade(xd, plane, block, blk_row, blk_col,
p->eobs[block]);
p->eobs[block], cm->reduced_tx_set_used);
av1_dist_block(args->cpi, x, plane, plane_bsize, block, blk_row, blk_col,
tx_size, &this_rd_stats.dist, &this_rd_stats.sse,
OUTPUT_HAS_DECODED_PIXELS);
......@@ -3799,7 +3801,7 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
mrc_mask,
#endif // CONFIG_MRC_TX && SIGNAL_ANY_MRC_MASK
plane, tx_type, tx_size, rec_buffer, MAX_TX_SIZE,
eob);
eob, cm->reduced_tx_set_used);
if (eob > 0) {
#if CONFIG_DIST_8X8
if (x->using_dist_8x8 && plane == 0 && (bw < 8 && bh < 8)) {
......
......@@ -127,5 +127,6 @@ int64_t get_prediction_rd_cost(const struct AV1_COMP *cpi, struct macroblock *x,
MB_MODE_INFO *backup_mbmi);
void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
int blk_row, int blk_col, int eob);
int blk_row, int blk_col, int eob,
int reduced_tx_set);
#endif // AV1_ENCODER_RDOPT_H_
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