Fixed resolutions for BearPaw 1200 TA. Increase the lowest black for CCD

coarse calibration. Adjusted internal gamma correction.  CCD scanners use
color mode for coarse+quality cal now. Preview isn't always in 8 bit mode now
(can be selected by option). Upper and lower limits for coarse calibration are
unified now. Added options for adjusting gain and offset.
merge-requests/1/head
Henning Geinitz 2003-02-05 16:02:45 +00:00
rodzic b88fb0a410
commit 5b79536901
8 zmienionych plików z 143 dodań i 24 usunięć

Wyświetl plik

@ -1,3 +1,15 @@
2003-02-05 Henning Meier-Geinitz <henning@meier-geinitz.de>
* backend/gt68xx.c backend/gt68xx_devices.c backend/gt68xx_high.c
backend/gt68xx_high.h doc/descriptions/gt68xx.desc
doc/descriptions/unsupported.desc doc/gt68xx/gt68xx.CHANGES:
Fixed resolutions for BearPaw 1200 TA. Increase the lowest black
for CCD coarse calibration. Adjusted internal gamma correction.
CCD scanners use color mode for coarse+quality cal now. Preview isn't
always in 8 bit mode now (can be selected by option). Upper and lower
limits for coarse calibration are unified now. Added options for
adjusting gain and offset.
2003-02-04 Michael Herder <crapsite@gmx.net>
* doc/descriptions/artec_eplus48u.desc:

Wyświetl plik

@ -48,7 +48,7 @@
#include "../include/sane/config.h"
#define BUILD 37
#define BUILD 38
#define MAX_DEBUG
#define WARMUP_TIME 30
#define CALIBRATION_HEIGHT 2.5
@ -144,7 +144,7 @@ static const SANE_Range exposure_range = {
};
static const SANE_Range offset_range = {
0, /* minimum */
-63, /* minimum */
63, /* maximum */
1 /* quantization */
};
@ -287,7 +287,7 @@ setup_scan_request (GT68xx_Scanner * s, GT68xx_Scan_Request * scan_request)
scan_request->xdpi = s->dev->model->optical_xdpi;
scan_request->ydpi = s->val[OPT_RESOLUTION].w;
if (IS_ACTIVE (OPT_BIT_DEPTH) && !s->val[OPT_PREVIEW].w)
if (IS_ACTIVE (OPT_BIT_DEPTH) && (!s->val[OPT_PREVIEW].w || !s->val[OPT_FAST_PREVIEW].w))
scan_request->depth = s->val[OPT_BIT_DEPTH].w;
else
scan_request->depth = 8;
@ -544,7 +544,7 @@ init_options (GT68xx_Scanner * s)
s->opt[OPT_FULL_SCAN].constraint_type = SANE_CONSTRAINT_NONE;
s->val[OPT_FULL_SCAN].w = SANE_FALSE;
/* automatic gain */
/* coarse calibration */
s->opt[OPT_COARSE_CAL].name = "coarse-calibration";
s->opt[OPT_COARSE_CAL].title = SANE_I18N ("Coarse calibration");
s->opt[OPT_COARSE_CAL].desc =
@ -557,7 +557,7 @@ init_options (GT68xx_Scanner * s)
s->opt[OPT_COARSE_CAL].constraint_type = SANE_CONSTRAINT_NONE;
s->val[OPT_COARSE_CAL].w = SANE_TRUE;
/* automatic gain only once */
/* coarse calibration only once */
s->opt[OPT_COARSE_CAL_ONCE].name = "coarse-calibration-once";
s->opt[OPT_COARSE_CAL_ONCE].title =
SANE_I18N ("Coarse calibration for first scan only");
@ -580,6 +580,16 @@ init_options (GT68xx_Scanner * s)
s->opt[OPT_QUALITY_CAL].constraint_type = SANE_CONSTRAINT_NONE;
s->val[OPT_QUALITY_CAL].w = SANE_TRUE;
/* fast preview */
s->opt[OPT_FAST_PREVIEW].name = "fast-preview";
s->opt[OPT_FAST_PREVIEW].title = SANE_I18N ("Fast preview");
s->opt[OPT_FAST_PREVIEW].desc =
SANE_I18N ("Request that all previews are done in in the fastest "
"(low-quality) mode. This may be a non-color mode or a low "
"resolution mode.");
s->opt[OPT_FAST_PREVIEW].type = SANE_TYPE_BOOL;
s->val[OPT_FAST_PREVIEW].w = SANE_FALSE;
/* "Enhancement" group: */
s->opt[OPT_ENHANCEMENT_GROUP].title = SANE_I18N ("Enhancement");
s->opt[OPT_ENHANCEMENT_GROUP].desc = "";
@ -610,6 +620,32 @@ init_options (GT68xx_Scanner * s)
s->val[OPT_THRESHOLD].w = 128;
DISABLE (OPT_THRESHOLD);
/* gain correction */
s->opt[OPT_GAIN].name = "gain";
s->opt[OPT_GAIN].title =
SANE_I18N ("Gain correction");
s->opt[OPT_GAIN].desc =
SANE_I18N ("This value is added to the internal gain value. "
"Use for extremely light or dark images.");
s->opt[OPT_GAIN].type = SANE_TYPE_INT;
s->opt[OPT_GAIN].unit = SANE_UNIT_NONE;
s->opt[OPT_GAIN].constraint_type = SANE_CONSTRAINT_RANGE;
s->opt[OPT_GAIN].constraint.range = &offset_range;
s->val[OPT_GAIN].w = 0;
/* offset correction */
s->opt[OPT_OFFSET].name = "offset";
s->opt[OPT_OFFSET].title =
SANE_I18N ("Offset correction");
s->opt[OPT_OFFSET].desc =
SANE_I18N ("This value is added to the internal offset value. "
"Use for extremely light or dark images.");
s->opt[OPT_OFFSET].type = SANE_TYPE_INT;
s->opt[OPT_OFFSET].unit = SANE_UNIT_NONE;
s->opt[OPT_OFFSET].constraint_type = SANE_CONSTRAINT_RANGE;
s->opt[OPT_OFFSET].constraint.range = &offset_range;
s->val[OPT_OFFSET].w = 0;
/* "Geometry" group: */
s->opt[OPT_GEOMETRY_GROUP].title = SANE_I18N ("Geometry");
s->opt[OPT_GEOMETRY_GROUP].desc = "";
@ -1341,7 +1377,10 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
case OPT_FULL_SCAN:
case OPT_COARSE_CAL:
case OPT_COARSE_CAL_ONCE:
case OPT_OFFSET:
case OPT_GAIN:
case OPT_QUALITY_CAL:
case OPT_FAST_PREVIEW:
case OPT_PREVIEW:
case OPT_LAMP_ON:
case OPT_AUTO_WARMUP:
@ -1387,6 +1426,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
case OPT_RESOLUTION:
case OPT_BIT_DEPTH:
case OPT_FULL_SCAN:
case OPT_FAST_PREVIEW:
case OPT_PREVIEW:
case OPT_TL_X:
case OPT_TL_Y:
@ -1399,6 +1439,8 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
case OPT_LAMP_ON:
case OPT_AUTO_WARMUP:
case OPT_COARSE_CAL_ONCE:
case OPT_OFFSET:
case OPT_GAIN:
case OPT_QUALITY_CAL:
case OPT_GAMMA_VALUE:
case OPT_THRESHOLD:
@ -1547,12 +1589,15 @@ sane_start (SANE_Handle handle)
for (i = 0; i < gamma_size; i++)
{
s->gamma_table [i] =
(gamma_size - 1) * pow (((double) i) / (gamma_size - 1),
(gamma_size - 1) * pow (((double) i + 1) / (gamma_size),
1.0 / SANE_UNFIX(s->dev->gamma_value)) + 0.5;
if (s->gamma_table [i] > (gamma_size - 1))
s->gamma_table [i] = (gamma_size - 1);
if (s->gamma_table [i] < 0)
s->gamma_table [i] = 0;
#if 0
printf ("%d %d\n", i, s->gamma_table [i]);
#endif
}
s->calib = s->val[OPT_QUALITY_CAL].w;

Wyświetl plik

@ -269,7 +269,7 @@ static GT68xx_Model mustek_1200ta_model = {
SANE_TRUE, /* Use base_ydpi for all resolutions */
{600, 300, 150, 75, 50, 0}, /* possible x-resolutions */
{1200, 600, 300, 150, 100, 50, 0}, /* possible y-resolutions */
{1200, 600, 300, 150, 75, 50, 0}, /* possible y-resolutions */
{16, 12, 8, 0}, /* possible depths in gray mode */
{16, 12, 8, 0}, /* possible depths in color mode */

Wyświetl plik

@ -52,7 +52,8 @@
static SANE_Status
gt68xx_afe_ccd_auto (GT68xx_Scanner * scanner, GT68xx_Scan_Request * request);
static SANE_Status gt68xx_afe_cis_auto (GT68xx_Scanner * scanner);
static void
gt68xx_afe_correction (SANE_Byte * value, SANE_Int correction);
SANE_Status
gt68xx_calibrator_new (SANE_Int width,
@ -476,7 +477,7 @@ gt68xx_scanner_start_scan_extended (GT68xx_Scanner * scanner,
{
DECLARE_FUNCTION_NAME ("gt68xx_scanner_start_scan_extended")
SANE_Status status;
GT68xx_AFE_Parameters *afe = scanner->dev->afe;
GT68xx_AFE_Parameters afe = *scanner->dev->afe;
status = gt68xx_scanner_wait_for_positioning (scanner);
if (status != SANE_STATUS_GOOD)
@ -518,10 +519,25 @@ gt68xx_scanner_start_scan_extended (GT68xx_Scanner * scanner,
}
DBG (5,
"gt68xx_start_scan_extended: afe: %02X %02X %02X %02X %02X %02X\n",
afe->r_offset, afe->r_pga, afe->g_offset, afe->g_pga, afe->b_offset,
afe->b_pga);
afe.r_offset, afe.r_pga, afe.g_offset, afe.g_pga, afe.b_offset,
afe.b_pga);
status = gt68xx_device_set_afe (scanner->dev, afe);
if (action == SA_SCAN)
{
gt68xx_afe_correction (&afe.r_offset, scanner->val[OPT_OFFSET].w);
gt68xx_afe_correction (&afe.g_offset, scanner->val[OPT_OFFSET].w);
gt68xx_afe_correction (&afe.b_offset, scanner->val[OPT_OFFSET].w);
gt68xx_afe_correction (&afe.r_pga, scanner->val[OPT_GAIN].w);
gt68xx_afe_correction (&afe.b_pga, scanner->val[OPT_GAIN].w);
gt68xx_afe_correction (&afe.g_pga, scanner->val[OPT_GAIN].w);
DBG (5,
"gt68xx_start_scan_extended: corrected afe: %02X %02X %02X %02X %02X %02X\n",
afe.r_offset, afe.r_pga, afe.g_offset, afe.g_pga, afe.b_offset,
afe.b_pga);
}
status = gt68xx_device_set_afe (scanner->dev, &afe);
if (status != SANE_STATUS_GOOD)
{
XDBG ((5, "%s: gt68xx_device_set_afe failed: %s\n", function_name,
@ -678,8 +694,12 @@ gt68xx_scanner_calibrate (GT68xx_Scanner * scanner,
req.mds = SANE_TRUE;
req.mas = SANE_FALSE;
#if 0
if (scanner->dev->model->is_cis == SANE_TRUE)
req.color = SANE_TRUE;
#else
req.color = SANE_TRUE;
#endif
if (req.use_ta)
{
@ -881,12 +901,18 @@ gt68xx_scanner_read_line (GT68xx_Scanner * scanner,
}
else
{
#if 0
if (scanner->dev->model->is_cis == SANE_TRUE)
gt68xx_calibrator_process_line (scanner->cal_g,
buffer_pointers[0]);
else
gt68xx_calibrator_process_line (scanner->cal_gray,
buffer_pointers[0]);
#else
gt68xx_calibrator_process_line (scanner->cal_g,
buffer_pointers[0]);
#endif
}
}
@ -921,13 +947,15 @@ struct GT68xx_Afe_Values
SANE_Int scan_dpi;
SANE_Fixed start_black;
SANE_Int offset_direction;
SANE_Int coarse_black;
SANE_Int coarse_white;
};
#ifndef NDEBUG
static void
gt68xx_afe_dump (SANE_String_Const phase, int i, GT68xx_AFE_Parameters * afe)
{
XDBG ((5, "set afe %s %2d: RGB offset/pga: %02x %02x %02x %02x "
XDBG ((3, "set afe %s %2d: RGB offset/pga: %02x %02x %02x %02x "
"%02x %02x\n",
phase, i, afe->r_offset, afe->r_pga, afe->g_offset, afe->g_pga,
afe->b_offset, afe->b_pga));
@ -944,6 +972,17 @@ gt68xx_afe_exposure_dump (SANE_String_Const phase, int i,
}
#endif /* not NDEBUG */
static void
gt68xx_afe_correction (SANE_Byte * value, SANE_Int correction)
{
SANE_Int corrected_value = *value + correction;
if (corrected_value < 0)
corrected_value = 0;
if (corrected_value > 63)
corrected_value = 63;
*value = corrected_value;
}
/************************************************************************/
/* CCD scanners */
/************************************************************************/
@ -1033,8 +1072,8 @@ gt68xx_afe_ccd_adjust_offset_gain (GT68xx_Afe_Values * values,
unsigned int *buffer, SANE_Byte * offset,
SANE_Byte * pga)
{
SANE_Int black_low = 3, black_high = 18;
SANE_Int white_low = 234, white_high = 252;
SANE_Int black_low = values->coarse_black, black_high = black_low + 15;
SANE_Int white_high = values->coarse_white, white_low = white_high - 15;
SANE_Bool done = SANE_TRUE;
gt68xx_afe_ccd_calc (values, buffer);
@ -1096,8 +1135,8 @@ gt68xx_afe_ccd_adjust_offset_gain (GT68xx_Afe_Values * values,
goto finish;
}
finish:
DBG (5, "%swhite=%d, black=%d, offset=%d, gain=%d\n",
done ? "DONE: " : "", values->white, values->black, *offset, *pga);
DBG (5, "%swhite=%d, black=%d, offset=%d, gain=%d, total_white=%d\n",
done ? "DONE: " : "", values->white, values->black, *offset, *pga, values->total_white);
return done;
}
@ -1138,7 +1177,8 @@ gt68xx_afe_ccd_auto (GT68xx_Scanner * scanner,
request.xdpi = 300;
request.ydpi = 300;
request.depth = 8;
request.color = orig_request->color;
/* request.color = orig_request->color;*/
request.color = SANE_TRUE;
request.mas = SANE_FALSE;
request.mbs = SANE_FALSE;
request.mds = SANE_TRUE;
@ -1174,6 +1214,9 @@ gt68xx_afe_ccd_auto (GT68xx_Scanner * scanner,
values.start_black = SANE_FIX (20.0);
else
values.start_black = scanner->dev->model->x_offset_mark;
values.coarse_black = 5;
values.coarse_white = 250;
request.mds = SANE_FALSE;
XDBG ((5, "%s: scan_dpi=%d, calwidth=%d, max_width=%d, "
"start_black=%.1f mm\n", function_name, values.scan_dpi,
@ -1350,7 +1393,7 @@ gt68xx_afe_cis_adjust_offset (GT68xx_Afe_Values * values,
SANE_Byte * offset)
{
SANE_Int offs = 0, tmp_offset = *offset;
SANE_Int low = 8, high = 22;
SANE_Int low = values->coarse_black, high = low + 15;
gt68xx_afe_cis_calc_black (values, black_buffer);
if (values->black < low)
@ -1389,15 +1432,16 @@ gt68xx_afe_cis_adjust_gain (GT68xx_Afe_Values * values,
unsigned int *white_buffer, SANE_Byte * gain)
{
SANE_Int g = *gain;
SANE_Int white_high = values->coarse_white, white_low = white_high - 15;
gt68xx_afe_cis_calc_white (values, white_buffer);
if (values->white < 235)
if (values->white < white_low)
{
g += 1;
DBG (5, "white = %d (too low) --> gain += 1\n", values->white);
}
else if (values->white > 250)
else if (values->white > white_high)
{
g -= 1;
DBG (5, "white = %d (too high) --> gain -= 1\n", values->white);
@ -1501,6 +1545,8 @@ gt68xx_afe_cis_read_lines (GT68xx_Afe_Values * values,
values->scan_dpi = params.xdpi;
values->calwidth = params.pixel_xs;
values->callines = params.pixel_ys;
values->coarse_black = 5;
values->coarse_white = 250;
if (r_buffer && g_buffer && b_buffer)
for (line = 0; line < values->callines; line++)

Wyświetl plik

@ -199,10 +199,13 @@ enum GT68xx_Option
OPT_COARSE_CAL,
OPT_COARSE_CAL_ONCE,
OPT_QUALITY_CAL,
OPT_FAST_PREVIEW,
OPT_ENHANCEMENT_GROUP,
OPT_GAMMA_VALUE,
OPT_THRESHOLD,
OPT_GAIN,
OPT_OFFSET,
OPT_GEOMETRY_GROUP,
OPT_TL_X, /* top-left x */

Wyświetl plik

@ -1,6 +1,6 @@
:backend "gt68xx"
:status :beta
:version "1.0-37"
:version "1.0-38"
:manpage "sane-gt68xx"
:url "http://www.meier-geinitz.de/sane/gt68xx-backend/"
:comment "Only the USB scanners mentioned below are supported. For other Mustek BearPaws, look at the Plustek backend."

Wyświetl plik

@ -9,7 +9,7 @@
;
:backend "unsupported" ; name of backend
:version "2003-01-28" ; version of backend
:version "2003-02-04" ; version of backend
;:status :stable ; :alpha, :beta, :stable, :new
;:manpage "sane-mustek" ; name of manpage (if it exists)
;:url "http://www.meier-geinitz.de/sane/mustek-backend/"
@ -365,7 +365,7 @@
:url "http://groups.google.com/groups?as_umsgid=%3Cb0pvfg%24oa1%241%40newsg2.svr.pol.co.uk%3E"
:interface "USB"
:status :unsupported
:comment "Not supported. Chipset unknown, maybe `E1'. Vendor/product 0x0461/0x0347 (Primax!). One bulk-in and one bulk-out ep. See link to usenet posting for some more details."
:comment "Not supported. Chipset probably lm9830 + E5 (=GL640usb)???. Vendor/product 0x0461/0x0347 (Primax!). One bulk-in and one bulk-out ep. See link to usenet posting for some more details. Maybe it can be supported by the canon630u backend?"
;********************************************************************************************

Wyświetl plik

@ -1,5 +1,18 @@
gt68xx.CHANGES -*-text-*-
V 1.0-38 (2003-02-05)
- Fixed resolutions for BearPaw 1200 TA (75 instead of 100).
- Increase the lowest black for CCD coarse calibration to avoid too much black.
- Adjusted internal gamma correction to avoid getting 0 for high gamma values.
- CCD scanners use color mode for coarse+quality cal now. This fixes the
problem with extremly high gains and terrible quality cal in gray mode at
least for the BearPaw 1200 TA.
--> Thanks to Alexei V. Mezin for reporting these bugs.
- Preview isn't always in 8 bit mode now (can be selected by option).
- Upper and lower limits for coarse calibration are unified now.
- Added options for adjusting gain and offset.
V 1.0-37 (2003-01-18)
- Removed untested flag from A3 USB and Lexmark X70/X73.