From a0dd41281105ddce762672c489ff1a33cc99b1e2 Mon Sep 17 00:00:00 2001 From: Joose Sainio Date: Tue, 28 Jun 2022 11:05:29 +0300 Subject: [PATCH] [cclm] fix cclm bound calculation --- src/intra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intra.c b/src/intra.c index 83b9d004..6c5a2921 100644 --- a/src/intra.c +++ b/src/intra.c @@ -520,7 +520,7 @@ static void predict_cclm( const int ctu_size = tree_type == UVG_CHROMA_T ? LCU_WIDTH_C : LCU_WIDTH; if (y0) { - if (y_scu == 0) available_above_right = MIN(width / 2, (64-x_scu - width * 2) / 2); + if (y_scu == 0) available_above_right = MIN(MIN(width / 2, (64-x_scu - width * 2) / 2), (state->tile->frame->width - x0 - width* 2) / 2); for (; available_above_right < width / 2; available_above_right++) { int x_extension = x_scu + width * 2 + 4 * available_above_right; x_extension >>= tree_type == UVG_CHROMA_T; @@ -547,7 +547,7 @@ static void predict_cclm( } if(x0) { - if (x_scu == 0) available_left_below = MIN(width / 2, (64 - y_scu - height * 2) / 2); + if (x_scu == 0) available_left_below = MIN(MIN(width / 2, (64 - y_scu - height * 2) / 2), (state->tile->frame->height - y0 - height * 2) / 2); for (; available_left_below < height / 2; available_left_below++) { int y_extension = y_scu + height * 2 + 4 * available_left_below; y_extension >>= tree_type == UVG_CHROMA_T;