[mtt] Set cus outside of the frame to zero for initializing partial worktree

This commit is contained in:
Joose Sainio 2022-12-19 10:24:00 +02:00 committed by Marko Viitanen
parent 27d114bc08
commit 812377db45

View file

@ -77,12 +77,17 @@ static INLINE void copy_cu_info(lcu_t *from, lcu_t *to, const cu_loc_t* const cu
} }
static INLINE void initialize_partial_work_tree(lcu_t* from, lcu_t *to, const cu_loc_t * const cu_loc, const cu_loc_t* const static INLINE void initialize_partial_work_tree(
const encoder_state_t* const state,
lcu_t* from,
lcu_t *to,
const cu_loc_t * const cu_loc,
const cu_loc_t* const
chroma_loc, chroma_loc,
const enum uvg_tree_type tree_type) { const enum uvg_tree_type tree_type) {
const int y_limit = LCU_WIDTH >> (tree_type == UVG_CHROMA_T); const int y_limit = MIN(LCU_WIDTH, state->tile->frame->height - cu_loc->y / 64 * 64) >> (tree_type == UVG_CHROMA_T);
const int x_limit = LCU_WIDTH >> (tree_type == UVG_CHROMA_T); const int x_limit = MIN(LCU_WIDTH, state->tile->frame->width - cu_loc->x / 64 * 64) >> (tree_type == UVG_CHROMA_T);
if (cu_loc->local_x == 0) { if (cu_loc->local_x == 0) {
to->left_ref = from->left_ref; to->left_ref = from->left_ref;
@ -186,6 +191,16 @@ static INLINE void initialize_partial_work_tree(lcu_t* from, lcu_t *to, const cu
*LCU_GET_TOP_RIGHT_CU(to) = *LCU_GET_TOP_RIGHT_CU(from); *LCU_GET_TOP_RIGHT_CU(to) = *LCU_GET_TOP_RIGHT_CU(from);
} }
} }
if (x_limit != LCU_WIDTH >> (tree_type == UVG_CHROMA_T)) {
for (int y = y_start; y < y_limit; y += SCU_WIDTH) {
memset(LCU_GET_CU_AT_PX(to, x_limit, y), 0, sizeof(cu_info_t));
}
}
if (y_limit != LCU_WIDTH >> (tree_type == UVG_CHROMA_T)) {
for (int x = x_start; x < x_limit; x += SCU_WIDTH) {
memset(LCU_GET_CU_AT_PX(to, x, y_limit), 0, sizeof(cu_info_t));
}
}
} }
static INLINE void copy_cu_pixels( static INLINE void copy_cu_pixels(
@ -1694,7 +1709,7 @@ static double search_cu(
uint8_t separate_chroma = 0; uint8_t separate_chroma = 0;
const int splits = uvg_get_split_locs(cu_loc, split_type, new_cu_loc, &separate_chroma); const int splits = uvg_get_split_locs(cu_loc, split_type, new_cu_loc, &separate_chroma);
separate_chroma |= !has_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); initialize_partial_work_tree(state, lcu, &split_lcu[split_type - 1], cu_loc , separate_chroma ? chroma_loc : cu_loc, tree_type);
for (int split = 0; split < splits; ++split) { for (int split = 0; split < splits; ++split) {
new_split.part_index = split; new_split.part_index = split;
split_cost += search_cu(state, split_cost += search_cu(state,