Revert "Update cdf and mode rate per superblock in RDO"
This reverts commit b855b8e80827997fc54c3aaa4de1d3dd6cf0ab15.
Reason for revert:
breaks the rate assumptions in:
AV1/DatarateTestLarge.BasicRateTargetingVBR
AV1/DatarateTestLarge.ChangingDropFrameThresh/2
Change-Id: I92c4709b6c1bd98a78fe5aa6f0167a534fed5997
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 6dfeb68..8a2a63c 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -61,29 +61,6 @@
4, 4, 8, 8, 16, 16
};
-void av1_fill_nmv_costs(AV1_COMMON *const cm, MACROBLOCK *x,
- FRAME_CONTEXT *fc) {
- for (int i = 0; i < NMV_CONTEXTS; ++i) {
- memset(x->nmvcost_array, 0, sizeof(x->nmvcost_array));
- memset(x->nmvcost_hp_array, 0, sizeof(x->nmvcost_hp_array));
- x->nmvcost[i][0] = &x->nmvcost_array[i][0][MV_MAX];
- x->nmvcost[i][1] = &x->nmvcost_array[i][1][MV_MAX];
- x->nmvcost_hp[i][0] = &x->nmvcost_hp_array[i][0][MV_MAX];
- x->nmvcost_hp[i][1] = &x->nmvcost_hp_array[i][1][MV_MAX];
- if (cm->allow_high_precision_mv)
- x->mv_cost_stack[i] = x->nmvcost_hp[i];
- else
- x->mv_cost_stack[i] = x->nmvcost[i];
-
- av1_build_nmv_cost_table(
- x->nmv_vec_cost[i],
- cm->allow_high_precision_mv ? x->nmvcost_hp[i] : x->nmvcost[i],
- &fc->nmvc[i], cm->allow_high_precision_mv);
- }
- x->mvcost = x->mv_cost_stack[0];
- x->nmvjointcost = x->nmv_vec_cost[0];
-}
-
void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x,
FRAME_CONTEXT *fc) {
int i, j;
@@ -223,15 +200,8 @@
av1_cost_tokens(x->switchable_restore_cost, fc->switchable_restore_prob,
av1_switchable_restore_tree);
#endif // CONFIG_LOOP_RESTORATION
-#if CONFIG_INTRABC
- av1_fill_nmv_costs(cm, x, fc);
-#endif
if (!frame_is_intra_only(cm)) {
-#if !CONFIG_INTRABC
- av1_fill_nmv_costs(cm, x, fc);
-#endif
-
for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i) {
#if CONFIG_NEW_MULTISYMBOL
av1_cost_tokens_from_cdf(x->newmv_mode_cost[i], fc->newmv_cdf[i], NULL);
@@ -271,9 +241,6 @@
for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
av1_cost_tokens_from_cdf(x->inter_compound_mode_cost[i],
fc->inter_compound_mode_cdf[i], NULL);
- for (i = 0; i < BLOCK_SIZES_ALL; ++i)
- av1_cost_tokens_from_cdf(x->compound_type_cost[i],
- fc->compound_type_cdf[i], NULL);
#if CONFIG_COMPOUND_SINGLEREF
for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
av1_cost_tokens_from_cdf(x->inter_singleref_comp_mode_cost[i],
@@ -569,6 +536,7 @@
AV1_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->td.mb;
RD_OPT *const rd = &cpi->rd;
+ int nmv_ctx;
aom_clear_system_state();
@@ -578,7 +546,15 @@
set_block_thresholds(cm, rd);
- av1_fill_nmv_costs(cm, x, cm->fc);
+ for (nmv_ctx = 0; nmv_ctx < NMV_CONTEXTS; ++nmv_ctx) {
+ av1_build_nmv_cost_table(
+ x->nmv_vec_cost[nmv_ctx],
+ cm->allow_high_precision_mv ? x->nmvcost_hp[nmv_ctx]
+ : x->nmvcost[nmv_ctx],
+ &cm->fc->nmvc[nmv_ctx], cm->allow_high_precision_mv);
+ }
+ x->mvcost = x->mv_cost_stack[0];
+ x->nmvjointcost = x->nmv_vec_cost[0];
#if CONFIG_INTRABC
if (frame_is_intra_only(cm) && cm->allow_screen_content_tools &&