M3091 color scheme success

From: Frederik Ramm (frederik@remote.org)
Date: Tue Feb 27 2001 - 15:27:15 PST

  • Next message: Tom Martone: "Re: Writing Fujitsu M3091 backend"

    Hi,

       I've succeeded in dealing with the color data that the Fujitsu
    M3091 sends. In case anybody is interested (I suspect the Fujitsu is
    not then only scanner that does this) - it's quite straightforward:

    "Normal" scanners usually send one row of R values, followed by one
    row of G values, and one row of B values. Let ppl be the number of
    pixels on the line and bpl the number of bytes per line (=ppl*3), you
    have to rearrange the buffer into this order:

    buffer[0], buffer[ppl], buffer[2*ppl], /* the first RGB pixel */
    buffer[1], buffer[ppl+1], buffer[2*ppl+1], /* 2nd RGB pixel */
    ...
    buffer[ppl-1], buffer[2*ppl-1], buffer[3*ppl-1], /* last pixel line 1 */
    buffer[bpl], buffer[bpl+ppl], buffer[bpl+2*ppl], /* first pixel line 2 */

    and so on.

    With the Fujitsu, you have to ADD 8*bpl to the "G" indices and 4*bpl
    to the "B" indices, i.e. you have to fetch those values from "further
    ahead" in the data stream, matching the physical lay-out of the
    sensors. (8 and 4 are the line offsets for 300 dpi. They have to be
    changed accordingly for 75 (2 and 1), 150 (4 and 2), or 600 (16 and 8)
    dpi, and these are the ONLY y-axis resolutions available in color
    mode.)

    The "G" data of the first 8 lines is invalid, as are the "B" data of
    the first and last 4 and the "R" data of the last 8 lines of the full
    data stream.

    The scanner will give you a data stream that has a larger number of
    lines than you requested, to accomodate for this overhead. If you request
    a scanning length of one inch at 300 dpi, you will get data for 308
    lines.

    The only challenge when decoding this is that from each buffer block
    read, you have to retain the last 8 (at 300 dpi) lines of data and
    stick them onto the beginning of the buffer before you process the
    next chunk.

    I've solved that and I'll now start playing with the duplex option.

    A question on the side: As stated above, when scanning in color, only
    75, 150, 300 or 600 dpi are supported on the y-axis, while if you scan
    grayscale you can have any integral value from 50 to 600. The x-axis
    always supports any value from 50-300. Is there a way to inform the
    front-end of this, i.e. if mode==color, y-resolution is a list of four
    items while if mode==anything else, y-resolution is "slidable"? If
    not, how would you solve it - maybe introduce two properties, one
    called "y-resolution-color" and one "y-resolution-other"?

    Bye
    Frederik

    -- 
    Frederik Ramm  ##  eMail frederik@remote.org  ##  N57°48.10' W005°40.32'
    

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



    This archive was generated by hypermail 2b29 : Tue Feb 27 2001 - 15:12:54 PST