This commit is contained in:
Joose Sainio 2022-12-08 14:52:01 +02:00 committed by Marko Viitanen
parent ba0d43d846
commit 992182dafb
3 changed files with 12 additions and 3 deletions

View file

@ -1415,6 +1415,7 @@ void uvg_encode_coding_tree(
cu_loc_t chroma_tree_loc;
uint8_t separate_chroma = 0;
const int splits = uvg_get_split_locs(cu_loc, split_flag, new_cu_loc, &separate_chroma);
separate_chroma |= !has_chroma;
for (int split = 0; split <splits; ++split) {
new_split_tree.part_index = split;
if (tree_type == UVG_CHROMA_T) {
@ -1438,7 +1439,7 @@ void uvg_encode_coding_tree(
DBG_YUVIEW_VALUE(state->frame->poc, DBG_YUVIEW_CU_TYPE, abs_x, abs_y, cu_width, cu_height, cur_cu->type-1);
//fprintf(stderr, "%4d %4d %2d %2d %d %d\n", x, y, cu_width, cu_height, has_chroma, cur_cu->split_tree);
fprintf(stderr, "%4d %4d %2d %2d %d %d\n", x, y, cu_width, cu_height, has_chroma, cur_cu->split_tree);
if (ctrl->cfg.lossless) {
cabac->cur_ctx = &cabac->ctx.cu_transquant_bypass;

View file

@ -315,6 +315,8 @@ static void lcu_fill_chroma_cu_info(lcu_t *lcu, const cu_loc_t * const cu_loc)
cu->intra.mode_chroma = bottom_right->intra.mode_chroma;
cu->joint_cb_cr = bottom_right->joint_cb_cr;
cu->cr_lfnst_idx = bottom_right->cr_lfnst_idx;
cu->type = bottom_right->type;
cu->tr_skip |= bottom_right->tr_skip & 6;
}
}
}
@ -1015,6 +1017,7 @@ static double search_cu(
const int y = cu_loc->y;
const int luma_width = cu_loc->width;
const int luma_height = cu_loc->height;
const bool is_separate_tree = chroma_loc == NULL || cu_loc->height != chroma_loc->height || cu_loc->width != chroma_loc->width;
assert(cu_width >= 4);
double cost = MAX_DOUBLE;
@ -1381,6 +1384,7 @@ static double search_cu(
cost = bits * state->lambda;
cost += cu_rd_cost_tr_split_accurate(state, cur_cu, lcu, tree_type, 0, cu_loc, chroma_loc, has_chroma);
//fprintf(stderr, "%4d %4d %2d %2d %d %d %f\n", x, y, cu_width, cu_height, has_chroma, cur_cu->split_tree, cost);
//if (ctrl->cfg.zero_coeff_rdo && inter_zero_coeff_cost <= cost) {
// cost = inter_zero_coeff_cost;
@ -1495,6 +1499,7 @@ static double search_cu(
cu_loc_t new_cu_loc[4];
uint8_t separate_chroma = 0;
const int splits = uvg_get_split_locs(cu_loc, split_type, new_cu_loc, &separate_chroma);
separate_chroma |= !has_chroma;
initialize_partial_work_tree(lcu, &split_lcu[split_type - 1], cu_loc, separate_chroma ? chroma_loc : cu_loc , tree_type);
for (int split = 0; split < splits; ++split) {
new_split.part_index = split;

View file

@ -338,6 +338,7 @@ static double search_intra_trdepth(
num_transforms = MAX(num_transforms, 2);
}
pred_cu->intra.mode_chroma = -1;
pred_cu->joint_cb_cr = 4;
const int max_tb_size = TR_MAX_WIDTH;
// LFNST search params
@ -488,6 +489,7 @@ static double search_intra_trdepth(
if (reconstruct_chroma) {
int8_t luma_mode = pred_cu->intra.mode;
pred_cu->intra.mode_chroma = chroma_mode;
pred_cu->joint_cb_cr = 4;
// TODO: Maybe check the jccr mode here also but holy shit is the interface of search_intra_rdo bad currently
uvg_intra_recon_cu(
state,
@ -542,6 +544,7 @@ static double search_intra_trdepth(
if(reconstruct_chroma) {
int8_t luma_mode = pred_cu->intra.mode;
pred_cu->intra.mode_chroma = chroma_mode;
pred_cu->joint_cb_cr= 4; // TODO: Maybe check the jccr mode here also but holy shit is the interface of search_intra_rdo bad currently
uvg_intra_recon_cu(state,
search_data, cu_loc,
pred_cu, lcu,
@ -561,7 +564,7 @@ static double search_intra_trdepth(
// Early stop condition for the recursive search.
// If the cost of any 1/4th of the transform is already larger than the
// whole transform, assume that splitting further is a bad idea.
if (nosplit_cost >= cost_treshold) {
if (nosplit_cost <= cost_treshold) {
return nosplit_cost;
}
}
@ -1445,7 +1448,7 @@ int8_t uvg_search_intra_chroma_rdo(
const int offset = ((cu_loc->local_x) >> 1) + ((cu_loc->local_y) >> 1)* LCU_WIDTH_C;
int lfnst_modes_to_check[3];
if((is_separate || tree_type == UVG_CHROMA_T) && state->encoder_control->cfg.lfnst) {
if((is_separate || tree_type == UVG_CHROMA_T) && state->encoder_control->cfg.lfnst && PU_IS_TU(&chroma_data->pred_cu) ) {
for (int i = 0; i < 3; ++i) {
lfnst_modes_to_check[i] = i;
}