---=---=---=---=---
NJPL1I00PDS100000000 = SFDU_LABEL
RECORD_TYPE = STREAM
OBJECT = TEXT
NOTE = "Description of software provided with the
Voyager CD-ROM set."
END_OBJECT
END
Decompression Software
----------------------
The SOFTWARE directory contains software source code files for the
decompression of compressed image files. In order to make the software
available to a wide community of users, different versions of the
decompression software exist in VAX/VMS FORTRAN, IBM/PC FORTRAN,
C-language, and VAX/VMS Assembler language. Some modification of these
routines may be required in order to adapt the software to a particular
computer and operating system. This directory also contains a sample
utility program to read the image index flat table (IMGINDEX.FOR).
These routines assume that the user can access the compressed image
files through normal system input/output (I/O) commands. Otherwise
special utilities may be needed to move image files from the CD-ROM
to the user's fixed-disk prior to executing the decompression programs.
Information describing the compressed image files can be found in the
VOLINFO.TXT file located in the DOCUMENT directory. The document
describes the organization of the CD-ROM. It provides information on how
to access files stored on a CD-ROM, and gives details on the format and
contents of the image files and their supporting supplemental files.
The decompression software is supplied as callable subroutine
modules for use with existing applications; as source code for
stand-alone programs which can be copied to the users
host-computer, compiled, linked and executed; and as executables
for IBM PC and VAX users. The practice of distributing software on
read-only archival media is known to be risky. The executables
are being placed on this disk for evaluation and no guarantee is
made that they will work in specific computer configurations.
SUBROUTINES
The decompression software has two subroutines to be called by an
application program. Typically, an application program will open an
image file, read the image data from the file, call the decompression
routines to restore the image, and then transfer the image to the
appropriate output media or display device.
The software has two top-level subroutines, DECMPINIT and DECOMPRESS.
They provide a common base from which to call the processing
routines. DECMPINIT builds the Huffman tree from the encoding histogram
and is called only once per image. DECOMPRESS processes one compressed
input line per call and returns the line completely restored. These
routines are fully documented. Consult the source code files for a full
explanation of their use.
A Programmer's View
-------------------
From the programmer's view point, the calling sequence of these routines
are as follows:
1) First, extract the encoding histogram from the image file. (Consult
VOLINFO.TXT document for details). The encoding histogram contains
511 32-bit elements. Note, the encoding histogram is configured
in "least significant byte first" order. This is the order for integer
values used by VAX and IBM PC computer systems. Users of other
computer architectures (IBM Mainframes, Macintosh, SUN, and Apollo)
will need to swap the byte pairs 1 and 4, and 2 and 3. (Example,
hexadecimal value AA BB CC DD becomes DD CC BB AA.)
2) Pass the encoding histogram to the DECMPINIT routine to initialize
the Huffman coding tree.
3) After the initialization call, read compressed image lines, one at
at a time, from the image file and pass the lines to the DECOMPRESS
routine for restoration. After the image line has been restored,
transfer the line to an output image file or display screen.
FORTRAN Considerations
-----------------------
The VAX/VMS FORTRAN version of the decompression software resides in the
DECOMP.FOR file. This file contains the DECMPINIT and DECOMPRESS
routines, and the internal subroutines DCMPRS, HUFF_TREE, and SORT_FREQ.
A version of these routines for Sun workstations is in file DECOMPS.FOR.
Additionally, for VAX/VMS users there is an assembler language version
of the DCMPRS routine located in the file DCMPRS.MAR. Use of this
routine will improve the performance of the decompression software by a
factor of two. The VAX/VMS assembler routine will only work with the
FORTRAN version of the decompression software. There is also a source
file called BTEST.FOR. This file contains a FORTRAN version of the
VAX/VMS BTEST intrinsic function. Use this routine only if you are not
running under the VAX/VMS environment. Finally, there is a main
program, located in the DETEST.FOR file, which tests the performance
of the decompression software. If you are adapting the software to your
particular hardware configuration, then this program will be useful for
testing the software. A summary of the FORTRAN related files is
presented below.
DECOMP.FOR - VAX/VMS FORTRAN versions of the decompression
software. Contains routines DECMPINIT, DECOMPRESS, and
working routines SORT_FREQ, HUFF_TREE, and DCMPRS.
DCMPRS.MAR - VAX/VMS macro assembler routine which can replace
the FORTRAN version of the DCMPRS subroutine.
BTEST.FOR - Contains the FORTRAN code for the VAX/VMS BTEST
intrinsic function.
DETEST.FOR - Tests the decompression subroutines.
Example FORTRAN Program
------------------------
The example FORTRAN program shown below demonstrates how to use the
decompression programs.
C*******************************************************************
C
C HIST - Buffer to contain 511 elements of the encoding histogram.
C The encoding histogram is extracted from the image file.
C NSI - Number of bytes obtained from the read of a compressed
C line.
C NSO - Number of output samples after decompression. For Voyager
C images, this value is 836.
C LINEI - Buffer containing the input compressed line.
C LINEO - Buffer to contain the restored line after decompression.
C NL - Number of lines in the image array. For Voyager images,
C this value is 800
C IL - DO loop counter for processing image lines.
C********************************************************************
INTEGER*4 NSI,NSO,NL,IL
INTEGER*4 HIST(511)
BYTE LINEI(836),LINEO(836)
.
.
C********************************************************************
C Assume the encoding histogram has been extracted from
C the image file and has been placed into the HIST array.
C Pass it to the DECMPINIT routine for initialization
C********************************************************************
CALL DECMPINIT(HIST)
.
.
C********************************************************************
C The DO loop will read one compressed line at a time from the input
C file and call the DECOMPRESS routine to restore the line
C********************************************************************
NL = 800
NSO = 836
DO IL = 1,NL
.
.
(read next compressed line (LINEI) and length of line (NSI))
CALL DECOMPRESS(LINEI,LINEO,NSI,NSO)
(line is restored in the LINEO subroutine)
.
END DO
.
.
STOP
END |