c44

DjVu IW44 wavelet encoder.
Synopsis
        c44 [options] pnmfile [djvufile]
    

Description --- File "c44.cpp" illustrates the use of classes IWBitmap and IWPixmap for compressing and encoding a color image or a gray level image using the DjVu IW44 wavelets. This is the preferred mode for creating a DjVu image which does not require separate layers for encoding the text and the background images. The files created by c44 are recognized by both the IW44 decoder (see program d44) and by the DjVu decoder (see program djvutopnm).

Arguments --- Argument pnmfile is the name of the input file. PGM files are recognized for gray level images; PPM files are recognized for color images. Popular file formats can be converted to PGM or PPM using the NetPBM package (http://www.arc.umn.edu/GVL/Software/netpbm.html) or the ImageMagick package (http://www.wizards.dupont.com/cristy/).

Optional argument djvufile is the name of the output file. It is customary to use either suffix ".djvu", ".djv", ".iw44" or ".iw4". Suffix ".djvu" emphasizes the fact that IW44 files is seamlessly recognized by the current DjVu decoder. Suffix ".iw4" however was required by older versions of the DjVu plugin. If this argument is omitted, a filename is generated by replacing the suffix of pnmfile with suffix ".iw4".

Quality Specification--- Files produced by the DjVu IW44 Wavelet Encoder are IFF files composed of an arbitrary number of chunks (see showiff and IWImage.h) containing successive refinements of the encoded image. Each chunk is composed of several slices. A typical file contains a total of 100 slices split between three or four chunks. Various options provide quality targets (-decibel), slicing targets (-slice) or file size targets (-bpp or -size) for each of these refinements. Chunks are generated until meeting either the decibel target, the file size target, or the slicing target for each chunk.

-bpp n,..,n
Selects a increasing sequence of bitrates for building progressive IW44 file (in bits per pixel).
-size n,..,n
Selects a increasing sequence of minimal sizes for building progressive IW44 file (in bytes).
-decibel n,..,n
Selects an increasing sequence of luminance error expressed as decibels ranging from 16 (very low quality) to 48 (very high quality). This criterion should not be used when recoding an image which was already compressed with a lossy compression scheme (such as Wavelets or JPEG) because successive losses of quality accumulate.
-slice n+...+n
Selects an increasing sequence of data slices expressed as integers ranging from 1 to 140.
These options take a target specification list expressed either as a comma separated list of increasing numbers or as a list of numbers separated by character '+'. Both commands below for instance are equivalent:
    c44 -bpp 0.1,0.2,0.5 inputfile.ppm  outputfile.djvu
    c44 -bpp 0.1+0.1+0.3 inputfile.ppm  outputfile.djvu
    
Both these commands generate a file whose first chunk encodes the image with 0.1 bits per pixel, whose second chunk refines the image to 0.2 bits per pixel and whose third chunk refines the image to 0.5 bits per pixel. In other words, the second chunk provides an extra 0.1 bits per pixel and the third chunk provides an extra 0.3 bits per pixels.

When no quality specification is provided, program c44 usually generates a file composed of three progressive refinement chunks whose quality should be acceptable. The best results however are achieved by precisely tuning the image quality. As a rule of thumb, c44 generates an acceptable quality when you specify a size equal to 50% to 75% of the size of a comparable JPEG image.

Color Processing Specification --- Five options control the encoding of the chrominance information of color images. These options are of course meaningless for processing a gray level image.

-crcbnormal
Selects normal chrominance encoding (default). Chrominance information is encoded at the same resolution as the luminance.
-crcbhalf
Selects half resolution chrominance encoding. Chrominance information is encoded at half the luminance resolution.
-crcbdelay n
This option can be used with -crcbnormal and -crcbhalf for specifying an encoding delay which reduces the bitrate associated with the chrominance. The default chrominance encoding delay is 10 slices.
-crcbfull
Selects the highest possible quality for encoding the chrominance information. This is equivalent to specifying -crcbnormal and -crcbdelay 0.
-crcbnone
Disables encoding of the chrominance. Only the luminance information will be encoded. The resulting image will show in shades of gray.

Advanced Options --- Program c44 also recognizes the following options:

-dbfrac f
This option alters the meaning of the -decibel option. The decibel target then addresses only the average error of the specified fraction of the most misrepresented 32x32 pixel blocks.
-mask pbmfile
This option can be used when we know that certain pixels of a background image are going to be covered by foreground objects like text or drawings. File pbmfile must be a PBM file whose size matches the size of the input file. Each black pixel in pbmfile means that the value of the corresponding pixel in the input file is irrelevant. The DjVu IW44 Encoder will replace the masked pixels by a color value whose coding cost is minimal (see http://www.research.att.com/~leonb/DJVU/mask).

Performance --- The main design objective for the DjVu wavelets consisted of allowing progressive rendering and smooth scrolling of large images with limited memory requirements. Decoding functions process the compressed data and update a memory efficient representation of the wavelet coefficients. Imaging function then can quickly render an arbitrary segment of the image using the available data. Both process can be carried out in two threads of execution. This design plays an important role in the DjVu system.

We have investigated various state-of-the-art wavelet compression schemes: although these schemes may achieve slightly smaller file sizes, the decoding functions did not even approach our requirements. The IW44 wavelets reach these requirements today and may in the future implement more modern refinements (such as trellis quantization, bitrate allocation, etc.) if (and only if) these refinements can be implemented within our constraints.

Author:
Léon Bottou <leonb@research.att.com>
Version:
$Id: c44.html,v 1.2 2000/08/26 00:09:29 bcr Exp $

Alphabetic index Hierarchy of classes