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>
|
2009-04-25 Alessandro Zummo <a.zummo@towertech.it>
|
||||||
* backend/epson2.c: fixed TPU warmup retry
|
* backend/epson2.c: fixed TPU warmup retry
|
||||||
|
|
||||||
|
|
|
@ -2752,7 +2752,7 @@ compute_coefficient (unsigned int coeff,
|
||||||
unsigned int target_code, unsigned int val)
|
unsigned int target_code, unsigned int val)
|
||||||
{
|
{
|
||||||
if (val <= 0)
|
if (val <= 0)
|
||||||
return 65535;
|
return 0;
|
||||||
|
|
||||||
val = (coeff * target_code) / val;
|
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 += 256 * dev->dark_average_data[(x + j) * 2 * channels + 1];
|
||||||
}
|
}
|
||||||
dk /= j;
|
dk /= j;
|
||||||
|
if (dk > 65535)
|
||||||
|
dk = 65535;
|
||||||
for (j = 0; j < avgpixels; j++)
|
for (j = 0; j < avgpixels; j++)
|
||||||
{
|
{
|
||||||
ptr[0 + j * 2 * 2 * 3] = dk & 255;
|
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 += 256 * dev->dark_average_data[(x + j) * 2 * channels + 3];
|
||||||
}
|
}
|
||||||
dk /= j;
|
dk /= j;
|
||||||
|
if (dk > 65535)
|
||||||
|
dk = 65535;
|
||||||
for (j = 0; j < avgpixels; j++)
|
for (j = 0; j < avgpixels; j++)
|
||||||
{
|
{
|
||||||
ptr[4 + j * 2 * 2 * 3] = dk & 255;
|
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 += 256 * dev->dark_average_data[(x + j) * 2 * channels + 5];
|
||||||
}
|
}
|
||||||
dk /= j;
|
dk /= j;
|
||||||
|
if (dk > 65535)
|
||||||
|
dk = 65535;
|
||||||
for (j = 0; j < avgpixels; j++)
|
for (j = 0; j < avgpixels; j++)
|
||||||
{
|
{
|
||||||
ptr[8 + j * 2 * 2 * 3] = dk & 255;
|
ptr[8 + j * 2 * 2 * 3] = dk & 255;
|
||||||
|
@ -2970,11 +2976,7 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
|
||||||
compute_coefficients (dev,
|
compute_coefficients (dev,
|
||||||
shading_data,
|
shading_data,
|
||||||
pixels_per_line,
|
pixels_per_line,
|
||||||
channels,
|
channels, avgpixels, o, coeff, target_code);
|
||||||
avgpixels,
|
|
||||||
o,
|
|
||||||
coeff,
|
|
||||||
target_code);
|
|
||||||
break;
|
break;
|
||||||
case CCD_HP2300:
|
case CCD_HP2300:
|
||||||
case CCD_HP2400:
|
case CCD_HP2400:
|
||||||
|
@ -2986,11 +2988,7 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
|
||||||
compute_coefficients (dev,
|
compute_coefficients (dev,
|
||||||
shading_data,
|
shading_data,
|
||||||
pixels_per_line,
|
pixels_per_line,
|
||||||
channels,
|
channels, avgpixels, o, coeff, target_code);
|
||||||
avgpixels,
|
|
||||||
o,
|
|
||||||
coeff,
|
|
||||||
target_code);
|
|
||||||
break;
|
break;
|
||||||
case CCD_CANONLIDE35:
|
case CCD_CANONLIDE35:
|
||||||
target_bright = 0xfa00;
|
target_bright = 0xfa00;
|
||||||
|
|
|
@ -206,7 +206,7 @@ static Genesys_Sensor Sensor[] = {
|
||||||
/* 5: HP2300c */
|
/* 5: HP2300c */
|
||||||
{CCD_HP2300,600,
|
{CCD_HP2300,600,
|
||||||
48,
|
48,
|
||||||
20, 0, 5454, 210, 240,
|
20, 0, 5454, 180, 180,
|
||||||
{0x16, 0x00, 0x01, 0x03}
|
{0x16, 0x00, 0x01, 0x03}
|
||||||
,
|
,
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0x0a, 0x20, 0x2a, 0x6a, 0x8a,
|
{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);
|
required);
|
||||||
return 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
|
if (sensor == sensor_master[i].sensor
|
||||||
&& sensor_master[i].color == color)
|
&& sensor_master[i].color == color)
|
||||||
{
|
{
|
||||||
|
@ -1152,6 +1152,38 @@ get_closest_resolution (int sensor, int required, SANE_Bool color)
|
||||||
return dpi;
|
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
|
* Setup register and motor tables for a scan at the
|
||||||
* given resolution and color mode. TODO try to not use any filed from
|
* 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
|
* init registers for shading calibration
|
||||||
* we assume that scanner's head is on an area suiting 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
|
* 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
|
* @param dev scanner's device
|
||||||
* @return SANE_STATUS_GOOD if success, else error code
|
* @return SANE_STATUS_GOOD if success, else error code
|
||||||
*/
|
*/
|
||||||
|
@ -3400,14 +3432,15 @@ gl646_init_regs_for_shading (Genesys_Device * dev)
|
||||||
|
|
||||||
DBG (DBG_proc, "gl646_init_register_for_shading: start\n");
|
DBG (DBG_proc, "gl646_init_register_for_shading: start\n");
|
||||||
|
|
||||||
/* when shading all line, we must adapt to half_ccd case */
|
/* when shading all (full width) line, we must adapt to half_ccd case */
|
||||||
if ((dev->model->flags & GENESYS_FLAG_HALF_CCD_MODE)
|
if (dev->model->flags & GENESYS_FLAG_HALF_CCD_MODE)
|
||||||
&& (dev->settings.xres <= dev->sensor.optical_res / 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)
|
||||||
{
|
{
|
||||||
/* we are going to use half the pixel number */
|
|
||||||
half_ccd = 2;
|
half_ccd = 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* fill settings for scan */
|
/* fill settings for scan */
|
||||||
settings.scan_method = SCAN_METHOD_FLATBED;
|
settings.scan_method = SCAN_METHOD_FLATBED;
|
||||||
|
|
Ładowanie…
Reference in New Issue