Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!van-bc!jtc From: jtc@van-bc.wimsey.bc.ca (J.T. Conklin) Newsgroups: comp.misc Subject: Re: Compression algorithm wanted Message-ID: <798@van-bc.wimsey.bc.ca> Date: 5 Dec 90 16:08:14 GMT References: <774@van-bc.wimsey.bc.ca> Distribution: na Organization: UniFax Communications Inc., Vancouver, B.C., Canada Lines: 41 In article jjoshua@remus.rutgers.edu (J. Joshua) writes: >if it help you to know... i want to compress a byte stream as it goes >from a hard disk to a floppy disk. ie a backup program. this will >run on a macintosh and i would like to acheive a good compression >ratio without too much cost in time. > >now can you suggest an algorithm? I usually recommend against compressing backups, as it is almost impossible to recover anything if even a single bit is changed. For your application, it will be imporatant to design in error recovery. So you probably don't want to compress all of the files together in one stream, but rather compress each file individually. This way, a damaged archive will only effect the one file where the damage occurs. Storing files individually has the added advantage that each file can be compressed using a different encoding method, as no one method is approprate for every different file type. You might want to consider adding error detection and correction codes to the compressed data. This will expand the data a bit, but when combined with compression it should be a net gain. I'd start by supporting two compression methods: no compression at all, and LZW encoding. LZW is a good compression method, especially for text and uncompressed bilevel graphic images. You want a "no compression" compression methods for the files that exibit "negative compression". i.e. they get bigger when compressed. For a sample LZW implementation, look at the compress source code. It should be availiable on your machine, as compress is used by the news software to compress news batches. --jtc -- J.T. Conklin Toolsmith, Language Lawyer UniFax Communications Inc. ...!{uunet,ubc-cs}!van-bc!jtc, jtc@wimsey.bc.ca Brought to you by Super Global Mega Corp .com