* backend/genesys.c backend/genesys.h backend/genesys_low.h

backend/genesys_conv.c backend/genesys_gl841.c: Added extended
   option "Threshold" for lineart mode(Thanks to Laurent Charpentier).
merge-requests/1/head
Pierre Willenbrock 2006-03-27 14:41:30 +00:00
rodzic 864fce1daa
commit 6b7031ca40
6 zmienionych plików z 51 dodań i 6 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2006-03-27 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
* backend/genesys.c backend/genesys.h backend/genesys_low.h
backend/genesys_conv.c backend/genesys_gl841.c: Added extended
option "Threshold" for lineart mode(Thanks to Laurent Charpentier).
2006-03-24 Julien Blache <jb@jblache.org>
* doc/*: Another batch of spelling fixes from A. Costa.

Wyświetl plik

@ -4,6 +4,7 @@
Copyright (C) 2004, 2005 Gerhard Jaeger <gerhard@gjaeger.de>
Copyright (C) 2004, 2005 Stephane Voltz <stefdev@modulonet.fr>
Copyright (C) 2005, 2006 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
Copyright (C) 2006 Laurent Charpentier <laurent_pubs@yahoo.com>
This file is part of the SANE package.
@ -120,6 +121,11 @@ static const SANE_Range u8_range = {
0 /* quantization */
};
static const SANE_Range threshold_percentage_range = {
SANE_FIX( 0), /* minimum */
SANE_FIX( 100), /* maximum */
SANE_FIX( 1) /* quantization */
};
/* ------------------------------------------------------------------------ */
/* functions calling ASIC specific functions */
@ -4291,7 +4297,8 @@ Problems with the first approach:
status = genesys_gray_lineart(work_buffer_src, destination,
dev->settings.pixels,
channels,
dst_lines);
dst_lines,
dev->settings.threshold);
if (status != SANE_STATUS_GOOD) {
DBG (DBG_error,
"genesys_read_ordered_data: failed to reverse bits(%s)\n",
@ -4418,6 +4425,9 @@ calc_parameters (Genesys_Scanner * s)
s->dev->settings.tl_x = tl_x;
s->dev->settings.tl_y = tl_y;
/* threshold setting */
s->dev->settings.threshold = 2.55 * (SANE_UNFIX (s->val[OPT_THRESHOLD].w));
return status;
}
@ -4596,6 +4606,17 @@ init_options (Genesys_Scanner * s)
s->opt[OPT_EXTRAS_GROUP].size = 0;
s->opt[OPT_EXTRAS_GROUP].constraint_type = SANE_CONSTRAINT_NONE;
/* BW threshold */
s->opt[OPT_THRESHOLD].name = SANE_NAME_THRESHOLD;
s->opt[OPT_THRESHOLD].title = SANE_TITLE_THRESHOLD;
s->opt[OPT_THRESHOLD].desc = SANE_DESC_THRESHOLD;
s->opt[OPT_THRESHOLD].type = SANE_TYPE_FIXED;
s->opt[OPT_THRESHOLD].unit = SANE_UNIT_PERCENT;
s->opt[OPT_THRESHOLD].cap |= SANE_CAP_INACTIVE;
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);
/* Powersave time (turn lamp off) */
s->opt[OPT_LAMP_OFF_TIME].name = "lamp-off-time";
s->opt[OPT_LAMP_OFF_TIME].title = SANE_I18N ("Lamp off time");
@ -5127,6 +5148,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
case OPT_TL_Y:
case OPT_BR_X:
case OPT_BR_Y:
case OPT_THRESHOLD:
case OPT_LAMP_OFF_TIME:
*(SANE_Word *) val = s->val[option].w;
break;
@ -5173,6 +5195,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
break;
case OPT_RESOLUTION:
case OPT_BIT_DEPTH:
case OPT_THRESHOLD:
case OPT_PREVIEW:
s->val[option].w = *(SANE_Word *) val;
RIE (calc_parameters (s));
@ -5207,12 +5230,12 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
s->val[option].s = strdup (val);
if (strcmp (s->val[option].s, "Lineart") == 0)
{
/* ENABLE (OPT_THRESHOLD); */
ENABLE (OPT_THRESHOLD);
DISABLE (OPT_BIT_DEPTH);
}
else
{
/* DISABLE (OPT_THRESHOLD); */
DISABLE (OPT_THRESHOLD);
if (strcmp (s->val[option].s, "Gray") == 0)
create_bpp_list (s, s->dev->model->bpp_gray_values);
else

Wyświetl plik

@ -2,6 +2,7 @@
Copyright (C) 2003, 2004 Henning Meier-Geinitz <henning@meier-geinitz.de>
Copyright (C) 2005 Stephane Voltz <svoltz@numericable.fr>
Copyright (C) 2006 Laurent Charpentier <laurent_pubs@yahoo.com>
This file is part of the SANE package.
@ -82,6 +83,7 @@ enum Genesys_Option
OPT_EXTRAS_GROUP,
OPT_LAMP_OFF_TIME,
OPT_THRESHOLD,
/* must come last: */
NUM_OPTIONS
};

Wyświetl plik

@ -1,6 +1,6 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2005 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
Copyright (C) 2005, 2006 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
This file is part of the SANE package.
@ -95,7 +95,8 @@ genesys_gray_lineart(
u_int8_t *dst_data,
size_t pixels,
size_t channels,
size_t lines)
size_t lines,
u_int8_t threshold)
{
size_t x,y,c,b;
for(y = 0; y < lines; y++) {
@ -104,7 +105,7 @@ genesys_gray_lineart(
*(dst_data + c) = 0;
for(b = 0; b < 8 && x+b < pixels; b++) {
for(c = 0; c < channels; c++) {
if (*src_data++ < 0x80)
if (*src_data++ < threshold)
*(dst_data + c) |= (0x80 >> b);
}
}

Wyświetl plik

@ -6,6 +6,7 @@
Copyright (C) 2004, 2005 Stephane Voltz <stefdev@modulonet.fr>
Copyright (C) 2005 Philipp Schmid <philipp8288@web.de>
Copyright (C) 2005, 2006 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
Copyright (C) 2006 Laurent Charpentier <laurent_pubs@yahoo.com>
This file is part of the SANE package.
@ -1396,6 +1397,7 @@ gl841_bulk_full_size (void)
/*
* Set all registers to default values
* (function called only once at the beginning)
*/
static void
gl841_init_registers (Genesys_Device * dev)
@ -2457,6 +2459,13 @@ gl841_init_optical_regs_scan(Genesys_Device * dev,
r = sanei_genesys_get_address (reg, 0x03);
r->value |= REG03_AVEENB | REG03_LAMPPWR;
/* BW threshold */
r = sanei_genesys_get_address (reg, 0x2e);
r->value = dev->settings.threshold;
r = sanei_genesys_get_address (reg, 0x2f);
r->value = dev->settings.threshold;
/* monochrome / color scan */
r = sanei_genesys_get_address (reg, 0x04);
switch (depth) {

Wyświetl plik

@ -5,6 +5,7 @@
Copyright (C) 2004, 2005 Gerhard Jaeger <gerhard@gjaeger.de>
Copyright (C) 2004, 2005 Stephane Voltz <stefdev@modulonet.fr>
Copyright (C) 2005 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
Copyright (C) 2006 Laurent Charpentier <laurent_pubs@yahoo.com>
Parts of the structs have been taken from the gt68xx backend by
Sergey Vlasov <vsu@altlinux.ru> et al.
@ -400,6 +401,9 @@ typedef struct
int exposure_time;
unsigned int color_filter; /* todo: check, may be make it an advanced option */
/* BW threshold */
int threshold;
} Genesys_Settings;
typedef struct Genesys_Current_Setup