diff --git a/src/rdo.c b/src/rdo.c index 6122269d..67605c4e 100644 --- a/src/rdo.c +++ b/src/rdo.c @@ -1461,7 +1461,7 @@ void uvg_rdoq( const uint32_t cg_size = 16; const int32_t shift = 4 >> 1; - const uint32_t num_blk_side = width >> shift; + const uint32_t num_blk_side = MAX(width >> shift, 1); double cost_coeffgroup_sig[ 64 ]; uint32_t sig_coeffgroup_flag[ 64 ]; diff --git a/src/tables.c b/src/tables.c index dec6f020..c98ecf79 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2615,7 +2615,7 @@ 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 { - if (log2_w == 1 || log2_h == 1) { + if (log2_w <= 1 || log2_h <= 1) { // Just return array containing [0, 15] in order return g_scan_order[scan_group][0][4]; }