Account mode overhead early in handle_intra_mode()
Consider the ref_frame cost at the beginning so that encoder can skip RD
search earlier in some cases.
Coding quality is neural. Encoding complexity drops slightly.
STATS_CHANGED
Change-Id: Ie63233527dadc38d8f784c0372a767c786a4f5f8
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 6120387..5005047 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -12554,7 +12554,8 @@
MB_MODE_INFO *const mbmi = xd->mi[0];
assert(mbmi->ref_frame[0] == INTRA_FRAME);
const PREDICTION_MODE mode = mbmi->mode;
- const int mode_cost = x->mbmode_cost[size_group_lookup[bsize]][mode];
+ const int mode_cost =
+ x->mbmode_cost[size_group_lookup[bsize]][mode] + ref_frame_cost;
const int intra_cost_penalty = av1_get_intra_cost_penalty(
cm->base_qindex, cm->y_dc_delta_q, cm->seq_params.bit_depth);
const int skip_ctx = av1_get_skip_context(xd);
@@ -12728,10 +12729,6 @@
rd_stats->rate += intra_cost_penalty;
}
- // Estimate the reference frame signaling cost and add it
- // to the rolling cost variable.
- rd_stats->rate += ref_frame_cost;
-
// Intra block is always coded as non-skip
rd_stats->skip = 0;
rd_stats->dist = rd_stats_y->dist + rd_stats_uv->dist;