From 6d6d69bb815f5d9dd56d38c41686b816b9721244 Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Wed, 14 Dec 2022 10:23:20 +0200 Subject: [PATCH] [mtt] Check that we are inside the CTU before checking the ctu data --- src/cu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cu.c b/src/cu.c index 2697c38c..df89642b 100644 --- a/src/cu.c +++ b/src/cu.c @@ -499,12 +499,12 @@ int uvg_count_available_edge_cus(const cu_loc_t* const cu_loc, const lcu_t* cons int amount = 0; if(left) { if (cu_loc->local_y == 0 && cu_loc->local_x == 32 && cu_loc->height == 32 && cu_loc->width == 32) return 8; - 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) { + while (cu_loc->local_y + amount < LCU_WIDTH && LCU_GET_CU_AT_PX(lcu, cu_loc->local_x - TR_MIN_WIDTH, cu_loc->local_y + amount)->type != CU_NOTSET) { 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) { + while (cu_loc->local_x + amount < LCU_WIDTH && LCU_GET_CU_AT_PX(lcu, cu_loc->local_x + amount, cu_loc->local_y - TR_MIN_WIDTH)->type != CU_NOTSET) { amount += TR_MIN_WIDTH; } return MAX(amount / TR_MIN_WIDTH, cu_loc->width / TR_MIN_WIDTH); @@ -520,12 +520,12 @@ int uvg_count_chroma_tree_available_edge_cus(int x, int y, int width, int height int amount = 0; if(left) { - while (LCU_GET_CU_AT_PX(lcu, local_x - TR_MIN_WIDTH, local_y + amount)->type != CU_NOTSET && (local_y + amount) < LCU_WIDTH_C) { + 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 (LCU_GET_CU_AT_PX(lcu, local_x + amount, local_y - TR_MIN_WIDTH)->type != CU_NOTSET && local_x + amount < LCU_WIDTH_C) { + 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);