Commit 7821447a authored by Arild Fuldseth (arilfuld)'s avatar Arild Fuldseth (arilfuld)
Browse files

Improve low-latency (uni-directional) compound mode (non-normative)

Change-Id: I610c9d83b6e78aced1f14fb576b00de54acb0ffc
parent 38897306
......@@ -333,6 +333,14 @@ static void setup_frame(AV1_COMP *cpi) {
*cm->fc = cm->frame_contexts[cm->frame_context_idx];
av1_zero(cpi->interp_filter_selected[0]);
}
#if CONFIG_EXT_REFS
#if CONFIG_LOWDELAY_COMPOUND // No change to bitstream
if (cpi->sf.recode_loop == DISALLOW_RECODE) {
cpi->refresh_bwd_ref_frame = cpi->refresh_last_frame;
cpi->rc.is_bipred_frame = 1;
}
#endif
#endif
cpi->vaq_refresh = 0;
......@@ -4429,6 +4437,13 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
const int last3_is_last =
map[cpi->lst_fb_idxes[2]] == map[cpi->lst_fb_idxes[0]];
const int gld_is_last = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idxes[0]];
#if CONFIG_LOWDELAY_COMPOUND
const int alt_is_last = map[cpi->alt_fb_idx] == map[cpi->lst_fb_idxes[0]];
const int last3_is_last2 =
map[cpi->lst_fb_idxes[2]] == map[cpi->lst_fb_idxes[1]];
const int gld_is_last2 = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idxes[1]];
const int gld_is_last3 = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idxes[2]];
#else
const int bwd_is_last = map[cpi->bwd_fb_idx] == map[cpi->lst_fb_idxes[0]];
const int alt_is_last = map[cpi->alt_fb_idx] == map[cpi->lst_fb_idxes[0]];
......@@ -4442,6 +4457,7 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
const int bwd_is_gld = map[cpi->bwd_fb_idx] == map[cpi->gld_fb_idx];
#endif
const int last2_is_alt = map[cpi->lst_fb_idxes[1]] == map[cpi->alt_fb_idx];
const int last3_is_alt = map[cpi->lst_fb_idxes[2]] == map[cpi->alt_fb_idx];
const int gld_is_alt = map[cpi->gld_fb_idx] == map[cpi->alt_fb_idx];
......@@ -4474,10 +4490,15 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
if (gld_is_last2 || gld_is_last3) flags &= ~AOM_GOLD_FLAG;
#if CONFIG_LOWDELAY_COMPOUND // Changes LL & HL bitstream
/* Allow biprediction between two identical frames (e.g. bwd_is_last = 1) */
if (bwd_is_alt && (flags & AOM_BWD_FLAG)) flags &= ~AOM_BWD_FLAG;
#else
if ((bwd_is_last || bwd_is_last2 || bwd_is_last3 || bwd_is_gld ||
bwd_is_alt) &&
(flags & AOM_BWD_FLAG))
flags &= ~AOM_BWD_FLAG;
#endif
#endif // CONFIG_EXT_REFS
return flags;
......
......@@ -10080,6 +10080,17 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
// This is only used in motion vector unit test.
if (cpi->oxcf.motion_vector_unit_test && ref_frame == INTRA_FRAME) continue;
#if CONFIG_LOWDELAY_COMPOUND // Changes LL bitstream
#if CONFIG_EXT_REFS
if (cpi->oxcf.pass == 0) {
// Complexity-compression trade-offs
// if (ref_frame == ALTREF_FRAME) continue;
// if (ref_frame == BWDREF_FRAME) continue;
if (second_ref_frame == ALTREF_FRAME) continue;
// if (second_ref_frame == BWDREF_FRAME) continue;
}
#endif
#endif
comp_pred = second_ref_frame > INTRA_FRAME;
if (comp_pred) {
if (!cpi->allow_comp_inter_inter) continue;
......@@ -11809,6 +11820,17 @@ void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
// This is only used in motion vector unit test.
if (cpi->oxcf.motion_vector_unit_test && ref_frame == INTRA_FRAME) continue;
#if CONFIG_LOWDELAY_COMPOUND // Changes LL bitstream
#if CONFIG_EXT_REFS
if (cpi->oxcf.pass == 0) {
// Complexity-compression trade-offs
// if (ref_frame == ALTREF_FRAME) continue;
// if (ref_frame == BWDREF_FRAME) continue;
if (second_ref_frame == ALTREF_FRAME) continue;
// if (second_ref_frame == BWDREF_FRAME) continue;
}
#endif
#endif
comp_pred = second_ref_frame > INTRA_FRAME;
if (comp_pred) {
if (!cpi->allow_comp_inter_inter) continue;
......
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