home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume43
/
hpcdtoppm
/
part03
< prev
next >
Wrap
Internet Message Format
|
1994-06-10
|
61KB
From: danisch@ira.uka.de (Hadmut Danisch)
Newsgroups: comp.sources.misc
Subject: v43i041: hpcdtoppm - convert Photo-CD file into portable pixmap, v0.6, Part03/03
Date: 10 Jun 1994 11:19:45 -0500
Organization: Sterling Software
Sender: kent@sparky.sterling.com
Approved: kent@sparky.sterling.com
Message-ID: <2ta3r1$fgb@sparky.sterling.com>
X-Md4-Signature: 39fb4c6454a2ea685854ff27cf517d52
Submitted-by: danisch@ira.uka.de (Hadmut Danisch)
Posting-number: Volume 43, Issue 41
Archive-name: hpcdtoppm/part03
Environment: Photo-CD
Supersedes: hpcdtoppm: Volume 39, Issue 2-4
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# Contents: hpcdtoppm.0.6/Adding_code hpcdtoppm.0.6/Changes
# hpcdtoppm.0.6/Examples hpcdtoppm.0.6/Makefile hpcdtoppm.0.6/README
# hpcdtoppm.0.6/README.TOO hpcdtoppm.0.6/ReadMe.NeXT
# hpcdtoppm.0.6/ReadMe.SGI hpcdtoppm.0.6/TODO hpcdtoppm.0.6/color.c
# hpcdtoppm.0.6/config.h hpcdtoppm.0.6/hpcdtoppm.h
# hpcdtoppm.0.6/hpcdtoppm.man hpcdtoppm.0.6/pcdindex
# hpcdtoppm.0.6/tools.c
# Wrapped by kent@sparky on Fri Jun 10 11:08:33 1994
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 3 (of 3)."'
if test -f 'hpcdtoppm.0.6/Adding_code' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Adding_code'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/Adding_code'\" \(2027 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/Adding_code' <<'END_OF_FILE'
XSeveral people were changing the output image format
Xof the decoder or asked for a different output format.
X
Xpbmplus enables the transformation to every image
Xformat, but sometimes it is better to have the
Xformat "inside". Therefore v0.5 is able to keep several
Xformat 'drivers'.
X
X
XTo add a new output format:
X
X- Append a new tag to the enum type OUTFOR in hpcdtoppm.h
X
X- change O_DEFAULT to this tag in config.h if you want to
X have this format as the default format.
X
X- Insert a new 'if(...){...}' contruct to the procedure
X parseargs in main.c after the comment "Output options".
X
X- Insert description text to error.c and hpcdtoppm.man.
X
X- If your format needs only grayscale data, append your
X tag to the line "monochrome=(outfor==O_PGM)|| ..."
X in the main procedure in main.c .
X
X- If your format uses the paper size values, append your
X tag to the line "paper=(outfor==O_PS)|| ..."
X in the main procedure in main.c .
X
X- Insert your tag into the switch-statement in the
X procedure colconvert in color.c. If you need a
X 8-bit-grayscale or 24-bit-rgb model, you just
X have to insert a "case O_YourTag :" . Otherwise
X you have to write your own colorconversion.
X
X- Insert your tag and procedure name into the switch-
X statement in the procedure writepicture in output.c.
X If you have a three-plane-image you can use the do_3plane
X procedure with a pointer to your format writing
X procedure as the first argument, if you have one
X image plane, use the do_1plane. Otherwise write
X a similar do_nplane procedure.
X
X- Write a procedure, which produces your format. You
X should use the parameter scheme as defined for the
X driver types OUT3PL and OUT1PL in hpcdtoppm.h.
X
X This means:
X - a FILE *pointer to the output file
X - image width and height.
X
X - for each image plane the triple:
X - a pointer to the upper left position
X - a relative row step ( in bytes )
X - a relative column step ( in bytes )
X
X- If it works, let me know it. :-) Send mail to
X danisch@ira.uka.de .
X
X
X
XHadmut
X
X
X
X
END_OF_FILE
if test 2027 -ne `wc -c <'hpcdtoppm.0.6/Adding_code'`; then
echo shar: \"'hpcdtoppm.0.6/Adding_code'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/Adding_code'
fi
if test -f 'hpcdtoppm.0.6/Changes' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Changes'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/Changes'\" \(2166 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/Changes' <<'END_OF_FILE'
XChanges of hpcdtoppm:
X
Xv0.6:
X
X- hpcdtoppm now finds the 64Base extension files from the
X path given for the image-file name.
X
X- small bug fixed.
X
Xv0.6 beta patch2:
X
X- bug fixed for images with more than one file for
X each 64base plane
X
Xv0.6 beta patch1:
X
X- bug fixed in opening the 64Base files.
X
X- a debugging printf removed.
X
Xv0.6 beta:
X
X- Code added to read 64Base
X
X
Xv0.5 pl1:
X
X- Bug fixed in main.c, procedure f_ov. When writing all the
X images from overview files, a lot of file descriptors were
X opened, but never closed. This produced write errors if the
X machine has not enough file descriptors.
X
X- procedure clear renamed to clearimpl to avoid collision with
X other libraries
X
X- data types OUTGRAY and OUTRGB renamed to OUT1PL and OUT3PL,
X these data types are not bound to special color models.
X
X- gsave/grestore added to postscript output
X
Xv0.5:
X
X- Bug fixed in pgm writing procedure
X
X- Missing ':' added in BoundingBox line of encapsulated
X Postscript
X
X- postscript output with Floyd-Steinberg dithering added
X
X- orientation chooser for contact sheet option -C
X
X- accepts input from stdin (give '-' as filename)
X
X- -S option for subrectangles
X
X- procedure definitions in ANSI-C
X
X- "turn on head" added.
X
X
Xv0.4:
X
X- Additional Options -m, -pos, -rep, -crop
X
X- pgm output added
X
X- postscript output added
X
X- Flip options
X
X- color corrections
X
X- primitive form of contact sheet
X
X- simple method of jumping over reading errors in
X Huffman code
X
X- optional Huffman-Lookuptable for speedup
X
X
X
Xv0.3:
X- Additional Options -x, -a and -ycc
X
X- bcopy thrown out.
X
X- New datatype sBYTE for char. This fixes the problem with
X compilers which have the char unsigned. These got some
X 'snow' in their pictures (merry christmas :-).
X
X- Address arithmetik bug fixed in writepicture
X
Xv0.2:
X
X- Small workaround for strange behavior of address-calculation
X of a c-compiler for NeXT.
X
X- Improved rounding for integer maths.
X
X- Thrown out floating arithmetic, changed color conversion to
X integer fixed point.
X
X- PPM-writing-routines added. You can choose whether you
X want to use pbmplus-routines or the included routines.
X
X- some ununused variables thrown out.
X
END_OF_FILE
if test 2166 -ne `wc -c <'hpcdtoppm.0.6/Changes'`; then
echo shar: \"'hpcdtoppm.0.6/Changes'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/Changes'
fi
if test -f 'hpcdtoppm.0.6/Examples' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Examples'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/Examples'\" \(1568 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/Examples' <<'END_OF_FILE'
XThis are some examples of the use of hpcdtoppm, insert one
Xof your images where a filename as img0010.pcd is used.
X
X"postscriptprinter" means something on your machine, what
Xprints postscript output on paper.
X
X"xv" is a program for viewing images on X11.
X
X
X
Xhpcdtoppm img0005.pcd img0005.ppm
X
X converts the image img0005.pcd to the ppm-format with resolution
X 128x192. Output into the file img0005.ppm
X
X
Xhpcdtoppm -3 -crop img0005.pcd | xv -
X
X removes a black frame (some images are scanned with a black frame) and
X displays the image with resolution 512x768 on a X11-display (24-bit if possible).
X
X
Xhpcdtoppm -l -5 -s -pgm img0005.pcd img0005.pgm
X
X turns the images counter-clockwise to portrait, converts to
X the 2048x3072 resolution, applies a sharpness-operator and writes
X it as 8-Bit-grayscale pgm to the file img0005.pgm.
X
X
Xhpcdtoppm -l -5 -c+ -psd img0005.pcd img0005.ps
X
X corrects the images brighter and converts to a 2048x3072 dithered
X postscript image. Fits on a sheet of paper if used on a 300dpi printer.
X
Xhpcdtoppm -s -S 1300-1850 1000-1260 -5 img0010.pcd | xv -8 -
X
X displays a small subrectangle of the high resolution an your x11 screen.
X
Xhpcdtoppm -c+ -l -s -S 1300-1850 1000-1260 -5 -psd -pw 500 -dpi 300 img0010.pcd | postscriptprinter
X
X prints out a dithered small subrectangle of your image.
X
X
Xhpcdtoppm -c+ -C 6 l -psd -dpi 300 -pw 500 overview.pcd |postscriptprinter
X
X prints an index print; play with the number 6.
X
X
Xhpcdtoppm -c+ -C 4 n -psd -dpi 300 -pw 500 overview.pcd |postscriptprinter
X
X something similar
X
END_OF_FILE
if test 1568 -ne `wc -c <'hpcdtoppm.0.6/Examples'`; then
echo shar: \"'hpcdtoppm.0.6/Examples'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/Examples'
fi
if test -f 'hpcdtoppm.0.6/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/Makefile'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/Makefile'\" \(471 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/Makefile' <<'END_OF_FILE'
X#
X#
X# Use the hpcdtoppm procedures for writing ppm and pgm
XVFLAGS= -DOWN_WRITE
XVLIBS=
X# Use the pbmplus procedures for writing ppm and pgm
X#VFLAGS=
X#VLIBS= libpbm.a libpgm.a libppm.a
X#
X#
XCC= gcc
XCFLAGS= -g -ansi -Wall ${VFLAGS}
XINCL= hpcdtoppm.h config.h
XOBJ= main.o output.o color.o format.o tools.o error.o \
X ppm.o postscr.o const.o
XCOMPILE=${CC} ${CFLAGS} -c
X#
Xhpcdtoppm: ${OBJ}
X ${CC} -o hpcdtoppm ${OBJ} ${VLIBS}
X#
X${OBJ}: ${$@:.o=.c} ${INCL}
X ${COMPILE} ${*}.c
END_OF_FILE
if test 471 -ne `wc -c <'hpcdtoppm.0.6/Makefile'`; then
echo shar: \"'hpcdtoppm.0.6/Makefile'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/Makefile'
fi
if test -f 'hpcdtoppm.0.6/README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/README'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/README'\" \(4172 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/README' <<'END_OF_FILE'
X
XThis is Version 0.6 of hpcdtoppm, Hadmut's pcd to ppm converter.
XIt has this name to be distinguishable in case someone
Xelse is producing a program also called pcdtoppm.
X
XRead the README.TOO and edit the config.h and the Makefile !
X
XThis program converts Photo-CD-Images to the ppm-Format of
Xpbmplus. You can compile the program in two ways:
X
X1. Use its own ppm-writing-routines. In this case
X you don't need ppm-includes or libraries. You
X have to define macro 'OWN_WRITE' in the source or
X by compiler-option. I am not sure, whether the
X format of the ppm-header is the same on non-unix
X machines. If you get problems with line-endings
X (things like CR, LF, CR/LF), modify the macro
X PPM_Header.
X
X2. You can use the pbmplus-routines. In this case
X you need some files from the pbmplus package to compile:
X
X ppm.h pgm.h pbm.h pbmplus.h libppm.a libpgm.a libpbm.a
X
X
XIMPORTANT: Some older versions of the gcc have problems with
Xoptimization. They produce buggy code. This code will not
Xdie with 'segmentation fault' or something like that, it
Xjust produces damaged images.
X
XI did not have detailed information of the file-format and
Xmost of my information I got by staring at the hex-dumps
Xof an image file. So I am not absolutly sure, whether it
Xworks on all Photo-CDs, because there are some bytes in
Xthe header which I don't understand. But it works on
Xmy Photo-CD.
X
XNote that you will get a 24 bit image. You can view these
Xfiles with xv, but if you have an 8-bit-screen you will
Xsometimes have some color-defects (if you have an 1-bit-screen
Xyou will often have a lot of color-defects :-).
XIt will also take some time to show with xv.
X
XYou can produce nice overview prints if you get the icontact
Xprogram of Mark B. Hanson and put something like
X
Xdecode pcd hpcdtoppm -1 -a
X
Xin your ~/.icrc
X
Xor by use of the pcdindex script of Pieter S. van der
XMeulen in this distribution.
X
X
XIf you compile the program on a machine other than
XSPARC please send me a short email which machine
Xyou are using, whether you had problems or which
Xchanges you have made.
X
XIf you port the program to any machine, please tell me,
Xwhat you did and where to get the program. Within the
Xlast weeks I got a lot of mail asking for the special
XAmiga/NeXT/SGI/... version. Read the Special.* files.
X
X
X
XThanks to
X
X- James Pearson (jcpearso@ps.ucl.ac.uk) for giving debugging hints for
X the 64Base code, for sending a 64Base image and the code to find the
X 64Base files from the image file path.
X
X- R. P. Channing ["Rick"] Rodgers (rodgers@nlm.nih.gov) for improving the
X man page.
X
X
X- Some people sending code for TIFF and GIF writing code. Sorry, I didn't
X have the time to implant the code yet. I don't know whether many people want
X to have such extensions, please send mail if so.
X
X- Adolf Mathias (mathias@ira.uka.de) for writing some of the
X postscript drivers.
X
X- Pieter S. van der Meulen for the contact sheet script.
X
X- Jeff for finding out how to detect the orientation of the
X Overview thumbnails [ Hi Jeff, how are you? :-) ]
X
X- A lot of people for sending mail about
X compilation on MS-DOS and OS/2 and many other machines.
X
X- lots and lots of people for sending me their improvements of the code.
X Sorry, but I can not read and analyze them all. I do not have so
X much time for the decoder, its my hobby, not my job. Often I get
X mail with a complete source and "Hi Hadmut, I have improved your
X code. It is now faster/smaller/better/something_else." But I don't
X know, *what* is changed. A simple diff doesn't work, they all were
X reformatting my source completely and I do not have the time to
X read all sources to find the real changes. There are a lot
X of real good ideas, but *please* tell me, where is the beef.
X
X- lots of people sending me just a formatted version of my code.
X Thanks to them all, and yes, I have indent(1). I prefer
X this way of formatting C-source.
X
X
X
X
XHadmut Danisch (danisch@ira.uka.de , will change in future)
XE.I.S.S. (European Institute for System Security)
XUniversitaet Karlsruhe
XAm Fasanengarten 5
X
XD-76128 Karlsruhe
X
XGermany
X
XFAX: +49 721 696893
XTel./FAX privat: +49 721 607306 (will change in future)
X
X
END_OF_FILE
if test 4172 -ne `wc -c <'hpcdtoppm.0.6/README'`; then
echo shar: \"'hpcdtoppm.0.6/README'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/README'
fi
if test -f 'hpcdtoppm.0.6/README.TOO' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/README.TOO'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/README.TOO'\" \(1553 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/README.TOO' <<'END_OF_FILE'
XHere are some additional informations for installing and use:
X
XI. Edit the config.h and the Makefile !
X
XII. Several people had 'snowy' images with v0.1 and v0.2.
X This happens when the machine handles the standard
X type char unsigned. Therefore the datatype sBYTE
X was introduced as 'signed char'. If your compiler
X doesn't understand this, change sBYTE to such a datatype
X of your compiler or use a commandlineoption like
X -DsBYTE=char .
X
XIII. Not every image contains all resolutions (especially images
X from demo disks). You can't extract resolutions which are
X not contained.
X
XIV. Some cdrom drives read more than the data sectors of the
X PhotoCD files. They read additional sector headers etc.
X In this case to have to write a little conversion tool.
X
X E.g.: Sony NEWS, model NWS-3720
X Write a simple filter program, which takes the file,
X cuts in slices of 0x920 size, takes out 0x800 data
X with offset 8 of each slice and write them out in a new file.
X
X
XV. There are some problems when compiling for MS-DOS or OS/2.
X I don't like this, i don't have this and i don't use this.
X Several people sent mail with tricks for compiling.
X The important things are:
X - Use the gcc compiler and
X
X - change the fopen parameters from "w" to "wb" and from "r" to "rb".
X - or use the binmode.o routines.
X
XVI. On a Sun Workstation you can mount the Photo-CD as a high-sierra
X file system with the command
X mount -r -t hsfs /dev/sr0 /cdrom
X
X
END_OF_FILE
if test 1553 -ne `wc -c <'hpcdtoppm.0.6/README.TOO'`; then
echo shar: \"'hpcdtoppm.0.6/README.TOO'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/README.TOO'
fi
if test -f 'hpcdtoppm.0.6/ReadMe.NeXT' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/ReadMe.NeXT'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/ReadMe.NeXT'\" \(244 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/ReadMe.NeXT' <<'END_OF_FILE'
X
X
XThere are at least two ports to the NeXT machine with
Xgraphical user interface. One of them is called "pCD".
X
XSince i do not get informed about these ports, i don't
Xknow on which version of hpcdtoppm they are based and
Xwhere to get them.
X
X
END_OF_FILE
if test 244 -ne `wc -c <'hpcdtoppm.0.6/ReadMe.NeXT'`; then
echo shar: \"'hpcdtoppm.0.6/ReadMe.NeXT'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/ReadMe.NeXT'
fi
if test -f 'hpcdtoppm.0.6/ReadMe.SGI' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/ReadMe.SGI'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/ReadMe.SGI'\" \(345 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/ReadMe.SGI' <<'END_OF_FILE'
X
XThere is a special version of hpcdtoppm with extensions for
XSGI machines. The extensions are written by
X
X Rodney Hoinkes
X Head of Design Applications
X Centre for Landscape Research
X University of Toronto
X Email: rodney@dgp.utoronto.ca
X
XThe SGI version is available via ftp at
Xexplorer.dgp.toronto.edu (128.100.1.129) in pub/sgi/sgiphotocd .
X
X
X
END_OF_FILE
if test 345 -ne `wc -c <'hpcdtoppm.0.6/ReadMe.SGI'`; then
echo shar: \"'hpcdtoppm.0.6/ReadMe.SGI'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/ReadMe.SGI'
fi
if test -f 'hpcdtoppm.0.6/TODO' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/TODO'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/TODO'\" \(285 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/TODO' <<'END_OF_FILE'
XThings I want to do when I find time:
X
X- Make the 64Base decoder read the images in real size,
X not always 4096x6144.
X
X- Better gamma correction procedures
X
X- Color conversion to YMC and YMCK for printer drivers
X
X- Driver for color printers
X
X- Better correction of reading errors
X
X
X
X
END_OF_FILE
if test 285 -ne `wc -c <'hpcdtoppm.0.6/TODO'`; then
echo shar: \"'hpcdtoppm.0.6/TODO'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/TODO'
fi
if test -f 'hpcdtoppm.0.6/color.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/color.c'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/color.c'\" \(4569 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/color.c' <<'END_OF_FILE'
X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
X* Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
X* Permission to use and distribute this software and its
X* documentation for noncommercial use and without fee is hereby granted,
X* provided that the above copyright notice appear in all copies and that
X* both that copyright notice and this permission notice appear in
X* supporting documentation. It is not allowed to sell this software in
X* any way. This software is not public domain.
X*/
X
X#include "hpcdtoppm.h"
X
Xextern sINT RGB_BitSh1,RGB_Maximum1;
Xextern sINT RGB_F_LL;
Xextern sINT RGB_F_C1,RGB_O_C1;
Xextern sINT RGB_F_C2,RGB_O_C2;
Xextern sINT RGB_F_G1,RGB_F_G2,RGB_O_G;
Xextern uBYTE RGB_corr0[],RGB_corr1[],RGB_corr2[];
X
X
Xstatic uBYTE *RGB_corr=0;
Xstatic sINT T_L[256],T_R[256],T_G[256],T_g[256],T_B[256];
X
X#define slen 3072
X
X
X
Xstatic void initcorr(void)
X {
X switch(corrmode)
X {case C_LINEAR: RGB_corr=RGB_corr0; break;
X case C_DARK: RGB_corr=RGB_corr1; break;
X case C_BRIGHT: RGB_corr=RGB_corr2; break;
X default: error(E_INTERN);
X }
X }
X
X
X
Xstatic void initctable(void)
X {sINT i;
X static sINT init=0;
X
X if(init) return;
X
X init=1;
X
X initcorr();
X
X for(i=0;i<256;i++)
X { T_L[i] = i * RGB_F_LL;
X T_R[i] = i * RGB_F_C2 + RGB_O_C2;
X T_G[i] = i * RGB_F_G1;
X T_g[i] = i * RGB_F_G2 + RGB_O_G;
X T_B[i] = i * RGB_F_C1 + RGB_O_C1;
X }
X
X }
X
X
Xstatic void ycctorgb(implane *l,implane *c1,implane *c2)
X {dim x,y,w,h;
X uBYTE *pl,*pc1,*pc2;
X sINT red,green,blue;
X sINT L;
X
X melde("ycctorgb\n");
X initctable();
X
X w=l->iwidth;
X h=l->iheight;
X
X for(y=0;y<h;y++)
X {
X pl = l->im + y * l->mwidth;
X pc1= c1->im + y * c1->mwidth;
X pc2= c2->im + y * c2->mwidth;
X
X for(x=0;x<w;x++)
X {
X L = T_L[*pl];
X red = (L + T_R[*pc2] )>>RGB_BitSh1;
X green= (L + T_G[*pc1] + T_g[*pc2] )>>RGB_BitSh1;
X blue = (L + T_B[*pc1] )>>RGB_BitSh1;
X
X red = TRIF(red, 0,RGB_Maximum1,0,red, RGB_Maximum1);
X green = TRIF(green,0,RGB_Maximum1,0,green,RGB_Maximum1);
X blue = TRIF(blue ,0,RGB_Maximum1,0,blue, RGB_Maximum1);
X
X *(pl++ )=RGB_corr[red];
X *(pc1++)=RGB_corr[green];
X *(pc2++)=RGB_corr[blue];
X }
X }
X }
X#undef BitShift
X
X
X
X
X
Xstatic void sharpit(implane *l)
X {sINT x,y,h,w,mw,akk;
X uBYTE f1[slen],f2[slen],*old,*akt,*ptr,*work,*help,*optr=0;
X
X melde("sharpit\n");
X
X if((!l) || (!l->im)) error(E_INTERN);
X if(l->iwidth > slen) error(E_INTERN);
X
X old=f1; akt=f2;
X h=l->iheight;
X w=l->iwidth;
X mw=l->mwidth;
X
X for(y=1;y<h-1;y++)
X {
X ptr=l->im+ y*mw;
X optr=ptr-mw;
X work=akt;
X
X *(work++)= *(ptr++);
X for(x=1;x<w-1;x++)
X { akk = 5*((sINT)ptr[0])- ((sINT)ptr[1]) - ((sINT)ptr[-1])
X - ((sINT)ptr[mw]) - ((sINT)ptr[-mw]);
X NORM(akk);
X *(work++)=akk;
X ptr++;
X }
X
X *(work++)= *(ptr++);
X
X if(y>1)
X for(x=0;x<w;x++)
X optr[x] = old[x];
X
X help=old;old=akt;akt=help;
X
X }
X
X
X
X akt=optr+mw;
X for(x=0;x<w;x++)
X *(akt++) = *(old++);
X }
X
X
X
X
X
X
X
Xstatic void initmtable(void)
X {sINT i,h;
X static sINT init=0;
X
X if(init) return;
X
X init=1;
X
X initcorr();
X
X for(i=0;i<256;i++)
X { h = (i * RGB_F_LL)>>RGB_BitSh1;
X h = TRIF(h,0,RGB_Maximum1,0,h,RGB_Maximum1);
X T_L[i]=RGB_corr[h];
X }
X
X }
X
X
Xstatic void monocorr(implane *l)
X {dim x,y,w,h;
X uBYTE *ptr;
X
X melde("monocorr\n");
X initmtable();
X
X w=l->iwidth;
X h=l->iheight;
X
X for(y=0;y<h;y++)
X {
X ptr= l->im + y * l->mwidth;
X for(x=0;x<w;x++,ptr++)
X { *ptr = T_L[*ptr];
X }
X }
X }
X
X
X
X
X
X
X
Xvoid colconvert(sizeinfo *si,implane *l,implane *c1,implane *c2)
X
X#define w (si->rdhlen)
X#define h (si->rdvlen)
X
X {
X melde("colconvert\n");
X
X if((!l ) || ( l->iwidth != w ) || ( l->iheight != h) || (! l->im)) error(E_INTERN);
X
X if(!monochrome)
X {
X if((!c1) || (c1->iwidth != w ) || (c1->iheight != h) || (!c1->im)) error(E_INTERN);
X if((!c2) || (c2->iwidth != w ) || (c2->iheight != h) || (!c2->im)) error(E_INTERN);
X }
X
X if (do_crop) cropit(si,l,c1,c2);
X else shrink(si,l,c1,c2);
X if (do_sharp) sharpit(l);
X
X switch (outfor)
X {
X /* RGB-Conversion */
X case O_PS:
X case O_EPS:
X case O_PPM: ycctorgb(l,c1,c2);
X break;
X
X /* Grayscale Conversion */
X case O_PSG:
X case O_EPSG:
X case O_PSD:
X case O_EPSD:
X case O_PGM: monocorr(l);
X break;
X
X /* No Conversion */
X case O_YCC:
X break;
X
X default: error(E_INTERN);
X }
X#undef w
X#undef h
X }
X
X
X
END_OF_FILE
if test 4569 -ne `wc -c <'hpcdtoppm.0.6/color.c'`; then
echo shar: \"'hpcdtoppm.0.6/color.c'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/color.c'
fi
if test -f 'hpcdtoppm.0.6/config.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/config.h'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/config.h'\" \(3990 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/config.h' <<'END_OF_FILE'
X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
X* Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
X* Permission to use and distribute this software and its
X* documentation for noncommercial use and without fee is hereby granted,
X* provided that the above copyright notice appear in all copies and that
X* both that copyright notice and this permission notice appear in
X* supporting documentation. It is not allowed to sell this software in
X* any way. This software is not public domain.
X*/
X
X
X
X/* define OWN_WRITE either here or by compiler-option if you don't want to use
X the pbmplus-routines for writing */
X/* #define OWN_WRITE */
X
X
X
X/* define DEBUG for some debugging informations */
X/* #define DEBUG */
X
X
X/* define LONG_HELP or SHORT_HELP, if you want to have an options
X list if parameters are bad */
X#define LONG_HELP
X
X
X/* define DO_DECL_EXT for external declaration of system and library calls */
X#define DO_DECL_EXT
X
X
X/* define FASTHUFF for faster Huffman decoding with tables.
X** this makes a little speedup, but needs about 768 KByte memory
X*/
X#define FASTHUFF
X
X
X
X#ifdef OWN_WRITE
X/* If the own routines are used, this is the size of the buffer in bytes.
X You can shrink if needed. */
X#define own_BUsize 50000
X
X/* The header for the ppm-files */
X#define PPM_Header "P6\n%d %d\n255\n"
X#define PGM_Header "P5\n%d %d\n255\n"
X
X
X#endif
X
X
X
X/* fopen Parameters, for some systems (MS-DOS :-( ) you need "wb" and "rb" */
X#define W_OP "w"
X#define R_OP "r"
X
X
X/* define SMALLNAMES if the filenames of PhotoCD have small letters on
X your filesystem */
X#define SMALLNAMES
X
X/* The separator between directory- and filenames */
X#define DIRSEP '/'
X
X
X
X
X
X/* if you can't write to stdout in binary mode, you have to fdopen
X a FILE * in binary mode to stdout. This is important for system,
X where W_OP is something other than "w". Please define the
X Macro USE_FDOPEN in this case and check the instructions, where this
X macro is used.
X*/
X
X/* #define USE_FDOPEN */
X
X
X
X
X
X
X
X
X
X/** Error detection **/
X
X#define error(x) eerror(x,__FILE__,__LINE__)
X
X
X
X/*
X** Data Types
X** Important: sBYTE must be a signed byte type !
X** If your compiler doesn't understand "signed", remove it.
X*/
X
X#ifndef sBYTE
Xtypedef signed char sBYTE;
X#endif
X
Xtypedef unsigned char uBYTE;
X
X/* signed and unsigned 32-bit-integers
XsINT and uINT must at least have 32 bit. If you
Xdon't have 32-bit-integers, take 64-bit and
Xdefine the macro U_TOO_LONG !!!
X
XuINT and sINT must be suitable to the printf/scanf-format %d
Xand %u and to the systemcalls as fread etc.
X
X*/
X
X#define uINT unsigned int
X#define sINT int
X/*
X#define uLONG unsigned long
X#define sLONG unsigned long
X*/
X/* #define U_TOO_LONG */
X
X
X
X
X
X
Xtypedef uINT dim;
Xtypedef sINT sdim;
X
X
X
X
X/* Floating point data type and string for sscanf */
X#define FLTPT double
X#define SSFLTPT "%lf"
X
X
X
X
X
X
X
X/* Default taken when no size parameter given,
X** C_DEFAULT depends on your taste and video-hardware,
X*/
X
X#define S_DEFAULT S_Base16
X#define O_DEFAULT O_PPM
X#define C_DEFAULT C_LINEAR
X#define T_DEFAULT T_AUTO
X
X
X/* Background for contact sheet */
X#define CONTLUM neutrLum
X#define CONTCH1 neutrCh1
X#define CONTCH2 neutrCh2
X
X
X
X
X/* Maximum Black value of frame for cutting of the
X** frame. If MAX_BLACK is n, a frame is detected, when
X** all Luma values are within [ 0 .. (n-1) ]
X*/
X#define MAX_BLACK 1
X
X/* Default Postscript paper size
X** (German DIN A 4 )
X*/
X#define DEF_PAPER_LEFT 50.0
X#define DEF_PAPER_BOTTOM 50.0
X#define DEF_PAPER_WIDTH 500.0
X#define DEF_PAPER_HEIGHT 750.0
X#define DEF_DPI 300.0
X
X
X
X/* External Declarations */
X#ifdef DO_DECL_EXT
X
X/*extern void *malloc(unsigned);*/
Xextern int sscanf(char *,char *,...);
X
Xextern int fprintf(FILE *,char *,...);
Xextern int fclose(FILE *);
Xextern int fseek(FILE *,long,int);
Xextern int fread(void *,int,int,FILE *);
Xextern int fwrite(void *,int,int,FILE *);
Xextern int fputs(char *,FILE *);
Xextern int fputc(char ,FILE *);
Xextern int fflush(FILE *);
X
X#endif
X
X
X
X
X
X
X
END_OF_FILE
if test 3990 -ne `wc -c <'hpcdtoppm.0.6/config.h'`; then
echo shar: \"'hpcdtoppm.0.6/config.h'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/config.h'
fi
if test -f 'hpcdtoppm.0.6/hpcdtoppm.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/hpcdtoppm.h'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/hpcdtoppm.h'\" \(5965 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/hpcdtoppm.h' <<'END_OF_FILE'
X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
X* Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
X* Permission to use and distribute this software and its
X* documentation for noncommercial use and without fee is hereby granted,
X* provided that the above copyright notice appear in all copies and that
X* both that copyright notice and this permission notice appear in
X* supporting documentation. It is not allowed to sell this software in
X* any way. This software is not public domain.
X*/
X
X
X#include <stdio.h>
X#include <string.h>
X#include <malloc.h>
X#include <sys/types.h>
X#include <ctype.h>
X#include "config.h"
X
X
X
X
X
X
X
X
X/* Format definitions */
X
X#define BaseW ((dim)768)
X#define BaseH ((dim)512)
X
X#define SECSIZE 0x800
X
X#define SeHead 2
X#define L_Head (1+SeHead)
X
X#define SeBase16 18
X#define L_Base16 (1+SeBase16)
X
X#define SeBase4 72
X#define L_Base4 (1+SeBase4)
X
X#define SeBase 288
X#define L_Base (1+SeBase)
X
X
X#define neutrLum 128
X#define neutrCh1 156
X#define neutrCh2 137
X
X
X
X
X
X
X
X/* Structures and definitions */
Xstruct _implane
X {dim mwidth,mheight,
X iwidth,iheight;
X uBYTE *im,*mp;
X };
Xtypedef struct _implane implane;
X
X#define nullplane ((implane *) 0)
X
X
X
X
X
Xstruct _sizeinfo
X {dim w,h; /* Image Resolution */
X dim rdhoff,rdhlen, rdvoff, rdvlen; /* Size of Image in Memory */
X dim imhoff,imhlen, imvoff, imvlen; /* Real Size of Image */
X };
Xtypedef struct _sizeinfo sizeinfo;
X
X
X
X
X/* Definitions for 64Base */
X
Xstruct file32 { uBYTE x1,x2,x3,x4;};
Xstruct file16 { uBYTE x1,x2;};
X#define FILE32(x) ( (((uINT)x.x1)<<24) | (((uINT)x.x2)<<16) | (((uINT)x.x3)<<8) | (uINT)x.x4 )
X#define FILE16(x) ( (((uINT)x.x1)<<8) | (uINT)x.x2 )
X
Xstruct ic_header {char ic_name[0x28];
X struct file16 val1;
X struct file16 val2;
X struct file32 off_descr;
X struct file32 off_fnames;
X struct file32 off_pointers;
X struct file32 off_huffman;
X };
X
Xstruct ic_descr {struct file16 len;
X uBYTE color;
X uBYTE fill; /* Don't know */
X struct file16 width;
X struct file16 height;
X struct file16 offset;
X struct file32 length;
X struct file32 off_pointers;
X struct file32 off_huffman;
X };
X
X
Xstruct ic_fname {char fname[12];
X struct file32 size;
X };
X
Xstruct ic_entry {struct file16 fno;
X struct file32 offset;
X };
X
X
X
Xenum TURNS { T_UNSPEC,T_NONE,T_RIGHT,T_LEFT,T_HEAD,T_AUTO };
Xenum SIZES { S_UNSPEC,S_Base16,S_Base4,S_Base,S_4Base,S_16Base,S_64Base,S_Over,S_Contact };
Xenum OUTFOR { O_UNSPEC,O_PPM,O_PGM,O_YCC,O_PS,O_EPS,O_PSG,O_EPSG,O_PSD,O_EPSD };
Xenum CORR { C_UNSPEC,C_LINEAR,C_DARK,C_BRIGHT };
X
Xenum ERRORS { E_NONE,E_READ,E_WRITE,E_INTERN,E_ARG,E_OPT,E_MEM,E_HUFF,
X E_SEQ,E_SEQ1,E_SEQ2,E_SEQ3,E_SEQ4,E_SEQ5,E_SEQ6,E_SEQ7,E_POS,E_IMP,E_OVSKIP,
X E_TAUTO,E_TCANT,E_SUBR,E_PRPAR,E_CONFIG,E_FOPEN };
X
X
X
X
X
X/**** Macros ****/
X
X
X
X#ifdef DEBUG
X#define RPRINT {fprintf(stderr,"R-Position %x\n",bufpos);}
X#else
X#define RPRINT
X#endif
X
X#define melde(x) {if (do_melde) fprintf(stderr,x);}
X
X
X#define READBUF READ(sbuffer,sizeof(sbuffer))
X#define EREADBUF {if(READBUF < 1) error(E_READ);}
X
X#define SKIP(p) { if (SKIPn(p)) error(E_READ);}
X#define SKIPr(p) { if (SKIPn(p)) return(E_READ);}
X
X
X#define TRIF(x,u,o,a,b,c) ((x)<(u)? (a) : ( (x)>(o)?(c):(b) ))
X#define xNORM(x) x=TRIF(x,0,255,0,x,255)
X#define NORM(x) { if(x<0) x=0; else if (x>255) x=255;}
X
X#ifndef MIN
X#define MIN(a,b) (((a) < (b)) ? (a) : (b))
X#endif
X
X
X
X
X
X
X
X
X/* main.c */
Xextern void close_all(void);
X
Xextern char *ppmname,*pcdname;
Xextern sINT do_diff,do_info,do_sharp,do_overskip,monochrome;
Xextern sINT do_melde,do_rep,do_crop;
Xextern sINT flvert,flhori;
Xextern uBYTE sbuffer[SECSIZE];
Xextern enum TURNS turn;
Xextern enum SIZES size;
Xextern enum OUTFOR outfor;
Xextern enum CORR corrmode;
X
Xextern void SEEK(int);
Xextern int SKIPn(int);
Xextern int READ(uBYTE *,int);
Xextern sINT bufpos;
X
X
X
X
X/* error.c */
Xextern void eerror(enum ERRORS,char *, int);
X
X
X/* color.c */
Xextern void colconvert(sizeinfo *,implane *,implane *,implane *);
X
X/* tools.c */
Xextern void clearimpl(implane *,sINT);
Xextern void halve(implane *);
Xextern void interpolate(implane *);
Xextern sINT Skip4Base(void);
Xextern void planealloc(implane *,dim,dim);
Xextern void pastein(implane *,dim,dim,dim,dim,implane *, enum TURNS);
Xextern void cropit(sizeinfo *,implane *,implane *,implane *);
Xextern void shrink(sizeinfo *,implane *,implane *,implane *);
Xextern void typecheck(void);
X
X
X/* format.c */
Xextern void readhqt(sINT);
Xextern void readhqtx(sINT);
Xextern void decode(sizeinfo *,int,implane *,implane *,implane *,sINT);
Xextern void decodex(FILE **,int tag,struct ic_descr *,sizeinfo *,int,implane *,sINT);
Xextern enum ERRORS readplain(sizeinfo *,int,implane *,implane *,implane *);
X
X
X
X
X
X/* Type definitions for output format drives, used in output.c and the drivers */
X
Xtypedef void (OUT1PL)(FILE *,dim,dim, uBYTE *,sdim,sdim);
Xtypedef void (OUT3PL)(FILE *,dim,dim, uBYTE *,sdim,sdim, uBYTE *,sdim,sdim, uBYTE *,sdim,sdim);
X
X/* output.c */
Xextern void writepicture(FILE *,sizeinfo *,implane *,implane *,implane *,enum TURNS);
Xextern void druckeid(void);
X
X
X/* ppm.c */
Xextern OUT3PL write_ppm;
Xextern OUT1PL write_pgm;
X
X/* postscr.c */
Xextern OUT3PL write_epsrgb,write_psrgb;
Xextern OUT1PL write_epsgrey,write_psgrey,write_epsdith,write_psdith;
X
Xextern FLTPT PAPER_LEFT,PAPER_BOTTOM,PAPER_WIDTH,PAPER_HEIGHT,PRINTER_XDPI,PRINTER_YDPI,PRINTER_FAK;
Xextern sINT PSIZE_SET,DPI_SET,FAK_SET;
X
X
X
X
X
X
END_OF_FILE
if test 5965 -ne `wc -c <'hpcdtoppm.0.6/hpcdtoppm.h'`; then
echo shar: \"'hpcdtoppm.0.6/hpcdtoppm.h'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/hpcdtoppm.h'
fi
if test -f 'hpcdtoppm.0.6/hpcdtoppm.man' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/hpcdtoppm.man'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/hpcdtoppm.man'\" \(8628 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/hpcdtoppm.man' <<'END_OF_FILE'
X.ds Ps P\s-2OST\s+2S\s-2CRIPT\s+2
X.TH hpcdtoppm 1L "3 March 1994"
X.IX hpcdtoppm
X.SH NAME
Xhpcdtoppm \- convert a Photo-CD file into a portable bitmap file
X.SH SYNOPSIS
X.B hpcdtoppm
X.I infile
X.RB [ \-a ]
X.RB [{ \-C | \-0 | \-Overview | \-O }]
X.IR "file opt" ]
X.RB [ \-c0 ]
X.RB [ \-c- ]
X.RB [ \-c+ ]
X.RB [ \-crop ]
X.RB [ \-d ]
X.RB [ \-dpi
X.IR f ]
X.RB [ \-eps ]
X.RB [ \-epsd ]
X.RB [ \-epsg ]
X.RB [ \-fak
X.IR scale ]
X.RB [ \-hori ]
X.RB [ \-i ]
X.RB [ \-l ]
X.RB [ \-m ]
X.RB [ \-n ]
X.RB [ \-pb
X.IR pos ]
X.RB [ \-pgm ]
X.RB [ \-ph
X.IR height ]
X.RB [ \-pl
X.IR pos ]
X.RB [ \-pos ]
X.RB [ \-ppm ]
X.RB [ \-ps ]
X.RB [ \-psd ]
X.RB [ \-psg ]
X.RB [ \-pw
X.IR width ]
X.RB [ \-r ]
X.RB [ \-rep ]
X.RB [ \-S
X.IR "long short" ]
X.RB [ \-s ]
X.RB [ \-vert ]
X.RB [ -x ]
X.RB [ \-ycc ]
X.RB [ \-1 | \-Base/16
X.RI | \-128x192 ]
X.RB [ \-2 | \-Base/4
X.RI | \-256x384 ]
X.RB [ \-3 | \-Base
X.RI | \-512x768 ]
X.RB [ \-4 | \-4Base
X.RI | \-1024x1536 ]
X.RB [ \-5 | \-16Base
X.RI | \-2048x3072 ]
X.RB [ \-6 | \-64Base
X.RI | \-4096x6144 ]
X.RI [ outfile ]
X.SH DESCRIPTION
XThis program accepts Photo-CD image or overview file data from the specified
Xinput file,
X.I infile
X(or, if the resolution is lower than 64Base and the file argument is specified as
X.BR \- ,
Xfrom standard input),
Xand writes either Portable Bitmap Format or \*(Ps to the specified output file
X(or to standard output if no file is specified).
X.LP
XOn a standard Photo-CD,
Ximage files appear in
X.IR photo_cd/images ,
Xwhere they appear in files with names of the form
X.RI img nnnn.pcd ,
Xwhere
X.I nnnn
Xis a 4-digit-number.
XThe overview file appears in
X.IR photo_cd/overview.pcd .
X.LP
XPhoto-CD images are stored using as many as 6 different resolutions:
X.ta 1i 3i
X.nf
X Format Resolution
X ------ ----------
X 64Base 4096x6144 (ProPhotoCD only)
X 16Base 2048x3072
X 4Base 1024x1536
X Base 512x768
X Base/4 256x384
X Base/16 128x192
X.fi
X.LP
XThe overview file employs Base/16 format.
X.IX GIF
X.SH OPTIONS
XInvoking
X.I hpcdtoppm
Xwithout arguments produces a list of default values.
XNote that you can supply only one size option.
X.TP
X.B \-a
XAutomatically determine image orientation
X(this option is experimental,
Xand does not work for overview files).
X.TP
X{\fB\-C\fP | \fB\-0\fP | \fB\-Overview\fP | \fB\-O\fP } \fIfile opt\fP
XExtract all images from an overview file.
XThe mandatory
X.I file
Xargument is the name of a
X.I ppm
Xfile;
Xoutput files are named
X.IR filennnn ,
Xwhere
X.I nnnn
Xis a 4-digit number.
XOverview images are extracted in their original Base/16 format.
XThe value of
X.I opt
Xdetermines the orientation of the contact sheet image;
Xrecognized values are:
X.RS
X.TP
X.B n
XDo not rotate the image.
X.TP
X.B l
XRotate the picture counter-clockwise (portrait mode).
X.TP
X.B r
XRotate the picture clockwise (portrait mode).
X.RE
X.TP
X.B \-c0
XDo not correct (brighten or darken) the image.
X.TP
X.B \-c-
XDarken the image.
X.TP
X.B \-c+
XBrighten the image.
X.TP
X.B \-crop
XCut off the black frame which sometimes appears
Xat the image borders.
X.TP
X.B \-d
XShow only the decompressed difference rather than the complete image
X(applicable only to 4Base and 16Base images).
X.TP
X.B \-dpi res
XSet the printer resolution to
X.I res
Xfor dithered \*(Ps images.
X.TP
X.B \-eps
XWrite a RGB Encapsulated \*(Ps color image.
X.TP
X.B \-epsd
XWrite a Floyd-Steinberg dithered image in Encapsulated \*(Ps.
X.TP
X.B \-epsg
XWrite a grayscale image in Encapsulated \*(Ps.
X.TP
X.B \-fak scale
XSet the scaling factor for dithered \*(Ps images to
X.IR scale .
X.TP
X.B \-hori
XFlip the image horizontally.
X.TP
X.B \-i
XSend information from an image file header to standard error.
X.TP
X.B \-l
XRotate the picture counter-clockwise (portrait mode).
X.TP
X.B \-m
XWrite messages about the phases of decoding to standard error.
X.TP
X.B \-n
XDo not rotate the image.
X.TP
X.B \-pb pos
XSet the bottom position of the \*(Ps image to
X.IR pos .
X.TP
X.B \-pgm
XWrite a
X.I pgm
X(grayscale) image.
X.TP
X.B \-ph height
XSet the height of the \*(Ps image to
X.IR height .
X.TP
X.B \-pl pos
XSet the leftmost position of the \*(Ps image to
X.IR pos .
X.TP
X.B \-pos
XPrint the relative starting position of the data for the current resolution.
X.TP
X.B \-ppm
XWrite a
X.I ppm
XRGB (color) image.
X.TP
X.B \-ps
XWrite a RGB \*(Ps color image.
X.TP
X.B \-psd
XWrite a Floyd-Steinberg dithered image in \*(Ps.
X.TP
X.B \-psg
XWrite a \*(Ps grayscale image.
X.TP
X.B \-pw width
XSet the width of the \*(Ps image to
X.IR width .
X.TP
X.B \-r
XRotate the picture clockwise (portrait mode).
X.TP
X.B \-rep
XTry to jump over reading errors in the Huffman code.
X.TP
X.B \-S "long short"
XCut out a subrectangle with boundaries defined by the values:
X.RS
X.TP
X.I long
XFor the longer side of the image.
X.TP
X.I short
XFor the shorter side of the image.
X.RE
X.IP
Xwhere
X.I long
Xand
X.I short
Xtake one of two forms:
X.RS
X.TP
X.B a\-b
XCut from position
X.I a
Xto position
X.IR b .
X.TP
X.B a+b
XStarting at offset
X.IR a ,
Xcut a length of
X.IR b .
X.RE
X.IP
Xand where
X.I a
Xand
X.I b
Xare either integers representing pixel locations,
Xor floating point values over the range [0.0 ... 1.0],
Xrepresenting the fraction of the length of a side.
X.TP
X.B \-s
XApply a simple sharpness operator to the luminosity channel.
X.TP
X.B \-vert
XFlip the image vertically.
X.TP
X.B -x
XOverskip Mode (applicable to Base/16, Base/4, Base and 4Base).
XIn Photo-CD images the luminosity channel is stored in full resolution,
Xthe two chromaticity channels are stored in half resolution only and have
Xto be interpolated.
XIn Overskip Mode,
Xthe chromaticity channels of the next higher resolution are
Xtaken instead of interpolating.
XTo see the difference,
Xgenerate one
X.I ppm
Xwith and one
X.I ppm
Xwithout this flag.
XUse
X.IR pnmarith (1L)
Xto generate the difference image of these two images.
XCall
X.IR ppmhist (1L)
Xfor this difference or show it with
X.IR xv (1L)
X(push the
X.B HistEq
Xbutton in the color editor).
X.TP
X.B \-ycc
XWrite the image in
X.I ppm
XYCC format.
X.TP
X.BR \-1 | \-Base/16 | \-128x192
XExtract the Base/16 image.
X.TP
X.B \-2 | \-Base/4 | \-256x384
XExtract the Base/4 image.
X.TP
X.B \-3 | \-Base | \-512x768
XExtract the Base image.
X.TP
X.B \-4 | \-4Base | \-1024x1536
XExtract the 4Base image.
X.TP
X.B \-5 | \-16Base | \-2048x3072
XExtract the 16Base image.
X.TP
X.B \-6 | \-64Base | \-4096x6144
XExtract the 64Base image. This resolution can be extracted from
XProPhotoCD images only. The path of the 64Base extension files is
Xderived from the path to the image file. This means that it doesn't work
Xon stdin an the directory structure must be the very same as on the
XProPhotoCD.
X.SH "POSTSCRIPT OUTPUT"
XFor \*(Ps output (options
X.BR \-ps ,
X.BR \-eps ,
X.BR \-psg ,
X.BR \-epsg ,
X.BR \-psd ,
X.BR \-epsg )
Xyou can define both the resolution and placement of the image.
XBoth size and position are specified in points (1/72 inch).
X.LP
XThe position of the image
X(where the origin is assumed to be at the lower left corner of the page)
Xis controlled by the
X.B \-pl
Xand
X.B \-pb
Xoptions (applicable at all resolutions).
X.LP
XThe size of color and grayscale images is changed with the
X.B \-pw
Xand
X.B \-ph
Xoptions.
XEvery image pixel is mapped onto one \*(Ps pixel.
X.LP
XThere are three modes of control for dithered \*(Ps:
X.TP
XImage size
X.RB ( \-pw
Xand
X.BR -ph )
X.TP
XPrinter resolution
X.RB ( \-dpi )
X.TP
XScaling factor
X.RB ( \-fak )
X.LP
XThese three factors are interdependent,
Xhence no more then two can be specified simultaneously.
XUsing
X.B \-dpi
Xand the
X.BR \-pw / \-ph
Xoptions together often yields pleasing results.
XEven using the default values for these options will
Xproduce results differing from those obtained without use of the options.
X.SH BUGS
XThe program ignores read protection.
X.LP
XThe
X.B \-i
Xoption is not working correctly.
X.LP
XAvailable information obout the Photo-CD format is vague;
Xthis program was developed by trial-and-error after staring at hex-dumps.
XPlease send bugs reports and patches to the author.
X.SH "SEE ALSO"
Xpnmarith(1L),
Xppm(5L),
Xppmhist(1L),
Xppmquant(1L),
Xppmtopgm(1L),
Xppmtorgb3(1L),
Xxv(1L)
X.SH VERSION
XThe name
X.I hpcdtoppm
Xstands for "Hadmut's pcdtoppm,"
Xto make it distinguishable in the event that someone else is building
Xa similar application and naming it
X.IR pcdtoppm .
XThis is version 0.6.
X.SH AUTHOR
XCopyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
XThis software is not public domain.
XPermission to use and distribute this software and its
Xdocumentation for noncommercial use and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation.
XThis software may not be sold or used for profit-making activities.
X.LP
XManual page extensively modified by R. P. C. Rodgers (rodgers@nlm.nih.gov).
X.\" end of document
X
END_OF_FILE
if test 8628 -ne `wc -c <'hpcdtoppm.0.6/hpcdtoppm.man'`; then
echo shar: \"'hpcdtoppm.0.6/hpcdtoppm.man'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/hpcdtoppm.man'
fi
if test -f 'hpcdtoppm.0.6/pcdindex' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/pcdindex'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/pcdindex'\" \(4832 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/pcdindex' <<'END_OF_FILE'
X#!/bin/csh -f
X#
X# pcdindex - generate a single PPM file from a PCD overview file
X#
X# This script assumes that the PBMPLUS and hpcdtoppm software
X# packages are installed, and that /tmp has enough space
X# (worst case 150Kbyte per image).
X# Based on pnmindex (PBMPLUS), which was written by Jef Poskanzer,
X# this script makes also use of hpcdtoppm, written by Hadmut Danisch.
X#
X# A similar result can be achieved by using "hpcdtoppm -Overview"
X# followed by "pnmindex -black" on the generated PPM images.
X# This shell just makes it more convenient and transparent to
X# convert from one PCD to one PPM overview file.
X#
X# Additional options (compared to pnmindex) are -maxwidth and
X# -font <font>. See "man pbmtext" on how to create your own font.
X#
X# Pieter S. van der Meulen, 1992.
X
X# You may want to change the default values in the next 6 lines:
Xset maxwidth=1152 # maximum width of the index image
Xset size=192 # make the images about this big
Xset across=6 # show this many images per row
Xset colors="noquant" # maximum amount of colors or noquant (no quantization)
Xset back="-black" # default background color
Xset font=" " # default font or none (pbmtext's internal font)
X
X# Parse the options
Xwhile ( 1 )
X switch ( "$1" )
X
X case -m*:
X if ( $#argv < 2 ) goto usage
X set maxwidth="$2"
X shift
X shift
X breaksw
X
X case -s*:
X if ( $#argv < 2 ) goto usage
X set size="$2"
X shift
X shift
X breaksw
X
X case -a*:
X if ( $#argv < 2 ) goto usage
X set across="$2"
X shift
X shift
X breaksw
X
X case -c*:
X set colors="$2"
X shift
X shift
X breaksw
X
X case -f*:
X set font="-font $2"
X shift
X shift
X breaksw
X
X case -b*:
X set back="-black"
X shift
X breaksw
X
X case -w*:
X set back="-white"
X shift
X breaksw
X
X case -*:
X echo "$0 : Unknown option $1"
X echo " "
X goto usage
X breaksw
X
X default:
X break
X breaksw
X
X endsw
Xend
X
Xif ( $#argv == 0 ) then
X goto usage
Xendif
X
Xset tmpfile=/tmp/pi.tmp.$$
Xrm -f $tmpfile
Xtouch /tmp/img0001 # Avoid complaints about non matching
Xrm -f /tmp/img*
X
Xset rowfiles=()
Xset imagefiles=()
X@ row = 1
X@ col = 1
X@ width = $size
X
X# Convert the PCD overview file to many PPM images
Xif (-f $1) then
X hpcdtoppm -Overview $1 /tmp/img
Xelse
X echo "$0 : Could not access $1"
X echo " "
X goto usage
Xendif
X
Xforeach i ( /tmp/img* )
X
Xif (-f $i) then
X set description=`pnmfile $i`
X if ( $description[4] <= $size && $description[6] <= $size ) then
X cat $i > $tmpfile
X else
X if ( $colors =~ n* ) then
X pnmscale -quiet -xysize $size $size $i > $tmpfile
X else
X pnmscale -quiet -xysize $size $size $i | ppmquant -quiet $colors > $tmpfile
X endif
X endif
X set imagefile=/tmp/pi.${row}.${col}.$$
X rm -f $imagefile
X set ttext=$i:t
X if ( "$back" == "-white" ) then
X pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2| pnmcat $back -tb $tmpfile - > $imagefile
X else
X pbmtext $font "$ttext" | pnmcrop -quiet | pnmmargin -white 2 | pnminvert | pnmcat $back -tb $tmpfile - > $imagefile
X endif
X rm -f $tmpfile
X set description=`pnmfile $imagefile`
X @ width += $description[4]
X set imagefiles=( $imagefiles $imagefile )
X
X if (( $col >= $across ) || ( $width > $maxwidth)) then
X set rowfile=/tmp/pi.${row}.$$
X rm -f $rowfile
X if ( $colors =~ n* ) then
X pnmcat $back -lr -jbottom $imagefiles > $rowfile
X else
X pnmcat $back -lr -jbottom $imagefiles | ppmquant -quiet $colors > $rowfile
X endif
X rm -f $imagefiles
X set imagefiles=()
X set rowfiles=( $rowfiles $rowfile )
X @ col = 1
X @ row += 1
X @ width = $size
X else
X @ col += 1
X endif
Xendif
X
Xend
X
Xif ( $#imagefiles > 0 ) then
X set rowfile=/tmp/pi.${row}.$$
X rm -f $rowfile
X if ( $colors =~ n* ) then
X pnmcat $back -lr -jbottom $imagefiles > $rowfile
X else
X pnmcat $back -lr -jbottom $imagefiles | ppmquant -quiet $colors > $rowfile
X endif
X rm -f $imagefiles
X set rowfiles=( $rowfiles $rowfile )
Xendif
X
Xif ( $#rowfiles == 1 ) then
X cat $rowfiles
Xelse
X if ( $colors =~ n* ) then
X pnmcat $back -tb $rowfiles
X else
X pnmcat $back -tb $rowfiles | ppmquant -quiet $colors
X endif
Xendif
Xrm -f $rowfiles
Xrm -f /tmp/img*
X
Xexit 0
X
Xusage:
X echo "Usage: $0 [-m W] [-s S] [-a A] [-c N|n] [-f F] [-b|-w] <overview.pcd>"
X echo " with"
X echo " W = maximum width of the result image (default: $maxwidth)"
X echo " S = maximum size of each of the images (default: $size)"
X echo " A = maximum number of images across (default: $across)"
X echo " N = maximum number of colors or noquant (default: $colors)"
X echo -n " F = font to be used for annotation (default: "
X if ( "$font" == " " ) then
X echo "internal font)"
X else
X echo "$font)"
X endif
X echo " -b/-w = black/white background color (default: $back)"
X echo " "
X echo " e.g.: $0 -m 768 -s 96 -f smallfont.pbm overview.pcd > overview.ppm"
X echo " or : $0 /cdrom/photo_cd/overview.pcd | cjpeg > overview.jpg"
Xexit 1
X
X
END_OF_FILE
if test 4832 -ne `wc -c <'hpcdtoppm.0.6/pcdindex'`; then
echo shar: \"'hpcdtoppm.0.6/pcdindex'\" unpacked with wrong size!
fi
chmod +x 'hpcdtoppm.0.6/pcdindex'
# end of 'hpcdtoppm.0.6/pcdindex'
fi
if test -f 'hpcdtoppm.0.6/tools.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hpcdtoppm.0.6/tools.c'\"
else
echo shar: Extracting \"'hpcdtoppm.0.6/tools.c'\" \(8937 characters\)
sed "s/^X//" >'hpcdtoppm.0.6/tools.c' <<'END_OF_FILE'
X/* hpcdtoppm (Hadmut's pcdtoppm) v0.6
X* Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
X* Permission to use and distribute this software and its
X* documentation for noncommercial use and without fee is hereby granted,
X* provided that the above copyright notice appear in all copies and that
X* both that copyright notice and this permission notice appear in
X* supporting documentation. It is not allowed to sell this software in
X* any way. This software is not public domain.
X*/
X
X#include "hpcdtoppm.h"
X
X
Xvoid clearimpl(implane *l,sINT n)
X{ dim x,y;
X uBYTE *ptr;
X
X ptr=l->im;
X for (x=0;x<l->mwidth;x++)
X for (y=0; y<l->mheight;y++)
X *(ptr++)=n;
X}
X
X
X
X
Xvoid halve(implane *p)
X {dim w,h,x,y;
X uBYTE *optr,*nptr;
X
X melde("halve\n");
X if ((!p) || (!p->im)) error(E_INTERN);
X
X w=p->iwidth/=2;
X h=p->iheight/=2;
X
X
X for(y=0;y<h;y++)
X {
X nptr=(p->im) + y*(p->mwidth);
X optr=(p->im) + 2*y*(p->mwidth);
X
X for(x=0;x<w;x++,nptr++,optr+=2)
X { *nptr = *optr;
X }
X
X }
X
X }
X
X
X
X
X
X
X
Xvoid interpolate(implane *p)
X {dim w,h,x,y,yi;
X uBYTE *optr,*nptr,*uptr;
X
X melde("interpolate\n");
X if ((!p) || (!p->im)) error(E_INTERN);
X
X w=p->iwidth;
X h=p->iheight;
X
X if(p->mwidth < 2*w ) error(E_INTERN);
X if(p->mheight < 2*h ) error(E_INTERN);
X
X
X p->iwidth=2*w;
X p->iheight=2*h;
X
X
X for(y=0;y<h;y++)
X {yi=h-1-y;
X optr=p->im+ yi*p->mwidth + (w-1);
X nptr=p->im+2*yi*p->mwidth + (2*w - 2);
X
X nptr[0]=nptr[1]=optr[0];
X
X for(x=1;x<w;x++)
X { optr--; nptr-=2;
X nptr[0]=optr[0];
X nptr[1]=(((sINT)optr[0])+((sINT)optr[1])+1)>>1;
X }
X }
X
X for(y=0;y<h-1;y++)
X {optr=p->im + 2*y*p->mwidth;
X nptr=optr+p->mwidth;
X uptr=nptr+p->mwidth;
X
X for(x=0;x<w-1;x++)
X {
X nptr[0]=(((sINT)optr[0])+((sINT)uptr[0])+1)>>1;
X nptr[1]=(((sINT)optr[0])+((sINT)optr[2])+((sINT)uptr[0])+((sINT)uptr[2])+2)>>2;
X nptr+=2; optr+=2; uptr+=2;
X }
X *(nptr++)=(((sINT)*(optr++))+((sINT)*(uptr++))+1)>>1;
X *(nptr++)=(((sINT)*(optr++))+((sINT)*(uptr++))+1)>>1;
X }
X
X
X optr=p->im + (2*h-2)*p->mwidth;
X nptr=p->im + (2*h-1)*p->mwidth;
X for(x=0;x<w;x++)
X { *(nptr++) = *(optr++); *(nptr++) = *(optr++); }
X
X }
X
X
X
X
Xstatic sINT testbegin(void)
X {sINT i,j;
X for(i=j=0;i<32;i++)
X if(sbuffer[i]==0xff) j++;
X
X return (j>30);
X
X }
X
X
XsINT Skip4Base(void)
X {sINT cd_offset,cd_offhelp;
X
X cd_offset = L_Head + L_Base16 + L_Base4 + L_Base ;
X SEEK(cd_offset+3);
X EREADBUF;
X cd_offhelp=((((sINT)sbuffer[510])<<8)|sbuffer[511]) + 1;
X
X cd_offset+=cd_offhelp;
X
X SEEK(cd_offset);
X EREADBUF;
X while(!testbegin())
X {cd_offset++;
X EREADBUF;
X }
X return cd_offset;
X }
X
X
X
X
X
Xvoid planealloc(implane *p, dim width, dim height)
X {melde("planealloc\n");
X
X p->iwidth=p->iheight=0;
X p->mwidth=width;
X p->mheight=height;
X
X p->mp = ( p->im = ( uBYTE * ) malloc (width*height*sizeof(uBYTE)) );
X if(!(p->im)) error(E_MEM);
X }
X
X
X
Xstatic void pastequer(implane *gross,dim px,dim py,implane *klein)
X {dim x,y;
X uBYTE *von,*nach;
X
X if(px+klein->iwidth > gross->iwidth) error(E_INTERN);
X if(py+klein->iheight > gross->iheight) error(E_INTERN);
X
X for(y=0;y<klein->iheight;y++)
X { von=klein->im + y * klein->mwidth;
X nach=gross->im + (y+py) * gross->mwidth + px;
X for(x=0;x<klein->iwidth;x++)
X *(nach++)=*(von++);
X }
X }
X
X
Xstatic void pastehead(implane *gross,dim px,dim py,implane *klein)
X {dim x,y;
X uBYTE *von,*nach;
X
X if(px+klein->iwidth > gross->iwidth) error(E_INTERN);
X if(py+klein->iheight > gross->iheight) error(E_INTERN);
X
X for(y=0;y<klein->iheight;y++)
X { von= klein->im + (klein->iheight-1-y) * klein->mwidth + (klein->iwidth - 1);
X nach=gross->im + (y+py) * gross->mwidth + px;
X for(x=0;x<klein->iwidth;x++)
X *(nach++)=*(von--);
X }
X }
X
X
Xstatic void pastelinks(implane *gross,dim px,dim py,implane *klein)
X {dim x,y;
X uBYTE *von,*nach;
X
X if(px+klein->iheight > gross->iwidth) error(E_INTERN);
X if(py+klein->iwidth > gross->iheight) error(E_INTERN);
X
X for(y=0;y<klein->iwidth;y++)
X { von=klein->im + klein->iwidth - 1 - y;
X nach=gross->im + (y+py) * gross->mwidth + px;
X for(x=0;x<klein->iheight;x++,von+=klein->mwidth)
X *(nach++)=*(von);
X }
X }
X
Xstatic void pasterechts(implane *gross,dim px,dim py,implane *klein)
X {dim x,y;
X uBYTE *von,*nach;
X
X if(px+klein->iheight > gross->iwidth) error(E_INTERN);
X if(py+klein->iwidth > gross->iheight) error(E_INTERN);
X
X for(y=0;y<klein->iwidth;y++)
X { von=klein->im + (klein->iheight-1)*klein->mwidth + y;
X nach=gross->im + (y+py) * gross->mwidth + px;
X for(x=0;x<klein->iheight;x++,von-=klein->mwidth)
X *(nach++)=*(von);
X }
X }
X
X
Xvoid pastein(implane *gross,
X dim xpos,dim xw,
X dim ypos,dim yh,
X implane *klein, enum TURNS ori)
X {
X switch (ori)
X {
X case T_NONE: pastequer(gross,xpos+(xw-klein->iwidth)/2,ypos+(yh-klein->iheight)/2,klein);
X break;
X case T_LEFT: pastelinks(gross,xpos+(xw-klein->iheight)/2,ypos+(yh-klein->iwidth)/2,klein);
X break;
X case T_RIGHT:pasterechts(gross,xpos+(xw-klein->iheight)/2,ypos+(yh-klein->iwidth)/2,klein);
X break;
X case T_HEAD: pastehead(gross,xpos+(xw-klein->iwidth)/2,ypos+(yh-klein->iheight)/2,klein);
X break;
X case T_AUTO:
X default: error(E_INTERN);
X }
X }
X
X
X
X
X#define cro(p,d) {if(p) {p->im+=d*p->mwidth; p->iheight-=d;}}
X#define cru(p,d) {if(p) {p->iheight-=d;}}
X#define crl(p,d) {if(p) {p->im+=d; p->iwidth-=d;}}
X#define crr(p,d) {if(p) {p->iwidth-=d;}}
X
Xvoid cropit(sizeinfo *si,implane *l,implane *c1,implane *c2)
X {dim x,y,s,w,h;
X sINT nl,nr,no,nu;
X
X uBYTE *ptr;
X
X melde("crop\n");
X
X if(si->imvlen || si->imhlen) error(E_INTERN);
X w=si->rdhlen;
X h=si->rdvlen;
X
X if((!l) || (l->iwidth != w) || (l->iheight != h)) error(E_INTERN);
X
X if(!monochrome)
X {if((!c1) || (c1->iwidth != w) || (c1->iheight != h)) error(E_INTERN);
X if((!c2) || (c2->iwidth != w) || (c2->iheight != h)) error(E_INTERN);
X }
X
X
X for(y=0,no=0;y<h;y++,no++)
X {for(x=0,ptr=(l->im)+y*(l->mwidth); x<w && (*ptr)<MAX_BLACK ;x++,ptr++);
X if(x<w) break;
X }
X cro(l ,no);
X cro(c1,no);
X cro(c2,no);
X h-=no;
X
X
X for(y=h-1,nu=0;y;y--,nu++)
X {for(x=0,ptr=(l->im)+y*(l->mwidth); x<w && (*ptr)<MAX_BLACK ;x++,ptr++);
X if(x<w) break;
X }
X cru(l ,nu);
X cru(c1,nu);
X cru(c2,nu);
X h-=nu;
X
X
X s=l->mwidth;
X
X for(x=0,nl=0;x<w;x++,nl++)
X {for(y=0,ptr=(l->im)+x; y<h && (*ptr)<MAX_BLACK ; y++, ptr+=s);
X if(y<h) break;
X }
X crl(l ,nl);
X crl(c1,nl);
X crl(c2,nl);
X w-=nl;
X
X
X for(x=w-1,nr=0;x;x--,nr++)
X {for(y=0,ptr=(l->im)+x; y<h && (*ptr)<MAX_BLACK ; y++, ptr+=s);
X if(y<h) break;
X }
X crr(l ,nr);
X crr(c1,nr);
X crr(c2,nr);
X w-=nr;
X
X if (do_melde)
X {
X if (no || nu || nr || nl )
X fprintf(stderr,"Cut off %d top, %d bottom, %d left, %d right, new size is %dx%d\n",
X no,nu,nl,nr,w,h);
X else
X fprintf(stderr,"Nothing cut off\n");
X }
X
X si->imvlen=h;
X si->imhlen=w;
X }
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
Xvoid shrink(sizeinfo *si,implane *l,implane *c1,implane *c2)
X {dim w,h;
X
X melde("shrink\n");
X
X w=si->rdhlen;
X h=si->rdvlen;
X
X if((!l) || (l->iwidth != w) || (l->iheight != h)) error(E_INTERN);
X
X if(!monochrome)
X {if((!c1) || (c1->iwidth != w) || (c1->iheight != h)) error(E_INTERN);
X if((!c2) || (c2->iwidth != w) || (c2->iheight != h)) error(E_INTERN);
X }
X
X if((!si->imvlen) && (!si->imhlen)) /* no subrectangle given */
X {si->imvlen=si->rdvlen;
X si->imhlen=si->rdhlen;
X return;
X }
X
X if (si->imvlen>h || si->imvlen<1 ) error(E_INTERN);
X if (si->imvoff> si->rdvlen - si->imvlen) error(E_INTERN);
X
X if (si->imhlen>w || si->imhlen<1 ) error(E_INTERN);
X if (si->imhoff> si->rdhlen - si->imhlen) error(E_INTERN);
X
X cro(l ,si->imvoff);
X cro(c1,si->imvoff);
X cro(c2,si->imvoff);
X
X cru(l ,si->rdvlen - si->imvoff - si->imvlen);
X cru(c1,si->rdvlen - si->imvoff - si->imvlen);
X cru(c2,si->rdvlen - si->imvoff - si->imvlen);
X
X crl(l ,si->imhoff);
X crl(c1,si->imhoff);
X crl(c2,si->imhoff);
X
X crr(l ,si->rdhlen - si->imhoff - si->imhlen);
X crr(c1,si->rdhlen - si->imhoff - si->imhlen);
X crr(c2,si->rdhlen - si->imhoff - si->imhlen);
X
X
X }
X
X
X
X/* Test Data types for their size an whether they
X are signed / unsigned */
X
Xvoid typecheck(void)
X { sBYTE sbyte;
X uBYTE ubyte;
X sINT sint;
X uINT uint;
X
X
X if(sizeof(sBYTE) != 1) error(E_CONFIG);
X sbyte=126; sbyte++; sbyte++;
X if(sbyte > 126 ) error(E_CONFIG);
X
X if(sizeof(uBYTE) != 1) error(E_CONFIG);
X ubyte=126; ubyte++; ubyte++;
X if(ubyte < 126 ) error(E_CONFIG);
X
X#ifdef U_TOO_LONG
X if(sizeof(sINT) < 4) error(E_CONFIG);
X if(sizeof(uINT) < 4) error(E_CONFIG);
X#else
X if(sizeof(sINT) != 4) error(E_CONFIG);
X if(sizeof(uINT) != 4) error(E_CONFIG);
X#endif
X
X sint=1; sint--; sint--;
X if(sint>1) error(E_CONFIG);
X
X uint=1; uint--; uint--;
X if(uint<1) error(E_CONFIG);
X
X }
X
END_OF_FILE
if test 8937 -ne `wc -c <'hpcdtoppm.0.6/tools.c'`; then
echo shar: \"'hpcdtoppm.0.6/tools.c'\" unpacked with wrong size!
fi
# end of 'hpcdtoppm.0.6/tools.c'
fi
echo shar: End of archive 3 \(of 3\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 3 archives.
rm -f ark[1-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...