sane-project-website/old-archive/2001-02/0246.html

155 wiersze
5.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: M3091 color scheme success</TITLE>
<META NAME="Author" CONTENT="Frederik Ramm (frederik@remote.org)">
<META NAME="Subject" CONTENT="M3091 color scheme success">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>M3091 color scheme success</H1>
<!-- received="Tue Feb 27 15:11:34 2001" -->
<!-- isoreceived="20010227231134" -->
<!-- sent="Tue, 27 Feb 2001 23:27:15 +0000" -->
<!-- isosent="20010227232715" -->
<!-- name="Frederik Ramm" -->
<!-- email="frederik@remote.org" -->
<!-- subject="M3091 color scheme success" -->
<!-- id="20010227232715.A14623@aruba.remote.org" -->
<STRONG>From:</STRONG> Frederik Ramm (<A HREF="mailto:frederik@remote.org?Subject=Re:%20M3091%20color%20scheme%20success&In-Reply-To=&lt;20010227232715.A14623@aruba.remote.org&gt;"><EM>frederik@remote.org</EM></A>)<BR>
<STRONG>Date:</STRONG> Tue Feb 27 2001 - 15:27:15 PST
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0247.html">Tom Martone: "Re: Writing Fujitsu M3091 backend"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0245.html">Mick Barry: "Re: Writing Fujitsu M3091 backend"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#246">[ date ]</A>
<A HREF="index.html#246">[ thread ]</A>
<A HREF="subject.html#246">[ subject ]</A>
<A HREF="author.html#246">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P>&nbsp;&nbsp;&nbsp;I've succeeded in dealing with the color data that the Fujitsu
<BR>
M3091 sends. In case anybody is interested (I suspect the Fujitsu is
<BR>
not then only scanner that does this) - it's quite straightforward:
<BR>
<P>&quot;Normal&quot; scanners usually send one row of R values, followed by one
<BR>
row of G values, and one row of B values. Let ppl be the number of
<BR>
pixels on the line and bpl the number of bytes per line (=ppl*3), you
<BR>
have to rearrange the buffer into this order:
<BR>
<P>buffer[0], buffer[ppl], buffer[2*ppl], /* the first RGB pixel */
<BR>
buffer[1], buffer[ppl+1], buffer[2*ppl+1], /* 2nd RGB pixel */
<BR>
...
<BR>
buffer[ppl-1], buffer[2*ppl-1], buffer[3*ppl-1], /* last pixel line 1 */
<BR>
buffer[bpl], buffer[bpl+ppl], buffer[bpl+2*ppl], /* first pixel line 2 */
<BR>
<P>and so on.
<BR>
<P>With the Fujitsu, you have to ADD 8*bpl to the &quot;G&quot; indices and 4*bpl
<BR>
to the &quot;B&quot; indices, i.e. you have to fetch those values from &quot;further
<BR>
ahead&quot; in the data stream, matching the physical lay-out of the
<BR>
sensors. (8 and 4 are the line offsets for 300 dpi. They have to be
<BR>
changed accordingly for 75 (2 and 1), 150 (4 and 2), or 600 (16 and 8)
<BR>
dpi, and these are the ONLY y-axis resolutions available in color
<BR>
mode.)
<BR>
<P>The &quot;G&quot; data of the first 8 lines is invalid, as are the &quot;B&quot; data of
<BR>
the first and last 4 and the &quot;R&quot; data of the last 8 lines of the full
<BR>
data stream.
<BR>
<P>The scanner will give you a data stream that has a larger number of
<BR>
lines than you requested, to accomodate for this overhead. If you request
<BR>
a scanning length of one inch at 300 dpi, you will get data for 308
<BR>
lines.
<BR>
<P>The only challenge when decoding this is that from each buffer block
<BR>
read, you have to retain the last 8 (at 300 dpi) lines of data and
<BR>
stick them onto the beginning of the buffer before you process the
<BR>
next chunk.
<BR>
<P>I've solved that and I'll now start playing with the duplex option.
<BR>
<P>A question on the side: As stated above, when scanning in color, only
<BR>
75, 150, 300 or 600 dpi are supported on the y-axis, while if you scan
<BR>
grayscale you can have any integral value from 50 to 600. The x-axis
<BR>
always supports any value from 50-300. Is there a way to inform the
<BR>
front-end of this, i.e. if mode==color, y-resolution is a list of four
<BR>
items while if mode==anything else, y-resolution is &quot;slidable&quot;? If
<BR>
not, how would you solve it - maybe introduce two properties, one
<BR>
called &quot;y-resolution-color&quot; and one &quot;y-resolution-other&quot;?
<BR>
<P>Bye
<BR>
Frederik
<BR>
<P><PRE>
--
Frederik Ramm ## eMail <A HREF="mailto:frederik@remote.org?Subject=Re:%20M3091%20color%20scheme%20success&In-Reply-To=&lt;20010227232715.A14623@aruba.remote.org&gt;">frederik@remote.org</A> ## N57<35>48.10' W005<30>40.32'
<P><P>--
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?Subject=Re:%20M3091%20color%20scheme%20success&In-Reply-To=&lt;20010227232715.A14623@aruba.remote.org&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0247.html">Tom Martone: "Re: Writing Fujitsu M3091 backend"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0245.html">Mick Barry: "Re: Writing Fujitsu M3091 backend"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#246">[ date ]</A>
<A HREF="index.html#246">[ thread ]</A>
<A HREF="subject.html#246">[ subject ]</A>
<A HREF="author.html#246">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Tue Feb 27 2001 - 15:12:54 PST</EM>
</EM>
</SMALL>
</BODY>
</HTML>