Lines Matching +refs:val +refs:length
47 /* Bit length codes must not exceed MAX_BL_BITS bits */
53 /* repeat previous bit length 3-6 times (2 bits of repeat count) */
56 /* repeat a zero length 3-10 times (3 bits of repeat count) */
59 /* repeat a zero length 11-138 times (7 bits of repeat count) */
61 local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
67 local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
72 /* The lengths of the bit length codes are sent in order of decreasing
73 * probability, to avoid transmitting the lengths for unused bit length codes.
109 /* length code for each normalized match length (0 == MIN_MATCH) */
112 /* First normalized length for each code (0 = MIN_MATCH) */
126 int max_length; /* max bit length for the codes */
156 local unsigned bi_reverse OF((unsigned value, int length));
187 * IN assertion: length <= 16 and value fits in length bits.
190 local void send_bits OF((deflate_state *s, int value, int length));
192 local void send_bits(s, value, length)
195 int length; /* number of bits */
197 Tracevv((stderr," l %2d v %4x ", length, value));
198 Assert(length > 0 && length <= 15, "invalid length");
199 s->bits_sent += (ulg)length;
205 if (s->bi_valid > (int)Buf_size - length) {
209 s->bi_valid += length - Buf_size;
212 s->bi_valid += length;
217 #define send_bits(s, value, length) \
218 { int len = length;\
220 int val = value;\
221 s->bi_buf |= (val << s->bi_valid);\
223 s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
244 int length; /* length value */
248 /* number of codes at each bit length for an optimal tree */
259 /* Initialize the mapping length (0..255) -> length code (0..28) */
260 length = 0;
262 base_length[code] = length;
264 _length_code[length++] = (uch)code;
267 Assert (length == 256, "tr_static_init: length != 256");
268 /* Note that the length 255 (match length 258) can be represented
272 _length_code[length-1] = (uch)code;
443 * the subtrees have equal frequency. This minimizes the worst case length.
481 * Compute the optimal bit lengths for a tree and update the total bit length
485 * OUT assertions: the field len is set to the optimal bit length, the
486 * array bl_count contains the frequencies for each bit length.
487 * The length opt_len is updated; static_len is also updated if stree is
502 int bits; /* bit length */
505 int overflow = 0; /* number of elements with bit length too large */
510 * overflow in the case of the bit length tree).
532 Trace((stderr,"\nbit length overflow\n"));
535 /* Find the first bit length which could increase: */
572 * IN assertion: the array bl_count contains the bit length statistics for
575 * zero code length.
580 ushf *bl_count; /* number of codes at each bit length */
582 ush next_code[MAX_BITS+1]; /* next code value for each bit length */
613 * Update the total bit length for the current block.
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
705 * in the bit length tree.
713 int prevlen = -1; /* last emitted length */
714 int curlen; /* length of current code */
715 int nextlen = tree[0].Len; /* length of next code */
758 int prevlen = -1; /* last emitted length */
759 int curlen; /* length of current code */
760 int nextlen = tree[0].Len; /* length of next 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 */
808 /* Determine the bit length frequencies for literal and distance trees */
812 /* Build the bit length tree: */
814 /* opt_len now includes the length of the tree representations, except
818 /* Determine the number of bit length codes to send. The pkzip format
819 * requires that at least 4 bit length codes be sent. (appnote.txt says
825 /* Update opt_len to include the bit length tree and counts */
835 * lengths of the bit length codes, the literal tree and the distance tree.
870 ulg stored_len; /* length of input block */
903 * the EOB of the previous block) was thus at least one plus the length
924 ulg stored_len; /* length of input block */
928 int max_blindex = 0; /* index of last bit length code of non zero freq */
949 /* Build the bit length tree for the above two trees, and get the index
950 * in bl_order of the last bit length code to send.
1025 unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
1034 /* Here, lc is the match length - MIN_MATCH */
1047 /* Compute an upper bound for the compressed length */
1078 int lc; /* match length or unmatched char (if dist == 0) */
1090 /* Here, lc is the match length - MIN_MATCH */
1092 send_code(s, code+LITERALS+1, ltree); /* send the length code */
1096 send_bits(s, lc, extra); /* send the extra length bits */
1148 int len; /* its bit length */
1194 * Copy a stored block, storing first the length and its
1200 unsigned len; /* its length */