kopia lustrzana https://gitlab.com/sane-project/backends
add an option to use software lineart for GL841 based scanners
rodzic
f5d5d067e8
commit
db46aac928
|
@ -5017,7 +5017,7 @@ Problems with the first approach:
|
|||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error,
|
||||
"genesys_read_ordered_data: failed to reverse bits(%s)\n",
|
||||
"genesys_read_ordered_data: failed to convert bits(%s)\n",
|
||||
sane_strstatus (status));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
@ -5099,7 +5099,6 @@ calc_parameters (Genesys_Scanner * s)
|
|||
s->params.depth = depth;
|
||||
s->dev->settings.depth = depth;
|
||||
|
||||
|
||||
/* interpolation */
|
||||
s->dev->settings.disable_interpolation =
|
||||
s->val[OPT_DISABLE_INTERPOLATION].w == SANE_TRUE;
|
||||
|
@ -5165,11 +5164,17 @@ calc_parameters (Genesys_Scanner * s)
|
|||
else
|
||||
s->dev->settings.color_filter = 1;
|
||||
|
||||
/* true gray */
|
||||
if (strcmp (color_filter, "None") == 0)
|
||||
s->dev->settings.true_gray = 1;
|
||||
else
|
||||
s->dev->settings.true_gray = 0;
|
||||
|
||||
/* dynamic lineart */
|
||||
s->dev->settings.dynamic_lineart =
|
||||
s->val[OPT_DYNAMIC_LINEART].w == SANE_TRUE;
|
||||
DBG (DBG_io2, "dynamic_lineart=%d\n",s->dev->settings.dynamic_lineart);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -5440,6 +5445,23 @@ init_options (Genesys_Scanner * s)
|
|||
s->opt[OPT_THRESHOLD].constraint_type = SANE_CONSTRAINT_RANGE;
|
||||
s->opt[OPT_THRESHOLD].constraint.range = &threshold_percentage_range;
|
||||
s->val[OPT_THRESHOLD].w = SANE_FIX (50);
|
||||
|
||||
/* dynamic linart */
|
||||
s->opt[OPT_DYNAMIC_LINEART].name = "dynamic-lineart";
|
||||
s->opt[OPT_DYNAMIC_LINEART].title = SANE_I18N ("Dynamic lineart");
|
||||
s->opt[OPT_DYNAMIC_LINEART].desc =
|
||||
SANE_I18N
|
||||
("Use a software adaptative algorithm to generate lineart instead of"
|
||||
" relying on hardware lineart");
|
||||
s->opt[OPT_DYNAMIC_LINEART].type = SANE_TYPE_BOOL;
|
||||
s->opt[OPT_DYNAMIC_LINEART].unit = SANE_UNIT_NONE;
|
||||
s->opt[OPT_DYNAMIC_LINEART].constraint_type = SANE_CONSTRAINT_NONE;
|
||||
s->val[OPT_DYNAMIC_LINEART].w = SANE_FALSE;
|
||||
/* not working for GL646 scanners yet */
|
||||
if (s->dev->model->asic_type == GENESYS_GL646)
|
||||
{
|
||||
s->opt[OPT_DYNAMIC_LINEART].cap |= SANE_CAP_INACTIVE;
|
||||
}
|
||||
|
||||
/* disable_interpolation */
|
||||
s->opt[OPT_DISABLE_INTERPOLATION].name = "disable-interpolation";
|
||||
|
@ -5626,7 +5648,7 @@ init_options (Genesys_Scanner * s)
|
|||
s->last_val[OPT_CALIBRATE].b = 0;
|
||||
|
||||
/* clear calibration cache button */
|
||||
s->opt[OPT_CLEAR_CALIBRATION].name = "clear";
|
||||
s->opt[OPT_CLEAR_CALIBRATION].name = "clear-calibration";
|
||||
s->opt[OPT_CLEAR_CALIBRATION].title = SANE_I18N ("Clear calibration");
|
||||
s->opt[OPT_CLEAR_CALIBRATION].desc = SANE_I18N ("Clear calibration cache");
|
||||
s->opt[OPT_CLEAR_CALIBRATION].type = SANE_TYPE_BUTTON;
|
||||
|
@ -6334,6 +6356,7 @@ get_option_value (Genesys_Scanner * s, int option, void *val)
|
|||
case OPT_BR_X:
|
||||
case OPT_BR_Y:
|
||||
case OPT_THRESHOLD:
|
||||
case OPT_DYNAMIC_LINEART:
|
||||
case OPT_DISABLE_INTERPOLATION:
|
||||
case OPT_LAMP_OFF_TIME:
|
||||
case OPT_CUSTOM_GAMMA:
|
||||
|
@ -6443,6 +6466,7 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
|
|||
case OPT_RESOLUTION:
|
||||
case OPT_BIT_DEPTH:
|
||||
case OPT_THRESHOLD:
|
||||
case OPT_DYNAMIC_LINEART:
|
||||
case OPT_DISABLE_INTERPOLATION:
|
||||
case OPT_PREVIEW:
|
||||
s->val[option].w = *(SANE_Word *) val;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* sane - Scanner Access Now Easy.
|
||||
|
||||
Copyright (C) 2003, 2004 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||
Copyright (C) 2005 Stephane Voltz <stef.dev@free.fr>
|
||||
Copyright (C) 2005-2010 Stephane Voltz <stef.dev@free.fr>
|
||||
Copyright (C) 2006 Laurent Charpentier <laurent_pubs@yahoo.com>
|
||||
Copyright (C) 2009 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
|
||||
|
||||
|
@ -92,6 +92,7 @@ enum Genesys_Option
|
|||
OPT_EXTRAS_GROUP,
|
||||
OPT_LAMP_OFF_TIME,
|
||||
OPT_THRESHOLD,
|
||||
OPT_DYNAMIC_LINEART,
|
||||
OPT_DISABLE_INTERPOLATION,
|
||||
OPT_COLOR_FILTER,
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ genesys_gray_lineart(
|
|||
uint8_t threshold)
|
||||
{
|
||||
size_t x,y,c,b;
|
||||
DBG ( DBG_io2, "genesys_gray_lineart: converting %d lines of %d pixels\n", lines, pixels);
|
||||
for(y = 0; y < lines; y++) {
|
||||
for(x = 0; x < pixels; x+=8) {
|
||||
for(c = 0; c < channels; c++)
|
||||
|
|
|
@ -2691,6 +2691,7 @@ gl841_get_led_exposure(Genesys_Device * dev)
|
|||
#define SCAN_FLAG_IGNORE_LINE_DISTANCE 0x10
|
||||
#define SCAN_FLAG_USE_OPTICAL_RES 0x20
|
||||
#define SCAN_FLAG_DISABLE_LAMP 0x40
|
||||
#define SCAN_FLAG_DYNAMIC_LINEART 0x80
|
||||
|
||||
/* set up registers for an actual scan
|
||||
*
|
||||
|
@ -2930,8 +2931,12 @@ dummy \ scanned lines
|
|||
exposure_time);
|
||||
|
||||
/*** optical parameters ***/
|
||||
|
||||
|
||||
/* in case of dynamic lineart, we use an internal 8 bit gray scan
|
||||
* to generate 1 lineart data */
|
||||
if(flags & SCAN_FLAG_DYNAMIC_LINEART)
|
||||
{
|
||||
depth=8;
|
||||
}
|
||||
if (depth == 16)
|
||||
flags |= SCAN_FLAG_DISABLE_GAMMA;
|
||||
|
||||
|
@ -4679,7 +4684,7 @@ gl841_init_regs_for_scan (Genesys_Device * dev)
|
|||
|
||||
flags=0;
|
||||
|
||||
/* we aneable true gray for cis scanners only, and just when doing
|
||||
/* we enable true gray for cis scanners only, and just when doing
|
||||
* scan since color calibration is OK for this mode
|
||||
*/
|
||||
flags = 0;
|
||||
|
@ -4687,6 +4692,12 @@ gl841_init_regs_for_scan (Genesys_Device * dev)
|
|||
{
|
||||
flags |= OPTICAL_FLAG_ENABLE_LEDADD;
|
||||
}
|
||||
/* enable emulated lineart from gray data */
|
||||
if(dev->settings.scan_mode == SCAN_MODE_LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
}
|
||||
|
||||
status = gl841_init_scan_regs (dev,
|
||||
dev->reg,
|
||||
|
|
|
@ -497,13 +497,18 @@ typedef struct
|
|||
|
||||
unsigned int color_filter;
|
||||
|
||||
int true_gray; /**> true if scan is true gray, false if monochrome scan */
|
||||
/**> true if scan is true gray, false if monochrome scan */
|
||||
int true_gray;
|
||||
|
||||
/* BW threshold */
|
||||
/**> lineart threshold */
|
||||
int threshold;
|
||||
|
||||
/* Disable interpolation for xres<yres*/
|
||||
/**> Disable interpolation for xres<yres*/
|
||||
int disable_interpolation;
|
||||
|
||||
/**> true is lineart is generated from gray data by
|
||||
* the dynamic rasterization algo */
|
||||
int dynamic_lineart;
|
||||
} Genesys_Settings;
|
||||
|
||||
typedef struct Genesys_Current_Setup
|
||||
|
|
Ładowanie…
Reference in New Issue