Bug in snapscan or sane network protocolo?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in snapscan or sane network protocolo?

Giuseppe Sacco
Hi all,
I am using an EPSON Perfection 1670 over the network, via saned, and I
just found a problem.

Basically I do a scan of 210.0x297.0mm, using a 200dpi resolution.
Prior to scan I call get_parameters and receive an *estimated* values
for lines, pixelsperline, bytesperline; after receiving this data I
receive the frame data.

The problem is that get_parameters says:

[snapscan] sane_snapscan_get_parameters (0x8090aa8, 0xbffffc24)
[snapscan] sane_snapscan_get_parameters: Using estimated data
[snapscan] sane_snapscan_get_parameters: depth = 8
[snapscan] sane_snapscan_get_parameters: lines = 2338
[snapscan] sane_snapscan_get_parameters: pixels per line = 1653
[snapscan] sane_snapscan_get_parameters: bytes per line = 4959

while, when scanning, I get a different amount of data:

[snapscan] inquiry: exposure time: 4.6 ms
[snapscan] inquiry: ms per line: 4.600000
[snapscan] inquiry: G2R_DIFF: 131
[snapscan] inquiry: B2R_DIFF: 134
[snapscan] inquiry: Chroma offsets=6; Red=6, Green:=3, Blue=0
[snapscan] inquiry: hardware config = 0xbd
[snapscan] inquiry: bits per pixel = 14
[snapscan] inquiry: pixels per scan line = 1652
[snapscan] inquiry: bytes per scan line = 4956
[snapscan] inquiry: number of scan lines = 2338
[snapscan] inquiry: effective buffer size = 64428 bytes, 27 lines
[snapscan] inquiry: expected total scan data: 11616864 bytes
[snapscan] sane_snapscan_start: after measuring speed:
        4956 bytes per scan line
        4.600000 milliseconds per scan line.
        ==>1077.391327 bytes per millisecond
[snapscan] scan


As you may notice, the "pixel per line" value changed. So when I try to
create the image I have less data than expected.

I see two possible options:

1. Change the snapscan algorithm to have better supposed values
2. Change the sane network protocol in order to get all corrected
   parameter *with* or *after* the scanned data.

Any comment?

Giuseppe


--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Bug in snapscan or sane network protocolo?

Henning Meier-Geinitz
Hi,

On Thu, Jun 09, 2005 at 04:47:05PM +0200, Giuseppe Sacco wrote:
> Basically I do a scan of 210.0x297.0mm, using a 200dpi resolution.
> Prior to scan I call get_parameters and receive an *estimated* values
> for lines, pixelsperline, bytesperline; after receiving this data I
> receive the frame data.

Which frontend do you use?

> while, when scanning, I get a different amount of data:

This is perfectly legal (see SANE standard). The normal way is:

sane_get_parameters (returns estimated values)
sane_start
sane_get_parameters (returns exact parameters)
--> malloc memory for image, ...

> I see two possible options:
>
> 1. Change the snapscan algorithm to have better supposed values

If snapscan doesn't return the correct parameters after sane_start,
it's broken. But I'd be very surprised if that were the case as that
would break all frontends.

> 2. Change the sane network protocol in order to get all corrected
>    parameter *with* or *after* the scanned data.

I haven't checked that but you can get the parameters after running
sane_start, can't you?

You can test the behaviour of frontends concerning the estimated
parameters with the "test" backend (use option "fuzzy parameters").

Bye,
  Henning

--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Bug in snapscan or sane network protocolo?

Giuseppe Sacco
Il giorno gio, 09-06-2005 alle 19:50 +0200, Henning Meier-Geinitz ha
scritto:
> Hi,
>
> On Thu, Jun 09, 2005 at 04:47:05PM +0200, Giuseppe Sacco wrote:
> > Basically I do a scan of 210.0x297.0mm, using a 200dpi resolution.
> > Prior to scan I call get_parameters and receive an *estimated* values
> > for lines, pixelsperline, bytesperline; after receiving this data I
> > receive the frame data.
>
> Which frontend do you use?

I am using a java application. I use jsane as SANE library.

>From a client side point of view, we do:

1. device open
2. set all options
3. get frame:
   3.1 get parameters
   3.2 start
   3.3 download all frames
4. compose image using frames

> > while, when scanning, I get a different amount of data:
>
> This is perfectly legal (see SANE standard). The normal way is:
>
> sane_get_parameters (returns estimated values)
> sane_start
> sane_get_parameters (returns exact parameters)
> --> malloc memory for image, ...

Is this possible?

> > I see two possible options:
> >
> > 1. Change the snapscan algorithm to have better supposed values
>
> If snapscan doesn't return the correct parameters after sane_start,
> it's broken. But I'd be very surprised if that were the case as that
> would break all frontends.
>
> > 2. Change the sane network protocol in order to get all corrected
> >    parameter *with* or *after* the scanned data.
>
> I haven't checked that but you can get the parameters after running
> sane_start, can't you?

I don't know. I will try it tomorrow.

Thanks for all comments,
Giuseppe


--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Bug in snapscan or sane network protocolo?

Giuseppe Sacco
In reply to this post by Henning Meier-Geinitz
Il giorno gio, 09-06-2005 alle 19:50 +0200, Henning Meier-Geinitz ha
scritto:
[...]
> > while, when scanning, I get a different amount of data:
>
> This is perfectly legal (see SANE standard). The normal way is:
>
> sane_get_parameters (returns estimated values)
> sane_start
> sane_get_parameters (returns exact parameters)

I just made some changes to the code, to actually try this way, but this
seems to be impossible, since once start() is called, then you have to
receive the complete frame so you cannot call get_parameters().

Probably this works locally, since you may interlace function calls,
while, on the network, you may only send/receive data sequencially.

Where may I find a SANE network protocol specification?
I looked at the saned source code and noticed the data may be
transferred using a different socket. Is this true? Are there many SANE
protocol versions?

Giuseppe


--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Bug in snapscan or sane network protocolo?

Henning Meier-Geinitz
Hi,

On Fri, Jun 10, 2005 at 11:30:36AM +0200, Giuseppe Sacco wrote:
> I just made some changes to the code, to actually try this way, but this
> seems to be impossible, since once start() is called, then you have to
> receive the complete frame so you cannot call get_parameters().

You can allways call sane_get_parameters(). You don't get any data by
calling sane_start(), this only happens with sane_read().

> Probably this works locally, since you may interlace function calls,
> while, on the network, you may only send/receive data sequencially.

Not really. Even on the network you send sane_start, then
sane_get_parameters.

> Where may I find a SANE network protocol specification?

In the SANE standard.

> I looked at the saned source code and noticed the data may be
> transferred using a different socket.

It is transferred via a different port.

> Is this true? Are there many SANE protocol versions?

The current protocol version is 3, so I guess there have been at least
2 before this one. But the changes are very minor as far as I remember.

Bye,
  Henning

--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Bug in snapscan or sane network protocolo?

Giuseppe Sacco
Il giorno ven, 10-06-2005 alle 17:36 +0200, Henning Meier-Geinitz ha
scritto:
[...]
> > Where may I find a SANE network protocol specification?
>
> In the SANE standard.

I finally got the document and understood the problem. I also filed a
bug report against jsane-net and the author told me he is working on it.

Thank you very much Henning.



--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]