Re: Byte ordering
Ralph Little <[email protected]> Tue, 3 Jun 2025 22:00:45 -0700
| Newsgroups | gmane.comp.graphics.scanning.sane.devel |
|---|---|
| Message-ID | <CAFNXwePo2SxNoRw9LyrSruWFhVqv-nYrZfgF1NFp+dFxn+82Dg@mail.gmail.com> |
Hi, On Tue, Jun 3, 2025 at 9:54 PM James Ring <[email protected]> wrote: > > > On Tue, Jun 3, 2025 at 9:46 PM Ralph Little <[email protected]> wrote: > >> Hi. >> Someone has asked the question about byte order in multi-byte image data >> that we might get from a SANE backend. For example, if the data is 16-bit, >> what assumptions can we make about the byte order of that data? There >> doesn't seem to be anything in the SANE API specification for guidance. >> >> It is not enough to assume the local machine byte order since we may get >> data through the net backend from a remote machine with a different byte >> order. >> > > In the case of the net backend, the byte order is indicated in the SANE_NET_START > response <https://sane-project.gitlab.io/standard/net.html#sane-net-start>. > The client is responsible for reordering bytes if the byte orders differ. I > don't have any experience with other backends. :-) > This is interesting because it seems to *imply* that the image data from sane_read() will be host byte order, yet we have nothing in the SANE API specification on this topic. Cheers, Ralph