Re: Scanner survey results

Henning Meier-Geinitz (hmg-ml@gmx.de)
Wed, 24 Mar 1999 23:17:11 +0100

[mustek 600 II N ver. 1.01]
> Yes, unfortunately I have one with firmware 1.01, and I have
> problems with color scanning. Currently I have Sane-pre1.01-2 on
> my system. What options should one set in mustek.conf to get the
> best possible results with this scanner?

Possibly a patch I posted some months ago can help a bit. It's against
an older version of sane but I think it will work with your version,
too. Perhaps you have to tweak it a bit.

Something like patch -p1 <patch.file in the sane directory should do
it.

Here is the old article describing the problem:

------------------------ snip ---------------------------------------
From: Henning Meier-Geinitz <henningmg@gmx.de>
To: sane-devel@mostang.com
Subject: line-distance correction and mustek 600 II N
Sender: owner-sane-devel@mostang.com

I looked into the line-distance correction code for the mustek 600 II
N in mustek.c. Some details are explained in an earlier article. With
the patch color works somewhat, but there are missing lines at the
end. The problem is: The scanner sends data one line after the other
in the following manner (Example):

R-R-R-R-B-B-R-B-G-R-B-G ... R-G-B-R-G-B

If n is the distance between two CCD lines, sane loses 3*n data lines
at the end of the scan. The line-distance code in sane asumes the
following:

R-R-R-R-B-B-R-B-G-R-B-G ... R-G-B-G-B-G-B-G-G-G

If I understood correctly, mustek.c would have to scan n more lines
then specified to get the full sized image. I don't know most
internals of mustek.c so I can't do this.

By the way: My 600 II N doesn't need the line-distance-fix, the
line-distance values which it sends are correct. I don't know, if this
applies for all 600 II N.

The following patch corrects the color scanning problem with the 600
II N as far as I can do it. It will (hopefully) fix the problem with
not ignoring empty lines in mustek.conf. And I put a usleep in
sanei_ab306.c. This will allow to run sane without turning on
debugging (which was the only way to get sane with the 600 II N to
work for me). I don't know, why it works, but it does.

---------------------------- snip ----------------------------------

... and here is the patch (only the color correction, the rest should
have been included in sane):

---------------------------- snip ----------------------------------
diff -ru sane-0.72.orig/backend/mustek.c sane-0.72/backend/mustek.c
--- sane-0.72.orig/backend/mustek.c Tue Mar 3 04:02:43 1998
+++ sane-0.72/backend/mustek.c Mon Apr 13 21:25:53 1998
@@ -1394,7 +1394,7 @@
}
}

- num_saved_lines = s->ld.index[0] - s->ld.index[2];
+ num_saved_lines = s->ld.index[0] - s->ld.index[1];
if (num_saved_lines > 0)
/* restore the previously saved lines: */
memcpy (out, s->ld.buf[0], num_saved_lines * bpl);
@@ -1404,10 +1404,10 @@
if (++s->ld.lmod3 >= 3)
s->ld.lmod3 = 0;

- c = color_seq[s->ld.lmod3];
+ c = s->ld.lmod3;
if (s->ld.index[c] < 0)
++s->ld.index[c];
- else if (s->ld.index[c] < s->params.lines)
+ else /*if (s->ld.index[c] < s->params.lines)*/
{
s->ld.c[c].Qk += s->ld.peak_res;
if (s->ld.c[c].Qk > s->ld.max_value)
@@ -1421,17 +1421,17 @@
DBG (1, "fix_line_distance_pp: lmod3=%d, index=(%d,%d,%d)\n",
s->ld.lmod3,
s->ld.index[0], s->ld.index[1], s->ld.index[2]);
- num_lines = s->ld.index[2] - s->ld.ld_line;
+ num_lines = s->ld.index[1] - s->ld.ld_line;

/* copy away the lines with at least one missing
color component, so that we can interleave them
with new scan data on the next call */
- num_saved_lines = s->ld.index[0] - s->ld.index[2];
+ num_saved_lines = s->ld.index[0] - s->ld.index[1];
memcpy (s->ld.buf[0], out + num_lines * bpl,
num_saved_lines * bpl);

/* notice the number of lines we processed */
- s->ld.ld_line = s->ld.index[2];
+ s->ld.ld_line = s->ld.index[1];
/* return number of complete (r+g+b) lines */
return num_lines;
}
---------------------------- snip ----------------------------------

hth, Henning

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com