Commit 531d6afd authored by Yaowu Xu's avatar Yaowu Xu

localize the use of CONFIG_DEPENDENT_HORZTILES

This commit changes is_inside() function to reduce the code polution
of CONFIG_DEPENDENT_HORZTILES.

Change-Id: Ic065cc337e0246379d87966a49ddeb48b975c5be
parent 27d158b2
......@@ -191,12 +191,7 @@ static uint8_t scan_row_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
mi_pos.row = row_offset;
mi_pos.col = i;
#if CONFIG_DEPENDENT_HORZTILES
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm->dependent_horz_tiles,
&mi_pos)) {
#else
if (is_inside(tile, mi_col, mi_row, &mi_pos)) {
#endif
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos)) {
const MODE_INFO *const candidate_mi =
xd->mi[mi_pos.row * xd->mi_stride + mi_pos.col];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
......@@ -243,12 +238,7 @@ static uint8_t scan_col_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
mi_pos.row = i;
mi_pos.col = col_offset;
#if CONFIG_DEPENDENT_HORZTILES
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm->dependent_horz_tiles,
&mi_pos)) {
#else
if (is_inside(tile, mi_col, mi_row, &mi_pos)) {
#endif
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos)) {
const MODE_INFO *const candidate_mi =
xd->mi[mi_pos.row * xd->mi_stride + mi_pos.col];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
......@@ -281,14 +271,8 @@ static uint8_t scan_blk_mbmi(const AV1_COMMON *cm, const MACROBLOCKD *xd,
mi_pos.row = row_offset;
mi_pos.col = col_offset;
#if CONFIG_DEPENDENT_HORZTILES
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm->dependent_horz_tiles,
&mi_pos) &&
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos) &&
*refmv_count < MAX_REF_MV_STACK_SIZE) {
#else
if (is_inside(tile, mi_col, mi_row, &mi_pos) &&
*refmv_count < MAX_REF_MV_STACK_SIZE) {
#endif
const MODE_INFO *const candidate_mi =
xd->mi[mi_pos.row * xd->mi_stride + mi_pos.col];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
......@@ -369,14 +353,8 @@ static int add_col_ref_mv(const AV1_COMMON *cm,
mi_pos.col = blk_col;
#endif
#if CONFIG_DEPENDENT_HORZTILES
if (!is_inside(&xd->tile, mi_col, mi_row, cm->mi_rows,
cm->dependent_horz_tiles, &mi_pos))
if (!is_inside(&xd->tile, mi_col, mi_row, cm->mi_rows, cm, &mi_pos))
return coll_blk_count;
#else
if (!is_inside(&xd->tile, mi_col, mi_row, &mi_pos)) return coll_blk_count;
#endif
for (ref = 0; ref < 2; ++ref) {
if (prev_frame_mvs->ref_frame[ref] == ref_frame) {
int_mv this_refmv = prev_frame_mvs->mv[ref];
......@@ -678,12 +656,7 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
// and we also need to keep a mode count.
for (i = 0; i < 2; ++i) {
const POSITION *const mv_ref = &mv_ref_search[i];
#if CONFIG_DEPENDENT_HORZTILES
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm->dependent_horz_tiles,
mv_ref)) {
#else
if (is_inside(tile, mi_col, mi_row, mv_ref)) {
#endif
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, mv_ref)) {
const MODE_INFO *const candidate_mi =
xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
......@@ -705,12 +678,7 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
// mode counts.
for (; i < MVREF_NEIGHBOURS; ++i) {
const POSITION *const mv_ref = &mv_ref_search[i];
#if CONFIG_DEPENDENT_HORZTILES
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm->dependent_horz_tiles,
mv_ref)) {
#else
if (is_inside(tile, mi_col, mi_row, mv_ref)) {
#endif
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, mv_ref)) {
const MB_MODE_INFO *const candidate =
!xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
? NULL
......@@ -764,12 +732,7 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
if (different_ref_found) {
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
const POSITION *mv_ref = &mv_ref_search[i];
#if CONFIG_DEPENDENT_HORZTILES
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm->dependent_horz_tiles,
mv_ref)) {
#else
if (is_inside(tile, mi_col, mi_row, mv_ref)) {
#endif
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, mv_ref)) {
const MB_MODE_INFO *const candidate =
!xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]
? NULL
......@@ -822,10 +785,10 @@ Done:
#if CONFIG_EXT_INTER
// This function keeps a mode count for a given MB/SB
void av1_update_mv_context(const MACROBLOCKD *xd, MODE_INFO *mi,
MV_REFERENCE_FRAME ref_frame, int_mv *mv_ref_list,
int block, int mi_row, int mi_col,
int16_t *mode_context) {
void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd,
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list, int block, int mi_row,
int mi_col, int16_t *mode_context) {
int i, refmv_count = 0;
#if !CONFIG_REF_MV
const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type];
......@@ -879,12 +842,7 @@ void av1_update_mv_context(const MACROBLOCKD *xd, MODE_INFO *mi,
// If the size < 8x8, we get the mv from the bmi substructure;
for (i = 0; i < 2; ++i) {
const POSITION *const mv_ref = &mv_ref_search[i];
#if CONFIG_DEPENDENT_HORZTILES
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm->dependent_horz_tiles,
mv_ref)) {
#else
if (is_inside(tile, mi_col, mi_row, mv_ref)) {
#endif
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, cm, mv_ref)) {
const MODE_INFO *const candidate_mi =
xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
......@@ -929,7 +887,7 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
#endif
#endif
#if CONFIG_EXT_INTER
av1_update_mv_context(xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
av1_update_mv_context(cm, xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
#if CONFIG_REF_MV
compound_mode_context);
#else
......
......@@ -345,10 +345,15 @@ static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
// Checks that the given mi_row, mi_col and search point
// are inside the borders of the tile.
#if CONFIG_DEPENDENT_HORZTILES
static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row,
int mi_rows, int dependent_horz_tile_flag,
int mi_rows, const AV1_COMMON *cm,
const POSITION *mi_pos) {
#if CONFIG_DEPENDENT_HORZTILES
const int dependent_horz_tile_flag = cm->dependent_horz_tiles;
#else
const int dependent_horz_tile_flag = 0;
(void)cm;
#endif
#if CONFIG_TILE_GROUPS
if (dependent_horz_tile_flag && !tile->tg_horz_boundary) {
#else
......@@ -365,15 +370,6 @@ static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row,
mi_col + mi_pos->col >= tile->mi_col_end);
}
}
#else
static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row,
const POSITION *mi_pos) {
return !(mi_row + mi_pos->row < tile->mi_row_start ||
mi_col + mi_pos->col < tile->mi_col_start ||
mi_row + mi_pos->row >= tile->mi_row_end ||
mi_col + mi_pos->col >= tile->mi_col_end);
}
#endif
static INLINE void lower_mv_precision(MV *mv, int allow_hp) {
if (!allow_hp) {
......@@ -513,10 +509,10 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
// This function keeps a mode count for a given MB/SB
void av1_update_mv_context(const MACROBLOCKD *xd, MODE_INFO *mi,
MV_REFERENCE_FRAME ref_frame, int_mv *mv_ref_list,
int block, int mi_row, int mi_col,
int16_t *mode_context);
void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd,
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list, int block, int mi_row,
int mi_col, int16_t *mode_context);
#endif // CONFIG_EXT_INTER
#if CONFIG_WARPED_MOTION
......
......@@ -1834,8 +1834,8 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#if CONFIG_EXT_INTER
{
int_mv mv_ref_list[MAX_MV_REF_CANDIDATES];
av1_update_mv_context(xd, mi, mbmi->ref_frame[ref], mv_ref_list, j,
mi_row, mi_col, NULL);
av1_update_mv_context(cm, xd, mi, mbmi->ref_frame[ref], mv_ref_list,
j, mi_row, mi_col, NULL);
#endif // CONFIG_EXT_INTER
av1_append_sub8x8_mvs_for_idx(cm, xd, j, ref, mi_row, mi_col,
#if CONFIG_REF_MV
......
......@@ -5835,8 +5835,8 @@ static int64_t rd_pick_inter_best_sub8x8_mode(
const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
#if CONFIG_EXT_INTER
int_mv mv_ref_list[MAX_MV_REF_CANDIDATES];
av1_update_mv_context(xd, mi, frame, mv_ref_list, index, mi_row, mi_col,
NULL);
av1_update_mv_context(cm, xd, mi, frame, mv_ref_list, index, mi_row,
mi_col, NULL);
#endif // CONFIG_EXT_INTER
#if CONFIG_GLOBAL_MOTION
frame_mv[ZEROMV][frame].as_int =
......
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