7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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 */
|
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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 * Copyright (c) 2018-2019 Cosmin Truta
28 * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
29 * Copyright (c) 1996-1997 Andreas Dilger
30 * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
31 *
32 * This code is released under the libpng license.
33 * For conditions of distribution and use, see the disclaimer
34 * and license in png.h
35 */
36
37 /* The symbols declared in this file (including the functions declared
38 * as extern) are PRIVATE. They are not part of the libpng public
39 * interface, and are not recommended for use by regular applications.
40 * Some of them may become public in the future; others may stay private,
41 * change in an incompatible way, or even disappear.
42 * Although the libpng users are not forbidden to include this header,
43 * they should be well aware of the issues that may arise from doing so.
44 */
45
46 #ifndef PNGPRIV_H
47 #define PNGPRIV_H
48
49 /* Feature Test Macros. The following are defined here to ensure that correctly
50 * implemented libraries reveal the APIs libpng needs to build and hide those
180 */
181 # ifndef PNG_ARM_NEON_IMPLEMENTATION
182 # if defined(__ARM_NEON__) || defined(__ARM_NEON)
183 # if defined(__clang__)
184 /* At present it is unknown by the libpng developers which versions
185 * of clang support the intrinsics, however some or perhaps all
186 * versions do not work with the assembler so this may be
187 * irrelevant, so just use the default (do nothing here.)
188 */
189 # elif defined(__GNUC__)
190 /* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
191 * work, so if this *is* GCC, or G++, look for a version >4.5
192 */
193 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
194 # define PNG_ARM_NEON_IMPLEMENTATION 2
195 # endif /* no GNUC support */
196 # endif /* __GNUC__ */
197 # else /* !defined __ARM_NEON__ */
198 /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
199 */
200 # if !defined(__aarch64__)
201 /* The assembler code currently does not work on ARM64 */
202 # define PNG_ARM_NEON_IMPLEMENTATION 2
203 # endif /* __aarch64__ */
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 #ifndef PNG_POWERPC_VSX_OPT
222 # if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
223 # define PNG_POWERPC_VSX_OPT 2
276 # elif defined(__GNUC__)
277 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
278 # define PNG_MIPS_MSA_IMPLEMENTATION 2
279 # endif /* no GNUC support */
280 # endif /* __GNUC__ */
281 # else /* !defined __mips_msa */
282 # define PNG_MIPS_MSA_IMPLEMENTATION 2
283 # endif /* __mips_msa */
284 # endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
285
286 # ifndef PNG_MIPS_MSA_IMPLEMENTATION
287 # define PNG_MIPS_MSA_IMPLEMENTATION 1
288 # endif
289 #endif /* PNG_MIPS_MSA_OPT > 0 */
290
291 #if PNG_POWERPC_VSX_OPT > 0
292 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
293 # define PNG_POWERPC_VSX_IMPLEMENTATION 1
294 #endif
295
296
297 /* Is this a build of a DLL where compilation of the object modules requires
298 * different preprocessor settings to those required for a simple library? If
299 * so PNG_BUILD_DLL must be set.
300 *
301 * If libpng is used inside a DLL but that DLL does not export the libpng APIs
302 * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
303 * static library of libpng then link the DLL against that.
304 */
305 #ifndef PNG_BUILD_DLL
306 # ifdef DLL_EXPORT
307 /* This is set by libtool when files are compiled for a DLL; libtool
308 * always compiles twice, even on systems where it isn't necessary. Set
309 * PNG_BUILD_DLL in case it is necessary:
310 */
311 # define PNG_BUILD_DLL
312 # else
313 # ifdef _WINDLL
314 /* This is set by the Microsoft Visual Studio IDE in projects that
315 * build a DLL. It can't easily be removed from those projects (it
316 * isn't visible in the Visual Studio UI) so it is a fairly reliable
1543 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1544 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1545 #endif
1546
1547 #ifdef PNG_READ_tIME_SUPPORTED
1548 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1549 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1550 #endif
1551
1552 #ifdef PNG_READ_tRNS_SUPPORTED
1553 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1554 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1555 #endif
1556
1557 #ifdef PNG_READ_zTXt_SUPPORTED
1558 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1559 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1560 #endif
1561
1562 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
1563 png_uint_32 chunk_name),PNG_EMPTY);
1564
1565 PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
1566 png_uint_32 chunk_length),PNG_EMPTY);
1567
1568 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1569 png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1570 /* This is the function that gets called for unknown chunks. The 'keep'
1571 * argument is either non-zero for a known chunk that has been set to be
1572 * handled as unknown or zero for an unknown chunk. By default the function
1573 * just skips the chunk or errors out if it is critical.
1574 */
1575
1576 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1577 defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1578 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1579 (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1580 /* Exactly as the API png_handle_as_unknown() except that the argument is a
1581 * 32-bit chunk name, not a string.
1582 */
1583 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1584
1585 /* Handle the transformations for reading and writing */
1586 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
2123 */
2124 # if PNG_ARM_NEON_OPT > 0
2125 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2126 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2127 #endif
2128
2129 #if PNG_MIPS_MSA_OPT > 0
2130 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2131 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2132 #endif
2133
2134 # if PNG_INTEL_SSE_IMPLEMENTATION > 0
2135 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
2136 (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2137 # endif
2138 #endif
2139
2140 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2141 png_const_charp key, png_bytep new_key), PNG_EMPTY);
2142
2143 #if PNG_ARM_NEON_IMPLEMENTATION == 1
2144 PNG_INTERNAL_FUNCTION(void,
2145 png_riffle_palette_neon,
2146 (png_structrp),
2147 PNG_EMPTY);
2148 PNG_INTERNAL_FUNCTION(int,
2149 png_do_expand_palette_rgba8_neon,
2150 (png_structrp,
2151 png_row_infop,
2152 png_const_bytep,
2153 const png_bytepp,
2154 const png_bytepp),
2155 PNG_EMPTY);
2156 PNG_INTERNAL_FUNCTION(int,
2157 png_do_expand_palette_rgb8_neon,
2158 (png_structrp,
2159 png_row_infop,
2160 png_const_bytep,
2161 const png_bytepp,
2162 const png_bytepp),
2163 PNG_EMPTY);
2164 #endif
2165
2166 /* Maintainer: Put new private prototypes here ^ */
2167
2168 #include "pngdebug.h"
2169
2170 #ifdef __cplusplus
2171 }
2172 #endif
2173
2174 #endif /* PNG_VERSION_INFO_ONLY */
2175 #endif /* PNGPRIV_H */
|