AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2003.03.26 12:02 "LZW and 4bit tiffs", by Carter John-jcarte01
2003.03.26 23:30 "Re: LZW and 4bit tiffs", by Michael Still
2003.03.27 16:38 "RE: LZW and 4bit tiffs", by Carter John-jcarte01
2003.04.04 10:50 "RE: 8bit to 12bit", by Carter John-jcarte01
2003.04.03 13:03 "8bit to 12bit", by NTC Alpha
2003.04.04 10:33 "Re: 8bit to 12bit", by Michael Still

2003.03.26 12:02 "LZW and 4bit tiffs", by Carter John-jcarte01

Hi

I'm having great fun here trying to write a LZW decompression function.

I've pretty much stuck to the description given in section 13 of the tiff spec (v6) it goes more or less like so

  1. read in a compressed strip
  2. extract codes until EOI (257 dec) (keeping track of bit boundaries etc) the codes I'm getting out seem ok

I have 2 questions

  1. should the code you extract be in the table or at least if not in the table the index to where the next new string will be added,
  2. if statement 1 is false should the new string be written to location table[code] or should it be written to the first available free space in the table.

the reason i ask is that with the following sequence of code extractions and table additions i end up adding two strings of length 0 together ( malloc complains about this ).

thanks jc

code result
256 init table
153
258
259
260
261
262
87
173
203
247
251
268
269
270
383?
253 both strings = 0 length
265
272
275
240
274
276
113
265
274
280
276
250
283
277
399?
286 both strings = 0 length
271
277
289
269
111
257 EOI code

____________________________

John Carter
BSS O&M Development group,
Motorola,
Mahon Industrial Estate,
Cork.

Tel:         +353 21 4807 637 (direct)
Fax:         +353 21 4357635  ( reception )

Mobile: +353 86 3947920
Email <mailto:john.a.carter@motorola.com> www <http://www.cork.cig.mot.com/~jcarte01/> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Homer: There's 3 ways to do things, the right way, the wrong way, and the max power way.
Bart: isn't that the wrong way.
Homer: yea but faster.