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.35 [July 15, 2018]
33 * Copyright (c) 1998-2002,2004,2006-2018 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
185 */
186 # ifndef PNG_ARM_NEON_IMPLEMENTATION
187 # if defined(__ARM_NEON__) || defined(__ARM_NEON)
188 # if defined(__clang__)
189 /* At present it is unknown by the libpng developers which versions
190 * of clang support the intrinsics, however some or perhaps all
191 * versions do not work with the assembler so this may be
192 * irrelevant, so just use the default (do nothing here.)
193 */
194 # elif defined(__GNUC__)
195 /* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
196 * work, so if this *is* GCC, or G++, look for a version >4.5
197 */
198 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
199 # define PNG_ARM_NEON_IMPLEMENTATION 2
200 # endif /* no GNUC support */
201 # endif /* __GNUC__ */
202 # else /* !defined __ARM_NEON__ */
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
278 # elif defined(__GNUC__)
279 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
280 # define PNG_MIPS_MSA_IMPLEMENTATION 2
281 # endif /* no GNUC support */
282 # endif /* __GNUC__ */
283 # else /* !defined __mips_msa */
284 # define PNG_MIPS_MSA_IMPLEMENTATION 2
285 # endif /* __mips_msa */
286 # endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
287
288 # ifndef PNG_MIPS_MSA_IMPLEMENTATION
289 # define PNG_MIPS_MSA_IMPLEMENTATION 1
290 # endif
291 #endif /* PNG_MIPS_MSA_OPT > 0 */
292
293 #if PNG_POWERPC_VSX_OPT > 0
294 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
295 # define PNG_POWERPC_VSX_IMPLEMENTATION 1
296 #endif
297
298 /* Is this a build of a DLL where compilation of the object modules requires
299 * different preprocessor settings to those required for a simple library? If
300 * so PNG_BUILD_DLL must be set.
301 *
302 * If libpng is used inside a DLL but that DLL does not export the libpng APIs
303 * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
304 * static library of libpng then link the DLL against that.
305 */
306 #ifndef PNG_BUILD_DLL
307 # ifdef DLL_EXPORT
308 /* This is set by libtool when files are compiled for a DLL; libtool
309 * always compiles twice, even on systems where it isn't necessary. Set
310 * PNG_BUILD_DLL in case it is necessary:
311 */
312 # define PNG_BUILD_DLL
313 # else
314 # ifdef _WINDLL
315 /* This is set by the Microsoft Visual Studio IDE in projects that
316 * build a DLL. It can't easily be removed from those projects (it
317 * isn't visible in the Visual Studio UI) so it is a fairly reliable
1544 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1545 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1546 #endif
1547
1548 #ifdef PNG_READ_tIME_SUPPORTED
1549 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1550 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1551 #endif
1552
1553 #ifdef PNG_READ_tRNS_SUPPORTED
1554 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1555 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1556 #endif
1557
1558 #ifdef PNG_READ_zTXt_SUPPORTED
1559 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1560 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1561 #endif
1562
1563 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
1564 const png_uint_32 chunk_name),PNG_EMPTY);
1565
1566 PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
1567 const png_uint_32 chunk_length),PNG_EMPTY);
1568
1569 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1570 png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1571 /* This is the function that gets called for unknown chunks. The 'keep'
1572 * argument is either non-zero for a known chunk that has been set to be
1573 * handled as unknown or zero for an unknown chunk. By default the function
1574 * just skips the chunk or errors out if it is critical.
1575 */
1576
1577 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1578 defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1579 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1580 (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1581 /* Exactly as the API png_handle_as_unknown() except that the argument is a
1582 * 32-bit chunk name, not a string.
1583 */
1584 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1585
1586 /* Handle the transformations for reading and writing */
1587 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
2124 */
2125 # if PNG_ARM_NEON_OPT > 0
2126 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2127 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2128 #endif
2129
2130 #if PNG_MIPS_MSA_OPT > 0
2131 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2132 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2133 #endif
2134
2135 # if PNG_INTEL_SSE_IMPLEMENTATION > 0
2136 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
2137 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2138 # endif
2139 #endif
2140
2141 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2142 png_const_charp key, png_bytep new_key), PNG_EMPTY);
2143
2144 /* Maintainer: Put new private prototypes here ^ */
2145
2146 #include "pngdebug.h"
2147
2148 #ifdef __cplusplus
2149 }
2150 #endif
2151
2152 #endif /* PNG_VERSION_INFO_ONLY */
2153 #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 * Copyright (c) 2018-2019 Cosmin Truta
33 * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
34 * Copyright (c) 1996-1997 Andreas Dilger
35 * 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
185 */
186 # ifndef PNG_ARM_NEON_IMPLEMENTATION
187 # if defined(__ARM_NEON__) || defined(__ARM_NEON)
188 # if defined(__clang__)
189 /* At present it is unknown by the libpng developers which versions
190 * of clang support the intrinsics, however some or perhaps all
191 * versions do not work with the assembler so this may be
192 * irrelevant, so just use the default (do nothing here.)
193 */
194 # elif defined(__GNUC__)
195 /* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
196 * work, so if this *is* GCC, or G++, look for a version >4.5
197 */
198 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
199 # define PNG_ARM_NEON_IMPLEMENTATION 2
200 # endif /* no GNUC support */
201 # endif /* __GNUC__ */
202 # else /* !defined __ARM_NEON__ */
203 /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
204 */
205 # if !defined(__aarch64__)
206 /* The assembler code currently does not work on ARM64 */
207 # define PNG_ARM_NEON_IMPLEMENTATION 2
208 # endif /* __aarch64__ */
209 # endif /* __ARM_NEON__ */
210 # endif /* !PNG_ARM_NEON_IMPLEMENTATION */
211
212 # ifndef PNG_ARM_NEON_IMPLEMENTATION
213 /* Use the intrinsics code by default. */
214 # define PNG_ARM_NEON_IMPLEMENTATION 1
215 # endif
216 #endif /* PNG_ARM_NEON_OPT > 0 */
217
218 #ifndef PNG_MIPS_MSA_OPT
219 # if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
220 # define PNG_MIPS_MSA_OPT 2
221 # else
222 # define PNG_MIPS_MSA_OPT 0
223 # endif
224 #endif
225
226 #ifndef PNG_POWERPC_VSX_OPT
227 # if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
228 # define PNG_POWERPC_VSX_OPT 2
281 # elif defined(__GNUC__)
282 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
283 # define PNG_MIPS_MSA_IMPLEMENTATION 2
284 # endif /* no GNUC support */
285 # endif /* __GNUC__ */
286 # else /* !defined __mips_msa */
287 # define PNG_MIPS_MSA_IMPLEMENTATION 2
288 # endif /* __mips_msa */
289 # endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
290
291 # ifndef PNG_MIPS_MSA_IMPLEMENTATION
292 # define PNG_MIPS_MSA_IMPLEMENTATION 1
293 # endif
294 #endif /* PNG_MIPS_MSA_OPT > 0 */
295
296 #if PNG_POWERPC_VSX_OPT > 0
297 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
298 # define PNG_POWERPC_VSX_IMPLEMENTATION 1
299 #endif
300
301
302 /* Is this a build of a DLL where compilation of the object modules requires
303 * different preprocessor settings to those required for a simple library? If
304 * so PNG_BUILD_DLL must be set.
305 *
306 * If libpng is used inside a DLL but that DLL does not export the libpng APIs
307 * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
308 * static library of libpng then link the DLL against that.
309 */
310 #ifndef PNG_BUILD_DLL
311 # ifdef DLL_EXPORT
312 /* This is set by libtool when files are compiled for a DLL; libtool
313 * always compiles twice, even on systems where it isn't necessary. Set
314 * PNG_BUILD_DLL in case it is necessary:
315 */
316 # define PNG_BUILD_DLL
317 # else
318 # ifdef _WINDLL
319 /* This is set by the Microsoft Visual Studio IDE in projects that
320 * build a DLL. It can't easily be removed from those projects (it
321 * isn't visible in the Visual Studio UI) so it is a fairly reliable
1548 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1549 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1550 #endif
1551
1552 #ifdef PNG_READ_tIME_SUPPORTED
1553 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1554 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1555 #endif
1556
1557 #ifdef PNG_READ_tRNS_SUPPORTED
1558 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1559 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1560 #endif
1561
1562 #ifdef PNG_READ_zTXt_SUPPORTED
1563 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1564 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1565 #endif
1566
1567 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
1568 png_uint_32 chunk_name),PNG_EMPTY);
1569
1570 PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
1571 png_uint_32 chunk_length),PNG_EMPTY);
1572
1573 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1574 png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1575 /* This is the function that gets called for unknown chunks. The 'keep'
1576 * argument is either non-zero for a known chunk that has been set to be
1577 * handled as unknown or zero for an unknown chunk. By default the function
1578 * just skips the chunk or errors out if it is critical.
1579 */
1580
1581 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1582 defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1583 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1584 (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1585 /* Exactly as the API png_handle_as_unknown() except that the argument is a
1586 * 32-bit chunk name, not a string.
1587 */
1588 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1589
1590 /* Handle the transformations for reading and writing */
1591 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
2128 */
2129 # if PNG_ARM_NEON_OPT > 0
2130 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2131 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2132 #endif
2133
2134 #if PNG_MIPS_MSA_OPT > 0
2135 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2136 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2137 #endif
2138
2139 # if PNG_INTEL_SSE_IMPLEMENTATION > 0
2140 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
2141 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2142 # endif
2143 #endif
2144
2145 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2146 png_const_charp key, png_bytep new_key), PNG_EMPTY);
2147
2148 #if PNG_ARM_NEON_IMPLEMENTATION == 1
2149 PNG_INTERNAL_FUNCTION(void,
2150 png_riffle_palette_neon,
2151 (png_structrp),
2152 PNG_EMPTY);
2153 PNG_INTERNAL_FUNCTION(int,
2154 png_do_expand_palette_rgba8_neon,
2155 (png_structrp,
2156 png_row_infop,
2157 png_const_bytep,
2158 const png_bytepp,
2159 const png_bytepp),
2160 PNG_EMPTY);
2161 PNG_INTERNAL_FUNCTION(int,
2162 png_do_expand_palette_rgb8_neon,
2163 (png_structrp,
2164 png_row_infop,
2165 png_const_bytep,
2166 const png_bytepp,
2167 const png_bytepp),
2168 PNG_EMPTY);
2169 #endif
2170
2171 /* Maintainer: Put new private prototypes here ^ */
2172
2173 #include "pngdebug.h"
2174
2175 #ifdef __cplusplus
2176 }
2177 #endif
2178
2179 #endif /* PNG_VERSION_INFO_ONLY */
2180 #endif /* PNGPRIV_H */
|