sane-project-website/old-archive/1998-04/0127.html

140 wiersze
5.6 KiB
HTML

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!-- received="Mon Apr 13 15:17:10 1998 PDT" -->
<!-- sent="Tue, 14 Apr 1998 00:01:46 +0200" -->
<!-- name="Henning Meier-Geinitz" -->
<!-- email="henningmg@gmx.de" -->
<!-- subject="line-distance correction and mustek 600 II N" -->
<!-- id="" -->
<!-- inreplyto="" -->
<title>sane-devel: line-distance correction and mustek 600 II N</title>
<h1>line-distance correction and mustek 600 II N</h1>
<b>Henning Meier-Geinitz</b> (<a href="mailto:henningmg@gmx.de"><i>henningmg@gmx.de</i></a>)<br>
<i>Tue, 14 Apr 1998 00:01:46 +0200</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#127">[ date ]</a><a href="index.html#127">[ thread ]</a><a href="subject.html#127">[ subject ]</a><a href="author.html#127">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0128.html">Henning Meier-Geinitz: "Performance mustek 600 II N"</a>
<li> <b>Previous message:</b> <a href="0126.html">Oliver.Rauch@Wolfsburg.DE: "Re: /proc/scsi/scsi"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
I looked into the line-distance correction code for the mustek 600 II<br>
N in mustek.c. Some details are explained in an earlier article. With<br>
the patch color works somewhat, but there are missing lines at the<br>
end. The problem is: The scanner sends data one line after the other<br>
in the following manner (Example):<br>
<p>
R-R-R-R-B-B-R-B-G-R-B-G ... R-G-B-R-G-B<br>
<p>
If n is the distance between two CCD lines, sane loses 3*n data lines<br>
at the end of the scan. The line-distance code in sane asumes the<br>
following: <br>
<p>
R-R-R-R-B-B-R-B-G-R-B-G ... R-G-B-G-B-G-B-G-G-G<br>
<p>
If I understood correctly, mustek.c would have to scan n more lines<br>
then specified to get the full sized image. I don't know most<br>
internals of mustek.c so I can't do this.<br>
<p>
By the way: My 600 II N doesn't need the line-distance-fix, the<br>
line-distance values which it sends are correct. I don't know, if this<br>
applies for all 600 II N.<br>
<p>
The following patch corrects the color scanning problem with the 600<br>
II N as far as I can do it. It will (hopefully) fix the problem with<br>
not ignoring empty lines in mustek.conf. And I put a usleep in<br>
sanei_ab306.c. This will allow to run sane without turning on<br>
debugging (which was the only way to get sane with the 600 II N to<br>
work for me). I don't know, why it works, but it does.<br>
<p>
<p>
diff -ru sane-0.72.orig/backend/mustek.c sane-0.72/backend/mustek.c<br>
--- sane-0.72.orig/backend/mustek.c Tue Mar 3 04:02:43 1998<br>
+++ sane-0.72/backend/mustek.c Mon Apr 13 21:25:53 1998<br>
@@ -1394,7 +1394,7 @@<br>
}<br>
}<br>
<br>
- num_saved_lines = s-&gt;ld.index[0] - s-&gt;ld.index[2];<br>
+ num_saved_lines = s-&gt;ld.index[0] - s-&gt;ld.index[1];<br>
if (num_saved_lines &gt; 0)<br>
/* restore the previously saved lines: */<br>
memcpy (out, s-&gt;ld.buf[0], num_saved_lines * bpl);<br>
@@ -1404,10 +1404,10 @@<br>
if (++s-&gt;ld.lmod3 &gt;= 3)<br>
s-&gt;ld.lmod3 = 0;<br>
<br>
- c = color_seq[s-&gt;ld.lmod3];<br>
+ c = s-&gt;ld.lmod3;<br>
if (s-&gt;ld.index[c] &lt; 0)<br>
++s-&gt;ld.index[c];<br>
- else if (s-&gt;ld.index[c] &lt; s-&gt;params.lines)<br>
+ else /*if (s-&gt;ld.index[c] &lt; s-&gt;params.lines)*/<br>
{<br>
s-&gt;ld.c[c].Qk += s-&gt;ld.peak_res;<br>
if (s-&gt;ld.c[c].Qk &gt; s-&gt;ld.max_value)<br>
@@ -1421,17 +1421,17 @@<br>
DBG (1, "fix_line_distance_pp: lmod3=%d, index=(%d,%d,%d)\n",<br>
s-&gt;ld.lmod3,<br>
s-&gt;ld.index[0], s-&gt;ld.index[1], s-&gt;ld.index[2]);<br>
- num_lines = s-&gt;ld.index[2] - s-&gt;ld.ld_line;<br>
+ num_lines = s-&gt;ld.index[1] - s-&gt;ld.ld_line;<br>
<br>
/* copy away the lines with at least one missing<br>
color component, so that we can interleave them<br>
with new scan data on the next call */<br>
- num_saved_lines = s-&gt;ld.index[0] - s-&gt;ld.index[2];<br>
+ num_saved_lines = s-&gt;ld.index[0] - s-&gt;ld.index[1];<br>
memcpy (s-&gt;ld.buf[0], out + num_lines * bpl,<br>
num_saved_lines * bpl);<br>
<br>
/* notice the number of lines we processed */<br>
- s-&gt;ld.ld_line = s-&gt;ld.index[2];<br>
+ s-&gt;ld.ld_line = s-&gt;ld.index[1];<br>
/* return number of complete (r+g+b) lines */<br>
return num_lines;<br>
}<br>
@@ -2048,11 +2048,11 @@<br>
continue;<br>
<br>
len = strlen (cp);<br>
- if (cp[len - 1] == '\n')<br>
- cp[--len] = '\0';<br>
-<br>
if (!len)<br>
continue; /* ignore empty lines */<br>
+<br>
+ if (cp[len - 1] == '\n')<br>
+ cp[--len] = '\0';<br>
<br>
if (strncmp (cp, "option", 6) == 0 &amp;&amp; isspace (cp[6]))<br>
{<br>
diff -ru sane-0.72.orig/sanei/sanei_ab306.c sane-0.72/sanei/sanei_ab306.c<br>
--- sane-0.72.orig/sanei/sanei_ab306.c Tue Mar 3 03:13:25 1998<br>
+++ sane-0.72/sanei/sanei_ab306.c Mon Apr 13 15:58:02 1998<br>
@@ -196,6 +196,8 @@<br>
ab306_inb (p, base + 1));<br>
while ((ab306_inb (p, base + 1) &amp; 0x20) == 0);<br>
<br>
+ usleep(100000);<br>
+ <br>
DBG(4, "ab306_write: writing data\n");<br>
for (i = 0; i &lt; len; ++i)<br>
{<br>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0128.html">Henning Meier-Geinitz: "Performance mustek 600 II N"</a>
<li> <b>Previous message:</b> <a href="0126.html">Oliver.Rauch@Wolfsburg.DE: "Re: /proc/scsi/scsi"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>