deflate.h (7648bc9fee8dec6cb3c4941e0165a930fbe8dcb0) deflate.h (cd8822075a38d0734e74b1735e4b5dbef9789170)
1/* deflate.h -- internal compression state
1/* deflate.h -- internal compression state
2 * Copyright (C) 1995-2016 Jean-loup Gailly
2 * Copyright (C) 1995-2018 Jean-loup Gailly
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h.
9 */
10

--- 201 unchanged lines hidden (view full) ---

212 /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
213 * The same heap array is used to build all trees.
214 */
215
216 uch depth[2*L_CODES+1];
217 /* Depth of each subtree used as tie breaker for trees of equal frequency
218 */
219
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h.
9 */
10

--- 201 unchanged lines hidden (view full) ---

212 /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
213 * The same heap array is used to build all trees.
214 */
215
216 uch depth[2*L_CODES+1];
217 /* Depth of each subtree used as tie breaker for trees of equal frequency
218 */
219
220 uchf *l_buf; /* buffer for literals or lengths */
220 uchf *sym_buf; /* buffer for distances and literals/lengths */
221
222 uInt lit_bufsize;
223 /* Size of match buffer for literals/lengths. There are 4 reasons for
224 * limiting lit_bufsize to 64K:
225 * - frequencies can be kept in 16 bit counters
226 * - if compression is not successful for the first block, all input
227 * data is still in the window so we can still emit a stored block even
228 * when input comes from standard input. (This can also be done for

--- 5 unchanged lines hidden (view full) ---

234 * adaptation to changes in the input data statistics. (Take for
235 * example a binary file with poorly compressible code followed by
236 * a highly compressible string table.) Smaller buffer sizes give
237 * fast adaptation but have of course the overhead of transmitting
238 * trees more frequently.
239 * - I can't count above 4
240 */
241
221
222 uInt lit_bufsize;
223 /* Size of match buffer for literals/lengths. There are 4 reasons for
224 * limiting lit_bufsize to 64K:
225 * - frequencies can be kept in 16 bit counters
226 * - if compression is not successful for the first block, all input
227 * data is still in the window so we can still emit a stored block even
228 * when input comes from standard input. (This can also be done for

--- 5 unchanged lines hidden (view full) ---

234 * adaptation to changes in the input data statistics. (Take for
235 * example a binary file with poorly compressible code followed by
236 * a highly compressible string table.) Smaller buffer sizes give
237 * fast adaptation but have of course the overhead of transmitting
238 * trees more frequently.
239 * - I can't count above 4
240 */
241
242 uInt last_lit; /* running index in l_buf */
242 uInt sym_next; /* running index in sym_buf */
243 uInt sym_end; /* symbol table full when sym_next reaches this */
243
244
244 ushf *d_buf;
245 /* Buffer for distances. To simplify the code, d_buf and l_buf have
246 * the same number of elements. To use different lengths, an extra flag
247 * array would be necessary.
248 */
249
250 ulg opt_len; /* bit length of current block with optimal trees */
251 ulg static_len; /* bit length of current block with static trees */
252 uInt matches; /* number of string matches in current block */
253 uInt insert; /* bytes at end of window left to insert */
254
255#ifdef ZLIB_DEBUG
256 ulg compressed_len; /* total bit length of compressed file mod 2^32 */
257 ulg bits_sent; /* bit length of compressed data sent mod 2^32 */

--- 62 unchanged lines hidden (view full) ---

320 extern uch ZLIB_INTERNAL _dist_code[];
321#else
322 extern const uch ZLIB_INTERNAL _length_code[];
323 extern const uch ZLIB_INTERNAL _dist_code[];
324#endif
325
326# define _tr_tally_lit(s, c, flush) \
327 { uch cc = (c); \
245 ulg opt_len; /* bit length of current block with optimal trees */
246 ulg static_len; /* bit length of current block with static trees */
247 uInt matches; /* number of string matches in current block */
248 uInt insert; /* bytes at end of window left to insert */
249
250#ifdef ZLIB_DEBUG
251 ulg compressed_len; /* total bit length of compressed file mod 2^32 */
252 ulg bits_sent; /* bit length of compressed data sent mod 2^32 */

--- 62 unchanged lines hidden (view full) ---

315 extern uch ZLIB_INTERNAL _dist_code[];
316#else
317 extern const uch ZLIB_INTERNAL _length_code[];
318 extern const uch ZLIB_INTERNAL _dist_code[];
319#endif
320
321# define _tr_tally_lit(s, c, flush) \
322 { uch cc = (c); \
328 s->d_buf[s->last_lit] = 0; \
329 s->l_buf[s->last_lit++] = cc; \
323 s->sym_buf[s->sym_next++] = 0; \
324 s->sym_buf[s->sym_next++] = 0; \
325 s->sym_buf[s->sym_next++] = cc; \
330 s->dyn_ltree[cc].Freq++; \
326 s->dyn_ltree[cc].Freq++; \
331 flush = (s->last_lit == s->lit_bufsize-1); \
327 flush = (s->sym_next == s->sym_end); \
332 }
333# define _tr_tally_dist(s, distance, length, flush) \
334 { uch len = (uch)(length); \
335 ush dist = (ush)(distance); \
328 }
329# define _tr_tally_dist(s, distance, length, flush) \
330 { uch len = (uch)(length); \
331 ush dist = (ush)(distance); \
336 s->d_buf[s->last_lit] = dist; \
337 s->l_buf[s->last_lit++] = len; \
332 s->sym_buf[s->sym_next++] = dist; \
333 s->sym_buf[s->sym_next++] = dist >> 8; \
334 s->sym_buf[s->sym_next++] = len; \
338 dist--; \
339 s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
340 s->dyn_dtree[d_code(dist)].Freq++; \
335 dist--; \
336 s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
337 s->dyn_dtree[d_code(dist)].Freq++; \
341 flush = (s->last_lit == s->lit_bufsize-1); \
338 flush = (s->sym_next == s->sym_end); \
342 }
343#else
344# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
345# define _tr_tally_dist(s, distance, length, flush) \
346 flush = _tr_tally(s, distance, length)
347#endif
348
349#endif /* DEFLATE_H */
339 }
340#else
341# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
342# define _tr_tally_dist(s, distance, length, flush) \
343 flush = _tr_tally(s, distance, length)
344#endif
345
346#endif /* DEFLATE_H */