sane-project-website/old-archive/1997-02/0147.html

228 wiersze
9.0 KiB
HTML

<!-- received="Wed May 14 09:29:10 1997 MST" -->
<!-- sent="Wed, 14 May 1997 09:16:08 -0700" -->
<!-- name="David Mosberger-Tang" -->
<!-- email="davidm@azstarnet.com" -->
<!-- subject="[patch] Re: sane-0.57 available" -->
<!-- id="199705141616.JAA15860@panda.mosberger" -->
<!-- inreplyto="199705140854.KAA27559@hoggle.syscomp.de" -->
<title>sane-devel: [patch] Re: sane-0.57 available</title>
<h1>[patch] Re: sane-0.57 available</h1>
<b>David Mosberger-Tang</b> (<a href="mailto:davidm@azstarnet.com"><i>davidm@azstarnet.com</i></a>)<br>
<i>Wed, 14 May 1997 09:16:08 -0700</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#147">[ date ]</a><a href="index.html#147">[ thread ]</a><a href="subject.html#147">[ subject ]</a><a href="author.html#147">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0148.html">becka@sunserver1.rz.uni-duesseldorf.de: "Re: Scanner and Printer - Copier"</a>
<li> <b>Previous message:</b> <a href="0146.html">Reimond Rombey: "Scanner and Printer - Copier"</a>
<li> <b>In reply to:</b> <a href="0146.html">Reimond Rombey: "Scanner and Printer - Copier"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
<i>&gt;&gt;&gt;&gt;&gt; On Wed, 14 May 1997 10:54:55 +0200 (MET DST), Matthias Lautner &lt;l=</i><br>
<a href="mailto:autner@hoggle.syscomp.de">autner@hoggle.syscomp.de</a>&gt; said:<br>
<p>
Matthias&gt; Hi! I tested sane-0.57 on my MFS-12000CX 3-pass scanner<br>
Matthias&gt; and got errors while scanning color images with gamma<br>
Matthias&gt; table allthough the scanned image looks good.<br>
<p>
I don't see off-hand what's going wrong (and am a bit short of time).<br>
The red/green/blue gamma tables should not be set at all for 3-pass<br>
scanners (each pass, a (different) gray-scale gamma table should be<br>
down-loaded only). Can you investigate? For debugging purposes, it's<br>
recommended to run configure with --disable-shared.<br>
<p>
Matthias&gt; The progress bar of xscanimage stops at each scan after<br>
Matthias&gt; about 90% and proceeds to 100% on the next pass<br>
<p>
Hmmh, the next pass should use a _new_ progress bar. Is that not<br>
what's happening?<br>
<p>
Matthias&gt; Halftone scanning with xscanimage: pattern size 0 works<br>
Matthias&gt; good. In all other cases the Pattern box has only a<br>
Matthias&gt; horizontal Line. How can I set the patterns. xscanimage<br>
Matthias&gt; offers only a curve to alter like gamma correction.<br>
<p>
Yeah, I'm not sure I really care about the half-tone pattern. If<br>
somebody knows how it's being used and what it's useful for, they can<br>
feel free to make it work. I'm sure there are some cases where this<br>
would be useful, but I haven't had any need for halftone scanning with<br>
customized half-tone pattern. I suspect what we'd need to support<br>
this properly is a "matrix" data type.<br>
<p>
Matthias&gt; The brightness and contrast is calculated wrong for 3-pass<br>
Matthias&gt; mustek scanners. change in function encode_percentage()<br>
Matthias&gt; in mustek.c code =3D (int) ((value / 100.0 / quant) + 0.5) =<br>
+<br>
Matthias&gt; 0x0c; to code =3D (int) (((value +100) / 100.0 * 12.0) +<br>
Matthias&gt; 0.5); // quant is now unused<br>
<p>
Oh, there was indeed a bug in there. I the patch below should make<br>
it work correctly (at least according to my docs).<br>
<p>
Matthias&gt; In color scanning the previous settings of brightness and<br>
Matthias&gt; contrast from a former Lineart scan are used and take<br>
Matthias&gt; effect. Why shouldn=B4t it be allowed to set brightness<br>
Matthias&gt; and contrast in color mode?<br>
<p>
At least for single-pass scanners those controls have absolutely no<br>
effect in color mode (I confirmed this with Mustek). If you tell me<br>
that they work in color-mode for 3-pass scanners, just let me know and<br>
I'll enable them for those scanners.<br>
<p>
Oh, would you mind telling me what the label on the front of your<br>
scanner is? The firmware revision would be useful as well (see output<br>
of "SANE_DEBUG_MUSTEK=3D2 scanimage -d mustek -h &gt;/dev/null").<br>
<p>
=09--david<br>
<p>
--- mustek.c~=09Sat May 10 15:05:11 1997<br>
+++ mustek.c=09Wed May 14 08:53:49 1997<br>
@@ -57,49 +57,65 @@<br>
static Mustek_Scanner *first_handle;<br>
=20<br>
static const SANE_String_Const mode_list[] =3D<br>
-{<br>
- "Lineart", "Halftone", "Gray",<br>
- "Color Lineart", "Color Halftone", "Color",<br>
- 0<br>
-};<br>
+ {<br>
+ "Lineart", "Halftone", "Gray",<br>
+ "Color Lineart", "Color Halftone", "Color",<br>
+ 0<br>
+ };<br>
=20<br>
static const SANE_String_Const speed_list[] =3D<br>
-{<br>
- "Slowest", "Slower", "Normal", "Faster", "Fastest",<br>
- 0<br>
-};<br>
+ {<br>
+ "Slowest", "Slower", "Normal", "Faster", "Fastest",<br>
+ 0<br>
+ };<br>
=20<br>
static const SANE_String_Const source_list[] =3D<br>
-{<br>
- "Flatbed", "Automatic Document Feeder", "Transparency Adapter",<br>
- 0<br>
-};<br>
+ {<br>
+ "Flatbed", "Automatic Document Feeder", "Transparency Adapter",<br>
+ 0<br>
+ };<br>
=20<br>
static const SANE_Int grain_list[] =3D<br>
-{<br>
- 6,=09=09=09=09/* # of elements */<br>
- 2, 3, 4, 5, 6, 8<br>
-};<br>
+ {<br>
+ 6,=09=09=09=09/* # of elements */<br>
+ 2, 3, 4, 5, 6, 8<br>
+ };<br>
=20<br>
static const SANE_Range u8_range =3D<br>
-{<br>
- 0,=09=09=09=09/* minimum */<br>
- 255,=09=09=09=09/* maximum */<br>
- 0=09=09=09=09/* quantization */<br>
-};<br>
+ {<br>
+ 0,=09=09=09=09/* minimum */<br>
+ 255,=09=09=09=09/* maximum */<br>
+ 0=09=09=09=09/* quantization */<br>
+ };<br>
=20<br>
static const SANE_Int pattern_dimension_list[] =3D<br>
-{<br>
- 8,=09=09=09=09/* # of elements */<br>
- 0, 2, 3, 4, 5, 6, 7, 8<br>
-};<br>
+ {<br>
+ 8,=09=09=09=09/* # of elements */<br>
+ 0, 2, 3, 4, 5, 6, 7, 8<br>
+ };<br>
=20<br>
static const SANE_Range percentage_range =3D<br>
-{<br>
- -100 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* minimum */<br>
- 100 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* maximum */<br>
- 1 &lt;&lt; SANE_FIXED_SCALE_SHIFT=09/* quantization */<br>
-};<br>
+ {<br>
+ -100 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* minimum */<br>
+ 100 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* maximum */<br>
+ 1 &lt;&lt; SANE_FIXED_SCALE_SHIFT=09/* quantization */<br>
+ };<br>
+<br>
+/* for three-pass (ax) scanners: */<br>
+<br>
+static const SANE_Range ax_brightness_range =3D<br>
+ {<br>
+ -36 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* minimum */<br>
+ 36 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* maximum */<br>
+ 3 &lt;&lt; SANE_FIXED_SCALE_SHIFT=09/* quantization */<br>
+ };<br>
+<br>
+static const SANE_Range ax_contrast_range =3D<br>
+ {<br>
+ -84 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* minimum */<br>
+ 84 &lt;&lt; SANE_FIXED_SCALE_SHIFT,=09/* maximum */<br>
+ 7 &lt;&lt; SANE_FIXED_SCALE_SHIFT=09/* quantization */<br>
+ };<br>
=20<br>
/* Color band codes: */<br>
#define MUSTEK_CODE_GRAY=09=090<br>
@@ -523,7 +539,7 @@<br>
}<br>
else<br>
{<br>
- code =3D (int) ((value / 100.0 / quant) + 0.5) + 0x0c;<br>
+ code =3D (int) ((value / quant) + 0.5) + 0x0c;<br>
max =3D 0x18;<br>
}<br>
if (code &gt; max)<br>
@@ -1188,7 +1204,10 @@<br>
s-&gt;opt[OPT_BRIGHTNESS].cap |=3D SANE_CAP_INACTIVE;<br>
s-&gt;opt[OPT_BRIGHTNESS].unit =3D SANE_UNIT_PERCENT;<br>
s-&gt;opt[OPT_BRIGHTNESS].constraint_type =3D SANE_CONSTRAINT_RANGE;<br>
- s-&gt;opt[OPT_BRIGHTNESS].constraint.range =3D &amp;percentage_range;<br>
+ if (s-&gt;hw-&gt;flags &amp; MUSTEK_FLAG_SINGLE_PASS)<br>
+ s-&gt;opt[OPT_BRIGHTNESS].constraint.range =3D &amp;percentage_range;<br>
+ else<br>
+ s-&gt;opt[OPT_BRIGHTNESS].constraint.range =3D &amp;ax_brightness_range;<br>
s-&gt;val[OPT_BRIGHTNESS].w =3D 0;<br>
=20<br>
/* contrast */<br>
@@ -1201,7 +1220,10 @@<br>
s-&gt;opt[OPT_CONTRAST].cap |=3D SANE_CAP_INACTIVE;<br>
s-&gt;opt[OPT_CONTRAST].unit =3D SANE_UNIT_PERCENT;<br>
s-&gt;opt[OPT_CONTRAST].constraint_type =3D SANE_CONSTRAINT_RANGE;<br>
- s-&gt;opt[OPT_CONTRAST].constraint.range =3D &amp;percentage_range;<br>
+ if (s-&gt;hw-&gt;flags &amp; MUSTEK_FLAG_SINGLE_PASS)<br>
+ s-&gt;opt[OPT_CONTRAST].constraint.range =3D &amp;percentage_range;<br>
+ else<br>
+ s-&gt;opt[OPT_CONTRAST].constraint.range =3D &amp;ax_contrast_range;<br>
s-&gt;val[OPT_CONTRAST].w =3D 0;<br>
=20<br>
/* custom-gamma table */<br>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.azstarnet.com/~axplinux/sane/">http://www.azstarnet.com/~axplinux/sane/</a>
To unsubscribe: mail -s unsubscribe <a href="mailto:sane-devel-request@listserv.azstarnet.com">sane-devel-request@listserv.azstarnet.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0148.html">becka@sunserver1.rz.uni-duesseldorf.de: "Re: Scanner and Printer - Copier"</a>
<li> <b>Previous message:</b> <a href="0146.html">Reimond Rombey: "Scanner and Printer - Copier"</a>
<li> <b>In reply to:</b> <a href="0146.html">Reimond Rombey: "Scanner and Printer - Copier"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>