= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Set Partitioning Embedded Block Coder (SPECK) 2-D lossy version 1.0 for grayscale images August 6, 2001 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Copyright (c) 1999 and 2001 by Asad Islam and William A. Pearlman All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The methods therein are protected by US Patent Nos. 6671413 and 6,965,700. The programs may not be sold for profit nor may they be incorporated in commercial programs without seeking a license from PrimaComp. Please contact William A. Pearlman, wpearlman@spiht.com for licensing information. Permission to use is granted for internal use only and only for purposes of research. This program is provided as is, without any express or implied warranty, without even the warranty of fitness for a particular purpose. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - USAGE ===== Contained in the archive are four Windows/DOS executable programs: spk_enc.exe (encoder) spk_dec.exe (decoder) spk_ls_enc.exe (encoder with lossless capability) spk_ls_dec.exe (decoder with progressive lossy to lossless capability); and the file: cygwin1.dll; cygwin1.dll must reside in the same directory/folder as the above executables, when running at the Win/DOS prompt. If you use Cygwin, this file is already embedded, so you do not need it. And the Instructions file (this file): speck_usage.txt ‘speck_usage.txt’ replaces ‘codetree.doc’ displayed in the window dialogue after running a program. The spk_enc.exe and spk_dec.exe are the matching encoder-decoder pair. The spk_ls_enc.exe and spk_ls_dec.exe are the matching encoder-decoder pair. When in doubt about the command-line options and parameters, run program with the option '-u' after the program name. The original images should be monochrome (1 byte/pixel) in raster format, but WITHOUT the header (also called RAW format). It is assumed that the image is stored as a sequence of horizontal lines. The smoothing option may be selected for high dynamic range images with non-essential detail. The user is asked for a number in the range 0-7, with 0 representing no smoothing, and 7 the maximum. The best value depends on the image and on the user's taste. The decoder can be used to recover the image up to any bit/pixel rate equal to or below the rate used by the encoder. It can be used interactively to compare the recovered image to the original or to save it. The decoder can also be used in a 'batch mode' to evaluate a curve of rate x PSNR of the algorithm, for a given image. In this case the results are written to a text file. The encoder/decoder pair spk_ls_enc.exe/spk_ls_dec.exe can produce mathematically lossless image reconstructions by choosing "0" as the rate in the encoder and decoder. You can check whether the original and reconstructed images are identical via the command line programs 'fc /b' in Win/DOS or 'diff' in Cygwin or Linux. For example: > fc /b original.raw reconstruction.raw // Win/DOS or > diff original.raw reconstruction.raw // Cygwin or Linux EXAMPLES ======== (1) Here is an example of the usage of the program 'spk_enc'. The messages before the symbol '=?' were output by the program, and what is after that symbol was written by the user. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . spk_enc * Please read the file `codetree.doc' for usage instructions and Copyright/Patent information. // replace 'codetree.doc' with 'speck_usage.txt' * Use `spk_enc -u' for command-line usage information File with original image =? bike.raw File with compressed image =? bike_r150.spk Number of image lines =? 2560 Number of pixels per line =? 2048 Number of bytes per pixel =? 1 Rate (bits per pixel) =? 1.50 Use smoothing? (y/n) -> n Image read in 0.029000 seconds. Image transformed in 0.121000 seconds. Starting image compression... Image compressed in 0.729000 seconds. Compressed file size = 983039 bytes ( 1.500 bits/pixel). Total execution time (I/O included) = 0.894000 seconds. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Command line usage may be obtained by typing ‘spk_enc –u’ at the prompt as shown below: C:\Files\codecs\SPECK>spk_enc -u * Usage: spk_enc image_file coded_file number_lines pixels/line bytes/pixel bpp_rate [smoothing] The parameters in Example (1) could be entered at the command line: C:\Files\codecs\SPECK> spk_enc bike.raw bike_r150.spk 2048 2560 1 1.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (3) Below it is shown how the decoder is used interactively. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C:\Files\codecs\SPECK\spk_dec * Please read the file `codetree.doc' for instructions and Copyright/Patent information. * Use `spk_dec -u' for command-line usage information Interactive mode? (y/n) -> y Name of the compressed image file =? bike_r150.spk Recovered image will be compared to original? (y/n) -> y File with original image =? \Files\Images\bike.raw Image size = 2560 x 2048, 1 byte(s)/pixel Code rate (bits/pixel) =? 1.0 Starting image recovery... Image recovered in 0.377000 seconds. Rate = 1.000 bits/pixel --> mean squared-error = 12.013 = 37.33 dB PSNR Total execution time (I/O included) = 0.516000 seconds. Save new image to disk? (y/n) -> y Name of the new image file =? bike_r100.raw Test new rate? (y/n) -> y Image size = 2560 x 2048, 1 byte(s)/pixel Code rate (bits/pixel) =? 0.50 Starting image recovery... C:\Files\codecs\SPECK> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Note that the decoder rate is less than the encoder rate. When asked for a new rate, you can continue to decode the encoder file at any rate equal to or less than the encoder rate. Note in interactive mode, you can choose PSNR calculation, saving the decoded image, or both. - - - - - - - - - - - - - - - - - - - - - - - - - - - -the prompt: - - - - - - - (3) The decoder can also be activated at the command line. Below is the shown usage information by typing ‘spk_dec –u’ at C:\Files\codecs\SPECK>spk_dec -u * Usage to compare the recovered image with the original: spk_dec coded_file original_image bpp_rate * Usage to save the recovered image: spk_dec -s coded_file new_image_file bpp_rate ------------------------ (a) Example of saving the decoded image: C:\Files\codecs\SPECK>spk_dec -s bike_r150.spk bike_r075.raw 0.75 * Please read the file `codetree.doc' for instructions and Copyright/Patent information. * Use `spk_dec -u' for command-line usage information Image size = 2560 x 2048, 1 byte(s)/pixel Starting image recovery... Image recovered in 0.292000 seconds. Total execution time (I/O included) = 0.434000 seconds. - - - - - - - - - - - - - -- - - - - - - - - (b) Example of PSNR calculation: C:\Files\codecs\SPECK>spk_dec bike_r150.spk \Files\Images\bike_iv.raw 0.75 * Please read the file `codetree.doc' for instructions and Copyright/Patent information. * Use `spk_dec -u' for command-line usage information Image size = 2560 x 2048, 1 byte(s)/pixel Starting image recovery... Image recovered in 0.291000 seconds. Rate = 0.750 bits/pixel --> mean squared-error = 18.872 = 35.37 dB PSNR Total execution time (I/O included) = 0.431000 seconds.