summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorali <ali198724@gmail.com>2020-03-13 09:54:54 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2020-03-13 09:58:04 +0100
commitba1a326a572c93d5e0f07ba628efe3a109bfc3f3 (patch)
treead3042f4f32af91ecd35148ab5d3bfaef521e6a9
parente8100fa8b004f6344a765c623e883ccb60bda88c (diff)
downloadefl-ba1a326a572c93d5e0f07ba628efe3a109bfc3f3.tar.gz
evas_common: rgba32 to Y8 (Enhance Conversion)
Summary: Made small change to expand mapping range by using celling values. Now : rgb(255,255,255) -> y(255) Now : rgb(1 , 1 ,1 ) -> y(1) Old : rgb(255,255,255) -> y(254) Old : rgb(1 , 1, 1) -> y(0) It is important for white point convert to not loss any value Test Plan: ``` #include <stdio.h> int main() { unsigned char r =255, g =255,b =255; unsigned int gry8_old = ((r * 19595) + (g * 38469) + (b * 7471)) >> 16; unsigned int gry8_new = ((r * 19596) + (g * 38470) + (b * 7472)) >> 16; printf("gry_old=%i\n",gry8_old); printf("gry_new=%i\n",gry8_new); return 0; } ``` Reviewers: cedric, raster, zmike, vtorri, Hermet, woohyun, bu5hm4n, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9490
-rw-r--r--src/lib/evas/common/evas_convert_gry_8.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/evas/common/evas_convert_gry_8.c b/src/lib/evas/common/evas_convert_gry_8.c
index 30993ce498..bef3b39de0 100644
--- a/src/lib/evas/common/evas_convert_gry_8.c
+++ b/src/lib/evas/common/evas_convert_gry_8.c
@@ -25,7 +25,7 @@ void evas_common_convert_rgba_to_8bpp_gry_256_dith (DATA32 *src, DATA8 *dst,
b = (B_VAL(src_ptr));
// Y = 0.299 * R + 0.587 * G + 0.114 * B;
- gry8 = ((r * 19595) + (g * 38469) + (b * 7471)) >> 16;
+ gry8 = ((r * 19596) + (g * 38470) + (b * 7472)) >> 16;
*dst_ptr = gry8;
@@ -54,7 +54,7 @@ void evas_common_convert_rgba_to_8bpp_gry_16_dith (DATA32 *src, DATA8 *dst,
b = (B_VAL(src_ptr));
// Y = 0.299 * R + 0.587 * G + 0.114 * B;
- gry8 = ((r * 19595) + (g * 38469) + (b * 7471)) >> 16;
+ gry8 = ((r * 19596) + (g * 38470) + (b * 7472)) >> 16;
if (((gry8 - gry8 * 255 / 4) >= dith) && (gry8 < 0x07)) gry8++;