Home | History | Annotate | Download | only in net

Lines Matching defs:Code

309 /* number of length codes, not counting the special END_BLOCK code */
315 /* number of Literal or Length codes, including the END_BLOCK code */
335 /* Data structure describing a single value and its code string. */
339 ush code; /* bit string */
348 #define Code fc.code
356 int max_code; /* largest code with non zero frequency */
502 * example a binary file with poorly compressible code followed by
512 /* Buffer for distances. To simplify the code, d_buf and l_buf have
520 int last_eob_len; /* bit length of EOB code for last block */
550 /* In order to simplify the code, particularly on 16 bit machines, match
566 /* Mapping from a distance to a distance code. dist is the distance - 1 and
694 void match_init(void); /* asm code initialization */
749 /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
1332 match_init(); /* initialize the asm code */
1347 * match.S. The code will be functionally equivalent.
1361 /* Stop when cur_match becomes <= limit. To simplify the code,
1380 /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
1383 Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
1404 /* This code assumes sizeof(unsigned short) == 2. Do not use
1427 /* The funny "do {}" generates better code on most compilers */
1500 /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
1503 Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
1789 /* To simplify the code, we prevent matches with the string
1887 /* To simplify the code, we prevent matches with the string
1982 * Each code tree is stored in a compressed form which is itself
1983 * a Huffman encoding of the lengths of all the code strings (in
1984 * ascending order by source values). The actual code strings are
2020 /* end of block literal code */
2031 local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
2034 local const int extra_dbits[D_CODES] /* extra bits for each distance code */
2037 local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
2079 /* length code for each normalized match length (0 == MIN_MATCH) */
2082 /* First normalized length for each code (0 = MIN_MATCH) */
2085 /* First normalized distance for each code (0 = distance of 1) */
2223 const intf *extra_bits; /* extra bits for each code or NULL */
2267 # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
2268 /* Send a code of the given tree. c and tree must not have side effects */
2273 send_bits(s, tree[c].Code, tree[c].Len); }
2343 int code; /* code value */
2357 /* Initialize the mapping length (0..255) -> length code (0..28) */
2359 for (code = 0; code < LENGTH_CODES-1; code++) {
2360 base_length[code] = length;
2361 for (n = 0; n < (1<<extra_lbits[code]); n++) {
2362 _length_code[length++] = (uch)code;
2367 * in two different ways: code 284 + 5 bits or code 285, so we
2370 _length_code[length-1] = (uch)code;
2372 /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
2374 for (code = 0 ; code < 16; code++) {
2375 base_dist[code] = dist;
2376 for (n = 0; n < (1<<extra_dbits[code]); n++) {
2377 _dist_code[dist++] = (uch)code;
2382 for ( ; code < D_CODES; code++) {
2383 base_dist[code] = dist << 7;
2384 for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
2385 _dist_code[256 + dist++] = (uch)code;
2398 * tree construction to get a canonical Huffman tree (longest code
2406 static_dtree[n].Code = bi_reverse((unsigned)n, 5);
2439 fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
2445 fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
2653 Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
2668 * OUT assertion: the field code is set for all tree elements of non
2669 * zero code length.
2672 int max_code, /* largest code with non zero frequency */
2675 ush next_code[MAX_BITS+1]; /* next code value for each bit length */
2676 ush code = 0; /* running code value */
2678 int n; /* code index */
2680 /* The distribution counts are first used to generate the code values
2684 next_code[bits] = code = (code + bl_count[bits-1]) << 1;
2686 /* Check that the bit counts in bl_count are consistent. The last code
2689 Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
2697 tree[n].Code = bi_reverse(next_code[len]++, len);
2700 n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
2705 * Construct one Huffman tree and assigns the code bit strings and lengths.
2708 * OUT assertions: the fields len and code are set to the optimal bit length
2709 * and corresponding code. The length opt_len is updated; static_len is
2719 int max_code = -1; /* largest code with non zero frequency */
2737 /* The pkzip format requires that at least one distance code exists,
2739 * possible code. So to avoid special checks later on we force at least
2800 int max_code) /* and its largest code of non zero frequency */
2804 int curlen; /* length of current code */
2805 int nextlen = tree[0].Len; /* length of next code */
2806 int count = 0; /* repeat count of the current code */
2844 int max_code) /* and its largest code of non zero frequency */
2848 int curlen; /* length of current code */
2849 int nextlen = tree[0].Len; /* length of next code */
2850 int count = 0; /* repeat count of the current code */
2890 * bl_order of the last bit length code to send.
2894 int max_blindex; /* index of last bit length code of non zero freq */
2939 Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
2967 /* Send just the `stored block' type code without any length bytes or data.
2981 * The current inflate code requires 9 bits of lookahead. If the
2982 * last two codes for the previous block (real code plus EOB) were coded
2984 * the last real code. In this case we send two empty static blocks instead
2986 * To simplify the code, we assume the worst case of last real code encoded
2998 * (10 - bi_valid) bits. The lookahead for the last real code (before
3023 int max_blindex = 0; /* index of last bit length code of non zero freq */
3044 * in bl_order of the last bit length code to send.
3174 unsigned code; /* the code to send */
3185 code = _length_code[lc];
3186 send_code(s, code+LITERALS+1, ltree); /* send the length code */
3187 extra = extra_lbits[code];
3189 lc -= base_length[code];
3193 code = d_code(dist);
3194 Assert (code < D_CODES, "bad d_code");
3196 send_code(s, code, dtree); /* send the distance code */
3197 extra = extra_dbits[code];
3199 dist -= base_dist[code];
3231 * Reverse the first len bits of a code, using straightforward code (a faster
3235 local unsigned bi_reverse(unsigned code, /* the value to invert */
3240 res |= code & 1;
3241 code >>= 1, res <<= 1;
3339 int); /* initial return code */
3781 /* Huffman code lookup table entry--this entry is four bytes for machines
3790 Byte Bits; /* number of bits in this code or subcode */
3806 uIntf *, /* 19 code lengths */
3815 uIntf *, /* that many (total) code lengths */
3975 local const uInt border[] = { /* Order of the bit length code lengths */
3986 4. If only one code exists, then it is encoded using one bit. (Zero
3993 zero distance codes, which is sent as one code of zero bits in
3995 6. There are up to 286 literal/length codes. Code 256 represents the
4002 7. Unzip can check dynamic Huffman blocks for complete code sets.
4003 The exception is that a single code would not be complete (see #4).
4010 10. In the tree reconstruction algorithm, Code = Code + Increment
4013 12. Note: length code 284 can represent 227-258, but length code 285
4014 really is 258. The last length deserves its own, short code
4017 13. The literal/length and distance code bit lengths are read as a
4019 a repeat code (16, 17, or 18) to go across the boundary between
4452 uIntf *, /* code lengths in bits */
4481 Huffman code decoding is performed using a multi-level table lookup.
4483 size is determined by the longest code. However, the time it takes
4497 codes are shorter than that, in which case the longest code length in
4498 bits is used, or when the shortest code is *longer* than the requested
4499 table size, in which case the length of the shortest code in bits is
4502 There are two different values for the two tables, since they code a
4504 codes 286 possible values, or in a flat code, a little over eight
4514 #define BMAX 15 /* maximum bit length of any code */
4516 local int huft_build(uIntf *b, /* code lengths in bits (all assumed <= BMAX) */
4527 /* Given a list of code lengths and a maximum table size, make a set of
4529 if the given code set is incomplete (the tables are still built in this
4536 int g; /* maximum code length */
4538 uInt i; /* counter, current code */
4540 int k; /* number of bits in current code */
4548 uInt x[BMAX+1]; /* bit offsets, then code stack */
4578 k = j; /* minimum code length */
4584 g = i; /* maximum code length */
4617 x[0] = i = 0; /* first Huffman code is zero */
4625 /* go through the bit lengths (k already is bits in shortest code) */
4631 /* here i is the Huffman code of length k bits for value *p */
4678 r.exop = 128 + 64; /* out of values--invalid code */
4682 r.base = *p++; /* simple code is just the value */
4690 /* fill code-like entries with r */
4695 /* backwards increment the k-bit code i */
4719 int inflate_trees_bits(uIntf *c, /* 19 code lengths */
4748 uIntf *bl, /* that many (total) code lengths */
5098 } code; /* if LEN or DIST, where in tree */
5168 c->sub.code.need = c->lbits;
5169 c->sub.code.tree = c->ltree;
5173 j = c->sub.code.need;
5175 t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
5196 c->sub.code.need = e;
5197 c->sub.code.tree = t + t->base;
5206 c->mode = BADCODE; /* invalid code */
5207 z->msg = "invalid literal/length code";
5215 c->sub.code.need = c->dbits;
5216 c->sub.code.tree = c->dtree;
5221 j = c->sub.code.need;
5223 t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
5235 c->sub.code.need = e;
5236 c->sub.code.tree = t + t->base;
5239 c->mode = BADCODE; /* invalid code */
5240 z->msg = "invalid distance code";
5460 /* get literal/length code */
5461 GRABBITS(20) /* max bits for literal/length code */
5483 GRABBITS(15); /* max bits for distance code */
5542 z->msg = "invalid distance code";
5573 z->msg = "invalid literal/length code";
5646 /* exported to allow conversion of error code to string for compress() and
5878 * NetBSD module glue - this code is required for the vnd and swcrypto