Commit 7fcfee40 authored by Angie Chiang's avatar Angie Chiang

Prefer using get_tx_size()

Change-Id: Ifcdd3ce2953c1ecb1d0962da412a4b5ba2cda912
parent 345a22db
...@@ -126,11 +126,10 @@ void av1_foreach_transformed_block_in_plane( ...@@ -126,11 +126,10 @@ void av1_foreach_transformed_block_in_plane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane, const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
foreach_transformed_block_visitor visit, void *arg) { foreach_transformed_block_visitor visit, void *arg) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b") // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8 // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way. // transform size varies per plane, look it up in a common way.
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = get_tx_size(plane, xd);
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2 #if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
const BLOCK_SIZE plane_bsize = const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd)); AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
...@@ -165,11 +164,10 @@ void av1_foreach_8x8_transformed_block_in_plane( ...@@ -165,11 +164,10 @@ void av1_foreach_8x8_transformed_block_in_plane(
foreach_transformed_block_visitor visit, foreach_transformed_block_visitor visit,
foreach_transformed_block_visitor mi_visit, void *arg) { foreach_transformed_block_visitor mi_visit, void *arg) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b") // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8 // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way. // transform size varies per plane, look it up in a common way.
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = get_tx_size(plane, xd);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const uint8_t txw_unit = tx_size_wide_unit[tx_size]; const uint8_t txw_unit = tx_size_wide_unit[tx_size];
const uint8_t txh_unit = tx_size_high_unit[tx_size]; const uint8_t txh_unit = tx_size_high_unit[tx_size];
......
...@@ -933,12 +933,10 @@ static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi, ...@@ -933,12 +933,10 @@ static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
return uv_txsize; return uv_txsize;
} }
static INLINE TX_SIZE get_tx_size(int plane, const MACROBLOCKD *xd, static INLINE TX_SIZE get_tx_size(int plane, const MACROBLOCKD *xd) {
int block_idx) {
const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const MACROBLOCKD_PLANE *pd = &xd->plane[plane]; const MACROBLOCKD_PLANE *pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
(void)block_idx;
return tx_size; return tx_size;
} }
......
...@@ -708,6 +708,7 @@ static MB_MODE_INFO *set_offsets_extend(AV1_COMMON *const cm, ...@@ -708,6 +708,7 @@ static MB_MODE_INFO *set_offsets_extend(AV1_COMMON *const cm,
return &xd->mi[0]->mbmi; return &xd->mi[0]->mbmi;
} }
#if CONFIG_SUPERTX
static MB_MODE_INFO *set_mb_offsets(AV1_COMMON *const cm, MACROBLOCKD *const xd, static MB_MODE_INFO *set_mb_offsets(AV1_COMMON *const cm, MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col, BLOCK_SIZE bsize, int mi_row, int mi_col,
int bw, int bh, int x_mis, int y_mis) { int bw, int bh, int x_mis, int y_mis) {
...@@ -729,6 +730,7 @@ static MB_MODE_INFO *set_mb_offsets(AV1_COMMON *const cm, MACROBLOCKD *const xd, ...@@ -729,6 +730,7 @@ static MB_MODE_INFO *set_mb_offsets(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#endif #endif
return &xd->mi[0]->mbmi; return &xd->mi[0]->mbmi;
} }
#endif
static void set_offsets_topblock(AV1_COMMON *const cm, MACROBLOCKD *const xd, static void set_offsets_topblock(AV1_COMMON *const cm, MACROBLOCKD *const xd,
const TileInfo *const tile, BLOCK_SIZE bsize, const TileInfo *const tile, BLOCK_SIZE bsize,
...@@ -1660,7 +1662,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, ...@@ -1660,7 +1662,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
#endif // CONFIG_PALETTE && !CONFIG_PALETTE_THROUGHPUT #endif // CONFIG_PALETTE && !CONFIG_PALETTE_THROUGHPUT
for (plane = 0; plane < MAX_MB_PLANE; ++plane) { for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = get_tx_size(plane, xd);
const int stepr = tx_size_high_unit[tx_size]; const int stepr = tx_size_high_unit[tx_size];
const int stepc = tx_size_wide_unit[tx_size]; const int stepc = tx_size_wide_unit[tx_size];
#if CONFIG_CB4X4 #if CONFIG_CB4X4
...@@ -1780,8 +1782,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, ...@@ -1780,8 +1782,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
decode_reconstruct_tx(cm, xd, r, mbmi, plane, plane_bsize, row, col, decode_reconstruct_tx(cm, xd, r, mbmi, plane, plane_bsize, row, col,
max_tx_size, &eobtotal); max_tx_size, &eobtotal);
#else #else
const TX_SIZE tx_size = const TX_SIZE tx_size = get_tx_size(plane, xd);
plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
const int stepr = tx_size_high_unit[tx_size]; const int stepr = tx_size_high_unit[tx_size];
const int stepc = tx_size_wide_unit[tx_size]; const int stepc = tx_size_wide_unit[tx_size];
for (row = 0; row < max_blocks_high; row += stepr) for (row = 0; row < max_blocks_high; row += stepr)
...@@ -2289,7 +2290,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd, ...@@ -2289,7 +2290,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
for (i = 0; i < MAX_MB_PLANE; ++i) { for (i = 0; i < MAX_MB_PLANE; ++i) {
const struct macroblockd_plane *const pd = &xd->plane[i]; const struct macroblockd_plane *const pd = &xd->plane[i];
int row, col; int row, col;
const TX_SIZE tx_size = i ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = get_tx_size(i, xd);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const int stepr = tx_size_high_unit[tx_size]; const int stepr = tx_size_high_unit[tx_size];
const int stepc = tx_size_wide_unit[tx_size]; const int stepc = tx_size_wide_unit[tx_size];
......
...@@ -37,7 +37,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -37,7 +37,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_reader *r, int block, int plane, aom_reader *r, int block, int plane,
tran_low_t *tcoeffs, TXB_CTX *txb_ctx) { tran_low_t *tcoeffs, TXB_CTX *txb_ctx) {
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
TX_SIZE tx_size = get_tx_size(plane, xd, block); TX_SIZE tx_size = get_tx_size(plane, xd);
PLANE_TYPE plane_type = get_plane_type(plane); PLANE_TYPE plane_type = get_plane_type(plane);
aom_prob *nz_map = cm->fc->nz_map[tx_size][plane_type]; aom_prob *nz_map = cm->fc->nz_map[tx_size][plane_type];
aom_prob *eob_flag = cm->fc->eob_flag[tx_size][plane_type]; aom_prob *eob_flag = cm->fc->eob_flag[tx_size][plane_type];
......
...@@ -2219,8 +2219,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile, ...@@ -2219,8 +2219,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
} }
#endif // CONFIG_RD_DEBUG #endif // CONFIG_RD_DEBUG
} else { } else {
TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) TX_SIZE tx = get_tx_size(plane, xd);
: m->mbmi.tx_size;
const int bkw = tx_size_wide_unit[tx]; const int bkw = tx_size_wide_unit[tx];
const int bkh = tx_size_high_unit[tx]; const int bkh = tx_size_high_unit[tx];
#if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT #if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT
...@@ -2252,8 +2251,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile, ...@@ -2252,8 +2251,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
} }
} }
#else #else
TX_SIZE tx = TX_SIZE tx = get_tx_size(plane, xd);
plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) : m->mbmi.tx_size;
TOKEN_STATS token_stats; TOKEN_STATS token_stats;
#if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT #if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
...@@ -2319,8 +2317,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile, ...@@ -2319,8 +2317,7 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
if (!m->mbmi.skip) { if (!m->mbmi.skip) {
for (plane = 0; plane < MAX_MB_PLANE; ++plane) { for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
PVQ_INFO *pvq; PVQ_INFO *pvq;
TX_SIZE tx_size = TX_SIZE tx_size = get_tx_size(plane, xd);
plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) : m->mbmi.tx_size;
int idx, idy; int idx, idy;
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
int max_blocks_wide; int max_blocks_wide;
...@@ -2731,8 +2728,7 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile, ...@@ -2731,8 +2728,7 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
const int max_blocks_high = max_block_high(xd, plane_bsize, plane); const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
int row, col; int row, col;
TX_SIZE tx = TX_SIZE tx = get_tx_size(plane, xd);
plane ? get_uv_tx_size(mbmi, &xd->plane[plane]) : mbmi->tx_size;
BLOCK_SIZE txb_size = txsize_to_bsize[tx]; BLOCK_SIZE txb_size = txsize_to_bsize[tx];
const int stepr = tx_size_high_unit[txb_size]; const int stepr = tx_size_high_unit[txb_size];
......
...@@ -912,7 +912,7 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, ...@@ -912,7 +912,7 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize,
av1_get_entropy_contexts(bsize, 0, pd, ctx.ta[plane], ctx.tl[plane]); av1_get_entropy_contexts(bsize, 0, pd, ctx.ta[plane], ctx.tl[plane]);
#else #else
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = get_tx_size(plane, xd);
av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]); av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]);
#endif #endif
...@@ -953,7 +953,7 @@ void av1_encode_sb_supertx(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize) { ...@@ -953,7 +953,7 @@ void av1_encode_sb_supertx(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize) {
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
const TX_SIZE tx_size = TX_4X4; const TX_SIZE tx_size = TX_4X4;
#else #else
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; const TX_SIZE tx_size = get_tx_size(plane, xd);
#endif #endif
av1_subtract_plane(x, bsize, plane); av1_subtract_plane(x, bsize, plane);
av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]); av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]);
...@@ -1152,8 +1152,7 @@ void av1_encode_intra_block_plane(AV1_COMMON *cm, MACROBLOCK *x, ...@@ -1152,8 +1152,7 @@ void av1_encode_intra_block_plane(AV1_COMMON *cm, MACROBLOCK *x,
if (enable_optimize_b) { if (enable_optimize_b) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size = const TX_SIZE tx_size = get_tx_size(plane, xd);
plane ? get_uv_tx_size(&xd->mi[0]->mbmi, pd) : xd->mi[0]->mbmi.tx_size;
av1_get_entropy_contexts(bsize, tx_size, pd, ta, tl); av1_get_entropy_contexts(bsize, tx_size, pd, ta, tl);
} }
av1_foreach_transformed_block_in_plane(xd, bsize, plane, av1_foreach_transformed_block_in_plane(xd, bsize, plane,
......
...@@ -36,7 +36,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -36,7 +36,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_prob *eob_flag; aom_prob *eob_flag;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const PLANE_TYPE plane_type = get_plane_type(plane); const PLANE_TYPE plane_type = get_plane_type(plane);
const TX_SIZE tx_size = get_tx_size(plane, xd, block); const TX_SIZE tx_size = get_tx_size(plane, xd);
const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const SCAN_ORDER *const scan_order = const SCAN_ORDER *const scan_order =
get_scan(cm, tx_size, tx_type, is_inter_block(mbmi)); get_scan(cm, tx_size, tx_type, is_inter_block(mbmi));
......
...@@ -1126,8 +1126,7 @@ int av1_cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane, ...@@ -1126,8 +1126,7 @@ int av1_cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
#if !CONFIG_VAR_TX && !CONFIG_SUPERTX #if !CONFIG_VAR_TX && !CONFIG_SUPERTX
// Check for consistency of tx_size with mode info // Check for consistency of tx_size with mode info
assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size assert(tx_size == get_tx_size(plane, xd));
: get_uv_tx_size(mbmi, pd) == tx_size);
#endif // !CONFIG_VAR_TX && !CONFIG_SUPERTX #endif // !CONFIG_VAR_TX && !CONFIG_SUPERTX
(void)cm; (void)cm;
......
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