From 99495c331be218a9a0cdc6d31606223df80c19f5 Mon Sep 17 00:00:00 2001 From: siivonek Date: Fri, 16 Sep 2022 10:37:51 +0300 Subject: [PATCH] [isp] Fix some asserts to allow log2_dim 1 block sizes. Fix coefficient group scan order for small dimensions. --- src/intra.c | 3 ++- src/strategies/generic/intra-generic.c | 3 ++- src/tables.c | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/intra.c b/src/intra.c index 3c02dac2..b1ca6361 100644 --- a/src/intra.c +++ b/src/intra.c @@ -1248,7 +1248,8 @@ void uvg_intra_build_reference_inner( const int cu_x = cu_loc->x; const int cu_y = cu_loc->y; - assert((log2_width >= 2 && log2_width <= 5) && (log2_height >= 2 && log2_height <= 5)); + // Log2_dim 1 is possible with ISP blocks + assert((log2_width >= 1 && log2_width <= 5) && (log2_height >= 1 && log2_height <= 5)); refs->filtered_initialized = false; uvg_pixel * __restrict out_left_ref = &refs->ref.left[0]; diff --git a/src/strategies/generic/intra-generic.c b/src/strategies/generic/intra-generic.c index 833c42c2..81de7c4b 100644 --- a/src/strategies/generic/intra-generic.c +++ b/src/strategies/generic/intra-generic.c @@ -66,7 +66,8 @@ static void uvg_angular_pred_generic( const int log2_width = uvg_g_convert_to_log2[width]; const int log2_height = uvg_g_convert_to_log2[height]; - assert((log2_width >= 2 && log2_width <= 5) && (log2_height >= 2 && log2_height <= 5)); + // Log2_dim 1 is possible with ISP blocks + assert((log2_width >= 1 && log2_width <= 5) && (log2_height >= 1 && log2_height <= 5)); assert(intra_mode >= 2 && intra_mode <= 66); static const int16_t modedisp2sampledisp[32] = { 0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 23, 26, 29, 32, 35, 39, 45, 51, 57, 64, 73, 86, 102, 128, 171, 256, 341, 512, 1024 }; diff --git a/src/tables.c b/src/tables.c index dec8b467..dec6f020 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2615,6 +2615,12 @@ const uint32_t* const uvg_get_scan_order_table(int scan_group, int scan_type, in return g_scan_order[scan_group][log2_w][log2_h]; } else { - return g_scan_order[scan_group][log2_w - 2][log2_h - 2]; + if (log2_w == 1 || log2_h == 1) { + // Just return array containing [0, 15] in order + return g_scan_order[scan_group][0][4]; + } + else { + return g_scan_order[scan_group][log2_w - 2][log2_h - 2]; + } } }