Commit c2b797fa authored by Jingning Han's avatar Jingning Han

Make maximum transform coding unit 64x64 for inter blocks

This commit makes the maximum transform coefficient coding unit
64x64 for inter coded blocks. It allows the hardware design to
reuse the existing 64x64 coding pipeline for 128x128 level blocks.

Change-Id: Ibadd59cf7e652984456cac621ec2294d48cf4507
parent b7b60c57
......@@ -2069,17 +2069,37 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
#endif
#if CONFIG_VAR_TX
const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd);
int mu_blocks_wide =
block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
int mu_blocks_high =
block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
mu_blocks_wide = AOMMIN(max_blocks_wide, mu_blocks_wide);
mu_blocks_high = AOMMIN(max_blocks_high, mu_blocks_high);
const TX_SIZE max_tx_size = get_vartx_max_txsize(mbmi, plane_bsize);
const int bh_var_tx = tx_size_high_unit[max_tx_size];
const int bw_var_tx = tx_size_wide_unit[max_tx_size];
int block = 0;
int step =
tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
for (row = 0; row < max_blocks_high; row += bh_var_tx) {
for (col = 0; col < max_blocks_wide; col += bw_var_tx) {
decode_reconstruct_tx(cm, xd, r, mbmi, plane, plane_bsize, row, col,
block, max_tx_size, &eobtotal);
block += step;
for (row = 0; row < max_blocks_high; row += mu_blocks_high) {
for (col = 0; col < max_blocks_wide; col += mu_blocks_wide) {
int blk_row, blk_col;
const int unit_height =
AOMMIN(mu_blocks_high + row, max_blocks_high);
const int unit_width =
AOMMIN(mu_blocks_wide + col, max_blocks_wide);
for (blk_row = row; blk_row < unit_height; blk_row += bh_var_tx) {
for (blk_col = col; blk_col < unit_width; blk_col += bw_var_tx) {
decode_reconstruct_tx(cm, xd, r, mbmi, plane, plane_bsize,
blk_row, blk_col, block, max_tx_size,
&eobtotal);
block += step;
}
}
}
}
#else
......
......@@ -2619,6 +2619,15 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
TOKEN_STATS token_stats;
init_token_stats(&token_stats);
const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd);
int mu_blocks_wide =
block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
int mu_blocks_high =
block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
mu_blocks_wide = AOMMIN(num_4x4_w, mu_blocks_wide);
mu_blocks_high = AOMMIN(num_4x4_h, mu_blocks_high);
if (is_inter_block(mbmi)) {
const TX_SIZE max_tx_size = get_vartx_max_txsize(mbmi, plane_bsize);
int block = 0;
......@@ -2626,19 +2635,27 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
const int bkw = tx_size_wide_unit[max_tx_size];
const int bkh = tx_size_high_unit[max_tx_size];
for (row = 0; row < num_4x4_h; row += bkh) {
for (col = 0; col < num_4x4_w; col += bkw) {
pack_txb_tokens(w,
for (row = 0; row < num_4x4_h; row += mu_blocks_high) {
for (col = 0; col < num_4x4_w; col += mu_blocks_wide) {
int blk_row, blk_col;
const int unit_height = AOMMIN(mu_blocks_high + row, num_4x4_h);
const int unit_width = AOMMIN(mu_blocks_wide + col, num_4x4_w);
for (blk_row = row; blk_row < unit_height; blk_row += bkh) {
for (blk_col = col; blk_col < unit_width; blk_col += bkw) {
pack_txb_tokens(w,
#if CONFIG_LV_MAP
cm,
cm,
#endif
tok, tok_end,
tok, tok_end,
#if CONFIG_PVQ || CONFIG_LV_MAP
x,
x,
#endif
xd, mbmi, plane, plane_bsize, cm->bit_depth, block,
row, col, max_tx_size, &token_stats);
block += step;
xd, mbmi, plane, plane_bsize, cm->bit_depth,
block, blk_row, blk_col, max_tx_size,
&token_stats);
block += step;
}
}
}
}
#if CONFIG_RD_DEBUG
......
......@@ -947,11 +947,27 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
arg.tl = ctx.tl[plane];
#if CONFIG_VAR_TX
for (idy = 0; idy < mi_height; idy += bh) {
for (idx = 0; idx < mi_width; idx += bw) {
encode_block_inter(plane, block, idy, idx, plane_bsize, max_tx_size,
&arg);
block += step;
const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd);
int mu_blocks_wide =
block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
int mu_blocks_high =
block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
mu_blocks_wide = AOMMIN(mi_width, mu_blocks_wide);
mu_blocks_high = AOMMIN(mi_height, mu_blocks_high);
for (idy = 0; idy < mi_height; idy += mu_blocks_high) {
for (idx = 0; idx < mi_width; idx += mu_blocks_wide) {
int blk_row, blk_col;
const int unit_height = AOMMIN(mu_blocks_high + idy, mi_height);
const int unit_width = AOMMIN(mu_blocks_wide + idx, mi_width);
for (blk_row = idy; blk_row < unit_height; blk_row += bh) {
for (blk_col = idx; blk_col < unit_width; blk_col += bw) {
encode_block_inter(plane, block, blk_row, blk_col, plane_bsize,
max_tx_size, &arg);
block += step;
}
}
}
}
#else
......
......@@ -689,14 +689,30 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
int idx, idy;
int block = 0;
int step = tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
for (idy = 0; idy < mi_height; idy += bh) {
for (idx = 0; idx < mi_width; idx += bw) {
tokenize_vartx(td, t, dry_run, max_tx_size, plane_bsize, idy, idx,
block, plane, &arg);
block += step;
const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd);
int mu_blocks_wide =
block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
int mu_blocks_high =
block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
mu_blocks_wide = AOMMIN(mi_width, mu_blocks_wide);
mu_blocks_high = AOMMIN(mi_height, mu_blocks_high);
for (idy = 0; idy < mi_height; idy += mu_blocks_high) {
for (idx = 0; idx < mi_width; idx += mu_blocks_wide) {
int blk_row, blk_col;
const int unit_height = AOMMIN(mu_blocks_high + idy, mi_height);
const int unit_width = AOMMIN(mu_blocks_wide + idx, mi_width);
for (blk_row = idy; blk_row < unit_height; blk_row += bh) {
for (blk_col = idx; blk_col < unit_width; blk_col += bw) {
tokenize_vartx(td, t, dry_run, max_tx_size, plane_bsize, blk_row,
blk_col, block, plane, &arg);
block += step;
}
}
}
}
#if !CONFIG_LV_MAP
if (!dry_run) {
(*t)->token = EOSB_TOKEN;
......
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