[sane-devel] sane-canon: Endian inverted data when scanning 48bbp raw mode pnm

Jean-Michel Vourgère contact_mlsane at nirgal.com
Wed Dec 28 12:43:55 UTC 2005


On Wednesday 28 December 2005 10:58, Ulrich Deiters wrote:
> Indeed, I am using a big-endian machine.

Ok, then it's easy:

On Tuesday 27 December 2005 20:07, Henning Meier-Geinitz wrote:
> According to the SANE standard (3.2.1):  "the bytes of each sample
> value are transmitted in the machine's native byte order". 
On Wednesday 28 December 2005 12:18, Henning Meier-Geinitz wrote:
> For backends, the SANE standard applies and that one specifies: "the
> bytes of each sample value are transmitted in the machine's native
> byte order". Therefore, on little endian machines, data sent to the
> frontend by sane_read() must be little endian (and big endian on big
> endian machines).

So that the raw 2 bytes per pixel data from the scanner only need to be inverted in one of endianness (yours in that case).

Inverting it without testing the architecture is what is causing the corrupted data here.

I'm attaching a patch that I know to work here: It simply adds a #if, patch the comment, and moves the definition of b later to avoid a compilation warning (unused variable on little-endian comp's).
Please check mie english! ;)
I used the latest *debian* source, not the cvs source. I hope that's ok.

-- Nirgal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: canon-sane-endian.patch
Type: text/x-diff
Size: 1377 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20051228/4ed86956/canon-sane-endian.bin


More information about the sane-devel mailing list