kopia lustrzana https://gitlab.com/sane-project/backends
fix lineart issue at 1200 dpi and clean up block read for gl124
rodzic
de2af06d35
commit
8fb58d5118
|
@ -4972,7 +4972,7 @@ genesys_fill_read_buffer (Genesys_Device * dev)
|
||||||
size &= ~0xff;
|
size &= ~0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* early out if our remaining buffer capacity is too lo w */
|
/* early out if our remaining buffer capacity is too low */
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return SANE_STATUS_GOOD;
|
return SANE_STATUS_GOOD;
|
||||||
|
|
||||||
|
@ -5010,13 +5010,6 @@ genesys_fill_read_buffer (Genesys_Device * dev)
|
||||||
else /* regular case with no extra copy */
|
else /* regular case with no extra copy */
|
||||||
{
|
{
|
||||||
status = dev->model->cmd_set->bulk_read_data (dev, 0x45, work_buffer_dst, size);
|
status = dev->model->cmd_set->bulk_read_data (dev, 0x45, work_buffer_dst, size);
|
||||||
if (status != SANE_STATUS_GOOD)
|
|
||||||
{
|
|
||||||
DBG (DBG_error,
|
|
||||||
"genesys_fill_read_buffer: failed to read %lu bytes (%s)\n",
|
|
||||||
(u_long) size, sane_strstatus (status));
|
|
||||||
return SANE_STATUS_IO_ERROR;
|
|
||||||
}
|
|
||||||
#ifdef SANE_DEBUG_LOG_RAW_DATA
|
#ifdef SANE_DEBUG_LOG_RAW_DATA
|
||||||
if (rawfile != NULL && DBG_LEVEL >= DBG_data)
|
if (rawfile != NULL && DBG_LEVEL >= DBG_data)
|
||||||
{
|
{
|
||||||
|
@ -5026,6 +5019,13 @@ genesys_fill_read_buffer (Genesys_Device * dev)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (status != SANE_STATUS_GOOD)
|
||||||
|
{
|
||||||
|
DBG (DBG_error,
|
||||||
|
"genesys_fill_read_buffer: failed to read %lu bytes (%s)\n",
|
||||||
|
(u_long) size, sane_strstatus (status));
|
||||||
|
return SANE_STATUS_IO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (size > dev->read_bytes_left)
|
if (size > dev->read_bytes_left)
|
||||||
size = dev->read_bytes_left;
|
size = dev->read_bytes_left;
|
||||||
|
@ -5675,6 +5675,13 @@ calc_parameters (Genesys_Scanner * s)
|
||||||
s->params.pixels_per_line = (s->params.pixels_per_line/4)*4;
|
s->params.pixels_per_line = (s->params.pixels_per_line/4)*4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* corner case for true lineart for sensor with several segments */
|
||||||
|
if (s->dev->settings.xres >= 1200
|
||||||
|
&& s->dev->model->asic_type == GENESYS_GL124 )
|
||||||
|
{
|
||||||
|
s->params.pixels_per_line = (s->params.pixels_per_line/16)*16;
|
||||||
|
}
|
||||||
|
|
||||||
s->params.bytes_per_line = s->params.pixels_per_line;
|
s->params.bytes_per_line = s->params.pixels_per_line;
|
||||||
if (s->params.depth > 8)
|
if (s->params.depth > 8)
|
||||||
{
|
{
|
||||||
|
@ -7300,8 +7307,6 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
SANE_Status status = SANE_STATUS_GOOD;
|
||||||
SANE_Word *table;
|
SANE_Word *table;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int min, count;
|
|
||||||
SANE_Word *dpi_list;
|
|
||||||
SANE_Range *x_range, *y_range;
|
SANE_Range *x_range, *y_range;
|
||||||
Genesys_Calibration_Cache *cache, *next_cache;
|
Genesys_Calibration_Cache *cache, *next_cache;
|
||||||
|
|
||||||
|
@ -7388,6 +7393,7 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
|
||||||
|
|
||||||
/* due to low resolution emulation ,we can't mix lineart
|
/* due to low resolution emulation ,we can't mix lineart
|
||||||
* with dpi lower than 300 for GL124 */
|
* with dpi lower than 300 for GL124 */
|
||||||
|
/* XXX STEF XXX
|
||||||
if(s->dev->model->asic_type == GENESYS_GL124)
|
if(s->dev->model->asic_type == GENESYS_GL124)
|
||||||
{
|
{
|
||||||
free(s->opt[OPT_RESOLUTION].constraint.word_list);
|
free(s->opt[OPT_RESOLUTION].constraint.word_list);
|
||||||
|
@ -7405,7 +7411,7 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
|
||||||
s->opt[OPT_RESOLUTION].constraint.word_list = dpi_list;
|
s->opt[OPT_RESOLUTION].constraint.word_list = dpi_list;
|
||||||
if(s->val[OPT_RESOLUTION].w<min)
|
if(s->val[OPT_RESOLUTION].w<min)
|
||||||
s->val[OPT_RESOLUTION].w=min;
|
s->val[OPT_RESOLUTION].w=min;
|
||||||
}
|
} */
|
||||||
|
|
||||||
if (strcmp (s->val[option].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
|
if (strcmp (s->val[option].s, SANE_VALUE_SCAN_MODE_LINEART) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -145,12 +145,11 @@ gl124_bulk_read_data (Genesys_Device * dev, uint8_t addr,
|
||||||
|
|
||||||
/* blocks must be multiple of 512 but not last block */
|
/* blocks must be multiple of 512 but not last block */
|
||||||
read = size;
|
read = size;
|
||||||
if (read >= 512)
|
|
||||||
{
|
|
||||||
read /= 512;
|
read /= 512;
|
||||||
read *= 512;
|
read *= 512;
|
||||||
}
|
|
||||||
|
|
||||||
|
if(read>0)
|
||||||
|
{
|
||||||
DBG (DBG_io2,
|
DBG (DBG_io2,
|
||||||
"gl124_bulk_read_data: trying to read %lu bytes of data\n",
|
"gl124_bulk_read_data: trying to read %lu bytes of data\n",
|
||||||
(u_long) read);
|
(u_long) read);
|
||||||
|
@ -162,14 +161,15 @@ gl124_bulk_read_data (Genesys_Device * dev, uint8_t addr,
|
||||||
sane_strstatus (status));
|
sane_strstatus (status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* read less than 512 bytes remainder */
|
/* read less than 512 bytes remainder */
|
||||||
if (read < size)
|
if (read < size)
|
||||||
{
|
{
|
||||||
done=read;
|
done = read;
|
||||||
read = size - read;
|
read = size - read;
|
||||||
DBG (DBG_io2,
|
DBG (DBG_io2,
|
||||||
"gl124_bulk_read_data: trying to read %lu bytes of data\n",
|
"gl124_bulk_read_data: trying to read remaining %lu bytes of data\n",
|
||||||
(u_long) read);
|
(u_long) read);
|
||||||
status = sanei_usb_read_bulk (dev->dn, data+done, &read);
|
status = sanei_usb_read_bulk (dev->dn, data+done, &read);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
|
|
Ładowanie…
Reference in New Issue