mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-04 05:54:05 +00:00
[debug] Temporarily move split flag counting
This commit is contained in:
parent
8c939c1405
commit
4c66561ebe
28
src/search.c
28
src/search.c
|
@ -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;
|
cabac_data_t post_seach_cabac;
|
||||||
memcpy(&post_seach_cabac, &state->search_cabac, sizeof(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));
|
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.
|
// If skip mode was selected for the block, skip further search.
|
||||||
// Skip mode means there's no coefficients in the block, so splitting
|
// 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;
|
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
|
// 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
|
// 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
|
// gets used, at least in the most obvious cases, while avoiding any
|
||||||
|
|
|
@ -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);
|
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++) {
|
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);
|
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].pred_cu.tr_idx = MTS_TR_NUM;
|
||||||
search_data[mode].bits = rdo_bitcost;
|
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
|
// FIXME: It might make more sense to only disable rough search if
|
||||||
// num_modes is 0.is 0.
|
// 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 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 pic_px = { state->tile->frame->width, state->tile->frame->height };
|
||||||
const vector2d_t luma_px = { x_px & ~7, y_px & ~7};
|
const vector2d_t luma_px = { x_px & ~7, y_px & ~7};
|
||||||
|
|
Loading…
Reference in a new issue