kopia lustrzana https://gitlab.com/sane-project/backends
close to final version for gl847
- feed to scan area - revert data reading for shading calibration - tuned geometrymerge-requests/1/head
rodzic
aec8271689
commit
bc944cbc3a
|
@ -2459,8 +2459,8 @@ genesys_dark_shading_calibration (Genesys_Device * dev)
|
|||
|
||||
status =
|
||||
dev->model->cmd_set->bulk_write_register (dev, dev->calib_reg,
|
||||
dev->model->cmd_set->
|
||||
bulk_full_size ());
|
||||
dev->model->
|
||||
cmd_set->bulk_full_size ());
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
free (calibration_data);
|
||||
|
@ -2482,38 +2482,14 @@ genesys_dark_shading_calibration (Genesys_Device * dev)
|
|||
return status;
|
||||
}
|
||||
|
||||
if (!(dev->model->flags & GENESYS_FLAG_ODD_EVEN_CIS))
|
||||
status = sanei_genesys_read_data_from_scanner (dev, calibration_data, size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
status =
|
||||
sanei_genesys_read_data_from_scanner (dev, calibration_data, size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
free (calibration_data);
|
||||
DBG (DBG_error,
|
||||
"genesys_dark_shading_calibration: Failed to read data: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we need to read full line by full line */
|
||||
size = channels * 2 * pixels_per_line;
|
||||
for (i = 0; i < dev->model->shading_lines; i++)
|
||||
{
|
||||
status =
|
||||
sanei_genesys_read_data_from_scanner (dev,
|
||||
calibration_data + i * size,
|
||||
size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
free (calibration_data);
|
||||
DBG (DBG_error,
|
||||
"genesys_white_shading_calibration: failed to read data: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
}
|
||||
free (calibration_data);
|
||||
DBG (DBG_error,
|
||||
"genesys_dark_shading_calibration: failed to read data: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
|
||||
status = dev->model->cmd_set->end_scan (dev, dev->calib_reg, SANE_TRUE);
|
||||
|
@ -2521,7 +2497,7 @@ genesys_dark_shading_calibration (Genesys_Device * dev)
|
|||
{
|
||||
free (calibration_data);
|
||||
DBG (DBG_error,
|
||||
"genesys_dark_shading_calibration: Failed to end scan: %s\n",
|
||||
"genesys_dark_shading_calibration: failed to end scan: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
|
@ -2691,8 +2667,8 @@ genesys_white_shading_calibration (Genesys_Device * dev)
|
|||
|
||||
status =
|
||||
dev->model->cmd_set->bulk_write_register (dev, dev->calib_reg,
|
||||
dev->model->cmd_set->
|
||||
bulk_full_size ());
|
||||
dev->model->
|
||||
cmd_set->bulk_full_size ());
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
free (calibration_data);
|
||||
|
@ -2715,38 +2691,14 @@ genesys_white_shading_calibration (Genesys_Device * dev)
|
|||
return status;
|
||||
}
|
||||
|
||||
if (!(dev->model->flags & GENESYS_FLAG_ODD_EVEN_CIS))
|
||||
status = sanei_genesys_read_data_from_scanner (dev, calibration_data, size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
status =
|
||||
sanei_genesys_read_data_from_scanner (dev, calibration_data, size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
free (calibration_data);
|
||||
DBG (DBG_error,
|
||||
"genesys_white_shading_calibration: failed to read data: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we need to read full line by full line */
|
||||
size = channels * 2 * pixels_per_line;
|
||||
for (i = 0; i < dev->model->shading_lines; i++)
|
||||
{
|
||||
status =
|
||||
sanei_genesys_read_data_from_scanner (dev,
|
||||
calibration_data + i * size,
|
||||
size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
free (calibration_data);
|
||||
DBG (DBG_error,
|
||||
"genesys_white_shading_calibration: failed to read data: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
}
|
||||
free (calibration_data);
|
||||
DBG (DBG_error,
|
||||
"genesys_white_shading_calibration: failed to read data: %s\n",
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
|
||||
status = dev->model->cmd_set->end_scan (dev, dev->calib_reg, SANE_TRUE);
|
||||
|
@ -6210,7 +6162,7 @@ init_options (Genesys_Scanner * s)
|
|||
s->opt[OPT_DISABLE_DYNAMIC_LINEART].constraint_type = SANE_CONSTRAINT_NONE;
|
||||
s->val[OPT_DISABLE_DYNAMIC_LINEART].w = SANE_FALSE;
|
||||
/* not working for GL646 scanners yet */
|
||||
if (s->dev->model->asic_type == GENESYS_GL646)
|
||||
if (s->dev->model->asic_type == GENESYS_GL646 || s->dev->model->asic_type == GENESYS_GL847)
|
||||
{
|
||||
s->opt[OPT_DISABLE_DYNAMIC_LINEART].cap |= SANE_CAP_INACTIVE;
|
||||
}
|
||||
|
|
|
@ -786,9 +786,9 @@ static Genesys_Motor Motor[] = {
|
|||
1, /* maximum power modes count */
|
||||
{ /* motor slopes */
|
||||
{ /* power mode 0 */
|
||||
{ 2343, 1017, 128, 0.80}, /* full step */
|
||||
{ 2343, 1017, 64, 0.80}, /* full step */
|
||||
{ 4678, 2034, 64, 0.80}, /* half step */
|
||||
{ 3*2712, 3*2712, 16, 0.80}, /* quarter step 0.75*2712 */
|
||||
{ 3*2712, 3*2712, 64, 0.80}, /* quarter step 0.75*2712 */
|
||||
/*{ 4*2034, 4*2034, 32, 0.80}, quarter step */
|
||||
/* extra values kept for documentation
|
||||
{ 2343, 864, 32, 0.80}, full step
|
||||
|
@ -936,8 +936,8 @@ static Genesys_Model canon_lide_100_model = {
|
|||
{16, 8, 0}, /* possible depths in gray mode */
|
||||
{16, 8, 0}, /* possible depths in color mode */
|
||||
|
||||
SANE_FIX (0.0), /* Start of scan area in mm (x) 6.95 */
|
||||
SANE_FIX (30.0), /* Start of scan area in mm (y) */
|
||||
SANE_FIX (0.0), /* Start of scan area in mm (x) */
|
||||
SANE_FIX (7.3), /* Start of scan area in mm (y) */
|
||||
SANE_FIX (216.07), /* Size of scan area in mm (x) */
|
||||
SANE_FIX (299.0), /* Size of scan area in mm (y) */
|
||||
|
||||
|
|
|
@ -871,11 +871,12 @@ gl847_init_motor_regs (Genesys_Device * dev, Genesys_Register_Set * reg, unsigne
|
|||
fast_slope_table,
|
||||
256,
|
||||
fast_slope_steps,
|
||||
dev->sensor.dummy_pixel + 1 + dev->sensor.CCD_start_xoffset+dev->sensor.sensor_pixels,
|
||||
0,
|
||||
fast_exposure,
|
||||
dev->motor.base_ydpi /
|
||||
4, &fast_slope_steps,
|
||||
&fast_exposure, 0);
|
||||
dev->motor.base_ydpi / 4,
|
||||
&fast_slope_steps,
|
||||
&fast_exposure,
|
||||
0);
|
||||
|
||||
feedl = feed_steps - fast_slope_steps * 2;
|
||||
use_fast_fed = 1;
|
||||
|
@ -1567,7 +1568,7 @@ gl847_init_optical_regs_scan (Genesys_Device * dev,
|
|||
r = sanei_genesys_get_address (reg, 0x33);
|
||||
r->value = LOBYTE (endx);
|
||||
|
||||
/* words(16bit) before gamma, conversion to 8 bit or lineart*/
|
||||
/* words(16bit) before gamma, conversion to 8 bit or lineart*/
|
||||
words_per_line = (used_pixels * dpiset) / gl847_get_dpihw (dev);
|
||||
|
||||
dev->bpl = words_per_line*(depth/8);
|
||||
|
@ -1584,7 +1585,7 @@ gl847_init_optical_regs_scan (Genesys_Device * dev,
|
|||
DBG (DBG_io2, "%s: dev->skip=%d\n", __FUNCTION__, dev->skip);
|
||||
|
||||
RIE (sanei_genesys_buffer_free (&(dev->oe_buffer)));
|
||||
RIE (sanei_genesys_buffer_alloc (&(dev->oe_buffer), dev->bpl*channels));
|
||||
RIE (sanei_genesys_buffer_alloc (&(dev->oe_buffer), dev->bpl));
|
||||
|
||||
words_per_line *= channels;
|
||||
|
||||
|
@ -1646,7 +1647,9 @@ gl847_get_led_exposure (Genesys_Device * dev)
|
|||
static
|
||||
#endif
|
||||
SANE_Status
|
||||
gl847_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xres, /*dpi */
|
||||
gl847_init_scan_regs (Genesys_Device * dev,
|
||||
Genesys_Register_Set * reg,
|
||||
float xres, /*dpi */
|
||||
float yres, /*dpi */
|
||||
float startx, /*optical_res, from dummy_pixel+1 */
|
||||
float starty, /*base_ydpi, from home! */
|
||||
|
@ -1666,7 +1669,6 @@ gl847_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xr
|
|||
int stagger;
|
||||
|
||||
int slope_dpi = 0;
|
||||
int move_dpi = 0;
|
||||
int dummy = 0;
|
||||
int scan_step_type = 1;
|
||||
int scan_power_mode = 0;
|
||||
|
@ -1890,19 +1892,17 @@ independent of our calculated values:
|
|||
/* lincnt */
|
||||
lincnt = lines + max_shift + stagger;
|
||||
|
||||
/* move */
|
||||
move_dpi = dev->motor.base_ydpi;
|
||||
|
||||
/* add tl_y to base movement */
|
||||
move = starty;
|
||||
DBG (DBG_info, "gl847_init_scan_regs: move=%d steps\n", move);
|
||||
|
||||
/* subtract current head position */
|
||||
/* XXX STEF XXX
|
||||
move -= dev->scanhead_position_in_steps;
|
||||
DBG (DBG_info, "gl847_init_scan_regs: move=%d steps\n", move);
|
||||
|
||||
if (move < 0)
|
||||
move = 0;
|
||||
move = 0; */
|
||||
|
||||
/* round it */
|
||||
/* the move is not affected by dummy -- pierre */
|
||||
|
@ -3371,13 +3371,13 @@ gl847_init_regs_for_scan (Genesys_Device * dev)
|
|||
|
||||
gl847_slow_back_home (dev, 1);
|
||||
|
||||
/* channels */
|
||||
/* channels */
|
||||
if (dev->settings.scan_mode == SCAN_MODE_COLOR) /* single pass color */
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
/* depth */
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == SCAN_MODE_LINEART)
|
||||
depth = 1;
|
||||
|
@ -3404,19 +3404,17 @@ gl847_init_regs_for_scan (Genesys_Device * dev)
|
|||
|
||||
move_dpi = dev->motor.base_ydpi;
|
||||
|
||||
move = 0;
|
||||
if (dev->model->flags & GENESYS_FLAG_SEARCH_START)
|
||||
move += SANE_UNFIX (dev->model->y_offset_calib);
|
||||
|
||||
DBG (DBG_info, "gl847_init_regs_for_scan: move=%f steps\n", move);
|
||||
|
||||
move += SANE_UNFIX (dev->model->y_offset);
|
||||
DBG (DBG_info, "gl847_init_regs_for_scan: move=%f steps\n", move);
|
||||
|
||||
move = SANE_UNFIX (dev->model->y_offset);
|
||||
move += dev->settings.tl_y;
|
||||
move = (move * move_dpi) / MM_PER_INCH;
|
||||
DBG (DBG_info, "gl847_init_regs_for_scan: move=%f steps\n", move);
|
||||
|
||||
move = (move * move_dpi) / MM_PER_INCH;
|
||||
status = gl847_feed (dev, move);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: failed to move to scan area\n",__FUNCTION__);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* start */
|
||||
start = SANE_UNFIX (dev->model->x_offset);
|
||||
|
@ -3447,11 +3445,13 @@ gl847_init_regs_for_scan (Genesys_Device * dev)
|
|||
dev->settings.xres,
|
||||
dev->settings.yres,
|
||||
start,
|
||||
move,
|
||||
0,
|
||||
dev->settings.pixels,
|
||||
dev->settings.lines,
|
||||
depth,
|
||||
channels, dev->settings.color_filter, flags);
|
||||
channels,
|
||||
dev->settings.color_filter,
|
||||
flags);
|
||||
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
|
@ -4085,6 +4085,7 @@ gl847_init_memory_layout (Genesys_Device * dev)
|
|||
return status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/** @brief dummy scan to reset scanner
|
||||
*
|
||||
* */
|
||||
|
@ -4149,6 +4150,7 @@ gl847_dummy_scan (Genesys_Device * dev)
|
|||
DBGCOMPLETED;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/**
|
||||
|
@ -4484,8 +4486,6 @@ gl847_init (Genesys_Device * dev)
|
|||
}
|
||||
dev->already_initialized = SANE_TRUE;
|
||||
|
||||
gl847_dummy_scan(dev);
|
||||
|
||||
/* Move home */
|
||||
RIE (gl847_slow_back_home (dev, SANE_TRUE));
|
||||
dev->scanhead_position_in_steps = 0;
|
||||
|
|
Ładowanie…
Reference in New Issue