Lines Matching refs:symbol

65  *                      - Catch missing end-of-block symbol error
202 * symbol[] are the symbol values in canonical order, where the number of
208 short *symbol; /* canonically ordered symbols */
212 * Decode a code from the stream s using huffman table h. Return the symbol or
241 int index; /* index of first code of length len in symbol table */
247 if (code - count < first) /* if length len, return symbol */
248 return h->symbol[index + (code - first)];
269 int index; /* index of first code of length len in symbol table */
284 if (code - count < first) { /* if length len, return symbol */
287 return h->symbol[index + (code - first)];
318 * enough bits will resolve to a symbol. If the return value is positive, then
325 * one symbol, which is an error in a dynamic block.
334 * codes and any code with a single symbol which in deflate is coded as one
342 int symbol; /* current symbol when stepping through length[] */
345 short offs[MAXBITS+1]; /* offsets in symbol table for each length */
350 for (symbol = 0; symbol < n; symbol++)
351 (h->count[length[symbol]])++; /* assumes lengths are within bounds */
364 /* generate offsets into symbol table for each length for sorting */
370 * put symbols in table sorted by length, by symbol order within each
373 for (symbol = 0; symbol < n; symbol++)
374 if (length[symbol] != 0)
375 h->symbol[offs[length[symbol]]++] = symbol;
395 * symbols (257..285), and the end-of-block symbol (256).
399 * by just a length symbol. Lengths 11..257 are represented as a symbol and
401 * of the length symbol. The number of extra bits is determined by the base
402 * length symbol. These are in the static arrays below, lens[] for the base
405 * - The reason that 258 gets its own symbol is that the longest length is used
413 * to a base value represented by the symbol. The distances 1..4 get their
414 * own symbol, but the rest require extra bits. The base distances and
440 int symbol; /* decoded symbol */
460 symbol = decode(s, lencode);
461 if (symbol < 0)
462 return symbol; /* invalid symbol */
463 if (symbol < 256) { /* literal: symbol is the byte */
468 s->out[s->outcnt] = symbol;
472 else if (symbol > 256) { /* length */
474 symbol -= 257;
475 if (symbol >= 29)
477 len = lens[symbol] + bits(s, lext[symbol]);
480 symbol = decode(s, distcode);
481 if (symbol < 0)
482 return symbol; /* invalid symbol */
483 dist = dists[symbol] + bits(s, dext[symbol]);
506 } while (symbol != 256); /* end of block symbol */
521 * codes and distance codes are fixed. The specific lengths for each symbol
545 int symbol;
550 lencode.symbol = lensym;
552 distcode.symbol = distsym;
555 for (symbol = 0; symbol < 144; symbol++)
556 lengths[symbol] = 8;
557 for (; symbol < 256; symbol++)
558 lengths[symbol] = 9;
559 for (; symbol < 280; symbol++)
560 lengths[symbol] = 7;
561 for (; symbol < FIXLCODES; symbol++)
562 lengths[symbol] = 8;
566 for (symbol = 0; symbol < MAXDCODES; symbol++)
567 lengths[symbol] = 5;
590 * are simply a list of code lengths for each symbol.
596 * - If a symbol is not used in the block, this is represented by a zero as
598 * that no code should be created for this symbol. There is no way in the
605 * interesting consequence. Normally if only one symbol is used for a given
608 * only a single distance base symbol appears in a block, then it will be
611 * and should result in an error. So incomplete distance codes of one symbol
618 * literal/length codes of one symbol should also be permitted.
625 * the list of code lengths, a 0 symbol means no code, a 1..15 symbol means
634 * representing no code (0) or the code length for that symbol (1..7).
679 lencode.symbol = lensym;
681 distcode.symbol = distsym;
704 int symbol; /* decoded value */
707 symbol = decode(s, &lencode);
708 if (symbol < 0)
709 return symbol; /* invalid symbol */
710 if (symbol < 16) /* length in 0..15 */
711 lengths[index++] = symbol;
714 if (symbol == 16) { /* repeat last length 3..6 times */
718 symbol = 3 + bits(s, 2);
720 else if (symbol == 17) /* repeat zero 3..10 times */
721 symbol = 3 + bits(s, 3);
723 symbol = 11 + bits(s, 7);
724 if (index + symbol > nlen + ndist)
726 while (symbol--) /* repeat last or zero symbol times */