# Apple: Patch for proper scanning

Milon Firikis (milonf@ariadne-t.gr)
Mon, 09 Nov 1998 02:13:59 +0200

- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Milon Firikis: "Q: sane-1.0"
- Previous message: Andre Couture: "parallele BizCard Reader ???"

This is a multi-part message in MIME format.
--------------906255AA3B0EC6650D2B970E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello

I included and tested a patch that was sent to me by Ian R. Justman.
This patch allows the backend to scan when the underlying hardware is
the ColorOneScanner and I suspect that may also help with the
OneScanner. It doesn't break the AppleScanner. I stressed it during the
weekend.

The problem with the Apple Scanners lies mostly to the quantization
algorithm that is used by the underlying hardware. Only the
ColorOneScanner has well documented quantization methods although I
hadn't implement them mainly due to the lack of hardware. The other 2
models needs extreme experimentation in order to guess the algorithm.
You have practically to reverse engineer the internal algorithm of the
scanner in order to give correct info to the SANE backend. At least
these scanners looks robust enough not to explode :-) when out of bounds
scanning region is specified. Mine for example refuses to scan until you
specify a valid region. So the
current status is:

AppleScanner :Fully functional.

OneScanner :It may scan.
You may have quantization problems.

ColorOneScanner :It will scan in non color modes.
You may have quantization problems.

Quantization problems:

When you have quantization problems means that the SANE backend could
not calculate correctly the number of pixels in X or Y direction (mostly
in X). This results to unexpected round offs while the SANE may wait
bigger/smaller image and that may lead to undesired warnings and cropped
images. A cropped image is most possible a shifted image also. As Ian R.
Justman said:

> No warnings, no cropped images, but the quantization algorithms introduce
> some really neat effects when there are rounding problems. One mode I
> tried does work right, but it yields a negative image. Otherwise, other
> modes look like a horizontally-rolling picture on a TV set.

Milon Firikis

PS

I am also attaching a patch containing some correction in my e-mail
address.
--------------906255AA3B0EC6650D2B970E
Content-Type: text/plain; charset=us-ascii; name="apple_buffer"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="apple_buffer"

diff -ur sane-pre0.75.orig/backend/apple.c sane-pre0.75/backend/apple.c
--- sane-pre0.75.orig/backend/apple.c Thu Oct 29 09:00:43 1998
+++ sane-pre0.75/backend/apple.c Sun Nov 8 21:18:13 1998
@@ -2502,7 +2502,8 @@
if (data_length)
{
- if (result[3] & 1) /* Scanner Blocked: Retrieve data */
+ /* if (result[3] & 1) Scanner Blocked: Retrieve data */
+ if ((result[3] & 1) || data_av)
{
DBG (IO_MESSAGE,
"sane_read: (status) Available in scanner buffer %u.\n",
diff -ur sane-pre0.75.orig/backend/apple.desc sane-pre0.75/backend/apple.desc
--- sane-pre0.75.orig/backend/apple.desc Tue Jul 28 07:47:48 1998
+++ sane-pre0.75/backend/apple.desc Sun Nov 8 21:54:30 1998
@@ -1,10 +1,10 @@
;Apple backend .desc file by Milon Firikis.
:backend "apple" ; name of backend
-:version "0.2" ; version of backend
+:version "0.31" ; version of backend
:status :alpha ; :alpha, :beta, :stable, :new
:manpage "sane-apple" ; name of manpage (if it exists)
-;:url "http://www.luser.com/temp/" ; backend's web page
+;:url "http://no.www.page.yet/" ; backend's web page
:devicetype :scanner ; start of a list of devices....
@@ -13,6 +13,6 @@
:model "Apple Scanner"
:comment "4bit, 16 shades of gray"
:model "OneScanner"
-:comment "8bit, 256 shades of gray (needs work)"
+:comment "8bit, 256 shades of gray. The backend needs work especially in the quantization code but it may work."
:model "ColorOneScanner"
-:comment "truecolor (needs much work)"
+:comment "truecolor (needs much work) but it scans in non color modes."

--------------906255AA3B0EC6650D2B970E
Content-Type: text/plain; charset=us-ascii; name="apple_mail"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="apple_mail"

diff -ur sane-pre0.75.orig/AUTHORS sane-pre0.75/AUTHORS
--- sane-pre0.75.orig/AUTHORS Wed Oct 28 09:41:51 1998
+++ sane-pre0.75/AUTHORS Sun Nov 8 22:36:02 1998
@@ -8,6 +8,7 @@
Backends:
+ apple: Milon Firikis
artec: Chris Pinkham
coolscan: Didier Carlier
dc25: Peter Fales
@@ -59,7 +60,7 @@
Matthew Marjanovic <maddog@mir.com>
Michael K. Johnson <johnsonm@redhat.com>
Michel Roelofs <michelr@stack.nl>
-Milon Firikis <milonf@isosun.ariadne-t.gr>
+Milon Firikis <milonf@ariadne-t.gr>
Oliver Rauch <Oliver.Rauch@Wolfsburg.DE>
Patrick Reynolds <patrickr@virginia.edu>
Peter Fales <psfales@earthling.net>
diff -ur sane-pre0.75.orig/PROJECTS sane-pre0.75/PROJECTS
--- sane-pre0.75.orig/PROJECTS Tue Jul 21 08:43:19 1998
+++ sane-pre0.75/PROJECTS Sun Nov 8 22:37:41 1998
@@ -23,7 +23,7 @@
Polaroid wip Dick Bruijn <dick@wau.mis.ah.nl> Polaroid SprintScan
35 LE
Artec wip Chris Pinkham <cpinkham@infi.net> Artec AT3
-Apple wip Milon Firikis <milonf@isosun.ariadne-t.gr> AppleScanner (?)
+Apple wip Milon Firikis <milonf@ariadne-t.gr> AppleScanner
Coolscan wip Didier Carlier <carlierd@acm.org> Nikon Coolscan II
DC25 wip Peter Fales <psfales@earthling.net> Kodak DC25
DMC wip David Skoll <dskoll@chipworks.com> Polaroid Digital

--------------906255AA3B0EC6650D2B970E--

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

- Next message: Milon Firikis: "Q: sane-1.0"
- Previous message: Andre Couture: "parallele BizCard Reader ???"