[sane-devel] sp15c - 4 Bit gray generates 8 bit files

Gregory C. Johnson Greg@GregJohnson.Com
Sun Jul 3 20:20:15 UTC 2005


[[Posted from list subscribing address to avoid further burdening mods]]

>From sp15.c's reader_process()
.
.
.
      /* expand 4-bit pixels to 8-bit bytes */
      if (scanner->composition == WD_comp_G4)
        {
          src = &scanner->buffer[data_to_read - 1];
          dst = &scanner->buffer[data_to_read * 2 - 1];
          for (i = 0; i < data_to_read; i++)
            {
              *dst-- = (*src << 4) & 0xf0;
              *dst-- = (*src--) & 0xf0;
            }
          data_to_read *= 2;
        }

.
.
.

I'm a little confused.  This is a SCSI scanner, I don't see a bandwidth
bottleneck on the HW side...

Does SANE require grayscale to be 8 BPP, or am I just completely missing
why one would want to shift 4 bits of information into the most
significant bits of twice as many bytes?

Granted, it _should_ compress down to about where it ought to be, and the
compression ratios on the 4-bit scans are around 92%.  This would lead one
to think it all comes out in the wash, but still...

Thanks,
-Greg






More information about the sane-devel mailing list