From a8a120942eb490a79f3e5a0d663db0217868b01a Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 2 Jun 2021 21:15:58 +0900 Subject: [PATCH] sw_engine: data optimization. changed alpha channel data type to 32 bits from 8 bits, since subsequent data operations requires 32 bits values. this 8 bits (since channel range is up to 255) doesn't helpful for saving memory size because it would generate additional data casting by compiler. I compared the binary size and this patch saves about 600bytes. --- src/lib/sw_engine/tvgSwCommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/sw_engine/tvgSwCommon.h b/src/lib/sw_engine/tvgSwCommon.h index 6e78543f..be91cfab 100644 --- a/src/lib/sw_engine/tvgSwCommon.h +++ b/src/lib/sw_engine/tvgSwCommon.h @@ -279,7 +279,7 @@ static inline uint32_t COLOR_INTERPOLATE(uint32_t c1, uint32_t a1, uint32_t c2, return (c1 |= t); } -static inline uint8_t ALPHA_MULTIPLY(uint32_t c, uint32_t a) +static inline uint32_t ALPHA_MULTIPLY(uint32_t c, uint32_t a) { return ((c * a + 0xff) >> 8); }