From f3f0037123bc4eb85e99fef0314118c0dfe3d672 Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Thu, 27 Jan 2022 13:41:19 +0200 Subject: [PATCH] include root_cbf cost --- src/search_inter.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/search_inter.c b/src/search_inter.c index f56998b7..9bda59b4 100644 --- a/src/search_inter.c +++ b/src/search_inter.c @@ -2016,9 +2016,14 @@ void kvz_cu_cost_inter_rd2(encoder_state_t * const state, false); double bits = 0; - *inter_cost = kvz_cu_rd_cost_luma(state, SUB_SCU(x), SUB_SCU(y), depth, cur_cu, lcu, &bits); - if (reconstruct_chroma) { - *inter_cost += kvz_cu_rd_cost_chroma(state, SUB_SCU(x), SUB_SCU(y), depth, cur_cu, lcu, &bits); + int cbf = cbf_is_set_any(cur_cu->cbf, depth); + *inter_bitcost += CTX_ENTROPY_FBITS(&state->cabac.ctx.cu_qt_root_cbf_model, !!cbf); + + if(cbf) { + *inter_cost = kvz_cu_rd_cost_luma(state, SUB_SCU(x), SUB_SCU(y), depth, cur_cu, lcu, &bits); + if (reconstruct_chroma) { + *inter_cost += kvz_cu_rd_cost_chroma(state, SUB_SCU(x), SUB_SCU(y), depth, cur_cu, lcu, &bits); + } } FILE_BITS(bits, x, y, depth, "inter rd 2 bits");