Rev 6799 | Rev 6851 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6799 | Rev 6847 | ||
---|---|---|---|
Line 144... | Line 144... | ||
144 | ; Attempt to find a better match only when the current match is strictly |
144 | ; Attempt to find a better match only when the current match is strictly |
145 | ; smaller than this value. This mechanism is used only for compression |
145 | ; smaller than this value. This mechanism is used only for compression |
146 | ; levels >= 4. |
146 | ; levels >= 4. |
Line 147... | Line 147... | ||
147 | 147 | ||
- | 148 | level dw ? ;int ;compression level (1..9) |
|
148 | level dw ? ;int ;compression level (1..9) |
149 | rb 2 ;for align |
- | 150 | strategy dw ? ;int ;favor or force Huffman coding |
|
Line 149... | Line 151... | ||
149 | strategy dw ? ;int ;favor or force Huffman coding |
151 | rb 2 ;for align |
150 | 152 | ||
Line 151... | Line 153... | ||
151 | good_match dd ? ;uInt |
153 | good_match dd ? ;uInt |
Line 164... | Line 166... | ||
164 | bl_desc tree_desc ;desc. for bit length tree |
166 | bl_desc tree_desc ;desc. for bit length tree |
Line 165... | Line 167... | ||
165 | 167 | ||
166 | bl_count rw MAX_BITS+1 ;uint_16[] |
168 | bl_count rw MAX_BITS+1 ;uint_16[] |
Line 167... | Line 169... | ||
167 | ; number of codes at each bit length for an optimal tree |
169 | ; number of codes at each bit length for an optimal tree |
168 | 170 | ||
169 | heap rw 2*L_CODES+1 ;int[] ;heap used to build the Huffman trees |
171 | heap rd 2*L_CODES+1 ;int[] ;heap used to build the Huffman trees |
170 | heap_len dd ? ;int ;number of elements in the heap |
172 | heap_len dd ? ;int ;number of elements in the heap |
171 | heap_max dd ? ;int ;element of largest frequency |
173 | heap_max dd ? ;int ;element of largest frequency |
Line 207... | Line 209... | ||
207 | static_len dd ? ;ulg ;bit length of current block with static trees |
209 | static_len dd ? ;ulg ;bit length of current block with static trees |
208 | matches dd ? ;uInt ;number of string matches in current block |
210 | matches dd ? ;uInt ;number of string matches in current block |
209 | insert dd ? ;uInt ;bytes at end of window left to insert |
211 | insert dd ? ;uInt ;bytes at end of window left to insert |
Line 210... | Line 212... | ||
210 | 212 | ||
211 | if DEBUG eq 1 |
213 | if DEBUG eq 1 |
212 | compressed_len dd ? ;ulg ;total bit length of compressed file mod 2^32 |
214 | ;compressed_len dd ? ;ulg ;total bit length of compressed file mod 2^32 |
213 | bits_sent dd ? ;ulg ;bit length of compressed data sent mod 2^32 |
215 | ;bits_sent dd ? ;ulg ;bit length of compressed data sent mod 2^32 |
Line 214... | Line 216... | ||
214 | end if |
216 | end if |
- | 217 | ||
215 | 218 | bi_buf dw ? ;uint_16 |
|
216 | bi_buf dw ? ;uint_16 |
219 | rb 2 ;for align |
Line 217... | Line 220... | ||
217 | ; Output buffer. bits are inserted starting at the bottom (least |
220 | ; Output buffer. bits are inserted starting at the bottom (least |
218 | ; significant bits). |
221 | ; significant bits). |
Line 236... | Line 239... | ||
236 | ; Output a byte on the stream. |
239 | ; Output a byte on the stream. |
237 | ; IN assertion: there is enough room in pending_buf. |
240 | ; IN assertion: there is enough room in pending_buf. |
Line 238... | Line 241... | ||
238 | 241 | ||
239 | macro put_byte s, c |
242 | macro put_byte s, c |
240 | { |
243 | { |
241 | movzx eax,word[s+deflate_state.pending] |
244 | mov eax,[s+deflate_state.pending] |
242 | add eax,[s+deflate_state.pending_buf] |
245 | add eax,[s+deflate_state.pending_buf] |
243 | mov byte[eax],c |
246 | mov byte[eax],c |
244 | inc word[s+deflate_state.pending] |
247 | inc dword[s+deflate_state.pending] |
245 | } |
248 | } |
246 | macro put_dword s, d |
249 | macro put_dword s, d |
247 | { |
- | |
248 | zlib_debug '(%d)',d |
250 | { |
249 | movzx eax,word[s+deflate_state.pending] |
251 | mov eax,[s+deflate_state.pending] |
250 | add eax,[s+deflate_state.pending_buf] |
252 | add eax,[s+deflate_state.pending_buf] |
251 | mov dword[eax],d |
253 | mov dword[eax],d |
252 | add word[s+deflate_state.pending],4 |
254 | add dword[s+deflate_state.pending],4 |
Line 253... | Line 255... | ||
253 | } |
255 | } |
254 | 256 | ||
255 | MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) |
257 | MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) |
Line 303... | Line 305... | ||
303 | add ecx,[s+deflate_state.l_buf] |
305 | add ecx,[s+deflate_state.l_buf] |
304 | mov byte[ecx],al |
306 | mov byte[ecx],al |
305 | inc dword[s+deflate_state.last_lit] |
307 | inc dword[s+deflate_state.last_lit] |
306 | and eax,0xff |
308 | and eax,0xff |
307 | imul eax,sizeof.ct_data |
309 | imul eax,sizeof.ct_data |
308 | add eax,s |
- | |
309 | inc word[eax+deflate_state.dyn_ltree+Freq] |
310 | inc word[s+eax+deflate_state.dyn_ltree+Freq] |
310 | xor eax,eax |
311 | xor eax,eax |
311 | mov ecx,[s+deflate_state.lit_bufsize] |
312 | mov ecx,[s+deflate_state.lit_bufsize] |
312 | dec ecx |
313 | dec ecx |
313 | cmp [s+deflate_state.last_lit],ecx |
314 | cmp [s+deflate_state.last_lit],ecx |
314 | jne .end0 |
315 | jne .end0 |