Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Looking for JPLDIS source code (Developers)

posted by neozeed(R), 24.08.2019, 05:58

C-language Considerations

The C-language versions of the decompression subroutines are more
portable than the equivalent FORTRAN versions. These routines have
been tested on a VAX 750 running under version 4.6 of VMS, a
Micro-VAX running under version 2.2 of ULTRIX, a SUN workstation
running under version 4.2 (release 3.4) of UNIX, and an IBM PC
running under MSDOS using versions 4.0 and 3.0 of MICROSOFT C.

The C-language version of the decompression software resides in the
DECOMP.C file. This file contains the decmpinit and decompress
routines, and the working routines dcmprs, huff_tree, and sort_freq.
Also, there is a main program, located in the DETEST.C file, which
tests the performance of the decompression software. If you are
adapting the software to your paricular hardware and operating system
environment, then this program will be useful for testing the

Example C-language Program

The example program shown below demonstrates the use of the
decompression subroutines.

* hist - Buffer to contain 511 elements of the encoding histogram.
* The encoding histogram is extracted from the image area.
* nsi - Number of bytes obtained from the read of a compressed
* line.
* nso - Number of output samples after decompression. For Voyager
* images, this value is 836.
* linei - Buffer containing the input compressed line.
* lineo - Buffer to contain the restored line after decompression.
* nl - Number of lines in the image array. For Voyager images,
* this value is 800.
* il - Loop counter for processing image lines.
main ()
extern void decmpinit(); /* decmpinit is void function*/
extern void decompress();/* decompress is void fuction*/
long nsi,nso,nl,il;
long hist[511];
char linei[836],lineo[836];
* Assume the encoding histogram has been extracted from
* the image file and has been placed into the hist array.
* Pass it to the decmpinit routine for intialization
* The loop will read one compressed line at a time from the input
* file and call the decompress routine to restore the line
nl = 800;
nso = 836;
for (il=0; i<nl; ++i)
(read next compressed line (linei) and length of line (nsi))
(line is restored in the LINEO variable.)

Stand-Alone Applications

Stand-alone applications which will read a compressed image file,
reformat the labels and decompress the image to an output file
are provided in C and FORTRAN language versions.

The program CDCOMP.C includes all routines necessary to compile and
link, producing an executable version of the program. This program
has been tested on an IBM PC with Microsoft C, version 5.1, on a
VAX 11/780 using VMS C version 2.2-015, and on a Sun workstation
running BSD UNIX 4.2. IBM PC users will receive three compilation
warnings which may be ignored. VAX/VMS users may have to edit the
"#include <stdio.h>" statement at the beginning of the file depending
on their environment setup.

The program CDCOMP.C prompts the user for a input file name, output
file format choice, and output file name. The output file formats
supported by this version of CDCOMP.C include PDS labelled format,
FITS labelled format, a simple VICAR2 labelled format and an
unlabelled binary array format.

The following commands should be used to link subroutines and produce
an executable file:

On an IBM PC (using Microsoft C Version 5.1)

cl /c cdcomp.c
link cdcomp/stack:10000;

On a VAX using VMS:
cc cdcomp
link cdcomp

On a Unix host (Sun, Masscomp)
cc -o cdcomp cdcomp.c

versions of a program to decompress image files and write them out to
a PDS formatted file. Both programs need to be compiled, then linked
with DECOMP.FOR to produce an executable file. The programs are
identical except for the file open statements and the variable
length record I/O (read) statements.

On an IBM PC (using Microsoft FORTRAN Version 4.1)

fl pcdriv.for decomp.for

On a VAX/VMS system:

for vaxdriv,decomp
link vaxdriv,decomp

There is also a sample program, IMGINDEX.FOR which will read and
display the contents of the image index table (IMGINDEX.TAB). It has
been tested on the VAX and IBM PC. The image index table must be in
the same directory as the executable for the program to operate
properly. The FILE='IMGINDEX.TAB' statement in the OPEN call can be
edited to reflect the location of the table (for example, on an IBM PC
it might be specified as FILE='L:INDEXIMGINDEX.TAB').


The CDCOMP program has been compiled and linked on IBM PC and VAX/VMS
systems to produce executable programs for decompressing images.
For users of IBM PC computers, the program PCDCOMP.EXE will prompt
for input and output file names, writing the decompressed file
to the specified file name. The program also supports writing
the image file out in PDS, FITS and VICAR2 format, or writing
an unlabelled 800 by 800 array of sample values. The FITS and
VICAR2 formats provide only minimal system labels to allow display
of the image on systems which support these label formats and have
not been carefully tested. For VAX/VMS users, the equivalent program
is VAXDCOMP.EXE, which writes out fixed-length files of 836-bytes
(PDS format), 2880-bytes (FITS format) or 800-bytes (VICAR2 or
unlabelled formats). The image histogram and all engineering
parameters discarded when writing the FITS, VICAR2 and unlabelled

No guarantee is made that these programs will work in your computer
configuration. The VAX program assumes that you have file-access
support for ISO format CD-ROM disks on your system, or that you have
used a CD-ROM utility routine to read the compressed file from CD-ROM
to a magnetic disk.


Complete thread:

Back to the forum
Board view  Mix view
16016 Postings in 1483 Threads, 271 registered users, 4 users online (0 registered, 4 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum