[mtt] 64x32 and 32x64

This commit is contained in:
Joose Sainio 2022-11-21 13:45:36 +02:00
parent baa7a3bb70
commit 69f66626ed
5 changed files with 69 additions and 71 deletions

View file

@ -372,10 +372,10 @@ int uvg_count_available_edge_cus(const cu_loc_t* const cu_loc, const lcu_t* cons
while (LCU_GET_CU_AT_PX(lcu, cu_loc->local_x - TR_MIN_WIDTH, cu_loc->local_y + amount)->type != CU_NOTSET && (cu_loc->local_y + amount) < LCU_WIDTH) {
amount += TR_MIN_WIDTH;
}
return amount / TR_MIN_WIDTH;
return MAX(amount / TR_MIN_WIDTH, cu_loc->height / TR_MIN_WIDTH);
}
while (LCU_GET_CU_AT_PX(lcu, cu_loc->local_x + amount, cu_loc->local_y - TR_MIN_WIDTH)->type != CU_NOTSET && cu_loc->local_x + amount < LCU_WIDTH) {
amount += TR_MIN_WIDTH;
}
return amount / TR_MIN_WIDTH;
return MAX(amount / TR_MIN_WIDTH, cu_loc->width / TR_MIN_WIDTH);
}

View file

@ -626,24 +626,30 @@ static void encode_transform_coeff(
const int y_cu = 8 * (y / 8);
const cu_info_t *cur_cu = uvg_cu_array_at_const(used_array, x, y); // TODO: very suspect, chroma cbfs stored in upper left corner, everything else in bottom right for depth 4
int8_t split = (cu_loc->width > TR_MAX_WIDTH || cu_loc->height > TR_MAX_WIDTH);
const bool ver_split = cu_loc->height > TR_MAX_WIDTH;
const bool hor_split = cu_loc->width > TR_MAX_WIDTH;
const int cb_flag_y = tree_type != UVG_CHROMA_T ? cbf_is_set(cur_pu->cbf, COLOR_Y) : 0;
const int cb_flag_u = tree_type != UVG_LUMA_T ?( cur_pu->joint_cb_cr ? (cur_pu->joint_cb_cr >> 1) & 1 : cbf_is_set(cur_cu->cbf, COLOR_U)) : 0;
const int cb_flag_v = tree_type != UVG_LUMA_T ? (cur_pu->joint_cb_cr ? cur_pu->joint_cb_cr & 1 : cbf_is_set(cur_cu->cbf, COLOR_V)) : 0;
if (split) {
int split_width = width >> 1;
int split_height = height >> 1;
for (int j = 0; j < 2; j++) {
for (int i = 0; i < 2; i++) {
cu_loc_t loc;
uvg_cu_loc_ctor(&loc, (x + i * split_width), (y + j * split_height), width >> 1, height >> 1);
encode_transform_coeff(state, &loc, only_chroma, coeff, tree_type, true, luma_cbf_ctx, &loc);
if (hor_split || ver_split) {
enum split_type split;
if (cu_loc->width > TR_MAX_WIDTH && cu_loc->height > TR_MAX_WIDTH) {
split = QT_SPLIT;
}
else if (cu_loc->width > TR_MAX_WIDTH) {
split = BT_VER_SPLIT;
}
else {
split = BT_HOR_SPLIT;
}
cu_loc_t split_cu_loc[4];
const int split_count = uvg_get_split_locs(cu_loc, split, split_cu_loc);
for (int i = 0; i < split_count; ++i) {
encode_transform_coeff(state, &split_cu_loc[i], only_chroma, coeff, tree_type, true, luma_cbf_ctx, &split_cu_loc[i]);
}
return;
}

View file

@ -565,7 +565,7 @@ static void predict_cclm(
y_extension >>= tree_type == UVG_CHROMA_T;
const cu_info_t* pu = LCU_GET_CU_AT_PX(lcu, (x_scu >> (tree_type == UVG_CHROMA_T)) - 4, y_extension);
if (y_extension >= ctu_size || pu->type == CU_NOTSET || (pu->type == CU_INTRA && pu->intra.mode_chroma == -1)) break;
if(x_scu == 32 && y_scu == 0 && pu->log2_width == 6) break;
if(x_scu == 32 && y_scu == 0 && pu->log2_height == 6 && pu->log2_width == 6 ) break;
}
for(int i = 0; i < height + available_left_below * 2; i++) {
sampled_luma_ref.left[i] = state->tile->frame->cclm_luma_rec[(y0/2 + i) * (stride2/2) + x0 / 2 - 1];
@ -1783,6 +1783,7 @@ static void intra_recon_tb_leaf(
}
}
/**
* \brief Reconstruct an intra CU
*
@ -1833,33 +1834,23 @@ void uvg_intra_recon_cu(
}
if (width > TR_MAX_WIDTH || height > TR_MAX_WIDTH) {
cu_loc_t split_cu_loc;
enum split_type split;
if (cu_loc->width > TR_MAX_WIDTH && cu_loc->height > TR_MAX_WIDTH) {
split = QT_SPLIT;
}
else if (cu_loc->width > TR_MAX_WIDTH) {
split = BT_VER_SPLIT;
}
else {
split = BT_HOR_SPLIT;
}
const int half_width = width / 2;
const int half_height = height / 2;
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x, cu_loc->y, half_width, half_height);
uvg_intra_recon_cu(state, search_data, &split_cu_loc, NULL, lcu, tree_type, recon_luma, recon_chroma);
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x + half_width, cu_loc->y, half_width, half_height);
uvg_intra_recon_cu(state, search_data, &split_cu_loc, NULL, lcu, tree_type, recon_luma, recon_chroma);
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x, cu_loc->y + half_height, half_width, half_height);
uvg_intra_recon_cu(state, search_data, &split_cu_loc, NULL, lcu, tree_type, recon_luma, recon_chroma);
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x + half_width, cu_loc->y + half_height, half_width, half_height);
uvg_intra_recon_cu(state, search_data, &split_cu_loc, NULL, lcu, tree_type, recon_luma, recon_chroma);
cu_loc_t split_cu_loc[4];
const int split_count = uvg_get_split_locs(cu_loc, split, split_cu_loc);
for (int i = 0; i < split_count; ++i) {
uvg_intra_recon_cu(state, search_data, &split_cu_loc[i], NULL, lcu, tree_type, recon_luma, recon_chroma);
}
// Propagate coded block flags from child CUs to parent CU.
uint16_t child_cbfs[3] = {
LCU_GET_CU_AT_PX(lcu, (lcu_px.x + half_width) >> (tree_type == UVG_CHROMA_T), lcu_px.y >> (tree_type == UVG_CHROMA_T))->cbf,
LCU_GET_CU_AT_PX(lcu, lcu_px.x >> (tree_type == UVG_CHROMA_T), (lcu_px.y + half_height) >> (tree_type == UVG_CHROMA_T))->cbf,
LCU_GET_CU_AT_PX(lcu, (lcu_px.x + half_width) >> (tree_type == UVG_CHROMA_T), (lcu_px.y + half_height) >> (tree_type == UVG_CHROMA_T))->cbf,
};
//if (recon_luma && depth <= MAX_DEPTH) {
// cbf_set_conditionally(&cur_cu->cbf, child_cbfs, depth, COLOR_Y);
//}
//if (recon_chroma && depth <= MAX_DEPTH) {
// cbf_set_conditionally(&cur_cu->cbf, child_cbfs, depth, COLOR_U);
// cbf_set_conditionally(&cur_cu->cbf, child_cbfs, depth, COLOR_V);
//}
return;
}
if (search_data->pred_cu.intra.isp_mode != ISP_MODE_NO_ISP && recon_luma ) {

View file

@ -575,25 +575,24 @@ static double search_intra_trdepth(
// max_depth.
// - Min transform size hasn't been reached (MAX_PU_DEPTH).
else {
cu_loc_t split_cu_loc;
const int half_width = width / 2;
const int half_height = height / 2;
split_cost = 0;
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x, cu_loc->y, half_width, half_height);
split_cost += search_intra_trdepth(state, &split_cu_loc, nosplit_cost, search_data, lcu, tree_type);
if (split_cost < nosplit_cost) {
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x + half_width, cu_loc->y, half_width, half_height);
split_cost += search_intra_trdepth(state, &split_cu_loc, nosplit_cost, search_data, lcu, tree_type);
enum split_type split;
if (cu_loc->width > TR_MAX_WIDTH && cu_loc->height > TR_MAX_WIDTH) {
split = QT_SPLIT;
}
if (split_cost < nosplit_cost) {
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x, cu_loc->y + half_height, half_width, half_height);
split_cost += search_intra_trdepth(state, &split_cu_loc, nosplit_cost, search_data, lcu, tree_type);
else if (cu_loc->width > TR_MAX_WIDTH) {
split = BT_VER_SPLIT;
}
if (split_cost < nosplit_cost) {
uvg_cu_loc_ctor(&split_cu_loc, cu_loc->x + half_width, cu_loc->y + half_height, half_width, half_height);
split_cost += search_intra_trdepth(state, &split_cu_loc, nosplit_cost, search_data, lcu, tree_type);
else {
split = BT_HOR_SPLIT;
}
cu_loc_t split_cu_loc[4];
const int split_count = uvg_get_split_locs(cu_loc, split, split_cu_loc);
for (int i = 0; i < split_count; ++i) {
split_cost += search_intra_trdepth(state, &split_cu_loc[i], nosplit_cost, search_data, lcu, tree_type);
}
}
@ -1821,7 +1820,7 @@ void uvg_search_cu_intra(
}
uint8_t num_mrl_modes = 0;
for(int line = 1; line < lines; ++line) {
for(int line = 1; line < lines && !is_large; ++line) {
uvg_pixel extra_refs[128 * MAX_REF_LINE_IDX] = { 0 };
if (luma_px.x > 0 && lcu_px.x == 0 && lcu_px.y > 0) {

View file

@ -1400,26 +1400,28 @@ void uvg_quantize_lcu_residual(
}
if (cu_loc->width > TR_MAX_WIDTH || cu_loc->height > TR_MAX_WIDTH) {
enum split_type split;
if (cu_loc->width > TR_MAX_WIDTH && cu_loc->height > TR_MAX_WIDTH) {
split = QT_SPLIT;
}
else if (cu_loc->width > TR_MAX_WIDTH) {
split = BT_VER_SPLIT;
}
else {
split = BT_HOR_SPLIT;
}
// Split transform and increase depth
const int offset = width / 2;
for (int j = 0; j < 2; ++j) {
for (int i = 0; i < 2; ++i) {
cu_loc_t loc;
uvg_cu_loc_ctor(&loc, (x + i * offset), (y + j * offset), width >> 1, height >> 1);
// jccr is currently not supported if transform is split
uvg_quantize_lcu_residual(state, luma, chroma, 0, &loc, NULL, lcu, early_skip, tree_type);
cu_loc_t split_cu_loc[4];
uint16_t child_cbfs[3];
const int split_count = uvg_get_split_locs(cu_loc, split, split_cu_loc);
for (int i = 0; i < split_count; ++i) {
uvg_quantize_lcu_residual(state, luma, chroma, 0, &split_cu_loc[i], NULL, lcu, early_skip, tree_type);
if(i != 0) {
child_cbfs[i - 1] = LCU_GET_CU_AT_PX(lcu, split_cu_loc[i].local_x, split_cu_loc[i].local_y)->cbf;
}
}
// Propagate coded block flags from child CUs to parent CU.
uint16_t child_cbfs[3] = {
LCU_GET_CU_AT_PX(lcu, lcu_px.x + offset, lcu_px.y )->cbf,
LCU_GET_CU_AT_PX(lcu, lcu_px.x, lcu_px.y + offset)->cbf,
LCU_GET_CU_AT_PX(lcu, lcu_px.x + offset, lcu_px.y + offset)->cbf,
};
cur_pu->root_cbf = cbf_is_set_any(cur_pu->cbf)
|| cbf_is_set_any(child_cbfs[0])
|| cbf_is_set_any(child_cbfs[1])