Rename contexts in MACROBLOCKD, MACROBLOCKD_PLANE Match them with new names in CommonContexts (part of AV1_COMMON), to ensure they explicitly name the type of context they are referring to. Rename the relevant function too for clarity. BUG=aomedia:2610 Change-Id: I9de0d0dcd61bea5fe3916a1ae7763ea9d26675f4
diff --git a/av1/common/av1_common_int.h b/av1/common/av1_common_int.h index bc64924..9232755 100644 --- a/av1/common/av1_common_int.h +++ b/av1/common/av1_common_int.h
@@ -878,9 +878,9 @@ int num_planes, int tile_row, MACROBLOCKD *xd) { for (int i = 0; i < num_planes; ++i) { - xd->above_context[i] = above_contexts->entropy[i][tile_row]; + xd->above_entropy_context[i] = above_contexts->entropy[i][tile_row]; } - xd->above_seg_context = above_contexts->partition[tile_row]; + xd->above_partition_context = above_contexts->partition[tile_row]; xd->above_txfm_context = above_contexts->txfm[tile_row]; } @@ -917,8 +917,8 @@ cfl_init(&xd->cfl, &cm->seq_params); } -static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col, - const int num_planes) { +static INLINE void set_entropy_context(MACROBLOCKD *xd, int mi_row, int mi_col, + const int num_planes) { int i; int row_offset = mi_row; int col_offset = mi_col; @@ -932,8 +932,10 @@ col_offset = mi_col - 1; int above_idx = col_offset; int left_idx = row_offset & MAX_MIB_MASK; - pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x]; - pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y]; + pd->above_entropy_context = + &xd->above_entropy_context[i][above_idx >> pd->subsampling_x]; + pd->left_entropy_context = + &xd->left_entropy_context[i][left_idx >> pd->subsampling_y]; } } @@ -1041,9 +1043,9 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row, int mi_col, BLOCK_SIZE subsize, BLOCK_SIZE bsize) { - PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; + PARTITION_CONTEXT *const above_ctx = xd->above_partition_context + mi_col; PARTITION_CONTEXT *const left_ctx = - xd->left_seg_context + (mi_row & MAX_MIB_MASK); + xd->left_partition_context + (mi_row & MAX_MIB_MASK); const int bw = mi_size_wide[bsize]; const int bh = mi_size_high[bsize]; @@ -1138,9 +1140,9 @@ static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row, int mi_col, BLOCK_SIZE bsize) { - const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col; + const PARTITION_CONTEXT *above_ctx = xd->above_partition_context + mi_col; const PARTITION_CONTEXT *left_ctx = - xd->left_seg_context + (mi_row & MAX_MIB_MASK); + xd->left_partition_context + (mi_row & MAX_MIB_MASK); // Minimum partition point is 8x8. Offset the bsl accordingly. const int bsl = mi_size_wide_log2[bsize] - mi_size_wide_log2[BLOCK_8X8]; int above = (*above_ctx >> bsl) & 1, left = (*left_ctx >> bsl) & 1; @@ -1242,8 +1244,8 @@ } static INLINE void av1_zero_left_context(MACROBLOCKD *const xd) { - av1_zero(xd->left_context); - av1_zero(xd->left_seg_context); + av1_zero(xd->left_entropy_context); + av1_zero(xd->left_partition_context); memset(xd->left_txfm_context_buffer, tx_size_high[TX_SIZES_LARGEST], sizeof(xd->left_txfm_context_buffer));
diff --git a/av1/common/blockd.c b/av1/common/blockd.c index aacb903..00725ea 100644 --- a/av1/common/blockd.c +++ b/av1/common/blockd.c
@@ -28,11 +28,12 @@ return above_mi->mode; } -void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, - int plane, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, - int has_eob, int aoff, int loff) { - ENTROPY_CONTEXT *const a = pd->above_context + aoff; - ENTROPY_CONTEXT *const l = pd->left_context + loff; +void av1_set_entropy_contexts(const MACROBLOCKD *xd, + struct macroblockd_plane *pd, int plane, + BLOCK_SIZE plane_bsize, TX_SIZE tx_size, + int has_eob, int aoff, int loff) { + ENTROPY_CONTEXT *const a = pd->above_entropy_context + aoff; + ENTROPY_CONTEXT *const l = pd->left_entropy_context + loff; const int txs_wide = tx_size_wide_unit[tx_size]; const int txs_high = tx_size_high_unit[tx_size]; @@ -56,8 +57,8 @@ memset(l, has_eob, sizeof(*l) * txs_high); } } -void av1_reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize, - const int num_planes) { +void av1_reset_entropy_context(MACROBLOCKD *xd, BLOCK_SIZE bsize, + const int num_planes) { assert(bsize < BLOCK_SIZES_ALL); const int nplanes = 1 + (num_planes - 1) * xd->is_chroma_ref; for (int i = 0; i < nplanes; i++) { @@ -66,8 +67,8 @@ get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y); const int txs_wide = mi_size_wide[plane_bsize]; const int txs_high = mi_size_high[plane_bsize]; - memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide); - memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high); + memset(pd->above_entropy_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide); + memset(pd->left_entropy_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high); } }
diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 61aef6a..7eb1aea 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h
@@ -398,8 +398,8 @@ int subsampling_y; struct buf_2d dst; struct buf_2d pre[2]; - ENTROPY_CONTEXT *above_context; - ENTROPY_CONTEXT *left_context; + ENTROPY_CONTEXT *above_entropy_context; + ENTROPY_CONTEXT *left_entropy_context; // The dequantizers below are true dequantizers used only in the // dequantization process. They have the same coefficient @@ -514,11 +514,11 @@ /* pointer to current frame */ const YV12_BUFFER_CONFIG *cur_buf; - ENTROPY_CONTEXT *above_context[MAX_MB_PLANE]; - ENTROPY_CONTEXT left_context[MAX_MB_PLANE][MAX_MIB_SIZE]; + ENTROPY_CONTEXT *above_entropy_context[MAX_MB_PLANE]; + ENTROPY_CONTEXT left_entropy_context[MAX_MB_PLANE][MAX_MIB_SIZE]; - PARTITION_CONTEXT *above_seg_context; - PARTITION_CONTEXT left_seg_context[MAX_MIB_SIZE]; + PARTITION_CONTEXT *above_partition_context; + PARTITION_CONTEXT left_partition_context[MAX_MIB_SIZE]; TXFM_CONTEXT *above_txfm_context; TXFM_CONTEXT *left_txfm_context; @@ -996,8 +996,8 @@ pd->subsampling_y); } -void av1_reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize, - const int num_planes); +void av1_reset_entropy_context(MACROBLOCKD *xd, BLOCK_SIZE bsize, + const int num_planes); void av1_reset_loop_filter_delta(MACROBLOCKD *xd, int num_planes); @@ -1008,9 +1008,10 @@ BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg); -void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd, - int plane, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, - int has_eob, int aoff, int loff); +void av1_set_entropy_contexts(const MACROBLOCKD *xd, + struct macroblockd_plane *pd, int plane, + BLOCK_SIZE plane_bsize, TX_SIZE tx_size, + int has_eob, int aoff, int loff); #define MAX_INTERINTRA_SB_SQUARE 32 * 32 static INLINE int is_interintra_mode(const MB_MODE_INFO *mbmi) {
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 4541008..0dc539f 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -341,7 +341,7 @@ } set_plane_n4(xd, bw, bh, num_planes); - set_skip_context(xd, mi_row, mi_col, num_planes); + set_entropy_context(xd, mi_row, mi_col, num_planes); // Distance of Mb to the various image edges. These are specified to 8th pel // as they are always compared to values that are in 1/8th pel units @@ -1465,7 +1465,7 @@ } } } - if (mbmi->skip) av1_reset_skip_context(xd, bsize, num_planes); + if (mbmi->skip) av1_reset_entropy_context(xd, bsize, num_planes); decode_token_recon_block(pbi, td, r, bsize); }
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c index 24c6031..541f4c9 100644 --- a/av1/decoder/decodetxb.c +++ b/av1/decoder/decodetxb.c
@@ -337,11 +337,12 @@ get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y); TXB_CTX txb_ctx; - get_txb_ctx(plane_bsize, tx_size, plane, pd->above_context + col, - pd->left_context + row, &txb_ctx); + get_txb_ctx(plane_bsize, tx_size, plane, pd->above_entropy_context + col, + pd->left_entropy_context + row, &txb_ctx); const uint8_t cul_level = av1_read_coeffs_txb(cm, xd, r, row, col, plane, &txb_ctx, tx_size); - av1_set_contexts(xd, pd, plane, plane_bsize, tx_size, cul_level, col, row); + av1_set_entropy_contexts(xd, pd, plane, plane_bsize, tx_size, cul_level, col, + row); if (is_inter_block(mbmi)) { const PLANE_TYPE plane_type = get_plane_type(plane);
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 1f59d8b..fbff008 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -396,7 +396,7 @@ set_mode_info_offsets(cpi, x, xd, mi_row, mi_col); - set_skip_context(xd, mi_row, mi_col, num_planes); + set_entropy_context(xd, mi_row, mi_col, num_planes); xd->above_txfm_context = cm->above_contexts.txfm[tile->tile_row] + mi_col; xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); @@ -1499,19 +1499,20 @@ for (p = 0; p < num_planes; p++) { int tx_col = mi_col; int tx_row = mi_row & MAX_MIB_MASK; - memcpy(xd->above_context[p] + (tx_col >> xd->plane[p].subsampling_x), - ctx->a + num_4x4_blocks_wide * p, - (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >> - xd->plane[p].subsampling_x); - memcpy(xd->left_context[p] + (tx_row >> xd->plane[p].subsampling_y), + memcpy( + xd->above_entropy_context[p] + (tx_col >> xd->plane[p].subsampling_x), + ctx->a + num_4x4_blocks_wide * p, + (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >> + xd->plane[p].subsampling_x); + memcpy(xd->left_entropy_context[p] + (tx_row >> xd->plane[p].subsampling_y), ctx->l + num_4x4_blocks_high * p, (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >> xd->plane[p].subsampling_y); } - memcpy(xd->above_seg_context + mi_col, ctx->sa, - sizeof(*xd->above_seg_context) * mi_width); - memcpy(xd->left_seg_context + (mi_row & MAX_MIB_MASK), ctx->sl, - sizeof(xd->left_seg_context[0]) * mi_height); + memcpy(xd->above_partition_context + mi_col, ctx->sa, + sizeof(*xd->above_partition_context) * mi_width); + memcpy(xd->left_partition_context + (mi_row & MAX_MIB_MASK), ctx->sl, + sizeof(xd->left_partition_context[0]) * mi_height); xd->above_txfm_context = ctx->p_ta; xd->left_txfm_context = ctx->p_tl; memcpy(xd->above_txfm_context, ctx->ta, @@ -1533,17 +1534,18 @@ for (p = 0; p < num_planes; ++p) { int tx_col = mi_col; int tx_row = mi_row & MAX_MIB_MASK; - memcpy(ctx->a + mi_width * p, - xd->above_context[p] + (tx_col >> xd->plane[p].subsampling_x), - (sizeof(ENTROPY_CONTEXT) * mi_width) >> xd->plane[p].subsampling_x); + memcpy( + ctx->a + mi_width * p, + xd->above_entropy_context[p] + (tx_col >> xd->plane[p].subsampling_x), + (sizeof(ENTROPY_CONTEXT) * mi_width) >> xd->plane[p].subsampling_x); memcpy(ctx->l + mi_height * p, - xd->left_context[p] + (tx_row >> xd->plane[p].subsampling_y), + xd->left_entropy_context[p] + (tx_row >> xd->plane[p].subsampling_y), (sizeof(ENTROPY_CONTEXT) * mi_height) >> xd->plane[p].subsampling_y); } - memcpy(ctx->sa, xd->above_seg_context + mi_col, - sizeof(*xd->above_seg_context) * mi_width); - memcpy(ctx->sl, xd->left_seg_context + (mi_row & MAX_MIB_MASK), - sizeof(xd->left_seg_context[0]) * mi_height); + memcpy(ctx->sa, xd->above_partition_context + mi_col, + sizeof(*xd->above_partition_context) * mi_width); + memcpy(ctx->sl, xd->left_partition_context + (mi_row & MAX_MIB_MASK), + sizeof(xd->left_partition_context[0]) * mi_height); memcpy(ctx->ta, xd->above_txfm_context, sizeof(*xd->above_txfm_context) * mi_width); memcpy(ctx->tl, xd->left_txfm_context,
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c index 046d66e..fc5a851 100644 --- a/av1/encoder/encodetxb.c +++ b/av1/encoder/encodetxb.c
@@ -2092,8 +2092,9 @@ if (args->dry_run == OUTPUT_ENABLED) { MB_MODE_INFO *mbmi = xd->mi[0]; TXB_CTX txb_ctx; - get_txb_ctx(plane_bsize, tx_size, plane, pd->above_context + blk_col, - pd->left_context + blk_row, &txb_ctx); + get_txb_ctx(plane_bsize, tx_size, plane, + pd->above_entropy_context + blk_col, + pd->left_entropy_context + blk_row, &txb_ctx); const int bwl = get_txb_bwl(tx_size); const int width = get_txb_wide(tx_size); const int height = get_txb_high(tx_size); @@ -2118,8 +2119,8 @@ eob_txb[block] = eob; if (eob == 0) { - av1_set_contexts(xd, pd, plane, plane_bsize, tx_size, 0, blk_col, - blk_row); + av1_set_entropy_contexts(xd, pd, plane, plane_bsize, tx_size, 0, blk_col, + blk_row); return; } const int segment_id = mbmi->segment_id; @@ -2220,8 +2221,8 @@ tcoeff = qcoeff; } const int cul_level = av1_get_txb_entropy_context(tcoeff, scan_order, eob); - av1_set_contexts(xd, pd, plane, plane_bsize, tx_size, cul_level, blk_col, - blk_row); + av1_set_entropy_contexts(xd, pd, plane, plane_bsize, tx_size, cul_level, + blk_col, blk_row); } void av1_update_txb_context(const AV1_COMP *cpi, ThreadData *td, @@ -2234,7 +2235,7 @@ MB_MODE_INFO *const mbmi = xd->mi[0]; struct tokenize_b_args arg = { cpi, td, 0, allow_update_cdf, dry_run }; if (mbmi->skip) { - av1_reset_skip_context(xd, bsize, num_planes); + av1_reset_entropy_context(xd, bsize, num_planes); return; }
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c index 727956c..21b75bd 100644 --- a/av1/encoder/rd.c +++ b/av1/encoder/rd.c
@@ -968,8 +968,8 @@ ENTROPY_CONTEXT t_left[MAX_MIB_SIZE]) { const int num_4x4_w = mi_size_wide[plane_bsize]; const int num_4x4_h = mi_size_high[plane_bsize]; - const ENTROPY_CONTEXT *const above = pd->above_context; - const ENTROPY_CONTEXT *const left = pd->left_context; + const ENTROPY_CONTEXT *const above = pd->above_entropy_context; + const ENTROPY_CONTEXT *const left = pd->left_entropy_context; memcpy(t_above, above, sizeof(ENTROPY_CONTEXT) * num_4x4_w); memcpy(t_left, left, sizeof(ENTROPY_CONTEXT) * num_4x4_h);
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c index eb57f88..e674153 100644 --- a/av1/encoder/tokenize.c +++ b/av1/encoder/tokenize.c
@@ -195,7 +195,7 @@ struct tokenize_b_args arg = { cpi, td, 0, allow_update_cdf, dry_run }; if (mbmi->skip) { - av1_reset_skip_context(xd, bsize, num_planes); + av1_reset_entropy_context(xd, bsize, num_planes); return; }