1Copyright 1993-2001 David Clunie.
2
3PCD patch for XV 3.10a Release Notes 2001/07/08.
4
5See also the progress notes at the end of this file. Thanks to all those
6contributors who have substantially improved this patch.
7
8These patches allow xv to read Kodak photocd files and choose which of the
95 available resolutions one wants to view.
10
11When a photocd file is loaded, a dialog box asks which resolution you
12would like. The visual schnauzer builds thumbnails by reading the lowest
13resolution image. The selected resolution can be selected from the
14command line with the -pcd option:
15
16	[-pcd 0|1|2|3|4]
17
18where:
19
20	0=192*128,	base/16 resolution
21	1=384*256,	base/4 resolution
22	2=768*512,	base resolution
23	3=1536*1024,	4base resolution
24	4=3072*2048	16base resolution.
25
26Note that the Pro format is not supported.
27
28The command line option allows loops without the dialog box popping up, eg.:
29
30	xv -pcd 1 -wloop -wait 10 *.pcd
31
32The code is pretty crude and was written quickly for a specific purpose and
33has not really been cleaned up. It is poorly structured, full of debugging
34codes and verbose comments, and there is very little attempt at optimizing
35things. No profiling has been done.
36
37There is not yet support for overview files, nor is there a facility to
38use the higher resolution chroma planes from when viewing lower resolution
39images.
40
41It's only claim to fame is that it works and produces reasonable looking
42images.
43
44The outline of this is shamelessly derived from xvpbm.c to read the
45file, and xvtiffwr.c to handle the popup window and X stuff (X never
46has been my forte !), and the PhotoCD format information (though not
47the code) was found in Hadmut Danisch's (danisch@ira.uka.de) hpcdtoppm
48program in which he has reverse engineered the format by studying
49hex dumps of PhotoCDs ! The color stuff and Huffman decding were
50extensively revised by Matthew Francey.
51
52Feel free to send me comments or improvements, or even better, more
53information about the photo CD format ... hopefully someone who really
54knows what they are doing will tidy it up or do a neater job.
55
56david (dclunie@dclunie.com)
57
58---------
59
60The trace #define in xvpcd.c is now in the right place, and the ansi
61prototype for the magnify function has been fixed. Colin made me switch to
62xvbcopy() which seems like a good idea for System V victims.
63
64---------
65
66Date: Wed, 22 Dec 1993 16:09:52 --1000
67From: colinc@fitmail.fit.qut.edu.au (Colin Canfield )
68
69I have done some more work using your patch I thought you might be intested in.
70The major change was adding a size parameter to the LoadPCD; either -1 to mean
71the popup or else the size you desired. This allows batch mode processing,
72specifically xv -pcd <size> <filename>, and the visual schnauzer can work in
73quick mode (ie. you don't have to select each image size when it is building
74the icons)
75
76I have added an xbm file for the file type but haven't drawn an icon for it,
77this is in bitmaps/br_pcd.xbm. I will just send you the new files.
78
79---------
80
81From: andrew@andrew.triumf.ca (Andrew Daviel)
82Date: 16 Feb 1995 23:32:21 GMT
83
84This is David Clunie's patch for xv-3.00 tuned a bit to work
85on xv-3.10. The code's all the same except for replacing
86"trace" with "fprintf" in xvpcd.c and adding an "unsigned" qualifier to
87keep my compiler (gcc) happy. Oh yes, changed RFT_PCD to 20 as
88John Bradley has now used 15 through 19.
89
90---------
91
92From: dclunie@flash.us.com (David A. Clunie)
93Date: Thu Jun 15 14:43:46 GMT+0300 1995
94
95Andrew's patch didn't include Colin's browser changes, so I redid the
96xv-3.10 update from scratch ... it seems pretty much the same as
97Andrew's changes. I also edited the Imakefile and Makefiles in order
98to support the PCD changes, as well as make the install process a
99little more flexible, with options to strip and set modes and so on.
100Also made RFT_PCD 25 so as not to conflict with magpic patch from Japan
101by Ikemoto Masahiro <ikeyan@airlab.cs.ritsumei.ac.jp>, and used his
102bitmap icon for pcd files.
103
104Now there are two versions of the patch, one which should be applied
105to the xv-3.10 distribution.
106
107The other should be applied to xv-3.10 AFTER Ikemoto Masahiro's
108Patch.magpic2.PhotoCD.XV319a, in order to add the browser features to
109the latter, as well as fixing a Makefile typo (was xcpcd.c not xvpcd.c)
110and including unistd.h for the SEEK_xxx constants in the magicpic
111stuff.
112
113---------
114
115Subject: Re: photo-cd patch for xv
116From: Matthew Francey <mdf@angoss.com>
117Date: Mon, 26 Mar 2001 15:37:55 +0000
118
119Attached is a revised version of xvpcd.c;  the areas that I have
120re-written or changed are in a different coding style so you can tell
121what has changed.  The GNU 'indent' program can be run against the file
122to enforce a consistent style ..
123
124Here is what I've done though:
125
126a) huffman table reader re-written, because it would fail on some
127   photocd files with "unusual" huffman codes.
128
129b) the huffman-coded corrections are now properly applied
130
131c) the corrections can sometimes over or underflow;  clipping has been
132   introduced and effectively fixes the problem, but I suspect that
133   there is something deeper going on.
134
135d) the "official" YCC->sRGB transform is done.  a "beyond 100% white"
136   mapping table was snarfed from ImageMagick.  an option for using a
137   flat linear LUT was added -- this can make somewhat over-exposed images
138   look alot nicer.
139
140e) there were strange problems where the code wouldn't be able to find
141   the huffman tables and data for the 16base image (the bit-buffering
142   code was starting mid-sector, instead of at a sector boundary).  Looking
143   at a pcd file with a hex editor suggests to me that it is possible to
144   just skip directly to these huffman tables -- no special "+12" and such
145   constants necessary.  But I haven't tried this yet.
146
147The results:  I've been able to read about 50 or 60 .pcd files [scattered
148in age from 6 years old to scans done last week] with this code without
149incident.  Image quality at the high resolution is excellent.  Even the
150trivial amount of LUT control is useful when dealing with over-exposed
151images.
152
153If I get around to it:  finer LUT control to take advantage of the
154slightly extended dynamic range of PhotoCD scans, especially in regards to
155dark or somewhat underexposed scenes.
156
157
158
159
160