12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25 /* pngpriv.h - private declarations for use inside libpng
26 *
27 * This file is available under and governed by the GNU General Public
28 * License version 2 only, as published by the Free Software Foundation.
29 * However, the following notice accompanied the original version of this
30 * file and, per its terms, should not be removed:
31 *
32 * Last changed in libpng 1.6.26 [October 20, 2016]
33 * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
34 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
35 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
36 *
37 * This code is released under the libpng license.
38 * For conditions of distribution and use, see the disclaimer
39 * and license in png.h
40 */
41
42 /* The symbols declared in this file (including the functions declared
43 * as extern) are PRIVATE. They are not part of the libpng public
44 * interface, and are not recommended for use by regular applications.
45 * Some of them may become public in the future; others may stay private,
46 * change in an incompatible way, or even disappear.
47 * Although the libpng users are not forbidden to include this header,
48 * they should be well aware of the issues that may arise from doing so.
49 */
50
51 #ifndef PNGPRIV_H
52 #define PNGPRIV_H
53
54 /* Feature Test Macros. The following are defined here to ensure that correctly
55 * implemented libraries reveal the APIs libpng needs to build and hide those
56 * that are not needed and potentially damaging to the compilation.
57 *
58 * Feature Test Macros must be defined before any system header is included (see
59 * POSIX 1003.1 2.8.2 "POSIX Symbols."
60 *
61 * These macros only have an effect if the operating system supports either
62 * POSIX 1003.1 or C99, or both. On other operating systems (particularly
63 * Windows/Visual Studio) there is no effect; the OS specific tests below are
64 * still required (as of 2011-05-02.)
65 */
66 #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
67
68 #ifndef PNG_VERSION_INFO_ONLY
69 /* Standard library headers not required by png.h: */
70 # include <stdlib.h>
71 # include <string.h>
72 #endif
73
74 #define PNGLIB_BUILD /*libpng is being built, not used*/
75
76 /* If HAVE_CONFIG_H is defined during the build then the build system must
77 * provide an appropriate "config.h" file on the include path. The header file
78 * must provide definitions as required below (search for "HAVE_CONFIG_H");
79 * see configure.ac for more details of the requirements. The macro
80 * "PNG_NO_CONFIG_H" is provided for maintainers to test for dependencies on
81 * 'configure'; define this macro to prevent the configure build including the
82 * configure generated config.h. Libpng is expected to compile without *any*
83 * special build system support on a reasonably ANSI-C compliant system.
84 */
85 #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
86 # include <config.h>
201 /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
202 */
203 # define PNG_ARM_NEON_IMPLEMENTATION 2
204 # endif /* __ARM_NEON__ */
205 # endif /* !PNG_ARM_NEON_IMPLEMENTATION */
206
207 # ifndef PNG_ARM_NEON_IMPLEMENTATION
208 /* Use the intrinsics code by default. */
209 # define PNG_ARM_NEON_IMPLEMENTATION 1
210 # endif
211 #endif /* PNG_ARM_NEON_OPT > 0 */
212
213 #ifndef PNG_MIPS_MSA_OPT
214 # if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
215 # define PNG_MIPS_MSA_OPT 2
216 # else
217 # define PNG_MIPS_MSA_OPT 0
218 # endif
219 #endif
220
221 #if PNG_MIPS_MSA_OPT > 0
222 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
223 # ifndef PNG_MIPS_MSA_IMPLEMENTATION
224 # if defined(__mips_msa)
225 # if defined(__clang__)
226 # elif defined(__GNUC__)
227 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
228 # define PNG_MIPS_MSA_IMPLEMENTATION 2
229 # endif /* no GNUC support */
230 # endif /* __GNUC__ */
231 # else /* !defined __mips_msa */
232 # define PNG_MIPS_MSA_IMPLEMENTATION 2
233 # endif /* __mips_msa */
234 # endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
235
236 # ifndef PNG_MIPS_MSA_IMPLEMENTATION
237 # define PNG_MIPS_MSA_IMPLEMENTATION 1
238 # endif
239 #endif /* PNG_MIPS_MSA_OPT > 0 */
240
241
242 /* Is this a build of a DLL where compilation of the object modules requires
243 * different preprocessor settings to those required for a simple library? If
244 * so PNG_BUILD_DLL must be set.
245 *
246 * If libpng is used inside a DLL but that DLL does not export the libpng APIs
247 * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
248 * static library of libpng then link the DLL against that.
249 */
250 #ifndef PNG_BUILD_DLL
251 # ifdef DLL_EXPORT
252 /* This is set by libtool when files are compiled for a DLL; libtool
253 * always compiles twice, even on systems where it isn't necessary. Set
254 * PNG_BUILD_DLL in case it is necessary:
255 */
256 # define PNG_BUILD_DLL
257 # else
258 # ifdef _WINDLL
259 /* This is set by the Microsoft Visual Studio IDE in projects that
260 * build a DLL. It can't easily be removed from those projects (it
414 # define PNG_ZBUF_SIZE 65536L
415 #endif
416
417 /* If warnings or errors are turned off the code is disabled or redirected here.
418 * From 1.5.4 functions have been added to allow very limited formatting of
419 * error and warning messages - this code will also be disabled here.
420 */
421 #ifdef PNG_WARNINGS_SUPPORTED
422 # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
423 #else
424 # define png_warning_parameter(p,number,string) ((void)0)
425 # define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
426 # define png_warning_parameter_signed(p,number,format,value) ((void)0)
427 # define png_formatted_warning(pp,p,message) ((void)(pp))
428 # define PNG_WARNING_PARAMETERS(p)
429 #endif
430 #ifndef PNG_ERROR_TEXT_SUPPORTED
431 # define png_fixed_error(s1,s2) png_err(s1)
432 #endif
433
434 /* C allows up-casts from (void*) to any pointer and (const void*) to any
435 * pointer to a const object. C++ regards this as a type error and requires an
436 * explicit, static, cast and provides the static_cast<> rune to ensure that
437 * const is not cast away.
438 */
439 #ifdef __cplusplus
440 # define png_voidcast(type, value) static_cast<type>(value)
441 # define png_constcast(type, value) const_cast<type>(value)
442 # define png_aligncast(type, value) \
443 static_cast<type>(static_cast<void*>(value))
444 # define png_aligncastconst(type, value) \
445 static_cast<type>(static_cast<const void*>(value))
446 #else
447 # define png_voidcast(type, value) (value)
448 # define png_constcast(type, value) ((type)(value))
449 # define png_aligncast(type, value) ((void*)(value))
450 # define png_aligncastconst(type, value) ((const void*)(value))
451 #endif /* __cplusplus */
452
453 /* Some fixed point APIs are still required even if not exported because
454 * they get used by the corresponding floating point APIs. This magic
455 * deals with this:
456 */
457 #ifdef PNG_FIXED_POINT_SUPPORTED
458 # define PNGFAPI PNGAPI
459 #else
460 # define PNGFAPI /* PRIVATE */
461 #endif
462
463 #ifndef PNG_VERSION_INFO_ONLY
464 /* Other defines specific to compilers can go here. Try to keep
465 * them inside an appropriate ifdef/endif pair for portability.
466 */
467 #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
468 defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
469 /* png.c requires the following ANSI-C constants if the conversion of
470 * floating point to ASCII is implemented therein:
471 *
472 * DBL_DIG Maximum number of decimal digits (can be set to any constant)
473 * DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
474 * DBL_MAX Maximum floating point number (can be set to an arbitrary value)
475 */
476 # include <float.h>
477
478 # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
479 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
480 /* We need to check that <math.h> hasn't already been included earlier
481 * as it seems it doesn't agree with <fp.h>, yet we should really use
482 * <fp.h> if possible.
483 */
484 # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
485 # include <fp.h>
486 # endif
792 * type. In fact the specification does not express chunk types this way,
793 * however using a 32-bit value means that the chunk type can be read from the
794 * stream using exactly the same code as used for a 32-bit unsigned value and
795 * can be examined far more efficiently (using one arithmetic compare).
796 *
797 * Prior to 1.5.6 the chunk type constants were expressed as C strings. The
798 * libpng API still uses strings for 'unknown' chunks and a macro,
799 * PNG_STRING_FROM_CHUNK, allows a string to be generated if required. Notice
800 * that for portable code numeric values must still be used; the string "IHDR"
801 * is not portable and neither is PNG_U32('I', 'H', 'D', 'R').
802 *
803 * In 1.7.0 the definitions will be made public in png.h to avoid having to
804 * duplicate the same definitions in application code.
805 */
806 #define png_IDAT PNG_U32( 73, 68, 65, 84)
807 #define png_IEND PNG_U32( 73, 69, 78, 68)
808 #define png_IHDR PNG_U32( 73, 72, 68, 82)
809 #define png_PLTE PNG_U32( 80, 76, 84, 69)
810 #define png_bKGD PNG_U32( 98, 75, 71, 68)
811 #define png_cHRM PNG_U32( 99, 72, 82, 77)
812 #define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
813 #define png_gAMA PNG_U32(103, 65, 77, 65)
814 #define png_gIFg PNG_U32(103, 73, 70, 103)
815 #define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
816 #define png_gIFx PNG_U32(103, 73, 70, 120)
817 #define png_hIST PNG_U32(104, 73, 83, 84)
818 #define png_iCCP PNG_U32(105, 67, 67, 80)
819 #define png_iTXt PNG_U32(105, 84, 88, 116)
820 #define png_oFFs PNG_U32(111, 70, 70, 115)
821 #define png_pCAL PNG_U32(112, 67, 65, 76)
822 #define png_pHYs PNG_U32(112, 72, 89, 115)
823 #define png_sBIT PNG_U32(115, 66, 73, 84)
824 #define png_sCAL PNG_U32(115, 67, 65, 76)
825 #define png_sPLT PNG_U32(115, 80, 76, 84)
826 #define png_sRGB PNG_U32(115, 82, 71, 66)
827 #define png_sTER PNG_U32(115, 84, 69, 82)
828 #define png_tEXt PNG_U32(116, 69, 88, 116)
829 #define png_tIME PNG_U32(116, 73, 77, 69)
830 #define png_tRNS PNG_U32(116, 82, 78, 83)
831 #define png_zTXt PNG_U32(122, 84, 88, 116)
1092 PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr,
1093 png_fixed_point file_gamma),PNG_EMPTY);
1094 #endif
1095
1096 #ifdef PNG_WRITE_sBIT_SUPPORTED
1097 PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr,
1098 png_const_color_8p sbit, int color_type),PNG_EMPTY);
1099 #endif
1100
1101 #ifdef PNG_WRITE_cHRM_SUPPORTED
1102 PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
1103 const png_xy *xy), PNG_EMPTY);
1104 /* The xy value must have been previously validated */
1105 #endif
1106
1107 #ifdef PNG_WRITE_sRGB_SUPPORTED
1108 PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
1109 int intent),PNG_EMPTY);
1110 #endif
1111
1112 #ifdef PNG_WRITE_iCCP_SUPPORTED
1113 PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
1114 png_const_charp name, png_const_bytep profile), PNG_EMPTY);
1115 /* The profile must have been previously validated for correctness, the
1116 * length comes from the first four bytes. Only the base, deflate,
1117 * compression is supported.
1118 */
1119 #endif
1120
1121 #ifdef PNG_WRITE_sPLT_SUPPORTED
1122 PNG_INTERNAL_FUNCTION(void,png_write_sPLT,(png_structrp png_ptr,
1123 png_const_sPLT_tp palette),PNG_EMPTY);
1124 #endif
1125
1126 #ifdef PNG_WRITE_tRNS_SUPPORTED
1127 PNG_INTERNAL_FUNCTION(void,png_write_tRNS,(png_structrp png_ptr,
1128 png_const_bytep trans, png_const_color_16p values, int number,
1129 int color_type),PNG_EMPTY);
1130 #endif
1131
1267 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1268 #endif
1269
1270 #if PNG_MIPS_MSA_OPT > 0
1271 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
1272 png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1273 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
1274 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1275 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_msa,(png_row_infop
1276 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1277 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_msa,(png_row_infop
1278 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1279 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop
1280 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1281 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop
1282 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1283 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
1284 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1285 #endif
1286
1287 /* Choose the best filter to use and filter the row data */
1288 PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
1289 png_row_infop row_info),PNG_EMPTY);
1290
1291 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1292 PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
1293 png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
1294 /* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer
1295 * is NULL the function checks, instead, for the end of the stream. In this
1296 * case a benign error will be issued if the stream end is not found or if
1297 * extra data has to be consumed.
1298 */
1299 PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
1300 PNG_EMPTY);
1301 /* This cleans up when the IDAT LZ stream does not end when the last image
1302 * byte is read; there is still some pending input.
1303 */
1304
1305 PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
1306 PNG_EMPTY);
1359 */
1360
1361 /* Decode the IHDR chunk */
1362 PNG_INTERNAL_FUNCTION(void,png_handle_IHDR,(png_structrp png_ptr,
1363 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1364 PNG_INTERNAL_FUNCTION(void,png_handle_PLTE,(png_structrp png_ptr,
1365 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1366 PNG_INTERNAL_FUNCTION(void,png_handle_IEND,(png_structrp png_ptr,
1367 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1368
1369 #ifdef PNG_READ_bKGD_SUPPORTED
1370 PNG_INTERNAL_FUNCTION(void,png_handle_bKGD,(png_structrp png_ptr,
1371 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1372 #endif
1373
1374 #ifdef PNG_READ_cHRM_SUPPORTED
1375 PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
1376 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1377 #endif
1378
1379 #ifdef PNG_READ_gAMA_SUPPORTED
1380 PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
1381 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1382 #endif
1383
1384 #ifdef PNG_READ_hIST_SUPPORTED
1385 PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
1386 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1387 #endif
1388
1389 #ifdef PNG_READ_iCCP_SUPPORTED
1390 PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
1391 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1392 #endif /* READ_iCCP */
1393
1394 #ifdef PNG_READ_iTXt_SUPPORTED
1395 PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
1396 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1397 #endif
1398
1434 #ifdef PNG_READ_tEXt_SUPPORTED
1435 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1436 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1437 #endif
1438
1439 #ifdef PNG_READ_tIME_SUPPORTED
1440 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1441 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1442 #endif
1443
1444 #ifdef PNG_READ_tRNS_SUPPORTED
1445 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1446 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1447 #endif
1448
1449 #ifdef PNG_READ_zTXt_SUPPORTED
1450 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1451 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1452 #endif
1453
1454 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr,
1455 png_uint_32 chunk_name),PNG_EMPTY);
1456
1457 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1458 png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1459 /* This is the function that gets called for unknown chunks. The 'keep'
1460 * argument is either non-zero for a known chunk that has been set to be
1461 * handled as unknown or zero for an unknown chunk. By default the function
1462 * just skips the chunk or errors out if it is critical.
1463 */
1464
1465 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1466 defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1467 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1468 (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1469 /* Exactly as the API png_handle_as_unknown() except that the argument is a
1470 * 32-bit chunk name, not a string.
1471 */
1472 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1473
1474 /* Handle the transformations for reading and writing */
1475 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
2002 * the generic code is used.
2003 */
2004 #ifdef PNG_FILTER_OPTIMIZATIONS
2005 PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
2006 unsigned int bpp), PNG_EMPTY);
2007 /* Just declare the optimization that will be used */
2008 #else
2009 /* List *all* the possible optimizations here - this branch is required if
2010 * the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
2011 * CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
2012 */
2013 # if PNG_ARM_NEON_OPT > 0
2014 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2015 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2016 #endif
2017
2018 #if PNG_MIPS_MSA_OPT > 0
2019 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2020 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2021 #endif
2022 #endif
2023
2024 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2025 png_const_charp key, png_bytep new_key), PNG_EMPTY);
2026
2027 /* Maintainer: Put new private prototypes here ^ */
2028
2029 #include "pngdebug.h"
2030
2031 #ifdef __cplusplus
2032 }
2033 #endif
2034
2035 #endif /* PNG_VERSION_INFO_ONLY */
2036 #endif /* PNGPRIV_H */
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25 /* pngpriv.h - private declarations for use inside libpng
26 *
27 * This file is available under and governed by the GNU General Public
28 * License version 2 only, as published by the Free Software Foundation.
29 * However, the following notice accompanied the original version of this
30 * file and, per its terms, should not be removed:
31 *
32 * Last changed in libpng 1.6.32 [August 24, 2017]
33 * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
34 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
35 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
36 *
37 * This code is released under the libpng license.
38 * For conditions of distribution and use, see the disclaimer
39 * and license in png.h
40 */
41
42 /* The symbols declared in this file (including the functions declared
43 * as extern) are PRIVATE. They are not part of the libpng public
44 * interface, and are not recommended for use by regular applications.
45 * Some of them may become public in the future; others may stay private,
46 * change in an incompatible way, or even disappear.
47 * Although the libpng users are not forbidden to include this header,
48 * they should be well aware of the issues that may arise from doing so.
49 */
50
51 #ifndef PNGPRIV_H
52 #define PNGPRIV_H
53
54 /* Feature Test Macros. The following are defined here to ensure that correctly
55 * implemented libraries reveal the APIs libpng needs to build and hide those
56 * that are not needed and potentially damaging to the compilation.
57 *
58 * Feature Test Macros must be defined before any system header is included (see
59 * POSIX 1003.1 2.8.2 "POSIX Symbols."
60 *
61 * These macros only have an effect if the operating system supports either
62 * POSIX 1003.1 or C99, or both. On other operating systems (particularly
63 * Windows/Visual Studio) there is no effect; the OS specific tests below are
64 * still required (as of 2011-05-02.)
65 */
66 #ifndef _POSIX_SOURCE
67 # define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
68 #endif
69
70 #ifndef PNG_VERSION_INFO_ONLY
71 /* Standard library headers not required by png.h: */
72 # include <stdlib.h>
73 # include <string.h>
74 #endif
75
76 #define PNGLIB_BUILD /*libpng is being built, not used*/
77
78 /* If HAVE_CONFIG_H is defined during the build then the build system must
79 * provide an appropriate "config.h" file on the include path. The header file
80 * must provide definitions as required below (search for "HAVE_CONFIG_H");
81 * see configure.ac for more details of the requirements. The macro
82 * "PNG_NO_CONFIG_H" is provided for maintainers to test for dependencies on
83 * 'configure'; define this macro to prevent the configure build including the
84 * configure generated config.h. Libpng is expected to compile without *any*
85 * special build system support on a reasonably ANSI-C compliant system.
86 */
87 #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
88 # include <config.h>
203 /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
204 */
205 # define PNG_ARM_NEON_IMPLEMENTATION 2
206 # endif /* __ARM_NEON__ */
207 # endif /* !PNG_ARM_NEON_IMPLEMENTATION */
208
209 # ifndef PNG_ARM_NEON_IMPLEMENTATION
210 /* Use the intrinsics code by default. */
211 # define PNG_ARM_NEON_IMPLEMENTATION 1
212 # endif
213 #endif /* PNG_ARM_NEON_OPT > 0 */
214
215 #ifndef PNG_MIPS_MSA_OPT
216 # if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
217 # define PNG_MIPS_MSA_OPT 2
218 # else
219 # define PNG_MIPS_MSA_OPT 0
220 # endif
221 #endif
222
223 #ifndef PNG_POWERPC_VSX_OPT
224 # if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
225 # define PNG_POWERPC_VSX_OPT 2
226 # else
227 # define PNG_POWERPC_VSX_OPT 0
228 # endif
229 #endif
230
231 #ifndef PNG_INTEL_SSE_OPT
232 # ifdef PNG_INTEL_SSE
233 /* Only check for SSE if the build configuration has been modified to
234 * enable SSE optimizations. This means that these optimizations will
235 * be off by default. See contrib/intel for more details.
236 */
237 # if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
238 defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
239 (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
240 # define PNG_INTEL_SSE_OPT 1
241 # endif
242 # endif
243 #endif
244
245 #if PNG_INTEL_SSE_OPT > 0
246 # ifndef PNG_INTEL_SSE_IMPLEMENTATION
247 # if defined(__SSE4_1__) || defined(__AVX__)
248 /* We are not actually using AVX, but checking for AVX is the best
249 way we can detect SSE4.1 and SSSE3 on MSVC.
250 */
251 # define PNG_INTEL_SSE_IMPLEMENTATION 3
252 # elif defined(__SSSE3__)
253 # define PNG_INTEL_SSE_IMPLEMENTATION 2
254 # elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
255 (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
256 # define PNG_INTEL_SSE_IMPLEMENTATION 1
257 # else
258 # define PNG_INTEL_SSE_IMPLEMENTATION 0
259 # endif
260 # endif
261
262 # if PNG_INTEL_SSE_IMPLEMENTATION > 0
263 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
264 # endif
265 #endif
266
267 #if PNG_MIPS_MSA_OPT > 0
268 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
269 # ifndef PNG_MIPS_MSA_IMPLEMENTATION
270 # if defined(__mips_msa)
271 # if defined(__clang__)
272 # elif defined(__GNUC__)
273 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
274 # define PNG_MIPS_MSA_IMPLEMENTATION 2
275 # endif /* no GNUC support */
276 # endif /* __GNUC__ */
277 # else /* !defined __mips_msa */
278 # define PNG_MIPS_MSA_IMPLEMENTATION 2
279 # endif /* __mips_msa */
280 # endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
281
282 # ifndef PNG_MIPS_MSA_IMPLEMENTATION
283 # define PNG_MIPS_MSA_IMPLEMENTATION 1
284 # endif
285 #endif /* PNG_MIPS_MSA_OPT > 0 */
286
287 #if PNG_POWERPC_VSX_OPT > 0
288 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
289 # define PNG_POWERPC_VSX_IMPLEMENTATION 1
290 #endif
291
292
293 /* Is this a build of a DLL where compilation of the object modules requires
294 * different preprocessor settings to those required for a simple library? If
295 * so PNG_BUILD_DLL must be set.
296 *
297 * If libpng is used inside a DLL but that DLL does not export the libpng APIs
298 * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
299 * static library of libpng then link the DLL against that.
300 */
301 #ifndef PNG_BUILD_DLL
302 # ifdef DLL_EXPORT
303 /* This is set by libtool when files are compiled for a DLL; libtool
304 * always compiles twice, even on systems where it isn't necessary. Set
305 * PNG_BUILD_DLL in case it is necessary:
306 */
307 # define PNG_BUILD_DLL
308 # else
309 # ifdef _WINDLL
310 /* This is set by the Microsoft Visual Studio IDE in projects that
311 * build a DLL. It can't easily be removed from those projects (it
465 # define PNG_ZBUF_SIZE 65536L
466 #endif
467
468 /* If warnings or errors are turned off the code is disabled or redirected here.
469 * From 1.5.4 functions have been added to allow very limited formatting of
470 * error and warning messages - this code will also be disabled here.
471 */
472 #ifdef PNG_WARNINGS_SUPPORTED
473 # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
474 #else
475 # define png_warning_parameter(p,number,string) ((void)0)
476 # define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
477 # define png_warning_parameter_signed(p,number,format,value) ((void)0)
478 # define png_formatted_warning(pp,p,message) ((void)(pp))
479 # define PNG_WARNING_PARAMETERS(p)
480 #endif
481 #ifndef PNG_ERROR_TEXT_SUPPORTED
482 # define png_fixed_error(s1,s2) png_err(s1)
483 #endif
484
485 /* Some fixed point APIs are still required even if not exported because
486 * they get used by the corresponding floating point APIs. This magic
487 * deals with this:
488 */
489 #ifdef PNG_FIXED_POINT_SUPPORTED
490 # define PNGFAPI PNGAPI
491 #else
492 # define PNGFAPI /* PRIVATE */
493 #endif
494
495 #ifndef PNG_VERSION_INFO_ONLY
496 /* Other defines specific to compilers can go here. Try to keep
497 * them inside an appropriate ifdef/endif pair for portability.
498 */
499
500 /* C allows up-casts from (void*) to any pointer and (const void*) to any
501 * pointer to a const object. C++ regards this as a type error and requires an
502 * explicit, static, cast and provides the static_cast<> rune to ensure that
503 * const is not cast away.
504 */
505 #ifdef __cplusplus
506 # define png_voidcast(type, value) static_cast<type>(value)
507 # define png_constcast(type, value) const_cast<type>(value)
508 # define png_aligncast(type, value) \
509 static_cast<type>(static_cast<void*>(value))
510 # define png_aligncastconst(type, value) \
511 static_cast<type>(static_cast<const void*>(value))
512 #else
513 # define png_voidcast(type, value) (value)
514 # ifdef _WIN64
515 # ifdef __GNUC__
516 typedef unsigned long long png_ptruint;
517 # else
518 typedef unsigned __int64 png_ptruint;
519 # endif
520 # else
521 typedef unsigned long png_ptruint;
522 # endif
523 # define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
524 # define png_aligncast(type, value) ((void*)(value))
525 # define png_aligncastconst(type, value) ((const void*)(value))
526 #endif /* __cplusplus */
527
528 #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
529 defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
530 /* png.c requires the following ANSI-C constants if the conversion of
531 * floating point to ASCII is implemented therein:
532 *
533 * DBL_DIG Maximum number of decimal digits (can be set to any constant)
534 * DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
535 * DBL_MAX Maximum floating point number (can be set to an arbitrary value)
536 */
537 # include <float.h>
538
539 # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
540 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
541 /* We need to check that <math.h> hasn't already been included earlier
542 * as it seems it doesn't agree with <fp.h>, yet we should really use
543 * <fp.h> if possible.
544 */
545 # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
546 # include <fp.h>
547 # endif
853 * type. In fact the specification does not express chunk types this way,
854 * however using a 32-bit value means that the chunk type can be read from the
855 * stream using exactly the same code as used for a 32-bit unsigned value and
856 * can be examined far more efficiently (using one arithmetic compare).
857 *
858 * Prior to 1.5.6 the chunk type constants were expressed as C strings. The
859 * libpng API still uses strings for 'unknown' chunks and a macro,
860 * PNG_STRING_FROM_CHUNK, allows a string to be generated if required. Notice
861 * that for portable code numeric values must still be used; the string "IHDR"
862 * is not portable and neither is PNG_U32('I', 'H', 'D', 'R').
863 *
864 * In 1.7.0 the definitions will be made public in png.h to avoid having to
865 * duplicate the same definitions in application code.
866 */
867 #define png_IDAT PNG_U32( 73, 68, 65, 84)
868 #define png_IEND PNG_U32( 73, 69, 78, 68)
869 #define png_IHDR PNG_U32( 73, 72, 68, 82)
870 #define png_PLTE PNG_U32( 80, 76, 84, 69)
871 #define png_bKGD PNG_U32( 98, 75, 71, 68)
872 #define png_cHRM PNG_U32( 99, 72, 82, 77)
873 #define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
874 #define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
875 #define png_gAMA PNG_U32(103, 65, 77, 65)
876 #define png_gIFg PNG_U32(103, 73, 70, 103)
877 #define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
878 #define png_gIFx PNG_U32(103, 73, 70, 120)
879 #define png_hIST PNG_U32(104, 73, 83, 84)
880 #define png_iCCP PNG_U32(105, 67, 67, 80)
881 #define png_iTXt PNG_U32(105, 84, 88, 116)
882 #define png_oFFs PNG_U32(111, 70, 70, 115)
883 #define png_pCAL PNG_U32(112, 67, 65, 76)
884 #define png_pHYs PNG_U32(112, 72, 89, 115)
885 #define png_sBIT PNG_U32(115, 66, 73, 84)
886 #define png_sCAL PNG_U32(115, 67, 65, 76)
887 #define png_sPLT PNG_U32(115, 80, 76, 84)
888 #define png_sRGB PNG_U32(115, 82, 71, 66)
889 #define png_sTER PNG_U32(115, 84, 69, 82)
890 #define png_tEXt PNG_U32(116, 69, 88, 116)
891 #define png_tIME PNG_U32(116, 73, 77, 69)
892 #define png_tRNS PNG_U32(116, 82, 78, 83)
893 #define png_zTXt PNG_U32(122, 84, 88, 116)
1154 PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr,
1155 png_fixed_point file_gamma),PNG_EMPTY);
1156 #endif
1157
1158 #ifdef PNG_WRITE_sBIT_SUPPORTED
1159 PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr,
1160 png_const_color_8p sbit, int color_type),PNG_EMPTY);
1161 #endif
1162
1163 #ifdef PNG_WRITE_cHRM_SUPPORTED
1164 PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
1165 const png_xy *xy), PNG_EMPTY);
1166 /* The xy value must have been previously validated */
1167 #endif
1168
1169 #ifdef PNG_WRITE_sRGB_SUPPORTED
1170 PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
1171 int intent),PNG_EMPTY);
1172 #endif
1173
1174 #ifdef PNG_WRITE_eXIf_SUPPORTED
1175 PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr,
1176 png_bytep exif, int num_exif),PNG_EMPTY);
1177 #endif
1178
1179 #ifdef PNG_WRITE_iCCP_SUPPORTED
1180 PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
1181 png_const_charp name, png_const_bytep profile), PNG_EMPTY);
1182 /* The profile must have been previously validated for correctness, the
1183 * length comes from the first four bytes. Only the base, deflate,
1184 * compression is supported.
1185 */
1186 #endif
1187
1188 #ifdef PNG_WRITE_sPLT_SUPPORTED
1189 PNG_INTERNAL_FUNCTION(void,png_write_sPLT,(png_structrp png_ptr,
1190 png_const_sPLT_tp palette),PNG_EMPTY);
1191 #endif
1192
1193 #ifdef PNG_WRITE_tRNS_SUPPORTED
1194 PNG_INTERNAL_FUNCTION(void,png_write_tRNS,(png_structrp png_ptr,
1195 png_const_bytep trans, png_const_color_16p values, int number,
1196 int color_type),PNG_EMPTY);
1197 #endif
1198
1334 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1335 #endif
1336
1337 #if PNG_MIPS_MSA_OPT > 0
1338 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
1339 png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1340 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
1341 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1342 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_msa,(png_row_infop
1343 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1344 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_msa,(png_row_infop
1345 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1346 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop
1347 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1348 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop
1349 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1350 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
1351 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1352 #endif
1353
1354 #if PNG_POWERPC_VSX_OPT > 0
1355 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
1356 png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1357 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop
1358 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1359 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop
1360 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1361 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop
1362 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1363 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop
1364 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1365 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop
1366 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1367 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop
1368 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1369 #endif
1370
1371 #if PNG_INTEL_SSE_IMPLEMENTATION > 0
1372 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop
1373 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1374 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop
1375 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1376 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop
1377 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1378 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop
1379 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1380 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop
1381 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1382 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
1383 row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
1384 #endif
1385
1386 /* Choose the best filter to use and filter the row data */
1387 PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
1388 png_row_infop row_info),PNG_EMPTY);
1389
1390 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1391 PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
1392 png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
1393 /* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer
1394 * is NULL the function checks, instead, for the end of the stream. In this
1395 * case a benign error will be issued if the stream end is not found or if
1396 * extra data has to be consumed.
1397 */
1398 PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
1399 PNG_EMPTY);
1400 /* This cleans up when the IDAT LZ stream does not end when the last image
1401 * byte is read; there is still some pending input.
1402 */
1403
1404 PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
1405 PNG_EMPTY);
1458 */
1459
1460 /* Decode the IHDR chunk */
1461 PNG_INTERNAL_FUNCTION(void,png_handle_IHDR,(png_structrp png_ptr,
1462 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1463 PNG_INTERNAL_FUNCTION(void,png_handle_PLTE,(png_structrp png_ptr,
1464 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1465 PNG_INTERNAL_FUNCTION(void,png_handle_IEND,(png_structrp png_ptr,
1466 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1467
1468 #ifdef PNG_READ_bKGD_SUPPORTED
1469 PNG_INTERNAL_FUNCTION(void,png_handle_bKGD,(png_structrp png_ptr,
1470 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1471 #endif
1472
1473 #ifdef PNG_READ_cHRM_SUPPORTED
1474 PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
1475 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1476 #endif
1477
1478 #ifdef PNG_READ_eXIf_SUPPORTED
1479 PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
1480 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1481 #endif
1482
1483 #ifdef PNG_READ_gAMA_SUPPORTED
1484 PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
1485 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1486 #endif
1487
1488 #ifdef PNG_READ_hIST_SUPPORTED
1489 PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
1490 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1491 #endif
1492
1493 #ifdef PNG_READ_iCCP_SUPPORTED
1494 PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
1495 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1496 #endif /* READ_iCCP */
1497
1498 #ifdef PNG_READ_iTXt_SUPPORTED
1499 PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
1500 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1501 #endif
1502
1538 #ifdef PNG_READ_tEXt_SUPPORTED
1539 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1540 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1541 #endif
1542
1543 #ifdef PNG_READ_tIME_SUPPORTED
1544 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1545 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1546 #endif
1547
1548 #ifdef PNG_READ_tRNS_SUPPORTED
1549 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1550 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1551 #endif
1552
1553 #ifdef PNG_READ_zTXt_SUPPORTED
1554 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1555 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1556 #endif
1557
1558 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
1559 const png_uint_32 chunk_name),PNG_EMPTY);
1560
1561 PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
1562 const png_uint_32 chunk_length),PNG_EMPTY);
1563
1564 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1565 png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1566 /* This is the function that gets called for unknown chunks. The 'keep'
1567 * argument is either non-zero for a known chunk that has been set to be
1568 * handled as unknown or zero for an unknown chunk. By default the function
1569 * just skips the chunk or errors out if it is critical.
1570 */
1571
1572 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1573 defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1574 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1575 (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1576 /* Exactly as the API png_handle_as_unknown() except that the argument is a
1577 * 32-bit chunk name, not a string.
1578 */
1579 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1580
1581 /* Handle the transformations for reading and writing */
1582 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
2109 * the generic code is used.
2110 */
2111 #ifdef PNG_FILTER_OPTIMIZATIONS
2112 PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
2113 unsigned int bpp), PNG_EMPTY);
2114 /* Just declare the optimization that will be used */
2115 #else
2116 /* List *all* the possible optimizations here - this branch is required if
2117 * the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
2118 * CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
2119 */
2120 # if PNG_ARM_NEON_OPT > 0
2121 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2122 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2123 #endif
2124
2125 #if PNG_MIPS_MSA_OPT > 0
2126 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2127 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2128 #endif
2129
2130 # if PNG_INTEL_SSE_IMPLEMENTATION > 0
2131 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
2132 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2133 # endif
2134 #endif
2135
2136 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2137 png_const_charp key, png_bytep new_key), PNG_EMPTY);
2138
2139 /* Maintainer: Put new private prototypes here ^ */
2140
2141 #include "pngdebug.h"
2142
2143 #ifdef __cplusplus
2144 }
2145 #endif
2146
2147 #endif /* PNG_VERSION_INFO_ONLY */
2148 #endif /* PNGPRIV_H */
|