Documentation/cleanup for MACROBLOCKD struct.
Rename a couple of members for readability.
BUG=aomedia:2610
Change-Id: I0694f8600596c56518dc85926fee042d9e2a8d8c
diff --git a/av1/common/av1_common_int.h b/av1/common/av1_common_int.h
index 3872be8..0403405 100644
--- a/av1/common/av1_common_int.h
+++ b/av1/common/av1_common_int.h
@@ -1070,18 +1070,18 @@
xd->chroma_left_mbmi = chroma_left_mi;
}
- xd->n4_h = bh;
- xd->n4_w = bw;
+ xd->height = bh;
+ xd->width = bw;
xd->is_sec_rect = 0;
- if (xd->n4_w < xd->n4_h) {
+ if (xd->width < xd->height) {
// Only mark is_sec_rect as 1 for the last block.
// For PARTITION_VERT_4, it would be (0, 0, 0, 1);
// For other partitions, it would be (0, 1).
- if (!((mi_col + xd->n4_w) & (xd->n4_h - 1))) xd->is_sec_rect = 1;
+ if (!((mi_col + xd->width) & (xd->height - 1))) xd->is_sec_rect = 1;
}
- if (xd->n4_w > xd->n4_h)
- if (mi_row & (xd->n4_w - 1)) xd->is_sec_rect = 1;
+ if (xd->width > xd->height)
+ if (mi_row & (xd->width - 1)) xd->is_sec_rect = 1;
}
static INLINE aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx,
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 7eb1aea..0f2a241 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -478,57 +478,125 @@
// Most/all of the pointers are mere pointers to actual arrays are allocated
// elsewhere. This is mostly for coding convenience.
typedef struct macroblockd {
+ // Row and column position of current macroblock in mi units.
+ int mi_row;
+ int mi_col;
+ // Same as cm->mi_params.mi_stride, copied here for convenience.
+ int mi_stride;
+
+ // True if current block transmits chroma information.
+ // More detail:
+ // Smallest supported block size for both luma and chroma plane is 4x4. Hence,
+ // in case of subsampled chroma plane (YUV 4:2:0 or YUV 4:2:2), multiple luma
+ // blocks smaller than 8x8 maybe combined into one chroma block.
+ // For example, for YUV 4:2:0, let's say an 8x8 area is split into four 4x4
+ // luma blocks. Then, a single chroma block of size 4x4 will cover the area of
+ // these four luma blocks. This is implemented in bitstream as follows:
+ // - There are four MB_MODE_INFO structs for the four luma blocks.
+ // - First 3 MB_MODE_INFO have is_chroma_ref = false, and so do not transmit
+ // any information for chroma planes.
+ // - Last block will have is_chroma_ref = true and transmits chroma
+ // information for the 4x4 chroma block that covers whole 8x8 area covered by
+ // four luma blocks.
+ // Similar logic applies for chroma blocks that cover 2 or 3 luma blocks.
+ bool is_chroma_ref;
+
struct macroblockd_plane plane[MAX_MB_PLANE];
TileInfo tile;
- int mi_stride;
-
+ // Appropriate offset inside cm->mi_params.mi_grid_base based on current
+ // mi_row and mi_col.
MB_MODE_INFO **mi;
+
+ // True if 4x4 block above the current block is available.
+ bool up_available;
+ // True if 4x4 block to the left of the current block is available.
+ bool left_available;
+ // True if the above chrome reference block is available.
+ bool chroma_up_available;
+ // True if the left chrome reference block is available.
+ bool chroma_left_available;
+
+ // MB_MODE_INFO for 4x4 block to the left of the current block, if
+ // left_available == true; otherwise NULL.
MB_MODE_INFO *left_mbmi;
+ // MB_MODE_INFO for 4x4 block above the current block, if
+ // up_available == true; otherwise NULL.
MB_MODE_INFO *above_mbmi;
+ // Above chroma reference block if is_chroma_ref == true for the current block
+ // and chroma_up_available == true; otherwise NULL.
+ // See also: the special case logic when current chroma block covers more than
+ // one luma blocks in set_mi_row_col().
MB_MODE_INFO *chroma_left_mbmi;
+ // Left chroma reference block if is_chroma_ref == true for the current block
+ // and chroma_left_available == true; otherwise NULL.
+ // See also: the special case logic when current chroma block covers more than
+ // one luma blocks in set_mi_row_col().
MB_MODE_INFO *chroma_above_mbmi;
+ // Appropriate offset based on current 'mi_row' and 'mi_col', inside
+ // 'tx_type_map' in one of 'CommonModeInfoParams', 'PICK_MODE_CONTEXT' or
+ // 'MACROBLOCK' structs.
uint8_t *tx_type_map;
+ // Stride for 'tx_type_map'. Note that this may / may not be same as
+ // 'mi_stride', depending on which actual array 'tx_type_map' points to.
int tx_type_map_stride;
- int up_available;
- int left_available;
- int chroma_up_available;
- int chroma_left_available;
-
- /* Distance of MB away from frame edges in subpixels (1/8th pixel) */
+ // Distance of this macroblock from frame edges in 1/8th pixel units.
int mb_to_left_edge;
int mb_to_right_edge;
int mb_to_top_edge;
int mb_to_bottom_edge;
- int mi_row;
- int mi_col;
- int is_chroma_ref;
-
- /* pointers to reference frame scale factors */
+ // Scale factors for reference frames of the current block.
+ // These are pointers into 'cm->ref_scale_factors'.
const struct scale_factors *block_ref_scale_factors[2];
- /* pointer to current frame */
const YV12_BUFFER_CONFIG *cur_buf;
+ // Entropy contexts for the above blocks.
+ // above_entropy_context[i][j] corresponds to above entropy context for ith
+ // plane and jth mi column of this *frame*, wrt current 'mi_row'.
+ // These are pointers into 'cm->above_contexts.entropy'.
ENTROPY_CONTEXT *above_entropy_context[MAX_MB_PLANE];
+ // Entropy contexts for the left blocks.
+ // left_entropy_context[i][j] corresponds to left entropy context for ith
+ // plane and jth mi row of this *superblock*, wrt current 'mi_col'.
+ // Note: These contain actual data, NOT pointers.
ENTROPY_CONTEXT left_entropy_context[MAX_MB_PLANE][MAX_MIB_SIZE];
+ // Partition contexts for the above blocks.
+ // above_partition_context[i] corresponds to above partition context for ith
+ // mi column of this *frame*, wrt current 'mi_row'.
+ // These are pointers into 'cm->above_contexts.partition'.
PARTITION_CONTEXT *above_partition_context;
+ // Partition contexts for the left blocks.
+ // left_partition_context[i] corresponds to left partition context for ith
+ // mi row of this *superblock*, wrt current 'mi_col'.
+ // Note: These contain actual data, NOT pointers.
PARTITION_CONTEXT left_partition_context[MAX_MIB_SIZE];
+ // Transform contexts for the above blocks.
+ // TODO(urvang): Indexed two different ways from cm->above_contexts.txfm in
+ // code currently. Need to make it consistent / document why.
TXFM_CONTEXT *above_txfm_context;
+ // Transform contexts for the left blocks.
TXFM_CONTEXT *left_txfm_context;
+ // TODO(urvang): 'left_txfm_context' points to 'left_txfm_context_buffer'.
+ // Can we remove this indirection?
TXFM_CONTEXT left_txfm_context_buffer[MAX_MIB_SIZE];
+ // Default values for the two restoration filters for each plane.
+ // These values are used as reference values when writing the bitstream. That
+ // is, we transmit the delta between the actual values in
+ // cm->rst_info[plane].unit_info[unit_idx] and these reference values.
WienerInfo wiener_info[MAX_MB_PLANE];
SgrprojInfo sgrproj_info[MAX_MB_PLANE];
- // block dimension in the unit of mode_info.
- uint8_t n4_w, n4_h;
+ // Block dimensions in MB_MODE_INFO units.
+ uint8_t width;
+ uint8_t height;
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
@@ -540,15 +608,18 @@
uint8_t neighbors_ref_counts[REF_FRAMES];
FRAME_CONTEXT *tile_ctx;
- /* Bit depth: 8, 10, 12 */
+ // Bit depth: copied from cm->seq_params.bit_depth for convenience.
int bd;
int qindex[MAX_SEGMENTS];
int lossless[MAX_SEGMENTS];
+ // TODO(urvang): Move to decoder.
int corrupted;
+ // Same as cm->features.cur_frame_force_integer_mv.
int cur_frame_force_integer_mv;
- // same with that in AV1_COMMON
+ // Pointer to cm->error.
struct aom_internal_error_info *error_info;
+ // Same as cm->global_motion.
const WarpedMotionParams *global_motion;
int delta_qindex;
int current_qindex;
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 92931d4..db3098c 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -145,32 +145,31 @@
uint16_t *ref_mv_weight, uint8_t *refmv_count, uint8_t *ref_match_count,
uint8_t *newmv_count, int_mv *gm_mv_candidates, int max_row_offset,
int *processed_rows) {
- int end_mi = AOMMIN(xd->n4_w, cm->mi_params.mi_cols - mi_col);
+ int end_mi = AOMMIN(xd->width, cm->mi_params.mi_cols - mi_col);
end_mi = AOMMIN(end_mi, mi_size_wide[BLOCK_64X64]);
- const int n8_w_8 = mi_size_wide[BLOCK_8X8];
- const int n8_w_16 = mi_size_wide[BLOCK_16X16];
- int i;
+ const int width_8x8 = mi_size_wide[BLOCK_8X8];
+ const int width_16x16 = mi_size_wide[BLOCK_16X16];
int col_offset = 0;
// TODO(jingning): Revisit this part after cb4x4 is stable.
if (abs(row_offset) > 1) {
col_offset = 1;
- if ((mi_col & 0x01) && xd->n4_w < n8_w_8) --col_offset;
+ if ((mi_col & 0x01) && xd->width < width_8x8) --col_offset;
}
- const int use_step_16 = (xd->n4_w >= 16);
+ const int use_step_16 = (xd->width >= 16);
MB_MODE_INFO **const candidate_mi0 = xd->mi + row_offset * xd->mi_stride;
- for (i = 0; i < end_mi;) {
+ for (int i = 0; i < end_mi;) {
const MB_MODE_INFO *const candidate = candidate_mi0[col_offset + i];
const int candidate_bsize = candidate->sb_type;
const int n4_w = mi_size_wide[candidate_bsize];
- int len = AOMMIN(xd->n4_w, n4_w);
+ int len = AOMMIN(xd->width, n4_w);
if (use_step_16)
- len = AOMMAX(n8_w_16, len);
+ len = AOMMAX(width_16x16, len);
else if (abs(row_offset) > 1)
- len = AOMMAX(len, n8_w_8);
+ len = AOMMAX(len, width_8x8);
uint16_t weight = 2;
- if (xd->n4_w >= n8_w_8 && xd->n4_w <= n4_w) {
+ if (xd->width >= width_8x8 && xd->width <= n4_w) {
uint16_t inc = AOMMIN(-max_row_offset + row_offset + 1,
mi_size_high[candidate_bsize]);
// Obtain range used in weight calculation.
@@ -193,7 +192,7 @@
uint16_t *ref_mv_weight, uint8_t *refmv_count, uint8_t *ref_match_count,
uint8_t *newmv_count, int_mv *gm_mv_candidates, int max_col_offset,
int *processed_cols) {
- int end_mi = AOMMIN(xd->n4_h, cm->mi_params.mi_rows - mi_row);
+ int end_mi = AOMMIN(xd->height, cm->mi_params.mi_rows - mi_row);
end_mi = AOMMIN(end_mi, mi_size_high[BLOCK_64X64]);
const int n8_h_8 = mi_size_high[BLOCK_8X8];
const int n8_h_16 = mi_size_high[BLOCK_16X16];
@@ -201,23 +200,23 @@
int row_offset = 0;
if (abs(col_offset) > 1) {
row_offset = 1;
- if ((mi_row & 0x01) && xd->n4_h < n8_h_8) --row_offset;
+ if ((mi_row & 0x01) && xd->height < n8_h_8) --row_offset;
}
- const int use_step_16 = (xd->n4_h >= 16);
+ const int use_step_16 = (xd->height >= 16);
for (i = 0; i < end_mi;) {
const MB_MODE_INFO *const candidate =
xd->mi[(row_offset + i) * xd->mi_stride + col_offset];
const int candidate_bsize = candidate->sb_type;
const int n4_h = mi_size_high[candidate_bsize];
- int len = AOMMIN(xd->n4_h, n4_h);
+ int len = AOMMIN(xd->height, n4_h);
if (use_step_16)
len = AOMMAX(n8_h_16, len);
else if (abs(col_offset) > 1)
len = AOMMAX(len, n8_h_8);
int weight = 2;
- if (xd->n4_h >= n8_h_8 && xd->n4_h <= n4_h) {
+ if (xd->height >= n8_h_8 && xd->height <= n4_h) {
int inc = AOMMIN(-max_col_offset + col_offset + 1,
mi_size_wide[candidate_bsize]);
// Obtain range used in weight calculation.
@@ -288,19 +287,19 @@
// The left hand of two vertical rectangles always has a top right (as the
// block above will have been decoded)
- if (xd->n4_w < xd->n4_h)
+ if (xd->width < xd->height)
if (!xd->is_sec_rect) has_tr = 1;
// The bottom of two horizontal rectangles never has a top right (as the block
// to the right won't have been decoded)
- if (xd->n4_w > xd->n4_h)
+ if (xd->width > xd->height)
if (xd->is_sec_rect) has_tr = 0;
// The bottom left square of a Vertical A (in the old format) does
// not have a top right as it is decoded before the right hand
// rectangle of the partition
if (xd->mi[0]->partition == PARTITION_VERT_A) {
- if (xd->n4_w == xd->n4_h)
+ if (xd->width == xd->height)
if (mask_row & bs) has_tr = 0;
}
@@ -477,14 +476,14 @@
uint16_t ref_mv_weight[MAX_REF_MV_STACK_SIZE],
int_mv mv_ref_list[MAX_MV_REF_CANDIDATES], int_mv *gm_mv_candidates,
int mi_row, int mi_col, int16_t *mode_context) {
- const int bs = AOMMAX(xd->n4_w, xd->n4_h);
+ const int bs = AOMMAX(xd->width, xd->height);
const int has_tr = has_top_right(cm, xd, mi_row, mi_col, bs);
MV_REFERENCE_FRAME rf[2];
const TileInfo *const tile = &xd->tile;
int max_row_offset = 0, max_col_offset = 0;
- const int row_adj = (xd->n4_h < mi_size_high[BLOCK_8X8]) && (mi_row & 0x01);
- const int col_adj = (xd->n4_w < mi_size_wide[BLOCK_8X8]) && (mi_col & 0x01);
+ const int row_adj = (xd->height < mi_size_high[BLOCK_8X8]) && (mi_row & 0x01);
+ const int col_adj = (xd->width < mi_size_wide[BLOCK_8X8]) && (mi_col & 0x01);
int processed_rows = 0;
int processed_cols = 0;
@@ -496,7 +495,7 @@
if (xd->up_available) {
max_row_offset = -(MVREF_ROW_COLS << 1) + row_adj;
- if (xd->n4_h < mi_size_high[BLOCK_8X8])
+ if (xd->height < mi_size_high[BLOCK_8X8])
max_row_offset = -(2 << 1) + row_adj;
max_row_offset = find_valid_row_offset(tile, mi_row, max_row_offset);
@@ -505,7 +504,7 @@
if (xd->left_available) {
max_col_offset = -(MVREF_ROW_COLS << 1) + col_adj;
- if (xd->n4_w < mi_size_wide[BLOCK_8X8])
+ if (xd->width < mi_size_wide[BLOCK_8X8])
max_col_offset = -(2 << 1) + col_adj;
max_col_offset = find_valid_col_offset(tile, mi_col, max_col_offset);
@@ -527,7 +526,7 @@
max_col_offset, &processed_cols);
// Check top-right boundary
if (has_tr)
- scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, xd->n4_w, ref_mv_stack,
+ scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, xd->width, ref_mv_stack,
ref_mv_weight, &row_match_count, &newmv_count,
gm_mv_candidates, refmv_count);
@@ -540,25 +539,25 @@
if (cm->features.allow_ref_frame_mvs) {
int is_available = 0;
- const int voffset = AOMMAX(mi_size_high[BLOCK_8X8], xd->n4_h);
- const int hoffset = AOMMAX(mi_size_wide[BLOCK_8X8], xd->n4_w);
- const int blk_row_end = AOMMIN(xd->n4_h, mi_size_high[BLOCK_64X64]);
- const int blk_col_end = AOMMIN(xd->n4_w, mi_size_wide[BLOCK_64X64]);
+ const int voffset = AOMMAX(mi_size_high[BLOCK_8X8], xd->height);
+ const int hoffset = AOMMAX(mi_size_wide[BLOCK_8X8], xd->width);
+ const int blk_row_end = AOMMIN(xd->height, mi_size_high[BLOCK_64X64]);
+ const int blk_col_end = AOMMIN(xd->width, mi_size_wide[BLOCK_64X64]);
const int tpl_sample_pos[3][2] = {
{ voffset, -2 },
{ voffset, hoffset },
{ voffset - 2, hoffset },
};
- const int allow_extension = (xd->n4_h >= mi_size_high[BLOCK_8X8]) &&
- (xd->n4_h < mi_size_high[BLOCK_64X64]) &&
- (xd->n4_w >= mi_size_wide[BLOCK_8X8]) &&
- (xd->n4_w < mi_size_wide[BLOCK_64X64]);
+ const int allow_extension = (xd->height >= mi_size_high[BLOCK_8X8]) &&
+ (xd->height < mi_size_high[BLOCK_64X64]) &&
+ (xd->width >= mi_size_wide[BLOCK_8X8]) &&
+ (xd->width < mi_size_wide[BLOCK_64X64]);
- const int step_h = (xd->n4_h >= mi_size_high[BLOCK_64X64])
+ const int step_h = (xd->height >= mi_size_high[BLOCK_64X64])
? mi_size_high[BLOCK_16X16]
: mi_size_high[BLOCK_8X8];
- const int step_w = (xd->n4_w >= mi_size_wide[BLOCK_64X64])
+ const int step_w = (xd->width >= mi_size_wide[BLOCK_64X64])
? mi_size_wide[BLOCK_16X16]
: mi_size_wide[BLOCK_8X8];
@@ -671,9 +670,9 @@
len = nr_len;
}
- int mi_width = AOMMIN(mi_size_wide[BLOCK_64X64], xd->n4_w);
+ int mi_width = AOMMIN(mi_size_wide[BLOCK_64X64], xd->width);
mi_width = AOMMIN(mi_width, cm->mi_params.mi_cols - mi_col);
- int mi_height = AOMMIN(mi_size_high[BLOCK_64X64], xd->n4_h);
+ int mi_height = AOMMIN(mi_size_high[BLOCK_64X64], xd->height);
mi_height = AOMMIN(mi_height, cm->mi_params.mi_rows - mi_row);
const int mi_size = AOMMIN(mi_width, mi_height);
if (rf[1] > NONE_FRAME) {
@@ -739,10 +738,10 @@
assert(*refmv_count >= 2);
for (int idx = 0; idx < *refmv_count; ++idx) {
- clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->n4_w << MI_SIZE_LOG2,
- xd->n4_h << MI_SIZE_LOG2, xd);
- clamp_mv_ref(&ref_mv_stack[idx].comp_mv.as_mv, xd->n4_w << MI_SIZE_LOG2,
- xd->n4_h << MI_SIZE_LOG2, xd);
+ clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->width << MI_SIZE_LOG2,
+ xd->height << MI_SIZE_LOG2, xd);
+ clamp_mv_ref(&ref_mv_stack[idx].comp_mv.as_mv, xd->width << MI_SIZE_LOG2,
+ xd->height << MI_SIZE_LOG2, xd);
}
} else {
// Handle single reference frame extension
@@ -763,8 +762,8 @@
}
for (int idx = 0; idx < *refmv_count; ++idx) {
- clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->n4_w << MI_SIZE_LOG2,
- xd->n4_h << MI_SIZE_LOG2, xd);
+ clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->width << MI_SIZE_LOG2,
+ xd->height << MI_SIZE_LOG2, xd);
}
if (mv_ref_list != NULL) {
@@ -1129,14 +1128,14 @@
if (up_available) {
const int mi_row_offset = -1;
const MB_MODE_INFO *mbmi = xd->mi[mi_row_offset * mi_stride];
- uint8_t n4_w = mi_size_wide[mbmi->sb_type];
+ uint8_t superblock_width = mi_size_wide[mbmi->sb_type];
- if (xd->n4_w <= n4_w) {
+ if (xd->width <= superblock_width) {
// Handle "current block width <= above block width" case.
- const int col_offset = -mi_col % n4_w;
+ const int col_offset = -mi_col % superblock_width;
if (col_offset < 0) do_tl = 0;
- if (col_offset + n4_w > xd->n4_w) do_tr = 0;
+ if (col_offset + superblock_width > xd->width) do_tr = 0;
if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
record_samples(mbmi, pts, pts_inref, 0, -1, col_offset, 1);
@@ -1147,11 +1146,11 @@
}
} else {
// Handle "current block width > above block width" case.
- for (i = 0; i < AOMMIN(xd->n4_w, cm->mi_params.mi_cols - mi_col);
+ for (i = 0; i < AOMMIN(xd->width, cm->mi_params.mi_cols - mi_col);
i += mi_step) {
mbmi = xd->mi[i + mi_row_offset * mi_stride];
- n4_w = mi_size_wide[mbmi->sb_type];
- mi_step = AOMMIN(xd->n4_w, n4_w);
+ superblock_width = mi_size_wide[mbmi->sb_type];
+ mi_step = AOMMIN(xd->width, superblock_width);
if (mbmi->ref_frame[0] == ref_frame &&
mbmi->ref_frame[1] == NONE_FRAME) {
@@ -1170,11 +1169,11 @@
if (left_available) {
const int mi_col_offset = -1;
const MB_MODE_INFO *mbmi = xd->mi[mi_col_offset];
- uint8_t n4_h = mi_size_high[mbmi->sb_type];
+ uint8_t superblock_height = mi_size_high[mbmi->sb_type];
- if (xd->n4_h <= n4_h) {
+ if (xd->height <= superblock_height) {
// Handle "current block height <= above block height" case.
- const int row_offset = -mi_row % n4_h;
+ const int row_offset = -mi_row % superblock_height;
if (row_offset < 0) do_tl = 0;
@@ -1187,11 +1186,11 @@
}
} else {
// Handle "current block height > above block height" case.
- for (i = 0; i < AOMMIN(xd->n4_h, cm->mi_params.mi_rows - mi_row);
+ for (i = 0; i < AOMMIN(xd->height, cm->mi_params.mi_rows - mi_row);
i += mi_step) {
mbmi = xd->mi[mi_col_offset + i * mi_stride];
- n4_h = mi_size_high[mbmi->sb_type];
- mi_step = AOMMIN(xd->n4_h, n4_h);
+ superblock_height = mi_size_high[mbmi->sb_type];
+ mi_step = AOMMIN(xd->height, superblock_height);
if (mbmi->ref_frame[0] == ref_frame &&
mbmi->ref_frame[1] == NONE_FRAME) {
@@ -1224,17 +1223,17 @@
// Top-right block
if (do_tr &&
- has_top_right(cm, xd, mi_row, mi_col, AOMMAX(xd->n4_w, xd->n4_h))) {
- const POSITION trb_pos = { -1, xd->n4_w };
+ has_top_right(cm, xd, mi_row, mi_col, AOMMAX(xd->width, xd->height))) {
+ const POSITION trb_pos = { -1, xd->width };
const TileInfo *const tile = &xd->tile;
if (is_inside(tile, mi_col, mi_row, &trb_pos)) {
const int mi_row_offset = -1;
- const int mi_col_offset = xd->n4_w;
+ const int mi_col_offset = xd->width;
const MB_MODE_INFO *mbmi =
xd->mi[mi_col_offset + mi_row_offset * mi_stride];
if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
- record_samples(mbmi, pts, pts_inref, 0, -1, xd->n4_w, 1);
+ record_samples(mbmi, pts, pts_inref, 0, -1, xd->width, 1);
np++;
if (np >= LEAST_SQUARES_SAMPLES_MAX) return LEAST_SQUARES_SAMPLES_MAX;
}
diff --git a/av1/common/obmc.h b/av1/common/obmc.h
index a001186..cc97b6b 100644
--- a/av1/common/obmc.h
+++ b/av1/common/obmc.h
@@ -29,7 +29,7 @@
// prev_row_mi points into the mi array, starting at the beginning of the
// previous row.
MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
- const int end_col = AOMMIN(mi_col + xd->n4_w, cm->mi_params.mi_cols);
+ const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
uint8_t mi_step;
for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
above_mi_col += mi_step) {
@@ -48,8 +48,8 @@
}
if (is_neighbor_overlappable(*above_mi)) {
++nb_count;
- fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->n4_w, mi_step), 0, *above_mi,
- fun_ctxt, num_planes);
+ fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
+ *above_mi, fun_ctxt, num_planes);
}
}
}
@@ -66,7 +66,7 @@
// previous column
const int mi_row = xd->mi_row;
MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
- const int end_row = AOMMIN(mi_row + xd->n4_h, cm->mi_params.mi_rows);
+ const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
uint8_t mi_step;
for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
left_mi_row += mi_step) {
@@ -80,7 +80,7 @@
}
if (is_neighbor_overlappable(*left_mi)) {
++nb_count;
- fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->n4_h, mi_step), 1, *left_mi,
+ fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
fun_ctxt, num_planes);
}
}
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 1167c35..b11f178 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -1050,8 +1050,9 @@
}
xd->mb_to_left_edge = 8 * MI_SIZE * (-above_mi_col);
- xd->mb_to_right_edge = ctxt->mb_to_far_edge +
- (xd->n4_w - rel_mi_col - above_mi_width) * MI_SIZE * 8;
+ xd->mb_to_right_edge =
+ ctxt->mb_to_far_edge +
+ (xd->width - rel_mi_col - above_mi_width) * MI_SIZE * 8;
}
void av1_setup_build_prediction_by_left_pred(MACROBLOCKD *xd, int rel_mi_row,
@@ -1091,7 +1092,7 @@
xd->mb_to_top_edge = GET_MV_SUBPEL(MI_SIZE * (-left_mi_row));
xd->mb_to_bottom_edge =
ctxt->mb_to_far_edge +
- GET_MV_SUBPEL((xd->n4_h - rel_mi_row - left_mi_height) * MI_SIZE);
+ GET_MV_SUBPEL((xd->height - rel_mi_row - left_mi_height) * MI_SIZE);
}
static AOM_INLINE void combine_interintra(
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 303cd97..4495f1c 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -898,13 +898,13 @@
// Adjust mb_to_bottom_edge to have the correct value for the OBMC
// prediction block. This is half the height of the original block,
// except for 128-wide blocks, where we only use a height of 32.
- int this_height = xd->n4_h * MI_SIZE;
- int pred_height = AOMMIN(this_height / 2, 32);
+ 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 };
- BLOCK_SIZE bsize = xd->mi[0]->sb_type;
+ const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
foreach_overlappable_nb_above(cm, xd,
max_neighbor_obmc[mi_size_wide_log2[bsize]],
dec_build_prediction_by_above_pred, &ctxt);
@@ -952,14 +952,14 @@
// Adjust mb_to_right_edge to have the correct value for the OBMC
// prediction block. This is half the width of the original block,
// except for 128-wide blocks, where we only use a width of 32.
- int this_width = xd->n4_w * MI_SIZE;
- int pred_width = AOMMIN(this_width / 2, 32);
+ const int this_width = xd->width * MI_SIZE;
+ 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 };
- BLOCK_SIZE bsize = xd->mi[0]->sb_type;
+ const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
foreach_overlappable_nb_left(cm, xd,
max_neighbor_obmc[mi_size_high_log2[bsize]],
dec_build_prediction_by_left_pred, &ctxt);
@@ -1376,7 +1376,7 @@
read_tx_size(xd, cm->features.tx_mode, inter_block_tx, !mbmi->skip, r);
if (inter_block_tx)
memset(mbmi->inter_tx_size, mbmi->tx_size, sizeof(mbmi->inter_tx_size));
- set_txfm_ctxs(mbmi->tx_size, xd->n4_w, xd->n4_h,
+ set_txfm_ctxs(mbmi->tx_size, xd->width, xd->height,
mbmi->skip && is_inter_block(mbmi), xd);
#if CONFIG_LPF_MASK
const int w = mi_size_wide[bsize];
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 43c3d00..9929995 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1528,10 +1528,11 @@
}
} else {
write_selected_tx_size(xd, w);
- set_txfm_ctxs(mbmi->tx_size, xd->n4_w, xd->n4_h, 0, xd);
+ set_txfm_ctxs(mbmi->tx_size, xd->width, xd->height, 0, xd);
}
} else {
- set_txfm_ctxs(mbmi->tx_size, xd->n4_w, xd->n4_h, skip && is_inter_tx, xd);
+ set_txfm_ctxs(mbmi->tx_size, xd->width, xd->height, skip && is_inter_tx,
+ xd);
}
if (!mbmi->skip) {
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index a0f7775..c909f1c 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -6437,7 +6437,7 @@
tx_size = (bsize > BLOCK_4X4) ? tx_size : TX_4X4;
}
mbmi->tx_size = tx_size;
- set_txfm_ctxs(tx_size, xd->n4_w, xd->n4_h,
+ set_txfm_ctxs(tx_size, xd->width, xd->height,
(mbmi->skip || seg_skip) && is_inter_block(mbmi), xd);
}
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 84dfc29..f911733 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1324,9 +1324,9 @@
best_rd_stats_y = simple_states->rd_stats_y;
best_rd_stats_uv = simple_states->rd_stats_uv;
memcpy(best_blk_skip, simple_states->blk_skip,
- sizeof(x->blk_skip[0]) * xd->n4_h * xd->n4_w);
+ sizeof(x->blk_skip[0]) * xd->height * xd->width);
av1_copy_array(best_tx_type_map, simple_states->tx_type_map,
- xd->n4_h * xd->n4_w);
+ xd->height * xd->width);
best_xskip = simple_states->skip;
best_disable_skip = simple_states->disable_skip;
best_mbmi = *mbmi;
@@ -1574,9 +1574,9 @@
simple_states->rd_stats_y = *rd_stats_y;
simple_states->rd_stats_uv = *rd_stats_uv;
memcpy(simple_states->blk_skip, x->blk_skip,
- sizeof(x->blk_skip[0]) * xd->n4_h * xd->n4_w);
+ sizeof(x->blk_skip[0]) * xd->height * xd->width);
av1_copy_array(simple_states->tx_type_map, xd->tx_type_map,
- xd->n4_h * xd->n4_w);
+ xd->height * xd->width);
simple_states->skip = mbmi->skip;
simple_states->disable_skip = *disable_skip;
}
@@ -1589,8 +1589,8 @@
best_rate_mv = tmp_rate_mv;
if (num_planes > 1) best_rd_stats_uv = *rd_stats_uv;
memcpy(best_blk_skip, x->blk_skip,
- sizeof(x->blk_skip[0]) * xd->n4_h * xd->n4_w);
- av1_copy_array(best_tx_type_map, xd->tx_type_map, xd->n4_h * xd->n4_w);
+ sizeof(x->blk_skip[0]) * xd->height * xd->width);
+ av1_copy_array(best_tx_type_map, xd->tx_type_map, xd->height * xd->width);
best_xskip = mbmi->skip;
best_disable_skip = *disable_skip;
// TODO(anyone): evaluate the quality and speed trade-off of the early
@@ -1610,8 +1610,8 @@
*rd_stats_y = best_rd_stats_y;
if (num_planes > 1) *rd_stats_uv = best_rd_stats_uv;
memcpy(x->blk_skip, best_blk_skip,
- sizeof(x->blk_skip[0]) * xd->n4_h * xd->n4_w);
- av1_copy_array(xd->tx_type_map, best_tx_type_map, xd->n4_h * xd->n4_w);
+ sizeof(x->blk_skip[0]) * xd->height * xd->width);
+ av1_copy_array(xd->tx_type_map, best_tx_type_map, xd->height * xd->width);
x->force_skip = best_xskip;
*disable_skip = best_disable_skip;
@@ -2068,7 +2068,7 @@
// prev_row_mi points into the mi array, starting at the beginning of the
// previous row.
MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
- const int end_col = AOMMIN(mi_col + xd->n4_w, total_mi_cols);
+ const int end_col = AOMMIN(mi_col + xd->width, total_mi_cols);
uint8_t mi_step;
for (int above_mi_col = mi_col; above_mi_col < end_col;
above_mi_col += mi_step) {
@@ -2090,7 +2090,7 @@
// prev_col_mi points into the mi array, starting at the top of the
// previous column
MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
- const int end_row = AOMMIN(mi_row + xd->n4_h, total_mi_rows);
+ const int end_row = AOMMIN(mi_row + xd->height, total_mi_rows);
uint8_t mi_step;
for (int left_mi_row = mi_row; left_mi_row < end_row;
left_mi_row += mi_step) {
@@ -2593,8 +2593,9 @@
best_disable_skip = *disable_skip;
best_xskip = x->force_skip;
memcpy(best_blk_skip, x->blk_skip,
- sizeof(best_blk_skip[0]) * xd->n4_h * xd->n4_w);
- av1_copy_array(best_tx_type_map, xd->tx_type_map, xd->n4_h * xd->n4_w);
+ sizeof(best_blk_skip[0]) * xd->height * xd->width);
+ av1_copy_array(best_tx_type_map, xd->tx_type_map,
+ xd->height * xd->width);
motion_mode_cand->rate_mv = rate_mv;
motion_mode_cand->rate2_nocoeff = rate2_nocoeff;
}
@@ -2619,8 +2620,8 @@
assert(IMPLIES(mbmi->comp_group_idx == 1,
mbmi->interinter_comp.type != COMPOUND_AVERAGE));
memcpy(x->blk_skip, best_blk_skip,
- sizeof(best_blk_skip[0]) * xd->n4_h * xd->n4_w);
- av1_copy_array(xd->tx_type_map, best_tx_type_map, xd->n4_h * xd->n4_w);
+ sizeof(best_blk_skip[0]) * xd->height * xd->width);
+ av1_copy_array(xd->tx_type_map, best_tx_type_map, xd->height * xd->width);
rd_stats->rdcost = RDCOST(x->rdmult, rd_stats->rate, rd_stats->dist);
@@ -2791,14 +2792,14 @@
best_mbmi = *mbmi;
best_rdstats = rd_stats_yuv;
memcpy(best_blk_skip, x->blk_skip,
- sizeof(x->blk_skip[0]) * xd->n4_h * xd->n4_w);
- av1_copy_array(best_tx_type_map, xd->tx_type_map, xd->n4_h * xd->n4_w);
+ sizeof(x->blk_skip[0]) * xd->height * xd->width);
+ av1_copy_array(best_tx_type_map, xd->tx_type_map, xd->height * xd->width);
}
}
*mbmi = best_mbmi;
*rd_stats = best_rdstats;
memcpy(x->blk_skip, best_blk_skip,
- sizeof(x->blk_skip[0]) * xd->n4_h * xd->n4_w);
+ sizeof(x->blk_skip[0]) * xd->height * xd->width);
av1_copy_array(xd->tx_type_map, best_tx_type_map, ctx->num_4x4_blk);
#if CONFIG_RD_DEBUG
mbmi->rd_stats = *rd_stats;
@@ -3006,7 +3007,7 @@
memset(search_state->best_mbmode.inter_tx_size,
search_state->best_mbmode.tx_size,
sizeof(search_state->best_mbmode.inter_tx_size));
- set_txfm_ctxs(search_state->best_mbmode.tx_size, xd->n4_w, xd->n4_h,
+ set_txfm_ctxs(search_state->best_mbmode.tx_size, xd->width, xd->height,
search_state->best_mbmode.skip && is_inter_block(mbmi), xd);
// Set up color-related variables for skip mode.
@@ -3143,7 +3144,7 @@
av1_super_block_yrd(cpi, x, &rd_stats_y, bsize, INT64_MAX);
memset(mbmi->inter_tx_size, mbmi->tx_size,
sizeof(mbmi->inter_tx_size));
- for (int i = 0; i < xd->n4_h * xd->n4_w; ++i)
+ for (int i = 0; i < xd->height * xd->width; ++i)
set_blk_skip(x, 0, i, rd_stats_y.skip);
}
} else {
@@ -5126,7 +5127,7 @@
struct calc_target_weighted_pred_ctxt *ctxt =
(struct calc_target_weighted_pred_ctxt *)fun_ctxt;
- const int bw = xd->n4_w << MI_SIZE_LOG2;
+ const int bw = xd->width << MI_SIZE_LOG2;
const uint8_t *const mask1d = av1_get_obmc_mask(ctxt->overlap);
int32_t *wsrc = ctxt->x->wsrc_buf + (rel_mi_col * MI_SIZE);
@@ -5174,7 +5175,7 @@
struct calc_target_weighted_pred_ctxt *ctxt =
(struct calc_target_weighted_pred_ctxt *)fun_ctxt;
- const int bw = xd->n4_w << MI_SIZE_LOG2;
+ const int bw = xd->width << MI_SIZE_LOG2;
const uint8_t *const mask1d = av1_get_obmc_mask(ctxt->overlap);
int32_t *wsrc = ctxt->x->wsrc_buf + (rel_mi_row * MI_SIZE * bw);
@@ -5256,8 +5257,8 @@
const uint8_t *above, int above_stride, const uint8_t *left,
int left_stride) {
const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
- const int bw = xd->n4_w << MI_SIZE_LOG2;
- const int bh = xd->n4_h << MI_SIZE_LOG2;
+ const int bw = xd->width << MI_SIZE_LOG2;
+ const int bh = xd->height << MI_SIZE_LOG2;
int32_t *mask_buf = x->mask_buf;
int32_t *wsrc_buf = x->wsrc_buf;
diff --git a/av1/encoder/tx_search.c b/av1/encoder/tx_search.c
index 31868fe..277ad54 100644
--- a/av1/encoder/tx_search.c
+++ b/av1/encoder/tx_search.c
@@ -3497,7 +3497,7 @@
} else {
av1_super_block_yrd(cpi, x, rd_stats_y, bsize, rd_thresh);
memset(mbmi->inter_tx_size, mbmi->tx_size, sizeof(mbmi->inter_tx_size));
- for (int i = 0; i < xd->n4_h * xd->n4_w; ++i)
+ for (int i = 0; i < xd->height * xd->width; ++i)
set_blk_skip(x, 0, i, rd_stats_y->skip);
}