Lines Matching defs:code

302 /* number of length codes, not counting the special END_BLOCK code */
308 /* number of Literal or Length codes, including the END_BLOCK code */
328 /* Data structure describing a single value and its code string. */
332 ush code; /* bit string */
341 #define Code fc.code
349 int max_code; /* largest code with non zero frequency */
524 * compressible code followed by a highly compressible
536 * Buffer for distances. To simplify the code, d_buf and l_buf
544 int last_eob_len; /* bit length of EOB code for last block */
579 * In order to simplify the code, particularly on 16 bit machines,
596 * Mapping from a distance to a distance code. dist is the distance - 1 and
722 void match_init OF((void)); /* asm code initialization */
781 * Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
1432 match_init(); /* initialize the asm code */
1449 * match.asm or match.S. The code will be functionally equivalent.
1467 * Stop when cur_match becomes <= limit. To simplify the code,
1488 * The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2
1517 * This code assumes sizeof (unsigned short) == 2. Do
1545 /* The funny "do {}" generates better code on most compilers */
1628 * The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2
1982 * To simplify the code, we prevent matches
2109 * To simplify the code, we prevent matches
2222 * Each code tree is stored in a compressed form which is itself
2223 * a Huffman encoding of the lengths of all the code strings (in
2224 * ascending order by source values). The actual code strings are
2259 /* end of block literal code */
2270 /* extra bits for each length code */
2275 /* extra bits for each distance code */
2280 /* extra bits for each bit length code */
2327 /* length code for each normalized match length (0 == MIN_MATCH) */
2330 /* First normalized length for each code (0 = MIN_MATCH) */
2333 /* First normalized distance for each code (0 = distance of 1) */
2337 const intf *extra_bits; /* extra bits for each code or NULL */
2379 /* Send a code of the given tree. c and tree must not have side effects */
2464 int code; /* code value */
2479 /* Initialize the mapping length (0..255) -> length code (0..28) */
2481 for (code = 0; code < LENGTH_CODES-1; code++) {
2482 base_length[code] = length;
2483 for (n = 0; n < (1<<extra_lbits[code]); n++) {
2484 _length_code[length++] = (uch)code;
2490 * represented in two different ways: code 284 + 5 bits or
2491 * code 285, so we overwrite _length_code[255] to use the best
2494 _length_code[length-1] = (uch)code;
2496 /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
2498 for (code = 0; code < 16; code++) {
2499 base_dist[code] = dist;
2500 for (n = 0; n < (1<<extra_dbits[code]); n++) {
2501 _dist_code[dist++] = (uch)code;
2506 for (; code < D_CODES; code++) {
2507 base_dist[code] = dist << 7;
2508 for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
2509 _dist_code[256 + dist++] = (uch)code;
2523 * tree construction to get a canonical Huffman tree (longest code
2733 Trace((stderr, "code %d bits %d->%d\n", m,
2750 * OUT assertion: the field code is set for all tree elements of non
2751 * zero code length.
2756 int max_code; /* largest code with non zero frequency */
2759 /* next code value for each bit length */
2761 ush code = 0; /* running code value */
2763 int n; /* code index */
2766 * The distribution counts are first used to generate the code
2770 next_code[bits] = code = (code + bl_count[bits-1]) << 1;
2774 * last code must be all ones.
2776 Assert(code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
2795 * Construct one Huffman tree and assigns the code bit strings and lengths.
2798 * OUT assertions: the fields len and code are set to the optimal bit length
2799 * and corresponding code. The length opt_len is updated; static_len is
2811 int max_code = -1; /* largest code with non zero frequency */
2831 * The pkzip format requires that at least one distance code
2833 * there is only one possible code. So to avoid special checks
2903 int max_code; /* and its largest code of non zero frequency */
2907 int curlen; /* length of current code */
2908 int nextlen = tree[0].Len; /* length of next code */
2909 int count = 0; /* repeat count of the current code */
2950 int max_code; /* and its largest code of non zero frequency */
2954 int curlen; /* length of current code */
2955 int nextlen = tree[0].Len; /* length of next code */
2956 int count = 0; /* repeat count of the current code */
3001 * bl_order of the last bit length code to send.
3007 /* index of last bit length code of non zero freq */
3063 Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
3102 * Send just the `stored block' type code without any length bytes or data.
3119 * The current inflate code requires 9 bits of lookahead. If the
3120 * last two codes for the previous block (real code plus EOB) were coded
3122 * the last real code. In this case we send two empty static blocks instead
3124 * To simplify the code, we assume the worst case of last real code encoded
3137 * (10 - bi_valid) bits. The lookahead for the last real code
3164 /* index of last bit length code of non zero freq */
3190 * length code to send.
3367 unsigned code; /* the code to send */
3379 code = _length_code[lc];
3380 /* send the length code */
3381 send_code(s, code+LITERALS+1, ltree);
3382 extra = extra_lbits[code];
3384 lc -= base_length[code];
3390 code = d_code(dist);
3391 Assert(code < D_CODES, "bad d_code");
3393 /* send the distance code */
3394 send_code(s, code, dtree);
3395 extra = extra_dbits[code];
3397 dist -= base_dist[code];
3439 * Reverse the first len bits of a code, using straightforward code (a faster
3444 bi_reverse(code, len)
3445 unsigned code; /* the value to invert */
3450 res |= code & 1;
3451 code >>= 1, res <<= 1;
3560 int)); /* initial return code */
4045 * Huffman code lookup table entry--this entry is four bytes for
4056 /* number of bits in this code or subcode */
4075 uIntf *, /* 19 code lengths */
4084 uIntf *, /* that many (total) code lengths */
4245 local const uInt border[] = { /* Order of the bit length code lengths */
4256 * 4. If only one code exists, then it is encoded using one bit. (Zero
4263 * zero distance codes, which is sent as one code of zero bits in
4272 * 7. Unzip can check dynamic Huffman blocks for complete code sets.
4273 * The exception is that a single code would not be complete (see #4).
4283 * 12. Note: length code 284 can represent 227-258, but length code 285
4284 * really is 258. The last length deserves its own, short code
4287 * 13. The literal/length and distance code bit lengths are read as a
4289 * a repeat code (16, 17, or 18) to go across the boundary between
4764 uIntf *, /* code lengths in bits */
4794 * Huffman code decoding is performed using a multi-level table
4796 * table whose size is determined by the longest code. However, the
4812 * code length in bits is used, or when the shortest code is *longer*
4814 * shortest code in bits is used.
4816 * There are two different values for the two tables, since they code
4818 * codes 286 possible values, or in a flat code, a little over eight
4828 #define BMAX 15 /* maximum bit length of any code */
4833 uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
4844 * Given a list of code lengths and a maximum table size, make a set
4846 * Z_BUF_ERROR if the given code set is incomplete (the tables are
4856 int g; /* maximum code length */
4858 register uInt i; /* counter, current code */
4860 register int k; /* number of bits in current code */
4868 uInt x[BMAX+1]; /* bit offsets, then code stack */
4897 k = j; /* minimum code length */
4903 g = i; /* maximum code length */
4936 x[0] = i = 0; /* first Huffman code is zero */
4944 /* go through the bit lengths (k already is bits in shortest code) */
4949 * here i is the Huffman code of length k bits
5024 /* out of values--invalid code */
5030 /* simple code is just the value */
5040 /* fill code-like entries with r */
5045 /* backwards increment the k-bit code i */
5069 uIntf *c; /* 19 code lengths */
5096 uIntf *c; /* that many (total) code lengths */
5286 } code; /* if LEN or DIST, where in tree */
5367 c->sub.code.need = c->lbits;
5368 c->sub.code.tree = c->ltree;
5372 j = c->sub.code.need;
5374 t = c->sub.code.tree +
5395 c->sub.code.need = e;
5396 c->sub.code.tree = t + t->base;
5405 c->mode = BADCODE; /* invalid code */
5406 z->msg = "invalid literal/length code";
5414 c->sub.code.need = c->dbits;
5415 c->sub.code.tree = c->dtree;
5421 j = c->sub.code.need;
5423 t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
5433 c->sub.code.need = e;
5434 c->sub.code.tree = t + t->base;
5437 c->mode = BADCODE; /* invalid code */
5438 z->msg = "invalid distance code";
5679 /* get literal/length code */
5680 /* max bits for literal/length code */
5702 GRABBITS(15); /* max bits for distance code */
5770 "invalid distance code";
5803 z->msg = "invalid literal/length code";