📄 sp_code.doc
字号:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - S + P I M A G E C O M P R E S S I O N P R O G R A M S - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - < ANSI C > version 4.03 - 05/30/95 Amir Said: amir@densis.fee.unicamp.br - said@ipl.rpi.edu DENSIS - Faculty of Electrical Enginnering UNICAMP - Campinas, SP, Brazil William A. Pearlman - pearlman@ecse.rpi.edu Dept. of Electrical, Computer, and Systems Engineering Rensselaer Polytechnic Institute - Troy, NY 12180, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Copyright (c) 1995 Amir Said & William A. Pearlmam These programs are Copyright (c) by Amir Said and William A. Pearlman. They may be freely redistributed in their entirety provided that this copyright notice is not removed. They may not be sold for profit or incorporated in commercial programs without the written permission of the copyright holders. Each program is provided as is, without any express or implied warranty, without even the warranty of fitness for a particular purpose. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -DESCRIPTION===========The programs "sp_compress", "sp_uncompress", "sp_pack", and "sp_unpack"contain implementations of lossless image compression algorithms whichuse the S+P transform , introduced in the paper, "Image Compression via Multiresolution Representation and Predictive Coding," by A. Said and W. A. Pearlman, in Visual Communications and Image Processing '93, Proc. SPIE 2094, pp. 664-674, Nov. 1993. These programs compress gray-scale images and decompress them to perfect recovery. The programs "sp_compress" and "sp_uncompress" use an arithmetic codeand yield the maximum compression. The programs "sp_pack" and "sp_unpack"use a Huffman code, and yield smaller compression but with a smallercompression/recovery time.The arithmetic code implementation is in the files "arithm.h" and"arithm.c", and is described in the file "arithm.doc". The Huffmancode is implemented and described in the files "huffman.h", "huffman.c",and "huffman.doc".Please send corrections, suggestions and bug reports to amir@densis.fee.unicamp.br.FILES=====The programs are divided in several files, which are shared by the differentversions. To be included by the compiler they should be in the same directory.The list of files is: - arithm.h - arithm.c - arithm.doc - compile.bat - huffman.h - huffman.c - huffman.doc - sp_code.c - sp_code.doc - sp_comm.c - sp_compress.c - sp_decd.c - sp_pack.c - sp_uncompress.c - sp_unpack.cCOMPILATION===========To compile these programs under UNIX, just type, at the propt compile.bat COMPwhere 'COMP' is the name of the desired ANSI C compiler name (e.g.COMP=gcc for GNU's C compiler, COMP=CC for Sun's, andCOMP=xlc for IBM's.USAGE=====The original images should be in raster format, but without the header(they are here called PIC image files).The Huffman compression program usage is (pel = pixel):sp_pack [-options] hor_pels [vert_pels] bytes/pel PIC_file compressed_fileThe valid options are: -s use for very smooth (usually medical) images -r rectangular image (default = square) -sr, -rs combination of the options aboveIt is assumed that the image is stored in a sequence of horizontal lineswith "hor_pels" pixels. If the image is square (default) then the parameter"[vert_pels]" with the number of lines should not be included.Most images use 1 byte/pixel (256 gray levels). Some medical imagesuse 2048 or more gray levels and are stored with 2 bytes/pixel. Imagesprocessed with FORTRAN programs, stored as short integers also use2 bytes/pixel. The most significant byte is read first.The command to recover the original image is:sp_unpack compressed_file PIC_fileSimilarly, the usage for arithmetic compression is:sp_compress [-options] [vert_pels] hor_pels bytes/pel PIC_file comp_filesp_uncompress compressed_file PIC_fileWhen called without arguments these programs show the usage message.EXAMPLES========sp_compress 512 1 lena.pic lena.spcsp_uncompress lena.spc lena.picsp_pack -s 512 2 brainscan.dat brainscan.sppsp_unpack brainscan.spp brainscan.datsp_pack -rs 1024 768 2 x_ray.pic x_ray.sppsp_unpack x_ray.spp new_x_ray.picREMARKS=======-> These programs were tested in several images and compiled with the GNU, SUN, IBM, Borland and Microsoft C compilers. Nevertheless, they may not work with compilers that have other conventions for bit shifts of negative integers. Before deleting the original image it is always better to code and decode the image, and then compare the recovered version with the original. This can be done with the DOS "fc" or the UNIX "cmp" commands. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -