Blame tools/c44.1

Packit df99a1
.\" Copyright (c) 2001-2003 Leon Bottou, Yann Le Cun, Patrick Haffner,
Packit df99a1
.\" Copyright (c) 2001 AT&T Corp., and Lizardtech, Inc.
Packit df99a1
.\"
Packit df99a1
.\" This is free documentation; you can redistribute it and/or
Packit df99a1
.\" modify it under the terms of the GNU General Public License as
Packit df99a1
.\" published by the Free Software Foundation; either version 2 of
Packit df99a1
.\" the License, or (at your option) any later version.
Packit df99a1
.\"
Packit df99a1
.\" The GNU General Public License's references to "object code"
Packit df99a1
.\" and "executables" are to be interpreted as the output of any
Packit df99a1
.\" document formatting or typesetting system, including
Packit df99a1
.\" intermediate and printed output.
Packit df99a1
.\"
Packit df99a1
.\" This manual is distributed in the hope that it will be useful,
Packit df99a1
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit df99a1
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit df99a1
.\" GNU General Public License for more details.
Packit df99a1
.\"
Packit df99a1
.\" You should have received a copy of the GNU General Public
Packit df99a1
.\" License along with this manual. Otherwise check the web site
Packit df99a1
.\" of the Free Software Foundation at http://www.fsf.org.
Packit df99a1
.TH C44 1 "10/11/2001" "DjVuLibre-3.5" "DjVuLibre-3.5"
Packit df99a1
.SH NAME
Packit df99a1
c44 \- DjVuPhoto encode.
Packit df99a1
.
Packit df99a1
.SH SYNOPSIS
Packit df99a1
.BI "c44 [" "options" "] " "inputfilename" " [" "outputfilename" "]"
Packit df99a1
.
Packit df99a1
.SH DESCRIPTION
Packit df99a1
Produces a DjVuPhoto encoded image.
Packit df99a1
The input image file 
Packit df99a1
.I inputfilename
Packit df99a1
can be either a portable gray-map (\c
Packit df99a1
.SM PGM\c
Packit df99a1
) or a portable pix-map (\c
Packit df99a1
.SM PPM\c
Packit df99a1
).
Packit df99a1
Input images compressed with
Packit df99a1
.SM JPEG
Packit df99a1
are also accepted. It is however suggested to only use 
Packit df99a1
high quality 
Packit df99a1
.SM JPEG
Packit df99a1
files (low compression ratio, large size)
Packit df99a1
because the wavelet compression will increase the defects
Packit df99a1
already present in highly compressed
Packit df99a1
.SM JPEG
Packit df99a1
files.
Packit df99a1
.P
Packit df99a1
The program produces a DjVuPhoto file
Packit df99a1
.IR outputfilename .
Packit df99a1
If the output file name is not specified,
Packit df99a1
a default file name will be generated by replacing
Packit df99a1
the input file name suffix by suffix 
Packit df99a1
.IR djvu .
Packit df99a1
.P
Packit df99a1
The main design objective for the DjVu wavelets consisted of allowing
Packit df99a1
progressive rendering and smooth scrolling of large images with limited memory
Packit df99a1
requirements.  Decoding functions process the compressed data and update a
Packit df99a1
memory efficient representation of the wavelet coefficients.  Imaging function
Packit df99a1
then can quickly render an arbitrary segment of the image using the available
Packit df99a1
data.  Both process can be carried out in two threads of execution.  This
Packit df99a1
design plays an important role in the DjVu system.  We investigated various
Packit df99a1
state-of-the-art wavelet compression schemes.  Although these schemes may
Packit df99a1
achieve slightly smaller file sizes, the decoding functions did not even
Packit df99a1
approach our requirements.  The
Packit df99a1
.SM IW44
Packit df99a1
wavelets reach these requirements today and may in the future implement more
Packit df99a1
modern refinements if these refinements can be implemented within our
Packit df99a1
constraints.
Packit df99a1
.
Packit df99a1
.SH QUALITY SELECTION OPTIONS
Packit df99a1
.
Packit df99a1
DjVuPhoto files are logically composed of a sequence of "slices" containing
Packit df99a1
successive image refinements.  Slices are grouped in "chunks" defining the
Packit df99a1
progressive rendering sequence.  The viewer is able to display an intermediate
Packit df99a1
image after processing each chunk.  A typical DjVuPhoto files contains 80 to
Packit df99a1
120 slices grouped into 1 to 4 chunks.
Packit df99a1
.P
Packit df99a1
The quality selection options provide various ways to specify the number of
Packit df99a1
chunks and the number of slices per chunk.  The 
Packit df99a1
.B c44
Packit df99a1
program adds slices to the current chunk until exceeding a target
Packit df99a1
number of slices, a target file size, or a target quality specification.
Packit df99a1
The following options define targets for each chunk.  The option 
Packit df99a1
argument contain several numerical values (one per chunk) separated
Packit df99a1
by either commas or pluses.
Packit df99a1
.
Packit df99a1
.TP
Packit df99a1
.BI "-slice " "n" "+...+" "n"
Packit df99a1
Specify the number of slices in each chunk.
Packit df99a1
The option argument contains plus-separated numerical values (one per chunk)
Packit df99a1
indicating the number of slices per chunk.  Option 
Packit df99a1
.BR "-slice 74+13+10" ,
Packit df99a1
for instance, would be appropriate for compressing a photographic image
Packit df99a1
with three progressive refinements.  More quality and more refinements
Packit df99a1
can be obtained with option
Packit df99a1
.BR "-slice 72+11+10+10" .
Packit df99a1
.TP
Packit df99a1
.BI "-slice " "n" ",...," "n"
Packit df99a1
Specify the cumulative number of slices for each chunk.
Packit df99a1
Since the final quality is determined by the total number of slices,
Packit df99a1
it is often more convenient to use comma-separated values (one per chunk)
Packit df99a1
indicating the cumulative number of slices for each chunk (i.e.\& including
Packit df99a1
those encoded in all previous chunks).  The values suggested above
Packit df99a1
can also be expressed as
Packit df99a1
.B "-slice 74,87,97"
Packit df99a1
and
Packit df99a1
.BR "-slice 72,83,93,103".
Packit df99a1
.TP
Packit df99a1
.BI "-size " "n" ",...," "n"
Packit df99a1
Specify size targets for each chunk expressed in bytes.
Packit df99a1
The option argument can be either a plus-separated list specifying a size
Packit df99a1
for each chunk, or a comma separated list specifying cumulative sizes
Packit df99a1
for each chunk and all previous chunks.  Size targets are approximates.
Packit df99a1
Slices will be added to each chunk until exceeding the specified target.
Packit df99a1
.TP
Packit df99a1
.BI "-bpp " "n" ",...," "n"
Packit df99a1
Specify size targets for each chunk expressed in bits-per-pixel.
Packit df99a1
Both comma-separated and plus-separated specifications are accepted.
Packit df99a1
Option 
Packit df99a1
.B -bpp 0.25,0.5,1
Packit df99a1
usually provides good results.
Packit df99a1
.TP
Packit df99a1
.BI "-percent " "n" ",...," "n"
Packit df99a1
Specify size targets for each chunk expressed as a percentage of the
Packit df99a1
input file size.  Both comma-separated and plus-separated specifications
Packit df99a1
are accepted.  Results can be drastically different according to the
Packit df99a1
format of the input image (raw or 
Packit df99a1
.SM JPEG
Packit df99a1
compressed).
Packit df99a1
.TP
Packit df99a1
.BI "-decibel " "n" ",...," "n"
Packit df99a1
Specify quality targets for each chunk expressed as a comma-separated list of
Packit df99a1
increasing decibel values.  Decibel values range from 16 (very low quality) to
Packit df99a1
48 (very high quality).  This criterion should not be relied upon when
Packit df99a1
re-encoding an image previously compressed by another compression scheme.
Packit df99a1
Selecting this option significantly increases the compression time.
Packit df99a1
.TP
Packit df99a1
.BI "-dbfrac " "frac"
Packit df99a1
Indicate that the decibel values specified in option
Packit df99a1
.B -decibel
Packit df99a1
should be computed by averaging the mean squared errors of only the fraction
Packit df99a1
.I frac
Packit df99a1
of the most mis-represented blocks of 32 x 32 pixels.  This option is useful
Packit df99a1
with composite images containing solid color features (e.g.\& an image with a
Packit df99a1
large white border).
Packit df99a1
.PP
Packit df99a1
Providing no quality specification options automatically selects a default
Packit df99a1
quality specification
Packit df99a1
.BR "-slice 74,89,99" .
Packit df99a1
Multiple quality specification options are allowed.  The program outputs a
Packit df99a1
file whose total number of chunks is the largest number of chunks of all
Packit df99a1
quality specifications.  Slices are added to each chunk until reaching any of
Packit df99a1
the quality target for this chunk.
Packit df99a1
.
Packit df99a1
.SH OTHER OPTIONS
Packit df99a1
The following additional options are supported:
Packit df99a1
.TP
Packit df99a1
.BI "-dpi " n
Packit df99a1
Specify the resolution information encoded into the output file expressed in
Packit df99a1
dots per inch. The resolution information encoded in DjVu files determine how
Packit df99a1
the decoder scales the image on a particular display.  Meaningful resolutions
Packit df99a1
range from 25 to 1200.  The default value, 100 dpi, should be suitable for
Packit df99a1
most photographic images.
Packit df99a1
.TP
Packit df99a1
.BI "-gamma " n
Packit df99a1
Specify the gamma correction information encoded into the output file.
Packit df99a1
The argument 
Packit df99a1
.I n
Packit df99a1
specified the gamma value of the device for which the input image was
Packit df99a1
designed. The default value is 2.2.  This is appropriate for images 
Packit df99a1
designed for a standard computer monitor.
Packit df99a1
.TP
Packit df99a1
.BI "-mask " pbmfilename
Packit df99a1
The design of the 
Packit df99a1
.SM IW44
Packit df99a1
wavelets allows for compressing partially masked images.
Packit df99a1
This option can be used when certain pixels of a background
Packit df99a1
image are going to be covered by foreground objects like text or drawings.
Packit df99a1
File 
Packit df99a1
.I pbmfile 
Packit df99a1
must be a 
Packit df99a1
.SM PBM 
Packit df99a1
file whose size matches the size of the input file.  
Packit df99a1
Each black pixel in 
Packit df99a1
.I pbmfile 
Packit df99a1
means that the value of the corresponding pixel in the input file is
Packit df99a1
irrelevant.  The 
Packit df99a1
.SM IW44
Packit df99a1
encoder will replace the masked pixels by a color value whose coding 
Packit df99a1
cost is minimal (see 
Packit df99a1
.B http://www.djvuzone.org/djvu/techpapers/mask/index.djvu
Packit df99a1
for technical details.)
Packit df99a1
.TP
Packit df99a1
.BI "-crcbnormal "
Packit df99a1
Select normal chrominance encoding. 
Packit df99a1
Chrominance information is encoded at the same resolution as the luminance.
Packit df99a1
This is the default.
Packit df99a1
.TP
Packit df99a1
.BI "-crcbhalf "
Packit df99a1
Selects half resolution chrominance encoding.  Chrominance information is
Packit df99a1
encoded at half the luminance resolution.
Packit df99a1
.TP
Packit df99a1
.BI "-crcbdelay " n
Packit df99a1
This option can be used with 
Packit df99a1
.B -crcbnormal
Packit df99a1
and
Packit df99a1
.B -crcbhalf
Packit df99a1
to modify the quality of the chrominance information.
Packit df99a1
The option arguments specifies a parameter
Packit df99a1
.IR n ,
Packit df99a1
expressed in slices, that reduces the bit-rate associated with
Packit df99a1
the chrominance.  The default chrominance encoding delay is 
Packit df99a1
10 slices.
Packit df99a1
.TP
Packit df99a1
.BI "-crcbfull "
Packit df99a1
Select the highest possible quality for encoding the chrominance information. This
Packit df99a1
is equivalent to specifying 
Packit df99a1
.BR "-crcbnormal" " and " "-crcbdelay 0" .
Packit df99a1
.TP
Packit df99a1
.BI "-crcbnone "
Packit df99a1
Disable the encoding of the chrominance.  Only the luminance information will
Packit df99a1
be encoded. The resulting image will show in shades of gray.
Packit df99a1
.
Packit df99a1
.SH REMARKS
Packit df99a1
The default quality setting of the DjVuLibre version of
Packit df99a1
.B c44
Packit df99a1
has been increased.  
Packit df99a1
It produces larger files with a better quality.  
Packit df99a1
Quality can be lowered using the quality selection options!
Packit df99a1
.
Packit df99a1
.SH BUGS
Packit df99a1
The encoder requires more memory than necessary.
Packit df99a1
.br
Packit df99a1
The rechunking capability is currently broken.
Packit df99a1
.
Packit df99a1
.SH CREDITS
Packit df99a1
This program was written by L\('eon Bottou <leonb@users.sourceforge.net> and
Packit df99a1
was then improved by Andrei Erofeev <andrew_erofeev@yahoo.com>, Bill Riemers
Packit df99a1
<docbill@sourceforge.net> and many others.
Packit df99a1
.
Packit df99a1
.SH SEE ALSO
Packit df99a1
.BR djvu (1),
Packit df99a1
.BR pnm (5),
Packit df99a1
.BR cjpeg (1).