Commit 438b3ae7 authored by Zoe Liu's avatar Zoe Liu

Enable flex-refs by default when altref2 is on

Compared against baseline with default enabled tools (except for
ext-tx and global-motion for speed concern):

                 altref2 -> altref2 + flex-refs
lowres: avg_psnr -0.395% -> -0.460%
midres: avg_psnr -0.418% -> -0.478%

In particular, flex-refs improves the coding performance for the
following 3 clips while no impact on all other clips:

bowing_cif.y4m:    avg_psnr  0.023% -> -1.022%
pamphlet_cif.y4m:  avg_psnr  0.454% -> -1.111%
snow_mnt_480p.y4m: avg_psnr -0.162% -> -1.948%

Change-Id: I612c1ae5feb1f07d8bd5aaf67e21a076445e10b9
parent 7b581827
......@@ -1491,9 +1491,9 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
if ((rd_cost->rate != INT_MAX) && (aq_mode == COMPLEXITY_AQ) &&
(bsize >= BLOCK_16X16) &&
(cm->frame_type == KEY_FRAME || cpi->refresh_alt_ref_frame ||
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref))) {
av1_caq_select_segment(cpi, x, bsize, mi_row, mi_col, rd_cost->rate);
}
......@@ -4717,9 +4717,9 @@ static MV_REFERENCE_FRAME get_frame_type(const AV1_COMP *cpi) {
#endif
return ALTREF_FRAME;
else if (cpi->refresh_golden_frame ||
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame)
return GOLDEN_FRAME;
else
......
......@@ -5450,10 +5450,10 @@ static void check_src_altref(AV1_COMP *cpi,
(gf_group->update_type[gf_group->index] == INTNL_OVERLAY_UPDATE) ||
#endif // CONFIG_EXT_REFS
(gf_group->update_type[gf_group->index] == OVERLAY_UPDATE);
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
rc->is_src_frame_ext_arf =
gf_group->update_type[gf_group->index] == INTNL_OVERLAY_UPDATE;
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
} else {
rc->is_src_frame_alt_ref =
cpi->alt_ref_source && (source == cpi->alt_ref_source);
......@@ -5463,20 +5463,20 @@ static void check_src_altref(AV1_COMP *cpi,
// Current frame is an ARF overlay frame.
cpi->alt_ref_source = NULL;
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
if (rc->is_src_frame_ext_arf && !cpi->common.show_existing_frame) {
// For INTNL_OVERLAY, when show_existing_frame == 0, they do need to
// refresh the LAST_FRAME, i.e. LAST3 gets retired, LAST2 becomes LAST3,
// LAST becomes LAST2, and INTNL_OVERLAY becomes LAST.
cpi->refresh_last_frame = 1;
} else {
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
// Don't refresh the last buffer for an ARF overlay frame. It will
// become the GF so preserve last as an alternative prediction option.
cpi->refresh_last_frame = 0;
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
}
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
}
}
......
......@@ -2922,9 +2922,9 @@ void av1_rc_get_second_pass_params(AV1_COMP *cpi) {
// If this is an arf frame then we dont want to read the stats file or
// advance the input pointer as we already have what we need.
if (gf_group->update_type[gf_group->index] == ARF_UPDATE
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
|| gf_group->update_type[gf_group->index] == INTNL_ARF_UPDATE
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
) {
configure_buffer_updates(cpi);
target_rate = gf_group->bit_allocation[gf_group->index];
......
......@@ -580,9 +580,9 @@ static int calc_active_worst_quality_one_pass_vbr(const AV1_COMP *cpi) {
curr_frame == 0 ? rc->worst_quality : rc->last_q[KEY_FRAME] * 2;
} else {
if (!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame ||
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame)) {
active_worst_quality = curr_frame == 1 ? rc->last_q[KEY_FRAME] * 5 / 4
: rc->last_q[INTER_FRAME];
......@@ -1009,9 +1009,9 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int *bottom_index,
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, cm->bit_depth);
}
} else if (!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame ||
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame)) {
// Use the lower of active_worst_quality and recent
// average Q as basis for GF/ARF best Q limit unless last frame was
......@@ -1032,11 +1032,11 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int *bottom_index,
active_best_quality = active_best_quality * 15 / 16;
} else if (oxcf->rc_mode == AOM_Q) {
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
if (!cpi->refresh_alt_ref_frame && !cpi->refresh_alt2_ref_frame) {
#else
if (!cpi->refresh_alt_ref_frame) {
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
active_best_quality = cq_level;
} else {
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
......@@ -1069,9 +1069,9 @@ static int rc_pick_q_and_bounds_two_pass(const AV1_COMP *cpi, int *bottom_index,
(cpi->twopass.gf_zeromotion_pct < VLOW_MOTION_THRESHOLD)) {
if (frame_is_intra_only(cm) ||
(!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame ||
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame))) {
active_best_quality -=
(cpi->twopass.extend_minq + cpi->twopass.extend_minq_fast);
......@@ -1232,11 +1232,11 @@ static void update_golden_frame_stats(AV1_COMP *cpi) {
// Decrement count down till next gf
if (rc->frames_till_gf_update_due > 0) rc->frames_till_gf_update_due--;
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
} else if (!cpi->refresh_alt_ref_frame && !cpi->refresh_alt2_ref_frame) {
#else
} else if (!cpi->refresh_alt_ref_frame) {
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
// Decrement count down till next gf
if (rc->frames_till_gf_update_due > 0) rc->frames_till_gf_update_due--;
......@@ -1267,9 +1267,9 @@ void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
} else {
if (!rc->is_src_frame_alt_ref &&
!(cpi->refresh_golden_frame ||
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame)) {
rc->last_q[INTER_FRAME] = qindex;
rc->avg_frame_qindex[INTER_FRAME] =
......@@ -1292,9 +1292,9 @@ void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
if ((qindex < rc->last_boosted_qindex) || (cm->frame_type == KEY_FRAME) ||
(!rc->constrained_gf_group &&
(cpi->refresh_alt_ref_frame ||
#if CONFIG_EXT_REFS && CONFIG_ALTREF2
#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
#endif // CONFIG_ALTREF2
(cpi->refresh_golden_frame && !rc->is_src_frame_alt_ref)))) {
rc->last_boosted_qindex = qindex;
}
......
......@@ -559,6 +559,7 @@ post_process_cmdline() {
enabled ext_comp_refs && enable_feature var_refs
enabled ext_comp_refs && disable_feature one_sided_compound
enabled altref2 && enable_feature ext_refs
enabled altref2 && enable_feature flex_refs
enabled rect_tx_ext && enable_feature rect_tx
enabled cfl && enable_feature smooth_hv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment