| author | Marian Eichholz <eichholz@computer.org> | |
| Thu, 15 Apr 2004 21:06:58 +0000 (21:06 +0000) | ||
| committer | Marian Eichholz <eichholz@computer.org> | |
| Thu, 15 Apr 2004 21:06:58 +0000 (21:06 +0000) |
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
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>
diff --git a/backend/sm3600-color.c b/backend/sm3600-color.c
--- a/backend/sm3600-color.c
+++ b/backend/sm3600-color.c
UploadGammaTable(this,0x4000,this->agammaB);
INST_ASSERT();
- UploadGainCorrection(this);
+ UploadGainCorrection(this,0x6000);
INST_ASSERT();
/* enough for 1/100 inch sensor distance */
diff --git a/backend/sm3600-gray.c b/backend/sm3600-gray.c
--- a/backend/sm3600-gray.c
+++ b/backend/sm3600-gray.c
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 */
********************************************************************** */
__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;
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;
}
diff --git a/backend/sm3600.h b/backend/sm3600.h
--- a/backend/sm3600.h
+++ b/backend/sm3600.h
#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);
