mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
[dual-tree] Remove the limitation of not allowing 2 height chroma blocks in dual tree
This commit is contained in:
parent
899a0323fb
commit
ca7cc7881f
22
src/cu.c
22
src/cu.c
|
@ -502,25 +502,3 @@ int uvg_count_available_edge_cus(const cu_loc_t* const cu_loc, const lcu_t* cons
|
|||
}
|
||||
return MAX(amount / TR_MIN_WIDTH, cu_loc->width / TR_MIN_WIDTH);
|
||||
}
|
||||
|
||||
int uvg_count_chroma_tree_available_edge_cus(int x, int y, int width, int height, const lcu_t* const lcu, bool left)
|
||||
{
|
||||
if (left && x == 0 || !left && y == 0) return 0;
|
||||
const int local_x = x % LCU_WIDTH_C;
|
||||
const int local_y = y % LCU_WIDTH_C;
|
||||
if (left && local_x == 0) return (LCU_WIDTH_C - local_y) / 4;
|
||||
if (!left && local_y == 0) return width / 2;
|
||||
|
||||
int amount = 0;
|
||||
if(left) {
|
||||
while (local_y + amount < LCU_WIDTH_C && LCU_GET_CU_AT_PX(lcu, local_x - TR_MIN_WIDTH, local_y + amount)->type != CU_NOTSET) {
|
||||
amount += TR_MIN_WIDTH;
|
||||
}
|
||||
return MAX(amount / TR_MIN_WIDTH, height / TR_MIN_WIDTH);
|
||||
}
|
||||
while (local_x + amount < LCU_WIDTH_C && LCU_GET_CU_AT_PX(lcu, local_x + amount, local_y - TR_MIN_WIDTH)->type != CU_NOTSET) {
|
||||
amount += TR_MIN_WIDTH;
|
||||
}
|
||||
return MAX(amount / TR_MIN_WIDTH, width / TR_MIN_WIDTH);
|
||||
|
||||
}
|
1
src/cu.h
1
src/cu.h
|
@ -384,7 +384,6 @@ typedef struct {
|
|||
void uvg_cu_array_copy_from_lcu(cu_array_t* dst, int dst_x, int dst_y, const lcu_t *src);
|
||||
|
||||
int uvg_count_available_edge_cus(const cu_loc_t* const cu_loc, const lcu_t* const lcu, bool left);
|
||||
int uvg_count_chroma_tree_available_edge_cus(int x, int y, int width, int height, const lcu_t* const lcu, bool left);
|
||||
|
||||
/**
|
||||
* \brief Return pointer to the top right reference CU.
|
||||
|
|
|
@ -1081,12 +1081,12 @@ static void filter_deblock_edge_chroma(encoder_state_t * const state,
|
|||
int32_t y_coord = y << 1;
|
||||
cu_array_t* cua = tree_type != UVG_CHROMA_T ? frame->cu_array : frame->chroma_cu_array;
|
||||
if (dir == EDGE_VER) {
|
||||
y_coord = (y + min_chroma_length * blk_idx) << (tree_type != UVG_CHROMA_T);
|
||||
y_coord = (y + min_chroma_length * blk_idx) << (1);
|
||||
cu_p = uvg_cu_array_at(cua, x_coord - 1, y_coord);
|
||||
cu_q = uvg_cu_array_at(cua, x_coord , y_coord);
|
||||
|
||||
} else {
|
||||
x_coord = (x + min_chroma_length * blk_idx) << (tree_type != UVG_CHROMA_T);
|
||||
x_coord = (x + min_chroma_length * blk_idx) << (1);
|
||||
cu_p = uvg_cu_array_at(cua, x_coord, y_coord - 1);
|
||||
cu_q = uvg_cu_array_at(cua, x_coord, y_coord );
|
||||
}
|
||||
|
@ -1114,7 +1114,7 @@ static void filter_deblock_edge_chroma(encoder_state_t * const state,
|
|||
|
||||
|
||||
const bool large_boundary = (max_filter_length_P >= 3 && max_filter_length_Q >= 3);
|
||||
const bool is_chroma_hor_CTB_boundary = (dir == EDGE_HOR && y_coord % (LCU_WIDTH >> (tree_type == UVG_CHROMA_T)) == 0);
|
||||
const bool is_chroma_hor_CTB_boundary = (dir == EDGE_HOR && y_coord % LCU_WIDTH == 0);
|
||||
uint8_t c_strength[2] = { 0, 0 };
|
||||
|
||||
|
||||
|
|
28
src/intra.c
28
src/intra.c
|
@ -1153,14 +1153,8 @@ void uvg_intra_build_reference_any(
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (!is_dual_tree) {
|
||||
const int num_cus = uvg_count_available_edge_cus(cu_loc, lcu, true);
|
||||
px_available_left = is_dual_tree || !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
}
|
||||
else {
|
||||
const int num_cus = uvg_count_chroma_tree_available_edge_cus(cu_loc->x >> 1, cu_loc->y >> 1, width, height, lcu, true);
|
||||
px_available_left = num_cus * 4;
|
||||
}
|
||||
px_available_left = !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
}
|
||||
|
||||
// Limit the number of available pixels based on block size and dimensions
|
||||
|
@ -1282,14 +1276,8 @@ void uvg_intra_build_reference_any(
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (!is_dual_tree) {
|
||||
const int num_cus = uvg_count_available_edge_cus(cu_loc, lcu, false);
|
||||
px_available_top = is_dual_tree || !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
}
|
||||
else {
|
||||
const int num_cus = uvg_count_chroma_tree_available_edge_cus(cu_loc->x >> 1, cu_loc->y >> 1, width, height, lcu, false);
|
||||
px_available_top = num_cus * 4;
|
||||
}
|
||||
px_available_top = !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
}
|
||||
|
||||
// Limit the number of available pixels based on block size and dimensions
|
||||
|
@ -1475,8 +1463,8 @@ void uvg_intra_build_reference_inner(
|
|||
const int num_cus = uvg_count_available_edge_cus(cu_loc, lcu, true);
|
||||
px_available_left = is_dual_tree || !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
} else {
|
||||
const int num_cus = uvg_count_chroma_tree_available_edge_cus(cu_loc->x >> 1, cu_loc->y >> 1, width, height, lcu, true);
|
||||
px_available_left = num_cus * 4;
|
||||
const int num_cus = uvg_count_available_edge_cus(cu_loc, lcu, true);
|
||||
px_available_left = !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1538,14 +1526,8 @@ void uvg_intra_build_reference_inner(
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (!is_dual_tree) {
|
||||
const int num_cus = uvg_count_available_edge_cus(cu_loc, lcu, false);
|
||||
px_available_top = is_dual_tree || !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
}
|
||||
else {
|
||||
const int num_cus = uvg_count_chroma_tree_available_edge_cus(cu_loc->x >> 1, cu_loc->y >> 1, width, height, lcu, false);
|
||||
px_available_top = num_cus * 4;
|
||||
}
|
||||
px_available_top = !is_chroma ? num_cus * 4 : num_cus * 2;
|
||||
}
|
||||
|
||||
// Limit the number of available pixels based on block size and dimensions
|
||||
|
|
10
src/search.c
10
src/search.c
|
@ -1270,10 +1270,7 @@ static double search_cu(
|
|||
pu_depth_intra.min = ctrl->cfg.pu_depth_intra.min[gop_layer] >= 0 ? ctrl->cfg.pu_depth_intra.min[gop_layer] : ctrl->cfg.pu_depth_intra.min[0];
|
||||
pu_depth_intra.max = ctrl->cfg.pu_depth_intra.max[gop_layer] >= 0 ? ctrl->cfg.pu_depth_intra.max[gop_layer] : ctrl->cfg.pu_depth_intra.max[0];
|
||||
}
|
||||
if(tree_type == UVG_CHROMA_T) {
|
||||
pu_depth_intra.max = CLIP(1, 3, pu_depth_intra.max);
|
||||
pu_depth_intra.min = CLIP(1, 3, pu_depth_intra.min);
|
||||
}
|
||||
|
||||
pu_depth_inter.min = ctrl->cfg.pu_depth_inter.min[gop_layer] >= 0 ? ctrl->cfg.pu_depth_inter.min[gop_layer] : ctrl->cfg.pu_depth_inter.min[0];
|
||||
pu_depth_inter.max = ctrl->cfg.pu_depth_inter.max[gop_layer] >= 0 ? ctrl->cfg.pu_depth_inter.max[gop_layer] : ctrl->cfg.pu_depth_inter.max[0];
|
||||
|
||||
|
@ -1702,10 +1699,7 @@ static double search_cu(
|
|||
memcpy(&post_seach_cabac, &state->search_cabac, sizeof(post_seach_cabac));
|
||||
// Recursively split all the way to max search depth.
|
||||
for (int split_type = QT_SPLIT; split_type <= TT_VER_SPLIT; ++split_type) {
|
||||
if (!can_split[split_type]
|
||||
|| (tree_type == UVG_CHROMA_T && split_type == TT_HOR_SPLIT && cu_loc->chroma_height == 8)
|
||||
|| (tree_type == UVG_CHROMA_T && split_type == BT_HOR_SPLIT && cu_loc->chroma_height == 4)
|
||||
)
|
||||
if (!can_split[split_type])
|
||||
continue;
|
||||
|
||||
if (completely_inside && check_for_early_termission(
|
||||
|
|
Loading…
Reference in a new issue