small fixes

git-svn-id: svn://kolibrios.org@6881 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2017-03-31 18:34:26 +00:00
parent ff31272774
commit ff3cee003b
8 changed files with 94 additions and 103 deletions

View File

@ -10,10 +10,9 @@
; For conditions of distribution and use, see the disclaimer ; For conditions of distribution and use, see the disclaimer
; and license in png.inc ; and license in png.inc
crc_table rd 256 DEBUG equ 0
include '../../../../../../KOSfuncs.inc' include '../../../../../../KOSfuncs.inc'
include '../../../../../../fs/kfar/trunk/kfar_arc/crc.inc'
include '../../../../../../fs/kfar/trunk/zlib/deflate.inc' include '../../../../../../fs/kfar/trunk/zlib/deflate.inc'
include 'pngtokos.inc' ;integrate png to kos include 'pngtokos.inc' ;integrate png to kos
@ -1294,8 +1293,8 @@ proc png_colorspace_sync uses ecx edi esi, png_ptr:dword, info_ptr:dword
je @f ;if (..==0) ;reduce code size; check here not in the caller je @f ;if (..==0) ;reduce code size; check here not in the caller
mov ecx,sizeof.png_colorspace mov ecx,sizeof.png_colorspace
mov esi,[png_ptr] mov esi,[png_ptr]
mov esi,[esi+png_struct.colorspace] add esi,png_struct.colorspace
mov edi,[edi+png_info_def.colorspace] add edi,png_info_def.colorspace
rep movsb rep movsb
stdcall png_colorspace_sync_info, [png_ptr], [info_ptr] stdcall png_colorspace_sync_info, [png_ptr], [info_ptr]
@@: @@:

View File

@ -554,6 +554,7 @@ if (PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED eq 1) | (PNG_USER_CHUNKS_SUPPORTED eq 1)
struct png_unknown_chunk struct png_unknown_chunk
name rb 5 ;byte[5] ;Textual chunk name with '\0' terminator name rb 5 ;byte[5] ;Textual chunk name with '\0' terminator
rb 3 ;align
podata dd ? ;byte* ;Data, should not be modified on read! podata dd ? ;byte* ;Data, should not be modified on read!
size dd ? ;png_size_t size dd ? ;png_size_t

View File

@ -1183,16 +1183,16 @@ if PNG_WRITE_SUPPORTED eq 1
end if end if
; { ; {
if PNG_SEQUENTIAL_READ_SUPPORTED eq 1 if PNG_SEQUENTIAL_READ_SUPPORTED eq 1
; return png_ptr->IDAT_read_size; mov eax,[eax+png_struct.IDAT_read_size]
else else
mov eax,PNG_IDAT_READ_SIZE mov eax,PNG_IDAT_READ_SIZE
jmp .end_f
end if end if
; } ; }
if PNG_WRITE_SUPPORTED eq 1 if PNG_WRITE_SUPPORTED eq 1
jmp .end_f
; else ; else
; return png_ptr->zbuffer_size; mov eax,[eax+png_struct.zbuffer_size]
end if end if
.end_f: .end_f:
ret ret

View File

@ -135,8 +135,7 @@ if PNG_sBIT_SUPPORTED eq 1
sig_bit png_color_8 ; significant bits in color channels sig_bit png_color_8 ; significant bits in color channels
end if end if
;#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \ if (PNG_tRNS_SUPPORTED eq 1) | (PNG_READ_EXPAND_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1)
;defined(PNG_READ_BACKGROUND_SUPPORTED)
; The tRNS chunk supplies transparency data for paletted images and ; The tRNS chunk supplies transparency data for paletted images and
; other image types that don't need a full alpha channel. There are ; other image types that don't need a full alpha channel. There are
; "num_trans" transparency values for a paletted image, stored in the ; "num_trans" transparency values for a paletted image, stored in the
@ -148,7 +147,7 @@ end if
trans_alpha dd ? ;bytep ; alpha values for paletted image trans_alpha dd ? ;bytep ; alpha values for paletted image
trans_color png_color_16 ;transparent color for non-palette image trans_color png_color_16 ;transparent color for non-palette image
;end if end if
if (PNG_bKGD_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) if (PNG_bKGD_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1)
; The bKGD chunk gives the suggested image background color if the ; The bKGD chunk gives the suggested image background color if the

View File

@ -126,7 +126,7 @@ end if ;COLORSPACE || GAMMA
struct png_struct struct png_struct
if PNG_SETJMP_SUPPORTED eq 1 if PNG_SETJMP_SUPPORTED eq 1
jmp_buf_local dd ? ;jmp_buf ;New name in 1.6.0 for jmp_buf in png_struct jmp_buf_local rb 64 ;jmp_buf ;New name in 1.6.0 for jmp_buf in png_struct
longjmp_fn dd ? ;png_longjmp_ptr ;setjmp non-local goto function. longjmp_fn dd ? ;png_longjmp_ptr ;setjmp non-local goto function.
jmp_buf_ptr dd ? ;jmp_buf * ;passed to longjmp_fn jmp_buf_ptr dd ? ;jmp_buf * ;passed to longjmp_fn
jmp_buf_size dd ? ;size_t ;size of the above, if allocated jmp_buf_size dd ? ;size_t ;size of the above, if allocated
@ -154,6 +154,7 @@ if (PNG_READ_USER_TRANSFORM_SUPPORTED eq 1) | (PNG_WRITE_USER_TRANSFORM_SUPPORTE
user_transform_ptr dd ? ;voidp ;user supplied struct for user transform user_transform_ptr dd ? ;voidp ;user supplied struct for user transform
user_transform_depth db ? ;byte ;bit depth of user transformed pixels user_transform_depth db ? ;byte ;bit depth of user transformed pixels
user_transform_channels db ? ;byte ;channels in user transformed pixels user_transform_channels db ? ;byte ;channels in user transformed pixels
rb 2 ;align
end if end if
end if end if
@ -216,7 +217,7 @@ end if
crc dd ? ;uint_32 ;current chunk CRC value crc dd ? ;uint_32 ;current chunk CRC value
palette dd ? ;png_colorp ;palette from the input file palette dd ? ;png_colorp ;palette from the input file
num_palette dw ? ;uint_16 ;number of color entries in palette num_palette dw ? ;uint_16 ;number of color entries in palette
rb 2 ;align
; Added at libpng-1.5.10 ; Added at libpng-1.5.10
if PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED eq 1 if PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED eq 1
num_palette_max dd ? ;int ;maximum palette index found in IDAT num_palette_max dd ? ;int ;maximum palette index found in IDAT
@ -237,20 +238,23 @@ end if
sig_bytes db ? ;byte ;magic bytes read/written from start of file sig_bytes db ? ;byte ;magic bytes read/written from start of file
maximum_pixel_depth db ? ;byte ;pixel depth used for the row buffers maximum_pixel_depth db ? ;byte ;pixel depth used for the row buffers
transformed_pixel_depth db ? ;byte ;pixel depth after read/write transforms transformed_pixel_depth db ? ;byte ;pixel depth after read/write transforms
;#if PNG_ZLIB_VERNUM >= 0x1240 ;if PNG_ZLIB_VERNUM >= 0x1240
zstream_start db ? ;byte ;at start of an input zlib stream ;zstream_start db 1 ;byte ;at start of an input zlib stream
;end if /* Zlib >= 1.2.4 */ ;end if ;Zlib >= 1.2.4
if (PNG_READ_FILLER_SUPPORTED eq 1) | (PNG_WRITE_FILLER_SUPPORTED eq 1) if (PNG_READ_FILLER_SUPPORTED eq 1) | (PNG_WRITE_FILLER_SUPPORTED eq 1)
filler dw ? ;uint_16 ; filler bytes for pixel expansion filler dw ? ;uint_16 ;filler bytes for pixel expansion
end if end if
if (PNG_bKGD_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) | \ if (PNG_bKGD_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) | \
(PNG_READ_ALPHA_MODE_SUPPORTED eq 1) (PNG_READ_ALPHA_MODE_SUPPORTED eq 1)
background_gamma_type db ? ;byte background_gamma_type db ? ;byte
rb 1 ;align
background_gamma dd ? ;png_fixed_point background_gamma dd ? ;png_fixed_point
background png_color_16 ;background color in screen gamma space background png_color_16 ;background color in screen gamma space
rb 1 ;align
if PNG_READ_GAMMA_SUPPORTED eq 1 if PNG_READ_GAMMA_SUPPORTED eq 1
background_1 png_color_16 ;background normalized to gamma 1.0 background_1 png_color_16 ;background normalized to gamma 1.0
rb 1 ;align
end if end if
end if ;bKGD end if ;bKGD
@ -282,12 +286,14 @@ end if
if (PNG_READ_SHIFT_SUPPORTED eq 1) | (PNG_WRITE_SHIFT_SUPPORTED eq 1) if (PNG_READ_SHIFT_SUPPORTED eq 1) | (PNG_WRITE_SHIFT_SUPPORTED eq 1)
shift png_color_8 ;shift for significant bit tranformation shift png_color_8 ;shift for significant bit tranformation
rb 2 ;align
end if end if
if (PNG_tRNS_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) \ if (PNG_tRNS_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) \
| (PNG_READ_EXPAND_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) | (PNG_READ_EXPAND_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1)
trans_alpha dd ? ;bytep ;alpha values for paletted files trans_alpha dd ? ;bytep ;alpha values for paletted files
trans_color png_color_16 ;transparent color for non-paletted files trans_color png_color_16 ;transparent color for non-paletted files
rb 3 ;align
end if end if
read_row_fn dd ? ;png_read_status_ptr ;called after each row is decoded read_row_fn dd ? ;png_read_status_ptr ;called after each row is decoded
@ -325,6 +331,7 @@ end if
; To do: remove this from libpng-1.7 ; To do: remove this from libpng-1.7
if PNG_TIME_RFC1123_SUPPORTED eq 1 if PNG_TIME_RFC1123_SUPPORTED eq 1
time_buffer rb 29 ;char[29] ;String to hold RFC 1123 time text time_buffer rb 29 ;char[29] ;String to hold RFC 1123 time text
rb 2 ;align
end if end if
;end if ;end if
@ -355,6 +362,7 @@ if PNG_READ_RGB_TO_GRAY_SUPPORTED eq 1
rgb_to_gray_red_coeff dw ? ;uint_16 rgb_to_gray_red_coeff dw ? ;uint_16
rgb_to_gray_green_coeff dw ? ;uint_16 rgb_to_gray_green_coeff dw ? ;uint_16
; deleted in 1.5.5: rgb_to_gray_blue_coeff; ; deleted in 1.5.5: rgb_to_gray_blue_coeff;
rb 2 ;align
end if end if
if PNG_MNG_FEATURES_SUPPORTED eq 1 if PNG_MNG_FEATURES_SUPPORTED eq 1
@ -364,6 +372,7 @@ if PNG_MNG_FEATURES_SUPPORTED eq 1
; New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 ; New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0
filter_type db ? ;byte filter_type db ? ;byte
rb 3 ;align
end if end if
; New members added in libpng-1.2.0 ; New members added in libpng-1.2.0
@ -387,6 +396,7 @@ end if
; New members added in libpng-1.0.16 and 1.2.6 ; New members added in libpng-1.0.16 and 1.2.6
compression_type db ? ;byte compression_type db ? ;byte
rb 3 ;align
if PNG_USER_LIMITS_SUPPORTED eq 1 if PNG_USER_LIMITS_SUPPORTED eq 1
user_width_max dd ? ;uint_32 user_width_max dd ? ;uint_32
@ -408,7 +418,8 @@ if PNG_READ_UNKNOWN_CHUNKS_SUPPORTED eq 1
; Temporary storage for unknown chunk that the library doesn't recognize, ; Temporary storage for unknown chunk that the library doesn't recognize,
; used while reading the chunk. ; used while reading the chunk.
; png_unknown_chunk unknown_chunk; unknown_chunk png_unknown_chunk
rb 3 ;align
end if end if
; New member added in libpng-1.2.26 ; New member added in libpng-1.2.26
@ -431,9 +442,8 @@ end if
; New member added in libpng-1.5.6 ; New member added in libpng-1.5.6
big_prev_row dd ? ;bytep big_prev_row dd ? ;bytep
; New member added in libpng-1.5.7 ; New member added in libpng-1.5.7
; void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info, read_filter rd PNG_FILTER_VALUE_LAST-1
; bytep row, bytep prev_row);
if PNG_READ_SUPPORTED eq 1 if PNG_READ_SUPPORTED eq 1
if (PNG_COLORSPACE_SUPPORTED eq 1) | (PNG_GAMMA_SUPPORTED eq 1) if (PNG_COLORSPACE_SUPPORTED eq 1) | (PNG_GAMMA_SUPPORTED eq 1)

View File

@ -631,8 +631,8 @@ if PNG_USER_MEM_SUPPORTED eq 1
stdcall png_create_png_struct, [user_png_ver], [error_ptr], [error_fn], [warn_fn], 0, 0, 0 stdcall png_create_png_struct, [user_png_ver], [error_ptr], [error_fn], [warn_fn], 0, 0, 0
;eax = png_ptr ;eax = png_ptr
end if ;USER_MEM end if ;USER_MEM
cmp eax,0 test eax,eax
je .end0 ;if (..!=0) jz .end0 ;if (..!=0)
; Set the zlib control values to defaults; they can be overridden by the ; Set the zlib control values to defaults; they can be overridden by the
; application after the struct has been created. ; application after the struct has been created.
@ -1839,20 +1839,20 @@ proc png_image_write_init uses ebx ecx edx edi esi, image:dword
stdcall png_create_write_struct, PNG_LIBPNG_VER_STRING, ebx, png_safe_error, png_safe_warning stdcall png_create_write_struct, PNG_LIBPNG_VER_STRING, ebx, png_safe_error, png_safe_warning
;eax = png_ptr ;eax = png_ptr
cmp eax,0 test eax,eax
je .end0 ;if (..!=0) jz .end0 ;if (..!=0)
mov edi,eax mov edi,eax
stdcall png_create_info_struct, edi stdcall png_create_info_struct, edi
;eax = info_ptr ;eax = info_ptr
cmp eax,0 test eax,eax
je .end1 ;if (..!=0) jz .end1 ;if (..!=0)
mov esi,eax mov esi,eax
stdcall png_malloc_warn, edi, sizeof.png_control stdcall png_malloc_warn, edi, sizeof.png_control
;control = eax ;control = eax
cmp eax,0 test eax,eax
je .end2 ;if (..!=0) jz .end2 ;if (..!=0)
push eax push eax
mov edx,edi ; edx = png_ptr mov edx,edi ; edx = png_ptr
mov ecx,sizeof.png_control mov ecx,sizeof.png_control
@ -2745,8 +2745,8 @@ end if
stdcall png_free, edi, ecx stdcall png_free, edi, ecx
; Skip the 'write_end' on error: ; Skip the 'write_end' on error:
cmp eax,0 test eax,eax
je .end_f ;if (..==0) return 0 jz .end_f ;if (..==0) return 0
jmp .end8 jmp .end8
; Otherwise this is the case where the input is in a format currently ; Otherwise this is the case where the input is in a format currently
@ -2793,8 +2793,8 @@ png_debug 1, 'IDAT compress all'
;create buffer with filters ;create buffer with filters
stdcall png_zalloc, edi, 1, [len] stdcall png_zalloc, edi, 1, [len]
cmp eax,0 test eax,eax
je .end_f jz .end_f
mov [buf_f],eax mov [buf_f],eax
mov eax,ZLIB_IO_MAX mov eax,ZLIB_IO_MAX
@ -2803,8 +2803,8 @@ png_debug 1, 'IDAT compress all'
mov eax,[len] mov eax,[len]
@@: @@:
stdcall png_zalloc, edi, 1, eax stdcall png_zalloc, edi, 1, eax
cmp eax,0 test eax,eax
je .end0 jz .end0
mov [m1],eax mov [m1],eax
;init buffer with filters ;init buffer with filters
@ -3100,8 +3100,8 @@ endl
@@: @@:
stdcall png_image_write_init, ebx stdcall png_image_write_init, ebx
cmp eax,0 test eax,eax
je .end3 ;if (..!=0) jz .end3 ;if (..!=0)
mov ecx,sizeof.png_image_write_control mov ecx,sizeof.png_image_write_control
mov edi,ebp mov edi,ebp
sub edi,ecx sub edi,ecx

View File

@ -82,14 +82,14 @@ locals
buf rb 8 ;ebp-8 buf rb 8 ;ebp-8
endl endl
;#if defined(PNG_DEBUG) && (PNG_DEBUG > 0) if (PNG_DEBUG eq 1) & (PNG_DEBUG > 0)
; PNG_CSTRING_FROM_CHUNK(buf, chunk_name); ; PNG_CSTRING_FROM_CHUNK(buf, chunk_name);
; png_debug2(0, "Writing %s chunk, length = %lu", buf, (unsigned long)length); ; png_debug2(0, "Writing %s chunk, length = %lu", buf, (unsigned long)length);
;end if end if
mov edi,[png_ptr] mov edi,[png_ptr]
cmp edi,0 test edi,edi
je .end_f ;if (png_ptr == NULL) return jz .end_f ;if (..==0) return
if PNG_IO_STATE_SUPPORTED eq 1 if PNG_IO_STATE_SUPPORTED eq 1
; Inform the I/O callback that the chunk header is being written. ; Inform the I/O callback that the chunk header is being written.
@ -99,8 +99,7 @@ if PNG_IO_STATE_SUPPORTED eq 1
end if end if
; Write the length and the chunk name ; Write the length and the chunk name
mov ebx,ebp lea ebx,[ebp-8]
sub ebx,8
stdcall png_save_uint_32, ebx, [length] stdcall png_save_uint_32, ebx, [length]
m2m dword[ebx+4],dword[chunk_name] m2m dword[ebx+4],dword[chunk_name]
stdcall png_write_data, edi, ebx, 8 stdcall png_write_data, edi, ebx, 8
@ -110,9 +109,7 @@ end if
; Reset the crc and run it over the chunk name ; Reset the crc and run it over the chunk name
stdcall png_reset_crc, edi stdcall png_reset_crc, edi
lea ebx,[ebp-4] ;buf + 4
mov ebx,ebp
sub ebx,4 ;buf + 4
stdcall png_calculate_crc, edi, ebx, 4 stdcall png_calculate_crc, edi, ebx, 4
if PNG_IO_STATE_SUPPORTED eq 1 if PNG_IO_STATE_SUPPORTED eq 1
@ -199,8 +196,8 @@ endp
align 4 align 4
proc png_write_complete_chunk uses edi, png_ptr:dword, chunk_name:dword, p3data:dword, length:dword proc png_write_complete_chunk uses edi, png_ptr:dword, chunk_name:dword, p3data:dword, length:dword
mov edi,[png_ptr] mov edi,[png_ptr]
cmp edi,0 test edi,edi
je .end_f ;if (..==0) return jz .end_f ;if (..==0) return
; On 64-bit architectures 'length' may not fit in a uint_32. ; On 64-bit architectures 'length' may not fit in a uint_32.
cmp dword[length],PNG_UINT_31_MAX ;if(..>..) cmp dword[length],PNG_UINT_31_MAX ;if(..>..)
@ -678,14 +675,14 @@ endl
mov eax,[edx] mov eax,[edx]
mov [next],eax mov [next],eax
cmp eax,0 test eax,eax
jne .end1 ;if (..==0) jnz .end1 ;if (..==0)
PNG_COMPRESSION_BUFFER_SIZE edi PNG_COMPRESSION_BUFFER_SIZE edi
stdcall png_malloc, edi, eax stdcall png_malloc, edi, eax
mov [next],eax mov [next],eax
cmp eax,0 test eax,eax
jne @f ;if (..==0) jnz @f ;if (..==0)
mov esi,Z_MEM_ERROR mov esi,Z_MEM_ERROR
jmp .cycle0end jmp .cycle0end
@@: @@:
@ -1180,6 +1177,7 @@ endp
align 4 align 4
proc png_compress_IDAT uses eax ebx ecx edx, input:dword, input_len:dword, flush:dword proc png_compress_IDAT uses eax ebx ecx edx, input:dword, input_len:dword, flush:dword
png_debug 1, 'in png_compress_IDAT' png_debug 1, 'in png_compress_IDAT'
cmp dword[edi+png_struct.zowner],png_IDAT cmp dword[edi+png_struct.zowner],png_IDAT
je .end0 ;if (..!=..) je .end0 ;if (..!=..)
; First time. Ensure we have a temporary buffer for compression and ; First time. Ensure we have a temporary buffer for compression and
@ -1232,7 +1230,7 @@ align 4
mov eax,ZLIB_IO_MAX mov eax,ZLIB_IO_MAX
cmp eax,[input_len] cmp eax,[input_len]
jle @f ;if (..>..) jbe @f ;if (..>..)
mov eax,[input_len] ;safe because of the check mov eax,[input_len] ;safe because of the check
@@: @@:
@ -1451,8 +1449,8 @@ endl
stdcall png_check_keyword, edi, [name], ebx stdcall png_check_keyword, edi, [name], ebx
mov [name_len],eax mov [name_len],eax
cmp eax,0 test eax,eax
jne @f ;if (..==0) jnz @f ;if (..==0)
png_error edi, 'iCCP: invalid keyword' png_error edi, 'iCCP: invalid keyword'
@@: @@:
@ -1955,8 +1953,8 @@ pushad
stdcall png_check_keyword, edi, [key], ebx stdcall png_check_keyword, edi, [key], ebx
mov [key_len],eax mov [key_len],eax
cmp eax,0 test eax,eax
jne @f ;if (..==0) jnz @f ;if (..==0)
png_error edi, 'iTXt: invalid keyword' png_error edi, 'iTXt: invalid keyword'
@@: @@:
@ -2103,8 +2101,8 @@ pushad
stdcall png_check_keyword, edi, [purpose], ebx stdcall png_check_keyword, edi, [purpose], ebx
mov [purpose_len],eax mov [purpose_len],eax
cmp eax,0 test eax,eax
jne @f ;if(..==0) jnz @f ;if(..==0)
png_error edi, 'pCAL: invalid keyword' png_error edi, 'pCAL: invalid keyword'
@@: @@:
@ -2460,8 +2458,6 @@ proc png_write_finish_row uses eax ecx edx edi, png_ptr:dword
; See if we are done ; See if we are done
mov eax,[edi+png_struct.row_number] mov eax,[edi+png_struct.row_number]
;png_debug1 2, ' row_number = %d', eax
;png_debug1 2, ' num_rows = %d', [edi+png_struct.num_rows]
cmp eax,[edi+png_struct.num_rows] cmp eax,[edi+png_struct.num_rows]
jl .end_f ;if (..<..) return jl .end_f ;if (..<..) return
@ -3063,13 +3059,17 @@ locals
endl endl
pushad pushad
mov edi,[png_ptr] mov edi,[png_ptr]
if PNG_WRITE_FILTER_SUPPORTED eq 1 if PNG_WRITE_FILTER_SUPPORTED eq 0
mov eax,[edi+png_struct.row_number]
png_debug1 2, ' (3)= %d', eax
mov eax,[edi+png_struct.rowbytes] mov eax,[edi+png_struct.rowbytes]
inc eax inc eax
stdcall png_write_filtered_row, edi, [edi+png_struct.row_buf], eax stdcall png_write_filtered_row, edi, [edi+png_struct.row_buf], eax
mov eax,[edi+png_struct.row_number]
png_debug1 2, ' (4)= %d', eax
else else
mov esi,[row_info] mov esi,[row_info]
mov eax,[edi+png_struct.do_filter] movzx eax,byte[edi+png_struct.do_filter]
mov [filter_to_do],eax mov [filter_to_do],eax
mov eax,[esi+png_row_info.rowbytes] mov eax,[esi+png_row_info.rowbytes]
mov [row_bytes],eax mov [row_bytes],eax
@ -3119,8 +3119,8 @@ else
mov eax,[edi+png_struct.row_buf] mov eax,[edi+png_struct.row_buf]
mov [best_row],eax mov [best_row],eax
cmp PNG_SIZE_MAX/128, dword[row_bytes] cmp dword[row_bytes],PNG_SIZE_MAX/128
jg @f ;if (..<=..) jl @f ;if (..>=..)
; Overflow can occur in the calculation, just select the lowest set ; Overflow can occur in the calculation, just select the lowest set
; filter. ; filter.
@ -3168,8 +3168,8 @@ else
mov [mins],eax mov [mins],eax
mov eax,[edi+png_struct.try_row] mov eax,[edi+png_struct.try_row]
mov [best_row],eax mov [best_row],eax
cmp eax,0 test eax,eax
je .end1 ;if (..!=0) jz .end1 ;if (..!=0)
mov eax,[edi+png_struct.tst_row] mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax mov [edi+png_struct.try_row],eax
mov eax,[best_row] mov eax,[best_row]
@ -3194,8 +3194,8 @@ else
mov [mins],eax mov [mins],eax
mov eax,[edi+png_struct.try_row] mov eax,[edi+png_struct.try_row]
mov [best_row],eax mov [best_row],eax
cmp eax,0 test eax,eax
je .end2 ;if (..!=0) jz .end2 ;if (..!=0)
mov eax,[edi+png_struct.tst_row] mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax mov [edi+png_struct.try_row],eax
mov eax,[best_row] mov eax,[best_row]
@ -3220,14 +3220,14 @@ else
mov [mins],eax mov [mins],eax
mov eax,[edi+png_struct.try_row] mov eax,[edi+png_struct.try_row]
mov [best_row],eax mov [best_row],eax
cmp eax,0 test eax,eax
je .end3 ;if (..!=0) jz .end3 ;if (..!=0)
mov eax,[edi+png_struct.tst_row] mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax mov [edi+png_struct.try_row],eax
mov eax,[best_row] mov eax,[best_row]
mov [edi+png_struct.tst_row],eax mov [edi+png_struct.tst_row],eax
.end3: .end3:
if 0 ;;; tmp
; Paeth filter ; Paeth filter
mov eax,[filter_to_do] mov eax,[filter_to_do]
cmp eax,PNG_FILTER_PAETH cmp eax,PNG_FILTER_PAETH
@ -3246,14 +3246,14 @@ else
mov [mins],eax mov [mins],eax
mov eax,[edi+png_struct.try_row] mov eax,[edi+png_struct.try_row]
mov [best_row],eax mov [best_row],eax
cmp eax,0 test eax,eax
je .end4 ;if (..!=0) jz .end4 ;if (..!=0)
mov eax,[edi+png_struct.tst_row] mov eax,[edi+png_struct.tst_row]
mov [edi+png_struct.try_row],eax mov [edi+png_struct.try_row],eax
mov eax,[best_row] mov eax,[best_row]
mov [edi+png_struct.tst_row],eax mov [edi+png_struct.tst_row],eax
.end4: .end4:
end if
; Do the actual writing of the filtered row data from the chosen filter. ; Do the actual writing of the filtered row data from the chosen filter.
mov eax,[esi+png_row_info.rowbytes] mov eax,[esi+png_row_info.rowbytes]
inc eax inc eax
@ -3281,8 +3281,8 @@ proc png_write_filtered_row uses eax ebx edi, png_ptr:dword, filtered_row:dword,
if PNG_WRITE_FILTER_SUPPORTED eq 1 if PNG_WRITE_FILTER_SUPPORTED eq 1
; Swap the current and previous rows ; Swap the current and previous rows
mov eax,[edi+png_struct.prev_row] mov eax,[edi+png_struct.prev_row]
cmp eax,0 test eax,eax
je @f ;if (..!=0) jz @f ;if (..!=0)
;eax = tptr ;eax = tptr
mov ebx,[edi+png_struct.row_buf] mov ebx,[edi+png_struct.row_buf]
mov [edi+png_struct.prev_row],ebx mov [edi+png_struct.prev_row],ebx

View File

@ -17,14 +17,10 @@
; Definitions for doing the crc four data bytes at a time. ; Definitions for doing the crc four data bytes at a time.
TBLS equ 1
if DYNAMIC_CRC_TABLE eq 1 if DYNAMIC_CRC_TABLE eq 1
align 4 align 4
crc_table_empty dd 1 crc_table_empty dd 1
;align 4
;crc_table rd TBLS*256
; Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: ; Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
; x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. ; x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
@ -100,15 +96,12 @@ end if
endp endp
; ========================================================================= ; =========================================================================
;unsigned long (crc, buf, len) ;unsigned long (unsigned long crc, unsigned char *buf, uInt len)
; unsigned long crc
; unsigned char *buf
; uInt len
align 4 align 4
proc calc_crc32 uses ecx esi, p1crc:dword, buf:dword, len:dword proc calc_crc32 uses ecx esi, p1crc:dword, buf:dword, len:dword
xor eax,eax xor eax,eax
mov esi,[buf] mov esi,[buf]
zlib_debug 'calc_crc32 buf = %d',esi
cmp esi,Z_NULL cmp esi,Z_NULL
je .end_f ;if (..==0) return 0 je .end_f ;if (..==0) return 0
@ -121,7 +114,9 @@ end if
mov eax,[p1crc] mov eax,[p1crc]
mov ecx,[len] mov ecx,[len]
push edx
call crc call crc
pop edx
.end_f: .end_f:
ret ret
endp endp
@ -129,9 +124,7 @@ endp
GF2_DIM equ 32 ;dimension of GF(2) vectors (length of CRC) GF2_DIM equ 32 ;dimension of GF(2) vectors (length of CRC)
; ========================================================================= ; =========================================================================
;unsigned long (mat, vec) ;unsigned long (unsigned long *mat, unsigned long vec)
; unsigned long *mat
; unsigned long vec
align 4 align 4
proc gf2_matrix_times, mat:dword, vec:dword proc gf2_matrix_times, mat:dword, vec:dword
; unsigned long sum; ; unsigned long sum;
@ -148,9 +141,7 @@ proc gf2_matrix_times, mat:dword, vec:dword
endp endp
; ========================================================================= ; =========================================================================
;local void (square, mat) ;local void (unsigned long *square, unsigned long *mat)
; unsigned long *square
; unsigned long *mat
align 4 align 4
proc gf2_matrix_square, square:dword, mat:dword proc gf2_matrix_square, square:dword, mat:dword
; int n; ; int n;
@ -161,10 +152,7 @@ proc gf2_matrix_square, square:dword, mat:dword
endp endp
; ========================================================================= ; =========================================================================
;uLong (crc1, crc2, len2) ;uLong (uLong crc1, uLong crc2, z_off64_t len2)
; uLong crc1
; uLong crc2
; z_off64_t len2
align 4 align 4
proc crc32_combine_, crc1:dword, crc2:dword, len2:dword proc crc32_combine_, crc1:dword, crc2:dword, len2:dword
; int n; ; int n;
@ -219,20 +207,14 @@ proc crc32_combine_, crc1:dword, crc2:dword, len2:dword
endp endp
; ========================================================================= ; =========================================================================
;uLong (crc1, crc2, len2) ;uLong (uLong crc1, uLong crc2, z_off_t len2)
; uLong crc1
; uLong crc2
; z_off_t len2
align 4 align 4
proc crc32_combine, crc1:dword, crc2:dword, len2:dword proc crc32_combine, crc1:dword, crc2:dword, len2:dword
stdcall crc32_combine_, [crc1], [crc2], [len2] stdcall crc32_combine_, [crc1], [crc2], [len2]
ret ret
endp endp
;uLong (crc1, crc2, len2) ;uLong (uLong crc1, uLong crc2, z_off64_t len2)
; uLong crc1
; uLong crc2
; z_off64_t len2
align 4 align 4
proc crc32_combine64, crc1:dword, crc2:dword, len2:dword proc crc32_combine64, crc1:dword, crc2:dword, len2:dword
stdcall crc32_combine_, [crc1], [crc2], [len2] stdcall crc32_combine_, [crc1], [crc2], [len2]