Unify ref_frame_nrs and ref_frame Some functions that highly depend on ref_frame_nrs/ref_frame are also unified: av1_collect_neighbors_ref_counts_nrs set_ref_ptrs_nrs av1_find_mv_refs_nrs av1_get_ref_frame_nrs is_ref_frame_used_in_cache_nrs Change-Id: I24bd5c2614f724f10c5f629400c5f09967b40d46
diff --git a/av1/common/av1_loopfilter.c b/av1/common/av1_loopfilter.c index 994a042..c78de5c 100644 --- a/av1/common/av1_loopfilter.c +++ b/av1/common/av1_loopfilter.c
@@ -74,9 +74,9 @@ int plane, const MB_MODE_INFO *mbmi) { const int segment_id = mbmi->segment_id; #if CONFIG_NEW_REF_SIGNALING - const int ref_frame_nrs_index = mbmi->ref_frame_nrs[0] == INTRA_FRAME_NRS - ? INTRA_FRAME_INDEX_NRS - : mbmi->ref_frame_nrs[0]; + const int ref_frame_index = mbmi->ref_frame[0] == INTRA_FRAME_NRS + ? INTRA_FRAME_INDEX_NRS + : mbmi->ref_frame[0]; #endif // CONFIG_NEW_REF_SIGNALING if (cm->delta_q_info.delta_lf_present_flag) { int8_t delta_lf; @@ -104,9 +104,9 @@ if (cm->lf.mode_ref_delta_enabled) { const int scale = 1 << (lvl_seg >> 5); #if CONFIG_NEW_REF_SIGNALING - lvl_seg += cm->lf.ref_deltas[ref_frame_nrs_index] * scale; - if (mbmi->ref_frame_nrs[0] != INTRA_FRAME_NRS && - mbmi->ref_frame_nrs[0] != INVALID_IDX) + lvl_seg += cm->lf.ref_deltas[ref_frame_index] * scale; + if (mbmi->ref_frame[0] != INTRA_FRAME_NRS && + mbmi->ref_frame[0] != INVALID_IDX) #else lvl_seg += cm->lf.ref_deltas[mbmi->ref_frame[0]] * scale; if (mbmi->ref_frame[0] > INTRA_FRAME) @@ -117,7 +117,7 @@ return lvl_seg; } else { #if CONFIG_NEW_REF_SIGNALING - return lfi_n->lvl[plane][segment_id][dir_idx][ref_frame_nrs_index] + return lfi_n->lvl[plane][segment_id][dir_idx][ref_frame_index] [mode_lf_lut[mbmi->mode]]; #else return lfi_n->lvl[plane][segment_id][dir_idx][mbmi->ref_frame[0]]
diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 5d0a349..23e80c9 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h
@@ -341,11 +341,7 @@ int8_t rotation; #endif // CONFIG_EXT_ROTATION PARTITION_TYPE partition; -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs[2]; -#else MV_REFERENCE_FRAME ref_frame[2]; -#endif // CONFIG_NEW_REF_SIGNALING FILTER_INTRA_MODE_INFO filter_intra_mode_info; int8_t skip_txfm; uint8_t inter_tx_size[INTER_TX_SIZE_BUF_LEN]; @@ -433,7 +429,7 @@ static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) { #if CONFIG_NEW_REF_SIGNALING - return is_intrabc_block(mbmi) || mbmi->ref_frame_nrs[0] != INTRA_FRAME_NRS; + return is_intrabc_block(mbmi) || mbmi->ref_frame[0] != INTRA_FRAME_NRS; #else return is_intrabc_block(mbmi) || mbmi->ref_frame[0] > INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -465,8 +461,8 @@ static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) { #if CONFIG_NEW_REF_SIGNALING - return (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS) && - (mbmi->ref_frame_nrs[1] != INVALID_IDX); + return (mbmi->ref_frame[1] != INTRA_FRAME_NRS) && + (mbmi->ref_frame[1] != INVALID_IDX); #else return mbmi->ref_frame[1] > INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -1301,19 +1297,15 @@ */ bool is_first_horizontal_rect; -#if CONFIG_NEW_REF_SIGNALING /*! * Counts of each nrs ref frame in the above and left neighboring blocks. * NOTE: Take into account both single and comp references. */ - uint8_t neighbors_ref_counts_nrs[INTER_REFS_PER_FRAME_NRS]; -#endif // CONFIG_NEW_REF_SIGNALING - - /*! - * Counts of each reference frame in the above and left neighboring blocks. - * NOTE: Take into account both single and comp references. - */ +#if CONFIG_NEW_REF_SIGNALING + uint8_t neighbors_ref_counts[INTER_REFS_PER_FRAME_NRS]; +#else uint8_t neighbors_ref_counts[REF_FRAMES]; +#endif // CONFIG_NEW_REF_SIGNALING /*! * Current CDFs of all the symbols for the current tile. @@ -1874,9 +1866,9 @@ #define MAX_INTERINTRA_SB_SQUARE 32 * 32 static INLINE int is_interintra_mode(const MB_MODE_INFO *mbmi) { #if CONFIG_NEW_REF_SIGNALING - return (mbmi->ref_frame_nrs[0] != INTRA_FRAME_NRS && - mbmi->ref_frame_nrs[0] != INVALID_IDX && - mbmi->ref_frame_nrs[1] == INTRA_FRAME_NRS); + return (mbmi->ref_frame[0] != INTRA_FRAME_NRS && + mbmi->ref_frame[0] != INVALID_IDX && + mbmi->ref_frame[1] == INTRA_FRAME_NRS); #else return (mbmi->ref_frame[0] > INTRA_FRAME && mbmi->ref_frame[1] == INTRA_FRAME); @@ -1904,11 +1896,7 @@ static INLINE int is_interintra_allowed(const MB_MODE_INFO *mbmi) { return is_interintra_allowed_bsize(mbmi->sb_type) && -#if CONFIG_NEW_REF_SIGNALING - is_interintra_allowed_ref(mbmi->ref_frame_nrs) && -#else is_interintra_allowed_ref(mbmi->ref_frame) && -#endif // CONFIG_NEW_REF_SIGNALING is_interintra_allowed_mode(mbmi->mode); } @@ -1925,10 +1913,9 @@ static INLINE int is_interintra_pred(const MB_MODE_INFO *mbmi) { #if CONFIG_NEW_REF_SIGNALING - return mbmi->ref_frame_nrs[0] != INTRA_FRAME_NRS && - mbmi->ref_frame_nrs[0] != INVALID_IDX && - mbmi->ref_frame_nrs[1] == INTRA_FRAME_NRS && - is_interintra_allowed(mbmi); + return mbmi->ref_frame[0] != INTRA_FRAME_NRS && + mbmi->ref_frame[0] != INVALID_IDX && + mbmi->ref_frame[1] == INTRA_FRAME_NRS && is_interintra_allowed(mbmi); #else return mbmi->ref_frame[0] > INTRA_FRAME && mbmi->ref_frame[1] == INTRA_FRAME && is_interintra_allowed(mbmi); @@ -1983,17 +1970,13 @@ motion_mode_allowed(const WarpedMotionParams *gm_params, const MACROBLOCKD *xd, const MB_MODE_INFO *mbmi, int allow_warped_motion) { if (xd->cur_frame_force_integer_mv == 0) { -#if CONFIG_NEW_REF_SIGNALING - const TransformationType gm_type = gm_params[mbmi->ref_frame_nrs[0]].wmtype; -#else const TransformationType gm_type = gm_params[mbmi->ref_frame[0]].wmtype; -#endif // CONFIG_NEW_REF_SIGNALING if (is_global_mv_block(mbmi, gm_type)) return SIMPLE_TRANSLATION; } if (is_motion_variation_allowed_bsize(mbmi->sb_type, xd->mi_row, xd->mi_col) && #if CONFIG_NEW_REF_SIGNALING - is_inter_mode(mbmi->mode) && mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS && + is_inter_mode(mbmi->mode) && mbmi->ref_frame[1] != INTRA_FRAME_NRS && #else is_inter_mode(mbmi->mode) && mbmi->ref_frame[1] != INTRA_FRAME && #endif // CONFIG_NEW_REF_SIGNALING @@ -2104,12 +2087,7 @@ // Now check if all global motion is non translational for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - if (xd->global_motion[mbmi->ref_frame_nrs[ref]].wmtype == TRANSLATION) - return 0; -#else if (xd->global_motion[mbmi->ref_frame[ref]].wmtype == TRANSLATION) return 0; -#endif // CONFIG_NEW_REF_SIGNALING } return 1; }
diff --git a/av1/common/debugmodes.c b/av1/common/debugmodes.c index 0322642..78bc39a 100644 --- a/av1/common/debugmodes.c +++ b/av1/common/debugmodes.c
@@ -54,12 +54,7 @@ print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type)); print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode)); -#if CONFIG_NEW_REF_SIGNALING - print_mi_data(cm, mvs, - "Ref frame:", offsetof(MB_MODE_INFO, ref_frame_nrs[0])); -#else print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0])); -#endif // CONFIG_NEW_REF_SIGNALING print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size)); print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode));
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c index 427bee5..e4cba35 100644 --- a/av1/common/mvref_common.c +++ b/av1/common/mvref_common.c
@@ -62,11 +62,10 @@ mv->mv.as_int = 0; for (int idx = 0; idx < 2; ++idx) { + MV_REFERENCE_FRAME ref_frame = mi->ref_frame[idx]; #if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame = mi->ref_frame_nrs[idx]; if (ref_frame != INTRA_FRAME_NRS && ref_frame != INVALID_IDX) #else - MV_REFERENCE_FRAME ref_frame = mi->ref_frame[idx]; if (ref_frame > INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING { @@ -85,87 +84,21 @@ } } +static AOM_INLINE void add_ref_mv_candidate( + const MB_MODE_INFO *const candidate, const MV_REFERENCE_FRAME rf[2], + uint8_t *refmv_count, uint8_t *ref_match_count, uint8_t *newmv_count, + CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, + int_mv *gm_mv_candidates, const WarpedMotionParams *gm_params, + uint16_t weight) { + if (!is_inter_block(candidate)) return; + assert(weight % 2 == 0); + int index, ref; + #if CONFIG_NEW_REF_SIGNALING -static AOM_INLINE void add_ref_mv_candidate( - const MB_MODE_INFO *const candidate, const MV_REFERENCE_FRAME rf[2], - uint8_t *refmv_count, uint8_t *ref_match_count, uint8_t *newmv_count, - CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, - int_mv *gm_mv_candidates, const WarpedMotionParams *gm_params, - uint16_t weight) { - if (!is_inter_block(candidate)) return; - assert(weight % 2 == 0); - int index, ref; - if (rf[1] == INVALID_IDX) { - // single reference frame - for (ref = 0; ref < 2; ++ref) { - if (candidate->ref_frame_nrs[ref] == rf[0]) { - const int is_gm_block = - is_global_mv_block(candidate, gm_params[rf[0]].wmtype); - const int_mv this_refmv = - is_gm_block ? gm_mv_candidates[0] : get_block_mv(candidate, ref); - for (index = 0; index < *refmv_count; ++index) { - if (ref_mv_stack[index].this_mv.as_int == this_refmv.as_int) { - ref_mv_weight[index] += weight; - break; - } - } - - // Add a new item to the list. - if (index == *refmv_count && *refmv_count < MAX_REF_MV_STACK_SIZE) { - ref_mv_stack[index].this_mv = this_refmv; - ref_mv_weight[index] = weight; - ++(*refmv_count); - } - if (have_newmv_in_inter_mode(candidate->mode)) ++*newmv_count; - ++*ref_match_count; - } - } - } else { - // compound reference frame - if (candidate->ref_frame_nrs[0] == rf[0] && - candidate->ref_frame_nrs[1] == rf[1]) { - int_mv this_refmv[2]; - - for (ref = 0; ref < 2; ++ref) { - if (is_global_mv_block(candidate, gm_params[rf[ref]].wmtype)) - this_refmv[ref] = gm_mv_candidates[ref]; - else - this_refmv[ref] = get_block_mv(candidate, ref); - } - - for (index = 0; index < *refmv_count; ++index) { - if ((ref_mv_stack[index].this_mv.as_int == this_refmv[0].as_int) && - (ref_mv_stack[index].comp_mv.as_int == this_refmv[1].as_int)) { - ref_mv_weight[index] += weight; - break; - } - } - - // Add a new item to the list. - if (index == *refmv_count && *refmv_count < MAX_REF_MV_STACK_SIZE) { - ref_mv_stack[index].this_mv = this_refmv[0]; - ref_mv_stack[index].comp_mv = this_refmv[1]; - ref_mv_weight[index] = weight; - ++(*refmv_count); - } - if (have_newmv_in_inter_mode(candidate->mode)) ++*newmv_count; - ++*ref_match_count; - } - } -} #else -static AOM_INLINE void add_ref_mv_candidate( - const MB_MODE_INFO *const candidate, const MV_REFERENCE_FRAME rf[2], - uint8_t *refmv_count, uint8_t *ref_match_count, uint8_t *newmv_count, - CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, - int_mv *gm_mv_candidates, const WarpedMotionParams *gm_params, - uint16_t weight) { - if (!is_inter_block(candidate)) return; - assert(weight % 2 == 0); - int index, ref; - if (rf[1] == NONE_FRAME) { +#endif // CONFIG_NEW_REF_SIGNALING // single reference frame for (ref = 0; ref < 2; ++ref) { if (candidate->ref_frame[ref] == rf[0]) { @@ -222,22 +155,16 @@ } } } -#endif // CONFIG_NEW_REF_SIGNALING static AOM_INLINE void scan_row_mbmi( const AV1_COMMON *cm, const MACROBLOCKD *xd, #if CONFIG_EXT_RECUR_PARTITIONS int mi_row, #endif // CONFIG_EXT_RECUR_PARTITIONS - int mi_col, -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME rf[2], -#else - const MV_REFERENCE_FRAME rf[2], -#endif // CONFIG_NEW_REF_SIGNALING - int row_offset, CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, - uint8_t *refmv_count, uint8_t *ref_match_count, uint8_t *newmv_count, - int_mv *gm_mv_candidates, int max_row_offset, int *processed_rows) { + int mi_col, const MV_REFERENCE_FRAME rf[2], int row_offset, + CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, uint8_t *refmv_count, + uint8_t *ref_match_count, uint8_t *newmv_count, int_mv *gm_mv_candidates, + int max_row_offset, int *processed_rows) { int end_mi = AOMMIN(xd->width, cm->mi_params.mi_cols - mi_col); end_mi = AOMMIN(end_mi, mi_size_wide[BLOCK_64X64]); const int width_8x8 = mi_size_wide[BLOCK_8X8]; @@ -297,14 +224,10 @@ #if CONFIG_EXT_RECUR_PARTITIONS int mi_col, #endif // CONFIG_EXT_RECUR_PARTITIONS -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME rf[2], -#else - const MV_REFERENCE_FRAME rf[2], -#endif // CONFIG_NEW_REF_SIGNALING - int col_offset, CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, - uint8_t *refmv_count, uint8_t *ref_match_count, uint8_t *newmv_count, - int_mv *gm_mv_candidates, int max_col_offset, int *processed_cols) { + const MV_REFERENCE_FRAME rf[2], int col_offset, CANDIDATE_MV *ref_mv_stack, + uint16_t *ref_mv_weight, uint8_t *refmv_count, uint8_t *ref_match_count, + uint8_t *newmv_count, int_mv *gm_mv_candidates, int max_col_offset, + int *processed_cols) { int end_mi = AOMMIN(xd->height, cm->mi_params.mi_rows - mi_row); end_mi = AOMMIN(end_mi, mi_size_high[BLOCK_64X64]); const int n8_h_8 = mi_size_high[BLOCK_8X8]; @@ -360,15 +283,10 @@ static AOM_INLINE void scan_blk_mbmi( const AV1_COMMON *cm, const MACROBLOCKD *xd, const int mi_row, - const int mi_col, -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME rf[2], -#else - const MV_REFERENCE_FRAME rf[2], -#endif // CONFIG_NEW_REF_SIGNALING - int row_offset, int col_offset, CANDIDATE_MV *ref_mv_stack, - uint16_t *ref_mv_weight, uint8_t *ref_match_count, uint8_t *newmv_count, - int_mv *gm_mv_candidates, uint8_t *refmv_count) { + const int mi_col, const MV_REFERENCE_FRAME rf[2], int row_offset, + int col_offset, CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, + uint8_t *ref_match_count, uint8_t *newmv_count, int_mv *gm_mv_candidates, + uint8_t *refmv_count) { const TileInfo *const tile = &xd->tile; POSITION mi_pos; @@ -433,12 +351,7 @@ } static int add_tpl_ref_mv(const AV1_COMMON *cm, const MACROBLOCKD *xd, - int mi_row, int mi_col, -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame, -#else - MV_REFERENCE_FRAME ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING + int mi_row, int mi_col, MV_REFERENCE_FRAME ref_frame, int blk_row, int blk_col, int_mv *gm_mv_candidates, uint8_t *const refmv_count, CANDIDATE_MV ref_mv_stack[MAX_REF_MV_STACK_SIZE], @@ -456,13 +369,8 @@ ((mi_col + mi_pos.col) >> 1); if (prev_frame_mvs->mfmv0.as_int == INVALID_MV) return 0; -#if CONFIG_NEW_REF_SIGNALING MV_REFERENCE_FRAME rf[2]; av1_set_ref_frame(rf, ref_frame); -#else - MV_REFERENCE_FRAME rf[2]; - av1_set_ref_frame(rf, ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING const uint16_t weight_unit = 1; // mi_size_wide[BLOCK_8X8]; const int cur_frame_index = cm->cur_frame->order_hint; @@ -540,19 +448,10 @@ static AOM_INLINE void process_compound_ref_mv_candidate( const MB_MODE_INFO *const candidate, const AV1_COMMON *const cm, -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME *const rf, -#else - const MV_REFERENCE_FRAME *const rf, -#endif // CONFIG_NEW_REF_SIGNALING - int_mv ref_id[2][2], int ref_id_count[2], int_mv ref_diff[2][2], - int ref_diff_count[2]) { + const MV_REFERENCE_FRAME *const rf, int_mv ref_id[2][2], + int ref_id_count[2], int_mv ref_diff[2][2], int ref_diff_count[2]) { for (int rf_idx = 0; rf_idx < 2; ++rf_idx) { -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME can_rf = candidate->ref_frame_nrs[rf_idx]; -#else MV_REFERENCE_FRAME can_rf = candidate->ref_frame[rf_idx]; -#endif // CONFIG_NEW_REF_SIGNALING for (int cmp_idx = 0; cmp_idx < 2; ++cmp_idx) { if (can_rf == rf[cmp_idx] && ref_id_count[cmp_idx] < 2) { @@ -585,25 +484,20 @@ static AOM_INLINE void process_single_ref_mv_candidate( const MB_MODE_INFO *const candidate, const AV1_COMMON *const cm, -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame, -#else - MV_REFERENCE_FRAME ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - uint8_t *const refmv_count, + MV_REFERENCE_FRAME ref_frame, uint8_t *const refmv_count, CANDIDATE_MV ref_mv_stack[MAX_REF_MV_STACK_SIZE], uint16_t ref_mv_weight[MAX_REF_MV_STACK_SIZE]) { for (int rf_idx = 0; rf_idx < 2; ++rf_idx) { #if CONFIG_NEW_REF_SIGNALING - if (candidate->ref_frame_nrs[rf_idx] != INTRA_FRAME_NRS && - candidate->ref_frame_nrs[rf_idx] != INVALID_IDX) + if (candidate->ref_frame[rf_idx] != INTRA_FRAME_NRS && + candidate->ref_frame[rf_idx] != INVALID_IDX) #else if (candidate->ref_frame[rf_idx] > INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING { int_mv this_mv = candidate->mv[rf_idx]; #if CONFIG_NEW_REF_SIGNALING - if (cm->ref_frame_sign_bias_nrs[candidate->ref_frame_nrs[rf_idx]] != + if (cm->ref_frame_sign_bias_nrs[candidate->ref_frame[rf_idx]] != cm->ref_frame_sign_bias_nrs[ref_frame]) { this_mv.as_mv.row = -this_mv.as_mv.row; this_mv.as_mv.col = -this_mv.as_mv.col; @@ -1144,43 +1038,6 @@ #endif // CONFIG_REF_MV_BANK } -#if CONFIG_NEW_REF_SIGNALING -void av1_find_mv_refs_nrs(const AV1_COMMON *cm, const MACROBLOCKD *xd, - MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame_nrs, - uint8_t ref_mv_count[MODE_CTX_REF_FRAMES], - CANDIDATE_MV ref_mv_stack[][MAX_REF_MV_STACK_SIZE], - uint16_t ref_mv_weight[][MAX_REF_MV_STACK_SIZE], - int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES], - int_mv *global_mvs, int16_t *mode_context) { - const int mi_row = xd->mi_row; - const int mi_col = xd->mi_col; - int_mv gm_mv[2]; - - if (ref_frame_nrs == INTRA_FRAME_NRS) { - gm_mv[0].as_int = gm_mv[1].as_int = 0; - } else { - const BLOCK_SIZE bsize = mi->sb_type; - const int fr_mv_precision = cm->features.fr_mv_precision; - if (ref_frame_nrs < INTER_REFS_PER_FRAME_NRS) { - gm_mv[0] = gm_get_motion_vector(&cm->global_motion[ref_frame_nrs], - fr_mv_precision, bsize, mi_col, mi_row); - gm_mv[1].as_int = 0; - if (global_mvs != NULL) global_mvs[ref_frame_nrs] = gm_mv[0]; - } else { - MV_REFERENCE_FRAME rf[2]; - av1_set_ref_frame(rf, ref_frame_nrs); - gm_mv[0] = gm_get_motion_vector(&cm->global_motion[rf[0]], - fr_mv_precision, bsize, mi_col, mi_row); - gm_mv[1] = gm_get_motion_vector(&cm->global_motion[rf[1]], - fr_mv_precision, bsize, mi_col, mi_row); - } - } - setup_ref_mv_list(cm, xd, ref_frame_nrs, &ref_mv_count[ref_frame_nrs], - ref_mv_stack[ref_frame_nrs], ref_mv_weight[ref_frame_nrs], - mv_ref_list ? mv_ref_list[ref_frame_nrs] : NULL, gm_mv, - mi_row, mi_col, mode_context); -} -#else void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, uint8_t ref_mv_count[MODE_CTX_REF_FRAMES], @@ -1192,12 +1049,20 @@ const int mi_col = xd->mi_col; int_mv gm_mv[2]; +#if CONFIG_NEW_REF_SIGNALING + if (ref_frame == INTRA_FRAME_NRS) { +#else if (ref_frame == INTRA_FRAME) { +#endif // CONFIG_NEW_REF_SIGNALING gm_mv[0].as_int = gm_mv[1].as_int = 0; } else { const BLOCK_SIZE bsize = mi->sb_type; const int fr_mv_precision = cm->features.fr_mv_precision; +#if CONFIG_NEW_REF_SIGNALING + if (ref_frame < INTER_REFS_PER_FRAME_NRS) { +#else if (ref_frame < REF_FRAMES) { +#endif // CONFIG_NEW_REF_SIGNALING gm_mv[0] = gm_get_motion_vector(&cm->global_motion[ref_frame], fr_mv_precision, bsize, mi_col, mi_row); gm_mv[1].as_int = 0; @@ -1211,13 +1076,11 @@ fr_mv_precision, bsize, mi_col, mi_row); } } - setup_ref_mv_list(cm, xd, ref_frame, &ref_mv_count[ref_frame], ref_mv_stack[ref_frame], ref_mv_weight[ref_frame], mv_ref_list ? mv_ref_list[ref_frame] : NULL, gm_mv, mi_row, mi_col, mode_context); } -#endif // CONFIG_NEW_REF_SIGNALING void av1_find_best_ref_mvs(int_mv *mvlist, int_mv *nearest_mv, int_mv *near_mv, MvSubpelPrecision precision) { @@ -1236,22 +1099,20 @@ cm->cur_frame->absolute_poc = cm->current_frame.absolute_poc; cm->cur_frame->pyramid_level = cm->current_frame.pyramid_level; + MV_REFERENCE_FRAME ref_frame; #if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs; - for (ref_frame_nrs = 0; ref_frame_nrs < INTER_REFS_PER_FRAME_NRS; - ++ref_frame_nrs) { - const RefCntBuffer *const buf = get_ref_frame_buf(cm, ref_frame_nrs); - if (buf != NULL && ref_frame_nrs < cm->new_ref_frame_data.n_total_refs) { - cm->cur_frame->ref_order_hints[ref_frame_nrs] = buf->order_hint; - cm->cur_frame->ref_display_order_hint[ref_frame_nrs] = + for (ref_frame = 0; ref_frame < INTER_REFS_PER_FRAME_NRS; ++ref_frame) { + const RefCntBuffer *const buf = get_ref_frame_buf(cm, ref_frame); + if (buf != NULL && ref_frame < cm->new_ref_frame_data.n_total_refs) { + cm->cur_frame->ref_order_hints[ref_frame] = buf->order_hint; + cm->cur_frame->ref_display_order_hint[ref_frame] = buf->display_order_hint; } else { - cm->cur_frame->ref_order_hints[ref_frame_nrs] = -1; - cm->cur_frame->ref_display_order_hint[ref_frame_nrs] = -1; + cm->cur_frame->ref_order_hints[ref_frame] = -1; + cm->cur_frame->ref_display_order_hint[ref_frame] = -1; } } #else - MV_REFERENCE_FRAME ref_frame; for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { const RefCntBuffer *const buf = get_ref_frame_buf(cm, ref_frame); if (buf != NULL) { @@ -1676,11 +1537,7 @@ uint8_t av1_findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int *pts, int *pts_inref) { const MB_MODE_INFO *const mbmi0 = xd->mi[0]; -#if CONFIG_NEW_REF_SIGNALING - const int ref_frame_nrs = mbmi0->ref_frame_nrs[0]; -#else const int ref_frame = mbmi0->ref_frame[0]; -#endif // CONFIG_NEW_REF_SIGNALING const int up_available = xd->up_available; const int left_available = xd->left_available; int i, mi_step; @@ -1706,12 +1563,7 @@ #if CONFIG_COMPOUND_WARP_SAMPLES for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[ref] == ref_frame_nrs) -#else - if (mbmi->ref_frame[ref] == ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - { + if (mbmi->ref_frame[ref] == ref_frame) { record_samples(mbmi, ref, pts, pts_inref, 0, -1, col_offset, 1); pts += 2; pts_inref += 2; @@ -1722,8 +1574,7 @@ } #else #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[0] == ref_frame_nrs && - mbmi->ref_frame_nrs[1] == INVALID_IDX) + if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == INVALID_IDX) #else if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1743,12 +1594,7 @@ mi_step = AOMMIN(xd->width, superblock_width); #if CONFIG_COMPOUND_WARP_SAMPLES for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[ref] == ref_frame_nrs) -#else - if (mbmi->ref_frame[ref] == ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - { + if (mbmi->ref_frame[ref] == ref_frame) { record_samples(mbmi, ref, pts, pts_inref, 0, -1, i, 1); pts += 2; pts_inref += 2; @@ -1758,8 +1604,8 @@ } #else #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[0] == ref_frame_nrs && - mbmi->ref_frame_nrs[1] == INVALID_IDX) + if (mbmi->ref_frame[0] == ref_frame && + mbmi->ref_frame[1] == INVALID_IDX) #else if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1791,12 +1637,7 @@ #if CONFIG_COMPOUND_WARP_SAMPLES for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[ref] == ref_frame_nrs) -#else - if (mbmi->ref_frame[ref] == ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - { + if (mbmi->ref_frame[ref] == ref_frame) { record_samples(mbmi, ref, pts, pts_inref, row_offset, 1, 0, -1); pts += 2; pts_inref += 2; @@ -1807,8 +1648,7 @@ } #else #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[0] == ref_frame_nrs && - mbmi->ref_frame_nrs[1] == INVALID_IDX) + if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == INVALID_IDX) #else if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1828,12 +1668,7 @@ mi_step = AOMMIN(xd->height, superblock_height); #if CONFIG_COMPOUND_WARP_SAMPLES for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[ref] == ref_frame_nrs) -#else - if (mbmi->ref_frame[ref] == ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - { + if (mbmi->ref_frame[ref] == ref_frame) { record_samples(mbmi, ref, pts, pts_inref, i, 1, 0, -1); pts += 2; pts_inref += 2; @@ -1844,8 +1679,8 @@ } #else #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[0] == ref_frame_nrs && - mbmi->ref_frame_nrs[1] == INVALID_IDX) + if (mbmi->ref_frame[0] == ref_frame && + mbmi->ref_frame[1] == INVALID_IDX) #else if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1870,12 +1705,7 @@ MB_MODE_INFO *mbmi = xd->mi[mi_col_offset + mi_row_offset * mi_stride]; #if CONFIG_COMPOUND_WARP_SAMPLES for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[ref] == ref_frame_nrs) -#else - if (mbmi->ref_frame[ref] == ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - { + if (mbmi->ref_frame[ref] == ref_frame) { record_samples(mbmi, ref, pts, pts_inref, 0, -1, 0, -1); pts += 2; pts_inref += 2; @@ -1884,8 +1714,7 @@ } #else #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[0] == ref_frame_nrs && - mbmi->ref_frame_nrs[1] == INVALID_IDX) + if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == INVALID_IDX) #else if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1910,12 +1739,7 @@ xd->mi[mi_col_offset + mi_row_offset * mi_stride]; #if CONFIG_COMPOUND_WARP_SAMPLES for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[ref] == ref_frame_nrs) -#else - if (mbmi->ref_frame[ref] == ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - { + if (mbmi->ref_frame[ref] == ref_frame) { record_samples(mbmi, ref, pts, pts_inref, 0, -1, xd->width, 1); pts += 2; pts_inref += 2; @@ -1926,8 +1750,7 @@ } #else #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[0] == ref_frame_nrs && - mbmi->ref_frame_nrs[1] == INVALID_IDX) + if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == INVALID_IDX) #else if (mbmi->ref_frame[0] == ref_frame && mbmi->ref_frame[1] == NONE_FRAME) #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h index 130fe27..11506df 100644 --- a/av1/common/mvref_common.h +++ b/av1/common/mvref_common.h
@@ -313,36 +313,6 @@ int lst_map_idx, int gld_map_idx); #endif // !CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING -static INLINE void av1_collect_neighbors_ref_counts_nrs( - const AV1_COMMON *const cm, MACROBLOCKD *const xd) { - (void)cm; - av1_zero(xd->neighbors_ref_counts_nrs); - - uint8_t *const ref_counts = xd->neighbors_ref_counts_nrs; - - const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; - const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; - const int above_in_image = xd->up_available; - const int left_in_image = xd->left_available; - - // Above neighbor - if (above_in_image && is_inter_block(above_mbmi)) { - ref_counts[above_mbmi->ref_frame_nrs[0]]++; - if (has_second_ref(above_mbmi)) { - ref_counts[above_mbmi->ref_frame_nrs[1]]++; - } - } - - // Left neighbor - if (left_in_image && is_inter_block(left_mbmi)) { - ref_counts[left_mbmi->ref_frame_nrs[0]]++; - if (has_second_ref(left_mbmi)) { - ref_counts[left_mbmi->ref_frame_nrs[1]]++; - } - } -} -#else static INLINE void av1_collect_neighbors_ref_counts(MACROBLOCKD *const xd) { av1_zero(xd->neighbors_ref_counts); @@ -369,7 +339,6 @@ } } } -#endif // CONFIG_NEW_REF_SIGNALING void av1_copy_frame_mvs(const AV1_COMMON *const cm, const MB_MODE_INFO *const mi, int mi_row, int mi_col, @@ -378,15 +347,6 @@ // The global_mvs output parameter points to an array of REF_FRAMES elements. // The caller may pass a null global_mvs if it does not need the global_mvs // output. -#if CONFIG_NEW_REF_SIGNALING -void av1_find_mv_refs_nrs(const AV1_COMMON *cm, const MACROBLOCKD *xd, - MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame_nrs, - uint8_t ref_mv_count[MODE_CTX_REF_FRAMES], - CANDIDATE_MV ref_mv_stack[][MAX_REF_MV_STACK_SIZE], - uint16_t ref_mv_weight[][MAX_REF_MV_STACK_SIZE], - int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES], - int_mv *global_mvs, int16_t *mode_context); -#else void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, MB_MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame, uint8_t ref_mv_count[MODE_CTX_REF_FRAMES], @@ -394,7 +354,6 @@ uint16_t ref_mv_weight[][MAX_REF_MV_STACK_SIZE], int_mv mv_ref_list[][MAX_MV_REF_CANDIDATES], int_mv *global_mvs, int16_t *mode_context); -#endif // CONFIG_NEW_REF_SIGNALING // check a list of motion vectors by sad score using a number rows of pixels // above and a number cols of pixels in the left to select the one with best
diff --git a/av1/common/pred_common.c b/av1/common/pred_common.c index 5e2f2e5..d4093ff 100644 --- a/av1/common/pred_common.c +++ b/av1/common/pred_common.c
@@ -103,8 +103,8 @@ } #define JOINT_DIST_QINDEX_ORDERING 1 -void av1_get_ref_frames_nrs(AV1_COMMON *cm, int cur_frame_disp, - RefFrameMapPair *ref_frame_map_pairs) { +void av1_get_ref_frames(AV1_COMMON *cm, int cur_frame_disp, + RefFrameMapPair *ref_frame_map_pairs) { RefScoreData scores[REF_FRAMES_NRS]; memset(scores, 0, REF_FRAMES_NRS * sizeof(*scores)); for (int i = 0; i < REF_FRAMES_NRS; i++) scores[i].score = INT_MAX; @@ -382,21 +382,11 @@ // Returns a context number for the given MB prediction signal static InterpFilter get_ref_filter_type(const MB_MODE_INFO *ref_mbmi, const MACROBLOCKD *xd, int dir, -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs -#else - MV_REFERENCE_FRAME ref_frame -#endif // CONFIG_NEW_REF_SIGNALING -) { + MV_REFERENCE_FRAME ref_frame) { (void)xd; -#if CONFIG_NEW_REF_SIGNALING - if (ref_mbmi->ref_frame_nrs[0] != ref_frame_nrs && - ref_mbmi->ref_frame_nrs[1] != ref_frame_nrs) { -#else if (ref_mbmi->ref_frame[0] != ref_frame && ref_mbmi->ref_frame[1] != ref_frame) { -#endif // CONFIG_NEW_REF_SIGNALING return SWITCHABLE_FILTERS; } #if CONFIG_REMOVE_DUAL_FILTER @@ -410,15 +400,14 @@ int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir) { const MB_MODE_INFO *const mbmi = xd->mi[0]; #if CONFIG_NEW_REF_SIGNALING - const int ctx_offset = (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS && - mbmi->ref_frame_nrs[1] != INVALID_IDX) * + const int ctx_offset = (mbmi->ref_frame[1] != INTRA_FRAME_NRS && + mbmi->ref_frame[1] != INVALID_IDX) * INTER_FILTER_COMP_OFFSET; - const MV_REFERENCE_FRAME ref_frame = mbmi->ref_frame_nrs[0]; #else const int ctx_offset = (mbmi->ref_frame[1] > INTRA_FRAME) * INTER_FILTER_COMP_OFFSET; - const MV_REFERENCE_FRAME ref_frame = mbmi->ref_frame[0]; #endif // CONFIG_NEW_REF_SIGNALING + const MV_REFERENCE_FRAME ref_frame = mbmi->ref_frame[0]; assert(dir == 0 || dir == 1); // Note: // The mode info data structure has a one element border above and to the @@ -549,44 +538,25 @@ // The prediction flags in these dummy entries are initialized to 0. if (has_above && has_left) { // both edges available if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi)) - // neither edge uses comp pred (0/1) -#if CONFIG_NEW_REF_SIGNALING - ctx = IS_BACKWARD_REF_FRAME(above_mbmi->ref_frame_nrs[0]) ^ - IS_BACKWARD_REF_FRAME(left_mbmi->ref_frame_nrs[0]); -#else + // neither edge uses comp pred (0/1) ctx = IS_BACKWARD_REF_FRAME(above_mbmi->ref_frame[0]) ^ IS_BACKWARD_REF_FRAME(left_mbmi->ref_frame[0]); -#endif // CONFIG_NEW_REF_SIGNALING else if (!has_second_ref(above_mbmi)) - // one of two edges uses comp pred (2/3) -#if CONFIG_NEW_REF_SIGNALING - ctx = 2 + (IS_BACKWARD_REF_FRAME(above_mbmi->ref_frame_nrs[0]) || - !is_inter_block(above_mbmi)); -#else + // one of two edges uses comp pred (2/3) ctx = 2 + (IS_BACKWARD_REF_FRAME(above_mbmi->ref_frame[0]) || !is_inter_block(above_mbmi)); -#endif // CONFIG_NEW_REF_SIGNALING else if (!has_second_ref(left_mbmi)) - // one of two edges uses comp pred (2/3) -#if CONFIG_NEW_REF_SIGNALING - ctx = 2 + (IS_BACKWARD_REF_FRAME(left_mbmi->ref_frame_nrs[0]) || - !is_inter_block(left_mbmi)); -#else + // one of two edges uses comp pred (2/3) ctx = 2 + (IS_BACKWARD_REF_FRAME(left_mbmi->ref_frame[0]) || !is_inter_block(left_mbmi)); -#endif // CONFIG_NEW_REF_SIGNALING else // both edges use comp pred (4) ctx = 4; } else if (has_above || has_left) { // one edge available const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi; if (!has_second_ref(edge_mbmi)) - // edge does not use comp pred (0/1) -#if CONFIG_NEW_REF_SIGNALING - ctx = IS_BACKWARD_REF_FRAME(edge_mbmi->ref_frame_nrs[0]); -#else + // edge does not use comp pred (0/1) ctx = IS_BACKWARD_REF_FRAME(edge_mbmi->ref_frame[0]); -#endif // CONFIG_NEW_REF_SIGNALING else // edge uses comp pred (3) ctx = 3; @@ -601,7 +571,7 @@ int av1_get_ref_pred_context_nrs(const MACROBLOCKD *xd, MV_REFERENCE_FRAME ref, int n_total_refs) { assert((ref + 1) < n_total_refs); - const uint8_t *const ref_counts = &xd->neighbors_ref_counts_nrs[0]; + const uint8_t *const ref_counts = &xd->neighbors_ref_counts[0]; const int this_ref_count = ref_counts[ref]; int next_refs_count = 0;
diff --git a/av1/common/pred_common.h b/av1/common/pred_common.h index 8b27e6e..9985117 100644 --- a/av1/common/pred_common.h +++ b/av1/common/pred_common.h
@@ -74,9 +74,6 @@ RefFrameMapPair *ref_frame_map_pairs); #if CONFIG_NEW_REF_SIGNALING -void av1_get_ref_frames_nrs(AV1_COMMON *const cm, int cur_frame_disp, - RefFrameMapPair *ref_frame_map_pairs); - // Find the reference that is furthest in the future static INLINE int get_furthest_future_ref_index(const AV1_COMMON *const cm) { int index = INVALID_IDX; @@ -331,15 +328,10 @@ (void)cm; MB_MODE_INFO *mbmi = xd->mi[0]; #if CONFIG_NEW_REF_SIGNALING - const RefCntBuffer *const bck_buf = - get_ref_frame_buf(cm, mbmi->ref_frame_nrs[0]); - const RefCntBuffer *const fwd_buf = - get_ref_frame_buf(cm, mbmi->ref_frame_nrs[1]); MV_REFERENCE_FRAME altref_frame = get_furthest_future_ref_index(cm); -#else +#endif // CONFIG_NEW_REF_SIGNALING const RefCntBuffer *const bck_buf = get_ref_frame_buf(cm, mbmi->ref_frame[0]); const RefCntBuffer *const fwd_buf = get_ref_frame_buf(cm, mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING int bck_frame_index = 0, fwd_frame_index = 0; int cur_frame_index = cm->cur_frame->order_hint; @@ -359,7 +351,7 @@ if (above_mi) { if (has_second_ref(above_mi)) above_ctx = above_mi->comp_group_idx; #if CONFIG_NEW_REF_SIGNALING - else if (above_mi->ref_frame_nrs[0] == altref_frame) + else if (above_mi->ref_frame[0] == altref_frame) #else else if (above_mi->ref_frame[0] == ALTREF_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -368,7 +360,7 @@ if (left_mi) { if (has_second_ref(left_mi)) left_ctx = left_mi->comp_group_idx; #if CONFIG_NEW_REF_SIGNALING - else if (left_mi->ref_frame_nrs[0] == altref_frame) + else if (left_mi->ref_frame[0] == altref_frame) #else else if (left_mi->ref_frame[0] == ALTREF_FRAME) #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c index cb87073..5fc16b9 100644 --- a/av1/common/reconinter.c +++ b/av1/common/reconinter.c
@@ -141,13 +141,6 @@ #if CONFIG_EXT_ROTATION if (mi->motion_mode == SIMPLE_TRANSLATION && mi->rot_flag) { if (globalmv_rotation_allowed(xd)) { -#if CONFIG_NEW_REF_SIGNALING - // TODO(sarahparker) Temporary assert, see aomedia:3060 - assert(is_same_wm_params(&xd->global_motion[mi->ref_frame_nrs[0]], - &xd->global_motion[mi->ref_frame[0]]) - memcpy(&mi->wm_params, &xd->global_motion[mi->ref_frame_nrs[0]], - sizeof(WarpedMotionParams)); -#endif // CONFIG_NEW_REF_SIGNALING memcpy(&mi->wm_params, &xd->global_motion[mi->ref_frame[0]], sizeof(WarpedMotionParams)); } else if (simple_translation_rotation_allowed(mi)) { @@ -168,13 +161,8 @@ #if CONFIG_EXT_ROTATION xd, #endif // CONFIG_EXT_ROTATION - warp_types, -#if CONFIG_NEW_REF_SIGNALING - &xd->global_motion[mi->ref_frame_nrs[ref]], -#else - &xd->global_motion[mi->ref_frame[ref]], -#endif // CONFIG_NEW_REF_SIGNALING - 0, inter_pred_params->scale_factors, + warp_types, &xd->global_motion[mi->ref_frame[ref]], 0, + inter_pred_params->scale_factors, &inter_pred_params->warp_params)) inter_pred_params->mode = WARP_PRED; } @@ -706,12 +694,7 @@ uint8_t *pred_dst = CONVERT_TO_BYTEPTR(pred_dst16); // Compute distance between the current frame and reference const int cur_frame_index = cm->cur_frame->order_hint; -#if CONFIG_NEW_REF_SIGNALING - const RefCntBuffer *const ref_buf = - get_ref_frame_buf(cm, mi->ref_frame_nrs[ref]); -#else const RefCntBuffer *const ref_buf = get_ref_frame_buf(cm, mi->ref_frame[ref]); -#endif // CONFIG_NEW_REF_SIGNALING assert(ref_buf != NULL); const int ref_index = ref_buf->order_hint; // Find the distance in display order between the current frame and each @@ -729,12 +712,7 @@ uint8_t *tmp_buf2_8 = CONVERT_TO_BYTEPTR(tmp_buf2); int is_global[2] = { 0, 0 }; -#if CONFIG_NEW_REF_SIGNALING - const WarpedMotionParams *const wm = - &xd->global_motion[mi->ref_frame_nrs[ref]]; -#else const WarpedMotionParams *const wm = &xd->global_motion[mi->ref_frame[ref]]; -#endif // CONFIG_NEW_REF_SIGNALING is_global[ref] = is_global_mv_block(mi, wm->wmtype); const WarpTypesAllowed warp_types = { is_global[ref], mi->motion_mode == WARPED_CAUSAL }; @@ -850,12 +828,7 @@ // Compute distance between the current frame and reference const int cur_frame_index = cm->cur_frame->order_hint; -#if CONFIG_NEW_REF_SIGNALING - const RefCntBuffer *const ref_buf = - get_ref_frame_buf(cm, mi->ref_frame_nrs[ref]); -#else const RefCntBuffer *const ref_buf = get_ref_frame_buf(cm, mi->ref_frame[ref]); -#endif // CONFIG_NEW_REF_SIGNALING assert(ref_buf != NULL); const int ref_index = ref_buf->order_hint; // Find the distance in display order between the current frame and each @@ -871,12 +844,7 @@ uint8_t tmp_buf2[MAX_SB_SIZE * MAX_SB_SIZE] = { 0 }; int is_global[2] = { 0, 0 }; -#if CONFIG_NEW_REF_SIGNALING - const WarpedMotionParams *const wm = - &xd->global_motion[mi->ref_frame_nrs[ref]]; -#else const WarpedMotionParams *const wm = &xd->global_motion[mi->ref_frame[ref]]; -#endif // CONFIG_NEW_REF_SIGNALING is_global[ref] = is_global_mv_block(mi, wm->wmtype); const WarpTypesAllowed warp_types = { is_global[ref], mi->motion_mode == WARPED_CAUSAL }; @@ -1461,15 +1429,8 @@ return; } -#if CONFIG_NEW_REF_SIGNALING - const RefCntBuffer *const bck_buf = - get_ref_frame_buf(cm, mbmi->ref_frame_nrs[0]); - const RefCntBuffer *const fwd_buf = - get_ref_frame_buf(cm, mbmi->ref_frame_nrs[1]); -#else const RefCntBuffer *const bck_buf = get_ref_frame_buf(cm, mbmi->ref_frame[0]); const RefCntBuffer *const fwd_buf = get_ref_frame_buf(cm, mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING const int cur_frame_index = cm->cur_frame->order_hint; int bck_frame_index = 0, fwd_frame_index = 0; @@ -1581,17 +1542,10 @@ struct buf_2d *const dst_buf = &pd->dst; uint8_t *dst = dst_buf->buf + dst_buf->stride * y + x; int ref = 0; -#if CONFIG_NEW_REF_SIGNALING - const RefCntBuffer *ref_buf = - get_ref_frame_buf(cm, this_mbmi->ref_frame_nrs[ref]); - const struct scale_factors *ref_scale_factors = - get_ref_scale_factors_const(cm, this_mbmi->ref_frame_nrs[ref]); -#else const RefCntBuffer *ref_buf = get_ref_frame_buf(cm, this_mbmi->ref_frame[ref]); const struct scale_factors *ref_scale_factors = get_ref_scale_factors_const(cm, this_mbmi->ref_frame[ref]); -#endif // CONFIG_NEW_REF_SIGNALING const struct scale_factors *const sf = ref_scale_factors; const struct buf_2d pre_buf = { NULL, @@ -1639,12 +1593,7 @@ int is_global[2] = { 0, 0 }; for (int ref = 0; ref < 1 + is_compound; ++ref) { -#if CONFIG_NEW_REF_SIGNALING - const WarpedMotionParams *const wm = - &xd->global_motion[mi->ref_frame_nrs[ref]]; -#else const WarpedMotionParams *const wm = &xd->global_motion[mi->ref_frame[ref]]; -#endif // CONFIG_NEW_REF_SIGNALING is_global[ref] = is_global_mv_block(mi, wm->wmtype); } @@ -1882,7 +1831,7 @@ void av1_modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) { #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = INVALID_IDX; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[1] = NONE_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -2031,17 +1980,10 @@ const int num_refs = 1 + has_second_ref(above_mbmi); for (int ref = 0; ref < num_refs; ++ref) { -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME frame = above_mbmi->ref_frame_nrs[ref]; - const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame); - const struct scale_factors *const sf = - get_ref_scale_factors_const(ctxt->cm, frame); -#else const MV_REFERENCE_FRAME frame = above_mbmi->ref_frame[ref]; const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame); const struct scale_factors *const sf = get_ref_scale_factors_const(ctxt->cm, frame); -#endif // CONFIG_NEW_REF_SIGNALING xd->block_ref_scale_factors[ref] = sf; if ((!av1_is_valid_scale(sf))) aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM, @@ -2075,17 +2017,10 @@ const int num_refs = 1 + has_second_ref(left_mbmi); for (int ref = 0; ref < num_refs; ++ref) { -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME frame = left_mbmi->ref_frame_nrs[ref]; - const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame); - const struct scale_factors *const ref_scale_factors = - get_ref_scale_factors_const(ctxt->cm, frame); -#else const MV_REFERENCE_FRAME frame = left_mbmi->ref_frame[ref]; const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame); const struct scale_factors *const ref_scale_factors = get_ref_scale_factors_const(ctxt->cm, frame); -#endif // CONFIG_NEW_REF_SIGNALING xd->block_ref_scale_factors[ref] = ref_scale_factors; if ((!av1_is_valid_scale(ref_scale_factors)))
diff --git a/av1/common/warped_motion.c b/av1/common/warped_motion.c index c292eae..73c9ab6 100644 --- a/av1/common/warped_motion.c +++ b/av1/common/warped_motion.c
@@ -1108,13 +1108,8 @@ MB_MODE_INFO *mbmi = xd->mi[0]; if (mbmi->motion_mode != SIMPLE_TRANSLATION) return 0; if (mbmi->mode != GLOBALMV) return 0; -#if CONFIG_NEW_REF_SIGNALING - if (xd->global_motion[mbmi->ref_frame_nrs[0]].invalid) return 0; - if (xd->global_motion[mbmi->ref_frame_nrs[0]].wmtype == IDENTITY) return 0; -#else if (xd->global_motion[mbmi->ref_frame[0]].invalid) return 0; if (xd->global_motion[mbmi->ref_frame[0]].wmtype == IDENTITY) return 0; -#endif // CONFIG_NEW_REF_SIGNALING // smaller blocks don't benefit from EXT_ROTATION if (mbmi->sb_type < BLOCK_8X8 || mbmi->sb_type == BLOCK_4X16 || mbmi->sb_type == BLOCK_16X4)
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 9137cc8..1d28eed 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -911,26 +911,19 @@ const int mi_row = xd->mi_row; const int mi_col = xd->mi_col; for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME frame = mbmi->ref_frame_nrs[ref]; - if (frame == INTRA_FRAME_NRS) { - assert(is_intrabc_block(mbmi)); - assert(ref == 0); - } else { - const RefCntBuffer *ref_buf = get_ref_frame_buf(cm, frame); - const struct scale_factors *ref_scale_factors = - get_ref_scale_factors_const(cm, frame); -#else const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; +#if CONFIG_NEW_REF_SIGNALING + if (frame == INTRA_FRAME_NRS) { +#else if (frame < LAST_FRAME) { - assert(is_intrabc_block(mbmi)); assert(frame == INTRA_FRAME); +#endif // CONFIG_NEW_REF_SIGNALING + assert(is_intrabc_block(mbmi)); assert(ref == 0); } else { const RefCntBuffer *ref_buf = get_ref_frame_buf(cm, frame); const struct scale_factors *ref_scale_factors = get_ref_scale_factors_const(cm, frame); -#endif // CONFIG_NEW_REF_SIGNALING xd->block_ref_scale_factors[ref] = ref_scale_factors; av1_setup_pre_planes(xd, ref, &ref_buf->buf, mi_row, mi_col, ref_scale_factors, num_planes, @@ -5411,8 +5404,8 @@ // initialize without pyramid levels init_ref_map_pair(cm, ref_frame_map_pairs, current_frame->frame_type == KEY_FRAME); - av1_get_ref_frames_nrs(cm, current_frame->display_order_hint, - ref_frame_map_pairs); + av1_get_ref_frames(cm, current_frame->display_order_hint, + ref_frame_map_pairs); #else int frame_refs_short_signaling = 0; // Frame refs short signaling is off when error resilient mode is on.
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 9c95bfb..78ff42a 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -225,11 +225,7 @@ FRAME_CONTEXT *ec_ctx, DecoderCodingBlock *dcb, MB_MODE_INFO *mbmi, aom_reader *r) { MACROBLOCKD *const xd = &dcb->xd; -#if CONFIG_NEW_REF_SIGNALING - uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING mbmi->ref_mv_idx = 0; assert(!mbmi->skip_mode); const int range = av1_drl_range(dcb->ref_mv_count[ref_frame_type], @@ -247,11 +243,7 @@ static void read_drl_idx(FRAME_CONTEXT *ec_ctx, DecoderCodingBlock *dcb, MB_MODE_INFO *mbmi, aom_reader *r) { MACROBLOCKD *const xd = &dcb->xd; -#if CONFIG_NEW_REF_SIGNALING - uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING mbmi->ref_mv_idx = 0; if (mbmi->mode == NEWMV || mbmi->mode == NEW_NEWMV) { for (int idx = 0; idx < MAX_DRL_BITS; ++idx) { @@ -819,16 +811,16 @@ // TODO(kslu): Rework av1_find_mv_refs_nrs to avoid having this big array // ref_mvs int_mv ref_mvs[INTRA_FRAME_NRS + 1][MAX_MV_REF_CANDIDATES]; - av1_find_mv_refs_nrs(cm, xd, mbmi, INTRA_FRAME_NRS, dcb->ref_mv_count, - xd->ref_mv_stack, xd->weight, ref_mvs, - /*global_mvs=*/NULL, inter_mode_ctx); + av1_find_mv_refs(cm, xd, mbmi, INTRA_FRAME_NRS, dcb->ref_mv_count, + xd->ref_mv_stack, xd->weight, ref_mvs, + /*global_mvs=*/NULL, inter_mode_ctx); av1_find_best_ref_mvs(ref_mvs[INTRA_FRAME_NRS], &nearestmv, &nearmv, cm->features.fr_mv_precision); #else int_mv ref_mvs[INTRA_FRAME + 1][MAX_MV_REF_CANDIDATES]; av1_find_mv_refs(cm, xd, mbmi, INTRA_FRAME, dcb->ref_mv_count, - xd->ref_mv_stack, xd->weight, ref_mvs, /*global_mvs=*/NULL, - inter_mode_ctx); + xd->ref_mv_stack, xd->weight, ref_mvs, + /*global_mvs=*/NULL, inter_mode_ctx); av1_find_best_ref_mvs(ref_mvs[INTRA_FRAME], &nearestmv, &nearmv, cm->features.fr_mv_precision); #endif // CONFIG_NEW_REF_SIGNALING @@ -926,8 +918,8 @@ mbmi->current_qindex = xd->current_base_qindex; #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = INTRA_FRAME_NRS; - mbmi->ref_frame_nrs[1] = INVALID_IDX; + mbmi->ref_frame[0] = INTRA_FRAME_NRS; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[0] = INTRA_FRAME; mbmi->ref_frame[1] = NONE_FRAME; @@ -1108,80 +1100,68 @@ } #endif // !CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING -static void set_ref_frames_for_skip_mode_nrs( - AV1_COMMON *const cm, MV_REFERENCE_FRAME ref_frame_nrs[2]) { - ref_frame_nrs[0] = cm->current_frame.skip_mode_info.ref_frame_idx_0; - ref_frame_nrs[1] = cm->current_frame.skip_mode_info.ref_frame_idx_1; -} -#else static void set_ref_frames_for_skip_mode(AV1_COMMON *const cm, MV_REFERENCE_FRAME ref_frame[2]) { +#if CONFIG_NEW_REF_SIGNALING + ref_frame[0] = cm->current_frame.skip_mode_info.ref_frame_idx_0; + ref_frame[1] = cm->current_frame.skip_mode_info.ref_frame_idx_1; +#else ref_frame[0] = LAST_FRAME + cm->current_frame.skip_mode_info.ref_frame_idx_0; ref_frame[1] = LAST_FRAME + cm->current_frame.skip_mode_info.ref_frame_idx_1; -} #endif // CONFIG_NEW_REF_SIGNALING +} #if CONFIG_NEW_REF_SIGNALING static AOM_INLINE void read_single_ref_nrs( - MACROBLOCKD *const xd, MV_REFERENCE_FRAME ref_frame_nrs[2], + MACROBLOCKD *const xd, MV_REFERENCE_FRAME ref_frame[2], const NewRefFramesData *const new_ref_frame_data, aom_reader *r) { const int n_refs = new_ref_frame_data->n_total_refs; for (int i = 0; i < n_refs - 1; i++) { const int bit = aom_read_symbol( r, av1_get_pred_cdf_single_ref_nrs(xd, i, n_refs), 2, ACCT_STR); if (bit) { - ref_frame_nrs[0] = i; + ref_frame[0] = i; return; } } - ref_frame_nrs[0] = n_refs - 1; + ref_frame[0] = n_refs - 1; } static AOM_INLINE void read_compound_ref_nrs( - const MACROBLOCKD *xd, MV_REFERENCE_FRAME ref_frame_nrs[2], + const MACROBLOCKD *xd, MV_REFERENCE_FRAME ref_frame[2], const NewRefFramesData *const new_ref_frame_data, aom_reader *r) { const int n_refs = new_ref_frame_data->n_total_refs; assert(n_refs >= 2); int n_bits = 0; for (int i = 0; i < n_refs + n_bits - 2 && n_bits < 2; i++) { const int bit_type = av1_get_compound_ref_bit_type( - n_bits, new_ref_frame_data, ref_frame_nrs[0], i); + n_bits, new_ref_frame_data, ref_frame[0], i); const int bit = aom_read_symbol( r, av1_get_pred_cdf_compound_ref_nrs(xd, i, n_bits, bit_type, n_refs), 2, ACCT_STR); if (bit) { - ref_frame_nrs[n_bits++] = i; + ref_frame[n_bits++] = i; } } - if (n_bits < 2) ref_frame_nrs[1] = n_refs - 1; - if (n_bits < 1) ref_frame_nrs[0] = n_refs - 2; + if (n_bits < 2) ref_frame[1] = n_refs - 1; + if (n_bits < 1) ref_frame[0] = n_refs - 2; } #endif // CONFIG_NEW_REF_SIGNALING // Read the referncence frame static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd, aom_reader *r, int segment_id, -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs[2] -#else - MV_REFERENCE_FRAME ref_frame[2] -#endif // CONFIG_NEW_REF_SIGNALING -) { + MV_REFERENCE_FRAME ref_frame[2]) { if (xd->mi[0]->skip_mode) { -#if CONFIG_NEW_REF_SIGNALING - set_ref_frames_for_skip_mode_nrs(cm, ref_frame_nrs); -#else set_ref_frames_for_skip_mode(cm, ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING return; } #if CONFIG_NEW_REF_SIGNALING if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP) || segfeature_active(&cm->seg, segment_id, SEG_LVL_GLOBALMV)) { - ref_frame_nrs[0] = get_closest_pastcur_ref_index(cm); - ref_frame_nrs[1] = INVALID_IDX; + ref_frame[0] = get_closest_pastcur_ref_index(cm); + ref_frame[1] = INVALID_IDX; #else if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) { ref_frame[0] = (MV_REFERENCE_FRAME)get_segdata(&cm->seg, segment_id, @@ -1196,7 +1176,7 @@ const REFERENCE_MODE mode = read_block_reference_mode(cm, xd, r); if (mode == COMPOUND_REFERENCE) { #if CONFIG_NEW_REF_SIGNALING - read_compound_ref_nrs(xd, ref_frame_nrs, &cm->new_ref_frame_data, r); + read_compound_ref_nrs(xd, ref_frame, &cm->new_ref_frame_data, r); #else const COMP_REFERENCE_TYPE comp_ref_type = read_comp_reference_type(xd, r); @@ -1249,8 +1229,8 @@ #endif // CONFIG_NEW_REF_SIGNALING } else if (mode == SINGLE_REFERENCE) { #if CONFIG_NEW_REF_SIGNALING - read_single_ref_nrs(xd, ref_frame_nrs, &cm->new_ref_frame_data, r); - ref_frame_nrs[1] = INVALID_IDX; + read_single_ref_nrs(xd, ref_frame, &cm->new_ref_frame_data, r); + ref_frame[1] = INVALID_IDX; #else const int bit0 = READ_REF_BIT(single_ref_p1); if (bit0) { @@ -1332,8 +1312,8 @@ const int use_angle_delta = av1_use_angle_delta(bsize); #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = INTRA_FRAME_NRS; - mbmi->ref_frame_nrs[1] = INVALID_IDX; + mbmi->ref_frame[0] = INTRA_FRAME_NRS; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[0] = INTRA_FRAME; mbmi->ref_frame[1] = NONE_FRAME; @@ -1409,15 +1389,10 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd, PREDICTION_MODE mode, -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs[2], -#else - MV_REFERENCE_FRAME ref_frame[2], -#endif // CONFIG_NEW_REF_SIGNALING - int_mv mv[2], int_mv ref_mv[2], - int_mv nearest_mv[2], int_mv near_mv[2], - int is_compound, MvSubpelPrecision precision, - aom_reader *r) { + MV_REFERENCE_FRAME ref_frame[2], int_mv mv[2], + int_mv ref_mv[2], int_mv nearest_mv[2], + int_mv near_mv[2], int is_compound, + MvSubpelPrecision precision, aom_reader *r) { #if CONFIG_NEW_INTER_MODES (void)nearest_mv; #endif // CONFIG_NEW_INTER_MODES @@ -1445,18 +1420,10 @@ break; } case GLOBALMV: { -#if CONFIG_NEW_REF_SIGNALING - // TODO(sarahparker) Temporary assert, see aomedia:3060 - mv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame_nrs[0]], - features->fr_mv_precision, bsize, - xd->mi_col, xd->mi_row) - .as_int; -#else mv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame[0]], features->fr_mv_precision, bsize, xd->mi_col, xd->mi_row) .as_int; -#endif // CONFIG_NEW_REF_SIGNALING break; } case NEW_NEWMV: @@ -1533,17 +1500,6 @@ #endif // CONFIG_OPTFLOW_REFINEMENT { assert(is_compound); -#if CONFIG_NEW_REF_SIGNALING - // TODO(sarahparker) Temporary assert, see aomedia:3060 - mv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame_nrs[0]], - features->fr_mv_precision, bsize, - xd->mi_col, xd->mi_row) - .as_int; - mv[1].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame_nrs[1]], - features->fr_mv_precision, bsize, - xd->mi_col, xd->mi_row) - .as_int; -#else mv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame[0]], features->fr_mv_precision, bsize, xd->mi_col, xd->mi_row) @@ -1552,7 +1508,6 @@ features->fr_mv_precision, bsize, xd->mi_col, xd->mi_row) .as_int; -#endif // CONFIG_NEW_REF_SIGNALING break; } default: { return 0; } @@ -1610,14 +1565,9 @@ "newmv_ctx=%d, zeromv_ctx=%d, refmv_ctx=%d, tx_size=%d\n", cm->current_frame.frame_number, mi_row, mi_col, mbmi->skip_mode, mbmi->mode, mbmi->sb_type, cm->show_frame, mv[0].as_mv.row, - mv[0].as_mv.col, mv[1].as_mv.row, mv[1].as_mv.col, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1], -#else - mbmi->ref_frame[0], mbmi->ref_frame[1], -#endif // CONFIG_NEW_REF_SIGNALING - mbmi->motion_mode, mode_ctx, newmv_ctx, zeromv_ctx, refmv_ctx, - mbmi->tx_size); + mv[0].as_mv.col, mv[1].as_mv.row, mv[1].as_mv.col, mbmi->ref_frame[0], + mbmi->ref_frame[1], mbmi->motion_mode, mode_ctx, newmv_ctx, zeromv_ctx, + refmv_ctx, mbmi->tx_size); } } #endif // DEC_MISMATCH_DEBUG @@ -1642,31 +1592,14 @@ mbmi->palette_mode_info.palette_size[0] = 0; mbmi->palette_mode_info.palette_size[1] = 0; -#if CONFIG_NEW_REF_SIGNALING - av1_collect_neighbors_ref_counts_nrs(cm, xd); -#else av1_collect_neighbors_ref_counts(xd); -#endif // CONFIG_NEW_REF_SIGNALING - read_ref_frames(cm, xd, r, mbmi->segment_id, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs -#else - mbmi->ref_frame -#endif // CONFIG_NEW_REF_SIGNALING - ); + read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame); const int is_compound = has_second_ref(mbmi); -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs = av1_ref_frame_type(mbmi->ref_frame_nrs); - av1_find_mv_refs_nrs(cm, xd, mbmi, ref_frame_nrs, dcb->ref_mv_count, - xd->ref_mv_stack, xd->weight, ref_mvs, - /*global_mvs=*/NULL, inter_mode_ctx); -#else const MV_REFERENCE_FRAME ref_frame = av1_ref_frame_type(mbmi->ref_frame); av1_find_mv_refs(cm, xd, mbmi, ref_frame, dcb->ref_mv_count, xd->ref_mv_stack, xd->weight, ref_mvs, /*global_mvs=*/NULL, inter_mode_ctx); -#endif // CONFIG_NEW_REF_SIGNALING mbmi->ref_mv_idx = 0; @@ -1683,13 +1616,8 @@ segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_GLOBALMV)) { mbmi->mode = GLOBALMV; } else { - const int16_t mode_ctx = av1_mode_context_analyzer(inter_mode_ctx, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs -#else - mbmi->ref_frame -#endif // CONFIG_NEW_REF_SIGNALING - ); + const int16_t mode_ctx = + av1_mode_context_analyzer(inter_mode_ctx, mbmi->ref_frame); if (is_compound) mbmi->mode = read_inter_compound_mode(xd, r, mode_ctx); else @@ -1700,13 +1628,7 @@ read_drl_idx( #if CONFIG_NEW_INTER_MODES cm->features.max_drl_bits, - av1_mode_context_pristine(inter_mode_ctx, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs -#else - mbmi->ref_frame -#endif // CONFIG_NEW_REF_SIGNALING - ), + av1_mode_context_pristine(inter_mode_ctx, mbmi->ref_frame), #endif // CONFIG_NEW_INTER_MODES ec_ctx, dcb, mbmi, r); } @@ -1716,25 +1638,14 @@ if (is_compound != is_inter_compound_mode(mbmi->mode)) { aom_internal_error(xd->error_info, AOM_CODEC_CORRUPT_FRAME, "Prediction mode %d invalid with ref frame %d %d", - mbmi->mode, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1] -#else - mbmi->ref_frame[0], mbmi->ref_frame[1] -#endif // CONFIG_NEW_REF_SIGNALING - ); + mbmi->mode, mbmi->ref_frame[0], mbmi->ref_frame[1]); } // Note: the ref_mvs are constructed at frame level precision, but we may // additionally down scale the precision later during assign_mv call. if (!is_compound && mbmi->mode != GLOBALMV) { -#if CONFIG_NEW_REF_SIGNALING - av1_find_best_ref_mvs(ref_mvs[mbmi->ref_frame_nrs[0]], &nearestmv[0], - &nearmv[0], fr_mv_precision); -#else av1_find_best_ref_mvs(ref_mvs[mbmi->ref_frame[0]], &nearestmv[0], &nearmv[0], fr_mv_precision); -#endif // CONFIG_NEW_REF_SIGNALING } if (is_compound && mbmi->mode != GLOBAL_GLOBALMV) { @@ -1743,39 +1654,22 @@ #else int ref_mv_idx = mbmi->ref_mv_idx + 1; #endif // CONFIG_NEW_INTER_MODES -#if CONFIG_NEW_REF_SIGNALING - nearestmv[0] = xd->ref_mv_stack[ref_frame_nrs][0].this_mv; - nearestmv[1] = xd->ref_mv_stack[ref_frame_nrs][0].comp_mv; - nearmv[0] = xd->ref_mv_stack[ref_frame_nrs][ref_mv_idx].this_mv; - nearmv[1] = xd->ref_mv_stack[ref_frame_nrs][ref_mv_idx].comp_mv; -#else nearestmv[0] = xd->ref_mv_stack[ref_frame][0].this_mv; nearestmv[1] = xd->ref_mv_stack[ref_frame][0].comp_mv; nearmv[0] = xd->ref_mv_stack[ref_frame][ref_mv_idx].this_mv; nearmv[1] = xd->ref_mv_stack[ref_frame][ref_mv_idx].comp_mv; -#endif // CONFIG_NEW_REF_SIGNALING lower_mv_precision(&nearestmv[0].as_mv, fr_mv_precision); lower_mv_precision(&nearestmv[1].as_mv, fr_mv_precision); lower_mv_precision(&nearmv[0].as_mv, fr_mv_precision); lower_mv_precision(&nearmv[1].as_mv, fr_mv_precision); #if CONFIG_NEW_INTER_MODES } else if (mbmi->mode == NEARMV) { -#if CONFIG_NEW_REF_SIGNALING - nearmv[0] = - xd->ref_mv_stack[mbmi->ref_frame_nrs[0]][mbmi->ref_mv_idx].this_mv; -#else nearmv[0] = xd->ref_mv_stack[mbmi->ref_frame[0]][mbmi->ref_mv_idx].this_mv; -#endif // CONFIG_NEW_REF_SIGNALING } #else } else if (mbmi->ref_mv_idx > 0 && mbmi->mode == NEARMV) { -#if CONFIG_NEW_REF_SIGNALING - nearmv[0] = - xd->ref_mv_stack[mbmi->ref_frame_nrs[0]][1 + mbmi->ref_mv_idx].this_mv; -#else nearmv[0] = xd->ref_mv_stack[mbmi->ref_frame[0]][1 + mbmi->ref_mv_idx].this_mv; -#endif // CONFIG_NEW_REF_SIGNALING } #endif // CONFIG_NEW_INTER_MODES @@ -1792,27 +1686,14 @@ #endif // !CONFIG_NEW_INTER_MODES // TODO(jingning, yunqing): Do we need a lower_mv_precision() call here? if (compound_ref0_mode(mbmi->mode) == NEWMV) -#if CONFIG_NEW_REF_SIGNALING - ref_mv[0] = xd->ref_mv_stack[ref_frame_nrs][ref_mv_idx].this_mv; -#else ref_mv[0] = xd->ref_mv_stack[ref_frame][ref_mv_idx].this_mv; -#endif // CONFIG_NEW_REF_SIGNALING if (compound_ref1_mode(mbmi->mode) == NEWMV) -#if CONFIG_NEW_REF_SIGNALING - ref_mv[1] = xd->ref_mv_stack[ref_frame_nrs][ref_mv_idx].comp_mv; -#else ref_mv[1] = xd->ref_mv_stack[ref_frame][ref_mv_idx].comp_mv; -#endif // CONFIG_NEW_REF_SIGNALING } else { if (mbmi->mode == NEWMV) { -#if CONFIG_NEW_REF_SIGNALING - if (dcb->ref_mv_count[ref_frame_nrs] > 1) - ref_mv[0] = xd->ref_mv_stack[ref_frame_nrs][mbmi->ref_mv_idx].this_mv; -#else if (dcb->ref_mv_count[ref_frame] > 1) ref_mv[0] = xd->ref_mv_stack[ref_frame][mbmi->ref_mv_idx].this_mv; -#endif // CONFIG_NEW_REF_SIGNALING } } #if CONFIG_NEW_INTER_MODES @@ -1825,14 +1706,8 @@ #endif // CONFIG_NEW_INTER_MODES const int mv_corrupted_flag = - !assign_mv(cm, xd, mbmi->mode, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs, -#else - mbmi->ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - mbmi->mv, ref_mv, nearestmv, nearmv, is_compound, - mbmi->pb_mv_precision, r); + !assign_mv(cm, xd, mbmi->mode, mbmi->ref_frame, mbmi->mv, ref_mv, + nearestmv, nearmv, is_compound, mbmi->pb_mv_precision, r); aom_merge_corrupted_flag(&dcb->corrupted, mv_corrupted_flag); mbmi->use_wedge_interintra = 0; @@ -1842,7 +1717,7 @@ const int interintra = aom_read_symbol(r, ec_ctx->interintra_cdf[bsize_group], 2, ACCT_STR); #if CONFIG_NEW_REF_SIGNALING - assert(mbmi->ref_frame_nrs[1] == INVALID_IDX); + assert(mbmi->ref_frame[1] == INVALID_IDX); #else assert(mbmi->ref_frame[1] == NONE_FRAME); #endif // CONFIG_NEW_REF_SIGNALING @@ -1850,7 +1725,7 @@ const INTERINTRA_MODE interintra_mode = read_interintra_mode(xd, r, bsize_group); #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = INTRA_FRAME_NRS; + mbmi->ref_frame[1] = INTRA_FRAME_NRS; #else mbmi->ref_frame[1] = INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -1870,13 +1745,8 @@ } for (int ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME frame = mbmi->ref_frame_nrs[ref]; - xd->block_ref_scale_factors[ref] = get_ref_scale_factors_const(cm, frame); -#else const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; xd->block_ref_scale_factors[ref] = get_ref_scale_factors_const(cm, frame); -#endif // CONFIG_NEW_REF_SIGNALING } mbmi->motion_mode = SIMPLE_TRANSLATION; @@ -1888,7 +1758,7 @@ av1_count_overlappable_neighbors(cm, xd); #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS) + if (mbmi->ref_frame[1] != INTRA_FRAME_NRS) #else if (mbmi->ref_frame[1] != INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/decoder/inspection.c b/av1/decoder/inspection.c index 48132b5..5763024 100644 --- a/av1/decoder/inspection.c +++ b/av1/decoder/inspection.c
@@ -83,10 +83,6 @@ // Reference Frames mi->ref_frame[0] = mbmi->ref_frame[0]; mi->ref_frame[1] = mbmi->ref_frame[1]; -#if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = mbmi->ref_frame_nrs[0]; - mi->ref_frame_nrs[1] = mbmi->ref_frame_nrs[1]; -#endif // CONFIG_NEW_REF_SIGNALING // Prediction Mode mi->mode = mbmi->mode;
diff --git a/av1/decoder/inspection.h b/av1/decoder/inspection.h index ac8fc6f..4e4014d 100644 --- a/av1/decoder/inspection.h +++ b/av1/decoder/inspection.h
@@ -35,9 +35,10 @@ struct insp_mi_data { insp_mv mv[2]; - int16_t ref_frame[2]; #if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME_NRS_16 ref_frame_nrs[2]; + MV_REFERENCE_FRAME_NRS_16 ref_frame[2]; +#else + int16_t ref_frame[2]; #endif // CONFIG_NEW_REF_SIGNALING int16_t mode; int16_t uv_mode;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 12805f6..d602da3 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -709,7 +709,7 @@ const MACROBLOCKD *xd, const NewRefFramesData *const new_ref_frame_data, aom_writer *w) { const MB_MODE_INFO *const mbmi = xd->mi[0]; - MV_REFERENCE_FRAME ref = mbmi->ref_frame_nrs[0]; + MV_REFERENCE_FRAME ref = mbmi->ref_frame[0]; const int n_refs = new_ref_frame_data->n_total_refs; assert(ref < n_refs); for (int i = 0; i < n_refs - 1; i++) { @@ -724,8 +724,8 @@ const MACROBLOCKD *xd, const NewRefFramesData *const new_ref_frame_data, aom_writer *w) { const MB_MODE_INFO *const mbmi = xd->mi[0]; - MV_REFERENCE_FRAME ref0 = mbmi->ref_frame_nrs[0]; - MV_REFERENCE_FRAME ref1 = mbmi->ref_frame_nrs[1]; + MV_REFERENCE_FRAME ref0 = mbmi->ref_frame[0]; + MV_REFERENCE_FRAME ref1 = mbmi->ref_frame[1]; const int n_refs = new_ref_frame_data->n_total_refs; assert(n_refs >= 2); assert(ref0 < ref1); @@ -757,7 +757,7 @@ #if CONFIG_NEW_REF_SIGNALING if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP) || segfeature_active(&cm->seg, segment_id, SEG_LVL_GLOBALMV)) { - assert(mbmi->ref_frame_nrs[0] == get_closest_pastcur_ref_index(cm)); + assert(mbmi->ref_frame[0] == get_closest_pastcur_ref_index(cm)); #else if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) { assert(!is_compound); @@ -1412,13 +1412,8 @@ ref_mv_idx += 1; #endif // !CONFIG_NEW_INTER_MODES } - return get_ref_mv_from_stack(ref_idx, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs, -#else - mbmi->ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - ref_mv_idx, x->mbmi_ext_frame); + return get_ref_mv_from_stack(ref_idx, mbmi->ref_frame, ref_mv_idx, + x->mbmi_ext_frame); } static AOM_INLINE void pack_inter_mode_mvs(AV1_COMP *cpi, aom_writer *w) { @@ -1461,21 +1456,12 @@ } else { int16_t mode_ctx; -#if CONFIG_NEW_REF_SIGNALING - av1_collect_neighbors_ref_counts_nrs(cm, xd); -#else av1_collect_neighbors_ref_counts(xd); -#endif // CONFIG_NEW_REF_SIGNALING write_ref_frames(cm, xd, w); mode_ctx = -#if CONFIG_NEW_REF_SIGNALING - mode_context_analyzer(mbmi_ext_frame->mode_context, - mbmi->ref_frame_nrs); -#else mode_context_analyzer(mbmi_ext_frame->mode_context, mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING // If segment skip is not enabled code the mode. if (!segfeature_active(seg, segment_id, SEG_LVL_SKIP)) { @@ -1543,7 +1529,7 @@ cpi->common.seq_params.enable_interintra_compound && is_interintra_allowed(mbmi)) { #if CONFIG_NEW_REF_SIGNALING - const int interintra = mbmi->ref_frame_nrs[1] == INTRA_FRAME_NRS; + const int interintra = mbmi->ref_frame[1] == INTRA_FRAME_NRS; #else const int interintra = mbmi->ref_frame[1] == INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -1565,7 +1551,7 @@ } #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS) + if (mbmi->ref_frame[1] != INTRA_FRAME_NRS) write_motion_mode(cm, xd, mbmi, w); #else if (mbmi->ref_frame[1] != INTRA_FRAME) write_motion_mode(cm, xd, mbmi, w); @@ -1751,12 +1737,7 @@ const int16_t mode_ctx = is_comp_ref ? 0 : mode_context_analyzer(mbmi_ext_frame->mode_context, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs -#else - mbmi->ref_frame -#endif // CONFIG_NEW_REF_SIGNALING - ); + mbmi->ref_frame); const int16_t newmv_ctx = mode_ctx & NEWMV_CTX_MASK; int16_t zeromv_ctx = -1; @@ -1776,14 +1757,9 @@ "newmv_ctx=%d, zeromv_ctx=%d, refmv_ctx=%d, tx_size=%d\n", cm->current_frame.frame_number, mi_row, mi_col, mbmi->skip_mode, mbmi->mode, bsize, cm->show_frame, mv[0].as_mv.row, mv[0].as_mv.col, - mv[1].as_mv.row, mv[1].as_mv.col, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1], -#else - mbmi->ref_frame[0], mbmi->ref_frame[1], -#endif // CONFIG_NEW_REF_SIGNALING - mbmi->motion_mode, mode_ctx, newmv_ctx, zeromv_ctx, refmv_ctx, - mbmi->tx_size); + mv[1].as_mv.row, mv[1].as_mv.col, mbmi->ref_frame[0], + mbmi->ref_frame[1], mbmi->motion_mode, mode_ctx, newmv_ctx, + zeromv_ctx, refmv_ctx, mbmi->tx_size); } } } @@ -1800,11 +1776,7 @@ // has_subpel_mv_component needs the ref frame buffers set up to look // up if they are scaled. has_subpel_mv_component is in turn needed by // write_switchable_interp_filter, which is called by pack_inter_mode_mvs. -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, m->ref_frame_nrs[0], m->ref_frame_nrs[1]); -#else set_ref_ptrs(cm, xd, m->ref_frame[0], m->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING #if ENC_MISMATCH_DEBUG enc_dump_logs(cm, &cpi->mbmi_ext_info, xd->mi_row, xd->mi_col);
diff --git a/av1/encoder/block.h b/av1/encoder/block.h index 1fa19a7..a63aba0 100644 --- a/av1/encoder/block.h +++ b/av1/encoder/block.h
@@ -352,13 +352,8 @@ int comp_rs2[COMPOUND_TYPES]; //! Motion vector for each predictor. int_mv mv[2]; -#if CONFIG_NEW_REF_SIGNALING - //! Ref frame nrs for each predictor. - MV_REFERENCE_FRAME ref_frames_nrs[2]; -#else //! Ref frame for each predictor. MV_REFERENCE_FRAME ref_frames[2]; -#endif // CONFIG_NEW_REF_SIGNALING //! Current prediction mode. PREDICTION_MODE mode; //! Current interpolation filter.
diff --git a/av1/encoder/compound_type.c b/av1/encoder/compound_type.c index 05d8208..8043f25 100644 --- a/av1/encoder/compound_type.c +++ b/av1/encoder/compound_type.c
@@ -44,20 +44,11 @@ const MACROBLOCKD *const xd = &x->e_mbd; // Match MV and reference indices for (int i = 0; i < 2; ++i) { -#if CONFIG_NEW_REF_SIGNALING - if ((st->ref_frames_nrs[i] != mi->ref_frame_nrs[i]) || -#else if ((st->ref_frames[i] != mi->ref_frame[i]) || -#endif // CONFIG_NEW_REF_SIGNALING (st->mv[i].as_int != mi->mv[i].as_int)) { return 0; } -#if CONFIG_NEW_REF_SIGNALING - const WarpedMotionParams *const wm = - &xd->global_motion[mi->ref_frame_nrs[i]]; -#else const WarpedMotionParams *const wm = &xd->global_motion[mi->ref_frame[i]]; -#endif // CONFIG_NEW_REF_SIGNALING if (is_global_mv_block(mi, wm->wmtype) != st->is_global[i]) return 0; } @@ -573,11 +564,7 @@ cpi, mbmi, xd, x, interintra_mode_cost, orig_dst, intrapred, tmp_buf, best_interintra_mode, &best_interintra_rd, cur_mode, bsize); } -#if CONFIG_NEW_REF_SIGNALING - args->inter_intra_mode[mbmi->ref_frame_nrs[0]] = *best_interintra_mode; -#else args->inter_intra_mode[mbmi->ref_frame[0]] = *best_interintra_mode; -#endif // CONFIG_NEW_REF_SIGNALING } assert(IMPLIES(!cpi->oxcf.comp_type_cfg.enable_smooth_interintra || cpi->sf.inter_sf.disable_smooth_interintra, @@ -664,11 +651,7 @@ cpi, mbmi, xd, x, interintra_mode_cost, orig_dst, intrapred, tmp_buf, best_interintra_mode, best_rd, cur_mode, bsize); } -#if CONFIG_NEW_REF_SIGNALING - args->inter_intra_mode[mbmi->ref_frame_nrs[0]] = *best_interintra_mode; -#else args->inter_intra_mode[mbmi->ref_frame[0]] = *best_interintra_mode; -#endif // CONFIG_NEW_REF_SIGNALING mbmi->interintra_mode = *best_interintra_mode; // Recompute prediction if required @@ -710,7 +693,7 @@ // Set ref_frame[1] to NONE_FRAME temporarily so that the intra // predictor is not calculated again in av1_enc_build_inter_predictor(). #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = INVALID_IDX; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[1] = NONE_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -719,7 +702,7 @@ av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, orig_dst, bsize, AOM_PLANE_Y, AOM_PLANE_Y); #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = INTRA_FRAME_NRS; + mbmi->ref_frame[1] = INTRA_FRAME_NRS; #else mbmi->ref_frame[1] = INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -777,7 +760,7 @@ // Single reference inter prediction #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = INVALID_IDX; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[1] = NONE_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -790,14 +773,12 @@ // Restore the buffers for intra prediction restore_dst_buf(xd, *orig_dst, num_planes); #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = INTRA_FRAME_NRS; - INTERINTRA_MODE best_interintra_mode = - args->inter_intra_mode[mbmi->ref_frame_nrs[0]]; + mbmi->ref_frame[1] = INTRA_FRAME_NRS; #else mbmi->ref_frame[1] = INTRA_FRAME; +#endif // CONFIG_NEW_REF_SIGNALING INTERINTRA_MODE best_interintra_mode = args->inter_intra_mode[mbmi->ref_frame[0]]; -#endif // CONFIG_NEW_REF_SIGNALING // Compute smooth_interintra int64_t best_interintra_rd_nowedge = INT64_MAX; @@ -1068,12 +1049,7 @@ memcpy(rd_stats->model_dist, comp_model_dist, sizeof(rd_stats->model_dist)); memcpy(rd_stats->comp_rs2, comp_rs2, sizeof(rd_stats->comp_rs2)); memcpy(rd_stats->mv, cur_mv, sizeof(rd_stats->mv)); -#if CONFIG_NEW_REF_SIGNALING - memcpy(rd_stats->ref_frames_nrs, mbmi->ref_frame_nrs, - sizeof(rd_stats->ref_frames_nrs)); -#else memcpy(rd_stats->ref_frames, mbmi->ref_frame, sizeof(rd_stats->ref_frames)); -#endif // CONFIG_NEW_REF_SIGNALING rd_stats->mode = mbmi->mode; #if CONFIG_REMOVE_DUAL_FILTER rd_stats->interp_fltr = mbmi->interp_fltr; @@ -1083,13 +1059,8 @@ rd_stats->ref_mv_idx = mbmi->ref_mv_idx; const MACROBLOCKD *const xd = &x->e_mbd; for (int i = 0; i < 2; ++i) { -#if CONFIG_NEW_REF_SIGNALING - const WarpedMotionParams *const wm = - &xd->global_motion[mbmi->ref_frame_nrs[i]]; -#else const WarpedMotionParams *const wm = &xd->global_motion[mbmi->ref_frame[i]]; -#endif // CONFIG_NEW_REF_SIGNALING rd_stats->is_global[i] = is_global_mv_block(mbmi, wm->wmtype); } memcpy(&rd_stats->interinter_comp, &mbmi->interinter_comp, @@ -1491,7 +1462,7 @@ comp_model_dist[comp_type] = est_dist[comp_type]; #if CONFIG_NEW_REF_SIGNALING sse_y[comp_type] = - x->pred_sse[COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame_nrs[0])]; + x->pred_sse[COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame[0])]; #else sse_y[comp_type] = x->pred_sse[xd->mi[0]->ref_frame[0]]; #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c index c82816e..58a1620 100644 --- a/av1/encoder/encode_strategy.c +++ b/av1/encoder/encode_strategy.c
@@ -1394,7 +1394,7 @@ } #if CONFIG_NEW_REF_SIGNALING - av1_get_ref_frames_nrs(&cpi->common, cur_frame_disp, ref_frame_map_pairs); + av1_get_ref_frames(&cpi->common, cur_frame_disp, ref_frame_map_pairs); #else const RefCntBuffer *ref_frames[INTER_REFS_PER_FRAME]; const YV12_BUFFER_CONFIG *ref_frame_buf[INTER_REFS_PER_FRAME];
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index d94b599..5029f51 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -1259,12 +1259,10 @@ if (cpi->all_one_sided_refs && cpi->oxcf.gf_cfg.lag_in_frames > 0) return 0; #if CONFIG_NEW_REF_SIGNALING - const int ref_frame_nrs[2] = { - cm->current_frame.skip_mode_info.ref_frame_idx_0, - cm->current_frame.skip_mode_info.ref_frame_idx_1 - }; - if (!(cpi->common.ref_frame_flags & (1 << ref_frame_nrs[0])) || - !(cpi->common.ref_frame_flags & (1 << ref_frame_nrs[1]))) + const int ref_frame[2] = { cm->current_frame.skip_mode_info.ref_frame_idx_0, + cm->current_frame.skip_mode_info.ref_frame_idx_1 }; + if (!(cpi->common.ref_frame_flags & (1 << ref_frame[0])) || + !(cpi->common.ref_frame_flags & (1 << ref_frame[1]))) return 0; #else static const int flag_list[REF_FRAMES] = { 0,
diff --git a/av1/encoder/encodeframe_utils.c b/av1/encoder/encodeframe_utils.c index 543d95f..a2f5794 100644 --- a/av1/encoder/encodeframe_utils.c +++ b/av1/encoder/encodeframe_utils.c
@@ -224,12 +224,7 @@ *mi_addr = *mi; copy_mbmi_ext_frame_to_mbmi_ext(x->mbmi_ext, &ctx->mbmi_ext_best, -#if CONFIG_NEW_REF_SIGNALING - av1_ref_frame_type(ctx->mic.ref_frame_nrs) -#else - av1_ref_frame_type(ctx->mic.ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - ); + av1_ref_frame_type(ctx->mic.ref_frame)); memcpy(txfm_info->blk_skip, ctx->blk_skip, sizeof(txfm_info->blk_skip[0]) * ctx->num_4x4_blk);
diff --git a/av1/encoder/encodeframe_utils.h b/av1/encoder/encodeframe_utils.h index 44508b2..ed513a5 100644 --- a/av1/encoder/encodeframe_utils.h +++ b/av1/encoder/encodeframe_utils.h
@@ -177,11 +177,7 @@ const int num_4x4s = mi_size_wide[bsize] * mi_size_high[bsize]; int ref; for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { -#if CONFIG_NEW_REF_SIGNALING - rdc->global_motion_used[mbmi->ref_frame_nrs[ref]] += num_4x4s; -#else rdc->global_motion_used[mbmi->ref_frame[ref]] += num_4x4s; -#endif // CONFIG_NEW_REF_SIGNALING } } }
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c index f3678b9b..93f73b2 100644 --- a/av1/encoder/encodemv.c +++ b/av1/encoder/encodemv.c
@@ -330,13 +330,8 @@ ref_mv_idx += 1; #endif // !CONFIG_NEW_INTER_MODES } - return av1_get_ref_mv_from_stack(ref_idx, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs, -#else - mbmi->ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - ref_mv_idx, x->mbmi_ext); + return av1_get_ref_mv_from_stack(ref_idx, mbmi->ref_frame, ref_mv_idx, + x->mbmi_ext); } #if CONFIG_NEW_INTER_MODES
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index 5456cab..77216f7 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -2044,7 +2044,7 @@ cm->width, cm->height); #if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, 0, 0); + set_ref_ptrs(cm, xd, 0, 0); #else set_ref_ptrs(cm, xd, LAST_FRAME, LAST_FRAME); #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index b6284ea..097f0f6 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -3072,25 +3072,21 @@ // TODO(zoeliu): To set up cpi->oxcf.gf_cfg.enable_auto_brf +static INLINE void set_ref_ptrs(const AV1_COMMON *cm, MACROBLOCKD *xd, + MV_REFERENCE_FRAME ref0, + MV_REFERENCE_FRAME ref1) { #if CONFIG_NEW_REF_SIGNALING -static INLINE void set_ref_ptrs_nrs(const AV1_COMMON *cm, MACROBLOCKD *xd, - MV_REFERENCE_FRAME ref0, - MV_REFERENCE_FRAME ref1) { xd->block_ref_scale_factors[0] = get_ref_scale_factors_const( cm, ref0 < INTER_REFS_PER_FRAME_NRS ? ref0 : 0); xd->block_ref_scale_factors[1] = get_ref_scale_factors_const( cm, ref1 < INTER_REFS_PER_FRAME_NRS ? ref1 : 0); -} #else -static INLINE void set_ref_ptrs(const AV1_COMMON *cm, MACROBLOCKD *xd, - MV_REFERENCE_FRAME ref0, - MV_REFERENCE_FRAME ref1) { xd->block_ref_scale_factors[0] = get_ref_scale_factors_const(cm, ref0 >= LAST_FRAME ? ref0 : 1); xd->block_ref_scale_factors[1] = get_ref_scale_factors_const(cm, ref1 >= LAST_FRAME ? ref1 : 1); -} #endif // CONFIG_NEW_REF_SIGNALING +} static INLINE int get_chessboard_index(int frame_index) { return frame_index & 0x1;
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index a1f7e91..525f60b 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c
@@ -357,7 +357,7 @@ xd->left_available = (mb_col != 0); xd->mi[0]->sb_type = bsize; #if CONFIG_NEW_REF_SIGNALING - xd->mi[0]->ref_frame_nrs[0] = INTRA_FRAME_NRS; + xd->mi[0]->ref_frame[0] = INTRA_FRAME_NRS; #else xd->mi[0]->ref_frame[0] = INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -689,8 +689,8 @@ xd->mi[0]->mv[0].as_mv = best_mv; xd->mi[0]->tx_size = TX_4X4; #if CONFIG_NEW_REF_SIGNALING - xd->mi[0]->ref_frame_nrs[0] = get_closest_pastcur_ref_index(cm); - xd->mi[0]->ref_frame_nrs[1] = INVALID_IDX; + xd->mi[0]->ref_frame[0] = get_closest_pastcur_ref_index(cm); + xd->mi[0]->ref_frame[1] = INVALID_IDX; #else xd->mi[0]->ref_frame[0] = LAST_FRAME; xd->mi[0]->ref_frame[1] = NONE_FRAME;
diff --git a/av1/encoder/interp_search.c b/av1/encoder/interp_search.c index d8a8433..a8bd115 100644 --- a/av1/encoder/interp_search.c +++ b/av1/encoder/interp_search.c
@@ -23,11 +23,7 @@ int i; for (i = 0; i < 1 + is_comp; ++i) { -#if CONFIG_NEW_REF_SIGNALING - if (st->ref_frames_nrs[i] != mi->ref_frame_nrs[i]) return INT_MAX; -#else if (st->ref_frames[i] != mi->ref_frame[i]) return INT_MAX; -#endif // CONFIG_NEW_REF_SIGNALING } if (skip_level == 1 && is_comp) { @@ -55,11 +51,7 @@ mbmi->interp_filters, #endif // CONFIG_REMOVE_DUAL_FILTER { mbmi->mv[0], mbmi->mv[1] }, -#if CONFIG_NEW_REF_SIGNALING - { mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1] }, -#else { mbmi->ref_frame[0], mbmi->ref_frame[1] }, -#endif // CONFIG_NEW_REF_SIGNALING mbmi->interinter_comp.type, mbmi->compound_idx, rd, @@ -626,13 +618,8 @@ const int is_compound = has_second_ref(mbmi); assert(is_intrabc_block(mbmi) == 0); for (int ref = 0; ref < 1 + is_compound; ++ref) { -#if CONFIG_NEW_REF_SIGNALING - const struct scale_factors *const sf = - get_ref_scale_factors_const(cm, mbmi->ref_frame_nrs[ref]); -#else const struct scale_factors *const sf = get_ref_scale_factors_const(cm, mbmi->ref_frame[ref]); -#endif // CONFIG_NEW_REF_SIGNALING // TODO(any): Refine skip flag calculation considering scaling if (av1_is_scaled(sf)) { *skip_hor = 0; @@ -728,7 +715,7 @@ const int need_search = av1_is_interp_needed(xd) && !cpi->sf.rt_sf.skip_interp_filter_search; #if CONFIG_NEW_REF_SIGNALING - const int ref_frame = COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame_nrs[0]); + const int ref_frame = COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame[0]); #else const int ref_frame = xd->mi[0]->ref_frame[0]; #endif // CONFIG_NEW_REF_SIGNALING @@ -809,11 +796,7 @@ if (has_second_ref(mbmi)) { #endif // CONFIG_OPTFLOW_REFINEMENT const int ref_mv_idx = mbmi->ref_mv_idx; -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME *refs = mbmi->ref_frame_nrs; -#else MV_REFERENCE_FRAME *refs = mbmi->ref_frame; -#endif // CONFIG_NEW_REF_SIGNALING const int mode0 = compound_ref0_mode(mbmi->mode); const int mode1 = compound_ref1_mode(mbmi->mode); const int64_t mrd = AOMMIN(args->modelled_rd[mode0][ref_mv_idx][refs[0]],
diff --git a/av1/encoder/interp_search.h b/av1/encoder/interp_search.h index 1b7c9d5..257205f 100644 --- a/av1/encoder/interp_search.h +++ b/av1/encoder/interp_search.h
@@ -31,11 +31,7 @@ int_interpfilters filters; #endif // CONFIG_REMOVE_DUAL_FILTER int_mv mv[2]; -#if CONFIG_NEW_REF_SIGNALING - int8_t ref_frames_nrs[2]; -#else int8_t ref_frames[2]; -#endif // CONFIG_NEW_REF_SIGNALING COMPOUND_TYPE comp_type; int compound_idx; int64_t rd;
diff --git a/av1/encoder/intra_mode_search.c b/av1/encoder/intra_mode_search.c index e9ed418..420482f 100644 --- a/av1/encoder/intra_mode_search.c +++ b/av1/encoder/intra_mode_search.c
@@ -657,8 +657,8 @@ mbmi->mode = DC_PRED; mbmi->uv_mode = UV_DC_PRED; #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = INTRA_FRAME_NRS; - mbmi->ref_frame_nrs[1] = INVALID_IDX; + mbmi->ref_frame[0] = INTRA_FRAME_NRS; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[0] = INTRA_FRAME; mbmi->ref_frame[1] = NONE_FRAME; @@ -966,7 +966,7 @@ MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *const mbmi = xd->mi[0]; #if CONFIG_NEW_REF_SIGNALING - assert(mbmi->ref_frame_nrs[0] == INTRA_FRAME_NRS); + assert(mbmi->ref_frame[0] == INTRA_FRAME_NRS); #else assert(mbmi->ref_frame[0] == INTRA_FRAME); #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c index 0539da3..abe9e10 100644 --- a/av1/encoder/mcomp.c +++ b/av1/encoder/mcomp.c
@@ -1932,11 +1932,7 @@ unsigned int best_sad, tmp_sad, this_sad[4]; const int norm_factor = 3 + (bw >> 5); const YV12_BUFFER_CONFIG *scaled_ref_frame = -#if CONFIG_NEW_REF_SIGNALING - av1_get_scaled_ref_frame(cpi, mi->ref_frame_nrs[0]); -#else av1_get_scaled_ref_frame(cpi, mi->ref_frame[0]); -#endif // CONFIG_NEW_REF_SIGNALING static const MV search_pos[4] = { { -1, 0 }, { 0, -1 },
diff --git a/av1/encoder/model_rd.h b/av1/encoder/model_rd.h index 30fd967..0f1ece8 100644 --- a/av1/encoder/model_rd.h +++ b/av1/encoder/model_rd.h
@@ -177,7 +177,7 @@ // we need to divide by 8 before sending to modeling function. int plane; #if CONFIG_NEW_REF_SIGNALING - const int ref = COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame_nrs[0]); + const int ref = COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame[0]); #else const int ref = xd->mi[0]->ref_frame[0]; #endif // CONFIG_NEW_REF_SIGNALING @@ -232,7 +232,7 @@ // Hence quantizer step is also 8 times. To get effective quantizer // we need to divide by 8 before sending to modeling function. #if CONFIG_NEW_REF_SIGNALING - const int ref = COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame_nrs[0]); + const int ref = COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame[0]); #else const int ref = xd->mi[0]->ref_frame[0]; #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/encoder/motion_search_facade.c b/av1/encoder/motion_search_facade.c index ea3652f..e07cf41 100644 --- a/av1/encoder/motion_search_facade.c +++ b/av1/encoder/motion_search_facade.c
@@ -56,15 +56,9 @@ MB_MODE_INFO *mbmi = xd->mi[0]; struct buf_2d backup_yv12[MAX_MB_PLANE] = { { 0, 0, 0, 0, 0 } }; int bestsme = INT_MAX; -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_nrs = mbmi->ref_frame_nrs[ref_idx]; - const YV12_BUFFER_CONFIG *scaled_ref_frame = - av1_get_scaled_ref_frame(cpi, ref_nrs); -#else const int ref = mbmi->ref_frame[ref_idx]; const YV12_BUFFER_CONFIG *scaled_ref_frame = av1_get_scaled_ref_frame(cpi, ref); -#endif // CONFIG_NEW_REF_SIGNALING const int mi_row = xd->mi_row; const int mi_col = xd->mi_col; const MvCosts *mv_costs = &x->mv_costs; @@ -90,7 +84,7 @@ // block for the given reference. #if CONFIG_NEW_REF_SIGNALING const MV_REFERENCE_FRAME rfn = - (ref_nrs == INTRA_FRAME_NRS ? INTER_REFS_PER_FRAME_NRS : ref_nrs); + (ref == INTRA_FRAME_NRS ? INTER_REFS_PER_FRAME_NRS : ref); step_param = (av1_init_search_range(x->max_mv_context[rfn]) + mv_search_params->mv_step_param) / 2; @@ -141,7 +135,7 @@ for (int l = 0; l < nw; l++) { #if CONFIG_NEW_REF_SIGNALING const int_mv mv = - sb_enc->tpl_mv[start + k * sb_enc->tpl_stride + l][ref_nrs]; + sb_enc->tpl_mv[start + k * sb_enc->tpl_stride + l][ref]; #else const int_mv mv = sb_enc->tpl_mv[start + k * sb_enc->tpl_stride + l] [ref - LAST_FRAME]; @@ -296,7 +290,7 @@ av1_set_fractional_mv(fractional_ms_list); int dis; /* TODO: use dis in distortion calculation later. */ #if CONFIG_NEW_REF_SIGNALING - const int ref_pred = COMPACT_INDEX0_NRS(ref_nrs); + const int ref_pred = COMPACT_INDEX0_NRS(ref); #else const int ref_pred = ref; #endif // CONFIG_NEW_REF_SIGNALING @@ -372,19 +366,11 @@ // Do joint motion search in compound mode to get more accurate mv. struct buf_2d backup_yv12[2][MAX_MB_PLANE]; int last_besterr[2] = { INT_MAX, INT_MAX }; -#if CONFIG_NEW_REF_SIGNALING - const int refs_nrs[2] = { mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1] }; - const YV12_BUFFER_CONFIG *const scaled_ref_frame[2] = { - av1_get_scaled_ref_frame(cpi, refs_nrs[0]), - av1_get_scaled_ref_frame(cpi, refs_nrs[1]) - }; -#else const int refs[2] = { mbmi->ref_frame[0], mbmi->ref_frame[1] }; const YV12_BUFFER_CONFIG *const scaled_ref_frame[2] = { av1_get_scaled_ref_frame(cpi, refs[0]), av1_get_scaled_ref_frame(cpi, refs[1]) }; -#endif // CONFIG_NEW_REF_SIGNALING // Prediction buffer from second frame. DECLARE_ALIGNED(16, uint8_t, second_pred16[MAX_SB_SQUARE * sizeof(uint16_t)]); @@ -540,11 +526,7 @@ const int num_planes = av1_num_planes(cm); MACROBLOCKD *xd = &x->e_mbd; MB_MODE_INFO *mbmi = xd->mi[0]; -#if CONFIG_NEW_REF_SIGNALING - const int ref = mbmi->ref_frame_nrs[ref_idx]; -#else const int ref = mbmi->ref_frame[ref_idx]; -#endif // CONFIG_NEW_REF_SIGNALING const int_mv ref_mv = av1_get_ref_mv(x, ref_idx); struct macroblockd_plane *const pd = &xd->plane[0]; const MvCosts *mv_costs = &x->mv_costs; @@ -782,11 +764,10 @@ MB_MODE_INFO *mbmi = xd->mi[0]; mbmi->sb_type = bsize; mbmi->motion_mode = SIMPLE_TRANSLATION; -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = ref; - mbmi->ref_frame_nrs[1] = INVALID_IDX; -#else mbmi->ref_frame[0] = ref; +#if CONFIG_NEW_REF_SIGNALING + mbmi->ref_frame[1] = INVALID_IDX; +#else mbmi->ref_frame[1] = NONE_FRAME; #endif // CONFIG_NEW_REF_SIGNALING #if CONFIG_REMOVE_DUAL_FILTER @@ -813,15 +794,9 @@ int var; int_mv best_mv; -#if CONFIG_NEW_REF_SIGNALING - av1_setup_pre_planes(xd, ref_idx, yv12, mi_row, mi_col, - get_ref_scale_factors(cm, ref), num_planes, NULL); - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); -#else av1_setup_pre_planes(xd, ref_idx, yv12, mi_row, mi_col, get_ref_scale_factors(cm, ref), num_planes, NULL); set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING if (scaled_ref_frame) { backup_yv12 = xd->plane[AOM_PLANE_Y].pre[ref_idx]; av1_setup_pre_planes(xd, ref_idx, scaled_ref_frame, mi_row, mi_col, NULL, @@ -934,11 +909,10 @@ MB_MODE_INFO *mbmi = xd->mi[0]; mbmi->sb_type = bsize; -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = ref; - mbmi->ref_frame_nrs[1] = INVALID_IDX; -#else mbmi->ref_frame[0] = ref; +#if CONFIG_NEW_REF_SIGNALING + mbmi->ref_frame[1] = INVALID_IDX; +#else mbmi->ref_frame[1] = NONE_FRAME; #endif // CONFIG_NEW_REF_SIGNALING mbmi->motion_mode = SIMPLE_TRANSLATION; @@ -966,15 +940,9 @@ int var; int_mv best_mv; -#if CONFIG_NEW_REF_SIGNALING - av1_setup_pre_planes(xd, ref_idx, yv12, mi_row, mi_col, - get_ref_scale_factors(cm, ref), num_planes, NULL); - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); -#else av1_setup_pre_planes(xd, ref_idx, yv12, mi_row, mi_col, get_ref_scale_factors(cm, ref), num_planes, NULL); set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING if (scaled_ref_frame) { backup_yv12 = xd->plane[AOM_PLANE_Y].pre[ref_idx]; av1_setup_pre_planes(xd, ref_idx, scaled_ref_frame, mi_row, mi_col, NULL,
diff --git a/av1/encoder/mv_prec.c b/av1/encoder/mv_prec.c index ac3679f..a3421ef4 100644 --- a/av1/encoder/mv_prec.c +++ b/av1/encoder/mv_prec.c
@@ -35,18 +35,13 @@ #endif // !CONFIG_NEW_INTER_MODES } -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME *ref_frames_nrs = mbmi->ref_frame_nrs; - const int8_t ref_frame_type_nrs = av1_ref_frame_type(ref_frames_nrs); -#else const MV_REFERENCE_FRAME *ref_frames = mbmi->ref_frame; const int8_t ref_frame_type = av1_ref_frame_type(ref_frames); -#endif // CONFIG_NEW_REF_SIGNALING const CANDIDATE_MV *curr_ref_mv_stack = mbmi_ext_frame->ref_mv_stack; #if CONFIG_NEW_REF_SIGNALING - if (ref_frames_nrs[1] != INTRA_FRAME_NRS && ref_frames_nrs[1] != INVALID_IDX) + if (ref_frames[1] != INTRA_FRAME_NRS && ref_frames[1] != INVALID_IDX) #else if (ref_frames[1] > INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -59,11 +54,7 @@ assert(ref_idx == 0); return ref_mv_idx < mbmi_ext_frame->ref_mv_count ? curr_ref_mv_stack[ref_mv_idx].this_mv -#if CONFIG_NEW_REF_SIGNALING - : mbmi_ext_frame->global_mvs[ref_frame_type_nrs]; -#else : mbmi_ext_frame->global_mvs[ref_frame_type]; -#endif // CONFIG_NEW_REF_SIGNALING } static AOM_INLINE int get_symbol_cost(const aom_cdf_prob *cdf, int symbol) {
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c index 78a460e..e411f55 100644 --- a/av1/encoder/nonrd_pickmode.c +++ b/av1/encoder/nonrd_pickmode.c
@@ -47,11 +47,7 @@ PRED_BUFFER *best_pred; PREDICTION_MODE best_mode; TX_SIZE best_tx_size; -#if CONFIG_NEW_REF_SIGNALING MV_REFERENCE_FRAME best_ref_frame; -#else - MV_REFERENCE_FRAME best_ref_frame; -#endif // CONFIG_NEW_REF_SIGNALING uint8_t best_mode_skip_txfm; uint8_t best_mode_initial_skip_flag; #if CONFIG_REMOVE_DUAL_FILTER @@ -214,11 +210,7 @@ ? cpi->sf.rt_sf.fullpel_search_step_param : cpi->mv_search_params.mv_step_param; FULLPEL_MV start_mv; -#if CONFIG_NEW_REF_SIGNALING - const int ref_nrs = mi->ref_frame_nrs[0]; -#else const int ref = mi->ref_frame[0]; -#endif // CONFIG_NEW_REF_SIGNALING const MV ref_mv = av1_get_ref_mv(x, mi->ref_mv_idx).as_mv; MV center_mv; int dis; @@ -226,11 +218,7 @@ int cost_list[5]; int search_subpel = 1; const YV12_BUFFER_CONFIG *scaled_ref_frame = -#if CONFIG_NEW_REF_SIGNALING - av1_get_scaled_ref_frame(cpi, ref_nrs); -#else av1_get_scaled_ref_frame(cpi, ref); -#endif // CONFIG_NEW_REF_SIGNALING if (scaled_ref_frame) { int i; @@ -277,7 +265,7 @@ cpi->mv_search_params.find_fractional_mv_step( xd, cm, &ms_params, subpel_start_mv, &tmp_mv->as_mv, &dis, #if CONFIG_NEW_REF_SIGNALING - &x->pred_sse[COMPACT_INDEX0_NRS(ref_nrs)], + &x->pred_sse[COMPACT_INDEX0_NRS(ref)], #else &x->pred_sse[ref], #endif // CONFIG_NEW_REF_SIGNALING @@ -480,19 +468,12 @@ get_ref_scale_factors_const(cm, ref_frame); av1_setup_pred_block(xd, yv12_mb[ref_frame], yv12, sf, sf, num_planes); #endif // CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING - av1_find_mv_refs_nrs(cm, xd, mbmi, ref_frame, mbmi_ext->ref_mv_count, - xd->ref_mv_stack, xd->weight, NULL, - mbmi_ext->global_mvs, mbmi_ext->mode_context); - av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame); -#else av1_find_mv_refs(cm, xd, mbmi, ref_frame, mbmi_ext->ref_mv_count, xd->ref_mv_stack, xd->weight, NULL, mbmi_ext->global_mvs, mbmi_ext->mode_context); av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING - // TODO(Ravi): Populate mbmi_ext->ref_mv_stack[ref_frame][4] and - // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. + // TODO(Ravi): Populate mbmi_ext->ref_mv_stack[ref_frame][4] and + // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. #if CONFIG_NEW_INTER_MODES frame_mv[NEARMV][ref_frame] = av1_find_best_ref_mv_from_stack( mbmi_ext, ref_frame, cm->features.fr_mv_precision); @@ -1018,11 +999,7 @@ // Note our transform coeffs are 8 times an orthogonal transform. // Hence quantizer step is also 8 times. To get effective quantizer // we need to divide by 8 before sending to modeling function. -#if CONFIG_NEW_REF_SIGNALING - const int ref = xd->mi[0]->ref_frame_nrs[0]; -#else const int ref = xd->mi[0]->ref_frame[0]; -#endif // CONFIG_NEW_REF_SIGNALING assert(bsize < BLOCK_SIZES_ALL); @@ -1206,25 +1183,15 @@ } static INLINE void init_mbmi(MB_MODE_INFO *mbmi, PREDICTION_MODE pred_mode, -#if CONFIG_NEW_REF_SIGNALING MV_REFERENCE_FRAME ref_frame0, MV_REFERENCE_FRAME ref_frame1, -#else - MV_REFERENCE_FRAME ref_frame0, - MV_REFERENCE_FRAME ref_frame1, -#endif // CONFIG_NEW_REF_SIGNALING const AV1_COMMON *cm, const SB_INFO *sbi) { PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info; mbmi->ref_mv_idx = 0; mbmi->mode = pred_mode; mbmi->uv_mode = UV_DC_PRED; -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = ref_frame0; - mbmi->ref_frame_nrs[1] = ref_frame1; -#else mbmi->ref_frame[0] = ref_frame0; mbmi->ref_frame[1] = ref_frame1; -#endif // CONFIG_NEW_REF_SIGNALING pmi->palette_size[0] = 0; pmi->palette_size[1] = 0; mbmi->filter_intra_mode_info.use_filter_intra = 0; @@ -1258,14 +1225,8 @@ #endif // CONFIG_INTERNAL_STATS && !CONFIG_NEW_REF_SIGNALING ctx->mic = *xd->mi[0]; ctx->skippable = txfm_info->skip_txfm; - av1_copy_mbmi_ext_to_mbmi_ext_frame( - &ctx->mbmi_ext_best, x->mbmi_ext, -#if CONFIG_NEW_REF_SIGNALING - av1_ref_frame_type(xd->mi[0]->ref_frame_nrs) -#else - av1_ref_frame_type(xd->mi[0]->ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - ); + av1_copy_mbmi_ext_to_mbmi_ext_frame(&ctx->mbmi_ext_best, x->mbmi_ext, + av1_ref_frame_type(xd->mi[0]->ref_frame)); ctx->comp_pred_diff = 0; ctx->hybrid_pred_diff = 0; ctx->single_pred_diff = 0; @@ -2164,8 +2125,8 @@ mi->mode = this_mode; #if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = INTRA_FRAME_NRS; - mi->ref_frame_nrs[1] = INVALID_IDX; + mi->ref_frame[0] = INTRA_FRAME_NRS; + mi->ref_frame[1] = INVALID_IDX; #else mi->ref_frame[0] = INTRA_FRAME; mi->ref_frame[1] = NONE_FRAME; @@ -2352,13 +2313,12 @@ #if COLLECT_PICK_MODE_STAT static mode_search_stat ms_stat; #endif + MV_REFERENCE_FRAME ref_frame; #if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs; int_mv frame_mv[MB_MODE_COUNT][REF_FRAMES_NRS]; uint8_t mode_checked[MB_MODE_COUNT][REF_FRAMES_NRS]; struct buf_2d yv12_mb[REF_FRAMES_NRS][MAX_MB_PLANE]; #else - MV_REFERENCE_FRAME ref_frame; int_mv frame_mv[MB_MODE_COUNT][REF_FRAMES]; uint8_t mode_checked[MB_MODE_COUNT][REF_FRAMES]; struct buf_2d yv12_mb[REF_FRAMES][MAX_MB_PLANE]; @@ -2403,11 +2363,7 @@ init_best_pickmode(&best_pickmode); -#if CONFIG_NEW_REF_SIGNALING - av1_collect_neighbors_ref_counts_nrs(cm, xd); -#else av1_collect_neighbors_ref_counts(xd); -#endif // CONFIG_NEW_REF_SIGNALING const ModeCosts *mode_costs = &x->mode_costs; @@ -2437,8 +2393,8 @@ av1_invalid_rd_stats(rd_cost); mi->sb_type = bsize; #if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = INVALID_IDX; - mi->ref_frame_nrs[1] = INVALID_IDX; + mi->ref_frame[0] = INVALID_IDX; + mi->ref_frame[1] = INVALID_IDX; #else mi->ref_frame[0] = NONE_FRAME; mi->ref_frame[1] = NONE_FRAME; @@ -2450,23 +2406,17 @@ use_ref_frame_mask, &force_skip_low_temp_var); #if CONFIG_NEW_REF_SIGNALING - for (MV_REFERENCE_FRAME ref_frame_iter_nrs = 0; - ref_frame_iter_nrs < cm->new_ref_frame_data.n_total_refs; - ++ref_frame_iter_nrs) { - if (use_ref_frame_mask[ref_frame_iter_nrs]) { - find_predictors(cpi, x, ref_frame_iter_nrs, frame_mv, tile_data, yv12_mb, - bsize, force_skip_low_temp_var); - } - } + for (MV_REFERENCE_FRAME ref_frame_iter = 0; + ref_frame_iter < cm->new_ref_frame_data.n_total_refs; ++ref_frame_iter) { #else for (MV_REFERENCE_FRAME ref_frame_iter = LAST_FRAME; ref_frame_iter <= ALTREF_FRAME; ++ref_frame_iter) { +#endif // CONFIG_NEW_REF_SIGNALING if (use_ref_frame_mask[ref_frame_iter]) { find_predictors(cpi, x, ref_frame_iter, frame_mv, tile_data, yv12_mb, bsize, force_skip_low_temp_var); } } -#endif // CONFIG_NEW_REF_SIGNALING #if CONFIG_NEW_REF_SIGNALING const MV_REFERENCE_FRAME last_frame = get_closest_pastcur_ref_index(cm); @@ -2535,59 +2485,38 @@ !cm->seq_params.order_hint_info.enable_order_hint) continue; #endif // CONFIG_OPTFLOW_REFINEMENT -#if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs = ref_mode_set[idx].ref_frame; -#else ref_frame = ref_mode_set[idx].ref_frame; -#endif // CONFIG_NEW_REF_SIGNALING #if COLLECT_PICK_MODE_STAT aom_usec_timer_start(&ms_stat.timer1); ms_stat.num_searches[bsize][this_mode]++; #endif mi->mode = this_mode; -#if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = ref_frame_nrs; - if (!use_ref_frame_mask[ref_frame_nrs]) continue; -#else mi->ref_frame[0] = ref_frame; if (!use_ref_frame_mask[ref_frame]) continue; -#endif // CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING - // Skip non-zero motion for SVC if skip_nonzeromv_ref is set. - if (cpi->use_svc && frame_mv[this_mode][ref_frame_nrs].as_int != 0) { - if (ref_frame_nrs == last_frame && cpi->svc.skip_nonzeromv_last) - continue; - else if (ref_frame_nrs == golden_frame && cpi->svc.skip_nonzeromv_gf) - continue; - } -#else // Skip non-zero motion for SVC if skip_nonzeromv_ref is set. if (cpi->use_svc && frame_mv[this_mode][ref_frame].as_int != 0) { +#if CONFIG_NEW_REF_SIGNALING + if (ref_frame == last_frame && cpi->svc.skip_nonzeromv_last) + continue; + else if (ref_frame == golden_frame && cpi->svc.skip_nonzeromv_gf) + continue; +#else if (ref_frame == LAST_FRAME && cpi->svc.skip_nonzeromv_last) continue; else if (ref_frame == GOLDEN_FRAME && cpi->svc.skip_nonzeromv_gf) continue; - } #endif // CONFIG_NEW_REF_SIGNALING + } -#if CONFIG_NEW_REF_SIGNALING - if (skip_mode_by_bsize_and_ref_frame(cm, this_mode, ref_frame_nrs, bsize, - x->nonrd_prune_ref_frame_search, - sse_zeromv_norm)) - continue; - - if (skip_mode_by_low_temp( - this_mode, ref_frame_nrs, bsize, x->content_state_sb, - frame_mv[this_mode][ref_frame_nrs], force_skip_low_temp_var)) - continue; -#else +#if !CONFIG_NEW_REF_SIGNALING // If the segment reference frame feature is enabled then do nothing if the // current ref frame is not allowed. if (segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME) && get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) != (int)ref_frame) continue; +#endif // CONFIG_NEW_REF_SIGNALING if (skip_mode_by_bsize_and_ref_frame(cm, this_mode, ref_frame, bsize, x->nonrd_prune_ref_frame_search, @@ -2598,7 +2527,6 @@ frame_mv[this_mode][ref_frame], force_skip_low_temp_var)) continue; -#endif // CONFIG_NEW_REF_SIGNALING // Disable this drop out case if the ref frame segment level feature is // enabled for this segment. This is to prevent the possibility that we @@ -2606,20 +2534,8 @@ #if CONFIG_NEW_REF_SIGNALING // Check for skipping GOLDEN and ALTREF based pred_mv_sad. if (cpi->sf.rt_sf.nonrd_prune_ref_frame_search > 0 && - x->pred_mv_sad[ref_frame_nrs] != INT_MAX && - ref_frame_nrs != last_frame) { - if ((int64_t)(x->pred_mv_sad[ref_frame_nrs]) > thresh_sad_pred) continue; - } - - if (skip_mode_by_threshold( - this_mode, ref_frame_nrs, frame_mv[this_mode][ref_frame_nrs], - cpi->rc.frames_since_golden, rd_threshes, rd_thresh_freq_fact, - best_rdc.rdcost, best_pickmode.best_mode_skip_txfm)) - continue; - - // Select prediction reference frames. - for (int i = 0; i < MAX_MB_PLANE; i++) { - xd->plane[i].pre[0] = yv12_mb[ref_frame_nrs][i]; + x->pred_mv_sad[ref_frame] != INT_MAX && ref_frame != last_frame) { + if ((int64_t)(x->pred_mv_sad[ref_frame]) > thresh_sad_pred) continue; } #else if (!segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME)) { @@ -2629,6 +2545,7 @@ if ((int64_t)(x->pred_mv_sad[ref_frame]) > thresh_sad_pred) continue; } } +#endif // CONFIG_NEW_REF_SIGNALING if (skip_mode_by_threshold( this_mode, ref_frame, frame_mv[this_mode][ref_frame], @@ -2640,29 +2557,22 @@ for (int i = 0; i < MAX_MB_PLANE; i++) { xd->plane[i].pre[0] = yv12_mb[ref_frame][i]; } -#endif // CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = ref_frame_nrs; - mi->ref_frame_nrs[1] = INVALID_IDX; -#else + mi->ref_frame[0] = ref_frame; +#if CONFIG_NEW_REF_SIGNALING + mi->ref_frame[1] = INVALID_IDX; +#else mi->ref_frame[1] = NONE_FRAME; #endif // CONFIG_NEW_REF_SIGNALING #if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mi->ref_frame_nrs[0], INVALID_IDX); + set_ref_ptrs(cm, xd, mi->ref_frame[0], INVALID_IDX); #else set_ref_ptrs(cm, xd, mi->ref_frame[0], NONE_FRAME); #endif // CONFIG_NEW_REF_SIGNALING if (this_mode == NEWMV) { - if (search_new_mv(cpi, x, frame_mv, -#if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs, -#else - ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - gf_temporal_ref, bsize, mi_row, mi_col, &rate_mv, - &best_rdc)) + if (search_new_mv(cpi, x, frame_mv, ref_frame, gf_temporal_ref, bsize, + mi_row, mi_col, &rate_mv, &best_rdc)) continue; } @@ -2673,15 +2583,9 @@ #endif // CONFIG_NEW_INTER_MODES inter_mv_mode++) { if (inter_mv_mode == this_mode) continue; -#if CONFIG_NEW_REF_SIGNALING - if (mode_checked[inter_mv_mode][ref_frame_nrs] && - frame_mv[this_mode][ref_frame_nrs].as_int == - frame_mv[inter_mv_mode][ref_frame_nrs].as_int) { -#else if (mode_checked[inter_mv_mode][ref_frame] && frame_mv[this_mode][ref_frame].as_int == frame_mv[inter_mv_mode][ref_frame].as_int) { -#endif // CONFIG_NEW_REF_SIGNALING skip_this_mv = 1; break; } @@ -2690,11 +2594,7 @@ if (skip_this_mv) continue; mi->mode = this_mode; -#if CONFIG_NEW_REF_SIGNALING - mi->mv[0].as_int = frame_mv[this_mode][ref_frame_nrs].as_int; -#else mi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int; -#endif // CONFIG_NEW_REF_SIGNALING mi->mv[1].as_int = 0; if (reuse_inter_pred) { if (!this_mode_pred) { @@ -2711,7 +2611,7 @@ if (enable_filter_search && ((mi->mv[0].as_mv.row & 0x07) || (mi->mv[0].as_mv.col & 0x07)) && #if CONFIG_NEW_REF_SIGNALING - (ref_frame_nrs == last_frame || !x->nonrd_prune_ref_frame_search)) { + (ref_frame == last_frame || !x->nonrd_prune_ref_frame_search)) { #else (ref_frame == LAST_FRAME || !x->nonrd_prune_ref_frame_search)) { #endif // CONFIG_NEW_REF_SIGNALING @@ -2739,8 +2639,7 @@ } #if CONFIG_NEW_REF_SIGNALING - if (ref_frame_nrs == last_frame && - frame_mv[this_mode][ref_frame_nrs].as_int == 0) { + if (ref_frame == last_frame && frame_mv[this_mode][ref_frame].as_int == 0) { #else if (ref_frame == LAST_FRAME && frame_mv[this_mode][ref_frame].as_int == 0) { #endif // CONFIG_NEW_REF_SIGNALING @@ -2808,37 +2707,20 @@ // TODO(kyslov) account for UV prediction cost this_rdc.rate += rate_mv; const int16_t mode_ctx = -#if CONFIG_NEW_REF_SIGNALING - av1_mode_context_analyzer(mbmi_ext->mode_context, mi->ref_frame_nrs); -#else av1_mode_context_analyzer(mbmi_ext->mode_context, mi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING this_rdc.rate += cost_mv_ref(mode_costs, this_mode, mode_ctx); -#if CONFIG_NEW_REF_SIGNALING - this_rdc.rate += ref_costs_single[ref_frame_nrs]; -#else this_rdc.rate += ref_costs_single[ref_frame]; -#endif // CONFIG_NEW_REF_SIGNALING this_rdc.rdcost = RDCOST(x->rdmult, this_rdc.rate, this_rdc.dist); if (cpi->oxcf.rc_cfg.mode == AOM_CBR) { newmv_diff_bias(xd, this_mode, &this_rdc, bsize, -#if CONFIG_NEW_REF_SIGNALING - frame_mv[this_mode][ref_frame_nrs].as_mv.row, - frame_mv[this_mode][ref_frame_nrs].as_mv.col, -#else frame_mv[this_mode][ref_frame].as_mv.row, - frame_mv[this_mode][ref_frame].as_mv.col, -#endif // CONFIG_NEW_REF_SIGNALING - cpi->speed, x->source_variance); + frame_mv[this_mode][ref_frame].as_mv.col, cpi->speed, + x->source_variance); } -#if CONFIG_NEW_REF_SIGNALING - mode_checked[this_mode][ref_frame_nrs] = 1; -#else mode_checked[this_mode][ref_frame] = 1; -#endif // CONFIG_NEW_REF_SIGNALING #if COLLECT_PICK_MODE_STAT aom_usec_timer_mark(&ms_stat.timer1); ms_stat.nonskipped_search_times[bsize][this_mode] += @@ -2854,11 +2736,7 @@ best_pickmode.best_pred_filter = mi->interp_filters; #endif // CONFIG_REMOVE_DUAL_FILTER best_pickmode.best_tx_size = mi->tx_size; -#if CONFIG_NEW_REF_SIGNALING - best_pickmode.best_ref_frame = ref_frame_nrs; -#else best_pickmode.best_ref_frame = ref_frame; -#endif // CONFIG_NEW_REF_SIGNALING best_pickmode.best_mode_skip_txfm = this_rdc.skip_txfm; best_pickmode.best_mode_initial_skip_flag = (nonskip_rdc.rate == INT_MAX && this_rdc.skip_txfm); @@ -2884,11 +2762,7 @@ #endif // CONFIG_REMOVE_DUAL_FILTER mi->tx_size = best_pickmode.best_tx_size; memset(mi->inter_tx_size, mi->tx_size, sizeof(mi->inter_tx_size)); -#if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = best_pickmode.best_ref_frame; -#else mi->ref_frame[0] = best_pickmode.best_ref_frame; -#endif // CONFIG_NEW_REF_SIGNALING mi->mv[0].as_int = frame_mv[best_pickmode.best_mode][best_pickmode.best_ref_frame].as_int; @@ -2912,11 +2786,7 @@ pd->dst = orig_dst; mi->mode = best_pickmode.best_mode; -#if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = best_pickmode.best_ref_frame; -#else mi->ref_frame[0] = best_pickmode.best_ref_frame; -#endif // CONFIG_NEW_REF_SIGNALING txfm_info->skip_txfm = best_rdc.skip_txfm; if (!is_inter_block(mi)) {
diff --git a/av1/encoder/partition_search.c b/av1/encoder/partition_search.c index ad35ff2..591f3c0 100644 --- a/av1/encoder/partition_search.c +++ b/av1/encoder/partition_search.c
@@ -379,7 +379,7 @@ const int map_offset = block_index + y * (cm->mi_params.mi_cols >> 1) + x; if (is_inter_block(mi) && #if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] == get_closest_pastcur_ref_index(cm) && + mi->ref_frame[0] == get_closest_pastcur_ref_index(cm) && #else mi->ref_frame[0] == LAST_FRAME && #endif // CONFIG_NEW_REF_SIGNALING @@ -465,19 +465,10 @@ int ref; const int is_compound = has_second_ref(mbmi); -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); -#else set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING for (ref = 0; ref < 1 + is_compound; ++ref) { -#if CONFIG_NEW_REF_SIGNALING - const YV12_BUFFER_CONFIG *cfg = - get_ref_frame_yv12_buf(cm, mbmi->ref_frame_nrs[ref]); -#else const YV12_BUFFER_CONFIG *cfg = get_ref_frame_yv12_buf(cm, mbmi->ref_frame[ref]); -#endif // CONFIG_NEW_REF_SIGNALING assert(IMPLIES(!is_intrabc_block(mbmi), cfg)); av1_setup_pre_planes(xd, ref, cfg, mi_row, mi_col, xd->block_ref_scale_factors[ref], num_planes, @@ -961,11 +952,7 @@ #endif // !CONFIG_ENTROPY_STATS assert(have_drl_index(mbmi->mode)); assert(mbmi->ref_mv_idx < max_drl_bits + 1); -#if CONFIG_NEW_REF_SIGNALING - uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING const int range = av1_drl_range(mbmi_ext->ref_mv_count[ref_frame_type], (mode_ctx >> 8), max_drl_bits); for (int idx = 0; idx < range; ++idx) { @@ -1089,13 +1076,8 @@ // reference frame allowed for the segment so exclude it from // the reference frame counts used to work out probabilities. if (inter_block) { -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref0 = mbmi->ref_frame_nrs[0]; - const MV_REFERENCE_FRAME ref1 = mbmi->ref_frame_nrs[1]; -#else const MV_REFERENCE_FRAME ref0 = mbmi->ref_frame[0]; const MV_REFERENCE_FRAME ref1 = mbmi->ref_frame[1]; -#endif // CONFIG_NEW_REF_SIGNALING if (current_frame->reference_mode == REFERENCE_MODE_SELECT) { if (is_comp_ref_allowed(bsize)) { #if CONFIG_ENTROPY_STATS @@ -1199,7 +1181,7 @@ } else { #if CONFIG_NEW_REF_SIGNALING const int n_refs = cm->new_ref_frame_data.n_total_refs; - const MV_REFERENCE_FRAME ref0_nrs = mbmi->ref_frame_nrs[0]; + const MV_REFERENCE_FRAME ref0_nrs = mbmi->ref_frame[0]; for (int i = 0; i < n_refs - 1; i++) { const int bit = ref0_nrs == i; update_cdf(av1_get_pred_cdf_single_ref_nrs(xd, i, n_refs), bit, 2); @@ -1260,7 +1242,7 @@ is_interintra_allowed(mbmi)) { const int bsize_group = size_group_lookup[bsize]; #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[1] == INTRA_FRAME_NRS) + if (mbmi->ref_frame[1] == INTRA_FRAME_NRS) #else if (mbmi->ref_frame[1] == INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1302,7 +1284,7 @@ cm->features.allow_warped_motion) : SIMPLE_TRANSLATION; #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS) + if (mbmi->ref_frame[1] != INTRA_FRAME_NRS) #else if (mbmi->ref_frame[1] != INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1423,13 +1405,8 @@ if (inter_block && !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { const PREDICTION_MODE mode = mbmi->mode; - const int16_t mode_ctx = av1_mode_context_analyzer(mbmi_ext->mode_context, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs -#else - mbmi->ref_frame -#endif // CONFIG_NEW_REF_SIGNALING - ); + const int16_t mode_ctx = + av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame); if (has_second_ref(mbmi)) { #if CONFIG_ENTROPY_STATS ++counts->inter_compound_mode[mode_ctx][INTER_COMPOUND_OFFSET(mode)]; @@ -1448,23 +1425,13 @@ #if CONFIG_NEW_INTER_MODES if (have_drl_index(mbmi->mode)) { const int16_t mode_ctx_pristine = - av1_mode_context_pristine(mbmi_ext->mode_context, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs -#else - mbmi->ref_frame -#endif // CONFIG_NEW_REF_SIGNALING - ); + av1_mode_context_pristine(mbmi_ext->mode_context, mbmi->ref_frame); update_drl_index_stats(cm->features.max_drl_bits, mode_ctx_pristine, fc, counts, mbmi, mbmi_ext); } #else if (new_mv) { -#if CONFIG_NEW_REF_SIGNALING - const uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else const uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING for (int idx = 0; idx < 2; ++idx) { if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) { const uint8_t drl_ctx = @@ -1478,11 +1445,7 @@ } } if (have_nearmv_in_inter_mode(mbmi->mode)) { -#if CONFIG_NEW_REF_SIGNALING - const uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else const uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING for (int idx = 1; idx < 3; ++idx) { if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) { const uint8_t drl_ctx = @@ -1646,11 +1609,7 @@ assert(has_second_ref(mbmi)); rdc->compound_ref_used_flag = 1; } -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); -#else set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING } else { #if CONFIG_NEW_REF_SIGNALING const int seg_ref_active = 0; @@ -1663,23 +1622,14 @@ // reference frame allowed for the segment so exclude it from // the reference frame counts used to work out probabilities. if (is_inter_block(mbmi)) { -#if CONFIG_NEW_REF_SIGNALING - av1_collect_neighbors_ref_counts_nrs(cm, xd); -#else av1_collect_neighbors_ref_counts(xd); -#endif // CONFIG_NEW_REF_SIGNALING if (cm->current_frame.reference_mode == REFERENCE_MODE_SELECT) { if (has_second_ref(mbmi)) { // This flag is also updated for 4x4 blocks rdc->compound_ref_used_flag = 1; } } -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], - mbmi->ref_frame_nrs[1]); -#else set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING } } } @@ -1706,7 +1656,7 @@ : SIMPLE_TRANSLATION; #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS) + if (mbmi->ref_frame[1] != INTRA_FRAME_NRS) #else if (mbmi->ref_frame[1] != INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -1726,14 +1676,8 @@ // level (x->mbmi_ext) to frame level (cpi->mbmi_ext_info.frame_base). This // frame level buffer (cpi->mbmi_ext_info.frame_base) will be used during // bitstream preparation. - av1_copy_mbmi_ext_to_mbmi_ext_frame( - x->mbmi_ext_frame, x->mbmi_ext, -#if CONFIG_NEW_REF_SIGNALING - av1_ref_frame_type(xd->mi[0]->ref_frame_nrs) -#else - av1_ref_frame_type(xd->mi[0]->ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - ); + av1_copy_mbmi_ext_to_mbmi_ext_frame(x->mbmi_ext_frame, x->mbmi_ext, + av1_ref_frame_type(xd->mi[0]->ref_frame)); x->rdmult = origin_mult; } @@ -2508,14 +2452,8 @@ // level (x->mbmi_ext) to frame level (cpi->mbmi_ext_info.frame_base). This // frame level buffer (cpi->mbmi_ext_info.frame_base) will be used during // bitstream preparation. - av1_copy_mbmi_ext_to_mbmi_ext_frame( - x->mbmi_ext_frame, x->mbmi_ext, -#if CONFIG_NEW_REF_SIGNALING - av1_ref_frame_type(xd->mi[0]->ref_frame_nrs) -#else - av1_ref_frame_type(xd->mi[0]->ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - ); + av1_copy_mbmi_ext_to_mbmi_ext_frame(x->mbmi_ext_frame, x->mbmi_ext, + av1_ref_frame_type(xd->mi[0]->ref_frame)); x->rdmult = origin_mult; } /*!\brief Top level function to pick block mode for non-RD optimized case @@ -4481,11 +4419,7 @@ if (this_rdc->rate != INT_MAX) { // Record picked ref frame to prune ref frames for other partition types. if (cpi->sf.inter_sf.prune_ref_frame_for_rect_partitions) { -#if CONFIG_NEW_REF_SIGNALING - const int ref_type = av1_ref_frame_type(pc_tree->none->mic.ref_frame_nrs); -#else const int ref_type = av1_ref_frame_type(pc_tree->none->mic.ref_frame); -#endif av1_update_picked_ref_frames_mask( x, ref_type, bsize, cm->seq_params.mib_size, mi_row, mi_col); }
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c index af740af..318bda4 100644 --- a/av1/encoder/ratectrl.c +++ b/av1/encoder/ratectrl.c
@@ -2821,7 +2821,7 @@ for (int mi_row = 0; mi_row < rows; mi_row++) { for (int mi_col = 0; mi_col < cols; mi_col++) { #if CONFIG_NEW_REF_SIGNALING - if (mi[0]->ref_frame_nrs[0] == get_closest_pastcur_ref_index(cm) && + if (mi[0]->ref_frame[0] == get_closest_pastcur_ref_index(cm) && #else if (mi[0]->ref_frame[0] == LAST_FRAME && #endif // CONFIG_NEW_REF_SIGNALING
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c index 38a053e..258dd52 100644 --- a/av1/encoder/rd.c +++ b/av1/encoder/rd.c
@@ -1232,24 +1232,16 @@ void av1_mv_pred(const AV1_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer, int ref_y_stride, int ref, BLOCK_SIZE block_size) { -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frame_nrs = ref; -#else const MV_REFERENCE_FRAME ref_frame = ref; -#endif // CONFIG_NEW_REF_SIGNALING #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frames_nrs[2] = { ref_frame_nrs, INVALID_IDX }; - const int_mv ref_mv = - av1_get_ref_mv_from_stack(0, ref_frames_nrs, 0, x->mbmi_ext); - const int_mv ref_mv1 = - av1_get_ref_mv_from_stack(0, ref_frames_nrs, 1, x->mbmi_ext); + const MV_REFERENCE_FRAME ref_frames[2] = { ref_frame, INVALID_IDX }; #else const MV_REFERENCE_FRAME ref_frames[2] = { ref_frame, NONE_FRAME }; +#endif // CONFIG_NEW_REF_SIGNALING const int_mv ref_mv = av1_get_ref_mv_from_stack(0, ref_frames, 0, x->mbmi_ext); const int_mv ref_mv1 = av1_get_ref_mv_from_stack(0, ref_frames, 1, x->mbmi_ext); -#endif // CONFIG_NEW_REF_SIGNALING MV pred_mv[MAX_MV_REF_CANDIDATES + 1]; int num_mv_refs = 0; pred_mv[num_mv_refs++] = ref_mv.as_mv; @@ -1285,7 +1277,7 @@ } // Note the index of the mv that worked best in the reference list. #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME rfn = COMPACT_INDEX0_NRS(ref_frame_nrs); + const MV_REFERENCE_FRAME rfn = COMPACT_INDEX0_NRS(ref_frame); x->max_mv_context[rfn] = max_mv; x->pred_mv_sad[rfn] = best_sad; #else
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index 5998795..3c9606d 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -1279,26 +1279,15 @@ ctx->best_mode_index = mode_index; #endif // CONFIG_INTERNAL_STATS && !CONFIG_NEW_REF_SIGNALING ctx->mic = *xd->mi[0]; - av1_copy_mbmi_ext_to_mbmi_ext_frame( - &ctx->mbmi_ext_best, x->mbmi_ext, -#if CONFIG_NEW_REF_SIGNALING - av1_ref_frame_type(xd->mi[0]->ref_frame_nrs) -#else - av1_ref_frame_type(xd->mi[0]->ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - ); + av1_copy_mbmi_ext_to_mbmi_ext_frame(&ctx->mbmi_ext_best, x->mbmi_ext, + av1_ref_frame_type(xd->mi[0]->ref_frame)); ctx->single_pred_diff = (int)comp_pred_diff[SINGLE_REFERENCE]; ctx->comp_pred_diff = (int)comp_pred_diff[COMPOUND_REFERENCE]; ctx->hybrid_pred_diff = (int)comp_pred_diff[REFERENCE_MODE_SELECT]; } static AOM_INLINE void setup_buffer_ref_mvs_inter( - const AV1_COMP *const cpi, MACROBLOCK *x, -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs, -#else - MV_REFERENCE_FRAME ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING + const AV1_COMP *const cpi, MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, BLOCK_SIZE block_size, #if CONFIG_NEW_REF_SIGNALING struct buf_2d yv12_mb[REF_FRAMES_NRS][MAX_MB_PLANE] @@ -1309,80 +1298,42 @@ const AV1_COMMON *cm = &cpi->common; const int num_planes = av1_num_planes(cm); const YV12_BUFFER_CONFIG *scaled_ref_frame = -#if CONFIG_NEW_REF_SIGNALING - av1_get_scaled_ref_frame(cpi, ref_frame_nrs); -#else av1_get_scaled_ref_frame(cpi, ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *const mbmi = xd->mi[0]; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; -#if CONFIG_NEW_REF_SIGNALING - const struct scale_factors *const sf = - get_ref_scale_factors_const(cm, ref_frame_nrs); - const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_yv12_buf(cm, ref_frame_nrs); -#else const struct scale_factors *const sf = get_ref_scale_factors_const(cm, ref_frame); const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_yv12_buf(cm, ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING assert(yv12 != NULL); if (scaled_ref_frame) { // Setup pred block based on scaled reference, because av1_mv_pred() doesn't // support scaling. -#if CONFIG_NEW_REF_SIGNALING - av1_setup_pred_block(xd, yv12_mb[ref_frame_nrs], scaled_ref_frame, NULL, - NULL, num_planes); -#else av1_setup_pred_block(xd, yv12_mb[ref_frame], scaled_ref_frame, NULL, NULL, num_planes); -#endif // CONFIG_NEW_REF_SIGNALING } else { -#if CONFIG_NEW_REF_SIGNALING - av1_setup_pred_block(xd, yv12_mb[ref_frame_nrs], yv12, sf, sf, num_planes); -#else av1_setup_pred_block(xd, yv12_mb[ref_frame], yv12, sf, sf, num_planes); -#endif // CONFIG_NEW_REF_SIGNALING } // Gets an initial list of candidate vectors from neighbours and orders them -#if CONFIG_NEW_REF_SIGNALING - av1_find_mv_refs_nrs(cm, xd, mbmi, ref_frame_nrs, mbmi_ext->ref_mv_count, - xd->ref_mv_stack, xd->weight, NULL, mbmi_ext->global_mvs, - mbmi_ext->mode_context); -#else av1_find_mv_refs(cm, xd, mbmi, ref_frame, mbmi_ext->ref_mv_count, xd->ref_mv_stack, xd->weight, NULL, mbmi_ext->global_mvs, mbmi_ext->mode_context); -#endif // CONFIG_NEW_REF_SIGNALING // TODO(Ravi): Populate mbmi_ext->ref_mv_stack[ref_frame][4] and // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. -#if CONFIG_NEW_REF_SIGNALING - av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame_nrs); -#else av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING // Further refinement that is encode side only to test the top few candidates // in full and choose the best as the center point for subsequent searches. // The current implementation doesn't support scaling. -#if CONFIG_NEW_REF_SIGNALING - av1_mv_pred(cpi, x, yv12_mb[ref_frame_nrs][0].buf, - yv12_mb[ref_frame_nrs][0].stride, ref_frame_nrs, block_size); -#else av1_mv_pred(cpi, x, yv12_mb[ref_frame][0].buf, yv12_mb[ref_frame][0].stride, ref_frame, block_size); -#endif // CONFIG_NEW_REF_SIGNALING // Go back to unscaled reference. if (scaled_ref_frame) { // We had temporarily setup pred block based on scaled reference above. Go // back to unscaled reference now, for subsequent use. -#if CONFIG_NEW_REF_SIGNALING - av1_setup_pred_block(xd, yv12_mb[ref_frame_nrs], yv12, sf, sf, num_planes); -#else av1_setup_pred_block(xd, yv12_mb[ref_frame], yv12, sf, sf, num_planes); -#endif // CONFIG_NEW_REF_SIGNALING } } @@ -1408,23 +1359,15 @@ static int skip_repeated_mv(const AV1_COMMON *const cm, const MACROBLOCK *const x, PREDICTION_MODE this_mode, -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frames_nrs[2], -#else const MV_REFERENCE_FRAME ref_frames[2], -#endif // CONFIG_NEW_REF_SIGNALING InterModeSearchState *search_state) { #if CONFIG_NEW_REF_SIGNALING - const int is_comp_pred = (ref_frames_nrs[1] != INTRA_FRAME_NRS && - ref_frames_nrs[1] != INVALID_IDX); + const int is_comp_pred = + (ref_frames[1] != INTRA_FRAME_NRS && ref_frames[1] != INVALID_IDX); #else const int is_comp_pred = ref_frames[1] > INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING - const uint8_t ref_frame_type = av1_ref_frame_type(ref_frames_nrs); -#else const uint8_t ref_frame_type = av1_ref_frame_type(ref_frames); -#endif // CONFIG_NEW_REF_SIGNALING const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; const int ref_mv_count = mbmi_ext->ref_mv_count[ref_frame_type]; PREDICTION_MODE compare_mode = MB_MODE_COUNT; @@ -1434,25 +1377,15 @@ // NEARMV has the same motion vector as NEARESTMV compare_mode = NEARESTMV; } -#if CONFIG_NEW_REF_SIGNALING - if (ref_mv_count == 1 && - cm->global_motion[ref_frames_nrs[0]].wmtype <= TRANSLATION) { -#else if (ref_mv_count == 1 && cm->global_motion[ref_frames[0]].wmtype <= TRANSLATION) { -#endif // CONFIG_NEW_REF_SIGNALING // NEARMV has the same motion vector as GLOBALMV compare_mode = GLOBALMV; } } if (this_mode == GLOBALMV) { -#if CONFIG_NEW_REF_SIGNALING - if (ref_mv_count == 0 && - cm->global_motion[ref_frames_nrs[0]].wmtype <= TRANSLATION) { -#else if (ref_mv_count == 0 && cm->global_motion[ref_frames[0]].wmtype <= TRANSLATION) { -#endif // CONFIG_NEW_REF_SIGNALING // GLOBALMV has the same motion vector as NEARESTMV compare_mode = NEARESTMV; } @@ -1465,20 +1398,18 @@ if (compare_mode != MB_MODE_COUNT) { // Use modelled_rd to check whether compare mode was searched #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frame_nrs0 = - COMPACT_INDEX0_NRS(ref_frames_nrs[0]); - if (search_state->modelled_rd[compare_mode][0][ref_frame_nrs0] != - INT64_MAX) { + const MV_REFERENCE_FRAME ref_frame0 = COMPACT_INDEX0_NRS(ref_frames[0]); + if (search_state->modelled_rd[compare_mode][0][ref_frame0] != INT64_MAX) { const int16_t mode_ctx = - av1_mode_context_analyzer(mbmi_ext->mode_context, ref_frames_nrs); + av1_mode_context_analyzer(mbmi_ext->mode_context, ref_frames); const int compare_cost = cost_mv_ref(&x->mode_costs, compare_mode, mode_ctx); const int this_cost = cost_mv_ref(&x->mode_costs, this_mode, mode_ctx); // Only skip if the mode cost is larger than compare mode cost if (this_cost > compare_cost) { - search_state->modelled_rd[this_mode][0][ref_frame_nrs0] = - search_state->modelled_rd[compare_mode][0][ref_frame_nrs0]; + search_state->modelled_rd[this_mode][0][ref_frame0] = + search_state->modelled_rd[compare_mode][0][ref_frame0]; return 1; } } @@ -1537,8 +1468,8 @@ const int is_comp_pred = has_second_ref(mbmi); const PREDICTION_MODE this_mode = mbmi->mode; #if CONFIG_NEW_REF_SIGNALING - const int refs[2] = { mbmi->ref_frame_nrs[0], - COMPACT_INDEX1_NRS(mbmi->ref_frame_nrs[1]) }; + const int refs[2] = { mbmi->ref_frame[0], + COMPACT_INDEX1_NRS(mbmi->ref_frame[1]) }; #else const int refs[2] = { mbmi->ref_frame[0], mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1] }; @@ -1653,12 +1584,7 @@ int best_match = -1; MV prev_ref_mv[2] = { { 0 } }; for (int idx = 0; idx < mbmi->ref_mv_idx; ++idx) { - prev_ref_mv[idx] = av1_get_ref_mv_from_stack(ref_idx, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs, -#else - mbmi->ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING + prev_ref_mv[idx] = av1_get_ref_mv_from_stack(ref_idx, mbmi->ref_frame, idx, x->mbmi_ext) .as_mv; const int ref_mv_diff = AOMMAX(abs(ref_mv.row - prev_ref_mv[idx].row), @@ -1849,12 +1775,11 @@ int pts0[SAMPLES_ARRAY_SIZE], pts_inref0[SAMPLES_ARRAY_SIZE]; #if CONFIG_NEW_REF_SIGNALING - assert(mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS); - const MV_REFERENCE_FRAME ref_frame_1_nrs = mbmi->ref_frame_nrs[1]; + assert(mbmi->ref_frame[1] != INTRA_FRAME_NRS); #else assert(mbmi->ref_frame[1] != INTRA_FRAME); - const MV_REFERENCE_FRAME ref_frame_1 = mbmi->ref_frame[1]; #endif // CONFIG_NEW_REF_SIGNALING + const MV_REFERENCE_FRAME ref_frame_1 = mbmi->ref_frame[1]; (void)tile_data; av1_invalid_rd_stats(&best_rd_stats); aom_clear_system_state(); @@ -1918,7 +1843,7 @@ } else { mbmi->motion_mode = (MOTION_MODE)mode_index; #if CONFIG_NEW_REF_SIGNALING - assert(mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS); + assert(mbmi->ref_frame[1] != INTRA_FRAME_NRS); #else assert(mbmi->ref_frame[1] != INTRA_FRAME); #endif // CONFIG_NEW_REF_SIGNALING @@ -2164,17 +2089,16 @@ if (mbmi->motion_mode != WARPED_CAUSAL) rd_stats->rate += switchable_rate; if (interintra_allowed) { rd_stats->rate += - mode_costs - ->interintra_cost[size_group_lookup[bsize]] + mode_costs->interintra_cost[size_group_lookup[bsize]] #if CONFIG_NEW_REF_SIGNALING - [mbmi->ref_frame_nrs[1] == INTRA_FRAME_NRS]; + [mbmi->ref_frame[1] == INTRA_FRAME_NRS]; #else - [mbmi->ref_frame[1] == INTRA_FRAME]; + [mbmi->ref_frame[1] == INTRA_FRAME]; #endif // CONFIG_NEW_REF_SIGNALING } if ((last_motion_mode_allowed > SIMPLE_TRANSLATION) && #if CONFIG_NEW_REF_SIGNALING - (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS) + (mbmi->ref_frame[1] != INTRA_FRAME_NRS) #else (mbmi->ref_frame[1] != INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -2209,18 +2133,14 @@ cpi, bsize, x, xd, 0, num_planes - 1, &est_residue_cost, &est_dist, NULL, &curr_sse, NULL, NULL, NULL); #if CONFIG_NEW_REF_SIGNALING - sse_y = x->pred_sse[COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame_nrs[0])]; + sse_y = x->pred_sse[COMPACT_INDEX0_NRS(xd->mi[0]->ref_frame[0])]; #else sse_y = x->pred_sse[xd->mi[0]->ref_frame[0]]; #endif // CONFIG_NEW_REF_SIGNALING } est_rd = RDCOST(x->rdmult, rd_stats->rate + est_residue_cost, est_dist); if (est_rd * 0.80 > *best_est_rd) { -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = ref_frame_1_nrs; -#else mbmi->ref_frame[1] = ref_frame_1; -#endif // CONFIG_NEW_REF_SIGNALING continue; } const int mode_rate = rd_stats->rate; @@ -2302,7 +2222,7 @@ if (mode_index == 0) { #if CONFIG_NEW_REF_SIGNALING args->simple_rd[this_mode][mbmi->ref_mv_idx] - [COMPACT_INDEX0_NRS(mbmi->ref_frame_nrs[0])] = tmp_rd; + [COMPACT_INDEX0_NRS(mbmi->ref_frame[0])] = tmp_rd; #else args->simple_rd[this_mode][mbmi->ref_mv_idx][mbmi->ref_frame[0]] = tmp_rd; #endif @@ -2322,11 +2242,7 @@ } } // Update RD and mbmi stats for selected motion mode -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[1] = ref_frame_1_nrs; -#else mbmi->ref_frame[1] = ref_frame_1; -#endif // CONFIG_NEW_REF_SIGNALING *rate_mv = best_rate_mv; if (best_rd == INT64_MAX || !av1_check_newmv_joint_nonzero(cm, x)) { av1_invalid_rd_stats(rd_stats); @@ -2485,21 +2401,11 @@ int_mv this_mv; this_mv.as_int = INVALID_MV; ret = get_this_mv(&this_mv, this_mode, i, mbmi->ref_mv_idx, - skip_repeated_ref_mv, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs, -#else - mbmi->ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - x->mbmi_ext); + skip_repeated_ref_mv, mbmi->ref_frame, x->mbmi_ext); if (!ret) return 0; const PREDICTION_MODE single_mode = get_single_mode(this_mode, i); if (single_mode == NEWMV) { -#if CONFIG_NEW_REF_SIGNALING - const uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else const uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING cur_mv[i] = (i == 0) ? x->mbmi_ext->ref_mv_stack[ref_frame_type][mbmi->ref_mv_idx] .this_mv @@ -2527,11 +2433,7 @@ return 0; } int16_t mode_ctx_pristine = -#if CONFIG_NEW_REF_SIGNALING - av1_mode_context_pristine(mbmi_ext->mode_context, mbmi->ref_frame_nrs); -#else av1_mode_context_pristine(mbmi_ext->mode_context, mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING int cost = 0; const int range = av1_drl_range(mbmi_ext->ref_mv_count[ref_frame_type], mode_ctx_pristine >> 8, max_drl_bits); @@ -2589,11 +2491,7 @@ PREDICTION_MODE this_mode) { for (int ref_idx = 0; ref_idx < 2; ++ref_idx) { const PREDICTION_MODE single_mode = get_single_mode(this_mode, ref_idx); -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref = mbmi->ref_frame_nrs[ref_idx]; -#else const MV_REFERENCE_FRAME ref = mbmi->ref_frame[ref_idx]; -#endif // CONFIG_NEW_REF_SIGNALING if (single_mode == NEWMV && args->single_newmv_valid[mbmi->ref_mv_idx][ref] == 0) { return 0; @@ -2665,21 +2563,17 @@ MB_MODE_INFO *mbmi = xd->mi[0]; const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; (void)ref_frame_dist_info; -#if CONFIG_NEW_REF_SIGNALING - const int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else const int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING const int is_comp_pred = has_second_ref(mbmi); if (sf->inter_sf.reduce_inter_modes && ref_mv_idx > 0) { #if CONFIG_NEW_REF_SIGNALING // NOTE: This section changes the stats. int ranks[2][2], dir[2] = { -1, -1 }; - if (mbmi->ref_frame_nrs[0] != INTRA_FRAME_NRS) - dir[0] = get_dir_rank(cm, mbmi->ref_frame_nrs[0], ranks[0]); - if (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS && - mbmi->ref_frame_nrs[1] != INVALID_IDX) - dir[1] = get_dir_rank(cm, mbmi->ref_frame_nrs[1], ranks[1]); + if (mbmi->ref_frame[0] != INTRA_FRAME_NRS) + dir[0] = get_dir_rank(cm, mbmi->ref_frame[0], ranks[0]); + if (mbmi->ref_frame[1] != INTRA_FRAME_NRS && + mbmi->ref_frame[1] != INVALID_IDX) + dir[1] = get_dir_rank(cm, mbmi->ref_frame[1], ranks[1]); if ((dir[0] != -1 && ranks[0][dir[0]] > 3) || (dir[1] != -1 && ranks[1][dir[1]] > 2)) #else @@ -2703,9 +2597,9 @@ have_newmv_in_inter_mode(mbmi->mode)) { #if CONFIG_NEW_REF_SIGNALING if ((cm->new_ref_frame_data.n_future_refs == 0 || - mbmi->ref_frame_nrs[0] != cm->new_ref_frame_data.future_refs[0]) && + mbmi->ref_frame[0] != cm->new_ref_frame_data.future_refs[0]) && (cm->new_ref_frame_data.n_past_refs == 0 || - mbmi->ref_frame_nrs[0] != cm->new_ref_frame_data.past_refs[0])) { + mbmi->ref_frame[0] != cm->new_ref_frame_data.past_refs[0])) { #else if (mbmi->ref_frame[0] != ref_frame_dist_info->nearest_past_ref && mbmi->ref_frame[0] != ref_frame_dist_info->nearest_future_ref) { @@ -2757,11 +2651,7 @@ MACROBLOCKD *xd = &x->e_mbd; MB_MODE_INFO *mbmi = xd->mi[0]; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; -#if CONFIG_NEW_REF_SIGNALING - const int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else const int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING const AV1_COMMON *cm = &cpi->common; const int is_comp_pred = has_second_ref(mbmi); const ModeCosts *mode_costs = &x->mode_costs; @@ -2777,8 +2667,8 @@ mbmi->comp_group_idx = 0; mbmi->compound_idx = 1; #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[1] == INTRA_FRAME_NRS) { - mbmi->ref_frame_nrs[1] = INVALID_IDX; + if (mbmi->ref_frame[1] == INTRA_FRAME_NRS) { + mbmi->ref_frame[1] = INVALID_IDX; } #else if (mbmi->ref_frame[1] == INTRA_FRAME) { @@ -2786,11 +2676,7 @@ } #endif // CONFIG_NEW_REF_SIGNALING int16_t mode_ctx = -#if CONFIG_NEW_REF_SIGNALING - av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame_nrs); -#else av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING mbmi->num_proj_ref = 0; mbmi->motion_mode = SIMPLE_TRANSLATION; @@ -2894,10 +2780,10 @@ // Do not prune when there is internal resizing. TODO(elliottk) fix this // so b/2384 can be resolved. #if CONFIG_NEW_REF_SIGNALING - if (av1_is_scaled(get_ref_scale_factors(cm, mbmi->ref_frame_nrs[0])) || - (mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS && - mbmi->ref_frame_nrs[1] != INVALID_IDX && - av1_is_scaled(get_ref_scale_factors(cm, mbmi->ref_frame_nrs[1])))) { + if (av1_is_scaled(get_ref_scale_factors(cm, mbmi->ref_frame[0])) || + (mbmi->ref_frame[1] != INTRA_FRAME_NRS && + mbmi->ref_frame[1] != INVALID_IDX && + av1_is_scaled(get_ref_scale_factors(cm, mbmi->ref_frame[1])))) { return good_indices; } #else @@ -2998,17 +2884,10 @@ // (top/left) reference frames static AOM_INLINE int ref_match_found_in_nb_blocks(MB_MODE_INFO *cur_mbmi, MB_MODE_INFO *nb_mbmi) { -#if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME nb_ref_frames[2] = { nb_mbmi->ref_frame_nrs[0], - nb_mbmi->ref_frame_nrs[1] }; - MV_REFERENCE_FRAME cur_ref_frames[2] = { cur_mbmi->ref_frame_nrs[0], - cur_mbmi->ref_frame_nrs[1] }; -#else MV_REFERENCE_FRAME nb_ref_frames[2] = { nb_mbmi->ref_frame[0], nb_mbmi->ref_frame[1] }; MV_REFERENCE_FRAME cur_ref_frames[2] = { cur_mbmi->ref_frame[0], cur_mbmi->ref_frame[1] }; -#endif // CONFIG_NEW_REF_SIGNALING const int is_cur_comp_pred = has_second_ref(cur_mbmi); int match_found = 0; @@ -3566,10 +3445,8 @@ int i; // Reference frames for this mode #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME refs_nrs[2] = { - COMPACT_INDEX0_NRS(mbmi->ref_frame_nrs[0]), - COMPACT_INDEX1_NRS(mbmi->ref_frame_nrs[1]) - }; + const MV_REFERENCE_FRAME refs[2] = { COMPACT_INDEX0_NRS(mbmi->ref_frame[0]), + COMPACT_INDEX1_NRS(mbmi->ref_frame[1]) }; #else const MV_REFERENCE_FRAME refs[2] = { mbmi->ref_frame[0], (mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]) @@ -3592,11 +3469,7 @@ { MAX_SB_SIZE, MAX_SB_SIZE, MAX_SB_SIZE } }; int64_t ret_val = INT64_MAX; -#if CONFIG_NEW_REF_SIGNALING - const int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame_nrs); -#else const int8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING RD_STATS best_rd_stats, best_rd_stats_y, best_rd_stats_uv; int64_t best_rd = INT64_MAX; uint8_t best_blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE]; @@ -3624,22 +3497,12 @@ #if CONFIG_NEW_INTER_MODES cm->features.max_drl_bits, #endif // CONFIG_NEW_INTER_MODES - x, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs, -#else - mbmi->ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - this_mode); + x, mbmi->ref_frame, this_mode); // Save MV results from first 2 ref_mv_idx. int_mv save_mv[MAX_REF_MV_SEARCH - 1][2]; int best_ref_mv_idx = -1; const int16_t mode_ctx = -#if CONFIG_NEW_REF_SIGNALING - av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame_nrs); -#else av1_mode_context_analyzer(mbmi_ext->mode_context, mbmi->ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING const int idx_mask = ref_mv_idx_to_search(cpi, x, rd_stats, args, ref_best_rd, mode_info, bsize, ref_set); const ModeCosts *mode_costs = &x->mode_costs; @@ -3674,14 +3537,8 @@ !ref_match_found_in_left_nb && (ref_best_rd != INT64_MAX)) { // Skip mode if TPL model indicates it will not be beneficial. if (prune_modes_based_on_tpl_stats( - &cm->features, inter_cost_info_from_tpl, -#if CONFIG_NEW_REF_SIGNALING - refs_nrs, -#else - refs, -#endif // CONFIG_NEW_REF_SIGNALING - ref_mv_idx, this_mode, - cpi->sf.inter_sf.prune_inter_modes_based_on_tpl)) + &cm->features, inter_cost_info_from_tpl, refs, ref_mv_idx, + this_mode, cpi->sf.inter_sf.prune_inter_modes_based_on_tpl)) continue; } av1_init_rd_stats(rd_stats); @@ -3691,8 +3548,8 @@ mbmi->comp_group_idx = 0; mbmi->compound_idx = 1; #if CONFIG_NEW_REF_SIGNALING - if (mbmi->ref_frame_nrs[1] == INTRA_FRAME_NRS) { - mbmi->ref_frame_nrs[1] = INVALID_IDX; + if (mbmi->ref_frame[1] == INTRA_FRAME_NRS) { + mbmi->ref_frame[1] = INVALID_IDX; } #else if (mbmi->ref_frame[1] == INTRA_FRAME) { @@ -3752,12 +3609,7 @@ cpi, x, bsize, do_tx_search, this_mode, mbmi->max_mv_precision, &best_mbmi, motion_mode_cand, &ref_best_rd, &best_rd_stats, &best_rd_stats_y, &best_rd_stats_uv, mode_info, args, drl_cost, -#if CONFIG_NEW_REF_SIGNALING - refs_nrs, -#else - refs, -#endif // CONFIG_NEW_REF_SIGNALING - cur_mv, &best_rd, orig_dst, ref_mv_idx)) + refs, cur_mv, &best_rd, orig_dst, ref_mv_idx)) continue; } // Copy the motion vector for this mode into mbmi struct @@ -3822,11 +3674,7 @@ end_timing(cpi, interpolation_filter_search_time); #endif if (args->modelled_rd != NULL && !is_comp_pred) { -#if CONFIG_NEW_REF_SIGNALING - args->modelled_rd[this_mode][ref_mv_idx][refs_nrs[0]] = rd; -#else args->modelled_rd[this_mode][ref_mv_idx][refs[0]] = rd; -#endif // CONFIG_NEW_REF_SIGNALING } if (ret_val != 0) { restore_dst_buf(xd, orig_dst, num_planes); @@ -3847,13 +3695,8 @@ const int mode0 = compound_ref0_mode(this_mode); const int mode1 = compound_ref1_mode(this_mode); const int64_t mrd = -#if CONFIG_NEW_REF_SIGNALING - AOMMIN(args->modelled_rd[mode0][ref_mv_idx][refs_nrs[0]], - args->modelled_rd[mode1][ref_mv_idx][refs_nrs[1]]); -#else AOMMIN(args->modelled_rd[mode0][ref_mv_idx][refs[0]], args->modelled_rd[mode1][ref_mv_idx][refs[1]]); -#endif // CONFIG_NEW_REF_SIGNALING if ((rd >> 3) * 6 > mrd && ref_best_rd < INT64_MAX) { restore_dst_buf(xd, orig_dst, num_planes); continue; @@ -3893,12 +3736,7 @@ } // Collect mode stats for multiwinner mode processing store_winner_mode_stats( - &cpi->common, x, mbmi, rd_stats, rd_stats_y, rd_stats_uv, -#if CONFIG_NEW_REF_SIGNALING - refs_nrs, -#else - refs, -#endif // CONFIG_NEW_REF_SIGNALING + &cpi->common, x, mbmi, rd_stats, rd_stats_y, rd_stats_uv, refs, mbmi->mode, NULL, bsize, tmp_rd, cpi->sf.winner_mode_sf.multi_winner_mode_type, do_tx_search); if (tmp_rd < best_rd) { @@ -3976,44 +3814,26 @@ const int sb_col = mi_col >> cm->seq_params.mib_size_log2; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; - MV_REFERENCE_FRAME ref_frame = INTRA_FRAME; - (void)ref_frame; #if CONFIG_NEW_REF_SIGNALING - MV_REFERENCE_FRAME ref_frame_nrs = INTRA_FRAME_NRS; - av1_find_mv_refs_nrs(cm, xd, mbmi, ref_frame_nrs, mbmi_ext->ref_mv_count, - xd->ref_mv_stack, xd->weight, NULL, mbmi_ext->global_mvs, - mbmi_ext->mode_context); + MV_REFERENCE_FRAME ref_frame = INTRA_FRAME_NRS; #else + MV_REFERENCE_FRAME ref_frame = INTRA_FRAME; +#endif // CONFIG_NEW_REF_SIGNALING av1_find_mv_refs(cm, xd, mbmi, ref_frame, mbmi_ext->ref_mv_count, xd->ref_mv_stack, xd->weight, NULL, mbmi_ext->global_mvs, mbmi_ext->mode_context); -#endif // CONFIG_NEW_REF_SIGNALING // TODO(Ravi): Populate mbmi_ext->ref_mv_stack[ref_frame][4] and // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. -#if CONFIG_NEW_REF_SIGNALING - av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame_nrs); -#else av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame); -#endif // CONFIG_NEW_REF_SIGNALING #if CONFIG_NEW_INTER_MODES - int_mv dv_ref = av1_find_best_ref_mv_from_stack(mbmi_ext, -#if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs, -#else - ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING + int_mv dv_ref = av1_find_best_ref_mv_from_stack(mbmi_ext, ref_frame, cm->features.fr_mv_precision); dv_ref.as_int = dv_ref.as_int == INVALID_MV ? 0 : dv_ref.as_int; #else int_mv nearestmv, nearmv; - av1_find_best_ref_mvs_from_stack(mbmi_ext, -#if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs, -#else - ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - &nearestmv, &nearmv, MV_SUBPEL_NONE); + av1_find_best_ref_mvs_from_stack(mbmi_ext, ref_frame, &nearestmv, &nearmv, + MV_SUBPEL_NONE); if (nearestmv.as_int == INVALID_MV) { nearestmv.as_int = 0; @@ -4204,8 +4024,8 @@ ctx->rd_stats.skip_txfm = 0; #if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = INTRA_FRAME_NRS; - mbmi->ref_frame_nrs[1] = INVALID_IDX; + mbmi->ref_frame[0] = INTRA_FRAME_NRS; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[0] = INTRA_FRAME; mbmi->ref_frame[1] = NONE_FRAME; @@ -4259,14 +4079,8 @@ if (rd_cost->rate == INT_MAX) return; ctx->mic = *xd->mi[0]; - av1_copy_mbmi_ext_to_mbmi_ext_frame( - &ctx->mbmi_ext_best, x->mbmi_ext, -#if CONFIG_NEW_REF_SIGNALING - av1_ref_frame_type(xd->mi[0]->ref_frame_nrs) -#else - av1_ref_frame_type(xd->mi[0]->ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - ); + av1_copy_mbmi_ext_to_mbmi_ext_frame(&ctx->mbmi_ext_best, x->mbmi_ext, + av1_ref_frame_type(xd->mi[0]->ref_frame)); av1_copy_array(ctx->tx_type_map, xd->tx_type_map, ctx->num_4x4_blk); } @@ -4301,9 +4115,8 @@ } #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frame_nrs = skip_mode_info->ref_frame_idx_0; - const MV_REFERENCE_FRAME second_ref_frame_nrs = - skip_mode_info->ref_frame_idx_1; + const MV_REFERENCE_FRAME ref_frame = skip_mode_info->ref_frame_idx_0; + const MV_REFERENCE_FRAME second_ref_frame = skip_mode_info->ref_frame_idx_1; #else const MV_REFERENCE_FRAME ref_frame = LAST_FRAME + skip_mode_info->ref_frame_idx_0; @@ -4336,46 +4149,22 @@ mbmi->ref_mv_idx = 0; #endif // CONFIG_NEW_INTER_MODES mbmi->uv_mode = UV_DC_PRED; -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = ref_frame_nrs; - mbmi->ref_frame_nrs[1] = second_ref_frame_nrs; -#else mbmi->ref_frame[0] = ref_frame; mbmi->ref_frame[1] = second_ref_frame; -#endif // CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING - const uint8_t ref_frame_type_nrs = av1_ref_frame_type(mbmi->ref_frame_nrs); - if (x->mbmi_ext->ref_mv_count[ref_frame_type_nrs] == UINT8_MAX) { - if (x->mbmi_ext->ref_mv_count[ref_frame_nrs] == UINT8_MAX || - x->mbmi_ext->ref_mv_count[second_ref_frame_nrs] == UINT8_MAX) { - return; - } -#else const uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame); if (x->mbmi_ext->ref_mv_count[ref_frame_type] == UINT8_MAX) { if (x->mbmi_ext->ref_mv_count[ref_frame] == UINT8_MAX || x->mbmi_ext->ref_mv_count[second_ref_frame] == UINT8_MAX) { return; } -#endif // CONFIG_NEW_REF_SIGNALING MB_MODE_INFO_EXT *mbmi_ext = x->mbmi_ext; -#if CONFIG_NEW_REF_SIGNALING - av1_find_mv_refs_nrs(cm, xd, mbmi, ref_frame_type_nrs, - mbmi_ext->ref_mv_count, xd->ref_mv_stack, xd->weight, - NULL, mbmi_ext->global_mvs, mbmi_ext->mode_context); -#else av1_find_mv_refs(cm, xd, mbmi, ref_frame_type, mbmi_ext->ref_mv_count, xd->ref_mv_stack, xd->weight, NULL, mbmi_ext->global_mvs, mbmi_ext->mode_context); -#endif // CONFIG_NEW_REF_SIGNALING - // TODO(Ravi): Populate mbmi_ext->ref_mv_stack[ref_frame][4] and - // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. -#if CONFIG_NEW_REF_SIGNALING - av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame_type_nrs); -#else + // TODO(Ravi): Populate mbmi_ext->ref_mv_stack[ref_frame][4] and + // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame_type); -#endif // CONFIG_NEW_REF_SIGNALING } #if CONFIG_NEW_INTER_MODES @@ -4405,19 +4194,11 @@ set_default_interp_filters(mbmi, cm->features.interp_filter); -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); - for (int i = 0; i < num_planes; i++) { - xd->plane[i].pre[0] = yv12_mb[mbmi->ref_frame_nrs[0]][i]; - xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame_nrs[1]][i]; - } -#else set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); for (int i = 0; i < num_planes; i++) { xd->plane[i].pre[0] = yv12_mb[mbmi->ref_frame[0]][i]; xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame[1]][i]; } -#endif // CONFIG_NEW_RREF_SIGNALING BUFFER_SET orig_dst; for (int i = 0; i < num_planes; i++) { @@ -4453,13 +4234,8 @@ #else search_state->best_mbmode.mode = NEAREST_NEARESTMV; #endif // CONFIG_NEW_INTER_MODES -#if CONFIG_NEW_REF_SIGNALING - search_state->best_mbmode.ref_frame_nrs[0] = mbmi->ref_frame_nrs[0]; - search_state->best_mbmode.ref_frame_nrs[1] = mbmi->ref_frame_nrs[1]; -#else search_state->best_mbmode.ref_frame[0] = mbmi->ref_frame[0]; search_state->best_mbmode.ref_frame[1] = mbmi->ref_frame[1]; -#endif // CONFIG_NEW_REF_SIGNALING search_state->best_mbmode.mv[0].as_int = mbmi->mv[0].as_int; search_state->best_mbmode.mv[1].as_int = mbmi->mv[1].as_int; @@ -4589,15 +4365,6 @@ *mbmi = *winner_mbmi; -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); - // Select prediction reference frames. - for (int i = 0; i < num_planes; i++) { - xd->plane[i].pre[0] = yv12_mb[mbmi->ref_frame_nrs[0]][i]; - if (has_second_ref(mbmi)) - xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame_nrs[1]][i]; - } -#else set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); // Select prediction reference frames. for (int i = 0; i < num_planes; i++) { @@ -4605,7 +4372,6 @@ if (has_second_ref(mbmi)) xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame[1]][i]; } -#endif // CONFIG_NEW_REF_SIGNALING if (is_inter_mode(mbmi->mode)) { const int mi_row = xd->mi_row; @@ -5048,12 +4814,11 @@ } #if CONFIG_NEW_REF_SIGNALING -static AOM_INLINE int prune_ref_frame( - const AV1_COMP *cpi, const MACROBLOCK *x, - const MV_REFERENCE_FRAME ref_frame_type_nrs) { +static AOM_INLINE int prune_ref_frame(const AV1_COMP *cpi, const MACROBLOCK *x, + const MV_REFERENCE_FRAME ref_frame) { const AV1_COMMON *const cm = &cpi->common; MV_REFERENCE_FRAME rf[2]; - av1_set_ref_frame(rf, ref_frame_type_nrs); + av1_set_ref_frame(rf, ref_frame); const int comp_pred = (rf[1] != INVALID_IDX && rf[1] != INTRA_FRAME_NRS); if (comp_pred) { if (!cpi->oxcf.ref_frm_cfg.enable_onesided_comp || @@ -5122,31 +4887,17 @@ } #if CONFIG_EXT_RECUR_PARTITIONS -#if CONFIG_NEW_REF_SIGNALING -static AOM_INLINE int is_ref_frame_used_in_cache_nrs( - MV_REFERENCE_FRAME ref_frame_nrs, const MB_MODE_INFO *mi_cache) { - if (!mi_cache) { - return 0; - } - - if (ref_frame_nrs < INTER_REFS_PER_FRAME_NRS) { - return (ref_frame_nrs == mi_cache->ref_frame_nrs[0] || - ref_frame_nrs == mi_cache->ref_frame_nrs[1]); - } - - // if we are here, then the current mode is compound. - MV_REFERENCE_FRAME cached_ref_type = - av1_ref_frame_type(mi_cache->ref_frame_nrs); - return ref_frame_nrs == cached_ref_type; -} -#else static AOM_INLINE int is_ref_frame_used_in_cache(MV_REFERENCE_FRAME ref_frame, const MB_MODE_INFO *mi_cache) { if (!mi_cache) { return 0; } +#if CONFIG_NEW_REF_SIGNALING + if (ref_frame < INTER_REFS_PER_FRAME_NRS) { +#else if (ref_frame < REF_FRAMES) { +#endif // CONFIG_NEW_REF_SIGNALING return (ref_frame == mi_cache->ref_frame[0] || ref_frame == mi_cache->ref_frame[1]); } @@ -5155,7 +4906,6 @@ MV_REFERENCE_FRAME cached_ref_type = av1_ref_frame_type(mi_cache->ref_frame); return ref_frame == cached_ref_type; } -#endif // CONFIG_NEW_REF_SIGNALING #endif // CONFIG_EXT_RECUR_PARTITIONS // Please add/modify parameter setting in this function, making it consistent @@ -5177,11 +4927,7 @@ unsigned char segment_id = mbmi->segment_id; init_neighbor_pred_buf(&x->obmc_buffer, args, is_cur_buf_hbd(&x->e_mbd)); -#if CONFIG_NEW_REF_SIGNALING - av1_collect_neighbors_ref_counts_nrs(cm, xd); -#else av1_collect_neighbors_ref_counts(xd); -#endif // CONFIG_NEW_REF_SIGNALING estimate_ref_frame_costs(cm, xd, &x->mode_costs, segment_id, ref_costs_single, ref_costs_comp); @@ -5192,33 +4938,18 @@ // TODO(debargha, sarahparker): This section can be removed when // mbmi_ext->mode_context and mbmi_ext->ref_mv_count has been ported // over to use the new signaling framework. - for (MV_REFERENCE_FRAME ref_frame_nrs = 0; - ref_frame_nrs < INTER_REFS_PER_FRAME_NRS; ++ref_frame_nrs) { - x->mbmi_ext->mode_context[ref_frame_nrs] = 0; - mbmi_ext->ref_mv_count[ref_frame_nrs] = UINT8_MAX; + for (MV_REFERENCE_FRAME ref_frame = 0; ref_frame < INTER_REFS_PER_FRAME_NRS; + ++ref_frame) { + x->mbmi_ext->mode_context[ref_frame] = 0; + mbmi_ext->ref_mv_count[ref_frame] = UINT8_MAX; } - for (MV_REFERENCE_FRAME ref_frame_nrs = 0; - ref_frame_nrs < INTER_REFS_PER_FRAME_NRS; ++ref_frame_nrs) { - if ((cpi->common.ref_frame_flags & (1 << ref_frame_nrs))) { - x->pred_mv_sad[ref_frame_nrs] = INT_MAX; - if (mbmi->partition != PARTITION_NONE && - mbmi->partition != PARTITION_SPLIT) { - if (skip_ref_frame_mask & (1 << ref_frame_nrs) && - !is_ref_frame_used_by_compound_ref(ref_frame_nrs, - skip_ref_frame_mask) -#if CONFIG_EXT_RECUR_PARTITIONS - && !(should_reuse_mode(x, REUSE_INTER_MODE_IN_INTERFRAME_FLAG) && - is_ref_frame_used_in_cache_nrs(ref_frame_nrs, - x->inter_mode_cache)) -#endif // CONFIG_EXT_RECUR_PARTITIONS - ) { - continue; - } - } - assert(get_ref_frame_yv12_buf(cm, ref_frame_nrs) != NULL); - setup_buffer_ref_mvs_inter(cpi, x, ref_frame_nrs, bsize, yv12_mb); - } - } +#endif // CONFIG_NEW_REF_SIGNALING + +#if CONFIG_NEW_REF_SIGNALING + for (MV_REFERENCE_FRAME ref_frame = 0; ref_frame < INTER_REFS_PER_FRAME_NRS; + ++ref_frame) { + if ((cpi->common.ref_frame_flags & (1 << ref_frame))) { + x->pred_mv_sad[ref_frame] = INT_MAX; #else for (MV_REFERENCE_FRAME ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { @@ -5226,6 +4957,7 @@ x->mbmi_ext->mode_context[ref_frame] = 0; mbmi_ext->ref_mv_count[ref_frame] = UINT8_MAX; if (cpi->common.ref_frame_flags & av1_ref_frame_flag_list[ref_frame]) { +#endif // CONFIG_NEW_REF_SIGNALING if (mbmi->partition != PARTITION_NONE && mbmi->partition != PARTITION_SPLIT) { if (skip_ref_frame_mask & (1 << ref_frame) && @@ -5241,25 +4973,26 @@ assert(get_ref_frame_yv12_buf(cm, ref_frame) != NULL); setup_buffer_ref_mvs_inter(cpi, x, ref_frame, bsize, yv12_mb); } +#if !CONFIG_NEW_REF_SIGNALING // Store the best pred_mv_sad across all past frames if (cpi->sf.inter_sf.alt_ref_search_fp && cpi->ref_frame_dist_info.ref_relative_dist[ref_frame - LAST_FRAME] < 0) x->best_pred_mv_sad = AOMMIN(x->best_pred_mv_sad, x->pred_mv_sad[ref_frame]); - } #endif // CONFIG_NEW_REF_SIGNALING + } if (!cpi->sf.rt_sf.use_real_time_ref_set && is_comp_ref_allowed(bsize)) { // No second reference on RT ref set, so no need to initialize #if CONFIG_NEW_REF_SIGNALING - for (MV_REFERENCE_FRAME ref_frame_nrs = INTER_REFS_PER_FRAME_NRS; - ref_frame_nrs < INTRA_FRAME_NRS; ++ref_frame_nrs) { - x->mbmi_ext->mode_context[ref_frame_nrs] = 0; - mbmi_ext->ref_mv_count[ref_frame_nrs] = UINT8_MAX; + for (MV_REFERENCE_FRAME ref_frame = INTER_REFS_PER_FRAME_NRS; + ref_frame < INTRA_FRAME_NRS; ++ref_frame) { + x->mbmi_ext->mode_context[ref_frame] = 0; + mbmi_ext->ref_mv_count[ref_frame] = UINT8_MAX; } - for (MV_REFERENCE_FRAME ref_frame_nrs = INTER_REFS_PER_FRAME_NRS; - ref_frame_nrs < INTRA_FRAME_NRS; ++ref_frame_nrs) { + for (MV_REFERENCE_FRAME ref_frame = INTER_REFS_PER_FRAME_NRS; + ref_frame < INTRA_FRAME_NRS; ++ref_frame) { MV_REFERENCE_FRAME rf_nrs[2]; - av1_set_ref_frame(rf_nrs, ref_frame_nrs); + av1_set_ref_frame(rf_nrs, ref_frame); if (rf_nrs[0] >= cm->new_ref_frame_data.n_total_refs || rf_nrs[1] >= cm->new_ref_frame_data.n_total_refs) continue; @@ -5267,28 +5000,6 @@ (cpi->common.ref_frame_flags & (1 << rf_nrs[1])))) { continue; } - - if (mbmi->partition != PARTITION_NONE && - mbmi->partition != PARTITION_SPLIT) { - if (skip_ref_frame_mask & (1 << ref_frame_nrs) -#if CONFIG_EXT_RECUR_PARTITIONS - && !(should_reuse_mode(x, REUSE_INTER_MODE_IN_INTERFRAME_FLAG) && - is_ref_frame_used_in_cache_nrs(ref_frame_nrs, - x->inter_mode_cache)) -#endif // CONFIG_EXT_RECUR_PARTITIONS - ) { - continue; - } - } - - if (prune_ref_frame(cpi, x, ref_frame_nrs)) continue; - av1_find_mv_refs_nrs(cm, xd, mbmi, ref_frame_nrs, mbmi_ext->ref_mv_count, - xd->ref_mv_stack, xd->weight, NULL, - mbmi_ext->global_mvs, mbmi_ext->mode_context); - // TODO(Ravi): Populate mbmi_ext->ref_mv_stack[ref_frame][4] and - // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. - av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame_nrs); - } #else for (MV_REFERENCE_FRAME ref_frame = ALTREF_FRAME + 1; ref_frame < MODE_CTX_REF_FRAMES; ++ref_frame) { @@ -5299,6 +5010,7 @@ (cpi->common.ref_frame_flags & av1_ref_frame_flag_list[rf[1]]))) { continue; } +#endif // CONFIG_NEW_REF_SIGNALING if (mbmi->partition != PARTITION_NONE && mbmi->partition != PARTITION_SPLIT) { @@ -5322,7 +5034,6 @@ // mbmi_ext->weight[ref_frame][4] inside av1_find_mv_refs. av1_copy_usable_ref_mv_stack_and_weight(xd, mbmi_ext, ref_frame); } -#endif // CONFIG_NEW_REF_SIGNALING } av1_count_overlappable_neighbors(cm, xd); @@ -5497,30 +5208,25 @@ av1_zero(search_state->single_state_modelled_cnt); } -#if CONFIG_NEW_REF_SIGNALING static bool mask_says_skip(const mode_skip_mask_t *mode_skip_mask, - const MV_REFERENCE_FRAME *ref_frame_nrs, + const MV_REFERENCE_FRAME *ref_frame, const PREDICTION_MODE this_mode) { +#if CONFIG_NEW_REF_SIGNALING const MV_REFERENCE_FRAME rfn = - (ref_frame_nrs[0] == INTRA_FRAME_NRS ? INTRA_FRAME_INDEX_NRS - : ref_frame_nrs[0]); + (ref_frame[0] == INTRA_FRAME_NRS ? INTRA_FRAME_INDEX_NRS : ref_frame[0]); if (mode_skip_mask->pred_modes[rfn] & (1 << this_mode)) { return true; } - return get_mask_combo_bit_nrs(mode_skip_mask->ref_combo, ref_frame_nrs); -} + return get_mask_combo_bit_nrs(mode_skip_mask->ref_combo, ref_frame); #else -static bool mask_says_skip(const mode_skip_mask_t *mode_skip_mask, - const MV_REFERENCE_FRAME *ref_frame, - const PREDICTION_MODE this_mode) { if (mode_skip_mask->pred_modes[ref_frame[0]] & (1 << this_mode)) { return true; } return mode_skip_mask->ref_combo[ref_frame[0]][ref_frame[1] + 1]; -} #endif // CONFIG_NEW_REF_SIGNALING +} #if CONFIG_NEW_REF_SIGNALING static int inter_mode_compatible_skip(const AV1_COMP *cpi, const MACROBLOCK *x, @@ -5632,12 +5338,11 @@ } const PREDICTION_MODE cached_mode = cached_mi->mode; + const MV_REFERENCE_FRAME *cached_frame = cached_mi->ref_frame; #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME *cached_frame = cached_mi->ref_frame_nrs; const int cached_mode_is_single = cached_frame[1] == INTRA_FRAME_NRS || cached_frame[1] == INVALID_IDX; #else - const MV_REFERENCE_FRAME *cached_frame = cached_mi->ref_frame; const int cached_mode_is_single = cached_frame[1] <= INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -5700,35 +5405,18 @@ static int inter_mode_search_order_independent_skip( const AV1_COMP *cpi, const MACROBLOCK *x, mode_skip_mask_t *mode_skip_mask, InterModeSearchState *search_state, int skip_ref_frame_mask, - PREDICTION_MODE mode, -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME *ref_frame_nrs -#else - const MV_REFERENCE_FRAME *ref_frame -#endif // CONFIG_NEW_REF_SIGNALING -) { -#if CONFIG_NEW_REF_SIGNALING - if (mask_says_skip(mode_skip_mask, ref_frame_nrs, mode)) { - return 1; - } -#else + PREDICTION_MODE mode, const MV_REFERENCE_FRAME *ref_frame) { if (mask_says_skip(mode_skip_mask, ref_frame, mode)) { return 1; } -#endif // CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING - const int ref_type_nrs = av1_ref_frame_type(ref_frame_nrs); - if (prune_ref_frame(cpi, x, ref_type_nrs)) return 1; -#else const int ref_type = av1_ref_frame_type(ref_frame); if (prune_ref_frame(cpi, x, ref_type)) return 1; -#endif // CONFIG_NEW_REF_SIGNALING // This is only used in motion vector unit test. if (cpi->oxcf.unit_test_cfg.motion_vector_unit_test && #if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs[0] == INTRA_FRAME_NRS + ref_frame[0] == INTRA_FRAME_NRS #else ref_frame[0] == INTRA_FRAME #endif // CONFIG_NEW_REF_SIGNALING @@ -5737,24 +5425,13 @@ #if !CONFIG_NEW_INTER_MODES const AV1_COMMON *const cm = &cpi->common; - if (skip_repeated_mv(cm, x, mode, -#if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs, -#else - ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - search_state)) { + if (skip_repeated_mv(cm, x, mode, ref_frame, search_state)) { return 1; } #endif // !CONFIG_NEW_INTER_MODES #if CONFIG_EXT_RECUR_PARTITIONS - const int cached_skip_ret = skip_inter_mode_with_cached_mode(x, mode, -#if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs -#else - ref_frame -#endif // CONFIG_NEW_REF_SIGNALING - ); + const int cached_skip_ret = + skip_inter_mode_with_cached_mode(x, mode, ref_frame); if (cached_skip_ret > 0) { return cached_skip_ret; } @@ -5769,9 +5446,9 @@ int skip_motion_mode = 0; if (mbmi->partition != PARTITION_NONE && mbmi->partition != PARTITION_SPLIT) { + int skip_ref = skip_ref_frame_mask & (1 << ref_type); #if CONFIG_NEW_REF_SIGNALING - int skip_ref = skip_ref_frame_mask & (1 << ref_type_nrs); - if (ref_type_nrs < INTER_REFS_PER_FRAME_NRS && skip_ref) { + if (ref_type < INTER_REFS_PER_FRAME_NRS && skip_ref) { // Since the compound ref modes depends on the motion estimation result of // two single ref modes( best mv of single ref modes as the start point ) // If current single ref mode is marked skip, we need to check if it will @@ -5780,7 +5457,7 @@ if (skip_ref_frame_mask & (1 << r)) continue; MV_REFERENCE_FRAME rf[2]; av1_set_ref_frame(rf, r); - if (rf[0] == ref_type_nrs || rf[1] == ref_type_nrs) { + if (rf[0] == ref_type || rf[1] == ref_type) { // Found a not skipped compound ref mode which contains current // single ref. So this single ref can't be skipped completly // Just skip it's motion mode search, still try it's simple @@ -5792,7 +5469,6 @@ } } #else - int skip_ref = skip_ref_frame_mask & (1 << ref_type); if (ref_type <= ALTREF_FRAME && skip_ref) { // Since the compound ref modes depends on the motion estimation result of // two single ref modes( best mv of single ref modes as the start point ) @@ -5814,20 +5490,6 @@ } #endif // CONFIG_NEW_REF_SIGNALING #if CONFIG_EXT_RECUR_PARTITIONS -#if CONFIG_NEW_REF_SIGNALING - // If we are reusing the prediction from cache, and the current frame is - // required by the cache, then we cannot prune it. - if (should_reuse_mode(x, REUSE_INTER_MODE_IN_INTERFRAME_FLAG) && - is_ref_frame_used_in_cache_nrs(ref_type_nrs, x->inter_mode_cache)) { - skip_ref = 0; - // If the cache only needs the current reference type for compound - // prediction, then we can skip motion mode search. - skip_motion_mode = - (ref_type_nrs < INTER_REFS_PER_FRAME_NRS && - x->inter_mode_cache->ref_frame_nrs[1] != INVALID_IDX && - x->inter_mode_cache->ref_frame_nrs[1] != INTRA_FRAME_NRS); - } -#else // If we are reusing the prediction from cache, and the current frame is // required by the cache, then we cannot prune it. if (should_reuse_mode(x, REUSE_INTER_MODE_IN_INTERFRAME_FLAG) && @@ -5835,17 +5497,22 @@ skip_ref = 0; // If the cache only needs the current reference type for compound // prediction, then we can skip motion mode search. +#if CONFIG_NEW_REF_SIGNALING + skip_motion_mode = (ref_type < INTER_REFS_PER_FRAME_NRS && + x->inter_mode_cache->ref_frame[1] != INVALID_IDX && + x->inter_mode_cache->ref_frame[1] != INTRA_FRAME_NRS); +#else skip_motion_mode = (ref_type <= ALTREF_FRAME && x->inter_mode_cache->ref_frame[1] > INTRA_FRAME); - } #endif // CONFIG_NEW_REF_SIGNALING + } #endif // CONFIG_EXT_RECUR_PARTITIONS if (skip_ref) return 1; } const SPEED_FEATURES *const sf = &cpi->sf; #if CONFIG_NEW_REF_SIGNALING - if (ref_frame_nrs[0] == INTRA_FRAME_NRS) + if (ref_frame[0] == INTRA_FRAME_NRS) #else if (ref_frame[0] == INTRA_FRAME) #endif // CONFIG_NEW_REF_SIGNALING @@ -5867,23 +5534,14 @@ } static INLINE void init_mbmi(MB_MODE_INFO *mbmi, PREDICTION_MODE curr_mode, -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME *ref_frames_nrs, -#else const MV_REFERENCE_FRAME *ref_frames, -#endif // CONFIG_NEW_REF_SIGNALING const AV1_COMMON *cm, const SB_INFO *sbi) { PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info; mbmi->ref_mv_idx = 0; mbmi->mode = curr_mode; mbmi->uv_mode = UV_DC_PRED; -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = ref_frames_nrs[0]; - mbmi->ref_frame_nrs[1] = ref_frames_nrs[1]; -#else mbmi->ref_frame[0] = ref_frames[0]; mbmi->ref_frame[1] = ref_frames[1]; -#endif // CONFIG_NEW_REF_SIGNALING pmi->palette_size[0] = 0; pmi->palette_size[1] = 0; mbmi->filter_intra_mode_info.use_filter_intra = 0; @@ -5906,14 +5564,13 @@ (void)features; int i, j; #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frame_nrs = - COMPACT_INDEX0_NRS(mbmi->ref_frame_nrs[0]); + const MV_REFERENCE_FRAME ref_frame = COMPACT_INDEX0_NRS(mbmi->ref_frame[0]); #else const MV_REFERENCE_FRAME ref_frame = mbmi->ref_frame[0]; #endif // CONFIG_NEW_REF_SIGNALING const PREDICTION_MODE this_mode = mbmi->mode; #if CONFIG_NEW_REF_SIGNALING - const int dir = get_dir_rank(cm, ref_frame_nrs, NULL); + const int dir = get_dir_rank(cm, ref_frame, NULL); #else const int dir = ref_frame <= GOLDEN_FRAME ? 0 : 1; #endif // CONFIG_NEW_REF_SIGNALING @@ -5922,37 +5579,18 @@ #if CONFIG_NEW_INTER_MODES features->max_drl_bits, #endif // CONFIG_NEW_INTER_MODES - x, -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs, -#else - mbmi->ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - this_mode); + x, mbmi->ref_frame, this_mode); // Simple rd -#if CONFIG_NEW_REF_SIGNALING - int64_t simple_rd = search_state->simple_rd[this_mode][0][ref_frame_nrs]; -#else int64_t simple_rd = search_state->simple_rd[this_mode][0][ref_frame]; -#endif // CONFIG_NEW_REF_SIGNALING for (int ref_mv_idx = 1; ref_mv_idx < ref_set; ++ref_mv_idx) { -#if CONFIG_NEW_REF_SIGNALING - const int64_t rd = - search_state->simple_rd[this_mode][ref_mv_idx][ref_frame_nrs]; -#else const int64_t rd = search_state->simple_rd[this_mode][ref_mv_idx][ref_frame]; -#endif // CONFIG_NEW_REF_SIGNALING if (rd < simple_rd) simple_rd = rd; } // Insertion sort of single_state -#if CONFIG_NEW_REF_SIGNALING - const SingleInterModeState this_state_s = { simple_rd, ref_frame_nrs, 1 }; -#else const SingleInterModeState this_state_s = { simple_rd, ref_frame, 1 }; -#endif // CONFIG_NEW_REF_SIGNALING SingleInterModeState *state_s = search_state->single_state[dir][mode_offset]; i = search_state->single_state_cnt[dir][mode_offset]; for (j = i; j > 0 && state_s[j - 1].rd > this_state_s.rd; --j) @@ -5961,28 +5599,15 @@ search_state->single_state_cnt[dir][mode_offset]++; // Modelled rd -#if CONFIG_NEW_REF_SIGNALING - int64_t modelled_rd = search_state->modelled_rd[this_mode][0][ref_frame_nrs]; - for (int ref_mv_idx = 1; ref_mv_idx < ref_set; ++ref_mv_idx) { - const int64_t rd = - search_state->modelled_rd[this_mode][ref_mv_idx][ref_frame_nrs]; - if (rd < modelled_rd) modelled_rd = rd; - } -#else int64_t modelled_rd = search_state->modelled_rd[this_mode][0][ref_frame]; for (int ref_mv_idx = 1; ref_mv_idx < ref_set; ++ref_mv_idx) { const int64_t rd = search_state->modelled_rd[this_mode][ref_mv_idx][ref_frame]; if (rd < modelled_rd) modelled_rd = rd; } -#endif // CONFIG_NEW_REF_SIGNALING // Insertion sort of single_state_modelled -#if CONFIG_NEW_REF_SIGNALING - const SingleInterModeState this_state_m = { modelled_rd, ref_frame_nrs, 1 }; -#else const SingleInterModeState this_state_m = { modelled_rd, ref_frame, 1 }; -#endif // CONFIG_NEW_REF_SIGNALING SingleInterModeState *state_m = search_state->single_state_modelled[dir][mode_offset]; i = search_state->single_state_modelled_cnt[dir][mode_offset]; @@ -6219,20 +5844,6 @@ } // Check if ref frames of current block matches with given block. -#if CONFIG_NEW_REF_SIGNALING -static INLINE void match_ref_frame(const MB_MODE_INFO *const mbmi, - const MV_REFERENCE_FRAME *ref_frames, - int *const is_ref_match) { - if (is_inter_block(mbmi)) { - is_ref_match[0] |= ref_frames[0] == mbmi->ref_frame_nrs[0]; - is_ref_match[1] |= ref_frames[1] == mbmi->ref_frame_nrs[0]; - if (has_second_ref(mbmi)) { - is_ref_match[0] |= ref_frames[0] == mbmi->ref_frame_nrs[1]; - is_ref_match[1] |= ref_frames[1] == mbmi->ref_frame_nrs[1]; - } - } -} -#else static INLINE void match_ref_frame(const MB_MODE_INFO *const mbmi, const MV_REFERENCE_FRAME *ref_frames, int *const is_ref_match) { @@ -6245,17 +5856,11 @@ } } } -#endif // CONFIG_NEW_REF_SIGNALING // Prune compound mode using ref frames of neighbor blocks. static INLINE int compound_skip_using_neighbor_refs( MACROBLOCKD *const xd, const PREDICTION_MODE this_mode, -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME *ref_frames, -#else - const MV_REFERENCE_FRAME *ref_frames, -#endif // CONFIG_NEW_REF_SIGNALING - int prune_compound_using_neighbors) { + const MV_REFERENCE_FRAME *ref_frames, int prune_compound_using_neighbors) { // Exclude non-extended compound modes from pruning if (this_mode == NEAR_NEARMV || this_mode == NEW_NEWMV || this_mode == GLOBAL_GLOBALMV) @@ -6285,24 +5890,17 @@ // Update best single mode for the given reference frame based on simple rd. static INLINE void update_best_single_mode(InterModeSearchState *search_state, const PREDICTION_MODE this_mode, -#if CONFIG_NEW_REF_SIGNALING const MV_REFERENCE_FRAME ref_frame, -#else - const MV_REFERENCE_FRAME ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING int64_t this_rd) { #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frame_nrs = COMPACT_INDEX0_NRS(ref_frame); - if (this_rd < search_state->best_single_rd[ref_frame_nrs]) { - search_state->best_single_rd[ref_frame_nrs] = this_rd; - search_state->best_single_mode[ref_frame_nrs] = this_mode; - } + const MV_REFERENCE_FRAME rf = COMPACT_INDEX0_NRS(ref_frame); #else - if (this_rd < search_state->best_single_rd[ref_frame]) { + const MV_REFERENCE_FRAME rf = ref_frame; +#endif // CONFIG_NEW_REF_SIGNALING + if (this_rd < search_state->best_single_rd[rf]) { search_state->best_single_rd[ref_frame] = this_rd; search_state->best_single_mode[ref_frame] = this_mode; } -#endif // CONFIG_NEW_REF_SIGNALING } // Prune compound mode using best single mode for the same reference. @@ -6491,29 +6089,20 @@ { p[0].dst.stride, p[1].dst.stride, p[2].dst.stride }, }; -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); -#else set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING // Initialize motion mode to simple translation // Calculation of switchable rate depends on it. mbmi->motion_mode = 0; #if CONFIG_NEW_REF_SIGNALING - const int is_comp_pred = mbmi->ref_frame_nrs[1] != INVALID_IDX && - mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS; - for (int i = 0; i < num_planes; i++) { - xd->plane[i].pre[0] = yv12_mb[mbmi->ref_frame_nrs[0]][i]; - if (is_comp_pred) - xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame_nrs[1]][i]; - } + const int is_comp_pred = mbmi->ref_frame[1] != INVALID_IDX && + mbmi->ref_frame[1] != INTRA_FRAME_NRS; #else const int is_comp_pred = mbmi->ref_frame[1] > INTRA_FRAME; +#endif // CONFIG_NEW_REF_SIGNALING for (int i = 0; i < num_planes; i++) { xd->plane[i].pre[0] = yv12_mb[mbmi->ref_frame[0]][i]; if (is_comp_pred) xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame[1]][i]; } -#endif // CONFIG_NEW_REF_SIGNALING int64_t skip_rd[2] = { search_state->best_skip_rd[0], search_state->best_skip_rd[1] }; @@ -6524,13 +6113,8 @@ if (ret_value != INT64_MAX) { rd_stats.rdcost = RDCOST(x->rdmult, rd_stats.rate, rd_stats.dist); -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME refs[2] = { mbmi->ref_frame_nrs[0], - mbmi->ref_frame_nrs[1] }; -#else const MV_REFERENCE_FRAME refs[2] = { mbmi->ref_frame[0], mbmi->ref_frame[1] }; -#endif // CONFIG_NEW_REF_SIGNALING // Collect mode stats for multiwinner mode processing store_winner_mode_stats( &cpi->common, x, mbmi, &rd_stats, &rd_stats_y, &rd_stats_uv, refs, @@ -6570,7 +6154,7 @@ int64_t *ref_frame_rd, #if CONFIG_NEW_REF_SIGNALING PREDICTION_MODE this_mode, - const MV_REFERENCE_FRAME *ref_frames_nrs, + const MV_REFERENCE_FRAME *ref_frames, #else THR_MODES midx, #endif // CONFIG_NEW_REF_SIGNALING @@ -6579,11 +6163,11 @@ MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *const mbmi = xd->mi[0]; #if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME ref_frame_nrs = ref_frames_nrs[0]; - (void)ref_frame_nrs; - const MV_REFERENCE_FRAME second_ref_frame_nrs = ref_frames_nrs[1]; - const int comp_pred = second_ref_frame_nrs != INTRA_FRAME_NRS && - second_ref_frame_nrs != INVALID_IDX; + const MV_REFERENCE_FRAME ref_frame = ref_frames[0]; + (void)ref_frame; + const MV_REFERENCE_FRAME second_ref_frame = ref_frames[1]; + const int comp_pred = + second_ref_frame != INTRA_FRAME_NRS && second_ref_frame != INVALID_IDX; #else // Get the actual prediction mode we are trying in this iteration const THR_MODES mode_enum = av1_default_mode_order[midx]; @@ -6597,21 +6181,11 @@ // Check if this mode should be skipped because it is incompatible with the // current frame -#if CONFIG_NEW_REF_SIGNALING - if (inter_mode_compatible_skip(cpi, x, bsize, this_mode, ref_frames_nrs)) -#else if (inter_mode_compatible_skip(cpi, x, bsize, this_mode, ref_frames)) -#endif // CONFIG_NEW_REF_SIGNALING return 1; const int ret = inter_mode_search_order_independent_skip( cpi, x, args->mode_skip_mask, args->search_state, - args->skip_ref_frame_mask, this_mode, -#if CONFIG_NEW_REF_SIGNALING - ref_frames_nrs -#else - ref_frames -#endif // CONFIG_NEW_REF_SIGNALING - ); + args->skip_ref_frame_mask, this_mode, ref_frames); if (ret == 1) return 1; *(args->skip_motion_mode) = (ret == 2); @@ -6645,18 +6219,13 @@ #endif // CONFIG_OPTFLOW_REFINEMENT comp_pred) { if (compound_skip_by_single_states(cpi, args->search_state, this_mode, -#if CONFIG_NEW_REF_SIGNALING - ref_frame_nrs, second_ref_frame_nrs, -#else - ref_frame, second_ref_frame, -#endif // CONFIG_NEW_REF_SIGNALING - x)) + ref_frame, second_ref_frame, x)) return 1; } // Speed features to prune out INTRA frames #if CONFIG_NEW_REF_SIGNALING - if (ref_frame_nrs == INTRA_FRAME_NRS) { + if (ref_frame == INTRA_FRAME_NRS) { #else if (ref_frame == INTRA_FRAME) { #endif // CONFIG_NEW_REF_SIGNALING @@ -6673,8 +6242,8 @@ assert(*args->intra_mode_num < INTRA_MODES); #if CONFIG_NEW_REF_SIGNALING args->intra_mode_idx_ls[(*args->intra_mode_num)] = this_mode; - args->intra_mode_ref_frames[(*args->intra_mode_num)][0] = ref_frames_nrs[0]; - args->intra_mode_ref_frames[(*args->intra_mode_num)][1] = ref_frames_nrs[1]; + args->intra_mode_ref_frames[(*args->intra_mode_num)][0] = ref_frames[0]; + args->intra_mode_ref_frames[(*args->intra_mode_num)][1] = ref_frames[1]; (*args->intra_mode_num)++; #else args->intra_mode_idx_ls[(*args->intra_mode_num)++] = mode_enum; @@ -6692,36 +6261,20 @@ args->prune_cpd_using_sr_stats_ready = 1; } if (args->prune_cpd_using_sr_stats_ready && -#if CONFIG_NEW_REF_SIGNALING - !in_single_ref_cutoff(ref_frame_rd, ref_frame_nrs, second_ref_frame_nrs) -#else - !in_single_ref_cutoff(ref_frame_rd, ref_frame, second_ref_frame) -#endif // CONFIG_NEW_REF_SIGNALING - ) + !in_single_ref_cutoff(ref_frame_rd, ref_frame, second_ref_frame)) return 1; } if (sf->inter_sf.prune_compound_using_neighbors && comp_pred) { if (compound_skip_using_neighbor_refs( - xd, this_mode, -#if CONFIG_NEW_REF_SIGNALING - ref_frames_nrs, -#else - ref_frames, -#endif // CONFIG_NEW_REF_SIGNALING + xd, this_mode, ref_frames, sf->inter_sf.prune_compound_using_neighbors)) return 1; } if (sf->inter_sf.prune_comp_using_best_single_mode_ref && comp_pred) { if (skip_compound_using_best_single_mode_ref( - this_mode, -#if CONFIG_NEW_REF_SIGNALING - ref_frames_nrs, -#else - ref_frames, -#endif // CONFIG_NEW_REF_SIGNALING - args->search_state->best_single_mode, + this_mode, ref_frames, args->search_state->best_single_mode, sf->inter_sf.prune_comp_using_best_single_mode_ref)) return 1; } @@ -6810,24 +6363,18 @@ if (curr_est_rd * 0.80 > top_est_rd) break; txfm_info->skip_txfm = 0; -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mbmi->ref_frame_nrs[0], mbmi->ref_frame_nrs[1]); - const int is_comp_pred = mbmi->ref_frame_nrs[1] != INVALID_IDX && - mbmi->ref_frame_nrs[1] != INTRA_FRAME_NRS; - for (int i = 0; i < num_planes; i++) { - xd->plane[i].pre[0] = yv12_mb[mbmi->ref_frame_nrs[0]][i]; - if (is_comp_pred) - xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame_nrs[1]][i]; - } -#else set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); // Select prediction reference frames. +#if CONFIG_NEW_REF_SIGNALING + const int is_comp_pred = mbmi->ref_frame[1] != INVALID_IDX && + mbmi->ref_frame[1] != INTRA_FRAME_NRS; +#else const int is_comp_pred = mbmi->ref_frame[1] > INTRA_FRAME; +#endif // CONFIG_NEW_REF_SIGNALING for (int i = 0; i < num_planes; i++) { xd->plane[i].pre[0] = yv12_mb[mbmi->ref_frame[0]][i]; if (is_comp_pred) xd->plane[i].pre[1] = yv12_mb[mbmi->ref_frame[1]][i]; } -#endif // CONFIG_NEW_REF_SIGNALING // Build the prediction for this mode av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, NULL, bsize, 0, @@ -6864,13 +6411,8 @@ } rd_stats.rdcost = RDCOST(x->rdmult, rd_stats.rate, rd_stats.dist); -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME refs[2] = { mbmi->ref_frame_nrs[0], - mbmi->ref_frame_nrs[1] }; -#else const MV_REFERENCE_FRAME refs[2] = { mbmi->ref_frame[0], mbmi->ref_frame[1] }; -#endif // CONFIG_NEW_REF_SIGNALING // Collect mode stats for multiwinner mode processing const int txfm_search_done = 1; @@ -7177,38 +6719,32 @@ for (PREDICTION_MODE this_mode = 0; this_mode < MB_MODE_COUNT; ++this_mode) { for (MV_REFERENCE_FRAME rf_nrs = INVALID_IDX; rf_nrs < cm->new_ref_frame_data.n_total_refs; ++rf_nrs) { - MV_REFERENCE_FRAME ref_frame_nrs = + MV_REFERENCE_FRAME ref_frame = (rf_nrs == INVALID_IDX) ? INTRA_FRAME_NRS : rf_nrs; - if (this_mode < INTRA_MODE_END && ref_frame_nrs != INTRA_FRAME_NRS) - continue; - if (this_mode >= INTRA_MODE_END && ref_frame_nrs == INTRA_FRAME_NRS) - continue; - for (MV_REFERENCE_FRAME second_rf_nrs = INVALID_IDX; - second_rf_nrs < cm->new_ref_frame_data.n_total_refs; - ++second_rf_nrs) { - MV_REFERENCE_FRAME second_ref_frame_nrs = second_rf_nrs; - if (second_ref_frame_nrs != INVALID_IDX && + if (this_mode < INTRA_MODE_END && ref_frame != INTRA_FRAME_NRS) continue; + if (this_mode >= INTRA_MODE_END && ref_frame == INTRA_FRAME_NRS) continue; + for (MV_REFERENCE_FRAME second_rf = INVALID_IDX; + second_rf < cm->new_ref_frame_data.n_total_refs; ++second_rf) { + MV_REFERENCE_FRAME second_ref_frame = second_rf; + if (second_ref_frame != INVALID_IDX && this_mode < COMP_INTER_MODE_START) continue; if (this_mode >= COMP_INTER_MODE_START && - this_mode < COMP_INTER_MODE_END && - second_ref_frame_nrs == INVALID_IDX) + this_mode < COMP_INTER_MODE_END && second_ref_frame == INVALID_IDX) continue; - if (second_ref_frame_nrs != INVALID_IDX && - second_ref_frame_nrs != INTRA_FRAME_NRS && - second_ref_frame_nrs <= ref_frame_nrs) + if (second_ref_frame != INVALID_IDX && + second_ref_frame != INTRA_FRAME_NRS && + second_ref_frame <= ref_frame) continue; - const MV_REFERENCE_FRAME ref_frames_nrs[2] = { ref_frame_nrs, - second_ref_frame_nrs }; + const MV_REFERENCE_FRAME ref_frames[2] = { ref_frame, + second_ref_frame }; - const int is_single_pred = ref_frame_nrs != INTRA_FRAME_NRS && - second_ref_frame_nrs == INVALID_IDX; - const int comp_pred = second_ref_frame_nrs != INVALID_IDX && - second_ref_frame_nrs != INTRA_FRAME_NRS; + const int is_single_pred = + ref_frame != INTRA_FRAME_NRS && second_ref_frame == INVALID_IDX; + const int comp_pred = second_ref_frame != INVALID_IDX && + second_ref_frame != INTRA_FRAME_NRS; - init_mbmi(mbmi, this_mode, ref_frames_nrs, cm, xd->sbi); - set_ref_ptrs_nrs(cm, xd, ref_frame_nrs, second_ref_frame_nrs); #else for (THR_MODES midx = THR_MODE_START; midx < THR_MODE_END; ++midx) { // Get the actual prediction mode we are trying in this iteration @@ -7229,9 +6765,9 @@ ref_frame > INTRA_FRAME && second_ref_frame == NONE_FRAME; const int comp_pred = second_ref_frame > INTRA_FRAME; - init_mbmi(mbmi, this_mode, ref_frames, cm, xd->sbi); - set_ref_ptrs(cm, xd, ref_frame, second_ref_frame); #endif // CONFIG_NEW_REF_SIGNALING + init_mbmi(mbmi, this_mode, ref_frames, cm, xd->sbi); + set_ref_ptrs(cm, xd, ref_frame, second_ref_frame); txfm_info->skip_txfm = 0; num_single_modes_processed += is_single_pred; @@ -7239,25 +6775,17 @@ // Apply speed features to decide if this inter mode can be skipped if (skip_inter_mode(cpi, x, bsize, ref_frame_rd, #if CONFIG_NEW_REF_SIGNALING - this_mode, ref_frames_nrs, + this_mode, ref_frames, #else midx, #endif // CONFIG_NEW_REF_SIGNALING &sf_args)) continue; -#if CONFIG_NEW_REF_SIGNALING // Select prediction reference frames. for (i = 0; i < num_planes; i++) { - xd->plane[i].pre[0] = yv12_mb[ref_frame_nrs][i]; - if (comp_pred) xd->plane[i].pre[1] = yv12_mb[second_ref_frame_nrs][i]; + xd->plane[i].pre[0] = yv12_mb[ref_frame][i]; + if (comp_pred) xd->plane[i].pre[1] = yv12_mb[second_ref_frame][i]; } -#else - // Select prediction reference frames. - for (i = 0; i < num_planes; i++) { - xd->plane[i].pre[0] = yv12_mb[ref_frame][i]; - if (comp_pred) xd->plane[i].pre[1] = yv12_mb[second_ref_frame][i]; - } -#endif // CONFIG_NEW_REF_SIGNALING mbmi->angle_delta[PLANE_TYPE_Y] = 0; mbmi->angle_delta[PLANE_TYPE_UV] = 0; @@ -7268,16 +6796,9 @@ RD_STATS rd_stats, rd_stats_y, rd_stats_uv; av1_init_rd_stats(&rd_stats); -#if CONFIG_NEW_REF_SIGNALING const int ref_frame_cost = - comp_pred - ? ref_costs_comp[mbmi->ref_frame_nrs[0]][mbmi->ref_frame_nrs[1]] - : ref_costs_single[mbmi->ref_frame_nrs[0]]; -#else - const int ref_frame_cost = comp_pred - ? ref_costs_comp[ref_frame][second_ref_frame] - : ref_costs_single[ref_frame]; -#endif // CONFIG_NEW_REF_SIGNALING + comp_pred ? ref_costs_comp[ref_frame][second_ref_frame] + : ref_costs_single[ref_frame]; const int compmode_cost = is_comp_ref_allowed(mbmi->sb_type) ? comp_inter_cost[comp_pred] : 0; const int real_compmode_cost = @@ -7312,12 +6833,7 @@ if (sf->inter_sf.prune_comp_using_best_single_mode_ref > 0 && is_inter_singleref_mode(this_mode)) { -#if CONFIG_NEW_REF_SIGNALING - update_best_single_mode(&search_state, this_mode, ref_frame_nrs, - this_rd); -#else - update_best_single_mode(&search_state, this_mode, ref_frame, this_rd); -#endif // CONFIG_NEW_REF_SIGNALING + update_best_single_mode(&search_state, this_mode, ref_frame, this_rd); } if (this_rd == INT64_MAX) continue; @@ -7327,17 +6843,10 @@ rd_stats_uv.rate = 0; } -#if CONFIG_NEW_REF_SIGNALING if (sf->inter_sf.prune_compound_using_single_ref && is_single_pred && - this_rd < ref_frame_rd[ref_frame_nrs]) { - ref_frame_rd[ref_frame_nrs] = this_rd; + this_rd < ref_frame_rd[ref_frame]) { + ref_frame_rd[ref_frame] = this_rd; } -#else - if (sf->inter_sf.prune_compound_using_single_ref && is_single_pred && - this_rd < ref_frame_rd[ref_frame]) { - ref_frame_rd[ref_frame] = this_rd; - } -#endif // CONFIG_NEW_REF_SIGNALING // Did this mode help, i.e., is it the new best mode if (this_rd < search_state.best_rd) { @@ -7345,7 +6854,7 @@ cm->current_frame.reference_mode != SINGLE_REFERENCE)); #if CONFIG_NEW_REF_SIGNALING search_state.best_pred_sse = - x->pred_sse[COMPACT_INDEX0_NRS(ref_frame_nrs)]; + x->pred_sse[COMPACT_INDEX0_NRS(ref_frame)]; #else search_state.best_pred_sse = x->pred_sse[ref_frame]; #endif // CONFIG_NEW_REF_SIGNALING @@ -7471,8 +6980,8 @@ (this_mode >= D45_PRED && this_mode <= PAETH_PRED)) { #if CONFIG_NEW_REF_SIGNALING if (search_state.best_mbmode.mode != MODE_INVALID && - search_state.best_mbmode.ref_frame_nrs[0] != INTRA_FRAME_NRS && - search_state.best_mbmode.ref_frame_nrs[0] != INVALID_IDX) + search_state.best_mbmode.ref_frame[0] != INTRA_FRAME_NRS && + search_state.best_mbmode.ref_frame[0] != INVALID_IDX) continue; #else if (search_state.best_mbmode.mode != MODE_INVALID && @@ -7511,11 +7020,12 @@ #if CONFIG_DERIVED_INTRA_MODE if (av1_enable_derived_intra_mode(xd, bsize)) { +#if CONFIG_NEW_REF_SIGNALING + mbmi->ref_frame[0] = INTRA_FRAME_NRS; + mbmi->ref_frame[1] = INVALID_IDX; +#else mbmi->ref_frame[0] = INTRA_FRAME; mbmi->ref_frame[1] = NONE_FRAME; -#if CONFIG_NEW_REF_SIGNALING - mbmi->ref_frame_nrs[0] = INTRA_FRAME_NRS; - mbmi->ref_frame_nrs[1] = INVALID_IDX; #endif // CONFIG_NEW_REF_SIGNALING mbmi->filter_intra_mode_info.use_filter_intra = 0; mbmi->palette_mode_info.palette_size[0] = 0; @@ -7731,12 +7241,7 @@ (void)mi_col; (void)tile_data; -#if CONFIG_NEW_REF_SIGNALING - av1_collect_neighbors_ref_counts_nrs(cm, xd); -#else av1_collect_neighbors_ref_counts(xd); -#endif // CONFIG_NEW_REF_SIGNALING - estimate_ref_frame_costs(cm, xd, mode_costs, segment_id, ref_costs_single, ref_costs_comp); @@ -7760,23 +7265,19 @@ mbmi->uv_mode = UV_DC_PRED; #if CONFIG_NEW_REF_SIGNALING const MV_REFERENCE_FRAME last_frame = get_closest_pastcur_ref_index(cm); - mbmi->ref_frame_nrs[0] = last_frame; - mbmi->ref_frame_nrs[1] = INVALID_IDX; - mbmi->mv[0].as_int = - gm_get_motion_vector(&cm->global_motion[mbmi->ref_frame_nrs[0]], - features->fr_mv_precision, bsize, mi_col, mi_row) - .as_int; + mbmi->ref_frame[0] = last_frame; + mbmi->ref_frame[1] = INVALID_IDX; #else mbmi->ref_frame[1] = NONE_FRAME; if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) mbmi->ref_frame[0] = get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME); else mbmi->ref_frame[0] = LAST_FRAME; +#endif // CONFIG_NEW_REF_SIGNALING mbmi->mv[0].as_int = gm_get_motion_vector(&cm->global_motion[mbmi->ref_frame[0]], features->fr_mv_precision, bsize, mi_col, mi_row) .as_int; -#endif // CONFIG_NEW_REF_SIGNALING mbmi->tx_size = max_txsize_lookup[bsize]; x->txfm_search_info.skip_txfm = 1;
diff --git a/av1/encoder/reconinter_enc.c b/av1/encoder/reconinter_enc.c index 272af5b..2fb1d9b 100644 --- a/av1/encoder/reconinter_enc.c +++ b/av1/encoder/reconinter_enc.c
@@ -205,17 +205,10 @@ pd->subsampling_y, NULL); } -#if CONFIG_NEW_REF_SIGNALING - const MV_REFERENCE_FRAME frame = ref_mbmi->ref_frame_nrs[0]; - const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame); - const struct scale_factors *const sf = - get_ref_scale_factors_const(ctxt->cm, frame); -#else const MV_REFERENCE_FRAME frame = ref_mbmi->ref_frame[0]; const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame); const struct scale_factors *const sf = get_ref_scale_factors_const(ctxt->cm, frame); -#endif // CONFIG_NEW_REF_SIGNALING xd->block_ref_scale_factors[0] = sf; if ((!av1_is_valid_scale(sf))) @@ -344,12 +337,7 @@ const int mi_x = mi_col * MI_SIZE; const int mi_y = mi_row * MI_SIZE; WarpTypesAllowed warp_types; -#if CONFIG_NEW_REF_SIGNALING - const WarpedMotionParams *const wm = - &xd->global_motion[mi->ref_frame_nrs[ref]]; -#else const WarpedMotionParams *const wm = &xd->global_motion[mi->ref_frame[ref]]; -#endif // CONFIG_NEW_REF_SIGNALING warp_types.global_warp_allowed = is_global_mv_block(mi, wm->wmtype); warp_types.local_warp_allowed = mi->motion_mode == WARPED_CAUSAL; assert(mi->sb_type < BLOCK_SIZES_ALL);
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c index a2dc91e..dbc11a2 100644 --- a/av1/encoder/tpl_model.c +++ b/av1/encoder/tpl_model.c
@@ -281,8 +281,7 @@ // Intra prediction search #if CONFIG_NEW_REF_SIGNALING - // TODO(sarahparker) Delete this once the new TPL model is applied - xd->mi[0]->ref_frame_nrs[0] = INTRA_FRAME_NRS; + xd->mi[0]->ref_frame[0] = INTRA_FRAME_NRS; #else xd->mi[0]->ref_frame[0] = INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -327,8 +326,7 @@ // Motion compensated prediction #if CONFIG_NEW_REF_SIGNALING - // TODO(sarahparker) Delete this once the new TPL model is applied - xd->mi[0]->ref_frame_nrs[0] = INTRA_FRAME_NRS; + xd->mi[0]->ref_frame[0] = INTRA_FRAME_NRS; #else xd->mi[0]->ref_frame[0] = INTRA_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -464,7 +462,7 @@ if (best_inter_cost < best_intra_cost) { best_mode = NEWMV; #if CONFIG_NEW_REF_SIGNALING - xd->mi[0]->ref_frame_nrs[0] = best_rf_idx; + xd->mi[0]->ref_frame[0] = best_rf_idx; #else xd->mi[0]->ref_frame[0] = best_rf_idx + LAST_FRAME; #endif // CONFIG_NEW_REF_SIGNALING @@ -1075,11 +1073,7 @@ const int true_disp = (int)(tpl_frame->frame_display_index) - (gf_group->subgop_cfg != NULL && frame_params.show_frame); -#if CONFIG_NEW_REF_SIGNALING - av1_get_ref_frames_nrs(cm, true_disp, ref_frame_map_pairs); -#else av1_get_ref_frames(cm, true_disp, ref_frame_map_pairs); -#endif // CONFIG_NEW_REF_SIGNALING int refresh_mask = av1_get_refresh_frame_flags(cpi, &frame_params, frame_update_type, gf_index, true_disp, ref_frame_map_pairs); @@ -1125,7 +1119,7 @@ init_ref_map_pair( cm, ref_frame_map_pairs, cpi->gf_group.update_type[cpi->gf_group.index] == KEY_FRAME); - av1_get_ref_frames_nrs(cm, true_disp, ref_frame_map_pairs); + av1_get_ref_frames(cm, true_disp, ref_frame_map_pairs); #endif // CONFIG_NEW_REF_SIGNALING return; } @@ -1176,11 +1170,7 @@ const int true_disp = (int)(tpl_frame->frame_display_index) - (gf_group->subgop_cfg != NULL && frame_params.show_frame); -#if CONFIG_NEW_REF_SIGNALING - av1_get_ref_frames_nrs(cm, true_disp, ref_frame_map_pairs); -#else av1_get_ref_frames(cm, true_disp, ref_frame_map_pairs); -#endif // CONFIG_NEW_REF_SIGNALING // TODO(sarahparker) av1_get_refresh_frame_flags() // will execute default behavior even when // subgop cfg is enabled. This should be addressed if we ever remove the @@ -1234,11 +1224,7 @@ init_ref_map_pair( cm, ref_frame_map_pairs, cpi->gf_group.update_type[cpi->gf_group.index] == KEY_FRAME); -#if CONFIG_NEW_REF_SIGNALING - av1_get_ref_frames_nrs(cm, true_disp, ref_frame_map_pairs); -#else av1_get_ref_frames(cm, true_disp, ref_frame_map_pairs); -#endif // CONFIG_NEW_REF_SIGNALING } void av1_init_tpl_stats(TplParams *const tpl_data) {
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c index e9109dc..211a595 100644 --- a/av1/encoder/var_based_part.c +++ b/av1/encoder/var_based_part.c
@@ -772,8 +772,8 @@ #endif // CONFIG_NEW_REF_SIGNALING #if CONFIG_NEW_REF_SIGNALING - mi->ref_frame_nrs[0] = last_frame; - mi->ref_frame_nrs[1] = INVALID_IDX; + mi->ref_frame[0] = last_frame; + mi->ref_frame[1] = INVALID_IDX; #else mi->ref_frame[0] = LAST_FRAME; mi->ref_frame[1] = NONE_FRAME; @@ -803,7 +803,7 @@ av1_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col, get_ref_scale_factors(cm, golden_frame), num_planes, NULL); - mi->ref_frame_nrs[0] = golden_frame; + mi->ref_frame[0] = golden_frame; mi->mv[0].as_int = 0; *y_sad = *y_sad_g; *ref_frame_partition = golden_frame; @@ -832,11 +832,7 @@ } #endif // CONFIG_NEW_REF_SIGNALING -#if CONFIG_NEW_REF_SIGNALING - set_ref_ptrs_nrs(cm, xd, mi->ref_frame_nrs[0], mi->ref_frame_nrs[1]); -#else set_ref_ptrs(cm, xd, mi->ref_frame[0], mi->ref_frame[1]); -#endif // CONFIG_NEW_REF_SIGNALING av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, NULL, cm->seq_params.sb_size, AOM_PLANE_Y, AOM_PLANE_Y);