Disable compound mode in sub8x8 coding blocks Disable the support of compound prediction modes for sub8x8 codking blocks. Make the rate-distortion optimizations process account for such constraints. With the use 2x2 chroma prediction block, this makes the wrost case number of inter predictors same as vp9. It affects the coding gains by 0.35% for lowres, 0.17% for midres, and 0.08% for hdres. The encoding speed is up by 10%. Change-Id: Ieb2a83030676911baa403e586f1f800cbf485d81
diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 3f72609..ffd0b93 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h
@@ -36,6 +36,8 @@ extern "C" { #endif +#define SUB8X8_COMP_REF 1 + #define MAX_MB_PLANE 3 #if CONFIG_EXT_INTER
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 06534e2..dff0d5c 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -1011,6 +1011,11 @@ aom_reader *r) { if (cm->reference_mode == REFERENCE_MODE_SELECT) { const int ctx = av1_get_reference_mode_context(cm, xd); + +#if !SUB8X8_COMP_REF + if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) return SINGLE_REFERENCE; +#endif + const REFERENCE_MODE mode = (REFERENCE_MODE)aom_read(r, cm->fc->comp_inter_prob[ctx], ACCT_STR); FRAME_COUNTS *counts = xd->counts; @@ -1042,8 +1047,8 @@ const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref]; #endif // CONFIG_EXT_REFS const int ctx = av1_get_pred_context_comp_ref_p(cm, xd); - const int bit = aom_read(r, fc->comp_ref_prob[ctx][0], ACCT_STR); + const int bit = aom_read(r, fc->comp_ref_prob[ctx][0], ACCT_STR); if (counts) ++counts->comp_ref[ctx][0][bit]; #if CONFIG_EXT_REFS
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index d218eb0..9b8eeac 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -1040,7 +1040,12 @@ // does the feature use compound prediction or not // (if not specified at the frame/segment level) if (cm->reference_mode == REFERENCE_MODE_SELECT) { +#if SUB8X8_COMP_REF aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd)); +#else + if (mbmi->sb_type >= BLOCK_8X8) + aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd)); +#endif } else { assert((!is_compound) == (cm->reference_mode == SINGLE_REFERENCE)); }
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 5207743..915218d 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -2049,9 +2049,16 @@ const MV_REFERENCE_FRAME ref1 = mbmi->ref_frame[1]; #endif // CONFIG_EXT_REFS - if (cm->reference_mode == REFERENCE_MODE_SELECT) + if (cm->reference_mode == REFERENCE_MODE_SELECT) { +#if !SUB8X8_COMP_REF + if (mbmi->sb_type >= BLOCK_8X8) + counts->comp_inter[av1_get_reference_mode_context(cm, xd)] + [has_second_ref(mbmi)]++; +#else counts->comp_inter[av1_get_reference_mode_context(cm, xd)] [has_second_ref(mbmi)]++; +#endif + } if (has_second_ref(mbmi)) { #if CONFIG_EXT_REFS
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index 835f56b..210d72f 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -10139,6 +10139,10 @@ #if CONFIG_REF_MV int_mv backup_ref_mv[2]; +#if !SUB8X8_COMP_REF + if (bsize < BLOCK_8X8 && mbmi->ref_frame[1] > INTRA_FRAME) continue; +#endif + backup_ref_mv[0] = mbmi_ext->ref_mvs[ref_frame][0]; if (comp_pred) backup_ref_mv[1] = mbmi_ext->ref_mvs[second_ref_frame][0]; #endif @@ -10410,7 +10414,12 @@ if (this_rd == INT64_MAX) continue; +#if SUB8X8_COMP_REF compmode_cost = av1_cost_bit(comp_mode_p, comp_pred); +#else + if (mbmi->sb_type >= BLOCK_8X8) + compmode_cost = av1_cost_bit(comp_mode_p, comp_pred); +#endif if (cm->reference_mode == REFERENCE_MODE_SELECT) rate2 += compmode_cost; }