[mtt] Fix couple of issues with 64x32 CUs and non square tr skip rdoq

This commit is contained in:
Joose Sainio 2023-02-08 14:39:36 +02:00 committed by Marko Viitanen
parent 7d787c6b22
commit d69bdf79f4
5 changed files with 9 additions and 4 deletions

View file

@ -237,7 +237,7 @@ void uvg_encode_ts_residual(encoder_state_t* const state,
const uint32_t log2_block_width = uvg_g_convert_to_log2[width]; const uint32_t log2_block_width = uvg_g_convert_to_log2[width];
const uint32_t log2_block_height = uvg_g_convert_to_log2[height]; const uint32_t log2_block_height = uvg_g_convert_to_log2[height];
// TODO: log2_cg_size is wrong if width != height // TODO: log2_cg_size is wrong if width != height
const uint32_t log2_cg_size = uvg_g_log2_sbb_size[log2_block_width][log2_block_width][0] + uvg_g_log2_sbb_size[log2_block_width][log2_block_width][1]; const uint32_t log2_cg_size = uvg_g_log2_sbb_size[log2_block_width][log2_block_width][0] + uvg_g_log2_sbb_size[log2_block_width][log2_block_height][1];
const uint32_t* const scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_mode, log2_block_width, log2_block_height); const uint32_t* const scan = uvg_get_scan_order_table(SCAN_GROUP_4X4, scan_mode, log2_block_width, log2_block_height);
const uint32_t* const scan_cg = uvg_get_scan_order_table(SCAN_GROUP_UNGROUPED, scan_mode, log2_block_width, log2_block_height); const uint32_t* const scan_cg = uvg_get_scan_order_table(SCAN_GROUP_UNGROUPED, scan_mode, log2_block_width, log2_block_height);
@ -265,7 +265,7 @@ void uvg_encode_ts_residual(encoder_state_t* const state,
bool no_sig_group_before_last = true; bool no_sig_group_before_last = true;
for (i = 0; i <= scan_cg_last; i++) { for (i = 0; i <= scan_cg_last; i++) {
if (!(width == 4 || (i ==scan_cg_last && no_sig_group_before_last))) { if (!((width == 4 && height == 4) || (i ==scan_cg_last && no_sig_group_before_last))) {
uint32_t cg_blkpos = scan_cg[i]; uint32_t cg_blkpos = scan_cg[i];
uint32_t cg_pos_y = cg_blkpos / cg_width; uint32_t cg_pos_y = cg_blkpos / cg_width;
uint32_t cg_pos_x = cg_blkpos - (cg_pos_y * cg_width); uint32_t cg_pos_x = cg_blkpos - (cg_pos_y * cg_width);

View file

@ -129,7 +129,7 @@ typedef int16_t coeff_t;
typedef int32_t mv_t; typedef int32_t mv_t;
//#define VERBOSE 1 //#define VERBOSE 1
//#define UVG_DEBUG_PRINT_CABAC 1 #define UVG_DEBUG_PRINT_CABAC 1
//#define UVG_DEBUG 1 //#define UVG_DEBUG 1
//#define UVG_DEBUG_PRINT_YUVIEW_CSV 1 //#define UVG_DEBUG_PRINT_YUVIEW_CSV 1

View file

@ -1649,7 +1649,7 @@ void uvg_intra_predict(
} }
else { else {
uvg_pixels_blit(&state->tile->frame->cclm_luma_rec[x / 2 + (y * stride) / 4], dst, width, height, stride / 2, width); uvg_pixels_blit(&state->tile->frame->cclm_luma_rec[x / 2 + (y * stride) / 4], dst, width, height, stride / 2, width);
if (!PU_IS_TU(&data->pred_cu) || data->cclm_parameters[color == COLOR_U ? 0 : 1].b <= 0) { if (width != 1 << data->pred_cu.log2_chroma_width || height != 1 << data->pred_cu.log2_chroma_height || data->cclm_parameters[color == COLOR_U ? 0 : 1].b <= 0) {
predict_cclm( predict_cclm(
state, color, width, height, x, y, stride, intra_mode, lcu, refs, dst, state, color, width, height, x, y, stride, intra_mode, lcu, refs, dst,
(cclm_parameters_t*)&data->cclm_parameters[color == COLOR_U ? 0 : 1], (cclm_parameters_t*)&data->cclm_parameters[color == COLOR_U ? 0 : 1],

View file

@ -1196,8 +1196,11 @@ int uvg_ts_rdoq(encoder_state_t* const state, coeff_t* src_coeff, coeff_t* dest_
switch (cg_num) { switch (cg_num) {
case 1: FILL_ARRAY(sig_coeffgroup_flag, 0, 1); FILL_ARRAY(cost_coeffgroup_sig, 0, 1); break; case 1: FILL_ARRAY(sig_coeffgroup_flag, 0, 1); FILL_ARRAY(cost_coeffgroup_sig, 0, 1); break;
case 2: FILL_ARRAY(sig_coeffgroup_flag, 0, 2); FILL_ARRAY(cost_coeffgroup_sig, 0, 2); break;
case 4: FILL_ARRAY(sig_coeffgroup_flag, 0, 4); FILL_ARRAY(cost_coeffgroup_sig, 0, 4); break; case 4: FILL_ARRAY(sig_coeffgroup_flag, 0, 4); FILL_ARRAY(cost_coeffgroup_sig, 0, 4); break;
case 8: FILL_ARRAY(sig_coeffgroup_flag, 0, 8); FILL_ARRAY(cost_coeffgroup_sig, 0, 8); break;
case 16: FILL_ARRAY(sig_coeffgroup_flag, 0, 16); FILL_ARRAY(cost_coeffgroup_sig, 0, 16); break; case 16: FILL_ARRAY(sig_coeffgroup_flag, 0, 16); FILL_ARRAY(cost_coeffgroup_sig, 0, 16); break;
case 32: FILL_ARRAY(sig_coeffgroup_flag, 0, 32); FILL_ARRAY(cost_coeffgroup_sig, 0, 32); break;
case 64: FILL_ARRAY(sig_coeffgroup_flag, 0, 64); FILL_ARRAY(cost_coeffgroup_sig, 0, 64); break; case 64: FILL_ARRAY(sig_coeffgroup_flag, 0, 64); FILL_ARRAY(cost_coeffgroup_sig, 0, 64); break;
default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups"); default: assert(0 && "There should be 1, 4, 16 or 64 coefficient groups");
} }

View file

@ -341,6 +341,7 @@ static double search_intra_trdepth(
if (state->encoder_control->cfg.trskip_enable if (state->encoder_control->cfg.trskip_enable
&& width <= (1 << state->encoder_control->cfg.trskip_max_size) && width <= (1 << state->encoder_control->cfg.trskip_max_size)
&& height <= (1 << state->encoder_control->cfg.trskip_max_size) && height <= (1 << state->encoder_control->cfg.trskip_max_size)
&& PU_IS_TU(pred_cu)
&& pred_cu->intra.isp_mode == ISP_MODE_NO_ISP) { && pred_cu->intra.isp_mode == ISP_MODE_NO_ISP) {
num_transforms = MAX(num_transforms, 2); num_transforms = MAX(num_transforms, 2);
} }
@ -378,6 +379,7 @@ static double search_intra_trdepth(
if (trafo == MTS_SKIP && ((width > (1 << state->encoder_control->cfg.trskip_max_size) if (trafo == MTS_SKIP && ((width > (1 << state->encoder_control->cfg.trskip_max_size)
|| (height > (1 << state->encoder_control->cfg.trskip_max_size))) || (height > (1 << state->encoder_control->cfg.trskip_max_size)))
|| !PU_IS_TU(pred_cu)
|| !state->encoder_control->cfg.trskip_enable)) { || !state->encoder_control->cfg.trskip_enable)) {
continue; continue;
} }