kopia lustrzana https://gitlab.com/sane-project/backends
- HP2300 shading calibration fixes
rodzic
3d05683f81
commit
8d67bccbdc
|
@ -1,3 +1,7 @@
|
|||
2009-04-27 Stéphane Voltz <stef.dev@free.fr>
|
||||
* backend/genesys.c backend/genesys_gl646.c backend/genesys_devices.c:
|
||||
shading calibration fixes for HP2300
|
||||
|
||||
2009-04-25 Alessandro Zummo <a.zummo@towertech.it>
|
||||
* backend/epson2.c: fixed TPU warmup retry
|
||||
|
||||
|
|
|
@ -2752,7 +2752,7 @@ compute_coefficient (unsigned int coeff,
|
|||
unsigned int target_code, unsigned int val)
|
||||
{
|
||||
if (val <= 0)
|
||||
return 65535;
|
||||
return 0;
|
||||
|
||||
val = (coeff * target_code) / val;
|
||||
|
||||
|
@ -2796,6 +2796,8 @@ compute_coefficients (Genesys_Device * dev,
|
|||
dk += 256 * dev->dark_average_data[(x + j) * 2 * channels + 1];
|
||||
}
|
||||
dk /= j;
|
||||
if (dk > 65535)
|
||||
dk = 65535;
|
||||
for (j = 0; j < avgpixels; j++)
|
||||
{
|
||||
ptr[0 + j * 2 * 2 * 3] = dk & 255;
|
||||
|
@ -2810,6 +2812,8 @@ compute_coefficients (Genesys_Device * dev,
|
|||
dk += 256 * dev->dark_average_data[(x + j) * 2 * channels + 3];
|
||||
}
|
||||
dk /= j;
|
||||
if (dk > 65535)
|
||||
dk = 65535;
|
||||
for (j = 0; j < avgpixels; j++)
|
||||
{
|
||||
ptr[4 + j * 2 * 2 * 3] = dk & 255;
|
||||
|
@ -2822,6 +2826,8 @@ compute_coefficients (Genesys_Device * dev,
|
|||
dk += 256 * dev->dark_average_data[(x + j) * 2 * channels + 5];
|
||||
}
|
||||
dk /= j;
|
||||
if (dk > 65535)
|
||||
dk = 65535;
|
||||
for (j = 0; j < avgpixels; j++)
|
||||
{
|
||||
ptr[8 + j * 2 * 2 * 3] = dk & 255;
|
||||
|
@ -2967,30 +2973,22 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
|
|||
memset (shading_data, 0x00, pixels_per_line * 4 * channels);
|
||||
o = 4;
|
||||
avgpixels = 1;
|
||||
compute_coefficients(dev,
|
||||
shading_data,
|
||||
pixels_per_line,
|
||||
channels,
|
||||
avgpixels,
|
||||
o,
|
||||
coeff,
|
||||
target_code);
|
||||
compute_coefficients (dev,
|
||||
shading_data,
|
||||
pixels_per_line,
|
||||
channels, avgpixels, o, coeff, target_code);
|
||||
break;
|
||||
case CCD_HP2300:
|
||||
case CCD_HP2400:
|
||||
case CCD_HP3670:
|
||||
target_code = 0xfa00;
|
||||
memset (shading_data, 0x00, pixels_per_line * 4 * channels);
|
||||
o=2;
|
||||
o = 2;
|
||||
avgpixels = 1;
|
||||
compute_coefficients(dev,
|
||||
shading_data,
|
||||
pixels_per_line,
|
||||
channels,
|
||||
avgpixels,
|
||||
o,
|
||||
coeff,
|
||||
target_code);
|
||||
compute_coefficients (dev,
|
||||
shading_data,
|
||||
pixels_per_line,
|
||||
channels, avgpixels, o, coeff, target_code);
|
||||
break;
|
||||
case CCD_CANONLIDE35:
|
||||
target_bright = 0xfa00;
|
||||
|
@ -3028,8 +3026,8 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
|
|||
/* duplicate half-ccd logic */
|
||||
res = dev->settings.xres;
|
||||
if ((dev->model->flags & GENESYS_FLAG_HALF_CCD_MODE) &&
|
||||
dev->settings.xres <= dev->sensor.optical_res/2)
|
||||
res *= 2;/* scanner is using half-ccd mode */
|
||||
dev->settings.xres <= dev->sensor.optical_res / 2)
|
||||
res *= 2; /* scanner is using half-ccd mode */
|
||||
/*this should be evenly dividable */
|
||||
avgpixels = dev->sensor.optical_res / res;
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ static Genesys_Sensor Sensor[] = {
|
|||
/* 5: HP2300c */
|
||||
{CCD_HP2300,600,
|
||||
48,
|
||||
20, 0, 5454, 210, 240,
|
||||
20, 0, 5454, 180, 180,
|
||||
{0x16, 0x00, 0x01, 0x03}
|
||||
,
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0x0a, 0x20, 0x2a, 0x6a, 0x8a,
|
||||
|
|
|
@ -1135,7 +1135,7 @@ get_closest_resolution (int sensor, int required, SANE_Bool color)
|
|||
required);
|
||||
return required;
|
||||
}
|
||||
/* computes distance and kepm ode is closest than previous */
|
||||
/* computes distance and keep mode if it is closer than previous */
|
||||
if (sensor == sensor_master[i].sensor
|
||||
&& sensor_master[i].color == color)
|
||||
{
|
||||
|
@ -1152,6 +1152,38 @@ get_closest_resolution (int sensor, int required, SANE_Bool color)
|
|||
return dpi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes if sensor will be set up for half ccd pixels for the given
|
||||
* scan mode.
|
||||
* @param sensor id of the sensor
|
||||
* @param required required resolution
|
||||
* @param color true is color mode
|
||||
* @return SANE_TRUE if half ccd is used
|
||||
*/
|
||||
static SANE_Bool
|
||||
is_half_ccd (int sensor, int required, SANE_Bool color)
|
||||
{
|
||||
int i, nb;
|
||||
|
||||
i = 0;
|
||||
nb = sizeof (sensor_master) / sizeof (Sensor_Master);
|
||||
while (sensor_master[i].sensor != -1 && i < nb)
|
||||
{
|
||||
/* exit on perfect match */
|
||||
if (sensor == sensor_master[i].sensor
|
||||
&& sensor_master[i].dpi == required
|
||||
&& sensor_master[i].color == color)
|
||||
{
|
||||
DBG (DBG_io, "is_half_ccd: match found for %d (half_ccd=%d)\n",
|
||||
required,sensor_master[i].half_ccd);
|
||||
return sensor_master[i].half_ccd;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
DBG (DBG_info, "is_half_ccd: failed to find match for %d dpi\n", required);
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup register and motor tables for a scan at the
|
||||
* given resolution and color mode. TODO try to not use any filed from
|
||||
|
@ -3386,7 +3418,7 @@ gl646_init_regs_for_coarse_calibration (Genesys_Device * dev)
|
|||
* init registers for shading calibration
|
||||
* we assume that scanner's head is on an area suiting shading calibration.
|
||||
* We scan a full scan width area by the shading line number for the device
|
||||
* at eihter at full sensor's resolution or half depending upon half_ccd
|
||||
* at either at full sensor's resolution or half depending upon half_ccd
|
||||
* @param dev scanner's device
|
||||
* @return SANE_STATUS_GOOD if success, else error code
|
||||
*/
|
||||
|
@ -3400,15 +3432,16 @@ gl646_init_regs_for_shading (Genesys_Device * dev)
|
|||
|
||||
DBG (DBG_proc, "gl646_init_register_for_shading: start\n");
|
||||
|
||||
/* when shading all line, we must adapt to half_ccd case */
|
||||
if ((dev->model->flags & GENESYS_FLAG_HALF_CCD_MODE)
|
||||
&& (dev->settings.xres <= dev->sensor.optical_res / 2))
|
||||
/* when shading all (full width) line, we must adapt to half_ccd case */
|
||||
if (dev->model->flags & GENESYS_FLAG_HALF_CCD_MODE)
|
||||
{
|
||||
/* we are going to use half the pixel number */
|
||||
half_ccd = 2;
|
||||
/* walk the master mode list to find if half_ccd */
|
||||
if (is_half_ccd (dev->model->ccd_type, dev->settings.xres, SANE_TRUE) == SANE_TRUE)
|
||||
{
|
||||
half_ccd = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fill settings for scan */
|
||||
settings.scan_method = SCAN_METHOD_FLATBED;
|
||||
settings.scan_mode = dev->settings.scan_mode;
|
||||
|
|
Ładowanie…
Reference in New Issue