optimize struct 'z_stream'
git-svn-id: svn://kolibrios.org@6797 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -81,7 +81,7 @@ proc png_set_packswap uses edi, png_ptr:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr, png_const_color_8p true_bits)
|
||||
;void (png_structrp png_ptr, png_color_8p true_bits)
|
||||
align 4
|
||||
proc png_set_shift uses ecx edi, png_ptr:dword, true_bits:dword
|
||||
png_debug 1, 'in png_set_shift'
|
||||
@@ -139,8 +139,7 @@ proc png_set_filler uses eax edi, png_ptr:dword, filler:dword, filler_loc:dword
|
||||
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_IS_READ_STRUCT
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
if PNG_READ_FILLER_SUPPORTED eq 1
|
||||
; On read png_set_filler is always valid, regardless of the base PNG
|
||||
; format, because other transformations can give a format where the
|
||||
@@ -229,8 +228,7 @@ proc png_set_add_alpha uses eax edi, png_ptr:dword, filler:dword, filler_loc:dwo
|
||||
; The above may fail to do anything.
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_FILLER
|
||||
cmp eax,0
|
||||
je .end_f ;if (..!=0)
|
||||
jz .end_f ;if (..!=0)
|
||||
or dword[edi+png_struct.transformations],PNG_ADD_ALPHA
|
||||
.end_f:
|
||||
ret
|
||||
@@ -244,8 +242,7 @@ proc png_set_swap_alpha uses edi, png_ptr:dword
|
||||
mov edi,[png_ptr]
|
||||
cmp edi,0
|
||||
je .end_f ;if (..==0) return
|
||||
|
||||
; png_ptr->transformations |= PNG_SWAP_ALPHA;
|
||||
or dword[edi+png_struct.transformations], PNG_SWAP_ALPHA
|
||||
.end_f:
|
||||
ret
|
||||
endp
|
||||
@@ -259,8 +256,7 @@ proc png_set_invert_alpha uses edi, png_ptr:dword
|
||||
mov edi,[png_ptr]
|
||||
cmp edi,0
|
||||
je .end_f ;if (..==0) return
|
||||
|
||||
; png_ptr->transformations |= PNG_INVERT_ALPHA;
|
||||
or dword[edi+png_struct.transformations], PNG_INVERT_ALPHA
|
||||
.end_f:
|
||||
ret
|
||||
endp
|
||||
@@ -273,8 +269,7 @@ proc png_set_invert_mono uses edi, png_ptr:dword
|
||||
mov edi,[png_ptr]
|
||||
cmp edi,0
|
||||
je .end_f ;if (..==0) return
|
||||
|
||||
; png_ptr->transformations |= PNG_INVERT_MONO;
|
||||
or dword[edi+png_struct.transformations], PNG_INVERT_MONO
|
||||
.end_f:
|
||||
ret
|
||||
endp
|
||||
@@ -815,12 +810,10 @@ proc png_set_user_transform_info uses eax edi, png_ptr:dword, user_transform_ptr
|
||||
if PNG_READ_USER_TRANSFORM_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_IS_READ_STRUCT
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov eax,[edi+png_struct.flags]
|
||||
and eax,PNG_FLAG_ROW_INIT
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0 && ..!=0)
|
||||
jz @f ;if (..!=0 && ..!=0)
|
||||
cStr ,'info change after png_start_read_image or png_read_update_info'
|
||||
stdcall png_app_error, edi, eax
|
||||
jmp .end_f
|
||||
@@ -842,7 +835,7 @@ endp
|
||||
; associated with this pointer before png_write_destroy and png_read_destroy
|
||||
; are called.
|
||||
|
||||
;voidp (png_const_structrp png_ptr)
|
||||
;voidp (png_structrp png_ptr)
|
||||
align 4
|
||||
proc png_get_user_transform_ptr, png_ptr:dword
|
||||
mov eax,[png_ptr]
|
||||
@@ -853,7 +846,7 @@ proc png_get_user_transform_ptr, png_ptr:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
;uint_32 (png_const_structrp png_ptr)
|
||||
;uint_32 (png_structrp png_ptr)
|
||||
align 4
|
||||
proc png_get_current_row_number, png_ptr:dword
|
||||
; See the comments in png.inc - this is the sub-image row when reading an
|
||||
@@ -870,7 +863,7 @@ proc png_get_current_row_number, png_ptr:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
;byte (png_const_structrp png_ptr)
|
||||
;byte (png_structrp png_ptr)
|
||||
align 4
|
||||
proc png_get_current_pass_number, png_ptr:dword
|
||||
mov eax,[png_ptr]
|
||||
|
@@ -2939,19 +2939,18 @@ align 4
|
||||
xor ecx,ecx
|
||||
align 4
|
||||
.cycle4:
|
||||
mov word[edi+png_struct.zstream.avail_out],16*1024
|
||||
mov dword[edi+png_struct.zstream.avail_out],16*1024
|
||||
|
||||
stdcall [deflate], esi, Z_FINISH ;Z_NO_FLUSH
|
||||
cmp eax,Z_STREAM_ERROR
|
||||
je .end1
|
||||
|
||||
add ecx,16*1024
|
||||
movzx eax,word[edi+png_struct.zstream.avail_out]
|
||||
sub ecx,eax
|
||||
cmp word[edi+png_struct.zstream.avail_out],0
|
||||
sub ecx,[edi+png_struct.zstream.avail_out]
|
||||
cmp dword[edi+png_struct.zstream.avail_out],0
|
||||
je .cycle4 ;while (strm.avail_out == 0)
|
||||
if 0
|
||||
mov word[edi+png_struct.zstream.avail_out],16*1024
|
||||
mov dword[edi+png_struct.zstream.avail_out],16*1024
|
||||
stdcall [deflate], esi, Z_FINISH
|
||||
cmp eax,Z_STREAM_ERROR
|
||||
je .end1
|
||||
|
@@ -509,7 +509,7 @@ end if
|
||||
mov dword[edi+png_struct.zstream.next_in],0
|
||||
mov dword[edi+png_struct.zstream.avail_in],0
|
||||
mov dword[edi+png_struct.zstream.next_out],0
|
||||
mov word[edi+png_struct.zstream.avail_out],0
|
||||
mov dword[edi+png_struct.zstream.avail_out],0
|
||||
|
||||
; Now initialize if required, setting the new parameters, otherwise just
|
||||
; to a simple reset to the previous parameters.
|
||||
@@ -643,7 +643,7 @@ endl
|
||||
add eax,compression_state.output
|
||||
mov [edi+png_struct.zstream.next_out],eax
|
||||
mov eax,sizeof.compression_state.output ;1024
|
||||
mov [edi+png_struct.zstream.avail_out],ax
|
||||
mov [edi+png_struct.zstream.avail_out],eax
|
||||
|
||||
mov [output_len],eax
|
||||
|
||||
@@ -659,7 +659,7 @@ endl
|
||||
mov eax,[avail_in]
|
||||
mov [edi+png_struct.zstream.avail_in],eax
|
||||
|
||||
cmp word[edi+png_struct.zstream.avail_out],0
|
||||
cmp dword[edi+png_struct.zstream.avail_out],0
|
||||
jne .end0 ;if (..==0)
|
||||
; Chunk data is limited to 2^31 bytes in length, so the prefix
|
||||
; length must be counted here.
|
||||
@@ -699,7 +699,7 @@ endl
|
||||
mov eax,[eax+png_compression_buffer.output]
|
||||
mov [edi+png_struct.zstream.next_out],eax
|
||||
mov eax,[edi+png_struct.zbuffer_size]
|
||||
mov [edi+png_struct.zstream.avail_out],ax
|
||||
mov [edi+png_struct.zstream.avail_out],eax
|
||||
add [output_len],eax
|
||||
|
||||
; Move 'end' to the next buffer pointer.
|
||||
@@ -733,9 +733,9 @@ endl
|
||||
; There may be some space left in the last output buffer. This needs to
|
||||
; be subtracted from output_len.
|
||||
|
||||
movzx eax,word[edi+png_struct.zstream.avail_out]
|
||||
mov eax,[edi+png_struct.zstream.avail_out]
|
||||
sub [output_len],eax
|
||||
mov word[edi+png_struct.zstream.avail_out],0 ;safety
|
||||
mov dword[edi+png_struct.zstream.avail_out],0 ;safety
|
||||
mov eax,[output_len]
|
||||
mov [ebx+compression_state.output_len],eax
|
||||
|
||||
@@ -1216,7 +1216,7 @@ proc png_compress_IDAT uses eax ebx ecx edx, input:dword, input_len:dword, flush
|
||||
add eax,png_compression_buffer.output
|
||||
mov [edi+png_struct.zstream.next_out],eax
|
||||
mov eax,[edi+png_struct.zbuffer_size]
|
||||
mov [edi+png_struct.zstream.avail_out],ax
|
||||
mov [edi+png_struct.zstream.avail_out],eax
|
||||
.end0:
|
||||
|
||||
; Now loop reading and writing until all the input is consumed or an error
|
||||
@@ -1258,7 +1258,7 @@ align 4
|
||||
; that these two zstream fields are preserved across the calls, therefore
|
||||
; there is no need to set these up on entry to the loop.
|
||||
|
||||
cmp word[edi+png_struct.zstream.avail_out],0
|
||||
cmp dword[edi+png_struct.zstream.avail_out],0
|
||||
jne .end2 ;if (..==0)
|
||||
mov edx,[edi+png_struct.zbuffer_list]
|
||||
add edx,png_compression_buffer.output
|
||||
@@ -1283,7 +1283,7 @@ end if
|
||||
or dword[edi+png_struct.mode],PNG_HAVE_IDAT
|
||||
|
||||
mov [edi+png_struct.zstream.next_out],edx
|
||||
mov [edi+png_struct.zstream.avail_out],cx
|
||||
mov [edi+png_struct.zstream.avail_out],ecx
|
||||
|
||||
; For SYNC_FLUSH or FINISH it is essential to keep calling zlib with
|
||||
; the same flush parameter until it has finished output, for NO_FLUSH
|
||||
@@ -1321,7 +1321,7 @@ end if
|
||||
mov edx,[edi+png_struct.zbuffer_list]
|
||||
add edx,png_compression_buffer.output
|
||||
mov ecx,[edi+png_struct.zbuffer_size]
|
||||
movzx eax,word[edi+png_struct.zstream.avail_out]
|
||||
mov eax,[edi+png_struct.zstream.avail_out]
|
||||
sub ecx,eax
|
||||
;edx = data
|
||||
;ecx = size
|
||||
@@ -1337,7 +1337,7 @@ if PNG_WRITE_OPTIMIZE_CMF_SUPPORTED eq 1
|
||||
@@:
|
||||
end if
|
||||
stdcall png_write_complete_chunk, edi, png_IDAT, edx, ecx
|
||||
mov word[edi+png_struct.zstream.avail_out],0
|
||||
mov dword[edi+png_struct.zstream.avail_out],0
|
||||
mov dword[edi+png_struct.zstream.next_out],0
|
||||
or dword[edi+png_struct.mode], PNG_HAVE_IDAT or PNG_AFTER_IDAT
|
||||
|
||||
|
Reference in New Issue
Block a user