No subject


Sat Dec 3 12:15:27 GMT 2022


  Assume $B$ is the number of channels in the frame, then the bit depth
  $d$ (as given by member \code{depth}) and the number of pixels per
  line $n$ (as given by this member \code{pixels\_per\_line}) are
  related to $c$, the number of bytes per line (as given by member
  \code{bytes\_per\_line}) as follows:
  \[
    c >= \left\{
    \begin{array}{ll}
      \lceil B\cdot n / 8\rceil & \mbox{if $d=1$}\\
      B\cdot n \cdot \lceil (d + 7)/8 \rceil & \mbox{if $d>1$}
    \end{array}
    \right.
  \]

I think that the formula should be:

  \[
    c = \left\{
    \begin{array}{ll}
      \lceil B\cdot n / 8\rceil & \mbox{if $d=1$}\\
      B\cdot n \cdot d & \mbox{if $d>1$}
    \end{array}
    \right.
  \]

Firstly, if e.g. d=8, then ceil((d+7)/8) == 2, so we would have B*n*2
samples, while B*n would be the correct value. So, ceil(d/8) or
floor(d+7/8) would be correct.

Secondly, only multiples of 8 are allowed for d, so d/8 is anyway an
integer and we don't need floor or ceil.

Again from section 4.3.8:

  A plane is descibed by one channel, e.g. "\code{gray}" or
"\code{gray:12}".
                ^^ 'r' is mssing


I would understand "gray:12" as meaning "gray scale data with 12 bit
values", but we allow only 1 and n*8 as depth. Or should "gray:12" mean
the real bit depth of the scanner's ADC?

from sane2-api-todo:


   let backend display a frontend-info or -selection (ok/cancel)
   dialog-box (e.g. "Calibration in progress: wait 10/9/8/... seconds")
   this has to be done with a callback, eg.:
     sane_frontend_dialog_display(**window, text, ok_text, cancel_text,
          backend_dialog_callback_function)
     sane_frontend_dialog_close(window)
   the frontend function has to be implemented in a way that the backend
   can change the text.
   A good place to define the callback functions could be sane_init,
   where already the authorization_callback is defined.

This sounds really good. But I think that sane_frontend_dialog_close
should get something similar to the 'alt'-attribute of the HTML <img>
tag. scanimage or other non-graphical frontends have no way to tell the
user that a dialog window is closed, but an alternate text like
"calibration done" could be printed.

Another suggestion: Many scanners can return quite detailed error
information, like "lamp failure", "optical hardware error", "mechanical
hardware error", "5V fuse blown", "memory error" and whatever else. A
frontend could call a function like 

	SANE_String sane_verbose_error(Sane_Handle h)

to read some details about the last error. Printing this stuff might
save users a few gray hairs.

Abel



More information about the sane-devel mailing list