From: Andreas Baierl <ich...@imkreisrum.de>

There is some bogus code, which calculates the variable bright four times.
This typo is corrected and also the calculation is adapted to deliver the
right range for bright, contrast, saturation and hue from 0-63.
Before, when the maximum value (100) was given to the function,
calculation returned 64, which is wrong due to the possible range 0-63.

Signed-off-by: Andreas Baierl <ich...@imkreisrum.de>
---
 drivers/video/sunxi/disp/de_fe.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/video/sunxi/disp/de_fe.c b/drivers/video/sunxi/disp/de_fe.c
index 92799a0..9e4a28f 100644
--- a/drivers/video/sunxi/disp/de_fe.c
+++ b/drivers/video/sunxi/disp/de_fe.c
@@ -1382,10 +1382,10 @@ __s32 DE_SCAL_Set_CSC_Coef_Enhance(__u8 sel, __u8 
in_csc_mode,
        __u32 i;
        __s32 sinv, cosv; /* sin_tab: 7 bit fractional */
 
-       bright = bright * 64 / 100;
-       bright = saturation * 64 / 100;
-       bright = contrast * 64 / 100;
-       bright = hue * 64 / 100;
+       bright = ((bright * 63) + 50) / 100;
+       saturation = ((saturation * 63) + 50) / 100;
+       contrast = ((contrast * 63) + 50) / 100;
+       hue = ((hue * 63) + 50) / 100;
 
        sinv = image_enhance_tab[8 * 12 + (hue & 0x3f)];
        cosv = image_enhance_tab[8 * 12 + 8 * 8 + (hue & 0x3f)];
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to