
Thread
2003.03.27 16:38 "RE: LZW and 4bit tiffs", by Carter John-jcarte01
Hi
if your referring to the article by Mark Nelson, Oct 1989, I went with that code initially but found I couldn't alter it to suit the my needs.
my problem [with LZW anyway :-')] was my "get code function", in particular i found that when I'd make the code = to strip[byte_number] <<8 or <<16 that i get leading 1's my solution was to take a 3 step approach,
2) part2 = strip[byte_number];
part2 &= 000000FF; /* wipe leading 1's*/
part2 = part2<<(8+bit_count);
thanks jc
-----Original Message-----
I'm having great fun here trying to write a LZW decompression function.
There is one case in decompression (I think it was) where a code can be used which doesn't exist yet. Have you googled yet? There's a really good Dr Dobbs article from ages ago about this.
I use the following code for LZW decompression:
http://www.stillhq.com/extracted/pandaedit/lzw.cpp
http://www.stillhq.com/extracted/pandaedit/lzw.h(the rest of the code in that directory uses this if you need calling examples)
Note that it's in C++, but once you've ditched the use of STL templates for vectors etc that shouldn't be too bad. A couple of things to note:
- If you're in the US this is all covered by a Patent which hasn't yet expired (later this year it does)
- My code is covered by the GNU GPL
Michael Still (mikal@stillhq.com) | Stage 1: Steal underpants
http://www.stillhq.com | Stage 2: ????
UTC + 11 | Stage 3: Profit