< prev index next >

src/share/native/sun/awt/libpng/pngpriv.h

Print this page
rev 13657 : 8217676: Upgrade libpng to 1.6.37
Reviewed-by: prr, jdv, kcr


  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


 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 #ifdef PNG_POWERPC_VSX_API_SUPPORTED
 294 #if PNG_POWERPC_VSX_OPT > 0
 295 #  define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
 296 #  define PNG_POWERPC_VSX_IMPLEMENTATION 1
 297 #endif
 298 #endif
 299 
 300 

 301 /* Is this a build of a DLL where compilation of the object modules requires
 302  * different preprocessor settings to those required for a simple library?  If
 303  * so PNG_BUILD_DLL must be set.
 304  *
 305  * If libpng is used inside a DLL but that DLL does not export the libpng APIs
 306  * PNG_BUILD_DLL must not be set.  To avoid the code below kicking in build a
 307  * static library of libpng then link the DLL against that.
 308  */
 309 #ifndef PNG_BUILD_DLL
 310 #  ifdef DLL_EXPORT
 311       /* This is set by libtool when files are compiled for a DLL; libtool
 312        * always compiles twice, even on systems where it isn't necessary.  Set
 313        * PNG_BUILD_DLL in case it is necessary:
 314        */
 315 #     define PNG_BUILD_DLL
 316 #  else
 317 #     ifdef _WINDLL
 318          /* This is set by the Microsoft Visual Studio IDE in projects that
 319           * build a DLL.  It can't easily be removed from those projects (it
 320           * isn't visible in the Visual Studio UI) so it is a fairly reliable


1547 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1548     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1549 #endif
1550 
1551 #ifdef PNG_READ_tIME_SUPPORTED
1552 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1553     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1554 #endif
1555 
1556 #ifdef PNG_READ_tRNS_SUPPORTED
1557 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1558     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1559 #endif
1560 
1561 #ifdef PNG_READ_zTXt_SUPPORTED
1562 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1563     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1564 #endif
1565 
1566 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
1567     const png_uint_32 chunk_name),PNG_EMPTY);
1568 
1569 PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
1570     const png_uint_32 chunk_length),PNG_EMPTY);
1571 
1572 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1573     png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1574    /* This is the function that gets called for unknown chunks.  The 'keep'
1575     * argument is either non-zero for a known chunk that has been set to be
1576     * handled as unknown or zero for an unknown chunk.  By default the function
1577     * just skips the chunk or errors out if it is critical.
1578     */
1579 
1580 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1581     defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1582 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1583     (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1584    /* Exactly as the API png_handle_as_unknown() except that the argument is a
1585     * 32-bit chunk name, not a string.
1586     */
1587 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1588 
1589 /* Handle the transformations for reading and writing */
1590 #ifdef PNG_READ_TRANSFORMS_SUPPORTED


2126     * CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
2127     */
2128 #  if PNG_ARM_NEON_OPT > 0
2129 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2130    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2131 #endif
2132 
2133 #if PNG_MIPS_MSA_OPT > 0
2134 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2135    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2136 #endif
2137 
2138 #  if PNG_INTEL_SSE_IMPLEMENTATION > 0
2139 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
2140    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2141 #  endif
2142 #endif
2143 
2144 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2145    png_const_charp key, png_bytep new_key), PNG_EMPTY);























2146 
2147 /* Maintainer: Put new private prototypes here ^ */
2148 
2149 #include "pngdebug.h"
2150 
2151 #ifdef __cplusplus
2152 }
2153 #endif
2154 
2155 #endif /* PNG_VERSION_INFO_ONLY */
2156 #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


 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 #ifdef PNG_POWERPC_VSX_API_SUPPORTED
 297 #if PNG_POWERPC_VSX_OPT > 0
 298 #  define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
 299 #  define PNG_POWERPC_VSX_IMPLEMENTATION 1
 300 #endif
 301 #endif
 302 
 303 
 304 
 305 /* Is this a build of a DLL where compilation of the object modules requires
 306  * different preprocessor settings to those required for a simple library?  If
 307  * so PNG_BUILD_DLL must be set.
 308  *
 309  * If libpng is used inside a DLL but that DLL does not export the libpng APIs
 310  * PNG_BUILD_DLL must not be set.  To avoid the code below kicking in build a
 311  * static library of libpng then link the DLL against that.
 312  */
 313 #ifndef PNG_BUILD_DLL
 314 #  ifdef DLL_EXPORT
 315       /* This is set by libtool when files are compiled for a DLL; libtool
 316        * always compiles twice, even on systems where it isn't necessary.  Set
 317        * PNG_BUILD_DLL in case it is necessary:
 318        */
 319 #     define PNG_BUILD_DLL
 320 #  else
 321 #     ifdef _WINDLL
 322          /* This is set by the Microsoft Visual Studio IDE in projects that
 323           * build a DLL.  It can't easily be removed from those projects (it
 324           * isn't visible in the Visual Studio UI) so it is a fairly reliable


1551 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
1552     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1553 #endif
1554 
1555 #ifdef PNG_READ_tIME_SUPPORTED
1556 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
1557     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1558 #endif
1559 
1560 #ifdef PNG_READ_tRNS_SUPPORTED
1561 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
1562     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1563 #endif
1564 
1565 #ifdef PNG_READ_zTXt_SUPPORTED
1566 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
1567     png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
1568 #endif
1569 
1570 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
1571     png_uint_32 chunk_name),PNG_EMPTY);
1572 
1573 PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
1574     png_uint_32 chunk_length),PNG_EMPTY);
1575 
1576 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
1577     png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
1578    /* This is the function that gets called for unknown chunks.  The 'keep'
1579     * argument is either non-zero for a known chunk that has been set to be
1580     * handled as unknown or zero for an unknown chunk.  By default the function
1581     * just skips the chunk or errors out if it is critical.
1582     */
1583 
1584 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1585     defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1586 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
1587     (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
1588    /* Exactly as the API png_handle_as_unknown() except that the argument is a
1589     * 32-bit chunk name, not a string.
1590     */
1591 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
1592 
1593 /* Handle the transformations for reading and writing */
1594 #ifdef PNG_READ_TRANSFORMS_SUPPORTED


2130     * CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
2131     */
2132 #  if PNG_ARM_NEON_OPT > 0
2133 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
2134    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2135 #endif
2136 
2137 #if PNG_MIPS_MSA_OPT > 0
2138 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
2139    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2140 #endif
2141 
2142 #  if PNG_INTEL_SSE_IMPLEMENTATION > 0
2143 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
2144    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
2145 #  endif
2146 #endif
2147 
2148 PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
2149    png_const_charp key, png_bytep new_key), PNG_EMPTY);
2150 
2151 #if PNG_ARM_NEON_IMPLEMENTATION == 1
2152 PNG_INTERNAL_FUNCTION(void,
2153                       png_riffle_palette_neon,
2154                       (png_structrp),
2155                       PNG_EMPTY);
2156 PNG_INTERNAL_FUNCTION(int,
2157                       png_do_expand_palette_rgba8_neon,
2158                       (png_structrp,
2159                        png_row_infop,
2160                        png_const_bytep,
2161                        const png_bytepp,
2162                        const png_bytepp),
2163                       PNG_EMPTY);
2164 PNG_INTERNAL_FUNCTION(int,
2165                       png_do_expand_palette_rgb8_neon,
2166                       (png_structrp,
2167                        png_row_infop,
2168                        png_const_bytep,
2169                        const png_bytepp,
2170                        const png_bytepp),
2171                       PNG_EMPTY);
2172 #endif
2173 
2174 /* Maintainer: Put new private prototypes here ^ */
2175 
2176 #include "pngdebug.h"
2177 
2178 #ifdef __cplusplus
2179 }
2180 #endif
2181 
2182 #endif /* PNG_VERSION_INFO_ONLY */
2183 #endif /* PNGPRIV_H */
< prev index next >