kopia lustrzana https://gitlab.com/sane-project/backends
Simplyfied Asic_SetShadingTable.
rodzic
6d5a5123ea
commit
794b15ff9e
|
@ -3644,7 +3644,7 @@ Asic_SetWindow (PAsic chip, SANE_Byte bScanBits,
|
||||||
RamAccess.RwSize =
|
RamAccess.RwSize =
|
||||||
ShadingTableSize ((int) ((wWidth + 4) * dbXRatioAdderDouble)) *
|
ShadingTableSize ((int) ((wWidth + 4) * dbXRatioAdderDouble)) *
|
||||||
sizeof (unsigned short);
|
sizeof (unsigned short);
|
||||||
RamAccess.BufferPtr = chip->lpShadingTable;
|
RamAccess.BufferPtr = (SANE_Byte *) chip->lpShadingTable;
|
||||||
LLFRamAccess (chip, &RamAccess);
|
LLFRamAccess (chip, &RamAccess);
|
||||||
|
|
||||||
/* tell scan chip the shading table address, unit is 2^15 bytes */
|
/* tell scan chip the shading table address, unit is 2^15 bytes */
|
||||||
|
@ -4082,7 +4082,7 @@ Asic_SetShadingTable (PAsic chip, unsigned short * lpWhiteShading,
|
||||||
|
|
||||||
/* Clear old shading table, if present.
|
/* Clear old shading table, if present.
|
||||||
First 4 and last 5 elements of shading table cannot be used. */
|
First 4 and last 5 elements of shading table cannot be used. */
|
||||||
wShadingTableSize = (ShadingTableSize (wValidPixelNumber)) *
|
wShadingTableSize = ShadingTableSize (wValidPixelNumber) *
|
||||||
sizeof (unsigned short);
|
sizeof (unsigned short);
|
||||||
if (chip->lpShadingTable != NULL)
|
if (chip->lpShadingTable != NULL)
|
||||||
free (chip->lpShadingTable);
|
free (chip->lpShadingTable);
|
||||||
|
@ -4099,56 +4099,26 @@ Asic_SetShadingTable (PAsic chip, unsigned short * lpWhiteShading,
|
||||||
n = 0;
|
n = 0;
|
||||||
for (i = 0; i <= (wValidPixelNumber / 40); i++)
|
for (i = 0; i <= (wValidPixelNumber / 40); i++)
|
||||||
{
|
{
|
||||||
if (i < (wValidPixelNumber / 40))
|
unsigned short numPixel = 40;
|
||||||
|
if (i == (wValidPixelNumber / 40))
|
||||||
|
numPixel = wValidPixelNumber % 40;
|
||||||
|
|
||||||
|
for (j = 0; j < numPixel; j++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < 40; j++)
|
chip->lpShadingTable[i * 256 + j * 6] = lpDarkShading[n * 3];
|
||||||
{
|
chip->lpShadingTable[i * 256 + j * 6 + 2] = lpDarkShading[n * 3 + 1];
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6) =
|
chip->lpShadingTable[i * 256 + j * 6 + 4] = lpDarkShading[n * 3 + 2];
|
||||||
*((unsigned short *) lpDarkShading + n * 3);
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 2) =
|
|
||||||
*((unsigned short *) lpDarkShading + n * 3 + 1);
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 4) =
|
|
||||||
*((unsigned short *) lpDarkShading + n * 3 + 2);
|
|
||||||
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 1) =
|
chip->lpShadingTable[i * 256 + j * 6 + 1] = lpWhiteShading[n * 3];
|
||||||
*((unsigned short *) lpWhiteShading + n * 3);
|
chip->lpShadingTable[i * 256 + j * 6 + 3] = lpWhiteShading[n * 3 + 1];
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 3) =
|
chip->lpShadingTable[i * 256 + j * 6 + 5] = lpWhiteShading[n * 3 + 2];
|
||||||
*((unsigned short *) lpWhiteShading + n * 3 + 1);
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 5) =
|
if ((j % (unsigned short) dbXRatioAdderDouble) ==
|
||||||
*((unsigned short *) lpWhiteShading + n * 3 + 2);
|
|
||||||
if ((j % (unsigned short) dbXRatioAdderDouble) ==
|
|
||||||
(dbXRatioAdderDouble - 1))
|
(dbXRatioAdderDouble - 1))
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
if (i == 0 && j < 4 * dbXRatioAdderDouble)
|
if (i == 0 && j < 4 * dbXRatioAdderDouble)
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (j = 0; j < (wValidPixelNumber % 40); j++)
|
|
||||||
{
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6) =
|
|
||||||
*((unsigned short *) lpDarkShading + n * 3);
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 2) =
|
|
||||||
*((unsigned short *) lpDarkShading + n * 3 + 1);
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 4) =
|
|
||||||
*((unsigned short *) lpDarkShading + n * 3 + 2);
|
|
||||||
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 1) =
|
|
||||||
*((unsigned short *) lpWhiteShading + n * 3);
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 3) =
|
|
||||||
*((unsigned short *) lpWhiteShading + n * 3 + 1);
|
|
||||||
*((unsigned short *) chip->lpShadingTable + i * 256 + j * 6 + 5) =
|
|
||||||
*((unsigned short *) lpWhiteShading + n * 3 + 2);
|
|
||||||
|
|
||||||
if ((j % (unsigned short) dbXRatioAdderDouble) ==
|
|
||||||
(dbXRatioAdderDouble - 1))
|
|
||||||
n++;
|
|
||||||
|
|
||||||
if (i == 0 && j < 4 * dbXRatioAdderDouble)
|
|
||||||
n = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ typedef struct
|
||||||
|
|
||||||
SANE_Byte isMotorMove;
|
SANE_Byte isMotorMove;
|
||||||
SANE_Byte isMotorMoveToFirstLine;
|
SANE_Byte isMotorMoveToFirstLine;
|
||||||
SANE_Byte * lpShadingTable;
|
unsigned short * lpShadingTable;
|
||||||
} Asic, *PAsic;
|
} Asic, *PAsic;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
Ładowanie…
Reference in New Issue