Rev 6847 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6847 | Rev 6851 | ||
---|---|---|---|
Line 275... | Line 275... | ||
275 | ;if (dist < 256) _dist_code[dist] |
275 | ;if (dist < 256) _dist_code[dist] |
276 | ;else _dist_code[ 256+(dist>>7) ] |
276 | ;else _dist_code[ 256+(dist>>7) ] |
277 | local .end0 |
277 | local .end0 |
278 | mov eax,dist |
278 | mov eax,dist |
279 | cmp eax,256 |
279 | cmp eax,256 |
280 | jl .end0 |
280 | ja .end0 |
281 | shr eax,7 |
281 | shr eax,7 |
282 | add eax,256 |
282 | add eax,256 |
283 | .end0: |
283 | .end0: |
284 | movzx eax,byte[eax+_dist_code] |
284 | movzx eax,byte[eax+_dist_code] |
285 | } |
285 | } |
Line 287... | Line 287... | ||
287 | ; must not have side effects. _dist_code[256] and _dist_code[257] are never |
287 | ; must not have side effects. _dist_code[256] and _dist_code[257] are never |
288 | ; used. |
288 | ; used. |
Line 289... | Line 289... | ||
289 | 289 | ||
290 | macro _tr_tally_lit s, c, flush |
290 | macro _tr_tally_lit s, c, flush |
291 | { |
- | |
292 | local .end0 |
291 | { |
293 | if DEBUG eq 0 |
292 | if DEBUG eq 0 |
294 | ; Inline versions of _tr_tally for speed: |
293 | ; Inline versions of _tr_tally for speed: |
295 | if c eq eax |
294 | if c eq eax |
296 | else |
295 | else |
Line 304... | Line 303... | ||
304 | mov ecx,[s+deflate_state.last_lit] |
303 | mov ecx,[s+deflate_state.last_lit] |
305 | add ecx,[s+deflate_state.l_buf] |
304 | add ecx,[s+deflate_state.l_buf] |
306 | mov byte[ecx],al |
305 | mov byte[ecx],al |
307 | inc dword[s+deflate_state.last_lit] |
306 | inc dword[s+deflate_state.last_lit] |
308 | and eax,0xff |
307 | and eax,0xff |
309 | imul eax,sizeof.ct_data |
- | |
310 | inc word[s+eax+deflate_state.dyn_ltree+Freq] |
308 | inc word[s+sizeof.ct_data*eax+deflate_state.dyn_ltree+Freq] |
311 | xor eax,eax |
309 | xor eax,eax |
312 | mov ecx,[s+deflate_state.lit_bufsize] |
310 | mov ecx,[s+deflate_state.lit_bufsize] |
313 | dec ecx |
311 | dec ecx |
314 | cmp [s+deflate_state.last_lit],ecx |
312 | cmp [s+deflate_state.last_lit],ecx |
315 | jne .end0 |
- | |
316 | inc eax ;flush = (..==..) |
313 | sete al ;flush = (..==..) |
317 | .end0: |
- | |
318 | mov flush, eax |
314 | mov flush, eax |
319 | pop ecx |
315 | pop ecx |
320 | else |
316 | else |
321 | stdcall _tr_tally, s, 0, c |
317 | stdcall _tr_tally, s, 0, c |
322 | mov flush, eax |
318 | mov flush, eax |
323 | end if |
319 | end if |
324 | } |
320 | } |
325 | macro _tr_tally_dist s, distance, length, flush |
321 | macro _tr_tally_dist s, distance, length, flush |
326 | { |
322 | { |
327 | if 0 ;;;DEBUG eq 0 |
323 | if DEBUG eq 0 |
328 | push ecx |
324 | push ecx |
329 | ; uch len = (length) |
- | |
330 | if distance eq eax |
- | |
331 | else |
325 | |
332 | mov eax,distance |
326 | ;s.d_buf[s.last_lit] = dist |
333 | end if |
- | |
334 | mov ecx,[s+deflate_state.last_lit] |
327 | mov ecx,[s+deflate_state.last_lit] |
335 | shl ecx,1 |
328 | shl ecx,1 |
336 | add ecx,[s+deflate_state.d_buf] |
329 | add ecx,[s+deflate_state.d_buf] |
- | 330 | if distance eq eax |
|
337 | mov word[ecx],ax |
331 | mov [ecx],ax |
- | 332 | else |
|
- | 333 | mov word[ecx],distance |
|
- | 334 | end if |
|
- | 335 | ||
- | 336 | ;s.l_buf[s.last_lit++] = len |
|
338 | mov ecx,[s+deflate_state.last_lit] |
337 | mov ecx,[s+deflate_state.last_lit] |
339 | add ecx,[s+deflate_state.l_buf] |
338 | add ecx,[s+deflate_state.l_buf] |
- | 339 | if length eq eax |
|
- | 340 | mov [ecx],al |
|
- | 341 | else if length eq ebx |
|
- | 342 | mov [ecx],bl |
|
- | 343 | else |
|
340 | mov byte[ecx],length |
344 | ... ;mov byte[ecx],length |
- | 345 | end if |
|
341 | inc dword[s+deflate_state.last_lit] |
346 | inc dword[s+deflate_state.last_lit] |
- | 347 | ||
- | 348 | ;dist-- |
|
- | 349 | if distance eq eax |
|
- | 350 | else |
|
- | 351 | mov eax,distance |
|
- | 352 | end if |
|
342 | dec eax |
353 | dec eax |
- | 354 | ||
343 | ; s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; |
355 | ;s.dyn_ltree[_length_code[len]+LITERALS+1].Freq++ |
- | 356 | movzx ecx,byte[ecx] |
|
- | 357 | movzx ecx,byte[ecx+_length_code] |
|
- | 358 | inc word[s+sizeof.ct_data*ecx+deflate_state.dyn_ltree+sizeof.ct_data*(LITERALS+1)+Freq] |
|
- | 359 | ||
344 | ; s->dyn_dtree[d_code(dist)].Freq++; |
360 | ;s.dyn_dtree[d_code(dist)].Freq++ |
- | 361 | d_code eax |
|
- | 362 | inc word[s+sizeof.ct_data*eax+deflate_state.dyn_dtree+Freq] |
|
- | 363 | ||
345 | ; flush = (s->last_lit == s->lit_bufsize-1); |
364 | ;flush = (s.last_lit == s.lit_bufsize-1) |
- | 365 | mov ecx,[s+deflate_state.lit_bufsize] |
|
- | 366 | dec ecx |
|
- | 367 | xor eax,eax |
|
- | 368 | cmp [s+deflate_state.last_lit],ecx |
|
- | 369 | sete al |
|
- | 370 | mov flush,eax |
|
346 | pop ecx |
371 | pop ecx |
347 | else |
372 | else |
348 | stdcall _tr_tally, s, distance, length |
373 | stdcall _tr_tally, s, distance, length |
349 | mov flush, eax |
374 | mov flush, eax |
350 | end if |
375 | end if |