
	Copyright (C) Wickerhauser Consulting.  All Rights Reserved.
	Contains information proprietary to Wickerhauser Consulting.


		      WSQ Encoding Algorithm: Encoder 2
		      =================================

** indicates a change from Encoder 1.

Open the input and output files
While there is input
	Determine the image size and any non-default parameters
	Test the input for WSQ compliance
	Re-allocate memory for input, transform, and output buffering
	Read the image pixels into the input/output buffer
	Convert to floating point values in the transform buffer

	Write an SOI marker to the output file
	Write a Comment with an input file identifier and a time stamp
	Write the DTT into the output file
	Write an SOF marker and the frame header parameters to the output file
	Perform the WSQ custom wavelet packet transform in place
	Determine the subband heights and widths
	Determine the variances of the ``middles'' of the subbands
	**If the variances in subbands 0,1,2,3 sum to less than 20000, then 
	  recompute all 64 subband variances using all their coefficients.**
	Choose an initial `quality' factor based on the desired compression
	LOOP:
	If any subbands have nonpositive bit allocations at this quality then
		Remove the nonpositively coded subbands
		Increase `quality' to take advantage of the extra bits 
		Go to LOOP
	Test the parameters for WSQ compliance
	Print the chosen parameters to the log file
	Write the DQT parameters
	Write the DHT parameters
	For all ECS blocks B
		Write the SOB header for block B, identifying its DHT
		Huffman-encode the WSQ symbols for block B using that DHT
		Write the entropy coded segment for block B
	Write an EOI marker segment
Close the input and output files


				Buffer Usage
				============

	Pixels in `bytes0[]'
		\
		wsqb2r()
		/
	Real Gray Values in `words0[]'
		\
		cbwp2()		-- transposition done in `words1[]'
		/
	Wavelet Coefficients in `words0[]'
		\
		wsqqnt()
		/
	Quantization Bin Indices in `words1[]'
		\
		wsqwsym()
		/
	WSQ symbols and literals in  `bytes0[]'
		\
		wsqwecs()
		/
	Entropy Coded Segments in `words0[]'



			   Input File Assumptions
			   ======================

Multiple files may be listed on the command line, but only one image may be
present in the input stream if this function is used as a filter.  Only one
interchange-format WSQ file will be produced, containing all the images.

**Input files may be raw pixel streams, with width and height supplied
  externally, or else PGM P5 format files with a short header.**


			       Usage Help Page
			       ===============

Usage:  WSQ [options] [-ooutfile] [-llogfile] infile1 [ ... ]

Options:                                    (default is shown in parentheses)

 -v | -v0 | -v1 | -v2 | v3 :  set verbosity level.                (-v0)
   -v0: compress and log only fatal errors;
   -v1: like 0, but also logs warning messages;
   -v2: like 1, but also mentions normal events.
   -v3: like 2, but also prints parameters (same as -v).

 -t | -tg | -trW,H  :  specify the input file image type.         (-tg)
   -tg    ==> PGM input, 8-bit P5 binary data (same as `-t').
   -trW,H ==> raw 8-bit grayscale input, width `W', height `H'.

 -c..text.. ==> Include `..text..' as a comment in the WSQ file.  (no comment)

 -SA,B ==> Use A (black) and B (white) for scanner calibrations.  (A=0, B=255)

 -Zr ==> Quantize to achieve a nominal r bits per pixel.          (r=0.75)

 -ooutfile ==> write output to the file `outfile.wsq'.            (stdout)

 -llogfile ==> log messages to `logfile.log'.                     (stderr)

 infile1 [...] ==> read input from these files in turn; use - to read stdin.
