Removed obsolete _WAF_BLACKFINE.

LiDE20 does not seem to have a reliable black calibration area, so the
devices now will switch off the lamp for dark calibration.
Fixed line statistics and added calibration data output.
Bumped build number.
merge-requests/1/head
Gerhard Jaeger 2005-08-19 11:55:10 +00:00
rodzic f6bea76bae
commit f512d113f2
6 zmienionych plików z 141 dodań i 112 usunięć

Wyświetl plik

@ -38,6 +38,7 @@
* - added CRYSTAL_FREQ
* - added IPCDef
* - 0.50 - cleanup
* - removed obsolete _WAF_BLACKFINE
* .
* <hr>
* This file is part of the SANE package.

Wyświetl plik

@ -43,7 +43,7 @@
* - 0.50 - tried to use the settings from SANE-1.0.13
* - added _TWEAK_GAIN to allow increasing GAIN during
* lamp coarse calibration
* - added also speedtest
* - added also speedtest
*
* This file is part of the SANE package.
*
@ -136,8 +136,8 @@ static int cano_PrepareToReadBlackCal( Plustek_Device *dev )
if( strip_state != 2 ) {
/*
* if we have dark shading strip, there's no need to switch
* the lamp off
* if we have a dark shading strip, there's no need to switch
* the lamp off, leave in on a go to that strip
*/
if( dev->usbDev.pSource->DarkShadOrgY >= 0 ) {
@ -678,10 +678,11 @@ static int cano_GetNewOffset( Plustek_Device *dev, u_long *val, int channel,
static int cano_AdjustOffset( Plustek_Device *dev )
{
char tmp[40];
int i, adj;
u_long dw, dwPixels;
u_long dwSum[3];
char tmp[40];
int i, adj;
u_short r, g, b;
u_long dw, dwPixels;
u_long dwSum[3];
signed char low[3] = {-32,-32,-32 };
signed char now[3] = { 0, 0, 0 };
@ -729,7 +730,7 @@ static int cano_AdjustOffset( Plustek_Device *dev )
return SANE_FALSE;
}
DBG( _DBG_INFO2, "S.dwPixels = %lu\n", m_ScanParam.Size.dwPixels );
DBG( _DBG_INFO2, "S.dwPixels = %lu\n", m_ScanParam.Size.dwPixels );
DBG( _DBG_INFO2, "dwPixels = %lu\n", dwPixels );
DBG( _DBG_INFO2, "dwPhyBytes = %lu\n", m_ScanParam.Size.dwPhyBytes );
DBG( _DBG_INFO2, "dwPhyPixels = %lu\n", m_ScanParam.Size.dwPhyPixels );
@ -759,25 +760,28 @@ static int cano_AdjustOffset( Plustek_Device *dev )
if( hw->bReg_0x26 & _ONE_CH_COLOR ) {
dwSum[0] += ((u_short*)scanbuf)[dw];
dwSum[1] += ((u_short*)
scanbuf)[dw+m_ScanParam.Size.dwPhyPixels+1];
dwSum[2] += ((u_short*)
scanbuf)[dw+(m_ScanParam.Size.dwPhyPixels+1)*2];
r = ((u_short*)scanbuf)[dw];
g = ((u_short*)scanbuf)[dw+m_ScanParam.Size.dwPhyPixels+1];
b = ((u_short*)scanbuf)[dw+(m_ScanParam.Size.dwPhyPixels+1)*2];
} else {
dwSum[0] += ((RGBUShortDef*)scanbuf)[dw].Red;
dwSum[1] += ((RGBUShortDef*)scanbuf)[dw].Green;
dwSum[2] += ((RGBUShortDef*)scanbuf)[dw].Blue;
r = ((RGBUShortDef*)scanbuf)[dw].Red;
g = ((RGBUShortDef*)scanbuf)[dw].Green;
b = ((RGBUShortDef*)scanbuf)[dw].Blue;
}
dwSum[0] += r;
dwSum[1] += g;
dwSum[2] += b;
}
DBG( _DBG_INFO2, "RedSum = %lu, ave = %lu\n",
dwSum[0], dwSum[0]/dwPixels );
dwSum[0], dwSum[0]/dwPixels );
DBG( _DBG_INFO2, "GreenSum = %lu, ave = %lu\n",
dwSum[1], dwSum[1] /dwPixels );
dwSum[1], dwSum[1] /dwPixels );
DBG( _DBG_INFO2, "BlueSum = %lu, ave = %lu\n",
dwSum[2], dwSum[2] /dwPixels );
dwSum[2], dwSum[2] /dwPixels );
/* do averaging for each channel */
dwSum[0] /= dwPixels;
@ -801,7 +805,7 @@ static int cano_AdjustOffset( Plustek_Device *dev )
for( dw = 0; dw < dwPixels; dw++ )
dwSum[0] += ((u_short*)scanbuf)[dw];
dwSum [0] /= dwPixels;
dwSum[0] /= dwPixels;
DBG( _DBG_INFO2, "Sum=%lu, ave=%lu\n", dwSum[0],dwSum[0]/dwPixels);
adj = cano_GetNewOffset( dev, dwSum, 0, low, now, high );
@ -821,8 +825,8 @@ static int cano_AdjustOffset( Plustek_Device *dev )
}
if( m_ScanParam.bDataType == SCANDATATYPE_Color ) {
dev->usbDev.a_bRegs[0x38] = now[0];
dev->usbDev.a_bRegs[0x39] = now[1];
dev->usbDev.a_bRegs[0x38] = now[0];
dev->usbDev.a_bRegs[0x39] = now[1];
dev->usbDev.a_bRegs[0x3a] = now[2];
} else {
dev->usbDev.a_bRegs[0x38] =
@ -951,9 +955,6 @@ static SANE_Bool cano_AdjustDarkShading( Plustek_Device *dev )
a_wDarkShading[i+stepW*2] = (u_short)val;
}
if(usb_HostSwap())
usb_Swap(a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2 * 3 );
} else {
step = m_ScanParam.Size.dwPhyPixels + 1;
@ -967,8 +968,6 @@ static SANE_Bool cano_AdjustDarkShading( Plustek_Device *dev )
}
a_wDarkShading[i]= gray/j + param->swOffset[0];
}
if(usb_HostSwap())
usb_Swap(a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2 );
memcpy( a_wDarkShading + m_ScanParam.Size.dwPhyPixels * 2,
a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2);
@ -976,6 +975,9 @@ static SANE_Bool cano_AdjustDarkShading( Plustek_Device *dev )
a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2);
}
if(usb_HostSwap())
usb_Swap(a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2 * 3 );
usb_line_statistics( "Dark", a_wDarkShading, m_ScanParam.Size.dwPhyPixels,
scan->sParam.bDataType == SCANDATATYPE_Color?1:0);

Wyświetl plik

@ -52,6 +52,9 @@
* - 0.49 - tweaked motor settings for EPSON and CANON1200
* - added support for CanoScan LiDE25
* - 0.50 - cleanup
* - removed obsolete _WAF_BLACKFINE
* - LiDE20 does not seem to have a reliable black calibration area
* so the devices now will switch off the lamp for dark calibration
* .
* <hr>
* This file is part of the SANE package.
@ -628,7 +631,7 @@ static DCapsDef Cap0x04A9_0x2206 =
1, /* number of buttons */
kCIS650, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS, _NO_MIO
};
/* Canon N1220U
@ -646,7 +649,7 @@ static DCapsDef Cap0x04A9_0x2207 =
1, /* number of buttons */
kCIS1220, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS, _NO_MIO
};
/* Canon D660U
@ -664,7 +667,7 @@ static DCapsDef Cap0x04A9_0x2208 =
1,
kNEC8861, /* use default settings during calibration */
0,
(_WAF_MISC_IO_LAMPS | _WAF_BIN_FROM_COLOR | _WAF_GRAY_FROM_COLOR),
(_WAF_MISC_IO_LAMPS | _WAF_BIN_FROM_COLOR | _WAF_GRAY_FROM_COLOR),
_MIO5 + _TPA(_MIO6)
};
@ -672,7 +675,7 @@ static DCapsDef Cap0x04A9_0x2208 =
*/
static DCapsDef Cap0x04A9_0x220D =
{
{{ 0, 110}, 35, 10, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
{{ 0, 110}, 35, -1, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
@ -683,7 +686,7 @@ static DCapsDef Cap0x04A9_0x220D =
3, /* number of buttons */
kCIS670,
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS, _NO_MIO
};
/* Canon N1240U/LiDE30
@ -701,7 +704,7 @@ static DCapsDef Cap0x04A9_0x220E =
3, /* number of buttons */
kCIS1240, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS, _NO_MIO
};
/* Canon LiDE25
@ -719,7 +722,7 @@ static DCapsDef Cap0x04A9_0x2220 =
3, /* number of buttons */
kCIS1240, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS, _NO_MIO
};
/******************* additional Hardware descriptions ************************/

Wyświetl plik

@ -1047,13 +1047,13 @@ static void usb_GetPauseLimit( Plustek_Device *dev, ScanParam *pParam )
/* If not reversing, take into account the steps to reverse */
if( regs[0x50] == 0 )
m_dwPauseLimit -= ((regs[0x54] & 7) *
(pParam->Size.dwPhyBytes * scaler) + 1023) / 1024;
(pParam->Size.dwPhyBytes * scaler) + 1023) / 1024;
DBG( _DBG_INFO2, "* PL=%lu, coeffsize=%u, scaler=%u\n",
m_dwPauseLimit, coeffsize, scaler );
m_dwPauseLimit = usb_max( usb_min(m_dwPauseLimit,
(u_long)ceil(pParam->Size.dwTotalBytes / 1024.0)), 2);
(u_long)ceil(pParam->Size.dwTotalBytes / 1024.0)), 2);
regs[0x4e] = (u_char)floor((m_dwPauseLimit*512.0)/(2.0*hw->wDRAMSize));
@ -1104,6 +1104,7 @@ static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, ScanParam *pParam )
{
static u_char reg8, reg38[6], reg48[2];
ScanDef *scan = &dev->scanning;
ScanParam *pdParam = &dev->scanning.sParam;
HWDef *hw = &dev->usbDev.HwSetting;
u_char *regs = dev->usbDev.a_bRegs;

Wyświetl plik

@ -29,6 +29,7 @@
* - 0.49 - a_bRegs is now part of the device structure
* - using now PhyDpi.y as selector for the motor MCLK range
* - 0.50 - readded kCIS670 to add 5% extra to LiDE20 fine calibration
* - fixed line statistics and added data output
* .
* <hr>
* This file is part of the SANE package.
@ -95,45 +96,54 @@ static RGBByteDef Gain_Reg;
static u_long m_dwPixels;
static ScanParam m_ScanParam;
static u_long m_dwIdealGain;
static u_long m_dwIdealGain;
static double dMCLK, dExpect, dMax;
static double dMCLK_ADF;
/**
/** do some statistics...
*/
static void usb_line_statistics( char *cmt, u_short* buf,
u_long dim_x, SANE_Bool color )
{
int i, end;
char fn[50];
int i, channel;
u_long dw, imad, imid, alld, cld, cud;
u_short mid, mad, aved, lbd, ubd, tmp;
MonoWordDef *pvd, *pvd2;
FILE *fp;
SANE_Bool swap = usb_HostSwap();
pvd = pvd2 = (MonoWordDef*)buf;
if( color )
end = 3;
channel = 3;
else
end = 1;
channel = 1;
for( i = 0; i < end; i++ ) {
for( i = 0; i < channel; i++ ) {
mid = 0xFFFF;
mad = 0;
imid = 0;
imad = 0;
alld = 0;
cld = 0;
cud = 0;
fp = NULL;
if( DBG_LEVEL >= _DBG_DCALDATA ) {
sprintf( fn, "%scal%u.dat", cmt, i );
fp = fopen( fn, "w+b" );
if( fp == NULL )
DBG( _DBG_ERROR, "Could not open %s\n", fn );
}
/* do the standard min/max stuff */
for( dw = 0; dw < dim_x; pvd++, dw++ ) {
#ifdef SWAP_FINE
tmp = pvd->Mono;
#else
tmp = _LOBYTE(pvd->Mono) * 256 + _HIBYTE(pvd->Mono);
#endif
if( swap )
tmp = _LOBYTE(pvd->Mono) * 256 + _HIBYTE(pvd->Mono);
else
tmp = pvd->Mono;
if( tmp > mad ) {
mad = tmp;
@ -145,33 +155,40 @@ static void usb_line_statistics( char *cmt, u_short* buf,
imid = dw;
}
alld += tmp;
}
if( fp )
fprintf(fp, "%u\n", tmp );
alld += tmp;
}
if( fp )
fclose(fp);
/* calculate average and 5% limit */
aved = (u_short)(alld/dim_x);
lbd = aved - 0.05*aved;
ubd = aved + 0.05*aved;
cld = 0;
cud = 0;
/* find the number of values beyond the 5% limits */
for( dw = 0; dw < dim_x; pvd2++, dw++ ) {
#ifdef SWAP_FINE
tmp = pvd2->Mono;
#else
tmp = _LOBYTE(pvd2->Mono) * 256 + _HIBYTE(pvd2->Mono);
#endif
if( swap )
tmp = _LOBYTE(pvd2->Mono) * 256 + _HIBYTE(pvd2->Mono);
else
tmp = pvd2->Mono;
if( tmp > ubd ) {
cud++;
} else if( tmp < lbd ) {
cld++;
}
if( tmp > ubd ) cud++;
if( tmp < lbd ) cld++;
}
DBG( _DBG_INFO2, "Color[%u] (%s) : "
"min=%u(%lu) max=%u(%lu) ave=%u\n",
i, cmt, mid, imid, mad, imad, aved);
DBG( _DBG_INFO2, "5%%: %u (%lu), %u (%lu)\n", lbd, cld,ubd,cud);
}
DBG( _DBG_INFO2, "Color[%u] (%s): %lu pixels "
"min=%u(%lu) max=%u(%lu) ave=%u\n",
i, cmt, dim_x, mid, imid, mad, imad, aved);
DBG( _DBG_INFO2, "5%%: low@%u (count=%lu), upper@%u (count=%lu)\n",
lbd, cld, ubd, cud);
}
}
/**
@ -1386,9 +1403,8 @@ static SANE_Bool usb_AdjustOffset( Plustek_Device *dev )
/** this function tries to find out some suitable values for the dark
* fine calibration. If the device owns a black calibration strip
* (never saw one yet - _WAF_BLACKFINE is set then), the data is simply
* copied. If not, then the white strip is read with the lamp switched
* off...
* the data is simply copied. If not, then the white strip is read
* with the lamp switched off...
*/
static void usb_GetDarkShading( Plustek_Device *dev, u_short *pwDest,
HiLoDef *pSrce, u_long dwPixels,
@ -1399,8 +1415,8 @@ static void usb_GetDarkShading( Plustek_Device *dev, u_short *pwDest,
DCapsDef *scaps = &dev->usbDev.Caps;
HWDef *hw = &dev->usbDev.HwSetting;
if( scaps->workaroundFlag & _WAF_BLACKFINE )
{
if( dev->usbDev.pSource->DarkShadOrgY >= 0 ) {
u_short w;
int wtmp;
@ -1412,14 +1428,14 @@ static void usb_GetDarkShading( Plustek_Device *dev, u_short *pwDest,
#else
wtmp = (*((int*)pSrce) + iOffset);
#endif
if( wtmp < 0 )
wtmp = 0;
if( wtmp < 0 )
wtmp = 0;
if( wtmp > 0xffff )
wtmp = 0xffff;
w = (u_short)wtmp;
w = (u_short)wtmp;
#ifndef SWAP_FINE
pwDest[dw] = _LOBYTE(w) * 256 + _HIBYTE(w);
#else
@ -1458,9 +1474,9 @@ static void usb_GetDarkShading( Plustek_Device *dev, u_short *pwDest,
dwSum[1] = 0;
#ifndef SWAP_FINE
dwSum[0] = (u_long)_LOBYTE(_LOWORD(dwSum[0])) * 256UL +
_HIBYTE(_LOWORD(dwSum[0]));
_HIBYTE(_LOWORD(dwSum[0]));
dwSum[1] = (u_long)_LOBYTE(_LOWORD(dwSum[1])) * 256UL +
_HIBYTE(_LOWORD(dwSum[1]));
_HIBYTE(_LOWORD(dwSum[1]));
#else
dwSum[0] = (u_long)_LOWORD(dwSum[0]);
dwSum[1] = (u_long)_LOWORD(dwSum[1]);
@ -1489,7 +1505,7 @@ static void usb_GetDarkShading( Plustek_Device *dev, u_short *pwDest,
dwSum[0] = 0;
#ifndef SWAP_FINE
dwSum[0] = (u_long)_LOBYTE(_LOWORD(dwSum[0])) * 256UL +
_HIBYTE(_LOWORD(dwSum[0]));
_HIBYTE(_LOWORD(dwSum[0]));
#else
dwSum[0] = (u_long)_LOWORD(dwSum[0]);
#endif
@ -1514,7 +1530,7 @@ static void usb_GetDarkShading( Plustek_Device *dev, u_short *pwDest,
static SANE_Bool usb_AdjustDarkShading( Plustek_Device *dev )
{
char tmp[40];
ScanDef *scanning = &dev->scanning;
ScanDef *scanning = &dev->scanning;
DCapsDef *scaps = &dev->usbDev.Caps;
HWDef *hw = &dev->usbDev.HwSetting;
u_char *scanbuf = scanning->pScanBuffer;
@ -1529,7 +1545,7 @@ static SANE_Bool usb_AdjustDarkShading( Plustek_Device *dev )
DBG( _DBG_INFO, "#########################\n" );
DBG( _DBG_INFO, "usb_AdjustDarkShading()\n" );
DBG( _DBG_INFO2, "* MCLK = %f (scanparam-MCLK=%f)\n",
dMCLK, scanning->sParam.dMCLK );
dMCLK, scanning->sParam.dMCLK );
m_ScanParam = scanning->sParam;
m_ScanParam.Origin.y = 0;
@ -1537,14 +1553,14 @@ static SANE_Bool usb_AdjustDarkShading( Plustek_Device *dev )
m_ScanParam.Size.dwLines = 1; /* for gain */
m_ScanParam.bBitDepth = 16;
m_ScanParam.bCalibration = PARAM_DarkShading;
m_ScanParam.dMCLK = dMCLK;
m_ScanParam.dMCLK = dMCLK;
if( _LM9831 == hw->chip ) {
m_ScanParam.UserDpi.x = usb_SetAsicDpiX( dev, m_ScanParam.UserDpi.x);
if( m_ScanParam.UserDpi.x < 100)
if( m_ScanParam.UserDpi.x < 100)
m_ScanParam.UserDpi.x = 150;
/* Now DPI X is physical */
m_ScanParam.Origin.x = m_ScanParam.Origin.x %
(u_short)m_dHDPIDivider;
@ -1556,7 +1572,7 @@ static SANE_Bool usb_AdjustDarkShading( Plustek_Device *dev )
m_ScanParam.UserDpi.x / scanning->sParam.UserDpi.x;
} else {
m_ScanParam.Size.dwBytes = m_ScanParam.Size.dwPixels *
2 * m_ScanParam.bChannels;
2 * m_ScanParam.bChannels;
}
if( hw->bReg_0x26 & _ONE_CH_COLOR &&
@ -1564,15 +1580,14 @@ static SANE_Bool usb_AdjustDarkShading( Plustek_Device *dev )
m_ScanParam.Size.dwBytes *= 3;
}
/*
* if we have dark shading strip, there's no need to switch
* the lamp off
/* if we have dark shading strip, there's no need to switch
* the lamp off
*/
if( dev->usbDev.pSource->DarkShadOrgY >= 0 ) {
usb_ModuleToHome( dev, SANE_TRUE );
usb_ModuleMove ( dev, MOVE_Forward,
(u_long)dev->usbDev.pSource->DarkShadOrgY );
(u_long)dev->usbDev.pSource->DarkShadOrgY );
} else {
/* switch lamp off to read dark data... */
@ -1586,18 +1601,16 @@ static SANE_Bool usb_AdjustDarkShading( Plustek_Device *dev )
(!usb_ScanReadImage(dev,scanbuf, m_ScanParam.Size.dwPhyBytes)) ||
(!usb_ScanEnd( dev ))) {
/* on error, reset the lamp settings*/
/* on error, reset the lamp settings*/
regs[0x29] = hw->bReg_0x29;
usb_switchLamp( dev, SANE_TRUE );
usb_switchLamp( dev, SANE_TRUE );
usbio_WriteReg( dev->fd, 0x29, regs[0x29] );
DBG( _DBG_ERROR, "usb_AdjustDarkShading() failed\n" );
return SANE_FALSE;
}
/*
* set illumination mode and switch lamp on again
/* set illumination mode and switch lamp on again
*/
regs[0x29] = hw->bReg_0x29;
usb_switchLamp( dev, SANE_TRUE );
@ -1605,7 +1618,7 @@ static SANE_Bool usb_AdjustDarkShading( Plustek_Device *dev )
if( !usbio_WriteReg( dev->fd, 0x29, regs[0x29])) {
DBG( _DBG_ERROR, "usb_AdjustDarkShading() failed\n" );
return SANE_FALSE;
}
}
#ifdef SWAP_FINE
if(usb_HostSwap())
@ -2024,13 +2037,13 @@ static SANE_Bool usb_AdjustWhiteShading( Plustek_Device *dev )
if(usb_HostSwap()) {
#endif
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels *
m_ScanParam.bChannels; dw++) {
m_ScanParam.bChannels; dw++) {
pwDest[dw] = _HILO2WORD( pwSrce[dw] );
}
#ifdef SWAP_FINE
} else {
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels *
m_ScanParam.bChannels; dw++) {
m_ScanParam.bChannels; dw++) {
pwDest[dw] = ((u_short*)pwSrce)[dw];
}
}
@ -2052,8 +2065,8 @@ static SANE_Bool usb_AdjustWhiteShading( Plustek_Device *dev )
for( i = 0; i < 3; i++ ) {
for( dw = m_ScanParam.Size.dwPhyPixels;
dw; dw--, pValue++, pdw++) {
for(dw=m_ScanParam.Size.dwPhyPixels; dw; dw--,pValue++,pdw++) {
*pdw = *pdw * 1000 / ((shading_lines - hilight - shadow) *
scan->sParam.swGain[i]);
if(*pdw > 65535U)
@ -2067,7 +2080,7 @@ static SANE_Bool usb_AdjustWhiteShading( Plustek_Device *dev )
pValue->Mono = GAIN_Target;
#ifdef SWAP_FINE
if( swap )
if( swap )
#endif
_SWAP(pValue->HiLo.bHi, pValue->HiLo.bLo);
}
@ -2075,6 +2088,8 @@ static SANE_Bool usb_AdjustWhiteShading( Plustek_Device *dev )
} else {
for( dw = m_ScanParam.Size.dwPhyPixels*3; dw; dw--,pValue++,pdw++)
pValue->Mono=(u_short)(*pdw/(shading_lines-hilight-shadow));
/* swapping will be done later in usb_ResizeWhiteShading() */
}
} else {
@ -2155,16 +2170,19 @@ static SANE_Bool usb_AdjustWhiteShading( Plustek_Device *dev )
}
} else{
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels; dw++ ) {
pValue[dw].Mono = (u_short)(pdw[dw] /
(shading_lines - hilight - shadow));
/* swapping will be done later... */
/* swapping will be done later in usb_ResizeWhiteShading() */
}
}
}
usb_line_statistics( "White", a_wWhiteShading, m_ScanParam.Size.dwPhyPixels,
scan->sParam.bDataType == SCANDATATYPE_Color?1:0);
if( scan->sParam.bSource != SOURCE_Negative ) {
usb_line_statistics( "White", a_wWhiteShading, m_ScanParam.Size.dwPhyPixels,
scan->sParam.bDataType == SCANDATATYPE_Color?1:0);
}
return SANE_TRUE;
}
@ -2531,8 +2549,8 @@ static int usb_DoCalibration( Plustek_Device *dev )
DBG( _DBG_INFO, "DataOrigin.x=%u, DataOrigin.y=%u\n",
dev->usbDev.pSource->DataOrigin.x, dev->usbDev.pSource->DataOrigin.y);
if(!usb_ModuleMove( dev, MOVE_Forward,
(dev->usbDev.pSource->DataOrigin.y +
dev->usbDev.pSource->Size.y / 2))) {
(dev->usbDev.pSource->DataOrigin.y +
dev->usbDev.pSource->Size.y / 2))) {
return _E_LAMP_NOT_IN_POS;
}
@ -2543,12 +2561,12 @@ static int usb_DoCalibration( Plustek_Device *dev )
if((hw->motorModel == MODEL_HuaLien) && (scaps->OpticDpi.x==600)) {
if (!usb_ModuleMove(dev, MOVE_ToShading,
(u_long)dev->usbDev.pSource->ShadingOriginY)) {
(u_long)dev->usbDev.pSource->ShadingOriginY)) {
return _E_LAMP_NOT_IN_POS;
}
} else {
if( !usb_ModuleMove(dev, MOVE_Forward,
(u_long)dev->usbDev.pSource->ShadingOriginY)) {
(u_long)dev->usbDev.pSource->ShadingOriginY)) {
return _E_LAMP_NOT_IN_POS;
}
}
@ -2629,14 +2647,14 @@ static int usb_DoCalibration( Plustek_Device *dev )
DBG( _DBG_INFO, "GainGreen = %u\n", regs[0x3c] );
DBG( _DBG_INFO, "GainBlue = %u\n", regs[0x3d] );
#if 0
#if 0
if( !usb_ModuleMove( dev, MOVE_Backward,
dev->usbDev.pSource->DataOrigin.y +
dev->usbDev.pSource->Size.y / 2 -
dev->usbDev.pSource->ShadingOriginY)) {
return _E_LAMP_NOT_IN_POS;
}
#endif
#endif
regs[0x45] &= ~0x10;
regs[0x3b] = regs[0x3c] = regs[0x3d] = 1;
@ -2679,6 +2697,8 @@ static int usb_DoCalibration( Plustek_Device *dev )
m_ScanParam.Size.dwPhyPixels*2,
scanning->sParam.swGain[2]);
}
usb_line_statistics( "White", a_wWhiteShading,
m_ScanParam.Size.dwPhyPixels, SANE_TRUE);
break;
case SOURCE_ADF:

Wyświetl plik

@ -77,6 +77,7 @@
* - moved AFE stuff to enhanced options
* - 0.50 - cleanup
* - activated IPC stuff
* - added _DBG_DCALDATA for fine calibration data logging
*.
* <hr>
* This file is part of the SANE package.
@ -152,7 +153,7 @@
#include "../include/sane/sanei.h"
#include "../include/sane/saneopts.h"
#define BACKEND_VERSION "0.50-1"
#define BACKEND_VERSION "0.50-2"
#define BACKEND_NAME plustek
#include "../include/sane/sanei_access.h"
@ -175,6 +176,7 @@
#define _DBG_SANE_INIT 10
#define _DBG_INFO2 15
#define _DBG_DREGS 20
#define _DBG_DCALDATA 22
#define _DBG_DPIC 25
#define _DBG_READ 30