kopia lustrzana https://gitlab.com/sane-project/backends
Break remaining long lines.
rodzic
25242ff9c8
commit
a6b15f18cc
|
@ -122,19 +122,19 @@ static SANE_String_Const source_list[] = {
|
|||
0
|
||||
};
|
||||
static Scanner_Model mustek_A2nu2_model = {
|
||||
"Mustek", /* Device vendor string */
|
||||
"BearPaw 2448TA Pro", /* Device model name */
|
||||
"Mustek", /* Device vendor string */
|
||||
"BearPaw 2448TA Pro", /* Device model name */
|
||||
|
||||
{1200, 600, 300, 150, 75, 0}, /* possible resolutions */
|
||||
{1200, 600, 300, 150, 75, 0}, /* possible resolutions */
|
||||
|
||||
SANE_FIX (8.3 * MM_PER_INCH), /* Size of scan area in mm (x) */
|
||||
SANE_FIX (11.6 * MM_PER_INCH), /* Size of scan area in mm (y) */
|
||||
SANE_FIX (11.6 * MM_PER_INCH), /* Size of scan area in mm (y) */
|
||||
|
||||
SANE_FIX (1.46 * MM_PER_INCH), /* Size of scan area in TA mode in mm (x) */
|
||||
SANE_FIX (6.45 * MM_PER_INCH), /* Size of scan area in TA mode in mm (y) */
|
||||
SANE_FIX (1.46 * MM_PER_INCH), /* Size of scan area in TA mode in mm (x) */
|
||||
SANE_FIX (6.45 * MM_PER_INCH), /* Size of scan area in TA mode in mm (y) */
|
||||
|
||||
RO_RGB, /* Order of the CCD/CIS colors */
|
||||
SANE_FIX (2.0) /* Default gamma value */
|
||||
RO_RGB, /* Order of the CCD/CIS colors */
|
||||
SANE_FIX (2.0) /* Default gamma value */
|
||||
};
|
||||
|
||||
|
||||
|
@ -233,14 +233,14 @@ calc_parameters (Mustek_Scanner * s)
|
|||
}
|
||||
|
||||
|
||||
s->setpara.fmArea.x1 =
|
||||
(unsigned short) ((SANE_UNFIX (s->val[OPT_TL_X].w) * 300.0) / MM_PER_INCH + 0.5);
|
||||
s->setpara.fmArea.x2 =
|
||||
(unsigned short) ((SANE_UNFIX (s->val[OPT_BR_X].w) * 300.0) / MM_PER_INCH + 0.5);
|
||||
s->setpara.fmArea.y1 =
|
||||
(unsigned short) ((SANE_UNFIX (s->val[OPT_TL_Y].w) * 300.0) / MM_PER_INCH + 0.5);
|
||||
s->setpara.fmArea.y2 =
|
||||
(unsigned short) ((SANE_UNFIX (s->val[OPT_BR_Y].w) * 300.0) / MM_PER_INCH + 0.5);
|
||||
s->setpara.fmArea.x1 = (unsigned short) ((SANE_UNFIX (s->val[OPT_TL_X].w) *
|
||||
300.0) / MM_PER_INCH + 0.5);
|
||||
s->setpara.fmArea.x2 = (unsigned short) ((SANE_UNFIX (s->val[OPT_BR_X].w) *
|
||||
300.0) / MM_PER_INCH + 0.5);
|
||||
s->setpara.fmArea.y1 = (unsigned short) ((SANE_UNFIX (s->val[OPT_TL_Y].w) *
|
||||
300.0) / MM_PER_INCH + 0.5);
|
||||
s->setpara.fmArea.y2 = (unsigned short) ((SANE_UNFIX (s->val[OPT_BR_Y].w) *
|
||||
300.0) / MM_PER_INCH + 0.5);
|
||||
|
||||
s->setpara.wLinearThreshold = s->val[OPT_THRESHOLD].w;
|
||||
|
||||
|
@ -636,9 +636,8 @@ SetParameters (LPSETPARAMETERS pSetParameters)
|
|||
|
||||
for (i = 0; i < 65536; i++)
|
||||
{
|
||||
wGammaData =
|
||||
(unsigned short) (pow ((((float) i) / 65536.0), (((float) 10) / 16.0)) *
|
||||
65535);
|
||||
wGammaData = (unsigned short) (pow ((((float) i) / 65536.0),
|
||||
(((float) 10) / 16.0)) * 65535);
|
||||
|
||||
*(g_pGammaTable + i) = wGammaData;
|
||||
*(g_pGammaTable + i + 65536) = wGammaData;
|
||||
|
@ -1203,7 +1202,7 @@ AutoLevel (SANE_Byte *lpSource, unsigned short ScanLines,
|
|||
}
|
||||
|
||||
|
||||
/****************************** SANE API functions *****************************/
|
||||
/****************************** SANE API functions ****************************/
|
||||
|
||||
SANE_Status
|
||||
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
||||
|
@ -1753,9 +1752,8 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len,
|
|||
|
||||
|
||||
|
||||
lines_read =
|
||||
(maxbuffersize <
|
||||
(SANE_Int) s->scan_buffer_len) ? maxbuffersize : (SANE_Int) s->scan_buffer_len;
|
||||
lines_read = (maxbuffersize < (SANE_Int) s->scan_buffer_len) ?
|
||||
maxbuffersize : (SANE_Int) s->scan_buffer_len;
|
||||
DBG (DBG_DBG, "sane_read: after %d\n", lines_read);
|
||||
|
||||
*len = (SANE_Int) lines_read;
|
||||
|
|
|
@ -1059,7 +1059,8 @@ MustScanner_GetRgb24BitLine (SANE_Byte * lpLine, SANE_Bool isOrderInvert,
|
|||
}
|
||||
else
|
||||
{
|
||||
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: isOrderInvert is SANE_TRUE\n");
|
||||
DBG (DBG_FUNC, "MustScanner_GetRgb24BitLine: isOrderInvert is " \
|
||||
"SANE_TRUE\n");
|
||||
while (TotalXferLines < wWantedTotalLines)
|
||||
{
|
||||
if (g_dwTotalTotalXferLines >= g_SWHeight)
|
||||
|
|
|
@ -47,11 +47,14 @@
|
|||
|
||||
|
||||
static SANE_Bool Reflective_Reset (void);
|
||||
static SANE_Bool Reflective_SetupScan (COLORMODE ColorMode, unsigned short XDpi, unsigned short YDpi,
|
||||
unsigned short X, unsigned short Y, unsigned short Width,
|
||||
unsigned short Height);
|
||||
static SANE_Bool Reflective_SetupScan (COLORMODE ColorMode,
|
||||
unsigned short XDpi, unsigned short YDpi,
|
||||
unsigned short X, unsigned short Y,
|
||||
unsigned short Width,
|
||||
unsigned short Height);
|
||||
static SANE_Bool Reflective_AdjustAD (void);
|
||||
static SANE_Bool Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY);
|
||||
static SANE_Bool Reflective_FindTopLeft (unsigned short * lpwStartX,
|
||||
unsigned short * lpwStartY);
|
||||
static SANE_Bool Reflective_LineCalibration16Bits (void);
|
||||
|
||||
|
||||
|
@ -297,19 +300,19 @@ Reflective_SetupScan (COLORMODE ColorMode,
|
|||
|
||||
if (Reflective_LineCalibration16Bits () == SANE_FALSE)
|
||||
{
|
||||
DBG (DBG_FUNC,
|
||||
"Reflective_SetupScan: Reflective_LineCalibration16Bits return error\n");
|
||||
DBG (DBG_FUNC, "Reflective_SetupScan: Reflective_LineCalibration16Bits " \
|
||||
"return error\n");
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
DBG (DBG_FUNC,
|
||||
"Reflective_SetupScan: after Reflective_LineCalibration16Bits,g_X=%d,g_Y=%d\n",
|
||||
DBG (DBG_FUNC, "Reflective_SetupScan: " \
|
||||
"after Reflective_LineCalibration16Bits,g_X=%d,g_Y=%d\n",
|
||||
g_X, g_Y);
|
||||
|
||||
DBG (DBG_FUNC, "Reflective_SetupScan: before Asic_SetWindow\n");
|
||||
|
||||
DBG (DBG_FUNC,
|
||||
"Reflective_SetupScan: g_bScanBits=%d, g_XDpi=%d, g_YDpi=%d, g_X=%d, g_Y=%d, g_Width=%d, g_Height=%d\n",
|
||||
DBG (DBG_FUNC, "Reflective_SetupScan: g_bScanBits=%d,g_XDpi=%d,g_YDpi=%d," \
|
||||
"g_X=%d,g_Y=%d,g_Width=%d,g_Height=%d\n",
|
||||
g_bScanBits, g_XDpi, g_YDpi, g_X, g_Y, g_Width, g_Height);
|
||||
|
||||
if (g_Y > 300)
|
||||
|
@ -340,16 +343,17 @@ Reflective_AdjustAD (void)
|
|||
SANE_Byte * lpCalData;
|
||||
unsigned short wCalWidth;
|
||||
int nTimesOfCal;
|
||||
unsigned short wMaxValueR, wMinValueR, wMaxValueG, wMinValueG, wMaxValueB, wMinValueB;
|
||||
unsigned short wMaxValueR, wMaxValueG, wMaxValueB;
|
||||
unsigned short wMinValueR, wMinValueG, wMinValueB;
|
||||
#if 0
|
||||
SANE_Byte bDarkMaxLevel;
|
||||
SANE_Byte bDarkMinLevel;
|
||||
SANE_Byte bLastMinR, bLastROffset, bROffsetUpperBound = 255, bROffsetLowerBound =
|
||||
0;
|
||||
SANE_Byte bLastMinG, bLastGOffset, bGOffsetUpperBound = 255, bGOffsetLowerBound =
|
||||
0;
|
||||
SANE_Byte bLastMinB, bLastBOffset, bBOffsetUpperBound = 255, bBOffsetLowerBound =
|
||||
0;
|
||||
SANE_Byte bLastMinR, bLastROffset;
|
||||
SANE_Byte bROffsetUpperBound = 255, bROffsetLowerBound = 0;
|
||||
SANE_Byte bLastMinG, bLastGOffset;
|
||||
SANE_Byte bGOffsetUpperBound = 255, bGOffsetLowerBound = 0;
|
||||
SANE_Byte bLastMinB, bLastBOffset;
|
||||
SANE_Byte bBOffsetUpperBound = 255, bBOffsetLowerBound = 0;
|
||||
float fRFactor = 1.0;
|
||||
float fGFactor = 1.0;
|
||||
float fBFactor = 1.0;
|
||||
|
@ -513,10 +517,9 @@ Reflective_AdjustAD (void)
|
|||
DBG (DBG_FUNC,
|
||||
"Reflective_AdjustAD: run out first adjust offset do-while\n");
|
||||
|
||||
DBG (DBG_FUNC, "Reflective_AdjustAD: \
|
||||
g_chip.AD.OffsetR=%d,\
|
||||
g_chip.AD.OffsetG=%d,\
|
||||
g_chip.AD.OffsetB=%d\n", g_chip.AD.OffsetR, g_chip.AD.OffsetG, g_chip.AD.OffsetB);
|
||||
DBG (DBG_FUNC, "Reflective_AdjustAD: g_chip.AD.OffsetR=%d," \
|
||||
"g_chip.AD.OffsetG=%d,g_chip.AD.OffsetB=%d\n",
|
||||
g_chip.AD.OffsetR, g_chip.AD.OffsetG, g_chip.AD.OffsetB);
|
||||
|
||||
g_chip.AD.GainR = 1 - (double) (wMaxValueR - wMinValueR) / 210 > 0 ?
|
||||
(SANE_Byte) (((1 -
|
||||
|
@ -560,8 +563,9 @@ Reflective_AdjustAD (void)
|
|||
&wMinValueB))
|
||||
return SANE_FALSE;
|
||||
|
||||
DBG (DBG_FUNC, "Reflective_AdjustAD: "
|
||||
"RGain=%d, ROffset=%d, RDir=%d GGain=%d, GOffset=%d, GDir=%d BGain=%d, BOffset=%d, BDir=%d\n",
|
||||
DBG (DBG_FUNC, "Reflective_AdjustAD: RGain=%d, ROffset=%d, RDir=%d, " \
|
||||
"GGain=%d, GOffset=%d, GDir=%d BGain=%d, BOffset=%d, " \
|
||||
"BDir=%d\n",
|
||||
g_chip.AD.GainR, g_chip.AD.OffsetR, g_chip.AD.DirectionR,
|
||||
g_chip.AD.GainG, g_chip.AD.OffsetG, g_chip.AD.DirectionG,
|
||||
g_chip.AD.GainB, g_chip.AD.OffsetB, g_chip.AD.DirectionB);
|
||||
|
@ -764,8 +768,9 @@ Reflective_AdjustAD (void)
|
|||
&wMinValueB))
|
||||
return SANE_FALSE;
|
||||
|
||||
DBG (DBG_FUNC, "Reflective_AdjustAD: "
|
||||
"RGain=%d, ROffset=%d, RDir=%d GGain=%d, GOffset=%d, GDir=%d BGain=%d, BOffset=%d, BDir=%d\n",
|
||||
DBG (DBG_FUNC, "Reflective_AdjustAD: RGain=%d, ROffset=%d, RDir=%d, " \
|
||||
"GGain=%d, GOffset=%d, GDir=%d BGain=%d, BOffset=%d, " \
|
||||
"BDir=%d\n",
|
||||
g_chip.AD.GainR, g_chip.AD.OffsetR, g_chip.AD.DirectionR,
|
||||
g_chip.AD.GainG, g_chip.AD.OffsetG, g_chip.AD.DirectionG,
|
||||
g_chip.AD.GainB, g_chip.AD.OffsetB, g_chip.AD.DirectionB);
|
||||
|
@ -924,8 +929,8 @@ Reflective_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY)
|
|||
lpCalData + i * g_dwCalibrationSize,
|
||||
g_dwCalibrationSize, 8))
|
||||
{
|
||||
DBG (DBG_FUNC,
|
||||
"Reflective_FindTopLeft: Asic_ReadCalibrationData return error\n");
|
||||
DBG (DBG_FUNC, "Reflective_FindTopLeft: Asic_ReadCalibrationData " \
|
||||
"return error\n");
|
||||
free (lpCalData);
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
@ -1097,8 +1102,8 @@ Reflective_LineCalibration16Bits (void)
|
|||
|
||||
if (lpWhiteData == NULL || lpDarkData == NULL)
|
||||
{
|
||||
DBG (DBG_FUNC,
|
||||
"Reflective_LineCalibration16Bits: lpWhiteData or lpDarkData malloc error\n");
|
||||
DBG (DBG_FUNC, "Reflective_LineCalibration16Bits: lpWhiteData or " \
|
||||
"lpDarkData malloc error\n");
|
||||
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
@ -1179,8 +1184,8 @@ Reflective_LineCalibration16Bits (void)
|
|||
status = Asic_ReadCalibrationData (&g_chip, lpDarkData, dwDarkTotalSize, 8);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_FUNC,
|
||||
"Reflective_LineCalibration16Bits: Asic_ReadCalibrationData return error\n");
|
||||
DBG (DBG_FUNC, "Reflective_LineCalibration16Bits: " \
|
||||
"Asic_ReadCalibrationData return error\n");
|
||||
|
||||
free (lpWhiteData);
|
||||
free (lpDarkData);
|
||||
|
@ -1267,17 +1272,20 @@ Reflective_LineCalibration16Bits (void)
|
|||
lpRDarkSort[j] =
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 0));
|
||||
lpRDarkSort[j] +=
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 1) << 8);
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 1)
|
||||
<< 8);
|
||||
|
||||
lpGDarkSort[j] =
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 2));
|
||||
lpGDarkSort[j] +=
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 3) << 8);
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 3)
|
||||
<< 8);
|
||||
|
||||
lpBDarkSort[j] =
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 4));
|
||||
lpBDarkSort[j] +=
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 5) << 8);
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 5)
|
||||
<< 8);
|
||||
}
|
||||
|
||||
if (g_XDpi == 1200)
|
||||
|
@ -1287,38 +1295,41 @@ Reflective_LineCalibration16Bits (void)
|
|||
if (i % 2)
|
||||
{
|
||||
dwRDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
dwGDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
dwBDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
dwREvenDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
|
||||
dwGEvenDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
dwBEvenDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
dwRDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20, 30);
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
dwGDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20, 30);
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
dwBDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20, 30);
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1347,20 +1358,20 @@ Reflective_LineCalibration16Bits (void)
|
|||
|
||||
for (j = 0; j < wCalHeight; j++)
|
||||
{
|
||||
lpRWhiteSort[j] =
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 0));
|
||||
lpRWhiteSort[j] +=
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 1) << 8);
|
||||
lpRWhiteSort[j] = (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 0));
|
||||
lpRWhiteSort[j] += (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 1) << 8);
|
||||
|
||||
lpGWhiteSort[j] =
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 2));
|
||||
lpGWhiteSort[j] +=
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 3) << 8);
|
||||
lpGWhiteSort[j] = (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 2));
|
||||
lpGWhiteSort[j] += (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 3) << 8);
|
||||
|
||||
lpBWhiteSort[j] =
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 4));
|
||||
lpBWhiteSort[j] +=
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 5) << 8);
|
||||
lpBWhiteSort[j] = (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 4));
|
||||
lpBWhiteSort[j] += (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 5) << 8);
|
||||
}
|
||||
|
||||
if (g_XDpi == 1200)
|
||||
|
@ -1431,7 +1442,7 @@ Reflective_LineCalibration16Bits (void)
|
|||
free (lpWhiteShading);
|
||||
free (lpDarkShading);
|
||||
|
||||
DBG (DBG_FUNC,
|
||||
"Reflective_LineCalibration16Bits: leave Reflective_LineCalibration16Bits\n");
|
||||
DBG (DBG_FUNC, "Reflective_LineCalibration16Bits: leave " \
|
||||
"Reflective_LineCalibration16Bits\n");
|
||||
return SANE_TRUE;
|
||||
}
|
||||
|
|
|
@ -47,12 +47,17 @@
|
|||
|
||||
|
||||
static SANE_Bool Transparent_Reset (void);
|
||||
static SANE_Bool Transparent_SetupScan (COLORMODE ColorMode, unsigned short XDpi, unsigned short YDpi,
|
||||
unsigned short X, unsigned short Y, unsigned short Width,
|
||||
unsigned short Height);
|
||||
static SANE_Bool Transparent_SetupScan (COLORMODE ColorMode,
|
||||
unsigned short XDpi,
|
||||
unsigned short YDpi,
|
||||
unsigned short X, unsigned short Y,
|
||||
unsigned short Width,
|
||||
unsigned short Height);
|
||||
static SANE_Bool Transparent_AdjustAD (void);
|
||||
static SANE_Bool Transparent_FindTopLeft (unsigned short * lpwStartX, unsigned short * lpwStartY);
|
||||
static SANE_Bool Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus);
|
||||
static SANE_Bool Transparent_FindTopLeft (unsigned short * lpwStartX,
|
||||
unsigned short * lpwStartY);
|
||||
static SANE_Bool Transparent_LineCalibration16Bits (
|
||||
unsigned short wTAShadingMinus);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -293,12 +298,12 @@ Transparent_SetupScan (COLORMODE ColorMode,
|
|||
|
||||
Transparent_LineCalibration16Bits (wTAShadingMinus);
|
||||
|
||||
DBG (DBG_FUNC,
|
||||
"Transparent_SetupScan: after Reflective_LineCalibration16Bits,g_X=%d,g_Y=%d\n",
|
||||
DBG (DBG_FUNC, "Transparent_SetupScan: after " \
|
||||
"Reflective_LineCalibration16Bits,g_X=%d,g_Y=%d\n",
|
||||
g_X, g_Y);
|
||||
|
||||
DBG (DBG_FUNC,
|
||||
"Transparent_SetupScan: g_bScanBits=%d, g_XDpi=%d, g_YDpi=%d, g_X=%d, g_Y=%d, g_Width=%d, g_Height=%d\n",
|
||||
DBG (DBG_FUNC, "Transparent_SetupScan: g_bScanBits=%d, g_XDpi=%d, " \
|
||||
"g_YDpi=%d, g_X=%d, g_Y=%d, g_Width=%d, g_Height=%d\n",
|
||||
g_bScanBits, g_XDpi, g_YDpi, g_X, g_Y, g_Width, g_Height);
|
||||
|
||||
g_Y = Y * 1200 / g_YDpi + (300 - 40) + 189;
|
||||
|
@ -323,19 +328,20 @@ Transparent_AdjustAD (void)
|
|||
SANE_Byte * lpCalData;
|
||||
unsigned short wCalWidth;
|
||||
int nTimesOfCal;
|
||||
unsigned short wMaxValueR, wMinValueR, wMaxValueG, wMinValueG, wMaxValueB, wMinValueB;
|
||||
unsigned short wMaxValueR, wMaxValueG, wMaxValueB;
|
||||
unsigned short wMinValueR, wMinValueG, wMinValueB;
|
||||
#if 0
|
||||
float fRFactor = 1.0;
|
||||
float fGFactor = 1.0;
|
||||
float fBFactor = 1.0;
|
||||
SANE_Byte bDarkMaxLevel;
|
||||
SANE_Byte bDarkMinLevel;
|
||||
SANE_Byte bLastMinR, bLastROffset, bROffsetUpperBound = 255, bROffsetLowerBound =
|
||||
0;
|
||||
SANE_Byte bLastMinG, bLastGOffset, bGOffsetUpperBound = 255, bGOffsetLowerBound =
|
||||
0;
|
||||
SANE_Byte bLastMinB, bLastBOffset, bBOffsetUpperBound = 255, bBOffsetLowerBound =
|
||||
0;
|
||||
SANE_Byte bLastMinR, bLastROffset;
|
||||
SANE_Byte bROffsetUpperBound = 255, bROffsetLowerBound = 0;
|
||||
SANE_Byte bLastMinG, bLastGOffset;
|
||||
SANE_Byte bGOffsetUpperBound = 255, bGOffsetLowerBound = 0;
|
||||
SANE_Byte bLastMinB, bLastBOffset;
|
||||
SANE_Byte bBOffsetUpperBound = 255, bBOffsetLowerBound = 0;
|
||||
#endif
|
||||
unsigned short wAdjustADResolution;
|
||||
|
||||
|
@ -392,8 +398,8 @@ Transparent_AdjustAD (void)
|
|||
SANE_Byte * lpBuf = malloc (50);
|
||||
if (NULL == lpBuf)
|
||||
{
|
||||
DBG (DBG_FUNC,
|
||||
"Transparent_AdjustAD: Leave Transparent_AdjustAD for malloc fail!\n");
|
||||
DBG (DBG_FUNC, "Transparent_AdjustAD: Leave Transparent_AdjustAD for " \
|
||||
"malloc fail!\n");
|
||||
return SANE_FALSE;
|
||||
}
|
||||
memset (lpBuf, 0, 50);
|
||||
|
@ -530,8 +536,9 @@ Transparent_AdjustAD (void)
|
|||
&wMinValueB))
|
||||
return SANE_FALSE;
|
||||
|
||||
DBG (DBG_FUNC, "Transparent_AdjustAD: "
|
||||
"RGain=%d, ROffset=%d, RDir=%d GGain=%d, GOffset=%d, GDir=%d BGain=%d, BOffset=%d, BDir=%d\n",
|
||||
DBG (DBG_FUNC, "Transparent_AdjustAD: RGain=%d, ROffset=%d, RDir=%d, " \
|
||||
"GGain=%d, GOffset=%d, GDir=%d, BGain=%d, BOffset=%d, " \
|
||||
"BDir=%d\n",
|
||||
g_chip.AD.GainR, g_chip.AD.OffsetR, g_chip.AD.DirectionR,
|
||||
g_chip.AD.GainG, g_chip.AD.OffsetG, g_chip.AD.DirectionG,
|
||||
g_chip.AD.GainB, g_chip.AD.OffsetB, g_chip.AD.DirectionB);
|
||||
|
@ -733,9 +740,9 @@ Transparent_AdjustAD (void)
|
|||
&wMinValueB))
|
||||
return SANE_FALSE;
|
||||
|
||||
DBG (DBG_FUNC,
|
||||
"Transparent_AdjustAD: "
|
||||
"RGain=%d, ROffset=%d, RDir=%d GGain=%d, GOffset=%d, GDir=%d BGain=%d, BOffset=%d, BDir=%d\n",
|
||||
DBG (DBG_FUNC, "Transparent_AdjustAD: RGain=%d, ROffset=%d, RDir=%d, " \
|
||||
"GGain=%d, GOffset=%d, GDir=%d, BGain=%d, BOffset=%d, " \
|
||||
"BDir=%d\n",
|
||||
g_chip.AD.GainR, g_chip.AD.OffsetR, g_chip.AD.DirectionR,
|
||||
g_chip.AD.GainG, g_chip.AD.OffsetG, g_chip.AD.DirectionG,
|
||||
g_chip.AD.GainB, g_chip.AD.OffsetB, g_chip.AD.DirectionB);
|
||||
|
@ -1026,8 +1033,8 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
lpDarkData = malloc (dwDarkTotalSize);
|
||||
if (lpWhiteData == NULL || lpDarkData == NULL)
|
||||
{
|
||||
DBG (DBG_FUNC,
|
||||
"Transparent_LineCalibration16Bits: lpWhiteData or lpDarkData malloc fail\n");
|
||||
DBG (DBG_FUNC, "Transparent_LineCalibration16Bits: lpWhiteData or " \
|
||||
"lpDarkData malloc fail\n");
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1123,17 +1130,20 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
lpRDarkSort[j] =
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 0));
|
||||
lpRDarkSort[j] +=
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 1) << 8);
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 1)
|
||||
<< 8);
|
||||
|
||||
lpGDarkSort[j] =
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 2));
|
||||
lpGDarkSort[j] +=
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 3) << 8);
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 3)
|
||||
<< 8);
|
||||
|
||||
lpBDarkSort[j] =
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 4));
|
||||
lpBDarkSort[j] +=
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 5) << 8);
|
||||
(unsigned short) (*(lpDarkData + j * wCalWidth * 6 + i * 6 + 5)
|
||||
<< 8);
|
||||
}
|
||||
|
||||
/* sum of dark level for all pixels */
|
||||
|
@ -1143,36 +1153,39 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
if (i % 2)
|
||||
{
|
||||
dwRDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
dwGDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
dwBDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
dwREvenDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
dwGEvenDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
dwBEvenDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight,
|
||||
20, 30);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dwRDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20, 30);
|
||||
(unsigned int) MustScanner_FiltLower (lpRDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
dwGDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20, 30);
|
||||
(unsigned int) MustScanner_FiltLower (lpGDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
dwBDarkLevel +=
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20, 30);
|
||||
(unsigned int) MustScanner_FiltLower (lpBDarkSort, wCalHeight, 20,
|
||||
30);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1182,9 +1195,12 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
dwGDarkLevel = (unsigned int) (dwGDarkLevel / (wCalWidth / 2)) - 512;
|
||||
dwBDarkLevel = (unsigned int) (dwBDarkLevel / (wCalWidth / 2)) - 512;
|
||||
|
||||
dwREvenDarkLevel = (unsigned int) (dwREvenDarkLevel / (wCalWidth / 2)) - 512;
|
||||
dwGEvenDarkLevel = (unsigned int) (dwGEvenDarkLevel / (wCalWidth / 2)) - 512;
|
||||
dwBEvenDarkLevel = (unsigned int) (dwBEvenDarkLevel / (wCalWidth / 2)) - 512;
|
||||
dwREvenDarkLevel = (unsigned int) (dwREvenDarkLevel / (wCalWidth / 2)) -
|
||||
512;
|
||||
dwGEvenDarkLevel = (unsigned int) (dwGEvenDarkLevel / (wCalWidth / 2)) -
|
||||
512;
|
||||
dwBEvenDarkLevel = (unsigned int) (dwBEvenDarkLevel / (wCalWidth / 2)) -
|
||||
512;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1202,20 +1218,20 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
|
||||
for (j = 0; j < wCalHeight; j++)
|
||||
{
|
||||
lpRWhiteSort[j] =
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 0));
|
||||
lpRWhiteSort[j] +=
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 1) << 8);
|
||||
lpRWhiteSort[j] = (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 0));
|
||||
lpRWhiteSort[j] += (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 1) << 8);
|
||||
|
||||
lpGWhiteSort[j] =
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 2));
|
||||
lpGWhiteSort[j] +=
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 3) << 8);
|
||||
lpGWhiteSort[j] = (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 2));
|
||||
lpGWhiteSort[j] += (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 3) << 8);
|
||||
|
||||
lpBWhiteSort[j] =
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 4));
|
||||
lpBWhiteSort[j] +=
|
||||
(unsigned short) (*(lpWhiteData + j * wCalWidth * 2 * 3 + i * 6 + 5) << 8);
|
||||
lpBWhiteSort[j] = (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 4));
|
||||
lpBWhiteSort[j] += (unsigned short) (*(lpWhiteData + j * wCalWidth *
|
||||
2 * 3 + i * 6 + 5) << 8);
|
||||
}
|
||||
|
||||
if (1200 == g_XDpi)
|
||||
|
@ -1231,7 +1247,8 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
else
|
||||
{
|
||||
*(lpDarkShading + i * 3 + 0) = (unsigned short) dwRDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 1) = (unsigned short) (dwGDarkLevel * 0.78);
|
||||
*(lpDarkShading + i * 3 + 1) = (unsigned short)
|
||||
(dwGDarkLevel * 0.78);
|
||||
*(lpDarkShading + i * 3 + 2) = (unsigned short) dwBDarkLevel;
|
||||
}
|
||||
}
|
||||
|
@ -1239,16 +1256,21 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
{
|
||||
if (SS_Negative == g_ssScanSource)
|
||||
{
|
||||
*(lpDarkShading + i * 3 + 0) = (unsigned short) dwREvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 1) = (unsigned short) dwGEvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 2) = (unsigned short) dwBEvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 0) = (unsigned short)
|
||||
dwREvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 1) = (unsigned short)
|
||||
dwGEvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 2) = (unsigned short)
|
||||
dwBEvenDarkLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(lpDarkShading + i * 3 + 0) = (unsigned short) dwREvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 1) =
|
||||
(unsigned short) (dwGEvenDarkLevel * 0.78);
|
||||
*(lpDarkShading + i * 3 + 2) = (unsigned short) dwBEvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 0) = (unsigned short)
|
||||
dwREvenDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 1) = (unsigned short)
|
||||
(dwGEvenDarkLevel * 0.78);
|
||||
*(lpDarkShading + i * 3 + 2) = (unsigned short)
|
||||
dwBEvenDarkLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1263,7 +1285,8 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
else
|
||||
{
|
||||
*(lpDarkShading + i * 3 + 0) = (unsigned short) dwRDarkLevel;
|
||||
*(lpDarkShading + i * 3 + 1) = (unsigned short) (dwRDarkLevel * 0.78);
|
||||
*(lpDarkShading + i * 3 + 1) = (unsigned short)
|
||||
(dwRDarkLevel * 0.78);
|
||||
*(lpDarkShading + i * 3 + 2) = (unsigned short) dwRDarkLevel;
|
||||
}
|
||||
}
|
||||
|
@ -1336,7 +1359,7 @@ Transparent_LineCalibration16Bits (unsigned short wTAShadingMinus)
|
|||
free (lpWhiteShading);
|
||||
free (lpDarkShading);
|
||||
|
||||
DBG (DBG_FUNC,
|
||||
"Transparent_LineCalibration16Bits: leave Transparent_LineCalibration16Bits\n");
|
||||
DBG (DBG_FUNC, "Transparent_LineCalibration16Bits: leave " \
|
||||
"Transparent_LineCalibration16Bits\n");
|
||||
return SANE_TRUE;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue