Commit 20885281 authored by Wei-Ting Lin's avatar Wei-Ting Lin Committed by Wei-ting Lin

Remove motion_mode_wrapper

Change-Id: I3de1c933ee0fa90e9c0d52e6cbe4bc8bf5482a73
parent 3122b7d5
......@@ -1535,7 +1535,15 @@ static INLINE int check_num_overlappable_neighbors(const MB_MODE_INFO *mbmi) {
return !(mbmi->overlappable_neighbors[0] == 0 &&
mbmi->overlappable_neighbors[1] == 0);
}
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
static INLINE NCOBMC_MODE ncobmc_mode_allowed_bsize(BLOCK_SIZE bsize) {
if (bsize < BLOCK_8X8 || bsize >= BLOCK_64X64)
return NO_OVERLAP;
else
return MAX_NCOBMC_MODES;
}
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#endif // CONFIG_MOTION_VAR
static INLINE MOTION_MODE motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
......@@ -1563,12 +1571,20 @@ static INLINE MOTION_MODE motion_mode_allowed(
#endif
#if CONFIG_WARPED_MOTION
if (!has_second_ref(mbmi) && mbmi->num_proj_ref[0] >= 1 &&
!av1_is_scaled(&(xd->block_refs[0]->sf)))
!av1_is_scaled(&(xd->block_refs[0]->sf))) {
return WARPED_CAUSAL;
else
} else {
#endif // CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR
return OBMC_CAUSAL;
#if CONFIG_NCOBMC_ADAPT_WEIGHT
if (ncobmc_mode_allowed_bsize(mbmi->sb_type) < NO_OVERLAP)
return NCOBMC_ADAPT_WEIGHT;
else
#endif
return OBMC_CAUSAL;
#if CONFIG_WARPED_MOTION
}
#endif // CONFIG_WARPED_MOTION
#else
return SIMPLE_TRANSLATION;
#endif // CONFIG_MOTION_VAR
......@@ -1577,43 +1593,6 @@ static INLINE MOTION_MODE motion_mode_allowed(
}
}
#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR
static INLINE NCOBMC_MODE ncobmc_mode_allowed_bsize(BLOCK_SIZE bsize) {
if (bsize < BLOCK_8X8 || bsize >= BLOCK_64X64)
return NO_OVERLAP;
else
return MAX_NCOBMC_MODES;
}
static INLINE MOTION_MODE
motion_mode_allowed_wrapper(int for_mv_search,
#if CONFIG_GLOBAL_MOTION
int block, const WarpedMotionParams *gm_params,
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
const MACROBLOCKD *xd,
#endif
const MODE_INFO *mi) {
const MB_MODE_INFO *mbmi = &mi->mbmi;
MOTION_MODE motion_mode_for_mv_search = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
block, gm_params,
#endif
#if CONFIG_WARPED_MOTION
xd,
#endif
mi);
int ncobmc_mode_allowed =
(ncobmc_mode_allowed_bsize(mbmi->sb_type) < NO_OVERLAP) &&
motion_mode_for_mv_search >= OBMC_CAUSAL;
if (for_mv_search)
return motion_mode_for_mv_search;
else
return ncobmc_mode_allowed ? NCOBMC_ADAPT_WEIGHT
: motion_mode_for_mv_search;
}
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR
static INLINE void assert_motion_mode_valid(MOTION_MODE mode,
#if CONFIG_GLOBAL_MOTION
int block,
......@@ -1623,17 +1602,6 @@ static INLINE void assert_motion_mode_valid(MOTION_MODE mode,
const MACROBLOCKD *xd,
#endif
const MODE_INFO *mi) {
#if CONFIG_NCOBMC_ADAPT_WEIGHT
const MOTION_MODE last_motion_mode_allowed =
motion_mode_allowed_wrapper(0,
#if CONFIG_GLOBAL_MOTION
block, gm_params,
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
xd,
#endif
mi);
#else
const MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
block, gm_params,
......@@ -1642,7 +1610,7 @@ static INLINE void assert_motion_mode_valid(MOTION_MODE mode,
xd,
#endif
mi);
#endif
// Check that the input mode is not illegal
if (last_motion_mode_allowed < mode)
assert(0 && "Illegal motion mode selected");
......
......@@ -497,13 +497,13 @@ typedef enum {
SIMPLE_TRANSLATION = 0,
#if CONFIG_MOTION_VAR
OBMC_CAUSAL, // 2-sided OBMC
#endif // CONFIG_MOTION_VAR
#if CONFIG_NCOBMC_ADAPT_WEIGHT
NCOBMC_ADAPT_WEIGHT,
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#endif // CONFIG_MOTION_VAR
#if CONFIG_WARPED_MOTION
WARPED_CAUSAL, // 2-sided WARPED
#endif // CONFIG_WARPED_MOTION
#if CONFIG_NCOBMC_ADAPT_WEIGHT
NCOBMC_ADAPT_WEIGHT,
#endif
MOTION_MODES
} MOTION_MODE;
......
......@@ -304,17 +304,6 @@ static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
(void)cm;
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
const MOTION_MODE last_motion_mode_allowed =
motion_mode_allowed_wrapper(0,
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
xd,
#endif
mi);
#else
const MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
......@@ -323,7 +312,6 @@ static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
xd,
#endif
mi);
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
int motion_mode;
FRAME_COUNTS *counts = xd->counts;
......
......@@ -501,18 +501,6 @@ static void write_motion_mode(const AV1_COMMON *cm, MACROBLOCKD *xd,
// it to avoid a compiler warning.
(void)cm;
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
MOTION_MODE last_motion_mode_allowed =
motion_mode_allowed_wrapper(0,
#if CONFIG_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
xd,
#endif
mi);
#else
MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
0, cm->global_motion,
......@@ -521,7 +509,6 @@ static void write_motion_mode(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd,
#endif
mi);
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
if (last_motion_mode_allowed == SIMPLE_TRANSLATION) return;
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
if (last_motion_mode_allowed == OBMC_CAUSAL) {
......
......@@ -1789,17 +1789,6 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
#if CONFIG_WARPED_MOTION
set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT
const MOTION_MODE motion_allowed =
motion_mode_allowed_wrapper(0,
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
xd,
#endif
mi);
#else
const MOTION_MODE motion_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
......@@ -1808,7 +1797,6 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
xd,
#endif
mi);
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
......@@ -2081,7 +2069,6 @@ static void encode_b(const AV1_COMP *const cpi, const TileInfo *const tile,
#endif
#if CONFIG_MOTION_VAR && (CONFIG_NCOBMC || CONFIG_NCOBMC_ADAPT_WEIGHT)
#if CONFIG_NCOBMC
const MOTION_MODE motion_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
......@@ -2090,17 +2077,6 @@ static void encode_b(const AV1_COMP *const cpi, const TileInfo *const tile,
xd,
#endif
xd->mi[0]);
#elif CONFIG_NCOBMC_ADAPT_WEIGHT
const MOTION_MODE motion_allowed =
motion_mode_allowed_wrapper(0,
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
xd,
#endif
xd->mi[0]);
#endif
#endif // CONFIG_MOTION_VAR && (CONFIG_NCOBMC || CONFIG_NCOBMC_ADAPT_WEIGHT)
#if CONFIG_MOTION_VAR && CONFIG_NCOBMC
......
......@@ -8430,20 +8430,6 @@ static int64_t motion_mode_rd(
#endif // CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
rate2_nocoeff = rd_stats->rate;
#if CONFIG_NCOBMC_ADAPT_WEIGHT
// We cannot estimate the rd cost for the motion mode NCOBMC_ADAPT_WEIGHT
// right now since it requires mvs from all neighboring blocks. We will
// check if this mode is beneficial after all the mv's in the current
// superblock are selected.
last_motion_mode_allowed = motion_mode_allowed_wrapper(1,
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
xd,
#endif
mi);
#else
last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION
0, xd->global_motion,
......@@ -8452,7 +8438,6 @@ static int64_t motion_mode_rd(
xd,
#endif
mi);
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
base_mbmi = *mbmi;
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
......@@ -8470,6 +8455,14 @@ static int64_t motion_mode_rd(
int tmp_rate2 = rate2_nocoeff;
#endif // CONFIG_EXT_INTER
#if CONFIG_NCOBMC_ADAPT_WEIGHT
// We cannot estimate the rd cost for the motion mode NCOBMC_ADAPT_WEIGHT
// right now since it requires mvs from all neighboring blocks. We will
// check if this mode is beneficial after all the mv's in the current
// superblock are selected.
if (motion_mode == NCOBMC_ADAPT_WEIGHT) continue;
#endif
*mbmi = base_mbmi;
mbmi->motion_mode = motion_mode;
#if CONFIG_MOTION_VAR
......
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