From 7de1440cb8993577e1d4f7f31ca1fe7078d453f8 Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Sat, 15 Jan 2022 02:13:48 -0300 Subject: [PATCH] Simplify this check --- src/jpegwrite.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/jpegwrite.c b/src/jpegwrite.c index 3768c6a..3a35c04 100644 --- a/src/jpegwrite.c +++ b/src/jpegwrite.c @@ -76,10 +76,7 @@ void calculate_JPEG_quantization_tables (struct context * context, uint8_t lumin score += current; for (current = context -> source -> height; current > 4; current >>= 1) score += 2; score += current; - if (score < 24) - score = 2; - else - score -= 22; + score = (score > 24) ? score - 22 : 2; // adjust the chrominance accuracy based on the color depth current = get_true_color_depth(context -> source); uint_fast32_t adjustment = 72 - (current & 0xff) - ((current >> 8) & 0xff) - ((current >> 16) & 0xff);