Remove ext-warped-motion part2
Part2 of ext-warped-motion experiment was removed.
Change-Id: I1b7aebad1fd7cb60d92c3ce959d5101228addae2
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index a2bcaa6..37b7c5d 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -278,9 +278,6 @@
int wedge_sign;
SEG_MASK_TYPE mask_type;
MOTION_MODE motion_mode;
-#if CONFIG_EXT_WARPED_MOTION
- int wm_ctx;
-#endif // CONFIG_EXT_WARPED_MOTION
int overlappable_neighbors[2];
int_mv mv[2];
int_mv pred_mv[2];
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index f197314..0f30347 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -804,7 +804,6 @@
#endif // CONFIG_EXT_PARTITION
};
-#if !CONFIG_EXT_WARPED_MOTION
static const aom_cdf_prob
default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = {
{ AOM_CDF3(16384, 24576) }, { AOM_CDF3(16384, 24576) },
@@ -825,69 +824,6 @@
{ AOM_CDF3(32256, 32656) }, { AOM_CDF3(32256, 32656) },
#endif
};
-#else
-static const aom_cdf_prob
- default_motion_mode_cdf[MOTION_MODE_CTX][BLOCK_SIZES_ALL][CDF_SIZE(
- MOTION_MODES)] = {
- {
- { AOM_CDF3(16384, 24576) }, { AOM_CDF3(16384, 24576) },
- { AOM_CDF3(16384, 24576) }, { AOM_CDF3(7936, 19091) },
- { AOM_CDF3(4991, 19205) }, { AOM_CDF3(4992, 19314) },
- { AOM_CDF3(15104, 21590) }, { AOM_CDF3(9855, 21043) },
- { AOM_CDF3(12800, 22238) }, { AOM_CDF3(24320, 26498) },
- { AOM_CDF3(26496, 28995) }, { AOM_CDF3(25216, 28166) },
- { AOM_CDF3(30592, 31238) },
-#if CONFIG_EXT_PARTITION
- { AOM_CDF3(32256, 32656) }, { AOM_CDF3(32256, 32656) },
- { AOM_CDF3(32256, 32656) },
-#endif
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
-#if CONFIG_EXT_PARTITION
- { AOM_CDF3(32256, 32656) }, { AOM_CDF3(32256, 32656) },
-#endif
- },
- {
- { AOM_CDF3(16384, 24576) }, { AOM_CDF3(16384, 24576) },
- { AOM_CDF3(16384, 24576) }, { AOM_CDF3(7936, 19091) },
- { AOM_CDF3(4991, 19205) }, { AOM_CDF3(4992, 19314) },
- { AOM_CDF3(15104, 21590) }, { AOM_CDF3(9855, 21043) },
- { AOM_CDF3(12800, 22238) }, { AOM_CDF3(24320, 26498) },
- { AOM_CDF3(26496, 28995) }, { AOM_CDF3(25216, 28166) },
- { AOM_CDF3(30592, 31238) },
-#if CONFIG_EXT_PARTITION
- { AOM_CDF3(32256, 32656) }, { AOM_CDF3(32256, 32656) },
- { AOM_CDF3(32256, 32656) },
-#endif
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
-#if CONFIG_EXT_PARTITION
- { AOM_CDF3(32256, 32656) }, { AOM_CDF3(32256, 32656) },
-#endif
- },
- {
- { AOM_CDF3(16384, 24576) }, { AOM_CDF3(16384, 24576) },
- { AOM_CDF3(16384, 24576) }, { AOM_CDF3(7936, 19091) },
- { AOM_CDF3(4991, 19205) }, { AOM_CDF3(4992, 19314) },
- { AOM_CDF3(15104, 21590) }, { AOM_CDF3(9855, 21043) },
- { AOM_CDF3(12800, 22238) }, { AOM_CDF3(24320, 26498) },
- { AOM_CDF3(26496, 28995) }, { AOM_CDF3(25216, 28166) },
- { AOM_CDF3(30592, 31238) },
-#if CONFIG_EXT_PARTITION
- { AOM_CDF3(32256, 32656) }, { AOM_CDF3(32256, 32656) },
- { AOM_CDF3(32256, 32656) },
-#endif
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
- { AOM_CDF3(32640, 32740) }, { AOM_CDF3(32640, 32740) },
-#if CONFIG_EXT_PARTITION
- { AOM_CDF3(32256, 32656) }, { AOM_CDF3(32256, 32656) },
-#endif
- },
- };
-#endif // CONFIG_EXT_WARPED_MOTION
static const aom_cdf_prob default_obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)] = {
{ AOM_CDF2(128 * 128) }, { AOM_CDF2(128 * 128) }, { AOM_CDF2(128 * 128) },
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 5024034..ba7ac45 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -144,12 +144,7 @@
aom_cdf_prob wedge_interintra_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)];
aom_cdf_prob interintra_mode_cdf[BLOCK_SIZE_GROUPS]
[CDF_SIZE(INTERINTRA_MODES)];
-#if CONFIG_EXT_WARPED_MOTION
- aom_cdf_prob motion_mode_cdf[MOTION_MODE_CTX][BLOCK_SIZES_ALL]
- [CDF_SIZE(MOTION_MODES)];
-#else
aom_cdf_prob motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)];
-#endif // CONFIG_EXT_WARPED_MOTION
aom_cdf_prob obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)];
aom_prob comp_inter_prob[COMP_INTER_CONTEXTS];
aom_cdf_prob palette_y_size_cdf[PALATTE_BSIZE_CTXS][CDF_SIZE(PALETTE_SIZES)];
@@ -308,12 +303,7 @@
#else
unsigned int compound_interinter[BLOCK_SIZES_ALL][COMPOUND_TYPES];
#endif // CONFIG_JNT_COMP
-#if CONFIG_EXT_WARPED_MOTION
- unsigned int motion_mode[MOTION_MODE_CTX][BLOCK_SIZES_ALL][MOTION_MODES];
-#else
unsigned int motion_mode[BLOCK_SIZES_ALL][MOTION_MODES];
-#endif // CONFIG_EXT_WARPED_MOTION
-
unsigned int obmc[BLOCK_SIZES_ALL][2];
unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
diff --git a/av1/common/enums.h b/av1/common/enums.h
index d8bf048..dcf4038 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -515,10 +515,6 @@
MOTION_MODES
} MOTION_MODE;
-#if CONFIG_EXT_WARPED_MOTION
-#define MOTION_MODE_CTX 3
-#endif // CONFIG_EXT_WARPED_MOTION
-
typedef enum ATTRIBUTE_PACKED {
II_DC_PRED,
II_V_PRED,
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 8089148..efc27a5 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -72,12 +72,12 @@
#if USE_CUR_GM_REFMV
int_mv *gm_mv_candidates, const WarpedMotionParams *gm_params,
#endif // USE_CUR_GM_REFMV
- int col, int weight,
+ int col, int weight
#if CONFIG_AMVR
- int is_integer,
+ ,
+ int is_integer
#endif
- BLOCK_SIZE bsize, int mi_row, int mi_col, int subsampling_x,
- int subsampling_y, int do_warping) {
+ ) {
#if CONFIG_INTRABC
if (!is_inter_block(candidate)) return 0;
#endif // CONFIG_INTRABC
@@ -85,74 +85,23 @@
int newmv_count = 0;
assert(weight % 2 == 0);
(void)ref_match_count;
-#if !CONFIG_EXT_WARPED_MOTION
- (void)bsize;
- (void)mi_row;
- (void)mi_col;
- (void)subsampling_x;
- (void)subsampling_y;
- (void)do_warping;
-#endif // CONFIG_EXT_WARPED_MOTION
if (rf[1] == NONE_FRAME) {
// single reference frame
for (ref = 0; ref < 2; ++ref) {
if (candidate->ref_frame[ref] == rf[0]) {
int_mv this_refmv;
-#if CONFIG_EXT_WARPED_MOTION
- if (candidate->motion_mode == WARPED_CAUSAL && do_warping) {
- const WarpedMotionParams wm = candidate->wm_params[0];
- const int bw = block_size_wide[bsize];
- const int bh = block_size_high[bsize];
- int global_offset_c = mi_col * MI_SIZE;
- int global_offset_r = mi_row * MI_SIZE;
- int cc_offset = bw / 2 - 1;
- int cr_offset = bh / 2 - 1;
- int xc0 = cc_offset + global_offset_c;
- int yc0 = cr_offset + global_offset_r;
- int xc1 = xc0 + 1;
- int yc1 = yc0 + 1;
- int in[4] = { xc0, yc0, xc1, yc1 };
- int out[4] = { 0, 0, 0, 0 };
-
- assert(ref == 0);
- // For WARPED_CAUSAL, wmtype is always AFFINE.
- assert(wm.wmtype == AFFINE);
- project_points_affine(wm.wmmat, in, out, 2, 2, 2, subsampling_x,
- subsampling_y);
-
- // assert(x_scale == 1024 && y_scale == 1024);
- // out[]'s precision is 1/64, adjust xc, yc accordingly.
- out[0] -= (xc0 << (3 + SCALING_FCT));
- out[1] -= (yc0 << (3 + SCALING_FCT));
- out[2] -= (xc1 << (3 + SCALING_FCT));
- out[3] -= (yc1 << (3 + SCALING_FCT));
-
- this_refmv.as_mv.col =
- ROUND_POWER_OF_TWO_SIGNED(out[0] + out[2], SCALING_FCT + 1);
- this_refmv.as_mv.row =
- ROUND_POWER_OF_TWO_SIGNED(out[1] + out[3], SCALING_FCT + 1);
-#if CONFIG_AMVR
- lower_mv_precision(&this_refmv.as_mv, use_hp, is_integer);
-#else
- lower_mv_precision(&this_refmv.as_mv, use_hp);
-#endif
- } else {
-#endif // CONFIG_EXT_WARPED_MOTION
#if USE_CUR_GM_REFMV
- if (is_global_mv_block(candidate_mi, gm_params[rf[0]].wmtype))
- this_refmv = gm_mv_candidates[0];
- else
+ if (is_global_mv_block(candidate_mi, gm_params[rf[0]].wmtype))
+ this_refmv = gm_mv_candidates[0];
+ else
#endif // USE_CUR_GM_REFMV
- this_refmv = get_sub_block_mv(candidate_mi, ref, col);
+ this_refmv = get_sub_block_mv(candidate_mi, ref, col);
#if CONFIG_AMVR
- lower_mv_precision(&this_refmv.as_mv, use_hp, is_integer);
+ lower_mv_precision(&this_refmv.as_mv, use_hp, is_integer);
#else
lower_mv_precision(&this_refmv.as_mv, use_hp);
#endif // CONFIG_AMVR
-#if CONFIG_EXT_WARPED_MOTION
- }
-#endif // CONFIG_EXT_WARPED_MOTION
for (index = 0; index < *refmv_count; ++index)
if (ref_mv_stack[index].this_mv.as_int == this_refmv.as_int) break;
@@ -250,7 +199,7 @@
}
const int use_step_16 = (xd->n8_w >= 16);
MODE_INFO **const candidate_mi0 = xd->mi + row_offset * xd->mi_stride;
- const int do_warping = (row_offset == -1);
+ (void)mi_row;
for (i = 0; i < end_mi;) {
const MODE_INFO *const candidate_mi = candidate_mi0[col_offset + i];
@@ -280,9 +229,7 @@
#if USE_CUR_GM_REFMV
gm_mv_candidates, cm->global_motion,
#endif // USE_CUR_GM_REFMV
- col_offset + i, weight, cm->cur_frame_force_integer_mv,
- xd->mi[0]->mbmi.sb_type, mi_row, mi_col, xd->plane[0].subsampling_x,
- xd->plane[0].subsampling_y, do_warping);
+ col_offset + i, weight, cm->cur_frame_force_integer_mv);
#else
newmv_count += add_ref_mv_candidate(
candidate_mi, candidate, rf, refmv_count, ref_match_count, ref_mv_stack,
@@ -290,8 +237,7 @@
#if USE_CUR_GM_REFMV
gm_mv_candidates, cm->global_motion,
#endif // USE_CUR_GM_REFMV
- col_offset + i, weight, xd->mi[0]->mbmi.sb_type, mi_row, mi_col,
- xd->plane[0].subsampling_x, xd->plane[0].subsampling_y, do_warping);
+ col_offset + i, weight);
#endif
i += len;
@@ -321,7 +267,7 @@
if (mi_row & 0x01 && xd->n8_h < n8_h_8) --row_offset;
}
const int use_step_16 = (xd->n8_h >= 16);
- const int do_warping = (col_offset == -1);
+ (void)mi_col;
for (i = 0; i < end_mi;) {
const MODE_INFO *const candidate_mi =
@@ -352,9 +298,7 @@
#if USE_CUR_GM_REFMV
gm_mv_candidates, cm->global_motion,
#endif // USE_CUR_GM_REFMV
- col_offset, weight, cm->cur_frame_force_integer_mv,
- xd->mi[0]->mbmi.sb_type, mi_row, mi_col, xd->plane[0].subsampling_x,
- xd->plane[0].subsampling_y, do_warping);
+ col_offset, weight, cm->cur_frame_force_integer_mv);
#else
newmv_count += add_ref_mv_candidate(
candidate_mi, candidate, rf, refmv_count, ref_match_count, ref_mv_stack,
@@ -362,8 +306,7 @@
#if USE_CUR_GM_REFMV
gm_mv_candidates, cm->global_motion,
#endif // USE_CUR_GM_REFMV
- col_offset, weight, xd->mi[0]->mbmi.sb_type, mi_row, mi_col,
- xd->plane[0].subsampling_x, xd->plane[0].subsampling_y, do_warping);
+ col_offset, weight);
#endif
i += len;
}
@@ -383,7 +326,6 @@
const TileInfo *const tile = &xd->tile;
POSITION mi_pos;
uint8_t newmv_count = 0;
- const int do_warping = 1;
mi_pos.row = row_offset;
mi_pos.col = col_offset;
@@ -401,9 +343,7 @@
#if USE_CUR_GM_REFMV
gm_mv_candidates, cm->global_motion,
#endif // USE_CUR_GM_REFMV
- mi_pos.col, 2, cm->cur_frame_force_integer_mv, xd->mi[0]->mbmi.sb_type,
- mi_row, mi_col, xd->plane[0].subsampling_x, xd->plane[0].subsampling_y,
- do_warping);
+ mi_pos.col, 2, cm->cur_frame_force_integer_mv);
#else
newmv_count += add_ref_mv_candidate(
candidate_mi, candidate, rf, refmv_count, ref_match_count, ref_mv_stack,
@@ -411,8 +351,7 @@
#if USE_CUR_GM_REFMV
gm_mv_candidates, cm->global_motion,
#endif // USE_CUR_GM_REFMV
- mi_pos.col, 2, xd->mi[0]->mbmi.sb_type, mi_row, mi_col,
- xd->plane[0].subsampling_x, xd->plane[0].subsampling_y, do_warping);
+ mi_pos.col, 2);
#endif
} // Analyze a single 8x8 block motion information.
@@ -1730,7 +1669,7 @@
// Note: Samples returned are at 1/8-pel precision
int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
- int *pts, int *pts_inref, int *pts_mv, int *pts_wm) {
+ int *pts, int *pts_inref, int *pts_mv) {
MB_MODE_INFO *const mbmi0 = &(xd->mi[0]->mbmi);
int ref_frame = mbmi0->ref_frame[0];
int up_available = xd->up_available;
@@ -1760,11 +1699,6 @@
if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r,
global_offset_c, 0, -1, col_offset, 1);
- pts_wm[0] = mi_row_offset * xd->mi_stride;
- pts_wm[1] = (mbmi->motion_mode == WARPED_CAUSAL)
- ? (n8_w * mi_size_high[mbmi->sb_type])
- : 0;
- pts_wm += 2;
pts += 2;
pts_inref += 2;
pts_mv += 2;
@@ -1784,11 +1718,6 @@
mbmi->ref_frame[1] == NONE_FRAME) {
record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r,
global_offset_c, 0, -1, i, 1);
- pts_wm[0] = mi_col_offset + mi_row_offset * xd->mi_stride;
- pts_wm[1] = (mbmi->motion_mode == WARPED_CAUSAL)
- ? (n8_w * mi_size_high[mbmi->sb_type])
- : 0;
- pts_wm += 2;
pts += 2;
pts_inref += 2;
pts_mv += 2;
@@ -1817,11 +1746,6 @@
if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r,
global_offset_c, row_offset, 1, 0, -1);
- pts_wm[0] = mi_col_offset;
- pts_wm[1] = (mbmi->motion_mode == WARPED_CAUSAL)
- ? (n8_h * mi_size_wide[mbmi->sb_type])
- : 0;
- pts_wm += 2;
pts += 2;
pts_inref += 2;
pts_mv += 2;
@@ -1841,11 +1765,6 @@
mbmi->ref_frame[1] == NONE_FRAME) {
record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r,
global_offset_c, i, 1, 0, -1);
- pts_wm[0] = mi_col_offset + mi_row_offset * xd->mi_stride;
- pts_wm[1] = (mbmi->motion_mode == WARPED_CAUSAL)
- ? (n8_h * mi_size_wide[mbmi->sb_type])
- : 0;
- pts_wm += 2;
pts += 2;
pts_inref += 2;
pts_mv += 2;
@@ -1868,12 +1787,6 @@
if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r,
global_offset_c, 0, -1, 0, -1);
- pts_wm[0] = mi_col_offset + mi_row_offset * xd->mi_stride;
- pts_wm[1] =
- (mbmi->motion_mode == WARPED_CAUSAL)
- ? (mi_size_wide[mbmi->sb_type] * mi_size_high[mbmi->sb_type])
- : 0;
- pts_wm += 2;
pts += 2;
pts_inref += 2;
pts_mv += 2;
@@ -1898,11 +1811,6 @@
if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) {
record_samples(mbmi, pts, pts_inref, pts_mv, global_offset_r,
global_offset_c, 0, -1, xd->n8_w, 1);
- pts_wm[0] = mi_col_offset + mi_row_offset * xd->mi_stride;
- pts_wm[1] =
- (mbmi->motion_mode == WARPED_CAUSAL)
- ? (mi_size_wide[mbmi->sb_type] * mi_size_high[mbmi->sb_type])
- : 0;
np++;
if (np >= SAMPLES_MAX) return SAMPLES_MAX;
}
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h
index 9cf5d81..26b7c50 100644
--- a/av1/common/mvref_common.h
+++ b/av1/common/mvref_common.h
@@ -444,7 +444,7 @@
#if CONFIG_EXT_WARPED_MOTION
int sortSamples(int *pts_mv, MV *mv, int *pts, int *pts_inref, int len);
int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
- int *pts, int *pts_inref, int *pts_mv, int *pts_wm);
+ int *pts, int *pts_inref, int *pts_mv);
#else
int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
int *pts, int *pts_inref);
diff --git a/av1/common/warped_motion.h b/av1/common/warped_motion.h
index 2432bfc..c200300 100644
--- a/av1/common/warped_motion.h
+++ b/av1/common/warped_motion.h
@@ -36,8 +36,6 @@
// Here force number of samples within SAMPLES_MAX.
#define SAMPLES_MAX (LEAST_SQUARES_SAMPLES_MAX * 2)
#define SAMPLES_ARRAY_SIZE (SAMPLES_MAX * 2)
-
-#define SCALING_FCT 3
#else
#define SAMPLES_ARRAY_SIZE (LEAST_SQUARES_SAMPLES_MAX * 2)
#endif // CONFIG_EXT_WARPED_MOTION
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index d91da5b..21c082e 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -280,13 +280,8 @@
}
}
-#if CONFIG_EXT_WARPED_MOTION
-static MOTION_MODE read_motion_mode(MACROBLOCKD *xd, MODE_INFO *mi,
- aom_reader *r, int best) {
-#else
static MOTION_MODE read_motion_mode(MACROBLOCKD *xd, MODE_INFO *mi,
aom_reader *r) {
-#endif // CONFIG_EXT_WARPED_MOTION
MB_MODE_INFO *mbmi = &mi->mbmi;
#if CONFIG_EXT_SKIP
@@ -306,24 +301,10 @@
if (counts) ++counts->obmc[mbmi->sb_type][motion_mode];
return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
} else {
-#if CONFIG_EXT_WARPED_MOTION
- int wm_ctx = 0;
- if (best != -1) {
- wm_ctx = 1;
- if (mbmi->mode == NEARESTMV) wm_ctx = 2;
- }
-
- motion_mode =
- aom_read_symbol(r, xd->tile_ctx->motion_mode_cdf[wm_ctx][mbmi->sb_type],
- MOTION_MODES, ACCT_STR);
- if (counts) ++counts->motion_mode[wm_ctx][mbmi->sb_type][motion_mode];
-#else
motion_mode =
aom_read_symbol(r, xd->tile_ctx->motion_mode_cdf[mbmi->sb_type],
MOTION_MODES, ACCT_STR);
if (counts) ++counts->motion_mode[mbmi->sb_type][motion_mode];
-#endif // CONFIG_EXT_WARPED_MOTION
-
return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
}
}
@@ -1846,7 +1827,7 @@
int16_t compound_inter_mode_ctx[MODE_CTX_REF_FRAMES];
int pts[SAMPLES_ARRAY_SIZE], pts_inref[SAMPLES_ARRAY_SIZE];
#if CONFIG_EXT_WARPED_MOTION
- int pts_mv[SAMPLES_ARRAY_SIZE], pts_wm[SAMPLES_ARRAY_SIZE];
+ int pts_mv[SAMPLES_ARRAY_SIZE];
#endif // CONFIG_EXT_WARPED_MOTION
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
@@ -2136,9 +2117,6 @@
xd->block_refs[ref] = ref_buf;
}
-#if CONFIG_EXT_WARPED_MOTION
- int best_cand = -1;
-#endif // CONFIG_EXT_WARPED_MOTION
mbmi->motion_mode = SIMPLE_TRANSLATION;
if (mbmi->sb_type >= BLOCK_8X8 &&
#if CONFIG_EXT_SKIP
@@ -2146,32 +2124,15 @@
#endif // CONFIG_EXT_SKIP
!has_second_ref(mbmi))
#if CONFIG_EXT_WARPED_MOTION
- {
mbmi->num_proj_ref[0] =
- findSamples(cm, xd, mi_row, mi_col, pts, pts_inref, pts_mv, pts_wm);
-
- // Find a warped neighbor.
- int best_weight = 0;
-
- // if (mbmi->mode == NEARESTMV)
- for (int cand = 0; cand < mbmi->num_proj_ref[0]; cand++) {
- if (pts_wm[cand * 2 + 1] > best_weight) {
- best_weight = pts_wm[cand * 2 + 1];
- best_cand = cand;
- }
- }
- }
+ findSamples(cm, xd, mi_row, mi_col, pts, pts_inref, pts_mv);
#else
mbmi->num_proj_ref[0] = findSamples(cm, xd, mi_row, mi_col, pts, pts_inref);
#endif // CONFIG_EXT_WARPED_MOTION
av1_count_overlappable_neighbors(cm, xd, mi_row, mi_col);
if (mbmi->ref_frame[1] != INTRA_FRAME)
-#if CONFIG_EXT_WARPED_MOTION
- mbmi->motion_mode = read_motion_mode(xd, mi, r, best_cand);
-#else
mbmi->motion_mode = read_motion_mode(xd, mi, r);
-#endif // CONFIG_EXT_WARPED_MOTION
#if CONFIG_JNT_COMP
// init
@@ -2273,27 +2234,19 @@
mbmi->wm_params[0].wmtype = DEFAULT_WMTYPE;
#if CONFIG_EXT_WARPED_MOTION
- if (mbmi->mode == NEARESTMV && best_cand != -1) {
- MODE_INFO *best_mi = xd->mi[pts_wm[2 * best_cand]];
- assert(best_mi->mbmi.motion_mode == WARPED_CAUSAL);
- mbmi->wm_params[0] = best_mi->mbmi.wm_params[0];
- } else {
- if (mbmi->num_proj_ref[0] > 1)
- mbmi->num_proj_ref[0] = sortSamples(pts_mv, &mbmi->mv[0].as_mv, pts,
- pts_inref, mbmi->num_proj_ref[0]);
+ if (mbmi->num_proj_ref[0] > 1)
+ mbmi->num_proj_ref[0] = sortSamples(pts_mv, &mbmi->mv[0].as_mv, pts,
+ pts_inref, mbmi->num_proj_ref[0]);
#endif // CONFIG_EXT_WARPED_MOTION
- if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
- mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
- &mbmi->wm_params[0], mi_row, mi_col)) {
+ if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
+ mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
+ &mbmi->wm_params[0], mi_row, mi_col)) {
#if WARPED_MOTION_DEBUG
- printf("Warning: unexpected warped model from aomenc\n");
+ printf("Warning: unexpected warped model from aomenc\n");
#endif
- mbmi->wm_params[0].invalid = 1;
- }
-#if CONFIG_EXT_WARPED_MOTION
+ mbmi->wm_params[0].invalid = 1;
}
-#endif // CONFIG_EXT_WARPED_MOTION
}
#if DEC_MISMATCH_DEBUG
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 9c83c26..beeb30d 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -306,22 +306,9 @@
xd->tile_ctx->obmc_cdf[mbmi->sb_type], 2);
break;
default:
-#if CONFIG_EXT_WARPED_MOTION
- {
- int wm_ctx = 0;
- if (mbmi->wm_ctx != -1) {
- wm_ctx = 1;
- if (mbmi->mode == NEARESTMV) wm_ctx = 2;
- }
- aom_write_symbol(w, mbmi->motion_mode,
- xd->tile_ctx->motion_mode_cdf[wm_ctx][mbmi->sb_type],
- MOTION_MODES);
- }
-#else
aom_write_symbol(w, mbmi->motion_mode,
xd->tile_ctx->motion_mode_cdf[mbmi->sb_type],
MOTION_MODES);
-#endif // CONFIG_EXT_WARPED_MOTION
}
}
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index 1e83ad6..ae80ce0 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -287,11 +287,7 @@
int interintra_cost[BLOCK_SIZE_GROUPS][2];
int wedge_interintra_cost[BLOCK_SIZES_ALL][2];
int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
-#if CONFIG_EXT_WARPED_MOTION
- int motion_mode_cost[MOTION_MODE_CTX][BLOCK_SIZES_ALL][MOTION_MODES];
-#else
int motion_mode_cost[BLOCK_SIZES_ALL][MOTION_MODES];
-#endif // CONFIG_EXT_WARPED_MOTION
int motion_mode_cost1[BLOCK_SIZES_ALL][2];
int intra_uv_mode_cost[INTRA_MODES][UV_INTRA_MODES];
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 73e326b..a918abc 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1002,23 +1002,10 @@
motion_mode_allowed(xd->global_motion, xd, mi);
if (mbmi->ref_frame[1] != INTRA_FRAME) {
if (motion_allowed == WARPED_CAUSAL) {
-#if CONFIG_EXT_WARPED_MOTION
- int wm_ctx = 0;
- if (mbmi->wm_ctx != -1) {
- wm_ctx = 1;
- if (mbmi->mode == NEARESTMV) wm_ctx = 2;
- }
-
- counts->motion_mode[wm_ctx][bsize][mbmi->motion_mode]++;
- if (allow_update_cdf)
- update_cdf(fc->motion_mode_cdf[wm_ctx][bsize], mbmi->motion_mode,
- MOTION_MODES);
-#else
counts->motion_mode[bsize][mbmi->motion_mode]++;
if (allow_update_cdf)
update_cdf(fc->motion_mode_cdf[bsize], mbmi->motion_mode,
MOTION_MODES);
-#endif // CONFIG_EXT_WARPED_MOTION
} else if (motion_allowed == OBMC_CAUSAL) {
counts->obmc[bsize][mbmi->motion_mode == OBMC_CAUSAL]++;
if (allow_update_cdf)
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 601d1b6..7580bd0 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -262,20 +262,10 @@
av1_cost_tokens_from_cdf(x->wedge_interintra_cost[i],
fc->wedge_interintra_cdf[i], NULL);
}
-#if CONFIG_EXT_WARPED_MOTION
- for (i = 0; i < MOTION_MODE_CTX; i++) {
- for (j = BLOCK_8X8; j < BLOCK_SIZES_ALL; j++) {
- av1_cost_tokens_from_cdf(x->motion_mode_cost[i][j],
- fc->motion_mode_cdf[i][j], NULL);
- }
- }
-#else
for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
av1_cost_tokens_from_cdf(x->motion_mode_cost[i], fc->motion_mode_cdf[i],
NULL);
}
-#endif // CONFIG_EXT_WARPED_MOTION
-
for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
av1_cost_tokens_from_cdf(x->motion_mode_cost1[i], fc->obmc_cdf[i], NULL);
}
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 3756f44..c7713d8 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -7644,39 +7644,6 @@
}
#endif
-#if CONFIG_EXT_WARPED_MOTION
-static int handle_zero_mv(const AV1_COMMON *const cm, MACROBLOCK *const x,
- BLOCK_SIZE bsize, int mi_col, int mi_row) {
- MACROBLOCKD *xd = &x->e_mbd;
- MODE_INFO *mi = xd->mi[0];
- MB_MODE_INFO *mbmi = &mi->mbmi;
- int skip = 0;
-
- // Handle the special case of 0 MV.
- if (mbmi->ref_frame[0] > INTRA_FRAME && mbmi->ref_frame[1] <= INTRA_FRAME) {
- int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
- int16_t mode_ctx = x->mbmi_ext->mode_context[ref_frame_type];
- if (mode_ctx & (1 << ALL_ZERO_FLAG_OFFSET)) {
- int_mv zeromv;
- const MV_REFERENCE_FRAME ref = mbmi->ref_frame[0];
- zeromv.as_int = gm_get_motion_vector(&cm->global_motion[ref],
- cm->allow_high_precision_mv, bsize,
- mi_col, mi_row
-#if CONFIG_AMVR
- ,
- cm->cur_frame_force_integer_mv
-#endif
- )
- .as_int;
- if (mbmi->mv[0].as_int == zeromv.as_int && mbmi->mode != GLOBALMV) {
- skip = 1;
- }
- }
- }
- return skip;
-}
-#endif // CONFIG_EXT_WARPED_MOTION
-
// TODO(afergs): Refactor the MBMI references in here - there's four
// TODO(afergs): Refactor optional args - add them to a struct or remove
static int64_t motion_mode_rd(
@@ -7713,9 +7680,8 @@
#if CONFIG_EXT_WARPED_MOTION
int pts0[SAMPLES_ARRAY_SIZE], pts_inref0[SAMPLES_ARRAY_SIZE];
- int pts_mv0[SAMPLES_ARRAY_SIZE], pts_wm[SAMPLES_ARRAY_SIZE];
+ int pts_mv0[SAMPLES_ARRAY_SIZE];
int total_samples;
- int best_cand = -1;
#else
int pts[SAMPLES_ARRAY_SIZE], pts_inref[SAMPLES_ARRAY_SIZE];
#endif // CONFIG_EXT_WARPED_MOTION
@@ -7726,22 +7692,8 @@
aom_clear_system_state();
#if CONFIG_EXT_WARPED_MOTION
mbmi->num_proj_ref[0] =
- findSamples(cm, xd, mi_row, mi_col, pts0, pts_inref0, pts_mv0, pts_wm);
+ findSamples(cm, xd, mi_row, mi_col, pts0, pts_inref0, pts_mv0);
total_samples = mbmi->num_proj_ref[0];
-
- // Find a warped neighbor.
- int cand;
- int best_weight = 0;
-
- // if (this_mode == NEARESTMV)
- for (cand = 0; cand < mbmi->num_proj_ref[0]; cand++) {
- if (pts_wm[cand * 2 + 1] > best_weight) {
- best_weight = pts_wm[cand * 2 + 1];
- best_cand = cand;
- }
- }
- mbmi->wm_ctx = best_cand;
- best_bmc_mbmi->wm_ctx = mbmi->wm_ctx;
#else
mbmi->num_proj_ref[0] = findSamples(cm, xd, mi_row, mi_col, pts, pts_inref);
#endif // CONFIG_EXT_WARPED_MOTION
@@ -7800,97 +7752,77 @@
av1_unswitchable_filter(cm->interp_filter));
#if CONFIG_EXT_WARPED_MOTION
- if (this_mode == NEARESTMV && best_cand != -1) {
- MODE_INFO *best_mi = xd->mi[pts_wm[2 * best_cand]];
- assert(best_mi->mbmi.motion_mode == WARPED_CAUSAL);
- mbmi->wm_params[0] = best_mi->mbmi.wm_params[0];
-
- // Handle the special case of 0 MV.
- if (handle_zero_mv(cm, x, bsize, mi_col, mi_row)) continue;
-
- av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
- model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
- &tmp_dist, skip_txfm_sb, skip_sse_sb);
- } else {
- memcpy(pts, pts0, total_samples * 2 * sizeof(*pts0));
- memcpy(pts_inref, pts_inref0, total_samples * 2 * sizeof(*pts_inref0));
- // Rank the samples by motion vector difference
- if (mbmi->num_proj_ref[0] > 1) {
- mbmi->num_proj_ref[0] = sortSamples(pts_mv0, &mbmi->mv[0].as_mv, pts,
- pts_inref, mbmi->num_proj_ref[0]);
- best_bmc_mbmi->num_proj_ref[0] = mbmi->num_proj_ref[0];
- }
+ memcpy(pts, pts0, total_samples * 2 * sizeof(*pts0));
+ memcpy(pts_inref, pts_inref0, total_samples * 2 * sizeof(*pts_inref0));
+ // Rank the samples by motion vector difference
+ if (mbmi->num_proj_ref[0] > 1) {
+ mbmi->num_proj_ref[0] = sortSamples(pts_mv0, &mbmi->mv[0].as_mv, pts,
+ pts_inref, mbmi->num_proj_ref[0]);
+ best_bmc_mbmi->num_proj_ref[0] = mbmi->num_proj_ref[0];
+ }
#endif // CONFIG_EXT_WARPED_MOTION
- if (!find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
- mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
- &mbmi->wm_params[0], mi_row, mi_col)) {
- // Refine MV for NEWMV mode
- if (!is_comp_pred && have_newmv_in_inter_mode(this_mode)) {
- int tmp_rate_mv = 0;
- const int_mv mv0 = mbmi->mv[0];
- const WarpedMotionParams wm_params0 = mbmi->wm_params[0];
+ if (!find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
+ mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
+ &mbmi->wm_params[0], mi_row, mi_col)) {
+ // Refine MV for NEWMV mode
+ if (!is_comp_pred && have_newmv_in_inter_mode(this_mode)) {
+ int tmp_rate_mv = 0;
+ const int_mv mv0 = mbmi->mv[0];
+ const WarpedMotionParams wm_params0 = mbmi->wm_params[0];
#if CONFIG_EXT_WARPED_MOTION
- int num_proj_ref0 = mbmi->num_proj_ref[0];
+ int num_proj_ref0 = mbmi->num_proj_ref[0];
- // Refine MV in a small range.
- av1_refine_warped_mv(cpi, x, bsize, mi_row, mi_col, pts0,
- pts_inref0, pts_mv0, total_samples);
+ // Refine MV in a small range.
+ av1_refine_warped_mv(cpi, x, bsize, mi_row, mi_col, pts0, pts_inref0,
+ pts_mv0, total_samples);
#else
// Refine MV in a small range.
av1_refine_warped_mv(cpi, x, bsize, mi_row, mi_col, pts, pts_inref);
#endif // CONFIG_EXT_WARPED_MOTION
- // Keep the refined MV and WM parameters.
- if (mv0.as_int != mbmi->mv[0].as_int) {
- const int ref = refs[0];
- const MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
+ // Keep the refined MV and WM parameters.
+ if (mv0.as_int != mbmi->mv[0].as_int) {
+ const int ref = refs[0];
+ const MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
- tmp_rate_mv =
- av1_mv_bit_cost(&mbmi->mv[0].as_mv, &ref_mv, x->nmvjointcost,
- x->mvcost, MV_COST_WEIGHT);
+ tmp_rate_mv =
+ av1_mv_bit_cost(&mbmi->mv[0].as_mv, &ref_mv, x->nmvjointcost,
+ x->mvcost, MV_COST_WEIGHT);
- if (cpi->sf.adaptive_motion_search)
- x->pred_mv[ref] = mbmi->mv[0].as_mv;
+ if (cpi->sf.adaptive_motion_search)
+ x->pred_mv[ref] = mbmi->mv[0].as_mv;
- single_newmv[ref] = mbmi->mv[0];
+ single_newmv[ref] = mbmi->mv[0];
- if (discount_newmv_test(cpi, this_mode, mbmi->mv[0], mode_mv,
- refs[0])) {
- tmp_rate_mv = AOMMAX((tmp_rate_mv / NEW_MV_DISCOUNT_FACTOR), 1);
- }
-#if CONFIG_EXT_WARPED_MOTION
- best_bmc_mbmi->num_proj_ref[0] = mbmi->num_proj_ref[0];
-#endif // CONFIG_EXT_WARPED_MOTION
- tmp_rate2 = rate2_bmc_nocoeff - rate_mv_bmc + tmp_rate_mv;
-#if CONFIG_DUAL_FILTER
- mbmi->interp_filters =
- condition_interp_filters_on_mv(mbmi->interp_filters, xd);
-#endif // CONFIG_DUAL_FILTER
- } else {
- // Restore the old MV and WM parameters.
- mbmi->mv[0] = mv0;
- mbmi->wm_params[0] = wm_params0;
-#if CONFIG_EXT_WARPED_MOTION
- mbmi->num_proj_ref[0] = num_proj_ref0;
-#endif // CONFIG_EXT_WARPED_MOTION
+ if (discount_newmv_test(cpi, this_mode, mbmi->mv[0], mode_mv,
+ refs[0])) {
+ tmp_rate_mv = AOMMAX((tmp_rate_mv / NEW_MV_DISCOUNT_FACTOR), 1);
}
+#if CONFIG_EXT_WARPED_MOTION
+ best_bmc_mbmi->num_proj_ref[0] = mbmi->num_proj_ref[0];
+#endif // CONFIG_EXT_WARPED_MOTION
+ tmp_rate2 = rate2_bmc_nocoeff - rate_mv_bmc + tmp_rate_mv;
+#if CONFIG_DUAL_FILTER
+ mbmi->interp_filters =
+ condition_interp_filters_on_mv(mbmi->interp_filters, xd);
+#endif // CONFIG_DUAL_FILTER
+ } else {
+ // Restore the old MV and WM parameters.
+ mbmi->mv[0] = mv0;
+ mbmi->wm_params[0] = wm_params0;
+#if CONFIG_EXT_WARPED_MOTION
+ mbmi->num_proj_ref[0] = num_proj_ref0;
+#endif // CONFIG_EXT_WARPED_MOTION
}
-
-#if CONFIG_EXT_WARPED_MOTION
- // Handle the special case of 0 MV.
- if (handle_zero_mv(cm, x, bsize, mi_col, mi_row)) continue;
-#endif // CONFIG_EXT_WARPED_MOTION
-
- av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
- model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
- &tmp_dist, skip_txfm_sb, skip_sse_sb);
- } else {
- continue;
}
-#if CONFIG_EXT_WARPED_MOTION
+
+ av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
+ model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
+ &tmp_dist, skip_txfm_sb, skip_sse_sb);
+ } else {
+ continue;
}
-#endif // CONFIG_EXT_WARPED_MOTION
}
x->skip = 0;
@@ -7900,17 +7832,7 @@
rd_stats->rate = tmp_rate2;
if (last_motion_mode_allowed > SIMPLE_TRANSLATION) {
if (last_motion_mode_allowed == WARPED_CAUSAL) {
-#if CONFIG_EXT_WARPED_MOTION
- int wm_ctx = 0;
- if (mbmi->wm_ctx != -1) {
- wm_ctx = 1;
- if (mbmi->mode == NEARESTMV) wm_ctx = 2;
- }
-
- rd_stats->rate += x->motion_mode_cost[wm_ctx][bsize][mbmi->motion_mode];
-#else
rd_stats->rate += x->motion_mode_cost[bsize][mbmi->motion_mode];
-#endif // CONFIG_EXT_WARPED_MOTION
} else {
rd_stats->rate += x->motion_mode_cost1[bsize][mbmi->motion_mode];
}
@@ -10738,11 +10660,7 @@
// Therefore, sometimes, NEWMV is chosen instead of NEARESTMV, NEARMV, and
// GLOBALMV. Here, checks are added for those cases, and the mode decisions
// are corrected.
- if ((best_mbmode.mode == NEWMV || best_mbmode.mode == NEW_NEWMV)
-#if CONFIG_EXT_WARPED_MOTION
- && best_mbmode.motion_mode != WARPED_CAUSAL
-#endif // CONFIG_EXT_WARPED_MOTION
- ) {
+ if (best_mbmode.mode == NEWMV || best_mbmode.mode == NEW_NEWMV) {
const MV_REFERENCE_FRAME refs[2] = { best_mbmode.ref_frame[0],
best_mbmode.ref_frame[1] };
int comp_pred_mode = refs[1] > INTRA_FRAME;
@@ -10842,9 +10760,6 @@
if (best_mbmode.ref_frame[0] > INTRA_FRAME &&
best_mbmode.ref_frame[1] <= INTRA_FRAME
-#if CONFIG_EXT_WARPED_MOTION
- && best_mbmode.motion_mode != WARPED_CAUSAL
-#endif // CONFIG_EXT_WARPED_MOTION
#if CONFIG_EXT_SKIP
&& !best_mbmode.skip_mode
#endif // CONFIG_EXT_SKIP
@@ -11009,9 +10924,9 @@
if (is_motion_variation_allowed_bsize(bsize) && !has_second_ref(mbmi)) {
int pts[SAMPLES_ARRAY_SIZE], pts_inref[SAMPLES_ARRAY_SIZE];
#if CONFIG_EXT_WARPED_MOTION
- int pts_mv[SAMPLES_ARRAY_SIZE], pts_wm[SAMPLES_ARRAY_SIZE];
+ int pts_mv[SAMPLES_ARRAY_SIZE];
mbmi->num_proj_ref[0] =
- findSamples(cm, xd, mi_row, mi_col, pts, pts_inref, pts_mv, pts_wm);
+ findSamples(cm, xd, mi_row, mi_col, pts, pts_inref, pts_mv);
// Rank the samples by motion vector difference
if (mbmi->num_proj_ref[0] > 1)
mbmi->num_proj_ref[0] = sortSamples(pts_mv, &mbmi->mv[0].as_mv, pts,