Lines Matching defs:code

14  *      Each code tree is stored in a compressed form which is itself
15 * a Huffman encoding of the lengths of all the code strings (in
16 * ascending order by source values). The actual code strings are
50 /* end of block literal code */
61 local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
64 local const int extra_dbits[D_CODES] /* extra bits for each distance code */
67 local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
109 /* length code for each normalized match length (0 == MIN_MATCH) */
112 /* First normalized length for each code (0 = MIN_MATCH) */
115 /* First normalized distance for each code (0 = distance of 1) */
123 const intf *extra_bits; /* extra bits for each code or NULL */
168 /* Send a code of the given tree. c and tree must not have side effects */
245 int code; /* code value */
259 /* Initialize the mapping length (0..255) -> length code (0..28) */
261 for (code = 0; code < LENGTH_CODES-1; code++) {
262 base_length[code] = length;
263 for (n = 0; n < (1<<extra_lbits[code]); n++) {
264 _length_code[length++] = (uch)code;
269 * in two different ways: code 284 + 5 bits or code 285, so we
272 _length_code[length-1] = (uch)code;
274 /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
276 for (code = 0 ; code < 16; code++) {
277 base_dist[code] = dist;
278 for (n = 0; n < (1<<extra_dbits[code]); n++) {
279 _dist_code[dist++] = (uch)code;
284 for ( ; code < D_CODES; code++) {
285 base_dist[code] = dist << 7;
286 for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
287 _dist_code[256 + dist++] = (uch)code;
300 * tree construction to get a canonical Huffman tree (longest code
559 Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
574 * OUT assertion: the field code is set for all tree elements of non
575 * zero code length.
579 int max_code; /* largest code with non zero frequency */
582 ush next_code[MAX_BITS+1]; /* next code value for each bit length */
583 ush code = 0; /* running code value */
585 int n; /* code index */
587 /* The distribution counts are first used to generate the code values
591 next_code[bits] = code = (code + bl_count[bits-1]) << 1;
593 /* Check that the bit counts in bl_count are consistent. The last code
596 Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
612 * Construct one Huffman tree and assigns the code bit strings and lengths.
615 * OUT assertions: the fields len and code are set to the optimal bit length
616 * and corresponding code. The length opt_len is updated; static_len is
627 int max_code = -1; /* largest code with non zero frequency */
645 /* The pkzip format requires that at least one distance code exists,
647 * possible code. So to avoid special checks later on we force at least
710 int max_code; /* and its largest code of non zero frequency */
714 int curlen; /* length of current code */
715 int nextlen = tree[0].Len; /* length of next code */
716 int count = 0; /* repeat count of the current code */
755 int max_code; /* and its largest code of non zero frequency */
759 int curlen; /* length of current code */
760 int nextlen = tree[0].Len; /* length of next code */
761 int count = 0; /* repeat count of the current code */
801 * bl_order of the last bit length code to send.
806 int max_blindex; /* index of last bit length code of non zero freq */
852 Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
884 * The current inflate code requires 9 bits of lookahead. If the
885 * last two codes for the previous block (real code plus EOB) were coded
887 * the last real code. In this case we send two empty static blocks instead
889 * To simplify the code, we assume the worst case of last real code encoded
902 * (10 - bi_valid) bits. The lookahead for the last real code (before
928 int max_blindex = 0; /* index of last bit length code of non zero freq */
950 * in bl_order of the last bit length code to send.
1080 unsigned code; /* the code to send */
1091 code = _length_code[lc];
1092 send_code(s, code+LITERALS+1, ltree); /* send the length code */
1093 extra = extra_lbits[code];
1095 lc -= base_length[code];
1099 code = d_code(dist);
1100 Assert (code < D_CODES, "bad d_code");
1102 send_code(s, code, dtree); /* send the distance code */
1103 extra = extra_dbits[code];
1105 dist -= base_dist[code];
1142 * Reverse the first len bits of a code, using straightforward code (a faster
1146 local unsigned bi_reverse(code, len)
1147 unsigned code; /* the value to invert */
1152 res |= code & 1;
1153 code >>= 1, res <<= 1;