Commit ff6ee6ab authored by Jingning Han's avatar Jingning Han

Replace hard coded x8 with MI_SIZE

Change-Id: Ib7807125e533c32dad04b02bc54838dd1e90e8af
parent f4c904c7
......@@ -484,7 +484,7 @@ typedef struct macroblockd {
#endif
#endif
// dimension in the unit of 8x8 block of the current block
// block dimension in the unit of mode_info.
uint8_t n8_w, n8_h;
#if CONFIG_REF_MV
......
......@@ -477,15 +477,16 @@ static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if (rf[1] > NONE) {
for (idx = 0; idx < *refmv_count; ++idx) {
clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->n8_w << 3,
xd->n8_h << 3, xd);
clamp_mv_ref(&ref_mv_stack[idx].comp_mv.as_mv, xd->n8_w << 3,
xd->n8_h << 3, xd);
clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
clamp_mv_ref(&ref_mv_stack[idx].comp_mv.as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
}
} else {
for (idx = 0; idx < AOMMIN(MAX_MV_REF_CANDIDATES, *refmv_count); ++idx) {
mv_ref_list[idx].as_int = ref_mv_stack[idx].this_mv.as_int;
clamp_mv_ref(&mv_ref_list[idx].as_mv, xd->n8_w << 3, xd->n8_h << 3, xd);
clamp_mv_ref(&mv_ref_list[idx].as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
}
}
}
......@@ -877,8 +878,8 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
}
for (idx = 0; idx < *ref_mv_count; ++idx)
clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->n8_w << 3, xd->n8_h << 3,
xd);
clamp_mv_ref(&ref_mv_stack[idx].this_mv.as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
for (idx = 0; idx < AOMMIN(MAX_MV_REF_CANDIDATES, *ref_mv_count); ++idx)
mv_list[idx].as_int = ref_mv_stack[idx].this_mv.as_int;
......
......@@ -780,8 +780,8 @@ static INLINE void set_txfm_ctxs(TX_SIZE tx_size, int n8_w, int n8_h,
uint8_t bh = tx_size_high[tx_size];
if (skip) {
bw = n8_w * 8;
bh = n8_h * 8;
bw = n8_w * MI_SIZE;
bh = n8_h * MI_SIZE;
}
set_txfm_ctx(xd->above_txfm_context, bw, n8_w);
......
......@@ -1595,9 +1595,10 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
pd->pre[0].stride, pd->dst.buf,
((mi_col * MI_SIZE) >> pd->subsampling_x),
((mi_row * MI_SIZE) >> pd->subsampling_y),
xd->n8_w * (8 >> pd->subsampling_x),
xd->n8_h * (8 >> pd->subsampling_y), pd->dst.stride,
pd->subsampling_x, pd->subsampling_y, 16, 16, 0);
xd->n8_w * (MI_SIZE >> pd->subsampling_x),
xd->n8_h * (MI_SIZE >> pd->subsampling_y),
pd->dst.stride, pd->subsampling_x, pd->subsampling_y, 16,
16, 0);
}
} else {
#endif // CONFIG_WARPED_MOTION
......
......@@ -1749,7 +1749,8 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
(ref == 0)
? xd->ref_mv_stack[ref_frame_type][mbmi->ref_mv_idx].this_mv
: xd->ref_mv_stack[ref_frame_type][mbmi->ref_mv_idx].comp_mv;
clamp_mv_ref(&ref_mv[ref].as_mv, xd->n8_w << 3, xd->n8_h << 3, xd);
clamp_mv_ref(&ref_mv[ref].as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
}
#endif
nearestmv[ref] = ref_mv[ref];
......
......@@ -1063,7 +1063,8 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
(i == 0)
? x->mbmi_ext->ref_mv_stack[rf_type][mbmi->ref_mv_idx].this_mv
: x->mbmi_ext->ref_mv_stack[rf_type][mbmi->ref_mv_idx].comp_mv;
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << 3, xd->n8_h << 3, xd);
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
x->mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0] = this_mv;
mbmi->pred_mv[i] = this_mv;
mi->mbmi.pred_mv[i] = this_mv;
......@@ -1260,7 +1261,8 @@ static void update_state_supertx(const AV1_COMP *const cpi, ThreadData *td,
(i == 0)
? x->mbmi_ext->ref_mv_stack[rf_type][mbmi->ref_mv_idx].this_mv
: x->mbmi_ext->ref_mv_stack[rf_type][mbmi->ref_mv_idx].comp_mv;
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << 3, xd->n8_h << 3, xd);
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
lower_mv_precision(&this_mv.as_mv, cm->allow_high_precision_mv);
x->mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0] = this_mv;
mbmi->pred_mv[i] = this_mv;
......@@ -5546,9 +5548,10 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
pd->pre[0].stride, pd->dst.buf,
((mi_col * MI_SIZE) >> pd->subsampling_x),
((mi_row * MI_SIZE) >> pd->subsampling_y),
xd->n8_w * (8 >> pd->subsampling_x),
xd->n8_h * (8 >> pd->subsampling_y), pd->dst.stride,
pd->subsampling_x, pd->subsampling_y, 16, 16, 0);
xd->n8_w * (MI_SIZE >> pd->subsampling_x),
xd->n8_h * (MI_SIZE >> pd->subsampling_y),
pd->dst.stride, pd->subsampling_x, pd->subsampling_y, 16,
16, 0);
}
} else {
#endif // CONFIG_WARPED_MOTION
......
......@@ -7918,9 +7918,10 @@ static int64_t handle_inter_mode(
pd->pre[0].stride, pd->dst.buf,
(mi_col * MI_SIZE) >> pd->subsampling_x,
(mi_row * MI_SIZE) >> pd->subsampling_y,
(xd->n8_w * 8) >> pd->subsampling_x,
(xd->n8_h * 8) >> pd->subsampling_y, pd->dst.stride,
pd->subsampling_x, pd->subsampling_y, 16, 16, 0);
(xd->n8_w * MI_SIZE) >> pd->subsampling_x,
(xd->n8_h * MI_SIZE) >> pd->subsampling_y,
pd->dst.stride, pd->subsampling_x, pd->subsampling_y,
16, 16, 0);
}
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
......@@ -9298,7 +9299,8 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int_mv this_mv =
(ref == 0) ? mbmi_ext->ref_mv_stack[ref_frame_type][0].this_mv
: mbmi_ext->ref_mv_stack[ref_frame_type][0].comp_mv;
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << 3, xd->n8_h << 3, xd);
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0] = this_mv;
}
}
......@@ -9393,7 +9395,8 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
.this_mv
: mbmi_ext->ref_mv_stack[ref_frame_type][mbmi->ref_mv_idx]
.comp_mv;
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << 3, xd->n8_h << 3, xd);
clamp_mv_ref(&this_mv.as_mv, xd->n8_w << MI_SIZE_LOG2,
xd->n8_h << MI_SIZE_LOG2, xd);
mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0] = this_mv;
}
......@@ -9736,9 +9739,10 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
pd->pre[0].stride, pd->dst.buf,
((mi_col * MI_SIZE) >> pd->subsampling_x),
((mi_row * MI_SIZE) >> pd->subsampling_y),
xd->n8_w * (8 >> pd->subsampling_x),
xd->n8_h * (8 >> pd->subsampling_y), pd->dst.stride,
pd->subsampling_x, pd->subsampling_y, 16, 16, 0);
xd->n8_w * (MI_SIZE >> pd->subsampling_x),
xd->n8_h * (MI_SIZE >> pd->subsampling_y),
pd->dst.stride, pd->subsampling_x, pd->subsampling_y,
16, 16, 0);
}
} else {
#endif // CONFIG_WARPED_MOTION
......@@ -11172,8 +11176,8 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
int left_stride) {
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
int row, col, i;
const int bw = 8 * xd->n8_w;
const int bh = 8 * xd->n8_h;
const int bw = xd->n8_w << MI_SIZE_LOG2;
const int bh = xd->n8_h << MI_SIZE_LOG2;
int32_t *mask_buf = x->mask_buf;
int32_t *wsrc_buf = x->wsrc_buf;
const int wsrc_stride = bw;
......
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