/programs/fs/kfar/trunk/zlib/deflate.asm |
---|
162,8 → 162,9 |
push ebx |
mov ebx,[s+deflate_state.w_mask] |
and ebx,str |
shl ebx,2 |
add ebx,[s+deflate_state.prev] |
mov byte[ebx],al |
mov [ebx],eax |
pop ebx |
end if |
mov eax,[s+deflate_state.ins_h] |
179,13 → 180,13 |
macro CLEAR_HASH s |
{ |
;mov eax,[s+deflate_state.hash_size] |
;dec eax |
;shl eax,2 |
;add eax,[s+deflate_state.head] |
;mov dword[eax],NIL |
mov eax,[s+deflate_state.hash_size] |
dec eax |
shl eax,2 |
add eax,[s+deflate_state.head] |
mov dword[eax],NIL |
mov eax,[s+deflate_state.hash_size] |
dec eax |
;dec eax |
shl eax,2 ;sizeof(*s.head) |
stdcall zmemzero, [s+deflate_state.head], eax |
} |
587,7 → 588,6 |
end if |
mov dword[ebx+z_stream.adler],eax |
mov dword[edi+deflate_state.last_flush],Z_NO_FLUSH |
stdcall _tr_init, edi |
mov eax,Z_OK |
1925,6 → 1925,8 |
sub ecx,edi |
jz @f |
repe cmpsb |
dec edi |
dec esi |
@@: |
mov eax,[edx+deflate_state.window_size] |
1968,6 → 1970,7 |
dec dword[chain_length] |
cmp dword[chain_length],0 |
jne .cycle0 |
align 4 |
.cycle0end: ;while (..>.. && ..!=0) |
mov eax,[edx+deflate_state.lookahead] |
2281,6 → 2284,7 |
jge .cycle0end |
cmp dword[edx+z_stream.avail_in],0 |
jne .cycle0 |
align 4 |
.cycle0end: ;while (..<.. && ..!=..) |
; If the WIN_INIT bytes after the end of the current data have never been |
2411,12 → 2415,12 |
mov eax,[edi+deflate_state.pending_buf_size] |
sub eax,5 |
cmp ecx,eax |
jle @f ;if (..>..) |
jle .cycle0 ;if (..>..) |
mov ecx,eax |
@@: |
;ecx = max_block_size |
; Copy as much as possible from input to output: |
align 4 |
.cycle0: ;for (;;) { |
; Fill the window as much as possible: |
cmp dword[edi+deflate_state.lookahead],1 |
2435,7 → 2439,10 |
cmp dword[edi+deflate_state.lookahead],0 |
je .cycle0end ;if (..==0) break ;flush the current block |
.end0: |
; Assert(s->block_start >= 0, "block gone"); |
cmp dword[edi+deflate_state.block_start],0 |
jge @f |
zlib_assert 'block gone' ;Assert(..>=0) |
@@: |
mov eax,[edi+deflate_state.lookahead] |
add [edi+deflate_state.strstart],eax |
2823,6 → 2830,7 |
dec dword[edi+deflate_state.lookahead] |
;.end4: |
jmp .cycle0 |
align 4 |
.cycle0end: |
cmp dword[flush],Z_NO_FLUSH |
jne @f |
/programs/fs/kfar/trunk/zlib/deflate.inc |
---|
46,7 → 46,7 |
; Stream status |
; Data structure describing a single value and its code string. |
struct ct_data ;ct_data_s |
struct ct_data |
fc dw ? ;union |
;uint_16 freq ;frequency count |
;uint_16 code ;bit string |
60,7 → 60,7 |
Dad equ ct_data.dale ;.dad |
Len equ ct_data.dale ;.len |
struct tree_desc ;tree_desc_s |
struct tree_desc |
dyn_tree dd ? ;ct_data * ;the dynamic tree |
max_code dd ? ;int ;largest code with non zero frequency |
stat_desc dd ? ;static_tree_desc * ;the corresponding static tree |
80,6 → 80,7 |
gzhead dd ? ;gz_headerp ;gzip header information to write |
gzindex dd ? ;uInt ;where in extra, name, or comment |
method db ? ;Byte ;can only be DEFLATED |
rb 3 ;for align |
last_flush dd ? ;int ;value of flush param for previous deflate call |
; used by deflate.asm: |
171,7 → 172,7 |
; The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. |
; The same heap array is used to build all trees. |
depth rb 2*L_CODES+1 ;uch[] |
depth rb ((2*L_CODES+1)+3) and (not 3) ;uch[] |
; Depth of each subtree used as tie breaker for trees of equal frequency |
l_buf dd ? ;uchf * ;buffer for literals or lengths |
237,9 → 238,6 |
macro put_byte s, c |
{ |
;xor eax,eax |
;mov al,c |
;zlib_debug '(%d)',eax |
movzx eax,word[s+deflate_state.pending] |
add eax,[s+deflate_state.pending_buf] |
mov byte[eax],c |
/programs/fs/kfar/trunk/zlib/trees.asm |
---|
386,7 → 386,7 |
; Initialize the tree data structures for a new zlib stream. |
;void (s) |
; deflate_state* s; |
; deflate_state* s |
align 4 |
proc _tr_init uses eax edi, s:dword |
mov edi,[s] |
425,7 → 425,6 |
; deflate_state* s |
align 4 |
proc init_block uses eax ecx edi, s:dword |
; int n ;iterates over tree elements |
mov edi,[s] |
; Initialize the trees. |
451,8 → 450,7 |
add eax,sizeof.ct_data |
loop @b |
mov ecx,sizeof.ct_data*END_BLOCK+deflate_state.dyn_ltree+Freq |
mov word[ecx+edi],1 |
mov word[edi+sizeof.ct_data*END_BLOCK+deflate_state.dyn_ltree+Freq],1 |
mov dword[edi+deflate_state.static_len],0 |
mov dword[edi+deflate_state.opt_len],0 |
mov dword[edi+deflate_state.matches],0 |
1357,13 → 1355,11 |
mov eax,edi |
add eax,deflate_state.dyn_ltree |
stdcall scan_tree, edi, eax, [edi+deflate_state.l_desc.max_code] |
mov eax,edi |
add eax,deflate_state.dyn_dtree |
add eax,deflate_state.dyn_dtree-deflate_state.dyn_ltree |
stdcall scan_tree, edi, eax, [edi+deflate_state.d_desc.max_code] |
; Build the bit length tree: |
mov eax,edi |
add eax,deflate_state.bl_desc |
add eax,deflate_state.bl_desc-deflate_state.dyn_dtree |
stdcall build_tree, edi, eax |
; opt_len now includes the length of the tree representations, except |
; the lengths of the bit lengths codes and the 5+5+4 bits for the counts. |
1506,7 → 1502,7 |
; Flush the bits in the bit buffer to pending output (leaves at most 7 bits) |
;void (s) |
; deflate_state* s; |
; deflate_state* s |
align 4 |
proc _tr_flush_bits, s:dword |
stdcall bi_flush, [s] |
1745,13 → 1741,11 |
add eax,LITERALS+1 |
imul eax,sizeof.ct_data |
add eax,edi |
add eax,deflate_state.dyn_ltree+Freq |
inc word[eax] |
inc word[eax+deflate_state.dyn_ltree+Freq] |
d_code [dist] |
imul eax,sizeof.ct_data |
add eax,edi |
add eax,deflate_state.dyn_dtree+Freq |
inc word[eax] |
inc word[eax+deflate_state.dyn_dtree+Freq] |
.end0: |
if TRUNCATE_BLOCK eq 1 |
1795,7 → 1789,7 |
; Send the block data compressed using the given Huffman trees |
;void (s, ltree, dtree) |
; deflate_state* s; |
; deflate_state* s |
; ct_data *ltree ;literal tree |
; ct_data *dtree ;distance tree |
align 4 |
1952,7 → 1946,7 |
.end0: |
mov ecx,32 |
mov ebx,edi |
add ebx,deflate_state.dyn_ltree+Freq |
add ebx,deflate_state.dyn_ltree+Freq+32*sizeof.ct_data |
.cycle1: |
cmp ecx,LITERALS |
jge .cycle1end ;for (..;..<..;..,..) |
/programs/fs/kfar/trunk/zlib/zlib.asm |
---|
3,7 → 3,7 |
include '../../../../macros.inc' |
include '../../../../KOSfuncs.inc' |
FASTEST equ 1 |
FASTEST equ 0 |
GEN_TREES_H equ 0 |
DEBUG equ 0 |
DYNAMIC_CRC_TABLE equ 1 |