Rev 6733 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6733 | IgorA | 1 | |
2 | |||
3 | |||
4 | ; Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson |
||
5 | ; (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
||
6 | ; (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
||
7 | |||
8 | |||
9 | ; For conditions of distribution and use, see the disclaimer |
||
10 | ; and license in png.inc |
||
11 | |||
12 | |||
13 | |||
14 | ; The only people who need to care about what is inside of this are the |
||
15 | ; people who will be modifying the library for their own special needs. |
||
16 | ; It should NOT be accessed directly by an application. |
||
17 | |||
18 | |||
19 | |||
20 | ; in this structure and is required for decompressing the LZ compressed |
||
21 | ; data in PNG files. |
||
22 | |||
23 | |||
24 | |||
25 | |||
26 | ; can handle at once. This type need be no larger than 16 bits (so maximum of |
||
27 | ; 65535), this define allows us to discover how big it is, but limited by the |
||
28 | ; maximuum for png_size_t. The value can be overriden in a library build |
||
29 | ; (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably |
||
30 | ; lower value (e.g. 255 works). A lower value may help memory usage (slightly) |
||
31 | ; and may even improve performance on some systems (and degrade it on others.) |
||
32 | |||
33 | |||
34 | |||
35 | |||
36 | |||
37 | |||
38 | struct png_compression_buffer |
||
39 | next dd ? ;struct png_compression_buffer * |
||
40 | output db ? ;byte[1] ;actually zbuf_size |
||
41 | ends |
||
42 | |||
43 | |||
44 | { |
||
45 | mov eax,png_compression_buffer.output |
||
46 | add eax,[pp+png_struct.zbuffer_size] |
||
47 | } |
||
48 | |||
49 | |||
50 | ; functions to hold and communicate information about the color space. |
||
51 | |||
52 | |||
53 | ; colorspace corrections, otherwise all the colorspace information can be |
||
54 | ; skipped and the size of libpng can be reduced (significantly) by compiling |
||
55 | ; out the colorspace support. |
||
56 | |||
57 | |||
58 | ; The chromaticities of the red, green and blue colorants and the chromaticity |
||
59 | ; of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)). |
||
60 | |||
61 | |||
62 | redx dd ? ;png_fixed_point |
||
63 | redy dd ? |
||
64 | greenx dd ? |
||
65 | greeny dd ? |
||
66 | bluex dd ? |
||
67 | bluey dd ? |
||
68 | whitex dd ? |
||
69 | whitey dd ? |
||
70 | ends |
||
71 | |||
72 | |||
73 | ; from chromaticities the sum of the Y values is assumed to be 1.0 |
||
74 | |||
75 | |||
76 | red_X dd ? ;png_fixed_point |
||
77 | red_Y dd ? |
||
78 | red_Z dd ? |
||
79 | green_X dd ? |
||
80 | green_Y dd ? |
||
81 | green_Z dd ? |
||
82 | blue_X dd ? |
||
83 | blue_Y dd ? |
||
84 | blue_Z dd ? |
||
85 | ends |
||
86 | end if ;COLORSPACE |
||
87 | |||
88 | |||
89 | ; A colorspace is all the above plus, potentially, profile information; |
||
90 | ; however at present libpng does not use the profile internally so it is only |
||
91 | ; stored in the png_info struct (if iCCP is supported.) The rendering intent |
||
92 | ; is retained here and is checked. |
||
93 | |||
94 | |||
95 | ; is done by libpng, whereas color correction must currently be done by the |
||
96 | ; application. |
||
97 | |||
98 | |||
99 | if PNG_GAMMA_SUPPORTED eq 1 |
||
100 | gamma dd ? ;png_fixed_point ;File gamma |
||
101 | end if |
||
102 | |||
103 | |||
104 | end_points_xy png_xy ;End points as chromaticities |
||
105 | end_points_XYZ png_XYZ ;End points as CIE XYZ colorant values |
||
106 | rendering_intent dw ? ;uint_16 ;Rendering intent of a profile |
||
107 | end if |
||
108 | |||
109 | |||
110 | flags dw ? ;uint_16 ;As defined below |
||
111 | ends |
||
112 | |||
113 | |||
114 | PNG_COLORSPACE_HAVE_GAMMA equ 0x0001 |
||
115 | PNG_COLORSPACE_HAVE_ENDPOINTS equ 0x0002 |
||
116 | PNG_COLORSPACE_HAVE_INTENT equ 0x0004 |
||
117 | PNG_COLORSPACE_FROM_gAMA equ 0x0008 |
||
118 | PNG_COLORSPACE_FROM_cHRM equ 0x0010 |
||
119 | PNG_COLORSPACE_FROM_sRGB equ 0x0020 |
||
120 | PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB equ 0x0040 |
||
121 | PNG_COLORSPACE_MATCHES_sRGB equ 0x0080 ;exact match on profile |
||
122 | PNG_COLORSPACE_INVALID equ 0x8000 |
||
123 | macro PNG_COLORSPACE_CANCEL flags {(0xffff xor (flags))} |
||
124 | end if ;COLORSPACE || GAMMA |
||
125 | |||
126 | |||
127 | if PNG_SETJMP_SUPPORTED eq 1 |
||
128 | jmp_buf_local rb 64 ;jmp_buf ;New name in 1.6.0 for jmp_buf in png_struct |
||
6881 | IgorA | 129 | longjmp_fn dd ? ;png_longjmp_ptr ;setjmp non-local goto function. |
6733 | IgorA | 130 | jmp_buf_ptr dd ? ;jmp_buf * ;passed to longjmp_fn |
131 | jmp_buf_size dd ? ;size_t ;size of the above, if allocated |
||
132 | end if |
||
133 | error_fn dd ? ;png_error_ptr ;function for printing errors and aborting |
||
134 | if PNG_WARNINGS_SUPPORTED eq 1 |
||
135 | warning_fn dd ? ;png_error_ptr ;function for printing warnings |
||
136 | end if |
||
137 | error_ptr dd ? ;voidp ;user supplied struct for error functions |
||
138 | write_data_fn dd ? ;png_rw_ptr ;function for writing output data |
||
139 | read_data_fn dd ? ;png_rw_ptr ;function for reading input data |
||
140 | io_ptr dd ? ;voidp ;ptr to application struct for I/O functions |
||
141 | |||
142 | |||
143 | read_user_transform_fn dd ? ;png_user_transform_ptr ;user read transform |
||
144 | end if |
||
145 | |||
146 | |||
147 | write_user_transform_fn dd ? ;png_user_transform_ptr ; user write transform |
||
148 | end if |
||
149 | |||
150 | |||
151 | if PNG_USER_TRANSFORM_PTR_SUPPORTED eq 1 |
||
152 | if (PNG_READ_USER_TRANSFORM_SUPPORTED eq 1) | (PNG_WRITE_USER_TRANSFORM_SUPPORTED eq 1) |
||
153 | user_transform_ptr dd ? ;voidp ;user supplied struct for user transform |
||
154 | user_transform_depth db ? ;byte ;bit depth of user transformed pixels |
||
155 | user_transform_channels db ? ;byte ;channels in user transformed pixels |
||
156 | rb 2 ;align |
||
6881 | IgorA | 157 | end if |
6733 | IgorA | 158 | end if |
159 | |||
160 | |||
161 | flags dd ? ;uint_32 ;flags indicating various things to libpng |
||
162 | transformations dd ? ;uint_32 ;which transformations to perform |
||
163 | |||
164 | |||
165 | zstream z_stream ;decompression structure |
||
166 | |||
167 | |||
168 | zbuffer_size dd ? ;uInt ;size of the actual buffer |
||
169 | |||
170 | |||
171 | zlib_method dd ? ;int ;holds zlib compression method |
||
172 | zlib_window_bits dd ? ;int ;holds zlib compression window bits |
||
173 | zlib_mem_level dd ? ;int ;holds zlib compression memory level |
||
174 | zlib_strategy dd ? ;int ;holds zlib compression strategy |
||
175 | ; Added at libpng 1.5.4 |
||
176 | if PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED eq 1 |
||
177 | zlib_text_level dd ? ;int ;holds zlib compression level |
||
178 | zlib_text_method dd ? ;int ;holds zlib compression method |
||
179 | zlib_text_window_bits dd ? ;int ;holds zlib compression window bits |
||
180 | zlib_text_mem_level dd ? ;int ;holds zlib compression memory level |
||
181 | zlib_text_strategy dd ? ;int ;holds zlib compression strategy |
||
182 | end if |
||
183 | ;End of material added at libpng 1.5.4 |
||
184 | ;Added at libpng 1.6.0 |
||
185 | zlib_set_level dd ? ;int ;Actual values set into the zstream on write |
||
186 | zlib_set_method dd ? ;int |
||
187 | zlib_set_window_bits dd ? ;int |
||
188 | zlib_set_mem_level dd ? ;int |
||
189 | zlib_set_strategy dd ? ;int |
||
190 | |||
191 | |||
192 | height dd ? ;uint_32 ;height of image in pixels |
||
193 | num_rows dd ? ;uint_32 ;number of rows in current pass |
||
194 | usr_width dd ? ;uint_32 ;width of row at start of write |
||
195 | rowbytes dd ? ;png_size_t ;size of row in bytes |
||
196 | iwidth dd ? ;uint_32 ;width of current interlaced row in pixels |
||
197 | row_number dd ? ;uint_32 ;current row in interlace pass |
||
198 | chunk_name dd ? ;uint_32 ;PNG_CHUNK() id of current chunk |
||
199 | prev_row dd ? ;bytep ;buffer to save previous (unfiltered) row. |
||
200 | ;While reading this is a pointer into |
||
201 | ;big_prev_row; while writing it is separately |
||
202 | ;allocated if needed. |
||
203 | |||
204 | |||
205 | ;While reading, this is a pointer into |
||
206 | ;big_row_buf; while writing it is separately |
||
207 | ;allocated. |
||
208 | |||
209 | |||
210 | try_row dd ? ;bytep ;buffer to save trial row when filtering |
||
211 | tst_row dd ? ;bytep ;buffer to save best trial row when filtering |
||
212 | end if |
||
213 | info_rowbytes dd ? ;png_size_t ;Added in 1.5.4: cache of updated row bytes |
||
214 | |||
215 | |||
216 | crc dd ? ;uint_32 ;current chunk CRC value |
||
217 | palette dd ? ;png_colorp ;palette from the input file |
||
218 | num_palette dw ? ;uint_16 ;number of color entries in palette |
||
219 | rb 2 ;align |
||
6881 | IgorA | 220 | ; Added at libpng-1.5.10 |
6733 | IgorA | 221 | if PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED eq 1 |
222 | num_palette_max dd ? ;int ;maximum palette index found in IDAT |
||
223 | end if |
||
224 | |||
225 | |||
226 | compression db ? ;byte ;file compression type (always 0) |
||
227 | filter db ? ;byte ;file filter type (always 0) |
||
228 | interlaced db ? ;byte ;PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 |
||
229 | pass db ? ;byte ;current interlace pass (0 - 6) |
||
230 | do_filter db ? ;byte ;row filter flags (see PNG_FILTER_ in png.inc) |
||
231 | color_type db ? ;byte ;color type of file |
||
232 | bit_depth db ? ;byte ;bit depth of file |
||
233 | usr_bit_depth db ? ;byte ;bit depth of users row: write only |
||
234 | pixel_depth db ? ;byte ;number of bits per pixel |
||
235 | channels db ? ;byte ;number of channels in file |
||
236 | usr_channels db ? ;byte ;channels at start of write: write only |
||
237 | sig_bytes db ? ;byte ;magic bytes read/written from start of file |
||
238 | maximum_pixel_depth db ? ;byte ;pixel depth used for the row buffers |
||
239 | transformed_pixel_depth db ? ;byte ;pixel depth after read/write transforms |
||
240 | ;if PNG_ZLIB_VERNUM >= 0x1240 |
||
6881 | IgorA | 241 | ;zstream_start db 1 ;byte ;at start of an input zlib stream |
242 | ;end if ;Zlib >= 1.2.4 |
||
243 | if (PNG_READ_FILLER_SUPPORTED eq 1) | (PNG_WRITE_FILLER_SUPPORTED eq 1) |
||
6733 | IgorA | 244 | filler dw ? ;uint_16 ;filler bytes for pixel expansion |
6881 | IgorA | 245 | end if |
6733 | IgorA | 246 | |
247 | |||
248 | (PNG_READ_ALPHA_MODE_SUPPORTED eq 1) |
||
249 | background_gamma_type db ? ;byte |
||
250 | rb 1 ;align |
||
6881 | IgorA | 251 | background_gamma dd ? ;png_fixed_point |
6733 | IgorA | 252 | background png_color_16 ;background color in screen gamma space |
253 | rb 1 ;align |
||
6881 | IgorA | 254 | if PNG_READ_GAMMA_SUPPORTED eq 1 |
6733 | IgorA | 255 | background_1 png_color_16 ;background normalized to gamma 1.0 |
256 | rb 1 ;align |
||
6881 | IgorA | 257 | end if |
6733 | IgorA | 258 | end if ;bKGD |
259 | |||
260 | |||
261 | output_flush_fn dd ? ;png_flush_ptr ;Function for flushing output |
||
262 | flush_dist dd ? ;uint_32 ;how many rows apart to flush, 0 - no flush |
||
263 | flush_rows dd ? ;uint_32 ;number of rows written since last flush |
||
264 | end if |
||
265 | |||
266 | |||
267 | gamma_shift dd ? ;int ;number of "insignificant" bits in 16-bit gamma |
||
268 | screen_gamma dd ? ;png_fixed_point ;screen gamma value (display_exponent) |
||
269 | |||
270 | |||
271 | gamma_16_table dd ? ;uint_16pp ;gamma table for 16-bit depth files |
||
272 | if (PNG_READ_BACKGROUND_SUPPORTED eq 1) | \ |
||
273 | (PNG_READ_ALPHA_MODE_SUPPORTED eq 1) | \ |
||
274 | (PNG_READ_RGB_TO_GRAY_SUPPORTED eq 1) |
||
275 | gamma_from_1 dd ? ;bytep ;converts from 1.0 to screen |
||
276 | gamma_to_1 dd ? ;bytep ;converts from file to 1.0 |
||
277 | gamma_16_from_1 dd ? ;uint_16pp ;converts from 1.0 to screen |
||
278 | gamma_16_to_1 dd ? ;uint_16pp ;converts from file to 1.0 |
||
279 | end if ;READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY |
||
280 | end if |
||
281 | |||
282 | |||
283 | sig_bit png_color_8 ;significant bits in each available channel |
||
284 | end if |
||
285 | |||
286 | |||
287 | shift png_color_8 ;shift for significant bit tranformation |
||
288 | rb 2 ;align |
||
6881 | IgorA | 289 | end if |
6733 | IgorA | 290 | |
291 | |||
292 | | (PNG_READ_EXPAND_SUPPORTED eq 1) | (PNG_READ_BACKGROUND_SUPPORTED eq 1) |
||
293 | trans_alpha dd ? ;bytep ;alpha values for paletted files |
||
294 | trans_color png_color_16 ;transparent color for non-paletted files |
||
295 | rb 3 ;align |
||
6881 | IgorA | 296 | end if |
6733 | IgorA | 297 | |
298 | |||
299 | write_row_fn dd ? ;png_write_status_ptr ;called after each row is encoded |
||
300 | if PNG_PROGRESSIVE_READ_SUPPORTED eq 1 |
||
301 | info_fn dd ? ;png_progressive_info_ptr ;called after header data fully read |
||
302 | row_fn dd ? ;png_progressive_row_ptr ;called after a prog. row is decoded |
||
303 | end_fn dd ? ;png_progressive_end_ptr ;called after image is complete |
||
304 | save_buffer_ptr dd ? ;bytep ;current location in save_buffer |
||
305 | save_buffer dd ? ;bytep ;buffer for previously read data |
||
306 | current_buffer_ptr dd ? ;bytep ;current location in current_buffer |
||
307 | current_buffer dd ? ;bytep ;buffer for recently used data |
||
308 | push_length dd ? ;uint_32 ;size of current input chunk |
||
309 | skip_length dd ? ;uint_32 ;bytes to skip in input data |
||
310 | save_buffer_size dd ? ;png_size_t ;amount of data now in save_buffer |
||
311 | save_buffer_max dd ? ;png_size_t ;total size of save_buffer |
||
312 | buffer_size dd ? ;png_size_t ;total amount of available input data |
||
313 | current_buffer_size dd ? ;png_size_t ;amount of data now in current_buffer |
||
314 | process_mode dd ? ;int ;what push library is currently doing |
||
315 | cur_palette dd ? ;int ;current push library palette index |
||
316 | |||
317 | |||
318 | |||
319 | |||
320 | palette_lookup dd ? ;bytep ;lookup table for quantizing |
||
321 | quantize_index dd ? ;bytep ;index translation for palette files |
||
322 | end if |
||
323 | |||
324 | |||
325 | if PNG_SET_OPTION_SUPPORTED eq 1 |
||
326 | options db ? ;byte ;On/off state (up to 4 options) |
||
327 | end if |
||
328 | |||
329 | |||
330 | ; To do: remove this from libpng-1.7 |
||
331 | if PNG_TIME_RFC1123_SUPPORTED eq 1 |
||
332 | time_buffer rb 29 ;char[29] ;String to hold RFC 1123 time text |
||
333 | rb 2 ;align |
||
6881 | IgorA | 334 | end if |
6733 | IgorA | 335 | ;end if |
336 | |||
337 | |||
338 | |||
339 | |||
340 | |||
341 | |||
342 | user_chunk_ptr dd ? ;voidp |
||
343 | if PNG_READ_USER_CHUNKS_SUPPORTED eq 1 |
||
344 | read_user_chunk_fn dd ? ;png_user_chunk_ptr ;user read chunk handler |
||
345 | end if |
||
346 | end if |
||
347 | |||
348 | |||
349 | unknown_default dd ? ;int ; As PNG_HANDLE_* |
||
350 | num_chunk_list dd ? ;unsigned int ; Number of entries in the list |
||
351 | chunk_list dd ? ;bytep ; List of byte[5]; the textual chunk name |
||
352 | ; followed by a PNG_HANDLE_* byte |
||
353 | end if |
||
354 | |||
355 | |||
356 | if PNG_READ_RGB_TO_GRAY_SUPPORTED eq 1 |
||
357 | rgb_to_gray_status db ? ;byte |
||
358 | ; Added in libpng 1.5.5 to record setting of coefficients: |
||
359 | rgb_to_gray_coefficients_set db ? ;byte |
||
360 | ; These were changed from byte in libpng-1.0.6 |
||
361 | rgb_to_gray_red_coeff dw ? ;uint_16 |
||
362 | rgb_to_gray_green_coeff dw ? ;uint_16 |
||
363 | ; deleted in 1.5.5: rgb_to_gray_blue_coeff; |
||
364 | rb 2 ;align |
||
6881 | IgorA | 365 | end if |
6733 | IgorA | 366 | |
367 | |||
368 | ; New member added in libpng-1.0.4 (renamed in 1.0.9) |
||
369 | ; Changed from byte to uint_32 at version 1.2.0 |
||
370 | mng_features_permitted dd ? ;uint_32 |
||
371 | |||
372 | |||
373 | filter_type db ? ;byte |
||
374 | rb 3 ;align |
||
6881 | IgorA | 375 | end if |
6733 | IgorA | 376 | |
377 | |||
378 | |||
379 | |||
380 | if PNG_USER_MEM_SUPPORTED eq 1 |
||
381 | mem_ptr dd ? ;voidp ;user supplied struct for mem functions |
||
382 | malloc_fn dd ? ;malloc_ptr ;function for allocating memory |
||
383 | free_fn dd ? ;free_ptr ;function for freeing memory |
||
384 | end if |
||
385 | |||
386 | |||
387 | big_row_buf dd ? ;bytep ;buffer to save current (unfiltered) row |
||
388 | |||
389 | |||
390 | ; The following three members were added at version 1.0.14 and 1.2.4 |
||
391 | quantize_sort dd ? ;bytep ;working sort array |
||
392 | index_to_palette dd ? ;bytep ;where the original index currently is in the palette |
||
393 | palette_to_index dd ? ;bytep ;which original index points to this palette color |
||
394 | end if |
||
395 | |||
396 | |||
397 | compression_type db ? ;byte |
||
398 | rb 3 ;align |
||
6881 | IgorA | 399 | |
6733 | IgorA | 400 | |
401 | user_width_max dd ? ;uint_32 |
||
402 | user_height_max dd ? ;uint_32 |
||
403 | |||
404 | |||
405 | ; chunks that can be stored (0 means unlimited). |
||
406 | |||
407 | |||
408 | |||
409 | |||
410 | ; can occupy when decompressed. 0 means unlimited. |
||
411 | |||
412 | |||
413 | end if |
||
414 | |||
415 | |||
416 | if PNG_READ_UNKNOWN_CHUNKS_SUPPORTED eq 1 |
||
417 | ; Temporary storage for unknown chunk that the library doesn't recognize, |
||
418 | ; used while reading the chunk. |
||
419 | |||
420 | |||
6881 | IgorA | 421 | rb 3 ;align |
422 | end if |
||
6733 | IgorA | 423 | |
424 | |||
425 | old_big_row_buf_size dd ? ;png_size_t |
||
426 | |||
427 | |||
428 | ; New member added in libpng-1.2.30 |
||
429 | read_buffer dd ? ;bytep ;buffer for reading chunk data |
||
430 | read_buffer_size dd ? ;png_alloc_size_t ;current size of the buffer |
||
431 | end if |
||
432 | if PNG_SEQUENTIAL_READ_SUPPORTED eq 1 |
||
433 | IDAT_read_size dd ? ;uInt ;limit on read buffer size for IDAT |
||
434 | end if |
||
435 | |||
436 | |||
437 | ; New member added in libpng-1.4.0 |
||
438 | io_state dd ? ;uint_32 |
||
439 | end if |
||
440 | |||
441 | |||
442 | big_prev_row dd ? ;bytep |
||
443 | |||
444 | |||
6881 | IgorA | 445 | read_filter rd PNG_FILTER_VALUE_LAST-1 |
446 | |||
6733 | IgorA | 447 | |
448 | if (PNG_COLORSPACE_SUPPORTED eq 1) | (PNG_GAMMA_SUPPORTED eq 1) |
||
449 | colorspace png_colorspace |
||
450 | end if |
||
451 | end if |
||
452 | ends> |
||
453 |