From 0b6469ec260c6a93d1105a3f8c991ce4f3e3069f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Mon, 28 Nov 2005 20:49:57 +0000 Subject: [PATCH] - fix 'blue tint' on scanning area borders for 1220P/2000P --- ChangeLog | 5 +++++ backend/umax_pp_low.c | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 67ae0f4f0..7760ef410 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-11-28 Stephane Voltz + + * backend/umax_pp_low.c: fixed 'blue tint' on scanning area border + by increasing shading coefficient on dark areas + 2005-11-26 Oliver Schwartz * backend/snapscan-sources.c: Fix lineart mode for Epson 3490 diff --git a/backend/umax_pp_low.c b/backend/umax_pp_low.c index 907cc2f66..3cb1c8949 100644 --- a/backend/umax_pp_low.c +++ b/backend/umax_pp_low.c @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef HAVE_SYS_TIME_H #include #endif @@ -8655,7 +8656,7 @@ EPPcmdGetBuffer610p (int cmd, int len, unsigned char *buffer) #ifdef HAVE_LINUX_PPDEV_H int fd, mode, rc; #endif - int loop, pass, wait, remain; + int loop, wait, remain; /* first we set length and channel */ /* compute word */ @@ -9920,6 +9921,10 @@ evalGain (int sum, int count) int gn; float pct; float avg; + float area=15; + float coeff=2; + float cnst=0.9; + /* after ~ 60 * 10 scans , it looks like 1 step is a 0.57% increase */ /* so we take the value and compute the percent increase to reach 250 */ @@ -9929,6 +9934,18 @@ evalGain (int sum, int count) avg = (float) (sum) / (float) (count); pct = 100.0 - (avg * 100.0) / targetCode; gn = (int) (pct / 0.57); + + /* give gain for dark areas a boost */ + if(getenv("AREA")!=NULL) + cnst=atol(getenv("AREA")); + if(getenv("COEFF")!=NULL) + cnst=atol(getenv("COEFF")); + if(getenv("CNST")!=NULL) + cnst=atol(getenv("CNST")); + + pct = gn; + avg = exp((-pct)/area)*coeff+cnst; + gn = gn * avg; /* bound checking : there are sightings of >127 values being negative */ if (gn < 0)