Commit b05e5d10 authored by Zoe Liu's avatar Zoe Liu

Add a new experiment of REF_ADAPT

Noticed that some ALTREF_FRAMEs could have used compound modes for its
prediction but have been labeled as SINGLE_REFERENCE mode in the frame
header. This experiment is to remove the COMPOUND_REFERENCE mode from
the frame-level reference mode choices and only leave SINGLE_REFERENCE
and REFERENCE_MODE_SELECT the two choices in the frame header.

When turning on both ext-refs and ref-adapt, compared against ext-refs
itself, a small gain is achieved. In PSNR, the bitrate saving gains are
as follows:

lowres: Avg -0.120%; BDRate -0.128%
midres: Avg -0.155%; BDRate -0.128%

Change-Id: I2cfff8a6b7eaa65ef863dbdbc4dd086d3b586f8c
parent f844e6ef
......@@ -236,9 +236,13 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
static REFERENCE_MODE read_frame_reference_mode(
const AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
if (is_compound_reference_allowed(cm)) {
#if CONFIG_REF_ADAPT
return aom_rb_read_bit(rb) ? REFERENCE_MODE_SELECT : SINGLE_REFERENCE;
#else
return aom_rb_read_bit(rb)
? REFERENCE_MODE_SELECT
: (aom_rb_read_bit(rb) ? COMPOUND_REFERENCE : SINGLE_REFERENCE);
#endif // CONFIG_REF_ADAPT
} else {
return SINGLE_REFERENCE;
}
......
......@@ -4462,10 +4462,14 @@ static void write_uncompressed_header(AV1_COMP *cpi,
if (cpi->allow_comp_inter_inter) {
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
#if !CONFIG_REF_ADAPT
const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
#endif // !CONFIG_REF_ADAPT
aom_wb_write_bit(wb, use_hybrid_pred);
#if !CONFIG_REF_ADAPT
if (!use_hybrid_pred) aom_wb_write_bit(wb, use_compound_pred);
#endif // !CONFIG_REF_ADAPT
}
write_tile_info(cm, wb);
......
......@@ -4696,6 +4696,7 @@ static void init_encode_frame_mb_context(AV1_COMP *cpi) {
av1_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
}
#if !CONFIG_REF_ADAPT
static int check_dual_ref_flags(AV1_COMP *cpi) {
const int ref_flags = cpi->ref_frame_flags;
......@@ -4710,6 +4711,7 @@ static int check_dual_ref_flags(AV1_COMP *cpi) {
!!(ref_flags & AOM_ALT_FLAG)) >= 2;
}
}
#endif // !CONFIG_REF_ADAPT
#if !CONFIG_VAR_TX
static void reset_skip_tx_size(AV1_COMMON *cm, TX_SIZE max_tx_size) {
......@@ -5190,7 +5192,14 @@ void av1_encode_frame(AV1_COMP *cpi) {
int64_t *const mode_thrs = rd_opt->prediction_type_threshes[frame_type];
const int is_alt_ref = frame_type == ALTREF_FRAME;
/* prediction (compound, single or hybrid) mode selection */
/* prediction (compound, single or hybrid) mode selection */
#if CONFIG_REF_ADAPT
// NOTE(zoeliu): "is_alt_ref" is true only for OVERLAY/INTNL_OVERLAY frames
if (is_alt_ref || !cpi->allow_comp_inter_inter)
cm->reference_mode = SINGLE_REFERENCE;
else
cm->reference_mode = REFERENCE_MODE_SELECT;
#else
if (is_alt_ref || !cpi->allow_comp_inter_inter)
cm->reference_mode = SINGLE_REFERENCE;
else if (mode_thrs[COMPOUND_REFERENCE] > mode_thrs[SINGLE_REFERENCE] &&
......@@ -5201,6 +5210,7 @@ void av1_encode_frame(AV1_COMP *cpi) {
cm->reference_mode = SINGLE_REFERENCE;
else
cm->reference_mode = REFERENCE_MODE_SELECT;
#endif // CONFIG_REF_ADAPT
#if CONFIG_DUAL_FILTER
cm->interp_filter = SWITCHABLE;
......@@ -5223,9 +5233,11 @@ void av1_encode_frame(AV1_COMP *cpi) {
if (comp_count_zero == 0) {
cm->reference_mode = SINGLE_REFERENCE;
av1_zero(counts->comp_inter);
#if !CONFIG_REF_ADAPT
} else if (single_count_zero == 0) {
cm->reference_mode = COMPOUND_REFERENCE;
av1_zero(counts->comp_inter);
#endif // !CONFIG_REF_ADAPT
}
}
......
......@@ -304,6 +304,7 @@ EXPERIMENT_LIST="
dependent_horztiles
daala_dist
tripred
ref_adapt
"
CONFIG_LIST="
dependency_tracking
......
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