From ccb9d57645f5c626a1865f328264960a32489b13 Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Mon, 19 Dec 2022 14:25:03 +0200 Subject: [PATCH] [mtt] Fix reading uninitialized data for local chroma tree --- src/search.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/search.c b/src/search.c index 9041dcdc..7fff31fa 100644 --- a/src/search.c +++ b/src/search.c @@ -189,15 +189,27 @@ static INLINE void initialize_partial_work_tree( to->top_ref = from->top_ref; *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 (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)); + } } } - 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)); + else { + 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)); + } } } }