Home | History | Annotate | Download | only in puff

Lines Matching refs:symbol

65  *                      - Catch missing end-of-block symbol error
192 * symbol[] are the symbol values in canonical order, where the number of
198 short *symbol; /* canonically ordered symbols */
202 * Decode a code from the stream s using huffman table h. Return the symbol or
231 int index; /* index of first code of length len in symbol table */
237 if (code - count < first) /* if length len, return symbol */
238 return h->symbol[index + (code - first)];
259 int index; /* index of first code of length len in symbol table */
274 if (code - count < first) { /* if length len, return symbol */
277 return h->symbol[index + (code - first)];
305 * enough bits will resolve to a symbol. If the return value is positive, then
312 * one symbol, which is an error in a dynamic block.
321 * codes and any code with a single symbol which in deflate is coded as one
329 int symbol; /* current symbol when stepping through length[] */
332 short offs[MAXBITS+1]; /* offsets in symbol table for each length */
337 for (symbol = 0; symbol < n; symbol++)
338 (h->count[length[symbol]])++; /* assumes lengths are within bounds */
350 /* generate offsets into symbol table for each length for sorting */
356 * put symbols in table sorted by length, by symbol order within each
359 for (symbol = 0; symbol < n; symbol++)
360 if (length[symbol] != 0)
361 h->symbol[offs[length[symbol]]++] = symbol;
381 * symbols (257..285), and the end-of-block symbol (256).
385 * by just a length symbol. Lengths 11..257 are represented as a symbol and
387 * of the length symbol. The number of extra bits is determined by the base
388 * length symbol. These are in the static arrays below, lens[] for the base
391 * - The reason that 258 gets its own symbol is that the longest length is used
399 * to a base value represented by the symbol. The distances 1..4 get their
400 * own symbol, but the rest require extra bits. The base distances and
426 int symbol; /* decoded symbol */
446 symbol = decode(s, lencode);
447 if (symbol < 0) return symbol; /* invalid symbol */
448 if (symbol < 256) { /* literal: symbol is the byte */
452 s->out[s->outcnt] = symbol;
456 else if (symbol > 256) { /* length */
458 symbol -= 257;
459 if (symbol >= 29) return -10; /* invalid fixed code */
460 len = lens[symbol] + bits(s, lext[symbol]);
463 symbol = decode(s, distcode);
464 if (symbol < 0) return symbol; /* invalid symbol */
465 dist = dists[symbol] + bits(s, dext[symbol]);
486 } while (symbol != 256); /* end of block symbol */
501 * codes and distance codes are fixed. The specific lengths for each symbol
525 int symbol;
529 for (symbol = 0; symbol < 144; symbol++)
530 lengths[symbol] = 8;
531 for (; symbol < 256; symbol++)
532 lengths[symbol] = 9;
533 for (; symbol < 280; symbol++)
534 lengths[symbol] = 7;
535 for (; symbol < FIXLCODES; symbol++)
536 lengths[symbol] = 8;
540 for (symbol = 0; symbol < MAXDCODES; symbol++)
541 lengths[symbol] = 5;
546 lencode.symbol = lensym;
548 distcode.symbol = distsym;
570 * are simply a list of code lengths for each symbol.
576 * - If a symbol is not used in the block, this is represented by a zero as
578 * that no code should be created for this symbol. There is no way in the
585 * interesting consequence. Normally if only one symbol is used for a given
588 * only a single distance base symbol appears in a block, then it will be
591 * and should result in an error. So incomplete distance codes of one symbol
598 * literal/length codes of one symbol should also be permitted.
605 * the list of code lengths, a 0 symbol means no code, a 1..15 symbol means
614 * representing no code (0) or the code length for that symbol (1..7).
659 lencode.symbol = lensym;
661 distcode.symbol = distsym;
683 int symbol; /* decoded value */
686 symbol = decode(s, &lencode);
687 if (symbol < 16) /* length in 0..15 */
688 lengths[index++] = symbol;
691 if (symbol == 16) { /* repeat last length 3..6 times */
694 symbol = 3 + bits(s, 2);
696 else if (symbol == 17) /* repeat zero 3..10 times */
697 symbol = 3 + bits(s, 3);
699 symbol = 11 + bits(s, 7);
700 if (index + symbol > nlen + ndist)
702 while (symbol--) /* repeat last or zero symbol times */