JasPer Software Reference Manual

© Copyright 2000-2001 Michael David Adams.

(Version: $Id$)


Table of Contents


Introduction

The JasPer software is a collection of utilities for image coding. Arguably, the most useful utility in the JasPer suite is the transcoder program. This particular program accepts image data in one format and generates image data in another format. The JasPer software can handle image data in a number of popular formats, including JPEG 2000, PNM/PGM/PPM, Windows BMP, and Sun Rasterfile. Since the JPEG-2000 format is supported, the transcoder program can be used as a JPEG-2000 encoder or decoder.

The design of the JasPer JPEG-2000 codec implementation was driven by several key concerns: execution speed, memory usage, robustness, portability, modularity, maintainability, and extensibility. In some cases, however, during the design process, modularity, portability, and understandability of the code were weighed more heavily than execution speed and memory usage. Code understandability and portability were critical considerations since the JasPer software was intended to be used as a reference implementation of JPEG-2000 codec.

The JasPer software is written in the C programming language. This language was chosen mainly due to the availability of C development environments for most of today's computing platforms. The JasPer software consists of about 27k lines of code in total. This code is spread across several programs and libraries.

Return to the Table of Contents.


Obtaining the Software

The latest version of the JasPer software can be downloaded from the following locations:

Return to the Table of Contents.


Extracting the Software

The JasPer software is distributed in the form of a Zip file. Therefore, in order to extract the contents of this file, a program capable of handling Zip archives is required. Such software is readily available for many different computing platforms:

Return to the Table of Contents.


Building the Software

Obviously, before the software can be built, the contents of the archive file containing the JasPer distribution must be extracted.

The JasPer code should compile and run on any platform with a C language implementation conforming to ISO/IEC 9899:1999 (i.e., the ISO C language standard) and supporting a subset of ISO/IEC 9945-1:1990 (i.e., the POSIX C API). Only limited POSIX support is required (i.e., the open, close, read, write, and lseek functions must be supported).

The specific procedure required to build the JasPer software depends on the type of system involved. Only two different build methods are supported. The first method is based on the well known make utility and should work on most UNIX (or UNIX-like) systems. The second method is specifically tailored to the needs of Microsoft Visual C under Microsoft Windows. In passing, we note that by using free software such as Cygwin, one can also create a UNIX-like environment under Microsoft Windows in which to build JasPer using the first method.

If you are unfortunate enough to have a compiler that is not compliant with ISO/IEC 9899:1999 (i.e., the C language standard), you may need to make some changes to the code. Unfortunately, even some of the most popular C language implementations do not strictly comply with the standard. One such example is Microsoft Visual C 6.0. Due to the popularity of Visual C, however, several workarounds have been added to the JasPer code to ensure that it will compile successfully with Visual C.

The current version of the JasPer software is known to compile in the following environments:

Of course, the software should compile successfully in many other environments as well. For example, past versions of JasPer have been reported to build successfully in the following environments:

Build Process for UNIX (or UNIX-Like) Systems

The JasPer software is intended to be built using the standard UNIX make utility (in conjunction with a configure script).

If you need a C compiler that is reasonably compliant with the ISO/IEC 9899:1999 standard, you can obtain GNU C from the GNU Project web site. If you need an implementation of Make, you can also obtain GNU Make from the the GNU Project web site. All GNU software is free software.

In what follows, "$TOPDIR" denotes the top level directory of the JasPer software distribution (i.e., the directory containing the file named configure). To build the software, the following steps are required (in order):

  1. Set the current working directory to the top level directory of the JasPer software distribution. To set the current working directory as required, type: (where $TOPDIR is defined as described earlier in this section).
  2. Run the configure program. This allows important information about the system configuration to be determined. In theory, it should not be necessary to manually edit any of the makefile templates (i.e., the Makefile.in files) used by the configure program. To invoke the configure program, type:
  3. Run the make command. The make command is what actually builds the software. In theory, it should not be necessary to manually edit any of the makefiles. To run the make program, type:
Presuming that the build was successful, the executables for the JasPer software can be found in the directory $TOPDIR/src/bin.

Build Process for Microsoft Visual C Studio under Microsoft Windows

With Microsoft Visual C, the entire build process is driven from workspace and project files. For the sake of convenience, all of the workspace and project files necessary to build the JasPer software are provided.

In what follows, "$TOPDIR" denotes the top level directory of the JasPer software distribution (i.e., the directory containing the file named configure). To build the software, the following steps are required (in order):

  1. Run Microsoft Visual C.
  2. Open the JasPer workspace file. This file is called jasper.dsw and can be found in the directory $TOPDIR/src/msvc.
  3. Build the code. From the "Build Menu", select the "Batch Build" item. Ensure that all projects/configurations are selected. Then, click on the "Build" button.
Presuming that the build was successful, the release and debug versions of the executables for the JasPer software can be found in the directories $TOPDIR/src/msvc/Win32_Release and $TOPDIR/src/msvc/Win32_Debug, respectively.

Return to the Table of Contents.


Using the Software

The JasPer software consists of the following programs:
  1. jasper. The JasPer transcoder.
  2. imgcmp. An image comparison utility.
  3. imginfo. An image information utility.
The use of these commands is described in the sections that follow.

Return to the Table of Contents.


The jasper Command

Synopsis

jasper [options]

Description

The jasper command converts image data from one format to another. In other words, this command functions as a general-purpose transcoder. Since the JPEG-2000 format is supported by this software, it can be used as a JPEG-2000 encoder and/or decoder.

Options

The jasper program accepts the following options:

The argument format must have one of the following values: Note: The support for the BMP format in JasPer was written without the benefit of the BMP format specification from Microsoft. This means that the BMP support will inevitably not work correctly for all valid BMP files. The support for the PNM/PGM/PPM format is complete. Therefore, the use of this format is favored over BMP. The support for the MIF format is experimental. It is intended to be used for advanced testing of the JasPer JPEG-2000 codec implementation.

BMP Encoder Options

The BMP encoder does not support any special options.

BMP Decoder Options

The BMP decoder does not support any special options.

JP2 Encoder Options

The JP2 encoder supports all of the same options as the JPC encoder.

JP2 Decoder Options

The JP2 decoder supports all of the same options are the JPC decoder.

JPC Encoder Options

The following options are provided by the JPC encoder:

Note: All rates are specified in terms of compression factors (i.e., as reciprocals of compression ratio) and not as actual bit rates! Although image coding folks frequently use the number of bits per pixel to specify rate, this quantity is often inconvenient to use when dealing with images that have differing sample precisions. Furthermore, the number of bits per pixel is not well defined for multicomponent images with distinct subsampling factors. The compression factor, however, is independent of sample precision and well defined for all types of images. For these reasons, JasPer does uses the compression factor and not the number of bits per pixel to specify rates.

JPC Decoder Options

The JPC decoder does not support any special options.

MIF Encoder Options

The MIF encoder does not support any special options.

MIF Decoder Options

The MIF decoder does not support any special options.

PNM Encoder Options

The following options are provided by the PNM encoder:

PNM Decoder Options

The PNM decoder does not support any special options.

RAS Encoder Options

The RAS encoder does not support any special options.

RAS Decoder Options

The RAS decoder does not support any special options.

Examples

Suppose that we have an image stored in the PNM/PPM format in a file called lena.ppm. To encode this image (losslessly) in the JPEG-2000 JP2 format, and store the result in a file called lena.jp2, type:

Or, alternately (using short option names), type:

Suppose that we have a RGB color image stored in the JPEG-2000 JP2 format in a file called lena.jp2. To encode this image in the PNM/PPM format, and store the result in a file called lena.ppm, type:

Or, alternately (using short option names), type:

Suppose that we have an image stored in the BMP format in a file called lena.bmp. To encode this image in a lossy manner at 100:1 compression in the JPEG-2000 (code stream) format, and store the result in a file called lena_lossy.jpc, type:

Suppose that we have an image stored in a file called sachie.pnm in the PNM/PPM format, and we want to encode the image in the JPEG-2000 (code stream) format and store the result in a file named sachie_new.jpc. Further, suppose that we want the JPEG-2000 format to employ the following parameters:

In order to accomplish the above, type:

Return to the Table of Contents.


The imgcmp Command

Synopsis

imgcmp [options]

Description

The imgcmp command compares two images. The two images being compared must have the same geometry (i.e., the same width, height, number of components, component subsampling factors, etc.).

Options

The following options are supported:

The "-f" and "-F" options must always be specified. There is currently no way to explicitly specify the format of the images. If the format of either image cannot be autodetected, the command will exit with an error.

Examples

Suppose that we have two slightly different versions of an image stored in files original.pgm and reconstructed.pgm. In order to calculate the difference between these images using the PSNR metric, type:

Return to the Table of Contents.


The imginfo Command

Synopsis

imginfo [options]

Description

The imginfo command displays information about an image. This command is really only intended to be used from shell scripts for testing purposes.

Return to the Table of Contents.


Reporting Bugs

If you are unfortunate enough to encounter any problems with JasPer, please submit a bug report. In order to ensure that we are able to properly process your bug report, always ensure that it includes the following information:

It is essential that you include all of the above information. Your complete bug report should be sent to mdadams@ieee.org.

Return to the Table of Contents.


Additional JasPer Resources

For more information about the JasPer software, please visit the following web pages:

Return to the Table of Contents.


Origin of the Name

The JasPer software is named, in part, after Jasper National Park, the largest national park in the Canadian Rockies with 10,878 square kilometres of mountain wilderness. As it happens, jasper is also the name of an opaque cryptocrystalline variety of quartz used for ornamentation or as a gemstone. Hence, the implication that the software is robust (i.e., solid as a rock) and precious (i.e., like a gemstone). Lastly, the name "jasper" was also chosen because it contains a letter "J" followed subsequently by a letter "P", not unlike the abbreviation "JP" that is currently associated with the emerging JPEG-2000 standard.

Return to the Table of Contents.