Merge ref-mv into codebase Change-Id: I96e386678f6227f3ca735c9be2725cb9795b3296
diff --git a/av1/common/blockd.h b/av1/common/blockd.h index bf2374d..33b6c51 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h
@@ -260,9 +260,7 @@ typedef struct { PREDICTION_MODE as_mode; int_mv as_mv[2]; // first, second inter predictor motion vectors -#if CONFIG_REF_MV int_mv pred_mv[2]; -#endif #if CONFIG_EXT_INTER int_mv ref_mv[2]; #endif // CONFIG_EXT_INTER @@ -413,9 +411,7 @@ #endif // CONFIG_MOTION_VAR int_mv mv[2]; int_mv pred_mv[2]; -#if CONFIG_REF_MV uint8_t ref_mv_idx; -#endif #if CONFIG_EXT_PARTITION_TYPES PARTITION_TYPE partition; #endif @@ -631,11 +627,9 @@ // block dimension in the unit of mode_info. uint8_t n8_w, n8_h; -#if CONFIG_REF_MV uint8_t ref_mv_count[MODE_CTX_REF_FRAMES]; CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE]; uint8_t is_sec_rect; -#endif #if CONFIG_PVQ daala_dec_ctx daala_dec;
diff --git a/av1/common/entropy.c b/av1/common/entropy.c index e29bf27..6445205 100644 --- a/av1/common/entropy.c +++ b/av1/common/entropy.c
@@ -6260,7 +6260,6 @@ aom_cdf_prob *fc_cdf_ptr; -#if CONFIG_REF_MV int j; for (j = 0; j < NMV_CONTEXTS; ++j) { AVERAGE_TILE_CDFS(nmvc[j].joint_cdf) @@ -6271,15 +6270,6 @@ AVERAGE_TILE_CDFS(nmvc[j].comps[k].fp_cdf); } } -#else - AVERAGE_TILE_CDFS(nmvc.joint_cdf) - - for (k = 0; k < 2; ++k) { - AVERAGE_TILE_CDFS(nmvc.comps[k].class_cdf) - AVERAGE_TILE_CDFS(nmvc.comps[k].class0_fp_cdf) - AVERAGE_TILE_CDFS(nmvc.comps[k].fp_cdf) - } -#endif } void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[], @@ -6324,17 +6314,13 @@ aom_cdf_prob *fc_cdf_ptr; -// FIXME: comp_inter_cdf not defined + // FIXME: comp_inter_cdf not defined -// FIXME: comp_ref_cdf and comp_bwd_ref not defined + // FIXME: comp_ref_cdf and comp_bwd_ref not defined -// FIXME: single_ref_cdf not defined + // FIXME: single_ref_cdf not defined -#if CONFIG_REF_MV -// FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode -#else - AVERAGE_TILE_CDFS(inter_mode_cdf) -#endif + // FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode // FIXME: cdfs not defined for motion_mode_prob, obmc_prob
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index ac1a418..96c14e9 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -732,7 +732,6 @@ }; #endif // CONFIG_EXT_PARTITION_TYPES -#if CONFIG_REF_MV static const aom_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = { 200, 180, 150, 150, 110, 70, 60, }; @@ -747,7 +746,6 @@ static const aom_prob default_drl_prob[DRL_MODE_CONTEXTS] = { 128, 160, 180, 128, 160 }; -#endif // CONFIG_REF_MV static const aom_prob default_inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1] = { @@ -3268,12 +3266,10 @@ av1_copy(fc->txfm_partition_prob, default_txfm_partition_probs); #endif av1_copy(fc->skip_probs, default_skip_probs); -#if CONFIG_REF_MV av1_copy(fc->newmv_prob, default_newmv_prob); av1_copy(fc->zeromv_prob, default_zeromv_prob); av1_copy(fc->refmv_prob, default_refmv_prob); av1_copy(fc->drl_prob, default_drl_prob); -#endif // CONFIG_REF_MV av1_copy(fc->inter_mode_probs, default_inter_mode_probs); #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION av1_copy(fc->motion_mode_prob, default_motion_mode_prob); @@ -3494,7 +3490,6 @@ #endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF -#if CONFIG_REF_MV for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i) fc->newmv_prob[i] = av1_mode_mv_merge_probs(pre_fc->newmv_prob[i], counts->newmv_mode[i]); @@ -3508,11 +3503,6 @@ for (i = 0; i < DRL_MODE_CONTEXTS; ++i) fc->drl_prob[i] = av1_mode_mv_merge_probs(pre_fc->drl_prob[i], counts->drl_mode[i]); -#else - for (i = 0; i < INTER_MODE_CONTEXTS; i++) - aom_tree_merge_probs(av1_inter_mode_tree, pre_fc->inter_mode_probs[i], - counts->inter_mode[i], fc->inter_mode_probs[i]); -#endif #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i)
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 9c3a78d..ff15aaa 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h
@@ -185,12 +185,10 @@ aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS]; #endif -#if CONFIG_REF_MV aom_prob newmv_prob[NEWMV_MODE_CONTEXTS]; aom_prob zeromv_prob[ZEROMV_MODE_CONTEXTS]; aom_prob refmv_prob[REFMV_MODE_CONTEXTS]; aom_prob drl_prob[DRL_MODE_CONTEXTS]; -#endif // CONFIG_REF_MV aom_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1]; #if CONFIG_EXT_INTER @@ -228,11 +226,7 @@ aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS]; #endif aom_prob skip_probs[SKIP_CONTEXTS]; -#if CONFIG_REF_MV nmv_context nmvc[NMV_CONTEXTS]; -#else - nmv_context nmvc; -#endif #if CONFIG_INTRABC nmv_context ndvc; #endif @@ -360,12 +354,10 @@ av1_blockz_count_model blockz_count[TX_SIZES][PLANE_TYPES]; #endif -#if CONFIG_REF_MV unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2]; unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2]; unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2]; unsigned int drl_mode[DRL_MODE_CONTEXTS][2]; -#endif unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES]; #if CONFIG_EXT_INTER @@ -406,11 +398,7 @@ unsigned int txfm_partition[TXFM_PARTITION_CONTEXTS][2]; #endif unsigned int skip[SKIP_CONTEXTS][2]; -#if CONFIG_REF_MV nmv_context_counts mv[NMV_CONTEXTS]; -#else - nmv_context_counts mv; -#endif #if CONFIG_INTRABC nmv_context_counts dv; #endif
diff --git a/av1/common/entropymv.c b/av1/common/entropymv.c index ddca80a..8005778 100644 --- a/av1/common/entropymv.c +++ b/av1/common/entropymv.c
@@ -232,17 +232,11 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { int i, j; -#if CONFIG_REF_MV int idx; for (idx = 0; idx < NMV_CONTEXTS; ++idx) { nmv_context *nmvc = &cm->fc->nmvc[idx]; const nmv_context *pre_nmvc = &cm->pre_fc->nmvc[idx]; const nmv_context_counts *counts = &cm->counts.mv[idx]; -#else - nmv_context *nmvc = &cm->fc->nmvc; - const nmv_context *pre_nmvc = &cm->pre_fc.nmvc; - const nmv_context_counts *counts = &cm->counts.mv; -#endif // CONFIG_REF_MV aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints, nmvc->joints); for (i = 0; i < 2; ++i) { @@ -271,9 +265,7 @@ comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp); } } -#if CONFIG_REF_MV } -#endif // CONFIG_REF_MV } #if CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT @@ -296,15 +288,11 @@ #endif void av1_init_mv_probs(AV1_COMMON *cm) { -#if CONFIG_REF_MV int i; for (i = 0; i < NMV_CONTEXTS; ++i) { // NB: this sets CDFs too cm->fc->nmvc[i] = default_nmv_context; } -#else - cm->fc->nmvc = default_nmv_context; -#endif // CONFIG_REF_MV #if CONFIG_INTRABC cm->fc->ndvc = default_nmv_context; #endif // CONFIG_INTRABC
diff --git a/av1/common/enums.h b/av1/common/enums.h index 054bd40..ee18e3c 100644 --- a/av1/common/enums.h +++ b/av1/common/enums.h
@@ -419,7 +419,6 @@ #define SKIP_CONTEXTS 3 -#if CONFIG_REF_MV #define NMV_CONTEXTS 3 #define NEWMV_MODE_CONTEXTS 7 @@ -438,7 +437,6 @@ #define SKIP_NEARESTMV_OFFSET 9 #define SKIP_NEARMV_OFFSET 10 #define SKIP_NEARESTMV_SUB8X8_OFFSET 11 -#endif #define INTER_MODE_CONTEXTS 7 #if CONFIG_DELTA_Q @@ -455,14 +453,12 @@ /* Segment Feature Masks */ #define MAX_MV_REF_CANDIDATES 2 -#if CONFIG_REF_MV #define MAX_REF_MV_STACK_SIZE 16 #if CONFIG_EXT_PARTITION #define REF_CAT_LEVEL 640 #else #define REF_CAT_LEVEL 255 #endif // CONFIG_EXT_PARTITION -#endif // CONFIG_REF_MV #define INTRA_INTER_CONTEXTS 4 #define COMP_INTER_CONTEXTS 5 @@ -508,11 +504,7 @@ #define SINGLE_REFS (FWD_REFS + BWD_REFS) #define COMP_REFS (FWD_REFS * BWD_REFS) -#if CONFIG_REF_MV #define MODE_CTX_REF_FRAMES (TOTAL_REFS_PER_FRAME + COMP_REFS) -#else -#define MODE_CTX_REF_FRAMES TOTAL_REFS_PER_FRAME -#endif #if CONFIG_SUPERTX #define PARTITION_SUPERTX_CONTEXTS 2
diff --git a/av1/common/mv.h b/av1/common/mv.h index d4df379..1e6733d 100644 --- a/av1/common/mv.h +++ b/av1/common/mv.h
@@ -269,14 +269,12 @@ } #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_REF_MV typedef struct candidate_mv { int_mv this_mv; int_mv comp_mv; uint8_t pred_diff[2]; int weight; } CANDIDATE_MV; -#endif static INLINE int is_zero_mv(const MV *mv) { return *((const uint32_t *)mv) == 0;
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c index 5222948..7c5d93c 100644 --- a/av1/common/mvref_common.c +++ b/av1/common/mvref_common.c
@@ -14,8 +14,6 @@ #include "av1/common/warped_motion.h" #endif // CONFIG_WARPED_MOTION -#if CONFIG_REF_MV - static uint8_t add_ref_mv_candidate( const MODE_INFO *const candidate_mi, const MB_MODE_INFO *const candidate, const MV_REFERENCE_FRAME rf[2], uint8_t *refmv_count, @@ -556,7 +554,6 @@ } } } -#endif // This function searches the neighbourhood of a given MB/SB // to try and find candidate reference vectors. @@ -568,9 +565,6 @@ int_mv zeromv) { const int *ref_sign_bias = cm->ref_frame_sign_bias; int i, refmv_count = 0; -#if !CONFIG_REF_MV - const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type]; -#endif int different_ref_found = 0; int context_counter = 0; #if CONFIG_MV_COMPRESS @@ -596,7 +590,6 @@ const BLOCK_SIZE bsize = mi->mbmi.sb_type; const int bw = block_size_wide[AOMMAX(bsize, BLOCK_8X8)]; const int bh = block_size_high[AOMMAX(bsize, BLOCK_8X8)]; -#if CONFIG_REF_MV POSITION mv_ref_search[MVREF_NEIGHBOURS]; const int num_8x8_blocks_wide = num_8x8_blocks_wide_lookup[bsize]; const int num_8x8_blocks_high = num_8x8_blocks_high_lookup[bsize]; @@ -639,7 +632,6 @@ mv_ref_search[i].col *= 2; } #endif // CONFIG_CB4X4 -#endif // CONFIG_REF_MV // The nearest 2 blocks are treated differently // if the size < 8x8 we get the mv from the bmi substructure, @@ -673,12 +665,10 @@ !xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride] ? NULL : &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi; -#if CONFIG_REF_MV if (candidate == NULL) continue; if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE || (mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE) continue; -#endif different_ref_found = 1; if (candidate->ref_frame[0] == ref_frame) @@ -727,12 +717,10 @@ !xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride] ? NULL : &xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi; -#if CONFIG_REF_MV if (candidate == NULL) continue; if ((mi_row % MAX_MIB_SIZE) + mv_ref->row >= MAX_MIB_SIZE || (mi_col % MAX_MIB_SIZE) + mv_ref->col >= MAX_MIB_SIZE) continue; -#endif // If the candidate is INTRA we don't want to consider its mv. IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias, @@ -780,14 +768,10 @@ 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]; -#endif int context_counter = 0; const int bw = block_size_wide[mi->mbmi.sb_type]; const int bh = block_size_high[mi->mbmi.sb_type]; const TileInfo *const tile = &xd->tile; -#if CONFIG_REF_MV POSITION mv_ref_search[MVREF_NEIGHBOURS]; const int num_8x8_blocks_wide = mi_size_wide[mi->mbmi.sb_type]; const int num_8x8_blocks_high = mi_size_high[mi->mbmi.sb_type]; @@ -823,7 +807,6 @@ mv_ref_search[7].col = -3; mv_ref_search[8].row = num_8x8_blocks_high - 1; mv_ref_search[8].col = -3; -#endif // Blank the reference vector list memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES); @@ -859,12 +842,10 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, -#if CONFIG_REF_MV uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack, #if CONFIG_EXT_INTER int16_t *compound_mode_context, #endif // CONFIG_EXT_INTER -#endif int_mv *mv_ref_list, int mi_row, int mi_col, find_mv_refs_sync sync, void *const data, int16_t *mode_context) { @@ -872,23 +853,17 @@ #if CONFIG_GLOBAL_MOTION BLOCK_SIZE bsize = mi->mbmi.sb_type; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_REF_MV int idx, all_zero = 1; #if CONFIG_GLOBAL_MOTION MV_REFERENCE_FRAME rf[2]; #endif // CONFIG_GLOBAL_MOTION -#endif // CONFIG_REF_MV + #if CONFIG_EXT_INTER 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 - mode_context); -#endif // CONFIG_REF_MV #endif // CONFIG_EXT_INTER #if CONFIG_GLOBAL_MOTION -#if CONFIG_REF_MV av1_set_ref_frame(rf, ref_frame); zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[rf[0]], cm->allow_high_precision_mv, bsize, @@ -901,23 +876,13 @@ .as_int : 0; #else - zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame], - cm->allow_high_precision_mv, bsize, - mi_col, mi_row, 0) - .as_int; - zeromv[1].as_int = 0; -#endif // CONFIG_REF_MV -#else zeromv[0].as_int = zeromv[1].as_int = 0; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_REF_MV if (ref_frame <= ALTREF_FRAME) -#endif // CONFIG_REF_MV find_mv_refs_idx(cm, xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col, sync, data, mode_context, zeromv[0]); -#if CONFIG_REF_MV setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack, mv_ref_list, -1, mi_row, mi_col, mode_context); /* Note: If global motion is enabled, then we want to set the ALL_ZERO flag @@ -947,7 +912,6 @@ } if (all_zero) mode_context[ref_frame] |= (1 << ALL_ZERO_FLAG_OFFSET); -#endif } void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv, @@ -963,10 +927,8 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, int block, int ref, int mi_row, int mi_col, -#if CONFIG_REF_MV CANDIDATE_MV *ref_mv_stack, uint8_t *ref_mv_count, -#endif #if CONFIG_EXT_INTER int_mv *mv_list, #endif // CONFIG_EXT_INTER @@ -978,13 +940,11 @@ b_mode_info *bmi = mi->bmi; int n; int_mv zeromv; -#if CONFIG_REF_MV CANDIDATE_MV tmp_mv; uint8_t idx; uint8_t above_count = 0, left_count = 0; MV_REFERENCE_FRAME rf[2] = { mi->mbmi.ref_frame[ref], NONE_FRAME }; *ref_mv_count = 0; -#endif assert(MAX_MV_REF_CANDIDATES == 2); @@ -999,7 +959,6 @@ find_mv_refs_idx(cm, xd, mi, mi->mbmi.ref_frame[ref], mv_list, block, mi_row, mi_col, NULL, NULL, NULL, zeromv); -#if CONFIG_REF_MV scan_blk_mbmi(cm, xd, mi_row, mi_col, block, rf, -1, 0, ref_mv_stack, ref_mv_count); above_count = *ref_mv_count; @@ -1020,7 +979,6 @@ 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; -#endif near_mv->as_int = 0; switch (block) {
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h index 01f74b7..b4747c6 100644 --- a/av1/common/mvref_common.h +++ b/av1/common/mvref_common.h
@@ -18,11 +18,7 @@ extern "C" { #endif -#if CONFIG_REF_MV #define MVREF_NEIGHBOURS 9 -#else -#define MVREF_NEIGHBOURS 8 -#endif typedef struct position { int row; @@ -109,158 +105,6 @@ BOTH_INTRA // 18 }; -#if !CONFIG_REF_MV -static const POSITION mv_ref_blocks[BLOCK_SIZES][MVREF_NEIGHBOURS] = { - // 4X4 - { { -1, 0 }, - { 0, -1 }, - { -1, -1 }, - { -2, 0 }, - { 0, -2 }, - { -2, -1 }, - { -1, -2 }, - { -2, -2 } }, - // 4X8 - { { -1, 0 }, - { 0, -1 }, - { -1, -1 }, - { -2, 0 }, - { 0, -2 }, - { -2, -1 }, - { -1, -2 }, - { -2, -2 } }, - // 8X4 - { { -1, 0 }, - { 0, -1 }, - { -1, -1 }, - { -2, 0 }, - { 0, -2 }, - { -2, -1 }, - { -1, -2 }, - { -2, -2 } }, - // 8X8 - { { -1, 0 }, - { 0, -1 }, - { -1, -1 }, - { -2, 0 }, - { 0, -2 }, - { -2, -1 }, - { -1, -2 }, - { -2, -2 } }, - // 8X16 - { { 0, -1 }, - { -1, 0 }, - { 1, -1 }, - { -1, -1 }, - { 0, -2 }, - { -2, 0 }, - { -2, -1 }, - { -1, -2 } }, - // 16X8 - { { -1, 0 }, - { 0, -1 }, - { -1, 1 }, - { -1, -1 }, - { -2, 0 }, - { 0, -2 }, - { -1, -2 }, - { -2, -1 } }, - // 16X16 - { { -1, 0 }, - { 0, -1 }, - { -1, 1 }, - { 1, -1 }, - { -1, -1 }, - { -3, 0 }, - { 0, -3 }, - { -3, -3 } }, - // 16X32 - { { 0, -1 }, - { -1, 0 }, - { 2, -1 }, - { -1, -1 }, - { -1, 1 }, - { 0, -3 }, - { -3, 0 }, - { -3, -3 } }, - // 32X16 - { { -1, 0 }, - { 0, -1 }, - { -1, 2 }, - { -1, -1 }, - { 1, -1 }, - { -3, 0 }, - { 0, -3 }, - { -3, -3 } }, - // 32X32 - { { -1, 1 }, - { 1, -1 }, - { -1, 2 }, - { 2, -1 }, - { -1, -1 }, - { -3, 0 }, - { 0, -3 }, - { -3, -3 } }, - // 32X64 - { { 0, -1 }, - { -1, 0 }, - { 4, -1 }, - { -1, 2 }, - { -1, -1 }, - { 0, -3 }, - { -3, 0 }, - { 2, -1 } }, - // 64X32 - { { -1, 0 }, - { 0, -1 }, - { -1, 4 }, - { 2, -1 }, - { -1, -1 }, - { -3, 0 }, - { 0, -3 }, - { -1, 2 } }, - // 64X64 - { { -1, 3 }, - { 3, -1 }, - { -1, 4 }, - { 4, -1 }, - { -1, -1 }, - { -1, 0 }, - { 0, -1 }, - { -1, 6 } }, -#if CONFIG_EXT_PARTITION - // TODO(debargha/jingning) Making them twice the 32x64, .. ones above - // 64x128 - { { 0, -2 }, - { -2, 0 }, - { 8, -2 }, - { -2, 4 }, - { -2, -2 }, - { 0, -6 }, - { -6, 0 }, - { 4, -2 } }, - // 128x64 - { { -2, 0 }, - { 0, -2 }, - { -2, 8 }, - { 4, -2 }, - { -2, -2 }, - { -6, 0 }, - { 0, -6 }, - { -2, 4 } }, - // 128x128 - { { -2, 6 }, - { 6, -2 }, - { -2, 8 }, - { 8, -2 }, - { -2, -2 }, - { -2, 0 }, - { 0, -2 }, - { -2, 12 } }, -#endif // CONFIG_EXT_PARTITION -}; -#endif - static const int idx_n_column_to_subblock[4][2] = { { 1, 2 }, { 1, 3 }, { 3, 2 }, { 3, 3 } }; @@ -283,20 +127,11 @@ // on whether the block_size < 8x8 and we have check_sub_blocks set. static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate, int which_mv, int search_col, int block_idx) { -#if CONFIG_REF_MV (void)search_col; (void)block_idx; return candidate->mbmi.mv[which_mv]; -#else - return block_idx >= 0 && candidate->mbmi.sb_type < BLOCK_8X8 - ? candidate - ->bmi[idx_n_column_to_subblock[block_idx][search_col == 0]] - .as_mv[which_mv] - : candidate->mbmi.mv[which_mv]; -#endif } -#if CONFIG_REF_MV static INLINE int_mv get_sub_block_pred_mv(const MODE_INFO *candidate, int which_mv, int search_col, int block_idx) { @@ -304,7 +139,6 @@ (void)block_idx; return candidate->mbmi.mv[which_mv]; } -#endif // Performs mv sign inversion if indicated by the reference frame combination. static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref, @@ -384,7 +218,6 @@ } } -#if CONFIG_REF_MV static INLINE uint8_t av1_get_pred_diff_ctx(const int_mv pred_mv, const int_mv this_mv) { if (abs(this_mv.as_mv.row - pred_mv.as_mv.row) <= 4 && @@ -477,17 +310,14 @@ return 0; } -#endif typedef void (*find_mv_refs_sync)(void *const data, int mi_row); void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, -#if CONFIG_REF_MV uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack, #if CONFIG_EXT_INTER int16_t *compound_mode_context, #endif // CONFIG_EXT_INTER -#endif int_mv *mv_ref_list, int mi_row, int mi_col, find_mv_refs_sync sync, void *const data, int16_t *mode_context); @@ -500,10 +330,8 @@ void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, int block, int ref, int mi_row, int mi_col, -#if CONFIG_REF_MV CANDIDATE_MV *ref_mv_stack, uint8_t *ref_mv_count, -#endif #if CONFIG_EXT_INTER int_mv *mv_list, #endif // CONFIG_EXT_INTER
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index aa6f212..62191f4 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h
@@ -100,9 +100,7 @@ typedef struct { int_mv mv[2]; -#if CONFIG_REF_MV int_mv pred_mv[2]; -#endif MV_REFERENCE_FRAME ref_frame[2]; } MV_REF; @@ -657,14 +655,12 @@ xd->n8_h = bh; xd->n8_w = bw; -#if CONFIG_REF_MV xd->is_sec_rect = 0; if (xd->n8_w < xd->n8_h) if (mi_col & (xd->n8_h - 1)) xd->is_sec_rect = 1; if (xd->n8_w > xd->n8_h) if (mi_row & (xd->n8_w - 1)) xd->is_sec_rect = 1; -#endif // CONFIG_REF_MV } static INLINE const aom_prob *get_y_mode_probs(const AV1_COMMON *cm,
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 1ceae84..66c3e22 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -190,7 +190,6 @@ #endif static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) { -#if CONFIG_REF_MV int i; for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i) av1_diff_update_prob(r, &fc->newmv_prob[i], ACCT_STR); @@ -200,18 +199,6 @@ av1_diff_update_prob(r, &fc->refmv_prob[i], ACCT_STR); for (i = 0; i < DRL_MODE_CONTEXTS; ++i) av1_diff_update_prob(r, &fc->drl_prob[i], ACCT_STR); -#else -#if !CONFIG_EC_ADAPT - int i, j; - for (i = 0; i < INTER_MODE_CONTEXTS; ++i) { - for (j = 0; j < INTER_MODES - 1; ++j) - av1_diff_update_prob(r, &fc->inter_mode_probs[i][j], ACCT_STR); - } -#else - (void)fc; - (void)r; -#endif -#endif } #if CONFIG_EXT_INTER @@ -4686,9 +4673,6 @@ av1_diff_update_prob(&r, &cm->kf_y_prob[k][j][i], ACCT_STR); #endif } else { -#if !CONFIG_REF_MV - nmv_context *const nmvc = &fc->nmvc; -#endif read_inter_mode_probs(fc, &r); #if CONFIG_EXT_INTER @@ -4745,12 +4729,8 @@ } #endif -#if CONFIG_REF_MV for (i = 0; i < NMV_CONTEXTS; ++i) read_mv_probs(&fc->nmvc[i], cm->allow_high_precision_mv, &r); -#else - read_mv_probs(nmvc, cm->allow_high_precision_mv, &r); -#endif #if !CONFIG_EC_ADAPT read_ext_tx_probs(fc, &r); #endif // EC_ADAPT @@ -4767,11 +4747,7 @@ #endif /* Make tail distribution from head */ av1_coef_pareto_cdfs(fc); -#if CONFIG_REF_MV for (i = 0; i < NMV_CONTEXTS; ++i) av1_set_mv_cdfs(&fc->nmvc[i]); -#else - av1_set_mv_cdfs(&fc->nmvc); -#endif av1_set_mode_cdfs(cm); #endif // CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT @@ -4836,14 +4812,10 @@ assert(!memcmp(&cm->counts.tx_size, &zero_counts.tx_size, sizeof(cm->counts.tx_size))); assert(!memcmp(cm->counts.skip, zero_counts.skip, sizeof(cm->counts.skip))); -#if CONFIG_REF_MV assert( !memcmp(&cm->counts.mv[0], &zero_counts.mv[0], sizeof(cm->counts.mv[0]))); assert( !memcmp(&cm->counts.mv[1], &zero_counts.mv[1], sizeof(cm->counts.mv[0]))); -#else - assert(!memcmp(&cm->counts.mv, &zero_counts.mv, sizeof(cm->counts.mv))); -#endif assert(!memcmp(cm->counts.inter_ext_tx, zero_counts.inter_ext_tx, sizeof(cm->counts.inter_ext_tx))); assert(!memcmp(cm->counts.intra_ext_tx, zero_counts.intra_ext_tx, @@ -4967,9 +4939,7 @@ aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME, "Truncated packet or corrupt header length"); -#if CONFIG_REF_MV cm->setup_mi(cm); -#endif #if CONFIG_TEMPMV_SIGNALING if (cm->use_prev_frame_mvs) {
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index ec0f877..3adc235 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -221,7 +221,6 @@ static PREDICTION_MODE read_inter_mode(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd, aom_reader *r, int16_t ctx) { -#if CONFIG_REF_MV FRAME_COUNTS *counts = xd->counts; int16_t mode_ctx = ctx & NEWMV_CTX_MASK; aom_prob mode_prob = ec_ctx->newmv_prob[mode_ctx]; @@ -262,22 +261,8 @@ // Invalid prediction mode. assert(0); -#else -#if CONFIG_EC_MULTISYMBOL - const int mode = av1_inter_mode_inv[aom_read_symbol( - r, ec_ctx->inter_mode_cdf[ctx], INTER_MODES, ACCT_STR)]; -#else - const int mode = aom_read_tree(r, av1_inter_mode_tree, - ec_ctx->inter_mode_probs[ctx], ACCT_STR); -#endif - FRAME_COUNTS *counts = xd->counts; - if (counts) ++counts->inter_mode[ctx][mode]; - - return NEARESTMV + mode; -#endif } -#if CONFIG_REF_MV static void read_drl_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, MB_MODE_INFO *mbmi, aom_reader *r) { uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); @@ -324,7 +309,6 @@ } } } -#endif #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd, @@ -1477,7 +1461,6 @@ FRAME_CONTEXT *ec_ctx = cm->fc; #endif BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; -#if CONFIG_REF_MV MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; #if CONFIG_CB4X4 int_mv *pred_mv = mbmi->pred_mv; @@ -1486,9 +1469,6 @@ int_mv *pred_mv = (bsize >= BLOCK_8X8) ? mbmi->pred_mv : xd->mi[0]->bmi[block].pred_mv; #endif // CONFIG_CB4X4 -#else - (void)block; -#endif // CONFIG_REF_MV (void)ref_frame; (void)cm; (void)mi_row; @@ -1498,12 +1478,7 @@ switch (mode) { case NEWMV: { FRAME_COUNTS *counts = xd->counts; -#if !CONFIG_REF_MV - nmv_context *const nmvc = &ec_ctx->nmvc; - nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; -#endif for (i = 0; i < 1 + is_compound; ++i) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], i, @@ -1511,13 +1486,10 @@ nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; -#endif read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, nmvc, mv_counts, allow_hp); ret = ret && is_mv_valid(&mv[i].as_mv); -#if CONFIG_REF_MV pred_mv[i].as_int = ref_mv[i].as_int; -#endif } break; } @@ -1525,20 +1497,16 @@ mv[0].as_int = nearest_mv[0].as_int; if (is_compound) mv[1].as_int = nearest_mv[1].as_int; -#if CONFIG_REF_MV pred_mv[0].as_int = nearest_mv[0].as_int; if (is_compound) pred_mv[1].as_int = nearest_mv[1].as_int; -#endif break; } case NEARMV: { mv[0].as_int = near_mv[0].as_int; if (is_compound) mv[1].as_int = near_mv[1].as_int; -#if CONFIG_REF_MV pred_mv[0].as_int = near_mv[0].as_int; if (is_compound) pred_mv[1].as_int = near_mv[1].as_int; -#endif break; } case ZEROMV: { @@ -1557,22 +1525,15 @@ if (is_compound) mv[1].as_int = 0; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_REF_MV pred_mv[0].as_int = mv[0].as_int; if (is_compound) pred_mv[1].as_int = mv[1].as_int; -#endif break; } #if CONFIG_EXT_INTER case NEW_NEWMV: { FRAME_COUNTS *counts = xd->counts; -#if !CONFIG_REF_MV - nmv_context *const nmvc = &ec_ctx->nmvc; - nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; -#endif assert(is_compound); for (i = 0; i < 2; ++i) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], i, @@ -1580,7 +1541,6 @@ nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; -#endif read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, nmvc, mv_counts, allow_hp); ret = ret && is_mv_valid(&mv[i].as_mv); } @@ -1612,17 +1572,12 @@ } case NEW_NEARESTMV: { FRAME_COUNTS *counts = xd->counts; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; -#else - nmv_context *const nmvc = &ec_ctx->nmvc; - nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; -#endif read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); ret = ret && is_mv_valid(&mv[0].as_mv); @@ -1631,17 +1586,12 @@ } case NEAREST_NEWMV: { FRAME_COUNTS *counts = xd->counts; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; -#else - nmv_context *const nmvc = &ec_ctx->nmvc; - nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; -#endif mv[0].as_int = nearest_mv[0].as_int; read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); @@ -1650,17 +1600,12 @@ } case NEAR_NEWMV: { FRAME_COUNTS *counts = xd->counts; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; -#else - nmv_context *const nmvc = &ec_ctx->nmvc; - nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; -#endif mv[0].as_int = near_mv[0].as_int; read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); @@ -1670,17 +1615,12 @@ } case NEW_NEARMV: { FRAME_COUNTS *counts = xd->counts; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; -#else - nmv_context *const nmvc = &ec_ctx->nmvc; - nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; -#endif read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); ret = ret && is_mv_valid(&mv[0].as_mv); @@ -1748,9 +1688,9 @@ int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; int ref, is_compound; int16_t inter_mode_ctx[MODE_CTX_REF_FRAMES]; -#if CONFIG_REF_MV && CONFIG_EXT_INTER +#if CONFIG_EXT_INTER int16_t compound_inter_mode_ctx[MODE_CTX_REF_FRAMES]; -#endif // CONFIG_REF_MV && CONFIG_EXT_INTER +#endif // CONFIG_EXT_INTER int16_t mode_ctx = 0; #if CONFIG_WARPED_MOTION int pts[SAMPLES_ARRAY_SIZE], pts_inref[SAMPLES_ARRAY_SIZE]; @@ -1774,18 +1714,14 @@ for (ref = 0; ref < 1 + is_compound; ++ref) { MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; - av1_find_mv_refs(cm, xd, mi, frame, -#if CONFIG_REF_MV - &xd->ref_mv_count[frame], xd->ref_mv_stack[frame], + av1_find_mv_refs( + cm, xd, mi, frame, &xd->ref_mv_count[frame], xd->ref_mv_stack[frame], #if CONFIG_EXT_INTER - compound_inter_mode_ctx, + compound_inter_mode_ctx, #endif // CONFIG_EXT_INTER -#endif - ref_mvs[frame], mi_row, mi_col, fpm_sync, (void *)pbi, - inter_mode_ctx); + ref_mvs[frame], mi_row, mi_col, fpm_sync, (void *)pbi, inter_mode_ctx); } -#if CONFIG_REF_MV if (is_compound) { MV_REFERENCE_FRAME ref_frame = av1_ref_frame_type(mbmi->ref_frame); av1_find_mv_refs(cm, xd, mi, ref_frame, &xd->ref_mv_count[ref_frame], @@ -1833,9 +1769,6 @@ mode_ctx = av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame, bsize, -1); mbmi->ref_mv_idx = 0; -#else - mode_ctx = inter_mode_ctx[mbmi->ref_frame[0]]; -#endif if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { mbmi->mode = ZEROMV; @@ -1852,7 +1785,6 @@ else #endif // CONFIG_EXT_INTER mbmi->mode = read_inter_mode(ec_ctx, xd, r, mode_ctx); -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (mbmi->mode == NEWMV || mbmi->mode == NEW_NEWMV || have_nearmv_in_inter_mode(mbmi->mode)) @@ -1860,7 +1792,6 @@ if (mbmi->mode == NEARMV || mbmi->mode == NEWMV) #endif read_drl_idx(cm, xd, mbmi, r); -#endif } } @@ -1876,7 +1807,6 @@ } } -#if CONFIG_REF_MV if (mbmi->ref_mv_idx > 0) { int_mv cur_mv = xd->ref_mv_stack[mbmi->ref_frame[0]][1 + mbmi->ref_mv_idx].this_mv; @@ -1938,7 +1868,6 @@ } #endif // CONFIG_EXT_INTER } -#endif #if !CONFIG_DUAL_FILTER && !CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION read_mb_interp_filter(cm, xd, mbmi, r); @@ -1958,13 +1887,11 @@ int_mv block[2]; const int j = idy * 2 + idx; int_mv ref_mv_s8[2]; -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (!is_compound) #endif // CONFIG_EXT_INTER mode_ctx = av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame, bsize, j); -#endif #if CONFIG_EXT_INTER if (is_compound) b_mode = read_inter_compound_mode(cm, xd, r, mode_ctx); @@ -1977,10 +1904,8 @@ #else if (b_mode != ZEROMV) { #endif // CONFIG_EXT_INTER -#if CONFIG_REF_MV CANDIDATE_MV ref_mv_stack[2][MAX_REF_MV_STACK_SIZE]; uint8_t ref_mv_count[2]; -#endif for (ref = 0; ref < 1 + is_compound; ++ref) #if CONFIG_EXT_INTER { @@ -1989,9 +1914,7 @@ 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 ref_mv_stack[ref], &ref_mv_count[ref], -#endif #if CONFIG_EXT_INTER mv_ref_list, #endif // CONFIG_EXT_INTER @@ -2009,12 +1932,8 @@ } for (ref = 0; ref < 1 + is_compound && b_mode != ZEROMV; ++ref) { -#if CONFIG_REF_MV ref_mv_s8[ref] = nearest_sub8x8[ref]; lower_mv_precision(&ref_mv_s8[ref].as_mv, allow_hp); -#else - ref_mv_s8[ref] = nearestmv[ref]; -#endif } #if CONFIG_EXT_INTER (void)ref_mv_s8; @@ -2041,10 +1960,8 @@ } } -#if CONFIG_REF_MV mbmi->pred_mv[0].as_int = mi->bmi[3].pred_mv[0].as_int; mbmi->pred_mv[1].as_int = mi->bmi[3].pred_mv[1].as_int; -#endif mi->mbmi.mode = b_mode; mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int; @@ -2056,42 +1973,35 @@ #if CONFIG_EXT_INTER if (is_compound) { -#if CONFIG_REF_MV int ref_mv_idx = mbmi->ref_mv_idx; // Special case: NEAR_NEWMV and NEW_NEARMV modes use // 1 + mbmi->ref_mv_idx (like NEARMV) instead of // mbmi->ref_mv_idx (like NEWMV) if (mbmi->mode == NEAR_NEWMV || mbmi->mode == NEW_NEARMV) ref_mv_idx = 1 + mbmi->ref_mv_idx; -#endif if (compound_ref0_mode(mbmi->mode) == NEWMV) { -#if CONFIG_REF_MV uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); if (xd->ref_mv_count[ref_frame_type] > 1) { ref_mv[0] = xd->ref_mv_stack[ref_frame_type][ref_mv_idx].this_mv; clamp_mv_ref(&ref_mv[0].as_mv, xd->n8_w << MI_SIZE_LOG2, xd->n8_h << MI_SIZE_LOG2, xd); } -#endif nearestmv[0] = ref_mv[0]; } if (compound_ref1_mode(mbmi->mode) == NEWMV) { -#if CONFIG_REF_MV uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); if (xd->ref_mv_count[ref_frame_type] > 1) { ref_mv[1] = xd->ref_mv_stack[ref_frame_type][ref_mv_idx].comp_mv; clamp_mv_ref(&ref_mv[1].as_mv, xd->n8_w << MI_SIZE_LOG2, xd->n8_h << MI_SIZE_LOG2, xd); } -#endif nearestmv[1] = ref_mv[1]; } } else { #endif // CONFIG_EXT_INTER if (mbmi->mode == NEWMV) { for (ref = 0; ref < 1 + is_compound; ++ref) { -#if CONFIG_REF_MV uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); if (xd->ref_mv_count[ref_frame_type] > 1) { ref_mv[ref] = @@ -2102,7 +2012,6 @@ 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]; } } @@ -2371,7 +2280,6 @@ if (frame_is_intra_only(cm)) { read_intra_frame_mode_info(cm, xd, mi_row, mi_col, r); -#if CONFIG_REF_MV for (h = 0; h < y_mis; ++h) { MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols; for (w = 0; w < x_mis; ++w) { @@ -2380,7 +2288,6 @@ mv->ref_frame[1] = NONE_FRAME; } } -#endif } else { read_inter_frame_mode_info(pbi, xd, #if CONFIG_SUPERTX @@ -2395,10 +2302,8 @@ mv->ref_frame[1] = mi->mbmi.ref_frame[1]; mv->mv[0].as_int = mi->mbmi.mv[0].as_int; mv->mv[1].as_int = mi->mbmi.mv[1].as_int; -#if CONFIG_REF_MV mv->pred_mv[0].as_int = mi->mbmi.pred_mv[0].as_int; mv->pred_mv[1].as_int = mi->mbmi.pred_mv[1].as_int; -#endif } } }
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index fbdd0c0..a2c85ce 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -70,9 +70,6 @@ }; #endif static struct av1_token partition_encodings[PARTITION_TYPES]; -#if !CONFIG_REF_MV -static struct av1_token inter_mode_encodings[INTER_MODES]; -#endif #if CONFIG_EXT_INTER static const struct av1_token inter_compound_mode_encodings[INTER_COMPOUND_MODES] = { @@ -162,9 +159,6 @@ av1_tokens_from_tree(intra_mode_encodings, av1_intra_mode_tree); av1_tokens_from_tree(switchable_interp_encodings, av1_switchable_interp_tree); av1_tokens_from_tree(partition_encodings, av1_partition_tree); -#if !CONFIG_REF_MV - av1_tokens_from_tree(inter_mode_encodings, av1_inter_mode_tree); -#endif #if CONFIG_PALETTE av1_tokens_from_tree(palette_size_encodings, av1_palette_size_tree); @@ -251,7 +245,6 @@ static void write_inter_mode(aom_writer *w, PREDICTION_MODE mode, FRAME_CONTEXT *ec_ctx, const int16_t mode_ctx) { -#if CONFIG_REF_MV const int16_t newmv_ctx = mode_ctx & NEWMV_CTX_MASK; const aom_prob newmv_prob = ec_ctx->newmv_prob[newmv_ctx]; @@ -283,23 +276,8 @@ } #undef IS_NEWMV_MODE - -#else // !CONFIG_REF_MV - assert(is_inter_mode(mode)); -#if CONFIG_EC_MULTISYMBOL - aom_write_symbol(w, av1_inter_mode_ind[INTER_OFFSET(mode)], - ec_ctx->inter_mode_cdf[mode_ctx], INTER_MODES); -#else - { - const aom_prob *const inter_probs = ec_ctx->inter_mode_probs[mode_ctx]; - av1_write_token(w, av1_inter_mode_tree, inter_probs, - &inter_mode_encodings[INTER_OFFSET(mode)]); - } -#endif -#endif } -#if CONFIG_REF_MV static void write_drl_idx(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext, aom_writer *w) { uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); @@ -341,7 +319,6 @@ return; } } -#endif #if CONFIG_EXT_INTER static void write_inter_compound_mode(AV1_COMMON *cm, aom_writer *w, @@ -497,7 +474,6 @@ } } -#if CONFIG_REF_MV static void update_inter_mode_probs(AV1_COMMON *cm, aom_writer *w, FRAME_COUNTS *counts) { int i; @@ -519,7 +495,6 @@ av1_cond_prob_diff_update(w, &cm->fc->drl_prob[i], counts->drl_mode[i], probwt); } -#endif #if CONFIG_EXT_INTER static void update_inter_compound_mode_probs(AV1_COMMON *cm, int probwt, @@ -1734,9 +1709,6 @@ #else FRAME_CONTEXT *ec_ctx = cm->fc; #endif -#if !CONFIG_REF_MV - nmv_context *nmvc = &ec_ctx->nmvc; -#endif const MODE_INFO *mi = xd->mi[0]; const struct segmentation *const seg = &cm->seg; @@ -1880,7 +1852,6 @@ int16_t mode_ctx; write_ref_frames(cm, xd, w); -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (is_compound) mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]]; @@ -1888,9 +1859,6 @@ #endif // CONFIG_EXT_INTER mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame, bsize, -1); -#else // CONFIG_REF_MV - mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]]; -#endif // CONFIG_REF_MV // If segment skip is not enabled code the mode. if (!segfeature_active(seg, segment_id, SEG_LVL_SKIP)) { @@ -1902,7 +1870,6 @@ #endif // CONFIG_EXT_INTER write_inter_mode(w, mode, ec_ctx, mode_ctx); -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (mode == NEWMV || mode == NEW_NEWMV || have_nearmv_in_inter_mode(mode)) @@ -1912,7 +1879,6 @@ write_drl_idx(cm, mbmi, mbmi_ext, w); else assert(mbmi->ref_mv_idx == 0); -#endif } } @@ -1928,13 +1894,11 @@ for (idx = 0; idx < 2; idx += num_4x4_w) { const int j = idy * 2 + idx; const PREDICTION_MODE b_mode = mi->bmi[j].as_mode; -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (!is_compound) #endif // CONFIG_EXT_INTER mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame, bsize, j); -#endif #if CONFIG_EXT_INTER if (is_inter_compound_mode(b_mode)) write_inter_compound_mode(cm, w, b_mode, mode_ctx); @@ -1948,45 +1912,35 @@ if (b_mode == NEWMV) { #endif // CONFIG_EXT_INTER for (ref = 0; ref < 1 + is_compound; ++ref) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], ref, mbmi->ref_mv_idx); nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx]; -#endif av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv, #if CONFIG_EXT_INTER &mi->bmi[j].ref_mv[ref].as_mv, #else -#if CONFIG_REF_MV &mi->bmi[j].pred_mv[ref].as_mv, -#else - &mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0].as_mv, -#endif // CONFIG_REF_MV #endif // CONFIG_EXT_INTER nmvc, allow_hp); } } #if CONFIG_EXT_INTER else if (b_mode == NEAREST_NEWMV || b_mode == NEAR_NEWMV) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx]; -#endif av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[1].as_mv, &mi->bmi[j].ref_mv[1].as_mv, nmvc, allow_hp); } else if (b_mode == NEW_NEARESTMV || b_mode == NEW_NEARMV) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx]; -#endif av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[0].as_mv, &mi->bmi[j].ref_mv[0].as_mv, nmvc, allow_hp); } @@ -2001,37 +1955,31 @@ #endif // CONFIG_EXT_INTER int_mv ref_mv; for (ref = 0; ref < 1 + is_compound; ++ref) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], ref, mbmi->ref_mv_idx); nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx]; -#endif ref_mv = mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0]; av1_encode_mv(cpi, w, &mbmi->mv[ref].as_mv, &ref_mv.as_mv, nmvc, allow_hp); } #if CONFIG_EXT_INTER } else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx]; -#endif av1_encode_mv(cpi, w, &mbmi->mv[1].as_mv, &mbmi_ext->ref_mvs[mbmi->ref_frame[1]][0].as_mv, nmvc, allow_hp); } else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx]; -#endif av1_encode_mv(cpi, w, &mbmi->mv[0].as_mv, &mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv, nmvc, allow_hp); @@ -4623,14 +4571,6 @@ AV1_COMMON *const cm = &cpi->common; int frame; for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) { -#if !CONFIG_REF_MV - // With ref-mv, clearing unused global motion models here is - // unsafe, and we need to rely on the recode loop to do it - // instead. See av1_find_mv_refs for details. - if (!cpi->td.rd_counts.global_motion_used[frame]) { - set_default_warp_params(&cm->global_motion[frame]); - } -#endif write_global_motion_params( &cm->global_motion[frame], &cm->prev_frame->global_motion[frame], cm->fc->global_motion_types_prob, w, cm->allow_high_precision_mv); @@ -4762,16 +4702,7 @@ header_bc); #endif // CONFIG_EC_ADAPT } else { -#if CONFIG_REF_MV update_inter_mode_probs(cm, header_bc, counts); -#else -#if !CONFIG_EC_ADAPT - for (i = 0; i < INTER_MODE_CONTEXTS; ++i) { - prob_diff_update(av1_inter_mode_tree, cm->fc->inter_mode_probs[i], - counts->inter_mode[i], INTER_MODES, probwt, header_bc); - } -#endif -#endif #if CONFIG_EXT_INTER update_inter_compound_mode_probs(cm, probwt, header_bc); @@ -4860,12 +4791,7 @@ } #endif - av1_write_nmv_probs(cm, cm->allow_high_precision_mv, header_bc, -#if CONFIG_REF_MV - counts->mv); -#else - &counts->mv); -#endif + av1_write_nmv_probs(cm, cm->allow_high_precision_mv, header_bc, counts->mv); #if !CONFIG_EC_ADAPT update_ext_tx_probs(cm, header_bc); #endif @@ -4882,11 +4808,7 @@ av1_coef_head_cdfs(fc); #endif av1_coef_pareto_cdfs(fc); -#if CONFIG_REF_MV for (i = 0; i < NMV_CONTEXTS; ++i) av1_set_mv_cdfs(&fc->nmvc[i]); -#else - av1_set_mv_cdfs(&fc->nmvc); -#endif #if CONFIG_EC_MULTISYMBOL av1_set_mode_cdfs(cm); #endif
diff --git a/av1/encoder/block.h b/av1/encoder/block.h index 39e08d5..a674050 100644 --- a/av1/encoder/block.h +++ b/av1/encoder/block.h
@@ -17,9 +17,7 @@ #if CONFIG_PVQ #include "av1/encoder/encint.h" #endif -#if CONFIG_REF_MV #include "av1/common/mvref_common.h" -#endif #ifdef __cplusplus extern "C" { @@ -79,13 +77,11 @@ int dc_sign_ctx[MAX_MB_PLANE] [MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; #endif -#if CONFIG_REF_MV uint8_t ref_mv_count[MODE_CTX_REF_FRAMES]; CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE]; #if CONFIG_EXT_INTER int16_t compound_mode_context[MODE_CTX_REF_FRAMES]; #endif // CONFIG_EXT_INTER -#endif } MB_MODE_INFO_EXT; typedef struct { @@ -141,19 +137,12 @@ unsigned int pred_sse[TOTAL_REFS_PER_FRAME]; int pred_mv_sad[TOTAL_REFS_PER_FRAME]; -#if CONFIG_REF_MV int *nmvjointcost; int nmv_vec_cost[NMV_CONTEXTS][MV_JOINTS]; int *nmvcost[NMV_CONTEXTS][2]; int *nmvcost_hp[NMV_CONTEXTS][2]; int **mv_cost_stack[NMV_CONTEXTS]; int *nmvjointsadcost; -#else - int nmvjointcost[MV_JOINTS]; - int *nmvcost[2]; - int *nmvcost_hp[2]; - int nmvjointsadcost[MV_JOINTS]; -#endif int **mvcost; int *nmvsadcost[2]; @@ -174,10 +163,8 @@ #if CONFIG_VAR_TX uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8]; -#if CONFIG_REF_MV uint8_t blk_skip_drl[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8]; #endif -#endif int skip;
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 60b2f30..981773b 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -1067,7 +1067,6 @@ } } -#if CONFIG_REF_MV static void set_ref_and_pred_mvs(MACROBLOCK *const x, int_mv *const mi_pred_mv, int8_t rf_type) { MACROBLOCKD *const xd = &x->e_mbd; @@ -1116,7 +1115,6 @@ } #endif // CONFIG_EXT_INTER } -#endif // CONFIG_REF_MV static void update_state(const AV1_COMP *const cpi, ThreadData *td, PICK_MODE_CONTEXT *ctx, int mi_row, int mi_col, @@ -1144,9 +1142,7 @@ const int mi_height = mi_size_high[bsize]; const int unify_bsize = CONFIG_CB4X4; -#if CONFIG_REF_MV int8_t rf_type; -#endif #if !CONFIG_SUPERTX assert(mi->mbmi.sb_type == bsize); @@ -1159,13 +1155,11 @@ reset_intmv_filter_type(cm, xd, mbmi); #endif -#if CONFIG_REF_MV rf_type = av1_ref_frame_type(mbmi->ref_frame); if (x->mbmi_ext->ref_mv_count[rf_type] > 1 && (mbmi->sb_type >= BLOCK_8X8 || unify_bsize)) { set_ref_and_pred_mvs(x, mi->mbmi.pred_mv, rf_type); } -#endif // CONFIG_REF_MV // If segmentation in use if (seg->enabled) { @@ -1339,9 +1333,7 @@ MV_REF *const frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col; int w, h; -#if CONFIG_REF_MV int8_t rf_type; -#endif *mi_addr = *mi; *x->mbmi_ext = ctx->mbmi_ext; @@ -1352,13 +1344,11 @@ reset_intmv_filter_type(cm, xd, mbmi); #endif -#if CONFIG_REF_MV rf_type = av1_ref_frame_type(mbmi->ref_frame); if (x->mbmi_ext->ref_mv_count[rf_type] > 1 && (mbmi->sb_type >= BLOCK_8X8 || unify_bsize)) { set_ref_and_pred_mvs(x, mi->mbmi.pred_mv, rf_type); } -#endif // CONFIG_REF_MV // If segmentation in use if (seg->enabled) { @@ -2020,7 +2010,6 @@ ctx->dist = rd_cost->dist; } -#if CONFIG_REF_MV static void update_inter_mode_stats(FRAME_COUNTS *counts, PREDICTION_MODE mode, int16_t mode_context) { int16_t mode_ctx = mode_context & NEWMV_CTX_MASK; @@ -2050,7 +2039,6 @@ } } } -#endif static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row, int mi_col @@ -2242,12 +2230,8 @@ if (inter_block && !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { int16_t mode_ctx; -#if !CONFIG_REF_MV - mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]]; -#endif if (bsize >= BLOCK_8X8 || unify_bsize) { const PREDICTION_MODE mode = mbmi->mode; -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (has_second_ref(mbmi)) { mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]]; @@ -2298,14 +2282,6 @@ } } } -#else -#if CONFIG_EXT_INTER - if (is_inter_compound_mode(mode)) - ++counts->inter_compound_mode[mode_ctx][INTER_COMPOUND_OFFSET(mode)]; - else -#endif // CONFIG_EXT_INTER - ++counts->inter_mode[mode_ctx][INTER_OFFSET(mode)]; -#endif } else { const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; const int num_4x4_h = num_4x4_blocks_high_lookup[bsize]; @@ -2314,7 +2290,6 @@ for (idx = 0; idx < 2; idx += num_4x4_w) { const int j = idy * 2 + idx; const PREDICTION_MODE b_mode = mi->bmi[j].as_mode; -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (has_second_ref(mbmi)) { mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]]; @@ -2328,15 +2303,6 @@ #if CONFIG_EXT_INTER } #endif // CONFIG_EXT_INTER -#else -#if CONFIG_EXT_INTER - if (is_inter_compound_mode(b_mode)) - ++counts->inter_compound_mode[mode_ctx] - [INTER_COMPOUND_OFFSET(b_mode)]; - else -#endif // CONFIG_EXT_INTER - ++counts->inter_mode[mode_ctx][INTER_OFFSET(b_mode)]; -#endif } } } @@ -5179,9 +5145,7 @@ x->min_partition_size = AOMMIN(x->min_partition_size, cm->sb_size); x->max_partition_size = AOMMIN(x->max_partition_size, cm->sb_size); -#if CONFIG_REF_MV cm->setup_mi(cm); -#endif xd->mi = cm->mi_grid_visible; xd->mi[0] = cm->mi; @@ -5364,10 +5328,8 @@ #if CONFIG_VAR_TX x->txb_split_count = 0; -#if CONFIG_REF_MV av1_zero(x->blk_skip_drl); #endif -#endif if (cpi->sf.partition_search_type == VAR_BASED_PARTITION && cpi->td.var_root[0] == NULL)
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c index a2a53f8..064fdc6 100644 --- a/av1/encoder/encodemv.c +++ b/av1/encoder/encodemv.c
@@ -171,7 +171,6 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w, nmv_context_counts *const nmv_counts) { int i; -#if CONFIG_REF_MV int nmv_ctx = 0; for (nmv_ctx = 0; nmv_ctx < NMV_CONTEXTS; ++nmv_ctx) { nmv_context *const mvc = &cm->fc->nmvc[nmv_ctx]; @@ -213,46 +212,6 @@ } } } -#else - nmv_context *const mvc = &cm->fc->nmvc; - nmv_context_counts *const counts = nmv_counts; - -#if !CONFIG_EC_ADAPT - write_mv_update(av1_mv_joint_tree, mvc->joints, counts->joints, MV_JOINTS, w); - - for (i = 0; i < 2; ++i) { - int j; - nmv_component *comp = &mvc->comps[i]; - nmv_component_counts *comp_counts = &counts->comps[i]; - - update_mv(w, comp_counts->sign, &comp->sign, MV_UPDATE_PROB); - write_mv_update(av1_mv_class_tree, comp->classes, comp_counts->classes, - MV_CLASSES, w); - write_mv_update(av1_mv_class0_tree, comp->class0, comp_counts->class0, - CLASS0_SIZE, w); - for (j = 0; j < MV_OFFSET_BITS; ++j) - update_mv(w, comp_counts->bits[j], &comp->bits[j], MV_UPDATE_PROB); - } - - for (i = 0; i < 2; ++i) { - int j; - for (j = 0; j < CLASS0_SIZE; ++j) { - write_mv_update(av1_mv_fp_tree, mvc->comps[i].class0_fp[j], - counts->comps[i].class0_fp[j], MV_FP_SIZE, w); - } - write_mv_update(av1_mv_fp_tree, mvc->comps[i].fp, counts->comps[i].fp, - MV_FP_SIZE, w); - } -#endif // !CONFIG_EC_ADAPT - - if (usehp) { - for (i = 0; i < 2; ++i) { - update_mv(w, counts->comps[i].class0_hp, &mvc->comps[i].class0_hp, - MV_UPDATE_PROB); - update_mv(w, counts->comps[i].hp, &mvc->comps[i].hp, MV_UPDATE_PROB); - } - } -#endif } void av1_encode_mv(AV1_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref, @@ -306,135 +265,101 @@ #if CONFIG_EXT_INTER static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext, - const int_mv mvs[2], -#if CONFIG_REF_MV - const int_mv pred_mvs[2], -#endif + const int_mv mvs[2], const int_mv pred_mvs[2], nmv_context_counts *nmv_counts) { int i; PREDICTION_MODE mode = mbmi->mode; -#if !CONFIG_REF_MV - nmv_context_counts *counts = nmv_counts; -#endif if (mode == NEWMV || mode == NEW_NEWMV) { for (i = 0; i < 1 + has_second_ref(mbmi); ++i) { const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv; const MV diff = { mvs[i].as_mv.row - ref->row, mvs[i].as_mv.col - ref->col }; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx); nmv_context_counts *counts = &nmv_counts[nmv_ctx]; (void)pred_mvs; -#endif av1_inc_mv(&diff, counts, 1); } } else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) { const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[1]][0].as_mv; const MV diff = { mvs[1].as_mv.row - ref->row, mvs[1].as_mv.col - ref->col }; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); nmv_context_counts *counts = &nmv_counts[nmv_ctx]; -#endif av1_inc_mv(&diff, counts, 1); } else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) { const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv; const MV diff = { mvs[0].as_mv.row - ref->row, mvs[0].as_mv.col - ref->col }; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); nmv_context_counts *counts = &nmv_counts[nmv_ctx]; -#endif av1_inc_mv(&diff, counts, 1); } } static void inc_mvs_sub8x8(const MODE_INFO *mi, int block, const int_mv mvs[2], -#if CONFIG_REF_MV const MB_MODE_INFO_EXT *mbmi_ext, -#endif nmv_context_counts *nmv_counts) { int i; PREDICTION_MODE mode = mi->bmi[block].as_mode; -#if CONFIG_REF_MV const MB_MODE_INFO *mbmi = &mi->mbmi; -#else - nmv_context_counts *counts = nmv_counts; -#endif if (mode == NEWMV || mode == NEW_NEWMV) { for (i = 0; i < 1 + has_second_ref(&mi->mbmi); ++i) { const MV *ref = &mi->bmi[block].ref_mv[i].as_mv; const MV diff = { mvs[i].as_mv.row - ref->row, mvs[i].as_mv.col - ref->col }; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx); nmv_context_counts *counts = &nmv_counts[nmv_ctx]; -#endif av1_inc_mv(&diff, counts, 1); } } else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) { const MV *ref = &mi->bmi[block].ref_mv[1].as_mv; const MV diff = { mvs[1].as_mv.row - ref->row, mvs[1].as_mv.col - ref->col }; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); nmv_context_counts *counts = &nmv_counts[nmv_ctx]; -#endif av1_inc_mv(&diff, counts, 1); } else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) { const MV *ref = &mi->bmi[block].ref_mv[0].as_mv; const MV diff = { mvs[0].as_mv.row - ref->row, mvs[0].as_mv.col - ref->col }; -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); nmv_context_counts *counts = &nmv_counts[nmv_ctx]; -#endif av1_inc_mv(&diff, counts, 1); } } #else static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext, - const int_mv mvs[2], -#if CONFIG_REF_MV - const int_mv pred_mvs[2], -#endif + const int_mv mvs[2], const int_mv pred_mvs[2], nmv_context_counts *nmv_counts) { int i; -#if !CONFIG_REF_MV - nmv_context_counts *counts = nmv_counts; -#endif for (i = 0; i < 1 + has_second_ref(mbmi); ++i) { -#if CONFIG_REF_MV int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx); nmv_context_counts *counts = &nmv_counts[nmv_ctx]; const MV *ref = &pred_mvs[i].as_mv; -#else - const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv; -#endif const MV diff = { mvs[i].as_mv.row - ref->row, mvs[i].as_mv.col - ref->col }; av1_inc_mv(&diff, counts, 1); @@ -464,20 +389,11 @@ #if CONFIG_EXT_INTER if (have_newmv_in_inter_mode(mi->bmi[i].as_mode)) - inc_mvs_sub8x8(mi, i, mi->bmi[i].as_mv, -#if CONFIG_REF_MV - mbmi_ext, td->counts->mv); -#else - &td->counts->mv); -#endif + inc_mvs_sub8x8(mi, i, mi->bmi[i].as_mv, mbmi_ext, td->counts->mv); #else if (mi->bmi[i].as_mode == NEWMV) - inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv, -#if CONFIG_REF_MV - mi->bmi[i].pred_mv, td->counts->mv); -#else - &td->counts->mv); -#endif + inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv, mi->bmi[i].pred_mv, + td->counts->mv); #endif // CONFIG_EXT_INTER } } @@ -487,11 +403,6 @@ #else if (mbmi->mode == NEWMV) #endif // CONFIG_EXT_INTER - inc_mvs(mbmi, mbmi_ext, mbmi->mv, -#if CONFIG_REF_MV - mbmi->pred_mv, td->counts->mv); -#else - &td->counts->mv); -#endif + inc_mvs(mbmi, mbmi_ext, mbmi->mv, mbmi->pred_mv, td->counts->mv); } }
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index 8579b90..0a0d43e 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -246,7 +246,6 @@ MACROBLOCK *const mb = &cpi->td.mb; cpi->common.allow_high_precision_mv = allow_high_precision_mv; -#if CONFIG_REF_MV if (cpi->common.allow_high_precision_mv) { int i; for (i = 0; i < NMV_CONTEXTS; ++i) { @@ -260,15 +259,6 @@ mb->mvsadcost = mb->nmvsadcost; } } -#else - if (cpi->common.allow_high_precision_mv) { - mb->mvcost = mb->nmvcost_hp; - mb->mvsadcost = mb->nmvcost_hp; - } else { - mb->mvcost = mb->nmvcost; - mb->mvsadcost = mb->nmvcost; - } -#endif } static BLOCK_SIZE select_sb_size(const AV1_COMP *const cpi) { @@ -512,23 +502,17 @@ static void save_coding_context(AV1_COMP *cpi) { CODING_CONTEXT *const cc = &cpi->coding_context; AV1_COMMON *cm = &cpi->common; -#if CONFIG_REF_MV int i; -#endif -// Stores a snapshot of key state variables which can subsequently be -// restored with a call to av1_restore_coding_context. These functions are -// intended for use in a re-code loop in av1_compress_frame where the -// quantizer value is adjusted between loop iterations. -#if CONFIG_REF_MV + // Stores a snapshot of key state variables which can subsequently be + // restored with a call to av1_restore_coding_context. These functions are + // intended for use in a re-code loop in av1_compress_frame where the + // quantizer value is adjusted between loop iterations. for (i = 0; i < NMV_CONTEXTS; ++i) { av1_copy(cc->nmv_vec_cost[i], cpi->td.mb.nmv_vec_cost[i]); av1_copy(cc->nmv_costs, cpi->nmv_costs); av1_copy(cc->nmv_costs_hp, cpi->nmv_costs_hp); } -#else - av1_copy(cc->nmvjointcost, cpi->td.mb.nmvjointcost); -#endif av1_copy(cc->nmvcosts, cpi->nmvcosts); av1_copy(cc->nmvcosts_hp, cpi->nmvcosts_hp); @@ -542,21 +526,15 @@ static void restore_coding_context(AV1_COMP *cpi) { CODING_CONTEXT *const cc = &cpi->coding_context; AV1_COMMON *cm = &cpi->common; -#if CONFIG_REF_MV int i; -#endif -// Restore key state variables to the snapshot state stored in the -// previous call to av1_save_coding_context. -#if CONFIG_REF_MV + // Restore key state variables to the snapshot state stored in the + // previous call to av1_save_coding_context. for (i = 0; i < NMV_CONTEXTS; ++i) { av1_copy(cpi->td.mb.nmv_vec_cost[i], cc->nmv_vec_cost[i]); av1_copy(cpi->nmv_costs, cc->nmv_costs); av1_copy(cpi->nmv_costs_hp, cc->nmv_costs_hp); } -#else - av1_copy(cpi->td.mb.nmvjointcost, cc->nmvjointcost); -#endif av1_copy(cpi->nmvcosts, cc->nmvcosts); av1_copy(cpi->nmvcosts_hp, cc->nmvcosts_hp); @@ -2111,15 +2089,6 @@ #endif #define log2f(x) (log(x) / (float)M_LOG2_E) -#if !CONFIG_REF_MV -static void cal_nmvjointsadcost(int *mvjointsadcost) { - mvjointsadcost[0] = 600; - mvjointsadcost[1] = 300; - mvjointsadcost[2] = 300; - mvjointsadcost[3] = 300; -} -#endif - static void cal_nmvsadcosts(int *mvsadcost[2]) { int i = 1; @@ -2228,12 +2197,10 @@ realloc_segmentation_maps(cpi); -#if CONFIG_REF_MV for (i = 0; i < NMV_CONTEXTS; ++i) { memset(cpi->nmv_costs, 0, sizeof(cpi->nmv_costs)); memset(cpi->nmv_costs_hp, 0, sizeof(cpi->nmv_costs_hp)); } -#endif memset(cpi->nmvcosts, 0, sizeof(cpi->nmvcosts)); memset(cpi->nmvcosts_hp, 0, sizeof(cpi->nmvcosts_hp)); @@ -2301,20 +2268,12 @@ cpi->first_time_stamp_ever = INT64_MAX; -#if CONFIG_REF_MV for (i = 0; i < NMV_CONTEXTS; ++i) { cpi->td.mb.nmvcost[i][0] = &cpi->nmv_costs[i][0][MV_MAX]; cpi->td.mb.nmvcost[i][1] = &cpi->nmv_costs[i][1][MV_MAX]; cpi->td.mb.nmvcost_hp[i][0] = &cpi->nmv_costs_hp[i][0][MV_MAX]; cpi->td.mb.nmvcost_hp[i][1] = &cpi->nmv_costs_hp[i][1][MV_MAX]; } -#else - cal_nmvjointsadcost(cpi->td.mb.nmvjointsadcost); - cpi->td.mb.nmvcost[0] = &cpi->nmvcosts[0][MV_MAX]; - cpi->td.mb.nmvcost[1] = &cpi->nmvcosts[1][MV_MAX]; - cpi->td.mb.nmvcost_hp[0] = &cpi->nmvcosts_hp[0][MV_MAX]; - cpi->td.mb.nmvcost_hp[1] = &cpi->nmvcosts_hp[1][MV_MAX]; -#endif cpi->td.mb.nmvsadcost[0] = &cpi->nmvsadcosts[0][MV_MAX]; cpi->td.mb.nmvsadcost[1] = &cpi->nmvsadcosts[1][MV_MAX]; cal_nmvsadcosts(cpi->td.mb.nmvsadcost); @@ -3059,11 +3018,8 @@ cpi->gmparams_cost[i]) { set_default_warp_params(&cm->global_motion[i]); cpi->gmparams_cost[i] = 0; -#if CONFIG_REF_MV recode = 1; -#else recode |= (rdc->global_motion_used[i] > 0); -#endif } } return recode;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index 3e297c8..40668df 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -58,11 +58,9 @@ int nmvcosts[2][MV_VALS]; int nmvcosts_hp[2][MV_VALS]; -#if CONFIG_REF_MV int nmv_vec_cost[NMV_CONTEXTS][MV_JOINTS]; int nmv_costs[NMV_CONTEXTS][2][MV_VALS]; int nmv_costs_hp[NMV_CONTEXTS][2][MV_VALS]; -#endif // 0 = Intra, Last, GF, ARF signed char last_ref_lf_deltas[TOTAL_REFS_PER_FRAME]; @@ -433,10 +431,8 @@ CODING_CONTEXT coding_context; -#if CONFIG_REF_MV int nmv_costs[NMV_CONTEXTS][2][MV_VALS]; int nmv_costs_hp[NMV_CONTEXTS][2][MV_VALS]; -#endif int nmvcosts[2][MV_VALS]; int nmvcosts_hp[2][MV_VALS]; @@ -544,12 +540,10 @@ search_site_config ss_cfg; int mbmode_cost[BLOCK_SIZE_GROUPS][INTRA_MODES]; -#if CONFIG_REF_MV int newmv_mode_cost[NEWMV_MODE_CONTEXTS][2]; int zeromv_mode_cost[ZEROMV_MODE_CONTEXTS][2]; int refmv_mode_cost[REFMV_MODE_CONTEXTS][2]; int drl_mode_cost0[DRL_MODE_CONTEXTS][2]; -#endif unsigned int inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES]; #if CONFIG_EXT_INTER
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c index f06e569..cffa26b 100644 --- a/av1/encoder/rd.c +++ b/av1/encoder/rd.c
@@ -330,7 +330,6 @@ } } -#if CONFIG_REF_MV void av1_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int ref, int ref_mv_idx) { MB_MODE_INFO_EXT *mbmi_ext = x->mbmi_ext; @@ -343,16 +342,13 @@ x->mvsadcost = x->mvcost; x->nmvjointsadcost = x->nmvjointcost; } -#endif void av1_initialize_rd_consts(AV1_COMP *cpi) { AV1_COMMON *const cm = &cpi->common; MACROBLOCK *const x = &cpi->td.mb; RD_OPT *const rd = &cpi->rd; int i; -#if CONFIG_REF_MV int nmv_ctx; -#endif aom_clear_system_state(); @@ -363,7 +359,6 @@ set_block_thresholds(cm, rd); -#if CONFIG_REF_MV for (nmv_ctx = 0; nmv_ctx < NMV_CONTEXTS; ++nmv_ctx) { av1_build_nmv_cost_table( x->nmv_vec_cost[nmv_ctx], @@ -375,11 +370,6 @@ x->nmvjointcost = x->nmv_vec_cost[0]; x->mvsadcost = x->mvcost; x->nmvjointsadcost = x->nmvjointcost; -#else - av1_build_nmv_cost_table( - x->nmvjointcost, cm->allow_high_precision_mv ? x->nmvcost_hp : x->nmvcost, - &cm->fc->nmvc, cm->allow_high_precision_mv); -#endif if (cpi->oxcf.pass != 1) { av1_fill_token_costs(x->token_costs, cm->fc->coef_probs); @@ -425,7 +415,6 @@ fill_mode_costs(cpi); if (!frame_is_intra_only(cm)) { -#if CONFIG_REF_MV for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i) { cpi->newmv_mode_cost[i][0] = av1_cost_bit(cm->fc->newmv_prob[i], 0); cpi->newmv_mode_cost[i][1] = av1_cost_bit(cm->fc->newmv_prob[i], 1); @@ -445,11 +434,6 @@ cpi->drl_mode_cost0[i][0] = av1_cost_bit(cm->fc->drl_prob[i], 0); cpi->drl_mode_cost0[i][1] = av1_cost_bit(cm->fc->drl_prob[i], 1); } -#else - for (i = 0; i < INTER_MODE_CONTEXTS; ++i) - av1_cost_tokens((int *)cpi->inter_mode_cost[i], - cm->fc->inter_mode_probs[i], av1_inter_mode_tree); -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER for (i = 0; i < INTER_MODE_CONTEXTS; ++i) av1_cost_tokens((int *)cpi->inter_compound_mode_cost[i],
diff --git a/av1/encoder/rd.h b/av1/encoder/rd.h index c0ac1f7..d4e54ea 100644 --- a/av1/encoder/rd.h +++ b/av1/encoder/rd.h
@@ -454,10 +454,8 @@ void av1_init_me_luts(void); -#if CONFIG_REF_MV void av1_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int ref, int ref_mv_idx); -#endif void av1_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, const struct macroblockd_plane *pd,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index cbe6402..737d9cd 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -1923,9 +1923,7 @@ // transforms should be considered for pruning prune = prune_tx_types(cpi, bs, x, xd, -1); -#if CONFIG_REF_MV if (mbmi->ref_mv_idx > 0 && tx_type != DCT_DCT) return 1; -#endif // CONFIG_REF_MV if (FIXED_TX_TYPE && tx_type != get_default_tx_type(0, xd, 0, tx_size)) return 1; if (!is_inter && x->use_default_intra_tx_type && @@ -2190,9 +2188,7 @@ #endif TX_TYPE tx_type; for (tx_type = tx_start; tx_type < tx_end; ++tx_type) { -#if CONFIG_REF_MV if (mbmi->ref_mv_idx > 0 && tx_type != DCT_DCT) continue; -#endif // CONFIG_REF_MV const TX_SIZE rect_tx_size = max_txsize_rect_lookup[bs]; RD_STATS this_rd_stats; int ext_tx_set = @@ -4890,7 +4886,6 @@ } #endif -#if CONFIG_REF_MV int mode_cost = 0; int16_t mode_ctx = mode_context & NEWMV_CTX_MASK; int16_t is_all_zero_mv = mode_context & (1 << ALL_ZERO_FLAG_OFFSET); @@ -4921,10 +4916,6 @@ return mode_cost; } } -#else - assert(is_inter_mode(mode)); - return cpi->inter_mode_cost[mode_context][INTER_OFFSET(mode)]; -#endif // CONFIG_REF_MV } #if CONFIG_EXT_INTER @@ -4973,7 +4964,6 @@ lower_mv_precision(&this_mv[0].as_mv, 0); #endif // CONFIG_EXT_INTER -#if CONFIG_REF_MV for (idx = 0; idx < 1 + is_compound; ++idx) { this_mv[idx] = seg_mvs[mbmi->ref_frame[idx]]; av1_set_mvcost(x, mbmi->ref_frame[idx], idx, mbmi->ref_mv_idx); @@ -4983,17 +4973,6 @@ } (void)mvjcost; (void)mvcost; -#else - thismvcost += av1_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv, - mvjcost, mvcost, MV_COST_WEIGHT_SUB); -#if !CONFIG_EXT_INTER - if (is_compound) { - this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int; - thismvcost += av1_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv, - mvjcost, mvcost, MV_COST_WEIGHT_SUB); - } -#endif // !CONFIG_EXT_INTER -#endif // CONFIG_REF_MV break; case NEARMV: case NEARESTMV: @@ -5031,14 +5010,10 @@ lower_mv_precision(&this_mv[0].as_mv, 0); if (!cpi->common.allow_high_precision_mv) lower_mv_precision(&this_mv[1].as_mv, 0); -#if CONFIG_REF_MV av1_set_mvcost(x, mbmi->ref_frame[0], 0, mbmi->ref_mv_idx); -#endif thismvcost += av1_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); -#if CONFIG_REF_MV av1_set_mvcost(x, mbmi->ref_frame[1], 1, mbmi->ref_mv_idx); -#endif thismvcost += av1_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); break; @@ -5047,9 +5022,7 @@ this_mv[0].as_int = seg_mvs[mbmi->ref_frame[0]].as_int; if (!cpi->common.allow_high_precision_mv) lower_mv_precision(&this_mv[0].as_mv, 0); -#if CONFIG_REF_MV av1_set_mvcost(x, mbmi->ref_frame[0], 0, mbmi->ref_mv_idx); -#endif thismvcost += av1_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); this_mv[1].as_int = frame_mv[mode][mbmi->ref_frame[1]].as_int; @@ -5060,9 +5033,7 @@ this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int; if (!cpi->common.allow_high_precision_mv) lower_mv_precision(&this_mv[1].as_mv, 0); -#if CONFIG_REF_MV av1_set_mvcost(x, mbmi->ref_frame[1], 1, mbmi->ref_mv_idx); -#endif thismvcost += av1_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); break; @@ -5099,7 +5070,6 @@ mic->bmi[i].as_mode = mode; -#if CONFIG_REF_MV if (mode == NEWMV) { mic->bmi[i].pred_mv[0].as_int = mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_int; @@ -5110,13 +5080,11 @@ mic->bmi[i].pred_mv[0].as_int = this_mv[0].as_int; if (is_compound) mic->bmi[i].pred_mv[1].as_int = this_mv[1].as_int; } -#endif // CONFIG_REF_MV for (idy = 0; idy < num_4x4_blocks_high; ++idy) for (idx = 0; idx < num_4x4_blocks_wide; ++idx) memmove(&mic->bmi[i + idy * 2 + idx], &mic->bmi[i], sizeof(mic->bmi[i])); -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (is_compound) mode_ctx = mbmi_ext->compound_mode_context[mbmi->ref_frame[0]]; @@ -5124,9 +5092,6 @@ #endif // CONFIG_EXT_INTER mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame, mbmi->sb_type, i); -#else // CONFIG_REF_MV - mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]]; -#endif // CONFIG_REF_MV return cost_mv_ref(cpi, mode, mode_ctx) + thismvcost; } @@ -5248,9 +5213,7 @@ int64_t bsse; int64_t brdcost; int_mv mvs[2]; -#if CONFIG_REF_MV int_mv pred_mv[2]; -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER int_mv ref_mv[2]; #endif // CONFIG_EXT_INTER @@ -5317,9 +5280,9 @@ // TODO(aconverse): Find out if this is still productive then clean up or remove static int check_best_zero_mv( const AV1_COMP *const cpi, const int16_t mode_context[TOTAL_REFS_PER_FRAME], -#if CONFIG_REF_MV && CONFIG_EXT_INTER +#if CONFIG_EXT_INTER const int16_t compound_mode_context[TOTAL_REFS_PER_FRAME], -#endif // CONFIG_REF_MV && CONFIG_EXT_INTER +#endif // CONFIG_EXT_INTER int_mv frame_mv[MB_MODE_COUNT][TOTAL_REFS_PER_FRAME], int this_mode, const MV_REFERENCE_FRAME ref_frames[2], const BLOCK_SIZE bsize, int block, int mi_row, int mi_col) { @@ -5351,21 +5314,12 @@ frame_mv[this_mode][ref_frames[0]].as_int == zeromv[0].as_int && (ref_frames[1] <= INTRA_FRAME || frame_mv[this_mode][ref_frames[1]].as_int == zeromv[1].as_int)) { -#if CONFIG_REF_MV int16_t rfc = av1_mode_context_analyzer(mode_context, ref_frames, bsize, block); -#else - int16_t rfc = mode_context[ref_frames[0]]; -#endif // CONFIG_REF_MV int c1 = cost_mv_ref(cpi, NEARMV, rfc); int c2 = cost_mv_ref(cpi, NEARESTMV, rfc); int c3 = cost_mv_ref(cpi, ZEROMV, rfc); -#if !CONFIG_REF_MV - (void)bsize; - (void)block; -#endif // !CONFIG_REF_MV - if (this_mode == NEARMV) { if (c1 > c3) return 0; } else if (this_mode == NEARESTMV) { @@ -5391,11 +5345,7 @@ this_mode == ZERO_ZEROMV) && frame_mv[this_mode][ref_frames[0]].as_int == zeromv[0].as_int && frame_mv[this_mode][ref_frames[1]].as_int == zeromv[1].as_int) { -#if CONFIG_REF_MV int16_t rfc = compound_mode_context[ref_frames[0]]; -#else - int16_t rfc = mode_context[ref_frames[0]]; -#endif // CONFIG_REF_MV int c1 = cost_mv_ref(cpi, NEAREST_NEARMV, rfc); int c2 = cost_mv_ref(cpi, NEAREST_NEARESTMV, rfc); int c3 = cost_mv_ref(cpi, ZERO_ZEROMV, rfc); @@ -5592,9 +5542,7 @@ best_mv->col >>= 3; best_mv->row >>= 3; -#if CONFIG_REF_MV av1_set_mvcost(x, refs[id], id, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV // Small-range full-pixel motion search. bestsme = @@ -5669,9 +5617,7 @@ for (i = 0; i < MAX_MB_PLANE; i++) xd->plane[i].pre[ref] = backup_yv12[ref][i]; } -#if CONFIG_REF_MV av1_set_mvcost(x, refs[ref], ref, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER && !CONFIG_CB4X4 if (bsize >= BLOCK_8X8) #endif // CONFIG_EXT_INTER && !CONFIG_CB4X4 @@ -5687,7 +5633,7 @@ } } -#if CONFIG_REF_MV && !CONFIG_EXT_INTER +#if !CONFIG_EXT_INTER static void update_mv_search_and_seg_mvs( int *const run_mv_search, int_mv *const seg_mvs, int has_second_rf, const MV_REFERENCE_FRAME *const ref_frame, @@ -5710,7 +5656,7 @@ } } } -#endif // CONFIG_REF_MV && !CONFIG_EXT_INTER +#endif // !CONFIG_EXT_INTER static int64_t rd_pick_inter_best_sub8x8_mode( const AV1_COMP *const cpi, MACROBLOCK *x, int_mv *best_ref_mv, @@ -5722,9 +5668,7 @@ #endif // CONFIG_EXT_INTER BEST_SEG_INFO *bsi_buf, int filter_idx, int mi_row, int mi_col) { BEST_SEG_INFO *bsi = bsi_buf + filter_idx; -#if CONFIG_REF_MV int_mv tmp_ref_mv[2]; -#endif // CONFIG_REF_MV MACROBLOCKD *xd = &x->e_mbd; MODE_INFO *mi = xd->mi[0]; MB_MODE_INFO *mbmi = &mi->mbmi; @@ -5773,7 +5717,6 @@ for (idx = 0; idx < 4; ++idx) bsi->modes[idx] = ZEROMV; -#if CONFIG_REF_MV for (idx = 0; idx < 4; ++idx) { for (k = NEARESTMV; k <= NEWMV; ++k) { bsi->rdstat[idx][INTER_OFFSET(k)].pred_mv[0].as_int = INVALID_MV; @@ -5783,7 +5726,6 @@ bsi->rdstat[idx][INTER_OFFSET(k)].mvs[1].as_int = INVALID_MV; } } -#endif // CONFIG_REF_MV memcpy(t_above, pd->above_context, sizeof(t_above)); memcpy(t_left, pd->left_context, sizeof(t_left)); @@ -5805,10 +5747,8 @@ int64_t new_best_rd = INT64_MAX; const int index = idy * 2 + idx; int ref; -#if CONFIG_REF_MV CANDIDATE_MV ref_mv_stack[2][MAX_REF_MV_STACK_SIZE]; uint8_t ref_mv_count[2]; -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER int_mv ref_mvs_sub8x8[2][2]; #endif // CONFIG_EXT_INTER @@ -5835,21 +5775,17 @@ frame_mv[ZEROMV][frame].as_int = 0; #endif // CONFIG_GLOBAL_MOTION av1_append_sub8x8_mvs_for_idx(cm, xd, index, ref, mi_row, mi_col, -#if CONFIG_REF_MV ref_mv_stack[ref], &ref_mv_count[ref], -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER mv_ref_list, #endif // CONFIG_EXT_INTER &frame_mv[NEARESTMV][frame], &frame_mv[NEARMV][frame]); -#if CONFIG_REF_MV tmp_ref_mv[ref] = frame_mv[NEARESTMV][mbmi->ref_frame[ref]]; lower_mv_precision(&tmp_ref_mv[ref].as_mv, cm->allow_high_precision_mv); bsi->ref_mv[ref] = &tmp_ref_mv[ref]; mbmi_ext->ref_mvs[frame][0] = tmp_ref_mv[ref]; -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER mv_ref_list[0].as_int = frame_mv[NEARESTMV][frame].as_int; @@ -5917,7 +5853,6 @@ bsi->rdstat[index][mode_idx].brdcost = INT64_MAX; if (!(inter_mode_mask & (1 << this_mode))) continue; -#if CONFIG_REF_MV run_mv_search = 2; #if !CONFIG_EXT_INTER if (filter_idx > 0 && this_mode == NEWMV) { @@ -5938,7 +5873,6 @@ } } #endif // !CONFIG_EXT_INTER -#endif // CONFIG_REF_MV #if CONFIG_GLOBAL_MOTION if (cm->global_motion[mbmi->ref_frame[0]].wmtype == IDENTITY && @@ -5947,9 +5881,9 @@ #endif // CONFIG_GLOBAL_MOTION if (!check_best_zero_mv(cpi, mbmi_ext->mode_context, -#if CONFIG_REF_MV && CONFIG_EXT_INTER +#if CONFIG_EXT_INTER mbmi_ext->compound_mode_context, -#endif // CONFIG_REF_MV && CONFIG_EXT_INTER +#endif // CONFIG_EXT_INTER frame_mv, this_mode, mbmi->ref_frame, bsize, index, mi_row, mi_col)) continue; @@ -5990,13 +5924,6 @@ bsi->mvp.as_int = bsi->ref_mv[0]->as_int; #else // use previous block's result as next block's MV predictor. -#if !CONFIG_REF_MV - if (index > 0) { - bsi->mvp.as_int = mi->bmi[index - 1].as_mv[0].as_int; - if (index == 2) - bsi->mvp.as_int = mi->bmi[index - 2].as_mv[0].as_int; - } -#endif // !CONFIG_REF_MV #endif // CONFIG_EXT_INTER max_mv = (index == 0) ? (int)x->max_mv_context[mbmi->ref_frame[0]] : AOMMAX(abs(bsi->mvp.as_mv.row), @@ -6013,13 +5940,8 @@ step_param = cpi->mv_step_param; } -#if CONFIG_REF_MV mvp_full.row = bsi->ref_mv[0]->as_mv.row >> 3; mvp_full.col = bsi->ref_mv[0]->as_mv.col >> 3; -#else - mvp_full.row = bsi->mvp.as_mv.row >> 3; - mvp_full.col = bsi->mvp.as_mv.col >> 3; -#endif // CONFIG_REF_MV if (cpi->sf.adaptive_motion_search) { mvp_full.row = x->pred_mv[mbmi->ref_frame[0]].row >> 3; @@ -6034,9 +5956,7 @@ x->best_mv.as_int = x->second_best_mv.as_int = INVALID_MV; -#if CONFIG_REF_MV av1_set_mvcost(x, mbmi->ref_frame[0], 0, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV bestsme = av1_full_pixel_search( cpi, x, bsize, &mvp_full, step_param, sadpb, cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL, @@ -6218,7 +6138,6 @@ if (num_4x4_blocks_high > 1) bsi->rdstat[index + 2][mode_idx].mvs[ref].as_int = mode_mv[this_mode][ref].as_int; -#if CONFIG_REF_MV bsi->rdstat[index][mode_idx].pred_mv[ref].as_int = mi->bmi[index].pred_mv[ref].as_int; if (num_4x4_blocks_wide > 1) @@ -6227,7 +6146,6 @@ if (num_4x4_blocks_high > 1) bsi->rdstat[index + 2][mode_idx].pred_mv[ref].as_int = mi->bmi[index].pred_mv[ref].as_int; -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER bsi->rdstat[index][mode_idx].ref_mv[ref].as_int = bsi->ref_mv[ref]->as_int; @@ -6289,7 +6207,6 @@ if (!subpelmv && have_ref && ref_bsi->rdstat[index][mode_idx].brdcost < INT64_MAX) { -#if CONFIG_REF_MV bsi->rdstat[index][mode_idx].byrate = ref_bsi->rdstat[index][mode_idx].byrate; bsi->rdstat[index][mode_idx].bdist = @@ -6311,10 +6228,6 @@ memcpy(bsi->rdstat[index][mode_idx].tl, ref_bsi->rdstat[index][mode_idx].tl, sizeof(bsi->rdstat[index][mode_idx].tl)); -#else - memcpy(&bsi->rdstat[index][mode_idx], - &ref_bsi->rdstat[index][mode_idx], sizeof(SEG_RDSTAT)); -#endif // CONFIG_REF_MV if (num_4x4_blocks_wide > 1) bsi->rdstat[index + 1][mode_idx].eobs = ref_bsi->rdstat[index + 1][mode_idx].eobs; @@ -6323,7 +6236,6 @@ ref_bsi->rdstat[index + 2][mode_idx].eobs; if (bsi->rdstat[index][mode_idx].brdcost < new_best_rd) { -#if CONFIG_REF_MV // If the NEWMV mode is using the same motion vector as the // NEARESTMV mode, skip the rest rate-distortion calculations // and use the inferred motion vector modes. @@ -6340,7 +6252,6 @@ continue; } } -#endif // CONFIG_REF_MV mode_selected = this_mode; new_best_rd = bsi->rdstat[index][mode_idx].brdcost; #if CONFIG_PVQ @@ -6371,7 +6282,6 @@ } if (bsi->rdstat[index][mode_idx].brdcost < new_best_rd) { -#if CONFIG_REF_MV // If the NEWMV mode is using the same motion vector as the // NEARESTMV mode, skip the rest rate-distortion calculations // and use the inferred motion vector modes. @@ -6388,7 +6298,6 @@ continue; } } -#endif // CONFIG_REF_MV mode_selected = this_mode; new_best_rd = bsi->rdstat[index][mode_idx].brdcost; @@ -6599,11 +6508,9 @@ mi->bmi[idx].as_mv[0].as_int = bsi->rdstat[idx][mode_idx].mvs[0].as_int; if (has_second_ref(mbmi)) mi->bmi[idx].as_mv[1].as_int = bsi->rdstat[idx][mode_idx].mvs[1].as_int; -#if CONFIG_REF_MV mi->bmi[idx].pred_mv[0] = bsi->rdstat[idx][mode_idx].pred_mv[0]; if (has_second_ref(mbmi)) mi->bmi[idx].pred_mv[1] = bsi->rdstat[idx][mode_idx].pred_mv[1]; -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER mi->bmi[idx].ref_mv[0].as_int = bsi->rdstat[idx][mode_idx].ref_mv[0].as_int; if (has_second_rf) @@ -6803,15 +6710,13 @@ av1_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, sf, sf); // Gets an initial list of candidate vectors from neighbours and orders them - av1_find_mv_refs( - cm, xd, mi, ref_frame, -#if CONFIG_REF_MV - &mbmi_ext->ref_mv_count[ref_frame], mbmi_ext->ref_mv_stack[ref_frame], + av1_find_mv_refs(cm, xd, mi, ref_frame, &mbmi_ext->ref_mv_count[ref_frame], + mbmi_ext->ref_mv_stack[ref_frame], #if CONFIG_EXT_INTER - mbmi_ext->compound_mode_context, + mbmi_ext->compound_mode_context, #endif // CONFIG_EXT_INTER -#endif // CONFIG_REF_MV - candidates, mi_row, mi_col, NULL, NULL, mbmi_ext->mode_context); + candidates, mi_row, mi_col, NULL, NULL, + mbmi_ext->mode_context); // Candidate refinement carried out at encoder and decoder av1_find_best_ref_mvs(cm->allow_high_precision_mv, candidates, @@ -6877,9 +6782,7 @@ av1_set_mv_search_range(&x->mv_limits, &ref_mv); -#if CONFIG_REF_MV av1_set_mvcost(x, ref, ref_idx, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV // Work out the size of the first step in the mv step search. // 0 here is maximum length first step. 1 is AOMMAX >> 1 etc. @@ -7099,9 +7002,7 @@ pred_mv[1] = x->mbmi_ext->ref_mvs[ref][1].as_mv; pred_mv[2] = x->pred_mv[ref]; -#if CONFIG_REF_MV av1_set_mvcost(x, ref, ref_idx, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV if (scaled_ref_frame) { // Swap out the reference frame for a version that's been scaled to @@ -7872,9 +7773,7 @@ } else { *rate_mv = 0; for (i = 0; i < 2; ++i) { -#if CONFIG_REF_MV av1_set_mvcost(x, refs[i], i, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV *rate_mv += av1_mv_bit_cost( &frame_mv[refs[i]].as_mv, &mbmi_ext->ref_mvs[refs[i]][0].as_mv, x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); @@ -7882,18 +7781,14 @@ } } else if (this_mode == NEAREST_NEWMV || this_mode == NEAR_NEWMV) { frame_mv[refs[1]].as_int = single_newmv[refs[1]].as_int; -#if CONFIG_REF_MV av1_set_mvcost(x, refs[1], 1, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV *rate_mv = av1_mv_bit_cost(&frame_mv[refs[1]].as_mv, &mbmi_ext->ref_mvs[refs[1]][0].as_mv, x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); } else { assert(this_mode == NEW_NEARESTMV || this_mode == NEW_NEARMV); frame_mv[refs[0]].as_int = single_newmv[refs[0]].as_int; -#if CONFIG_REF_MV av1_set_mvcost(x, refs[0], 0, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV *rate_mv = av1_mv_bit_cost(&frame_mv[refs[0]].as_mv, &mbmi_ext->ref_mvs[refs[0]][0].as_mv, x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); @@ -7908,9 +7803,7 @@ } else { *rate_mv = 0; for (i = 0; i < 2; ++i) { -#if CONFIG_REF_MV av1_set_mvcost(x, refs[i], i, mbmi->ref_mv_idx); -#endif // CONFIG_REF_MV *rate_mv += av1_mv_bit_cost(&frame_mv[refs[i]].as_mv, &mbmi_ext->ref_mvs[refs[i]][0].as_mv, x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); @@ -8448,9 +8341,7 @@ cpi->interintra_mode_cost[size_group_lookup[bsize]]; #endif // CONFIG_INTERINTRA const int is_comp_interintra_pred = (mbmi->ref_frame[1] == INTRA_FRAME); -#if CONFIG_REF_MV uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_REF_MV #else int_mv *const single_newmv = args->single_newmv; #endif // CONFIG_EXT_INTER @@ -8490,7 +8381,6 @@ assert(!is_comp_interintra_pred || is_interintra_allowed(mbmi)); #endif // CONFIG_EXT_INTER -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (is_comp_pred) mode_ctx = mbmi_ext->compound_mode_context[refs[0]]; @@ -8498,9 +8388,6 @@ #endif // CONFIG_EXT_INTER mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame, bsize, -1); -#else // CONFIG_REF_MV - mode_ctx = mbmi_ext->mode_context[refs[0]]; -#endif // CONFIG_REF_MV #if CONFIG_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) @@ -8540,7 +8427,6 @@ mbmi->mv[i].as_int = cur_mv[i].as_int; } -#if CONFIG_REF_MV #if CONFIG_EXT_INTER if (this_mode == NEAREST_NEARESTMV) #else @@ -8621,7 +8507,6 @@ } } #endif // CONFIG_EXT_INTER -#endif // CONFIG_REF_MV // do first prediction into the destination buffer. Do the next // prediction into a temporary buffer. Then keep track of which one @@ -8654,7 +8539,7 @@ #else rd_stats->rate += AOMMIN(cost_mv_ref(cpi, this_mode, mode_ctx), cost_mv_ref(cpi, NEARESTMV, mode_ctx)); -#endif // CONFIG_REF_MV && CONFIG_EXT_INTER +#endif // CONFIG_EXT_INTER } else { rd_stats->rate += cost_mv_ref(cpi, this_mode, mode_ctx); } @@ -9595,10 +9480,8 @@ int64_t best_pred_diff[REFERENCE_MODES]; int64_t best_pred_rd[REFERENCE_MODES]; MB_MODE_INFO best_mbmode; -#if CONFIG_REF_MV int rate_skip0 = av1_cost_bit(av1_get_skip_prob(cm, xd), 0); int rate_skip1 = av1_cost_bit(av1_get_skip_prob(cm, xd), 1); -#endif // CONFIG_REF_MV int best_mode_skippable = 0; int midx, best_mode_index = -1; unsigned int ref_costs_single[TOTAL_REFS_PER_FRAME]; @@ -9749,9 +9632,9 @@ for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { x->pred_mv_sad[ref_frame] = INT_MAX; x->mbmi_ext->mode_context[ref_frame] = 0; -#if CONFIG_REF_MV && CONFIG_EXT_INTER +#if CONFIG_EXT_INTER x->mbmi_ext->compound_mode_context[ref_frame] = 0; -#endif // CONFIG_REF_MV && CONFIG_EXT_INTER +#endif // CONFIG_EXT_INTER if (cpi->ref_frame_flags & flag_list[ref_frame]) { assert(get_ref_frame_buffer(cpi, ref_frame) != NULL); setup_buffer_inter(cpi, x, ref_frame, bsize, mi_row, mi_col, @@ -9781,7 +9664,6 @@ #endif // CONFIG_EXT_INTER } -#if CONFIG_REF_MV for (; ref_frame < MODE_CTX_REF_FRAMES; ++ref_frame) { MODE_INFO *const mi = xd->mi[0]; int_mv *const candidates = x->mbmi_ext->ref_mvs[ref_frame]; @@ -9806,7 +9688,6 @@ mbmi_ext->mode_context[ref_frame] &= ~(1 << ALL_ZERO_FLAG_OFFSET); } } -#endif // CONFIG_REF_MV #if CONFIG_MOTION_VAR av1_count_overlappable_neighbors(cm, xd, mi_row, mi_col); @@ -9987,9 +9868,7 @@ int skippable = 0; int this_skip2 = 0; int64_t total_sse = INT64_MAX; -#if CONFIG_REF_MV uint8_t ref_frame_type; -#endif // CONFIG_REF_MV #if CONFIG_PVQ od_encode_rollback(&x->daala_enc, &pre_buf); #endif // CONFIG_PVQ @@ -9997,9 +9876,7 @@ this_mode = av1_mode_order[mode_index].mode; ref_frame = av1_mode_order[mode_index].ref_frame[0]; second_ref_frame = av1_mode_order[mode_index].ref_frame[1]; -#if CONFIG_REF_MV mbmi->ref_mv_idx = 0; -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER if (ref_frame > INTRA_FRAME && second_ref_frame == INTRA_FRAME) { @@ -10137,9 +10014,9 @@ #endif // CONFIG_GLOBAL_MOTION const MV_REFERENCE_FRAME ref_frames[2] = { ref_frame, second_ref_frame }; if (!check_best_zero_mv(cpi, mbmi_ext->mode_context, -#if CONFIG_REF_MV && CONFIG_EXT_INTER +#if CONFIG_EXT_INTER mbmi_ext->compound_mode_context, -#endif // CONFIG_REF_MV && CONFIG_EXT_INTER +#endif // CONFIG_EXT_INTER frame_mv, this_mode, ref_frames, bsize, -1, mi_row, mi_col)) continue; @@ -10330,7 +10207,6 @@ rate2 += intra_cost_penalty; distortion2 = distortion_y + distortion_uv; } else { -#if CONFIG_REF_MV int_mv backup_ref_mv[2]; #if !SUB8X8_COMP_REF @@ -10339,7 +10215,6 @@ backup_ref_mv[0] = mbmi_ext->ref_mvs[ref_frame][0]; if (comp_pred) backup_ref_mv[1] = mbmi_ext->ref_mvs[second_ref_frame][0]; -#endif // CONFIG_REF_MV #if CONFIG_EXT_INTER if (second_ref_frame == INTRA_FRAME) { if (best_single_inter_ref != ref_frame) continue; @@ -10359,7 +10234,6 @@ #endif // CONFIG_FILTER_INTRA } #endif // CONFIG_EXT_INTER -#if CONFIG_REF_MV mbmi->ref_mv_idx = 0; ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); @@ -10404,7 +10278,6 @@ #if CONFIG_EXT_INTER } #endif // CONFIG_EXT_INTER -#endif // CONFIG_REF_MV { RD_STATS rd_stats, rd_stats_y, rd_stats_uv; av1_init_rd_stats(&rd_stats); @@ -10435,7 +10308,6 @@ rate_uv = rd_stats_uv.rate; } -#if CONFIG_REF_MV // TODO(jingning): This needs some refactoring to improve code quality // and reduce redundant steps. #if CONFIG_EXT_INTER @@ -10677,7 +10549,6 @@ } mbmi_ext->ref_mvs[ref_frame][0] = backup_ref_mv[0]; if (comp_pred) mbmi_ext->ref_mvs[second_ref_frame][0] = backup_ref_mv[1]; -#endif // CONFIG_REF_MV if (this_rd == INT64_MAX) continue; @@ -10724,14 +10595,9 @@ // Cost the skip mb case rate2 += av1_cost_bit(av1_get_skip_prob(cm, xd), 1); } else if (ref_frame != INTRA_FRAME && !xd->lossless[mbmi->segment_id]) { -#if CONFIG_REF_MV if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv + rate_skip0, distortion2) < RDCOST(x->rdmult, x->rddiv, rate_skip1, total_sse)) { -#else - if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv, distortion2) < - RDCOST(x->rdmult, x->rddiv, 0, total_sse)) { -#endif // CONFIG_REF_MV // Add in the cost of the no skip flag. rate2 += av1_cost_bit(av1_get_skip_prob(cm, xd), 0); } else { @@ -11104,9 +10970,7 @@ best_mbmode.ref_frame[1] }; int comp_pred_mode = refs[1] > INTRA_FRAME; int_mv zeromv[2]; -#if CONFIG_REF_MV const uint8_t rf_type = av1_ref_frame_type(best_mbmode.ref_frame); -#endif // CONFIG_REF_MV #if CONFIG_GLOBAL_MOTION zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[refs[0]], cm->allow_high_precision_mv, bsize, @@ -11122,7 +10986,6 @@ zeromv[0].as_int = 0; zeromv[1].as_int = 0; #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_REF_MV if (!comp_pred_mode) { int ref_set = (mbmi_ext->ref_mv_count[rf_type] >= 2) ? AOMMIN(2, mbmi_ext->ref_mv_count[rf_type] - 2) @@ -11218,72 +11081,8 @@ } #endif // CONFIG_EXT_INTER } -#else -#if CONFIG_EXT_INTER - if (!comp_pred_mode) { -#endif // CONFIG_EXT_INTER - if (frame_mv[NEARESTMV][refs[0]].as_int == best_mbmode.mv[0].as_int && - ((comp_pred_mode && - frame_mv[NEARESTMV][refs[1]].as_int == best_mbmode.mv[1].as_int) || - !comp_pred_mode)) - best_mbmode.mode = NEARESTMV; - else if (frame_mv[NEARMV][refs[0]].as_int == best_mbmode.mv[0].as_int && - ((comp_pred_mode && - frame_mv[NEARMV][refs[1]].as_int == - best_mbmode.mv[1].as_int) || - !comp_pred_mode)) - best_mbmode.mode = NEARMV; - else if (best_mbmode.mv[0].as_int == zeromv[0].as_int && - ((comp_pred_mode && - best_mbmode.mv[1].as_int == zeromv[1].as_int) || - !comp_pred_mode)) - best_mbmode.mode = ZEROMV; -#if CONFIG_EXT_INTER - } else { -#if CONFIG_GLOBAL_MOTION - zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[refs[0]], - cm->allow_high_precision_mv, - bsize, mi_col, mi_row, 0) - .as_int; - zeromv[1].as_int = comp_pred_mode - ? gm_get_motion_vector(&cm->global_motion[refs[1]], - cm->allow_high_precision_mv, - bsize, mi_col, mi_row, 0) - .as_int - : 0; -#else - zeromv[0].as_int = 0; - zeromv[1].as_int = 0; -#endif // CONFIG_GLOBAL_MOTION - if (frame_mv[NEAREST_NEARESTMV][refs[0]].as_int == - best_mbmode.mv[0].as_int && - frame_mv[NEAREST_NEARESTMV][refs[1]].as_int == - best_mbmode.mv[1].as_int) - best_mbmode.mode = NEAREST_NEARESTMV; - else if (frame_mv[NEAREST_NEARMV][refs[0]].as_int == - best_mbmode.mv[0].as_int && - frame_mv[NEAREST_NEARMV][refs[1]].as_int == - best_mbmode.mv[1].as_int) - best_mbmode.mode = NEAREST_NEARMV; - else if (frame_mv[NEAR_NEARESTMV][refs[0]].as_int == - best_mbmode.mv[0].as_int && - frame_mv[NEAR_NEARESTMV][refs[1]].as_int == - best_mbmode.mv[1].as_int) - best_mbmode.mode = NEAR_NEARESTMV; - else if (frame_mv[NEAR_NEARMV][refs[0]].as_int == - best_mbmode.mv[0].as_int && - frame_mv[NEAR_NEARMV][refs[1]].as_int == - best_mbmode.mv[1].as_int) - best_mbmode.mode = NEAR_NEARMV; - else if (best_mbmode.mv[0].as_int == zeromv[0].as_int && - best_mbmode.mv[1].as_int == zeromv[1].as_int) - best_mbmode.mode = ZERO_ZEROMV; - } -#endif // CONFIG_EXT_INTER -#endif // CONFIG_REF_MV } -#if CONFIG_REF_MV // Make sure that the ref_mv_idx is only nonzero when we're // using a mode which can support ref_mv_idx if (best_mbmode.ref_mv_idx != 0 && @@ -11332,7 +11131,6 @@ } } } -#endif // CONFIG_REF_MV if (best_mode_index < 0 || best_rd >= best_rd_so_far) { rd_cost->rate = INT_MAX; @@ -11405,14 +11203,12 @@ } #endif // CONFIG_GLOBAL_MOTION -#if CONFIG_REF_MV for (i = 0; i < 1 + has_second_ref(mbmi); ++i) { if (mbmi->mode != NEWMV) mbmi->pred_mv[i].as_int = mbmi->mv[i].as_int; else mbmi->pred_mv[i].as_int = mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_int; } -#endif // CONFIG_REF_MV for (i = 0; i < REFERENCE_MODES; ++i) { if (best_pred_rd[i] == INT64_MAX) @@ -11495,10 +11291,8 @@ mbmi->tx_size = max_txsize_lookup[bsize]; x->skip = 1; -#if CONFIG_REF_MV mbmi->ref_mv_idx = 0; mbmi->pred_mv[0].as_int = 0; -#endif // CONFIG_REF_MV mbmi->motion_mode = SIMPLE_TRANSLATION; #if CONFIG_MOTION_VAR @@ -11687,9 +11481,9 @@ for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) { x->mbmi_ext->mode_context[ref_frame] = 0; -#if CONFIG_REF_MV && CONFIG_EXT_INTER +#if CONFIG_EXT_INTER x->mbmi_ext->compound_mode_context[ref_frame] = 0; -#endif // CONFIG_REF_MV && CONFIG_EXT_INTER +#endif // CONFIG_EXT_INTER if (cpi->ref_frame_flags & flag_list[ref_frame]) { setup_buffer_inter(cpi, x, ref_frame, bsize, mi_row, mi_col, frame_mv[NEARESTMV], frame_mv[NEARMV], yv12_mb); @@ -11726,9 +11520,7 @@ ref_frame = av1_ref_order[ref_index].ref_frame[0]; second_ref_frame = av1_ref_order[ref_index].ref_frame[1]; -#if CONFIG_REF_MV mbmi->ref_mv_idx = 0; -#endif // CONFIG_REF_MV // Look at the reference frame of the best mode so far and set the // skip mask to look at a subset of the remaining modes. @@ -12326,10 +12118,8 @@ for (i = 0; i < 4; ++i) memcpy(&xd->mi[0]->bmi[i], &best_bmodes[i], sizeof(b_mode_info)); -#if CONFIG_REF_MV mbmi->pred_mv[0].as_int = xd->mi[0]->bmi[3].pred_mv[0].as_int; mbmi->pred_mv[1].as_int = xd->mi[0]->bmi[3].pred_mv[1].as_int; -#endif // CONFIG_REF_MV mbmi->mv[0].as_int = xd->mi[0]->bmi[3].as_mv[0].as_int; mbmi->mv[1].as_int = xd->mi[0]->bmi[3].as_mv[1].as_int; }
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c index de962fe..98feb87 100644 --- a/av1/encoder/temporal_filter.c +++ b/av1/encoder/temporal_filter.c
@@ -281,12 +281,10 @@ av1_set_mv_search_range(&x->mv_limits, &best_ref_mv1); -#if CONFIG_REF_MV x->mvcost = x->mv_cost_stack[0]; x->nmvjointcost = x->nmv_vec_cost[0]; x->mvsadcost = x->mvcost; x->nmvjointsadcost = x->nmvjointcost; -#endif // Ignore mv costing by sending NULL pointer instead of cost arrays av1_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake index 47202b2..747f3c9 100644 --- a/build/cmake/aom_config_defaults.cmake +++ b/build/cmake/aom_config_defaults.cmake
@@ -92,7 +92,6 @@ set(CONFIG_CDEF 1 CACHE BOOL "Internal flag.") set(CONFIG_VAR_TX 0 CACHE BOOL "Internal flag.") set(CONFIG_RECT_TX 1 CACHE BOOL "Internal flag.") -set(CONFIG_REF_MV 1 CACHE BOOL "Internal flag.") set(CONFIG_TPL_MV 0 CACHE BOOL "Internal flag.") set(CONFIG_DUAL_FILTER 1 CACHE BOOL "Internal flag.") set(CONFIG_CONVOLVE_ROUND 0 CACHE BOOL "Internal flag.")
diff --git a/build/cmake/rtcd_config.cmake b/build/cmake/rtcd_config.cmake index cdea345..2887b58 100644 --- a/build/cmake/rtcd_config.cmake +++ b/build/cmake/rtcd_config.cmake
@@ -113,7 +113,6 @@ CONFIG_RECT_TX=${RTCD_CONFIG_RECT_TX} CONFIG_REFERENCE_BUFFER=${RTCD_CONFIG_REFERENCE_BUFFER} CONFIG_REF_ADAPT=${RTCD_CONFIG_REF_ADAPT} -CONFIG_REF_MV=${RTCD_CONFIG_REF_MV} CONFIG_RUNTIME_CPU_DETECT=${RTCD_CONFIG_RUNTIME_CPU_DETECT} CONFIG_RVCT=${RTCD_CONFIG_RVCT} CONFIG_SHARED=${RTCD_CONFIG_SHARED}
diff --git a/configure b/configure index 446232b..52fd766 100755 --- a/configure +++ b/configure
@@ -475,7 +475,6 @@ done # Enable adopted experiments by default - soft_enable ref_mv soft_enable cb4x4 soft_enable filter_7bit soft_enable reference_buffer