Mercurial > libavcodec.hg
comparison lzwenc.c @ 4831:4a7e1f5cdc7a libavcodec
simplify
author | michael |
---|---|
date | Mon, 09 Apr 2007 22:18:09 +0000 |
parents | c68b9a261f79 |
children | 8a5cbe8e014e |
comparison
equal
deleted
inserted
replaced
4830:5a523aee7379 | 4831:4a7e1f5cdc7a |
---|---|
230 clearTable(s); | 230 clearTable(s); |
231 | 231 |
232 for (i = 0; i < insize; i++) { | 232 for (i = 0; i < insize; i++) { |
233 uint8_t c = *inbuf++; | 233 uint8_t c = *inbuf++; |
234 int code = findCode(s, c, code_prefix); | 234 int code = findCode(s, c, code_prefix); |
235 if (s->tab[code].hash_prefix != LZW_PREFIX_FREE) { | 235 if (s->tab[code].hash_prefix == LZW_PREFIX_FREE) { |
236 code_prefix = s->tab[code].code; | |
237 } else { | |
238 writeCode(s, code_prefix); | 236 writeCode(s, code_prefix); |
239 addCode(s, c, code_prefix, code); | 237 addCode(s, c, code_prefix, code); |
240 code_prefix = s->tab[hash(0, c)].code; | 238 code= hash(0, c); |
241 } | 239 } |
240 code_prefix = s->tab[code].code; | |
242 if (s->tabsize >= s->maxcode - 1) { | 241 if (s->tabsize >= s->maxcode - 1) { |
243 clearTable(s); | 242 clearTable(s); |
244 } | 243 } |
245 } | 244 } |
246 s->last_code = code_prefix; | 245 s->last_code = code_prefix; |