Commit 3aa28111 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Add chroma bsize modifications correctly

Change-Id: I807dc86489bc9219a24801841e66b555a2d7a51f
parent 0f3942ff
...@@ -511,16 +511,17 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, ...@@ -511,16 +511,17 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
int eobtotal = 0; int eobtotal = 0;
for (int plane = 0; plane < av1_num_planes(cm); ++plane) { for (int plane = 0; plane < av1_num_planes(cm); ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x,
pd->subsampling_y))
continue;
const BLOCK_SIZE bsizec =
scale_chroma_bsize(bsize, pd->subsampling_x, pd->subsampling_y);
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(bsizec, pd));
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane); const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
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;
if (!is_chroma_reference(mi_row, mi_col, bsize, pd->subsampling_x,
pd->subsampling_y))
continue;
const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd); const BLOCK_SIZE max_unit_bsize = get_plane_block_size(BLOCK_64X64, pd);
int mu_blocks_wide = int mu_blocks_wide =
block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0]; block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
......
...@@ -1871,18 +1871,19 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile, ...@@ -1871,18 +1871,19 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
assert(*tok < tok_end); assert(*tok < tok_end);
#endif #endif
for (plane = 0; plane < num_planes; ++plane) { for (plane = 0; plane < num_planes; ++plane) {
if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type, const struct macroblockd_plane *const pd = &xd->plane[plane];
xd->plane[plane].subsampling_x, if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type, pd->subsampling_x,
xd->plane[plane].subsampling_y)) { pd->subsampling_y)) {
#if !CONFIG_LV_MAP #if !CONFIG_LV_MAP
(*tok)++; (*tok)++;
#endif // !CONFIG_LV_MAP #endif // !CONFIG_LV_MAP
continue; continue;
} }
const struct macroblockd_plane *const pd = &xd->plane[plane]; const BLOCK_SIZE bsize = mbmi->sb_type;
BLOCK_SIZE bsize = mbmi->sb_type; const BLOCK_SIZE bsizec =
scale_chroma_bsize(bsize, pd->subsampling_x, pd->subsampling_y);
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(bsizec, pd));
const int num_4x4_w = const int num_4x4_w =
block_size_wide[plane_bsize] >> tx_size_wide_log2[0]; block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
......
...@@ -821,11 +821,12 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, ...@@ -821,11 +821,12 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
subsampling_y)) subsampling_y))
continue; continue;
bsize = scale_chroma_bsize(bsize, subsampling_x, subsampling_y); const BLOCK_SIZE bsizec =
scale_chroma_bsize(bsize, subsampling_x, subsampling_y);
// TODO(jingning): Clean this up. // TODO(jingning): Clean this up.
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); const BLOCK_SIZE plane_bsize = get_plane_block_size(bsizec, pd);
const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0]; const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int mi_height = block_size_high[plane_bsize] >> tx_size_wide_log2[0]; const int mi_height = block_size_high[plane_bsize] >> tx_size_wide_log2[0];
const TX_SIZE max_tx_size = get_vartx_max_txsize( const TX_SIZE max_tx_size = get_vartx_max_txsize(
...@@ -836,9 +837,9 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, ...@@ -836,9 +837,9 @@ void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
int idx, idy; int idx, idy;
int block = 0; int block = 0;
int step = tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size]; int step = tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
av1_get_entropy_contexts(bsize, 0, pd, ctx.ta[plane], ctx.tl[plane]); av1_get_entropy_contexts(bsizec, 0, pd, ctx.ta[plane], ctx.tl[plane]);
av1_subtract_plane(x, bsize, plane); av1_subtract_plane(x, bsizec, plane);
arg.ta = ctx.ta[plane]; arg.ta = ctx.ta[plane];
arg.tl = ctx.tl[plane]; arg.tl = ctx.tl[plane];
......
...@@ -5008,8 +5008,8 @@ int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_stats, ...@@ -5008,8 +5008,8 @@ int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_stats,
av1_init_rd_stats(rd_stats); av1_init_rd_stats(rd_stats);
if (x->skip_chroma_rd) return is_cost_valid; if (x->skip_chroma_rd) return is_cost_valid;
bsize = scale_chroma_bsize(mbmi->sb_type, xd->plane[1].subsampling_x, const BLOCK_SIZE bsizec = scale_chroma_bsize(
xd->plane[1].subsampling_y); bsize, xd->plane[1].subsampling_x, xd->plane[1].subsampling_y);
#if 0 // CONFIG_EXT_TX #if 0 // CONFIG_EXT_TX
if (is_rect_tx(mbmi->tx_size)) { if (is_rect_tx(mbmi->tx_size)) {
...@@ -5019,13 +5019,13 @@ int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_stats, ...@@ -5019,13 +5019,13 @@ int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_stats,
if (is_inter_block(mbmi) && is_cost_valid) { if (is_inter_block(mbmi) && is_cost_valid) {
for (plane = 1; plane < MAX_MB_PLANE; ++plane) for (plane = 1; plane < MAX_MB_PLANE; ++plane)
av1_subtract_plane(x, bsize, plane); av1_subtract_plane(x, bsizec, plane);
} }
if (is_cost_valid) { if (is_cost_valid) {
for (plane = 1; plane < MAX_MB_PLANE; ++plane) { for (plane = 1; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); const BLOCK_SIZE plane_bsize = get_plane_block_size(bsizec, pd);
const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0]; const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int mi_height = const int mi_height =
block_size_high[plane_bsize] >> tx_size_high_log2[0]; block_size_high[plane_bsize] >> tx_size_high_log2[0];
...@@ -5040,7 +5040,7 @@ int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_stats, ...@@ -5040,7 +5040,7 @@ int inter_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_stats,
ENTROPY_CONTEXT tl[2 * MAX_MIB_SIZE]; ENTROPY_CONTEXT tl[2 * MAX_MIB_SIZE];
RD_STATS pn_rd_stats; RD_STATS pn_rd_stats;
av1_init_rd_stats(&pn_rd_stats); av1_init_rd_stats(&pn_rd_stats);
av1_get_entropy_contexts(bsize, 0, pd, ta, tl); av1_get_entropy_contexts(bsizec, 0, pd, ta, tl);
for (idy = 0; idy < mi_height; idy += bh) { for (idy = 0; idy < mi_height; idy += bh) {
for (idx = 0; idx < mi_width; idx += bw) { for (idx = 0; idx < mi_width; idx += bw) {
......
...@@ -653,8 +653,10 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t, ...@@ -653,8 +653,10 @@ void av1_tokenize_sb_vartx(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
continue; continue;
} }
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
const BLOCK_SIZE bsizec =
scale_chroma_bsize(bsize, pd->subsampling_x, pd->subsampling_y);
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(bsizec, pd));
const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0]; const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int mi_height = block_size_high[plane_bsize] >> tx_size_wide_log2[0]; const int mi_height = block_size_high[plane_bsize] >> tx_size_wide_log2[0];
const TX_SIZE max_tx_size = get_vartx_max_txsize( const TX_SIZE max_tx_size = get_vartx_max_txsize(
......
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