Introduce DecoderCodingBlock struct.
This contains the common object of type MACROBLOCKD and also the
decoder-only variables.
Note: This is similar to existing struct MACROBLOCK on the encoder side.
Also, move the decoder only variables from MACROBLOCKD to the new
DecoderCodingBlock struct.
BUG=aomedia:2610
Change-Id: Ie55b9149b06e35940f1a5b5cf215d85850ee29e2
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index aedb5c2..6e64399 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -140,31 +140,30 @@
}
}
-static AOM_INLINE void inverse_transform_block(MACROBLOCKD *xd, int plane,
- const TX_TYPE tx_type,
+static AOM_INLINE void inverse_transform_block(DecoderCodingBlock *dcb,
+ int plane, const TX_TYPE tx_type,
const TX_SIZE tx_size,
uint8_t *dst, int stride,
int reduced_tx_set) {
- struct macroblockd_plane *const pd = &xd->plane[plane];
- tran_low_t *const dqcoeff = pd->dqcoeff_block + xd->cb_offset[plane];
- eob_info *eob_data = pd->eob_data + xd->txb_offset[plane];
+ tran_low_t *const dqcoeff = dcb->dqcoeff_block[plane] + dcb->cb_offset[plane];
+ eob_info *eob_data = dcb->eob_data[plane] + dcb->txb_offset[plane];
uint16_t scan_line = eob_data->max_scan_line;
uint16_t eob = eob_data->eob;
- av1_inverse_transform_block(xd, dqcoeff, plane, tx_type, tx_size, dst, stride,
- eob, reduced_tx_set);
+ av1_inverse_transform_block(&dcb->xd, dqcoeff, plane, tx_type, tx_size, dst,
+ stride, eob, reduced_tx_set);
memset(dqcoeff, 0, (scan_line + 1) * sizeof(dqcoeff[0]));
}
static AOM_INLINE void read_coeffs_tx_intra_block(
- const AV1_COMMON *const cm, MACROBLOCKD *const xd, aom_reader *const r,
+ const AV1_COMMON *const cm, DecoderCodingBlock *dcb, aom_reader *const r,
const int plane, const int row, const int col, const TX_SIZE tx_size) {
- MB_MODE_INFO *mbmi = xd->mi[0];
+ MB_MODE_INFO *mbmi = dcb->xd.mi[0];
if (!mbmi->skip_txfm) {
#if TXCOEFF_TIMER
struct aom_usec_timer timer;
aom_usec_timer_start(&timer);
#endif
- av1_read_coeffs_txb_facade(cm, xd, r, plane, row, col, tx_size);
+ av1_read_coeffs_txb_facade(cm, dcb, r, plane, row, col, tx_size);
#if TXCOEFF_TIMER
aom_usec_timer_mark(&timer);
const int64_t elapsed_time = aom_usec_timer_elapsed(&timer);
@@ -175,12 +174,12 @@
}
static AOM_INLINE void decode_block_void(const AV1_COMMON *const cm,
- MACROBLOCKD *const xd,
+ DecoderCodingBlock *dcb,
aom_reader *const r, const int plane,
const int row, const int col,
const TX_SIZE tx_size) {
(void)cm;
- (void)xd;
+ (void)dcb;
(void)r;
(void)plane;
(void)row;
@@ -189,10 +188,10 @@
}
static AOM_INLINE void predict_inter_block_void(AV1_COMMON *const cm,
- MACROBLOCKD *const xd,
+ DecoderCodingBlock *dcb,
BLOCK_SIZE bsize) {
(void)cm;
- (void)xd;
+ (void)dcb;
(void)bsize;
}
@@ -203,24 +202,25 @@
}
static AOM_INLINE void predict_and_reconstruct_intra_block(
- const AV1_COMMON *const cm, MACROBLOCKD *const xd, aom_reader *const r,
+ const AV1_COMMON *const cm, DecoderCodingBlock *dcb, aom_reader *const r,
const int plane, const int row, const int col, const TX_SIZE tx_size) {
(void)r;
+ MACROBLOCKD *const xd = &dcb->xd;
MB_MODE_INFO *mbmi = xd->mi[0];
PLANE_TYPE plane_type = get_plane_type(plane);
av1_predict_intra_block_facade(cm, xd, plane, col, row, tx_size);
if (!mbmi->skip_txfm) {
- struct macroblockd_plane *const pd = &xd->plane[plane];
- eob_info *eob_data = pd->eob_data + xd->txb_offset[plane];
+ eob_info *eob_data = dcb->eob_data[plane] + dcb->txb_offset[plane];
if (eob_data->eob) {
const bool reduced_tx_set_used = cm->features.reduced_tx_set_used;
// tx_type was read out in av1_read_coeffs_txb.
const TX_TYPE tx_type = av1_get_tx_type(xd, plane_type, row, col, tx_size,
reduced_tx_set_used);
+ struct macroblockd_plane *const pd = &xd->plane[plane];
uint8_t *dst = &pd->dst.buf[(row * pd->dst.stride + col) << MI_SIZE_LOG2];
- inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
+ inverse_transform_block(dcb, plane, tx_type, tx_size, dst, pd->dst.stride,
reduced_tx_set_used);
}
}
@@ -230,10 +230,11 @@
}
static AOM_INLINE void inverse_transform_inter_block(
- const AV1_COMMON *const cm, MACROBLOCKD *const xd, aom_reader *const r,
+ const AV1_COMMON *const cm, DecoderCodingBlock *dcb, aom_reader *const r,
const int plane, const int blk_row, const int blk_col,
const TX_SIZE tx_size) {
(void)r;
+ MACROBLOCKD *const xd = &dcb->xd;
PLANE_TYPE plane_type = get_plane_type(plane);
const struct macroblockd_plane *const pd = &xd->plane[plane];
const bool reduced_tx_set_used = cm->features.reduced_tx_set_used;
@@ -243,7 +244,7 @@
uint8_t *dst =
&pd->dst.buf[(blk_row * pd->dst.stride + blk_col) << MI_SIZE_LOG2];
- inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
+ inverse_transform_block(dcb, plane, tx_type, tx_size, dst, pd->dst.stride,
reduced_tx_set_used);
#if CONFIG_MISMATCH_DEBUG
int pixel_c, pixel_r;
@@ -260,18 +261,19 @@
#endif
}
-static AOM_INLINE void set_cb_buffer_offsets(MACROBLOCKD *const xd,
+static AOM_INLINE void set_cb_buffer_offsets(DecoderCodingBlock *dcb,
TX_SIZE tx_size, int plane) {
- xd->cb_offset[plane] += tx_size_wide[tx_size] * tx_size_high[tx_size];
- xd->txb_offset[plane] =
- xd->cb_offset[plane] / (TX_SIZE_W_MIN * TX_SIZE_H_MIN);
+ dcb->cb_offset[plane] += tx_size_wide[tx_size] * tx_size_high[tx_size];
+ dcb->txb_offset[plane] =
+ dcb->cb_offset[plane] / (TX_SIZE_W_MIN * TX_SIZE_H_MIN);
}
static AOM_INLINE void decode_reconstruct_tx(
AV1_COMMON *cm, ThreadData *const td, aom_reader *r,
MB_MODE_INFO *const mbmi, int plane, BLOCK_SIZE plane_bsize, int blk_row,
int blk_col, int block, TX_SIZE tx_size, int *eob_total) {
- MACROBLOCKD *const xd = &td->xd;
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE plane_tx_size =
plane ? av1_get_max_uv_txsize(mbmi->sb_type, pd->subsampling_x,
@@ -285,14 +287,14 @@
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
if (tx_size == plane_tx_size || plane) {
- td->read_coeffs_tx_inter_block_visit(cm, xd, r, plane, blk_row, blk_col,
+ td->read_coeffs_tx_inter_block_visit(cm, dcb, r, plane, blk_row, blk_col,
tx_size);
- td->inverse_tx_inter_block_visit(cm, xd, r, plane, blk_row, blk_col,
+ td->inverse_tx_inter_block_visit(cm, dcb, r, plane, blk_row, blk_col,
tx_size);
- eob_info *eob_data = pd->eob_data + xd->txb_offset[plane];
+ eob_info *eob_data = dcb->eob_data[plane] + dcb->txb_offset[plane];
*eob_total += eob_data->eob;
- set_cb_buffer_offsets(xd, tx_size, plane);
+ set_cb_buffer_offsets(dcb, tx_size, plane);
} else {
const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
assert(IMPLIES(tx_size <= TX_4X4, sub_txs == tx_size));
@@ -353,7 +355,7 @@
}
static AOM_INLINE void decode_mbmi_block(AV1Decoder *const pbi,
- MACROBLOCKD *const xd, int mi_row,
+ DecoderCodingBlock *dcb, int mi_row,
int mi_col, aom_reader *r,
PARTITION_TYPE partition,
BLOCK_SIZE bsize) {
@@ -363,13 +365,14 @@
const int bh = mi_size_high[bsize];
const int x_mis = AOMMIN(bw, cm->mi_params.mi_cols - mi_col);
const int y_mis = AOMMIN(bh, cm->mi_params.mi_rows - mi_row);
+ MACROBLOCKD *const xd = &dcb->xd;
#if CONFIG_ACCOUNTING
aom_accounting_set_context(&pbi->accounting, mi_col, mi_row);
#endif
set_offsets(cm, xd, bsize, mi_row, mi_col, bw, bh, x_mis, y_mis);
xd->mi[0]->partition = partition;
- av1_read_mode_info(pbi, xd, r, x_mis, y_mis);
+ av1_read_mode_info(pbi, dcb, r, x_mis, y_mis);
if (bsize >= BLOCK_8X8 &&
(seq_params->subsampling_x || seq_params->subsampling_y)) {
const BLOCK_SIZE uv_subsize =
@@ -629,8 +632,8 @@
static void dec_calc_subpel_params_and_extend(
const MV *const src_mv, InterPredParams *const inter_pred_params,
- MACROBLOCKD *xd, int mi_x, int mi_y, int ref, uint8_t **pre,
- SubpelParams *subpel_params, int *src_stride) {
+ MACROBLOCKD *const xd, int mi_x, int mi_y, int ref, uint8_t **mc_buf,
+ uint8_t **pre, SubpelParams *subpel_params, int *src_stride) {
PadBlock block;
MV32 scaled_mv;
int subpel_x_mv, subpel_y_mv;
@@ -641,26 +644,30 @@
inter_pred_params->scale_factors, &inter_pred_params->ref_frame_buf,
scaled_mv, block, subpel_x_mv, subpel_y_mv,
inter_pred_params->mode == WARP_PRED, inter_pred_params->is_intrabc,
- inter_pred_params->use_hbd_buf, xd->mc_buf[ref], pre, src_stride);
+ inter_pred_params->use_hbd_buf, mc_buf[ref], pre, src_stride);
}
-static void dec_build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
- int plane, const MB_MODE_INFO *mi,
+static void dec_build_inter_predictors(const AV1_COMMON *cm,
+ DecoderCodingBlock *dcb, int plane,
+ const MB_MODE_INFO *mi,
int build_for_obmc, int bw, int bh,
int mi_x, int mi_y) {
- av1_build_inter_predictors(cm, xd, plane, mi, build_for_obmc, bw, bh, mi_x,
- mi_y, dec_calc_subpel_params_and_extend);
+ av1_build_inter_predictors(cm, &dcb->xd, plane, mi, build_for_obmc, bw, bh,
+ mi_x, mi_y, dcb->mc_buf,
+ dec_calc_subpel_params_and_extend);
}
static AOM_INLINE void dec_build_inter_predictor(const AV1_COMMON *cm,
- MACROBLOCKD *xd, int mi_row,
- int mi_col, BLOCK_SIZE bsize) {
+ DecoderCodingBlock *dcb,
+ int mi_row, int mi_col,
+ BLOCK_SIZE bsize) {
+ MACROBLOCKD *const xd = &dcb->xd;
const int num_planes = av1_num_planes(cm);
for (int plane = 0; plane < num_planes; ++plane) {
if (plane && !xd->is_chroma_ref) break;
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
- dec_build_inter_predictors(cm, xd, plane, xd->mi[0], 0,
+ dec_build_inter_predictors(cm, dcb, plane, xd->mi[0], 0,
xd->plane[plane].width, xd->plane[plane].height,
mi_x, mi_y);
if (is_interintra_pred(xd->mi[0])) {
@@ -676,7 +683,7 @@
}
static INLINE void dec_build_prediction_by_above_pred(
- MACROBLOCKD *xd, int rel_mi_row, int rel_mi_col, uint8_t op_mi_size,
+ MACROBLOCKD *const xd, int rel_mi_row, int rel_mi_col, uint8_t op_mi_size,
int dir, MB_MODE_INFO *above_mbmi, void *fun_ctxt, const int num_planes) {
struct build_prediction_ctxt *ctxt = (struct build_prediction_ctxt *)fun_ctxt;
const int above_mi_col = xd->mi_col + rel_mi_col;
@@ -700,15 +707,16 @@
block_size_high[BLOCK_64X64] >> (pd->subsampling_y + 1));
if (av1_skip_u4x4_pred_in_obmc(bsize, pd, 0)) continue;
- dec_build_inter_predictors(ctxt->cm, xd, j, &backup_mbmi, 1, bw, bh, mi_x,
- mi_y);
+ dec_build_inter_predictors(ctxt->cm, (DecoderCodingBlock *)ctxt->dcb, j,
+ &backup_mbmi, 1, bw, bh, mi_x, mi_y);
}
}
static AOM_INLINE void dec_build_prediction_by_above_preds(
- const AV1_COMMON *cm, MACROBLOCKD *xd, uint8_t *tmp_buf[MAX_MB_PLANE],
- int tmp_width[MAX_MB_PLANE], int tmp_height[MAX_MB_PLANE],
- int tmp_stride[MAX_MB_PLANE]) {
+ const AV1_COMMON *cm, DecoderCodingBlock *dcb,
+ uint8_t *tmp_buf[MAX_MB_PLANE], int tmp_width[MAX_MB_PLANE],
+ int tmp_height[MAX_MB_PLANE], int tmp_stride[MAX_MB_PLANE]) {
+ MACROBLOCKD *const xd = &dcb->xd;
if (!xd->up_available) return;
// Adjust mb_to_bottom_edge to have the correct value for the OBMC
@@ -717,9 +725,9 @@
const int this_height = xd->height * MI_SIZE;
const int pred_height = AOMMIN(this_height / 2, 32);
xd->mb_to_bottom_edge += GET_MV_SUBPEL(this_height - pred_height);
- struct build_prediction_ctxt ctxt = { cm, tmp_buf,
- tmp_width, tmp_height,
- tmp_stride, xd->mb_to_right_edge };
+ struct build_prediction_ctxt ctxt = {
+ cm, tmp_buf, tmp_width, tmp_height, tmp_stride, xd->mb_to_right_edge, dcb
+ };
const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
foreach_overlappable_nb_above(cm, xd,
max_neighbor_obmc[mi_size_wide_log2[bsize]],
@@ -731,7 +739,7 @@
}
static INLINE void dec_build_prediction_by_left_pred(
- MACROBLOCKD *xd, int rel_mi_row, int rel_mi_col, uint8_t op_mi_size,
+ MACROBLOCKD *const xd, int rel_mi_row, int rel_mi_col, uint8_t op_mi_size,
int dir, MB_MODE_INFO *left_mbmi, void *fun_ctxt, const int num_planes) {
struct build_prediction_ctxt *ctxt = (struct build_prediction_ctxt *)fun_ctxt;
const int left_mi_row = xd->mi_row + rel_mi_row;
@@ -754,15 +762,16 @@
int bh = (op_mi_size << MI_SIZE_LOG2) >> pd->subsampling_y;
if (av1_skip_u4x4_pred_in_obmc(bsize, pd, 1)) continue;
- dec_build_inter_predictors(ctxt->cm, xd, j, &backup_mbmi, 1, bw, bh, mi_x,
- mi_y);
+ dec_build_inter_predictors(ctxt->cm, (DecoderCodingBlock *)ctxt->dcb, j,
+ &backup_mbmi, 1, bw, bh, mi_x, mi_y);
}
}
static AOM_INLINE void dec_build_prediction_by_left_preds(
- const AV1_COMMON *cm, MACROBLOCKD *xd, uint8_t *tmp_buf[MAX_MB_PLANE],
- int tmp_width[MAX_MB_PLANE], int tmp_height[MAX_MB_PLANE],
- int tmp_stride[MAX_MB_PLANE]) {
+ const AV1_COMMON *cm, DecoderCodingBlock *dcb,
+ uint8_t *tmp_buf[MAX_MB_PLANE], int tmp_width[MAX_MB_PLANE],
+ int tmp_height[MAX_MB_PLANE], int tmp_stride[MAX_MB_PLANE]) {
+ MACROBLOCKD *const xd = &dcb->xd;
if (!xd->left_available) return;
// Adjust mb_to_right_edge to have the correct value for the OBMC
@@ -772,9 +781,9 @@
const int pred_width = AOMMIN(this_width / 2, 32);
xd->mb_to_right_edge += GET_MV_SUBPEL(this_width - pred_width);
- struct build_prediction_ctxt ctxt = { cm, tmp_buf,
- tmp_width, tmp_height,
- tmp_stride, xd->mb_to_bottom_edge };
+ struct build_prediction_ctxt ctxt = {
+ cm, tmp_buf, tmp_width, tmp_height, tmp_stride, xd->mb_to_bottom_edge, dcb
+ };
const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
foreach_overlappable_nb_left(cm, xd,
max_neighbor_obmc[mi_size_high_log2[bsize]],
@@ -785,8 +794,8 @@
xd->mb_to_bottom_edge = ctxt.mb_to_far_edge;
}
-static AOM_INLINE void dec_build_obmc_inter_predictors_sb(const AV1_COMMON *cm,
- MACROBLOCKD *xd) {
+static AOM_INLINE void dec_build_obmc_inter_predictors_sb(
+ const AV1_COMMON *cm, DecoderCodingBlock *dcb) {
const int num_planes = av1_num_planes(cm);
uint8_t *dst_buf1[MAX_MB_PLANE], *dst_buf2[MAX_MB_PLANE];
int dst_stride1[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
@@ -796,11 +805,12 @@
int dst_height1[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
int dst_height2[MAX_MB_PLANE] = { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE };
+ MACROBLOCKD *const xd = &dcb->xd;
av1_setup_obmc_dst_bufs(xd, dst_buf1, dst_buf2);
- dec_build_prediction_by_above_preds(cm, xd, dst_buf1, dst_width1, dst_height1,
- dst_stride1);
- dec_build_prediction_by_left_preds(cm, xd, dst_buf2, dst_width2, dst_height2,
+ dec_build_prediction_by_above_preds(cm, dcb, dst_buf1, dst_width1,
+ dst_height1, dst_stride1);
+ dec_build_prediction_by_left_preds(cm, dcb, dst_buf2, dst_width2, dst_height2,
dst_stride2);
const int mi_row = xd->mi_row;
const int mi_col = xd->mi_col;
@@ -819,8 +829,9 @@
}
static AOM_INLINE void predict_inter_block(AV1_COMMON *const cm,
- MACROBLOCKD *const xd,
+ DecoderCodingBlock *dcb,
BLOCK_SIZE bsize) {
+ MACROBLOCKD *const xd = &dcb->xd;
MB_MODE_INFO *mbmi = xd->mi[0];
const int num_planes = av1_num_planes(cm);
const int mi_row = xd->mi_row;
@@ -842,9 +853,9 @@
}
}
- dec_build_inter_predictor(cm, xd, mi_row, mi_col, bsize);
+ dec_build_inter_predictor(cm, dcb, mi_row, mi_col, bsize);
if (mbmi->motion_mode == OBMC_CAUSAL) {
- dec_build_obmc_inter_predictors_sb(cm, xd);
+ dec_build_obmc_inter_predictors_sb(cm, dcb);
}
#if CONFIG_MISMATCH_DEBUG
for (int plane = 0; plane < num_planes; ++plane) {
@@ -878,7 +889,8 @@
aom_reader *r,
BLOCK_SIZE bsize) {
AV1_COMMON *const cm = &pbi->common;
- MACROBLOCKD *const xd = &td->xd;
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
const int num_planes = av1_num_planes(cm);
MB_MODE_INFO *mbmi = xd->mi[0];
@@ -912,18 +924,18 @@
blk_row += stepr) {
for (int blk_col = col >> pd->subsampling_x; blk_col < unit_width;
blk_col += stepc) {
- td->read_coeffs_tx_intra_block_visit(cm, xd, r, plane, blk_row,
+ td->read_coeffs_tx_intra_block_visit(cm, dcb, r, plane, blk_row,
blk_col, tx_size);
- td->predict_and_recon_intra_block_visit(cm, xd, r, plane, blk_row,
- blk_col, tx_size);
- set_cb_buffer_offsets(xd, tx_size, plane);
+ td->predict_and_recon_intra_block_visit(
+ cm, dcb, r, plane, blk_row, blk_col, tx_size);
+ set_cb_buffer_offsets(dcb, tx_size, plane);
}
}
}
}
}
} else {
- td->predict_inter_block_visit(cm, xd, bsize);
+ td->predict_inter_block_visit(cm, dcb, bsize);
// Reconstruction
if (!mbmi->skip_txfm) {
int eobtotal = 0;
@@ -1130,8 +1142,9 @@
int mi_col, aom_reader *r,
PARTITION_TYPE partition,
BLOCK_SIZE bsize) {
- MACROBLOCKD *const xd = &td->xd;
- decode_mbmi_block(pbi, xd, mi_row, mi_col, r, partition, bsize);
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
+ decode_mbmi_block(pbi, dcb, mi_row, mi_col, r, partition, bsize);
av1_visit_palette(pbi, xd, r, av1_decode_palette_tokens);
@@ -1221,7 +1234,8 @@
BLOCK_SIZE bsize) {
AV1_COMMON *const cm = &pbi->common;
const CommonModeInfoParams *const mi_params = &cm->mi_params;
- MACROBLOCKD *const xd = &td->xd;
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
const int bw = mi_size_wide[bsize];
const int bh = mi_size_high[bsize];
const int num_planes = av1_num_planes(cm);
@@ -1291,7 +1305,8 @@
int parse_decode_flag) {
assert(bsize < BLOCK_SIZES_ALL);
AV1_COMMON *const cm = &pbi->common;
- MACROBLOCKD *const xd = &td->xd;
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
const int bw = mi_size_wide[bsize];
const int hbs = bw >> 1;
PARTITION_TYPE partition;
@@ -2432,7 +2447,7 @@
}
}
-static AOM_INLINE void set_cb_buffer(AV1Decoder *pbi, MACROBLOCKD *const xd,
+static AOM_INLINE void set_cb_buffer(AV1Decoder *pbi, DecoderCodingBlock *dcb,
CB_BUFFER *cb_buffer_base,
const int num_planes, int mi_row,
int mi_col) {
@@ -2443,11 +2458,12 @@
CB_BUFFER *cb_buffer = cb_buffer_base + offset;
for (int plane = 0; plane < num_planes; ++plane) {
- xd->plane[plane].dqcoeff_block = cb_buffer->dqcoeff[plane];
- xd->plane[plane].eob_data = cb_buffer->eob_data[plane];
- xd->cb_offset[plane] = 0;
- xd->txb_offset[plane] = 0;
+ dcb->dqcoeff_block[plane] = cb_buffer->dqcoeff[plane];
+ dcb->eob_data[plane] = cb_buffer->eob_data[plane];
+ dcb->cb_offset[plane] = 0;
+ dcb->txb_offset[plane] = 0;
}
+ MACROBLOCKD *const xd = &dcb->xd;
xd->plane[0].color_index_map = cb_buffer->color_index_map[0];
xd->plane[1].color_index_map = cb_buffer->color_index_map[1];
xd->color_index_map_offset[0] = 0;
@@ -2610,7 +2626,7 @@
for (int mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end;
mi_col += cm->seq_params.mib_size, sb_col_in_tile++) {
- set_cb_buffer(pbi, &td->xd, pbi->cb_buffer_base, num_planes, mi_row,
+ set_cb_buffer(pbi, &td->dcb, pbi->cb_buffer_base, num_planes, mi_row,
mi_col);
sync_read(&tile_data->dec_row_mt_sync, sb_row_in_tile, sb_col_in_tile);
@@ -2678,25 +2694,28 @@
av1_tile_set_row(&tile_info, cm, tile_row);
av1_tile_set_col(&tile_info, cm, tile_col);
- av1_zero_above_context(cm, &td->xd, tile_info.mi_col_start,
- tile_info.mi_col_end, tile_row);
- av1_reset_loop_filter_delta(&td->xd, num_planes);
- av1_reset_loop_restoration(&td->xd, num_planes);
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
+
+ av1_zero_above_context(cm, xd, tile_info.mi_col_start, tile_info.mi_col_end,
+ tile_row);
+ av1_reset_loop_filter_delta(xd, num_planes);
+ av1_reset_loop_restoration(xd, num_planes);
for (int mi_row = tile_info.mi_row_start; mi_row < tile_info.mi_row_end;
mi_row += cm->seq_params.mib_size) {
- av1_zero_left_context(&td->xd);
+ av1_zero_left_context(xd);
for (int mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end;
mi_col += cm->seq_params.mib_size) {
- set_cb_buffer(pbi, &td->xd, &td->cb_buffer_base, num_planes, 0, 0);
+ set_cb_buffer(pbi, dcb, &td->cb_buffer_base, num_planes, 0, 0);
// Bit-stream parsing and decoding of the superblock
decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
cm->seq_params.sb_size, 0x3);
if (aom_reader_has_overflowed(td->bit_reader)) {
- aom_merge_corrupted_flag(&td->xd.corrupted, 1);
+ aom_merge_corrupted_flag(&dcb->corrupted, 1);
return;
}
}
@@ -2704,7 +2723,7 @@
int corrupted =
(check_trailing_bits_after_symbol_coder(td->bit_reader)) ? 1 : 0;
- aom_merge_corrupted_flag(&td->xd.corrupted, corrupted);
+ aom_merge_corrupted_flag(&dcb->corrupted, corrupted);
}
static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
@@ -2783,13 +2802,14 @@
set_decode_func_pointers(&pbi->td, 0x3);
// Load all tile information into thread_data.
- td->xd = pbi->mb;
- td->xd.corrupted = 0;
- td->xd.mc_buf[0] = td->mc_buf[0];
- td->xd.mc_buf[1] = td->mc_buf[1];
- td->xd.tmp_conv_dst = td->tmp_conv_dst;
+ td->dcb = pbi->dcb;
+
+ td->dcb.corrupted = 0;
+ td->dcb.mc_buf[0] = td->mc_buf[0];
+ td->dcb.mc_buf[1] = td->mc_buf[1];
+ td->dcb.xd.tmp_conv_dst = td->tmp_conv_dst;
for (int j = 0; j < 2; ++j) {
- td->xd.tmp_obmc_bufs[j] = td->tmp_obmc_bufs[j];
+ td->dcb.xd.tmp_obmc_bufs[j] = td->tmp_obmc_bufs[j];
}
for (tile_row = tile_rows_start; tile_row < tile_rows_end; ++tile_row) {
@@ -2806,8 +2826,8 @@
td->bit_reader = &tile_data->bit_reader;
av1_zero(td->cb_buffer_base.dqcoeff);
- av1_tile_init(&td->xd.tile, cm, row, col);
- td->xd.current_qindex = cm->quant_params.base_qindex;
+ av1_tile_init(&td->dcb.xd.tile, cm, row, col);
+ td->dcb.xd.current_qindex = cm->quant_params.base_qindex;
setup_bool_decoder(tile_bs_buf->data, data_end, tile_bs_buf->size,
&cm->error, td->bit_reader, allow_update_cdf);
#if CONFIG_ACCOUNTING
@@ -2819,18 +2839,18 @@
td->bit_reader->accounting = NULL;
}
#endif
- av1_init_macroblockd(cm, &td->xd);
+ av1_init_macroblockd(cm, &td->dcb.xd);
av1_init_above_context(&cm->above_contexts, av1_num_planes(cm), row,
- &td->xd);
+ &td->dcb.xd);
// Initialise the tile context from the frame context
tile_data->tctx = *cm->fc;
- td->xd.tile_ctx = &tile_data->tctx;
+ td->dcb.xd.tile_ctx = &tile_data->tctx;
// decode tile
decode_tile(pbi, td, row, col);
- aom_merge_corrupted_flag(&pbi->mb.corrupted, td->xd.corrupted);
- if (pbi->mb.corrupted)
+ aom_merge_corrupted_flag(&pbi->dcb.corrupted, td->dcb.corrupted);
+ if (pbi->dcb.corrupted)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Failed to decode tile data");
}
@@ -2877,8 +2897,10 @@
td->bit_reader = &tile_data->bit_reader;
av1_zero(td->cb_buffer_base.dqcoeff);
- av1_tile_init(&td->xd.tile, cm, tile_row, tile_col);
- td->xd.current_qindex = cm->quant_params.base_qindex;
+
+ MACROBLOCKD *const xd = &td->dcb.xd;
+ av1_tile_init(&xd->tile, cm, tile_row, tile_col);
+ xd->current_qindex = cm->quant_params.base_qindex;
setup_bool_decoder(tile_buffer->data, thread_data->data_end,
tile_buffer->size, &thread_data->error_info,
td->bit_reader, allow_update_cdf);
@@ -2891,14 +2913,13 @@
td->bit_reader->accounting = NULL;
}
#endif
- av1_init_macroblockd(cm, &td->xd);
- td->xd.error_info = &thread_data->error_info;
- av1_init_above_context(&cm->above_contexts, av1_num_planes(cm), tile_row,
- &td->xd);
+ av1_init_macroblockd(cm, xd);
+ xd->error_info = &thread_data->error_info;
+ av1_init_above_context(&cm->above_contexts, av1_num_planes(cm), tile_row, xd);
// Initialise the tile context from the frame context
tile_data->tctx = *cm->fc;
- td->xd.tile_ctx = &tile_data->tctx;
+ xd->tile_ctx = &tile_data->tctx;
#if CONFIG_ACCOUNTING
if (pbi->acct_enabled) {
tile_data->bit_reader.accounting->last_tell_frac =
@@ -2919,7 +2940,7 @@
// before it returns.
if (setjmp(thread_data->error_info.jmp)) {
thread_data->error_info.setjmp = 0;
- thread_data->td->xd.corrupted = 1;
+ thread_data->td->dcb.corrupted = 1;
return 0;
}
thread_data->error_info.setjmp = 1;
@@ -2930,7 +2951,7 @@
set_decode_func_pointers(td, 0x3);
assert(cm->tiles.cols > 0);
- while (!td->xd.corrupted) {
+ while (!td->dcb.corrupted) {
TileJobsDec *cur_job_info = get_dec_job_info(&pbi->tile_mt_info);
if (cur_job_info != NULL) {
@@ -2947,7 +2968,7 @@
}
}
thread_data->error_info.setjmp = 0;
- return !td->xd.corrupted;
+ return !td->dcb.corrupted;
}
static INLINE int get_max_row_mt_workers_per_tile(AV1_COMMON *cm,
@@ -3110,27 +3131,28 @@
const int num_planes = av1_num_planes(cm);
TileInfo tile_info = tile_data->tile_info;
int tile_row = tile_info.tile_row;
+ DecoderCodingBlock *const dcb = &td->dcb;
+ MACROBLOCKD *const xd = &dcb->xd;
- av1_zero_above_context(cm, &td->xd, tile_info.mi_col_start,
- tile_info.mi_col_end, tile_row);
- av1_reset_loop_filter_delta(&td->xd, num_planes);
- av1_reset_loop_restoration(&td->xd, num_planes);
+ av1_zero_above_context(cm, xd, tile_info.mi_col_start, tile_info.mi_col_end,
+ tile_row);
+ av1_reset_loop_filter_delta(xd, num_planes);
+ av1_reset_loop_restoration(xd, num_planes);
for (int mi_row = tile_info.mi_row_start; mi_row < tile_info.mi_row_end;
mi_row += cm->seq_params.mib_size) {
- av1_zero_left_context(&td->xd);
+ av1_zero_left_context(xd);
for (int mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end;
mi_col += cm->seq_params.mib_size) {
- set_cb_buffer(pbi, &td->xd, pbi->cb_buffer_base, num_planes, mi_row,
- mi_col);
+ set_cb_buffer(pbi, dcb, pbi->cb_buffer_base, num_planes, mi_row, mi_col);
// Bit-stream parsing of the superblock
decode_partition(pbi, td, mi_row, mi_col, td->bit_reader,
cm->seq_params.sb_size, 0x1);
if (aom_reader_has_overflowed(td->bit_reader)) {
- aom_merge_corrupted_flag(&td->xd.corrupted, 1);
+ aom_merge_corrupted_flag(&dcb->corrupted, 1);
return;
}
}
@@ -3139,7 +3161,7 @@
int corrupted =
(check_trailing_bits_after_symbol_coder(td->bit_reader)) ? 1 : 0;
- aom_merge_corrupted_flag(&td->xd.corrupted, corrupted);
+ aom_merge_corrupted_flag(&dcb->corrupted, corrupted);
}
static int row_mt_worker_hook(void *arg1, void *arg2) {
@@ -3149,14 +3171,14 @@
ThreadData *const td = thread_data->td;
uint8_t allow_update_cdf;
AV1DecRowMTInfo *frame_row_mt_info = &pbi->frame_row_mt_info;
- td->xd.corrupted = 0;
+ td->dcb.corrupted = 0;
// The jmp_buf is valid only for the duration of the function that calls
// setjmp(). Therefore, this function must reset the 'setjmp' field to 0
// before it returns.
if (setjmp(thread_data->error_info.jmp)) {
thread_data->error_info.setjmp = 0;
- thread_data->td->xd.corrupted = 1;
+ thread_data->td->dcb.corrupted = 1;
#if CONFIG_MULTITHREAD
pthread_mutex_lock(pbi->row_mt_mutex_);
#endif
@@ -3175,7 +3197,7 @@
set_decode_func_pointers(td, 0x1);
assert(cm->tiles.cols > 0);
- while (!td->xd.corrupted) {
+ while (!td->dcb.corrupted) {
TileJobsDec *cur_job_info = get_dec_job_info(&pbi->tile_mt_info);
if (cur_job_info != NULL) {
@@ -3204,7 +3226,7 @@
}
}
- if (td->xd.corrupted) {
+ if (td->dcb.corrupted) {
thread_data->error_info.setjmp = 0;
#if CONFIG_MULTITHREAD
pthread_mutex_lock(pbi->row_mt_mutex_);
@@ -3246,9 +3268,9 @@
AV1DecRowMTSync *dec_row_mt_sync = &tile_data->dec_row_mt_sync;
TileInfo tile_info = tile_data->tile_info;
- av1_tile_init(&td->xd.tile, cm, tile_row, tile_col);
- av1_init_macroblockd(cm, &td->xd);
- td->xd.error_info = &thread_data->error_info;
+ av1_tile_init(&td->dcb.xd.tile, cm, tile_row, tile_col);
+ av1_init_macroblockd(cm, &td->dcb.xd);
+ td->dcb.xd.error_info = &thread_data->error_info;
decode_tile_sb_row(pbi, td, tile_info, mi_row);
@@ -3261,7 +3283,7 @@
#endif
}
thread_data->error_info.setjmp = 0;
- return !td->xd.corrupted;
+ return !td->dcb.corrupted;
}
// sorts in descending order
@@ -3369,13 +3391,14 @@
for (int worker_idx = 0; worker_idx < num_workers; ++worker_idx) {
AVxWorker *const worker = &pbi->tile_workers[worker_idx];
DecWorkerData *const thread_data = pbi->thread_data + worker_idx;
- thread_data->td->xd = pbi->mb;
- thread_data->td->xd.corrupted = 0;
- thread_data->td->xd.mc_buf[0] = thread_data->td->mc_buf[0];
- thread_data->td->xd.mc_buf[1] = thread_data->td->mc_buf[1];
- thread_data->td->xd.tmp_conv_dst = thread_data->td->tmp_conv_dst;
+ thread_data->td->dcb = pbi->dcb;
+ thread_data->td->dcb.corrupted = 0;
+ thread_data->td->dcb.mc_buf[0] = thread_data->td->mc_buf[0];
+ thread_data->td->dcb.mc_buf[1] = thread_data->td->mc_buf[1];
+ thread_data->td->dcb.xd.tmp_conv_dst = thread_data->td->tmp_conv_dst;
for (int j = 0; j < 2; ++j) {
- thread_data->td->xd.tmp_obmc_bufs[j] = thread_data->td->tmp_obmc_bufs[j];
+ thread_data->td->dcb.xd.tmp_obmc_bufs[j] =
+ thread_data->td->tmp_obmc_bufs[j];
}
winterface->sync(worker);
@@ -3419,7 +3442,7 @@
aom_merge_corrupted_flag(&corrupted, !winterface->sync(worker));
}
- pbi->mb.corrupted = corrupted;
+ pbi->dcb.corrupted = corrupted;
}
static AOM_INLINE void decode_mt_init(AV1Decoder *pbi) {
@@ -3567,7 +3590,7 @@
launch_dec_workers(pbi, data_end, num_workers);
sync_dec_workers(pbi, num_workers);
- if (pbi->mb.corrupted)
+ if (pbi->dcb.corrupted)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Failed to decode tile data");
@@ -3772,7 +3795,7 @@
launch_dec_workers(pbi, data_end, num_workers);
sync_dec_workers(pbi, num_workers);
- if (pbi->mb.corrupted)
+ if (pbi->dcb.corrupted)
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Failed to decode tile data");
@@ -4407,7 +4430,7 @@
const SequenceHeader *const seq_params = &cm->seq_params;
CurrentFrame *const current_frame = &cm->current_frame;
FeatureFlags *const features = &cm->features;
- MACROBLOCKD *const xd = &pbi->mb;
+ MACROBLOCKD *const xd = &pbi->dcb.xd;
BufferPool *const pool = cm->buffer_pool;
RefCntBuffer *const frame_bufs = pool->frame_bufs;
@@ -5076,7 +5099,7 @@
int trailing_bits_present) {
AV1_COMMON *const cm = &pbi->common;
const int num_planes = av1_num_planes(cm);
- MACROBLOCKD *const xd = &pbi->mb;
+ MACROBLOCKD *const xd = &pbi->dcb.xd;
#if CONFIG_BITSTREAM_DEBUG
aom_bitstream_queue_set_frame_read(cm->current_frame.frame_number * 2 +
@@ -5141,7 +5164,7 @@
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Uninitialized entropy context.");
- xd->corrupted = 0;
+ pbi->dcb.corrupted = 0;
return uncomp_hdr_size;
}
@@ -5168,7 +5191,7 @@
int end_tile, int initialize_flag) {
AV1_COMMON *const cm = &pbi->common;
CommonTileParams *const tiles = &cm->tiles;
- MACROBLOCKD *const xd = &pbi->mb;
+ MACROBLOCKD *const xd = &pbi->dcb.xd;
const int tile_count_tg = end_tile - start_tile + 1;
if (initialize_flag) setup_frame_info(pbi);
@@ -5200,13 +5223,13 @@
if (cm->lf.filter_level[0] || cm->lf.filter_level[1]) {
if (pbi->num_workers > 1) {
av1_loop_filter_frame_mt(
- &cm->cur_frame->buf, cm, &pbi->mb, 0, num_planes, 0,
+ &cm->cur_frame->buf, cm, &pbi->dcb.xd, 0, num_planes, 0,
#if CONFIG_LPF_MASK
1,
#endif
pbi->tile_workers, pbi->num_workers, &pbi->lf_row_sync);
} else {
- av1_loop_filter_frame(&cm->cur_frame->buf, cm, &pbi->mb,
+ av1_loop_filter_frame(&cm->cur_frame->buf, cm, &pbi->dcb.xd,
#if CONFIG_LPF_MASK
1,
#endif
@@ -5230,7 +5253,9 @@
av1_loop_restoration_save_boundary_lines(&pbi->common.cur_frame->buf,
cm, 0);
- if (do_cdef) av1_cdef_frame(&pbi->common.cur_frame->buf, cm, &pbi->mb);
+ if (do_cdef) {
+ av1_cdef_frame(&pbi->common.cur_frame->buf, cm, &pbi->dcb.xd);
+ }
superres_post_decode(pbi);
@@ -5269,7 +5294,7 @@
av1_zero_array(cm->lf.lfm, cm->lf.lfm_num);
#endif
- if (!xd->corrupted) {
+ if (!pbi->dcb.corrupted) {
if (cm->features.refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
assert(pbi->context_update_tile_id < pbi->allocated_tiles);
*cm->fc = pbi->tile_data[pbi->context_update_tile_id].tctx;