| OLD | NEW |
| 1 /* deflate.h -- internal compression state | 1 /* deflate.h -- internal compression state |
| 2 * Copyright (C) 1995-2010 Jean-loup Gailly | 2 * Copyright (C) 1995-2012 Jean-loup Gailly |
| 3 * For conditions of distribution and use, see copyright notice in zlib.h | 3 * For conditions of distribution and use, see copyright notice in zlib.h |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /* WARNING: this file should *not* be used by applications. It is | 6 /* WARNING: this file should *not* be used by applications. It is |
| 7 part of the implementation of the compression library and is | 7 part of the implementation of the compression library and is |
| 8 subject to change. Applications should only use zlib.h. | 8 subject to change. Applications should only use zlib.h. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 /* @(#) $Id$ */ | 11 /* @(#) $Id$ */ |
| 12 | 12 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 #define BL_CODES 19 | 42 #define BL_CODES 19 |
| 43 /* number of codes used to transfer the bit lengths */ | 43 /* number of codes used to transfer the bit lengths */ |
| 44 | 44 |
| 45 #define HEAP_SIZE (2*L_CODES+1) | 45 #define HEAP_SIZE (2*L_CODES+1) |
| 46 /* maximum heap size */ | 46 /* maximum heap size */ |
| 47 | 47 |
| 48 #define MAX_BITS 15 | 48 #define MAX_BITS 15 |
| 49 /* All codes must not exceed MAX_BITS bits */ | 49 /* All codes must not exceed MAX_BITS bits */ |
| 50 | 50 |
| 51 #define Buf_size 16 |
| 52 /* size of bit buffer in bi_buf */ |
| 53 |
| 51 #define INIT_STATE 42 | 54 #define INIT_STATE 42 |
| 52 #define EXTRA_STATE 69 | 55 #define EXTRA_STATE 69 |
| 53 #define NAME_STATE 73 | 56 #define NAME_STATE 73 |
| 54 #define COMMENT_STATE 91 | 57 #define COMMENT_STATE 91 |
| 55 #define HCRC_STATE 103 | 58 #define HCRC_STATE 103 |
| 56 #define BUSY_STATE 113 | 59 #define BUSY_STATE 113 |
| 57 #define FINISH_STATE 666 | 60 #define FINISH_STATE 666 |
| 58 /* Stream status */ | 61 /* Stream status */ |
| 59 | 62 |
| 60 | 63 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 typedef struct internal_state { | 100 typedef struct internal_state { |
| 98 z_streamp strm; /* pointer back to this zlib stream */ | 101 z_streamp strm; /* pointer back to this zlib stream */ |
| 99 int status; /* as the name implies */ | 102 int status; /* as the name implies */ |
| 100 Bytef *pending_buf; /* output still pending */ | 103 Bytef *pending_buf; /* output still pending */ |
| 101 ulg pending_buf_size; /* size of pending_buf */ | 104 ulg pending_buf_size; /* size of pending_buf */ |
| 102 Bytef *pending_out; /* next pending byte to output to the stream */ | 105 Bytef *pending_out; /* next pending byte to output to the stream */ |
| 103 uInt pending; /* nb of bytes in the pending buffer */ | 106 uInt pending; /* nb of bytes in the pending buffer */ |
| 104 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ | 107 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ |
| 105 gz_headerp gzhead; /* gzip header information to write */ | 108 gz_headerp gzhead; /* gzip header information to write */ |
| 106 uInt gzindex; /* where in extra, name, or comment */ | 109 uInt gzindex; /* where in extra, name, or comment */ |
| 107 Byte method; /* STORED (for zip only) or DEFLATED */ | 110 Byte method; /* can only be DEFLATED */ |
| 108 int last_flush; /* value of flush param for previous deflate call */ | 111 int last_flush; /* value of flush param for previous deflate call */ |
| 109 | 112 |
| 110 unsigned zalign(16) crc0[4 * 5]; | 113 unsigned zalign(16) crc0[4 * 5]; |
| 111 | 114 |
| 112 /* used by deflate.c: */ | 115 /* used by deflate.c: */ |
| 113 | 116 |
| 114 uInt w_size; /* LZ77 window size (32K by default) */ | 117 uInt w_size; /* LZ77 window size (32K by default) */ |
| 115 uInt w_bits; /* log2(w_size) (8..16) */ | 118 uInt w_bits; /* log2(w_size) (8..16) */ |
| 116 uInt w_mask; /* w_size - 1 */ | 119 uInt w_mask; /* w_size - 1 */ |
| 117 | 120 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 191 |
| 189 int level; /* compression level (1..9) */ | 192 int level; /* compression level (1..9) */ |
| 190 int strategy; /* favor or force Huffman coding*/ | 193 int strategy; /* favor or force Huffman coding*/ |
| 191 | 194 |
| 192 uInt good_match; | 195 uInt good_match; |
| 193 /* Use a faster search when the previous match is longer than this */ | 196 /* Use a faster search when the previous match is longer than this */ |
| 194 | 197 |
| 195 int nice_match; /* Stop searching when current match exceeds this */ | 198 int nice_match; /* Stop searching when current match exceeds this */ |
| 196 | 199 |
| 197 /* used by trees.c: */ | 200 /* used by trees.c: */ |
| 198 /* Didn't use ct_data typedef below to supress compiler warning */ | 201 /* Didn't use ct_data typedef below to suppress compiler warning */ |
| 199 struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ | 202 struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ |
| 200 struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ | 203 struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ |
| 201 struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ | 204 struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ |
| 202 | 205 |
| 203 struct tree_desc_s l_desc; /* desc. for literal tree */ | 206 struct tree_desc_s l_desc; /* desc. for literal tree */ |
| 204 struct tree_desc_s d_desc; /* desc. for distance tree */ | 207 struct tree_desc_s d_desc; /* desc. for distance tree */ |
| 205 struct tree_desc_s bl_desc; /* desc. for bit length tree */ | 208 struct tree_desc_s bl_desc; /* desc. for bit length tree */ |
| 206 | 209 |
| 207 ush bl_count[MAX_BITS+1]; | 210 ush bl_count[MAX_BITS+1]; |
| 208 /* number of codes at each bit length for an optimal tree */ | 211 /* number of codes at each bit length for an optimal tree */ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 247 |
| 245 ushf *d_buf; | 248 ushf *d_buf; |
| 246 /* Buffer for distances. To simplify the code, d_buf and l_buf have | 249 /* Buffer for distances. To simplify the code, d_buf and l_buf have |
| 247 * the same number of elements. To use different lengths, an extra flag | 250 * the same number of elements. To use different lengths, an extra flag |
| 248 * array would be necessary. | 251 * array would be necessary. |
| 249 */ | 252 */ |
| 250 | 253 |
| 251 ulg opt_len; /* bit length of current block with optimal trees */ | 254 ulg opt_len; /* bit length of current block with optimal trees */ |
| 252 ulg static_len; /* bit length of current block with static trees */ | 255 ulg static_len; /* bit length of current block with static trees */ |
| 253 uInt matches; /* number of string matches in current block */ | 256 uInt matches; /* number of string matches in current block */ |
| 254 int last_eob_len; /* bit length of EOB code for last block */ | 257 uInt insert; /* bytes at end of window left to insert */ |
| 255 | 258 |
| 256 #ifdef DEBUG | 259 #ifdef DEBUG |
| 257 ulg compressed_len; /* total bit length of compressed file mod 2^32 */ | 260 ulg compressed_len; /* total bit length of compressed file mod 2^32 */ |
| 258 ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ | 261 ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ |
| 259 #endif | 262 #endif |
| 260 | 263 |
| 261 ush bi_buf; | 264 ush bi_buf; |
| 262 /* Output buffer. bits are inserted starting at the bottom (least | 265 /* Output buffer. bits are inserted starting at the bottom (least |
| 263 * significant bits). | 266 * significant bits). |
| 264 */ | 267 */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 294 | 297 |
| 295 #define WIN_INIT MAX_MATCH | 298 #define WIN_INIT MAX_MATCH |
| 296 /* Number of bytes after end of data in window to initialize in order to avoid | 299 /* Number of bytes after end of data in window to initialize in order to avoid |
| 297 memory checker errors from longest match routines */ | 300 memory checker errors from longest match routines */ |
| 298 | 301 |
| 299 /* in trees.c */ | 302 /* in trees.c */ |
| 300 void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); | 303 void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); |
| 301 int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); | 304 int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); |
| 302 void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, | 305 void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, |
| 303 ulg stored_len, int last)); | 306 ulg stored_len, int last)); |
| 307 void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); |
| 304 void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); | 308 void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); |
| 305 void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, | 309 void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, |
| 306 ulg stored_len, int last)); | 310 ulg stored_len, int last)); |
| 307 | 311 |
| 308 #define d_code(dist) \ | 312 #define d_code(dist) \ |
| 309 ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) | 313 ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) |
| 310 /* Mapping from a distance to a distance code. dist is the distance - 1 and | 314 /* Mapping from a distance to a distance code. dist is the distance - 1 and |
| 311 * must not have side effects. _dist_code[256] and _dist_code[257] are never | 315 * must not have side effects. _dist_code[256] and _dist_code[257] are never |
| 312 * used. | 316 * used. |
| 313 */ | 317 */ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 void ZLIB_INTERNAL crc_fold_init(deflate_state* const s); | 354 void ZLIB_INTERNAL crc_fold_init(deflate_state* const s); |
| 351 void ZLIB_INTERNAL crc_fold_copy(deflate_state* const s, | 355 void ZLIB_INTERNAL crc_fold_copy(deflate_state* const s, |
| 352 unsigned char* dst, | 356 unsigned char* dst, |
| 353 const unsigned char* src, | 357 const unsigned char* src, |
| 354 long len); | 358 long len); |
| 355 unsigned ZLIB_INTERNAL crc_fold_512to32(deflate_state* const s); | 359 unsigned ZLIB_INTERNAL crc_fold_512to32(deflate_state* const s); |
| 356 | 360 |
| 357 void ZLIB_INTERNAL fill_window_sse(deflate_state* s); | 361 void ZLIB_INTERNAL fill_window_sse(deflate_state* s); |
| 358 | 362 |
| 359 #endif /* DEFLATE_H */ | 363 #endif /* DEFLATE_H */ |
| OLD | NEW |