Lines Matching defs:code

156 /* number of length codes, not counting the special END_BLOCK code */
162 /* number of Literal or Length codes, including the END_BLOCK code */
183 /* Data structure describing a single value and its code string. */
187 ush code; /* bit string */
196 #define Code fc.code
204 int max_code; /* largest code with non zero frequency */
350 * example a binary file with poorly compressible code followed by
360 /* Buffer for distances. To simplify the code, d_buf and l_buf have
369 int last_eob_len; /* bit length of EOB code for last block */
403 /* In order to simplify the code, particularly on 16 bit machines, match
518 /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
539 void match_init OF((void)); /* asm code initialization */
923 match_init(); /* initialize the asm code */
937 * match.S. The code will be functionally equivalent.
950 /* Stop when cur_match becomes <= limit. To simplify the code,
969 /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
988 /* This code assumes sizeof(unsigned short) == 2. Do not use
1011 /* The funny "do {}" generates better code on most compilers */
1259 /* To simplify the code, we prevent matches with the string
1357 /* To simplify the code, we prevent matches with the string
1451 * Each code tree is stored in a compressed form which is itself
1452 * a Huffman encoding of the lengths of all the code strings (in
1453 * ascending order by source values). The actual code strings are
1485 /* end of block literal code */
1496 local int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
1499 local int extra_dbits[D_CODES] /* extra bits for each distance code */
1502 local int extra_blbits[BL_CODES]/* extra bits for each bit length code */
1540 /* length code for each normalized match length (0 == MIN_MATCH) */
1543 /* First normalized length for each code (0 = MIN_MATCH) */
1546 /* First normalized distance for each code (0 = distance of 1) */
1550 intf *extra_bits; /* extra bits for each code or NULL */
1591 /* Send a code of the given tree. c and tree must not have side effects */
1601 /* Mapping from a distance to a distance code. dist is the distance - 1 and
1675 int code; /* code value */
1680 /* Initialize the mapping length (0..255) -> length code (0..28) */
1682 for (code = 0; code < LENGTH_CODES-1; code++) {
1683 base_length[code] = length;
1684 for (n = 0; n < (1<<extra_lbits[code]); n++) {
1685 length_code[length++] = (uch)code;
1690 * in two different ways: code 284 + 5 bits or code 285, so we
1693 length_code[length-1] = (uch)code;
1695 /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
1697 for (code = 0 ; code < 16; code++) {
1698 base_dist[code] = dist;
1699 for (n = 0; n < (1<<extra_dbits[code]); n++) {
1700 dist_code[dist++] = (uch)code;
1705 for ( ; code < D_CODES; code++) {
1706 base_dist[code] = dist << 7;
1707 for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
1708 dist_code[256 + dist++] = (uch)code;
1721 * tree construction to get a canonical Huffman tree (longest code
1917 Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
1932 * OUT assertion: the field code is set for all tree elements of non
1933 * zero code length.
1937 int max_code; /* largest code with non zero frequency */
1940 ush next_code[MAX_BITS+1]; /* next code value for each bit length */
1941 ush code = 0; /* running code value */
1943 int n; /* code index */
1945 /* The distribution counts are first used to generate the code values
1949 next_code[bits] = code = (code + bl_count[bits-1]) << 1;
1951 /* Check that the bit counts in bl_count are consistent. The last code
1954 Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
1970 * Construct one Huffman tree and assigns the code bit strings and lengths.
1973 * OUT assertions: the fields len and code are set to the optimal bit length
1974 * and corresponding code. The length opt_len is updated; static_len is
1985 int max_code = -1; /* largest code with non zero frequency */
2003 /* The pkzip format requires that at least one distance code exists,
2005 * possible code. So to avoid special checks later on we force at least
2067 int max_code; /* and its largest code of non zero frequency */
2071 int curlen; /* length of current code */
2072 int nextlen = tree[0].Len; /* length of next code */
2073 int count = 0; /* repeat count of the current code */
2112 int max_code; /* and its largest code of non zero frequency */
2116 int curlen; /* length of current code */
2117 int nextlen = tree[0].Len; /* length of next code */
2118 int count = 0; /* repeat count of the current code */
2158 * bl_order of the last bit length code to send.
2163 int max_blindex; /* index of last bit length code of non zero freq */
2209 Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
2237 /* Send just the `stored block' type code without any length bytes or data.
2251 * The current inflate code requires 9 bits of lookahead. If the EOB
2252 * code for the previous block was coded on 5 bits or less, inflate
2288 int max_blindex; /* index of last bit length code of non zero freq */
2309 * in bl_order of the last bit length code to send.
2459 unsigned code; /* the code to send */
2470 code = length_code[lc];
2471 send_code(s, code+LITERALS+1, ltree); /* send the length code */
2472 extra = extra_lbits[code];
2474 lc -= base_length[code];
2478 code = d_code(dist);
2479 Assert (code < D_CODES, "bad d_code");
2481 send_code(s, code, dtree); /* send the distance code */
2482 extra = extra_dbits[code];
2484 dist -= base_dist[code];
2517 * Reverse the first len bits of a code, using straightforward code (a faster
2521 local unsigned bi_reverse(code, len)
2522 unsigned code; /* the value to invert */
2527 res |= code & 1;
2528 code >>= 1, res <<= 1;
2619 int)); /* initial return code */
2649 /* Huffman code lookup table entry--this entry is four bytes for machines
2658 Byte Bits; /* number of bits in this code or subcode */
2674 uIntf *, /* 19 code lengths */
2682 uIntf *, /* that many (total) code lengths */
3159 local uInt border[] = { /* Order of the bit length code lengths */
3170 4. If only one code exists, then it is encoded using one bit. (Zero
3177 zero distance codes, which is sent as one code of zero bits in
3186 7. Unzip can check dynamic Huffman blocks for complete code sets.
3187 The exception is that a single code would not be complete (see #4).
3197 12. Note: length code 284 can represent 227-258, but length code 285
3198 really is 258. The last length deserves its own, short code
3201 13. The literal/length and distance code bit lengths are read as a
3203 a repeat code (16, 17, or 18) to go across the boundary between
3614 uIntf *, /* code lengths in bits */
3651 Huffman code decoding is performed using a multi-level table lookup.
3653 size is determined by the longest code. However, the time it takes
3667 codes are shorter than that, in which case the longest code length in
3668 bits is used, or when the shortest code is *longer* than the requested
3669 table size, in which case the length of the shortest code in bits is
3672 There are two different values for the two tables, since they code a
3674 codes 286 possible values, or in a flat code, a little over eight
3684 #define BMAX 15 /* maximum bit length of any code */
3692 uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
3700 /* Given a list of code lengths and a maximum table size, make a set of
3702 if the given code set is incomplete (the tables are still built in this
3710 int g; /* maximum code length */
3712 register uInt i; /* counter, current code */
3714 register int k; /* number of bits in current code */
3722 uInt x[BMAX+1]; /* bit offsets, then code stack */
3751 k = j; /* minimum code length */
3757 g = i; /* maximum code length */
3789 x[0] = i = 0; /* first Huffman code is zero */
3797 /* go through the bit lengths (k already is bits in shortest code) */
3803 /* here i is the Huffman code of length k bits for value *p */
3857 r.exop = 128 + 64; /* out of values--invalid code */
3861 r.base = *p++; /* simple code is just the value */
3869 /* fill code-like entries with r */
3874 /* backwards increment the k-bit code i */
3895 uIntf *c; /* 19 code lengths */
3918 uIntf *c; /* that many (total) code lengths */
4105 } code; /* if LEN or DIST, where in tree */
4180 c->sub.code.need = c->lbits;
4181 c->sub.code.tree = c->ltree;
4184 j = c->sub.code.need;
4186 t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
4207 c->sub.code.need = e;
4208 c->sub.code.tree = t->next;
4217 c->mode = BADCODE; /* invalid code */
4218 z->msg = "invalid literal/length code";
4226 c->sub.code.need = c->dbits;
4227 c->sub.code.tree = c->dtree;
4231 j = c->sub.code.need;
4233 t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
4245 c->sub.code.need = e;
4246 c->sub.code.tree = t->next;
4249 c->mode = BADCODE; /* invalid code */
4250 z->msg = "invalid distance code";
4438 /* get literal/length code */
4439 GRABBITS(20) /* max bits for literal/length code */
4461 GRABBITS(15); /* max bits for distance code */
4504 z->msg = "invalid distance code";
4534 z->msg = "invalid literal/length code";