Clean-up gm_disable_recode speed feature
Global motion recode was always disabled and this speed
feature was unused, so cleaned up.
Change-Id: I79308d6d7e1db41dce9ae94e33e2fedd3607ccb3
diff --git a/av1/encoder/encodeframe_utils.c b/av1/encoder/encodeframe_utils.c
index a65c36e..7223e7d 100644
--- a/av1/encoder/encodeframe_utils.c
+++ b/av1/encoder/encodeframe_utils.c
@@ -316,12 +316,6 @@
}
#endif
if (!frame_is_intra_only(cm)) {
- if (is_inter_block(mi_addr)) {
- // TODO(sarahparker): global motion stats need to be handled per-tile
- // to be compatible with tile-based threading.
- update_global_motion_used(mi_addr->mode, bsize, mi_addr, rdc);
- }
-
if (cm->features.interp_filter == SWITCHABLE &&
mi_addr->motion_mode != WARPED_CAUSAL &&
!is_nontrans_global_motion(xd, xd->mi[0])) {
diff --git a/av1/encoder/encodeframe_utils.h b/av1/encoder/encodeframe_utils.h
index 462dd7e..4c193a5 100644
--- a/av1/encoder/encodeframe_utils.h
+++ b/av1/encoder/encodeframe_utils.h
@@ -173,19 +173,6 @@
#endif // CONFIG_COLLECT_PARTITION_STATS
} PartitionSearchState;
-static AOM_INLINE void update_global_motion_used(PREDICTION_MODE mode,
- BLOCK_SIZE bsize,
- const MB_MODE_INFO *mbmi,
- RD_COUNTS *rdc) {
- if (mode == GLOBALMV || mode == GLOBAL_GLOBALMV) {
- const int num_4x4s = mi_size_wide[bsize] * mi_size_high[bsize];
- int ref;
- for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
- rdc->global_motion_used[mbmi->ref_frame[ref]] += num_4x4s;
- }
- }
-}
-
static AOM_INLINE void update_filter_type_cdf(const MACROBLOCKD *xd,
const MB_MODE_INFO *mbmi,
int dual_filter) {
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index baa3c9c..03d1ded 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -2614,11 +2614,6 @@
recode_loop_update_q(cpi, &loop, &q, &q_low, &q_high, top_index,
bottom_index, &undershoot_seen, &overshoot_seen,
&low_cr_seen, loop_count);
-
- if (!loop && !cpi->sf.gm_sf.gm_disable_recode)
- loop = av1_recode_loop_test_global_motion(
- cm->global_motion, cpi->td.rd_counts.global_motion_used,
- gm_info->params_cost);
}
if (loop) {
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 6baa5ca..01cb8a9 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -1264,8 +1264,6 @@
typedef struct RD_COUNTS {
int64_t comp_pred_diff[REFERENCE_MODES];
- // Stores number of 4x4 blocks using global motion per reference frame.
- int global_motion_used[REF_FRAMES];
int compound_ref_used_flag;
int skip_mode_used_flag;
int tx_type_used[TX_SIZES_ALL][TX_TYPES];
@@ -1633,13 +1631,6 @@
int type_cost[TRANS_TYPES];
/*!
- * Array to store the cost for signalling a particular global motion model for
- * each reference frame. gmparams_cost[i] stores the cost of signalling global
- * motion for the ith reference frame.
- */
- int params_cost[REF_FRAMES];
-
- /*!
* Flag to indicate if global motion search needs to be rerun.
*/
bool search_done;
diff --git a/av1/encoder/encoder_utils.c b/av1/encoder/encoder_utils.c
index 00700a7..302d424 100644
--- a/av1/encoder/encoder_utils.c
+++ b/av1/encoder/encoder_utils.c
@@ -967,28 +967,6 @@
cpi->sf.part_sf.partition_search_type = partition_search_type_orig;
cpi->sf.part_sf.fixed_partition_size = fixed_partition_block_size_orig;
}
-
-#define GM_RECODE_LOOP_NUM4X4_FACTOR 192
-int av1_recode_loop_test_global_motion(WarpedMotionParams *const global_motion,
- const int *const global_motion_used,
- int *const gm_params_cost) {
- int i;
- int recode = 0;
- for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
- if (global_motion[i].wmtype != IDENTITY &&
- global_motion_used[i] * GM_RECODE_LOOP_NUM4X4_FACTOR <
- gm_params_cost[i]) {
- global_motion[i] = default_warp_params;
- assert(global_motion[i].wmtype == IDENTITY);
- gm_params_cost[i] = 0;
- recode = 1;
- // TODO(sarahparker): The earlier condition for recoding here was:
- // "recode |= (rdc->global_motion_used[i] > 0);". Can we bring something
- // similar to that back to speed up global motion?
- }
- }
- return recode;
-}
#endif // CONFIG_REALTIME_ONLY
static void fix_interp_filter(InterpFilter *const interp_filter,
diff --git a/av1/encoder/encoder_utils.h b/av1/encoder/encoder_utils.h
index 317b473..4e854ab 100644
--- a/av1/encoder/encoder_utils.h
+++ b/av1/encoder/encoder_utils.h
@@ -979,10 +979,6 @@
uint16_t av1_setup_interp_filter_search_mask(AV1_COMP *cpi);
void av1_determine_sc_tools_with_encoding(AV1_COMP *cpi, const int q_orig);
-
-int av1_recode_loop_test_global_motion(WarpedMotionParams *const global_motion,
- const int *const global_motion_used,
- int *const gm_params_cost);
#endif
void av1_set_size_dependent_vars(AV1_COMP *cpi, int *q, int *bottom_index,
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index ba1572b..6f6ffde 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -29,10 +29,6 @@
for (int i = 0; i < REFERENCE_MODES; i++)
td->rd_counts.comp_pred_diff[i] += td_t->rd_counts.comp_pred_diff[i];
- for (int i = 0; i < REF_FRAMES; i++)
- td->rd_counts.global_motion_used[i] +=
- td_t->rd_counts.global_motion_used[i];
-
td->rd_counts.compound_ref_used_flag |=
td_t->rd_counts.compound_ref_used_flag;
td->rd_counts.skip_mode_used_flag |= td_t->rd_counts.skip_mode_used_flag;
diff --git a/av1/encoder/global_motion_facade.c b/av1/encoder/global_motion_facade.c
index 4cb4c43..c5a7415 100644
--- a/av1/encoder/global_motion_facade.c
+++ b/av1/encoder/global_motion_facade.c
@@ -208,7 +208,6 @@
MotionModel *params_by_motion, uint8_t *segment_map, int segment_map_w,
int segment_map_h) {
AV1_COMMON *const cm = &cpi->common;
- GlobalMotionInfo *const gm_info = &cpi->gm_info;
const WarpedMotionParams *ref_params =
cm->prev_frame ? &cm->prev_frame->global_motion[frame]
: &default_warp_params;
@@ -216,12 +215,6 @@
compute_global_motion_for_ref_frame(
cpi, ref_buf, frame, num_src_corners, src_corners, src_buffer,
params_by_motion, segment_map, segment_map_w, segment_map_h, ref_params);
-
- gm_info->params_cost[frame] =
- gm_get_params_cost(&cm->global_motion[frame], ref_params,
- cm->features.allow_high_precision_mv) +
- gm_info->type_cost[cm->global_motion[frame].wmtype] -
- gm_info->type_cost[IDENTITY];
}
// Loops over valid reference frames and computes global motion estimation.
@@ -318,7 +311,6 @@
// Skip global motion estimation for invalid ref frames
if (buf == NULL ||
(ref_disabled && cpi->sf.hl_sf.recode_loop != DISALLOW_RECODE)) {
- cpi->gm_info.params_cost[frame] = 0;
continue;
} else {
ref_buf[frame] = &buf->buf;
@@ -456,9 +448,6 @@
AV1_COMMON *const cm = &cpi->common;
GlobalMotionInfo *const gm_info = &cpi->gm_info;
- av1_zero(cpi->td.rd_counts.global_motion_used);
- av1_zero(gm_info->params_cost);
-
if (cpi->common.current_frame.frame_type == INTER_FRAME && cpi->source &&
cpi->oxcf.tool_cfg.enable_global_motion && !gm_info->search_done) {
setup_global_motion_info_params(cpi);
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 0700cba..45692c6 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -378,7 +378,6 @@
}
// Speed 0 for all speed features that give neutral coding performance change.
- sf->gm_sf.gm_disable_recode = 1;
sf->gm_sf.gm_search_type = GM_REDUCED_REF_SEARCH_SKIP_L2_L3;
sf->part_sf.less_rectangular_check_level = 1;
@@ -743,7 +742,6 @@
const int boosted = frame_is_boosted(cpi);
// Speed 0 for all speed features that give neutral coding performance change.
- sf->gm_sf.gm_disable_recode = 1;
sf->gm_sf.gm_search_type = GM_REDUCED_REF_SEARCH_SKIP_L2_L3;
sf->part_sf.less_rectangular_check_level = 1;
@@ -1070,7 +1068,6 @@
static AOM_INLINE void init_gm_sf(GLOBAL_MOTION_SPEED_FEATURES *gm_sf) {
gm_sf->selective_ref_gm = 1;
gm_sf->gm_search_type = GM_FULL_SEARCH;
- gm_sf->gm_disable_recode = 0;
gm_sf->prune_ref_frame_for_gm_search = 0;
}
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 6053716..6e33fbf 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -384,9 +384,6 @@
GM_SEARCH_TYPE gm_search_type;
- // whether to disable the global motion recode loop
- int gm_disable_recode;
-
// During global motion estimation, prune remaining reference frames in a
// given direction(past/future), if the evaluated ref_frame in that direction
// yields gm_type as INVALID/TRANSLATION/IDENTITY