[debug] Temporarily move split flag counting

This commit is contained in:
Joose Sainio 2022-05-13 12:05:54 +03:00
parent 8c939c1405
commit 4c66561ebe
2 changed files with 16 additions and 17 deletions

View file

@ -1148,20 +1148,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
cabac_data_t post_seach_cabac;
memcpy(&post_seach_cabac, &state->search_cabac, sizeof(post_seach_cabac));
memcpy(&state->search_cabac, &pre_search_cabac, sizeof(post_seach_cabac));
state->search_cabac.update = 1;
double split_bits = 0;
if (depth < MAX_DEPTH) {
// Add cost of cu_split_flag.
uvg_write_split_flag(state, &state->search_cabac,
x > 0 ? LCU_GET_CU_AT_PX(lcu,SUB_SCU(x) -1, SUB_SCU(y)): NULL,
y > 0 ? LCU_GET_CU_AT_PX(lcu, SUB_SCU(x), SUB_SCU(y) - 1) : NULL,
1, depth, cu_width, x, y, &split_bits);
}
state->search_cabac.update = 0;
split_cost += split_bits * state->lambda;
// If skip mode was selected for the block, skip further search.
// Skip mode means there's no coefficients in the block, so splitting
@ -1177,6 +1164,21 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
split_cost = INT_MAX;
}
state->search_cabac.update = 1;
double split_bits = 0;
if (depth < MAX_DEPTH) {
// Add cost of cu_split_flag.
uvg_write_split_flag(state, &state->search_cabac,
x > 0 ? LCU_GET_CU_AT_PX(lcu, SUB_SCU(x) - 1, SUB_SCU(y)) : NULL,
y > 0 ? LCU_GET_CU_AT_PX(lcu, SUB_SCU(x), SUB_SCU(y) - 1) : NULL,
1, depth, cu_width, x, y, &split_bits);
}
state->search_cabac.update = 0;
split_cost += split_bits * state->lambda;
// If no search is not performed for this depth, try just the best mode
// of the top left CU from the next depth. This should ensure that 64x64
// gets used, at least in the most obvious cases, while avoiding any

View file

@ -1250,9 +1250,6 @@ static int8_t search_intra_rdo(
const int tr_depth = CLIP(1, MAX_PU_DEPTH, depth + state->encoder_control->cfg.tr_depth_intra);
for (int mode = 0; mode < modes_to_check; mode++) {
if(mode == 0) {
printf("%hu %hu %d %d\n", state->search_cabac.ctx.qt_cbf_model_luma[0].state[0], state->search_cabac.ctx.qt_cbf_model_luma[0].state[1], x_px, y_px);
}
double rdo_bitcost = uvg_luma_mode_bits(state, &search_data[mode].pred_cu, x_px, y_px, depth, lcu);
search_data[mode].pred_cu.tr_idx = MTS_TR_NUM;
search_data[mode].bits = rdo_bitcost;
@ -1431,7 +1428,7 @@ int8_t uvg_search_cu_intra_chroma(encoder_state_t * const state,
// FIXME: It might make more sense to only disable rough search if
// num_modes is 0.is 0.
{
if(state->encoder_control->cfg.cclm){
const int_fast8_t log2_width_c = MAX(LOG2_LCU_WIDTH - depth - 1, 2);
const vector2d_t pic_px = { state->tile->frame->width, state->tile->frame->height };
const vector2d_t luma_px = { x_px & ~7, y_px & ~7};