Fix an offset in prune_compound_using_single_ref
Currently prune_compound_using_single_ref starts pruning when the mode
index is MAX_SINGLE_REF_MODES + 1. But MAX_SINGLE_REF_MODES is already
the first none single_ref, so we can start pruning when mode index is
MAX_SINGLE_REF_MODES.
There is a small bitrate reduction (~0.01~0.02%) and the speed remains
more or less neutral.
STATS_CHANGED
Change-Id: If94368e21d62c275efcee3f2a7e923e1810a55e4
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 91d3dbd..be2ad89 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -12636,8 +12636,7 @@
// After we done with single reference modes, find the 2nd best RD
// for a reference frame. Only search compound modes that have a reference
// frame at least as good as the 2nd best.
- if (sf->prune_compound_using_single_ref &&
- midx == MAX_SINGLE_REF_MODES + 1) {
+ if (sf->prune_compound_using_single_ref && midx == MAX_SINGLE_REF_MODES) {
find_top_ref(ref_frame_rd);
}
@@ -12655,7 +12654,7 @@
const MV_REFERENCE_FRAME second_ref_frame = mode_order->ref_frame[1];
const int comp_pred = second_ref_frame > INTRA_FRAME;
- if (sf->prune_compound_using_single_ref && midx > MAX_SINGLE_REF_MODES &&
+ if (sf->prune_compound_using_single_ref && midx >= MAX_SINGLE_REF_MODES &&
comp_pred &&
!in_single_ref_cutoff(ref_frame_rd, ref_frame, second_ref_frame)) {
continue;
@@ -12767,7 +12766,7 @@
rate_uv = 0;
}
- if (sf->prune_compound_using_single_ref && midx <= MAX_SINGLE_REF_MODES &&
+ if (sf->prune_compound_using_single_ref && midx < MAX_SINGLE_REF_MODES &&
this_rd < ref_frame_rd[ref_frame]) {
ref_frame_rd[ref_frame] = this_rd;
}