sm3600: fixed gain table transfer

merge-requests/1/head
Marian Eichholz 2004-04-15 21:06:58 +00:00
rodzic 1664d516d8
commit c8b840399a
5 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -13,6 +13,8 @@
out by Mattias Ellert, thanks: Waiting longer for DoJog() command
completion, new function for transmitting the line gain correction
data with correct endianess, Chassis-Gray-Level lowered.
* backend/sm3600.c : Fixed off-by-one-error in p->lines
backend/sm3600-scanmtek: Fixed just broken UploadGainCorrection()
2004-04-14 Karl Heinz Kremer <khk@khk.net>

Wyświetl plik

@ -271,7 +271,7 @@ TState StartScanColor(TInstance *this)
UploadGammaTable(this,0x4000,this->agammaB);
INST_ASSERT();
UploadGainCorrection(this);
UploadGainCorrection(this,0x6000);
INST_ASSERT();
/* enough for 1/100 inch sensor distance */

Wyświetl plik

@ -346,7 +346,7 @@ TState StartScanGray(TInstance *this)
RegWrite(this,0x40,1,0x20); /* FIFO at 0x08000 */
UploadGammaTable(this,0,this->agammaY); INST_ASSERT();
UploadGainCorrection(this);
UploadGainCorrection(this, 0x2000);
INST_ASSERT();
/* for halftone dithering we need one history line */

Wyświetl plik

@ -280,16 +280,13 @@ UploadGainCorrection()
********************************************************************** */
__SM3600EXPORT__
TState UploadGainCorrection(TInstance *this)
TState UploadGainCorrection(TInstance *this, int iTableOffset)
{
#ifndef SM3600_NO_GAIN_CORRECTION
RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */
RegWrite(this,0x3F,1,0x18); /* 16KB gain at 0x06000 */
{
struct TGain {
unsigned char uchLow;
unsigned char uchHigh;
} aGain[8192];
} aGain[0x2000]; /* 16 KB */
int i,iOff;
unsigned short uwGain;
@ -297,16 +294,17 @@ TState UploadGainCorrection(TInstance *this)
Oopsi: correction data starts at the left of the scanning window!
*/
iOff=this->param.x/2+this->calibration.xMargin;
memset(aGain,0,sizeof(aGain));
memset(aGain,0xFF,sizeof(aGain));
RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */
RegWrite(this,0x3F,1, iTableOffset==0x6000 ? 0x18 : 0x08); /* 16KB gain at 0x06000 or 0x02000 */
for (i=iOff; i<MAX_PIXEL_PER_SCANLINE; i++)
{
uwGain=this->calibration.achStripeY[i]<<4;
aGain[i-iOff].uchLow =(unsigned char)(uwGain&0xFF);
aGain[i-iOff].uchHigh=(unsigned char)(uwGain>>8);
}
for (i=0; i<0x2000; i+=0x1000)
MemWriteArray(this,(0x6000+i)>>1,0x1000,(unsigned char*)(aGain+i));
for (i=0; i<0x4000; i+=0x1000)
MemWriteArray(this,(iTableOffset+i)>>1,0x1000,((unsigned char*)aGain)+i);
}
#endif
return SANE_STATUS_GOOD;
}

Wyświetl plik

@ -283,7 +283,7 @@ __SM3600EXPORT__ TState DoLampSwitch(TInstance *this,int nPattern);
#endif
__SM3600EXPORT__ TState DoCalibration(TInstance *this);
__SM3600EXPORT__ TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma);
__SM3600EXPORT__ TState UploadGainCorrection(TInstance *this);
__SM3600EXPORT__ TState UploadGainCorrection(TInstance *this, int iTableOffset);
/* sm3600-scanusb.c */
__SM3600EXPORT__ TState RegWrite(TInstance *this,int iRegister, int cb, unsigned long ulValue);