Skip to content

Commit

Permalink
PNG 2024-02-10 (7a614829)
Browse files Browse the repository at this point in the history
Run the UpdateFromUpstream.sh script to extract upstream PNG
using the following shell commands.

$ git archive --prefix=upstream-png/ 7a614829 -- 
  png*.c
  png*.h
  arm/*
  LICENSE
  scripts/pnglibconf.h.prebuilt
   | tar x
$ git shortlog --perl-regexp --author='^((?!Kitware Robot).*)$' --no-merges --abbrev=8 --format='%h %s' dbe3e0c4..7a614829

Adam Richter (1):
      866fdf6f Fix an off-by-one error in `png_do_check_palette_indexes`

Alberto Barbaro (1):
      8a5732fc tools: Fix a buffer overflow involving a file name in pngfix

B. Scott Michel (1):
      70fda183 cmake: Fix the Clang support on Windows

Ben Bullock (4):
      cd03aaf7 Remove second call to write_eXIf
      8ca01083 Fix typo in README
      37965188 Remove duplicate line
      a37d4836 Eliminate spaces between function name and (

Cameron Cawley (2):
      763c77e6 cmake: Fix compilation on systems without libm
      ab6d97b7 build: Update and rename makefile.acorn to makefile.riscos

Carlo Bramini (1):
      71475b06 configure: allow to disable building of tools and test

Chris Blume (1):
      7f1f960d Add eXIf support to push mode

Christopher Sean Morrison (1):
      840af2ed cmake: Fix the build on Unix with source files checked out on Windows

Clinton Ingram (1):
      a3d1a35b cmake: Don't add Unix ASM file to the ARM-specific source list for MSVC

Cosmin Truta (129):
      c3f20917 ci: Recognize more CI_ variables for better cross-platform verification
      c2e2cd2e ci: Fix the Visual Studio verification on AppVeyor CI
      d6e13b2a .gitignore: Add
      e2bb5e75 contrib: Apply various fixes to libtests
      8c3fdb0a ci: Update the CI scripts
      b7ea74c9 Update the copyright year
      723b2d9f Update the copyright year
      103f8346 cmake: Set PNG_ARM_NEON to "on" by default on ARM64
      081e6751 ci: Update the CI scripts
      bfb0abe4 Update the configuration for Travis CI and AppVeyor CI
      cc0e9597 Clean up configure.ac
      9e32b6f1 Rerun "./autogen.sh --maintainer"
      6a42bc1c configure: Initialize PNG_ARM_NEON_OPT and PNG_MIPS_MSA_OPT correctly
      0fe598d2 cmake: Rename the target "symbol-check" to "scripts_symbols_chk"
      dd8db810 cmake: Fix the shared build on Android
      3848c73a cmake: Refactor the PNGLIB variables that define the versioning scheme
      c3a1d842 Update INSTALL
      6aff792b projects: Update the README file of the Visual Studio project
      0406deb1 Fix private macro png_constcast; delete private type png_ptruint
      36bd1bbd Fix a crash in png_convert_from_time_t with an invalid time_t argument
      2abaf81e arm: Avoid compiler warnings in palette_neon_intrinsics.c
      8c542ad9 arm: Do not allow PNG_ARM_NEON_CHECK_SUPPORTED on ARM64
      9cb84c4c Delete vestigial declarations formerly used on 16-bit platforms
      0c2388cd projects: Delete the definition of _WINDOWS from the VStudio project
      e9e9801a Simplify the definition of png_isaligned and avoid compiler warnings
      62c027d4 Fix handling incorrect hIST chunks of uneven size
      8b7b99c1 scripts: Clean up the logging in makefile.std and pnglibconf.mak
      c64655d0 scripts: Set the compiler warning options to "-Wall -Wextra -Wundef"
      b60656ec scripts: Disable the hardware-optimized compilation in legacy makefiles
      3c67eeca scripts: Add makefile.emcc for building libpng with Emscripten
      d72cda54 ci: Trace the paths of executable files found on the build machine
      823ef44f scripts: Remove leftover references to the ci_* scripts from README.txt
      abccfd79 .gitignore: Update
      3d57708c Revert "Remove second call to write_eXIf"
      2733482d Fix a last-minute bug in the checking of the EXIF byte-order header
      50d7a851 Acknowledge the contributors of bug fixes applied to the EXIF support
      0a158f35 Release libpng version 1.6.38
      6fc51194 Bump version to 1.6.39.git
      b422bc11 .gitignore: Ignore the autoreconf artifacts
      3f991d50 scripts: Remove makefile.cegcc
      9b65ad49 scripts: Remove the support for "install" targets from all makefiles
      12222e6f scripts: Add missing makefile.clang reference to README.txt
      b8ca9108 arm: Add a compile-time assertion about PNG_ARM_NEON_CHECK_SUPPORTED
      33de006e Turn large PNG chunks into benign errors
      689e0651 Clean up vestigial uses of png_size_tp
      f6036c0a Update, rename and clean up various scripts
      8cfdb543 Clean up oss-fuzz
      77c3a392 Clean up comments and whitespace characters in source files
      32f465a6 Update the file list in README
      07b88031 Release libpng version 1.6.39
      3c761b51 Bump version to 1.6.40.git
      b126f807 Reorganize and update the README file; add Markdown formatting
      5a0b7e9c manuals: Remove references to libpngpf(3); update links
      b445aade ci: Rename the ci_* scripts
      9db8cff6 ci: Fix verification under Cygwin Bash + CMake + Visual Studio; update
      61bfdb0c Update the configuration for Travis CI and AppVeyor CI
      9923515f Update the copyright year
      59fa76e1 ci: Add CMake+Ninja+Clang to the AppVeyor CI matrix
      66fede80 ci: Update the CI scripts
      c22ef3b2 Revert "cmake: Fix the Clang support on Windows"
      aab24fa1 Clean up CMakeLists.txt
      efc96c9d cmake: Redo the fix for Clang support on Windows
      e519af8b cmake: Allow overwriting the debug postfix of library filenames
      f7abe3c4 Avoid a memory leak when allocation of a pCAL buffer fails
      e6c5bf46 Ensure that only one eXIf chunk is written in the entire datastream
      afc6c595 Fix a build regression on Solaris
      f135775a Release libpng version 1.6.40
      d7f77bf2 Bump version to 1.6.41.git
      ad9e42a8 Add .yamllint.yml, a configuration file for yamllint
      c741d1e3 ci: Relicense the CI scripts to the Boost Software License version 1.0
      c0616f10 ci: Add ci.lib.ch; update ci_verify_*.sh accordingly
      82414985 ci: Add ci_lint_ci.sh and .shellcheckrc
      0b7bc40d ci: Introduce CI_HOST_* and CI_TARGET_*
      c81516e9 ci: Fix bad copy pasta in ci_verify_configure.sh
      f8e5fa92 ci: Fix ci_verify_cmake.sh; improve ci.lib.sh
      ee9d6d7b ci: Improve the support for cross-build verifications
      22ad62c2 configure: Rename the recently-added options
      5a6ea182 configure: Rerun "./autogen.sh --maintainer"
      b2ef6edb cmake: Rename PNG_EXECUTABLES to PNG_TOOLS
      53d2188f ci: Update the support for cross-build verifications; refactor
      f79c85e2 Update the configuration for Travis CI and AppVeyor CI
      e755fb79 ci: Quick-fix ci_verify_cmake.sh
      9c1dc4d1 cmake: Fix CPU architecture regexes
      d65b3ebf Revert "cmake: Fix CPU architecture regexes"
      e1088f99 Redo "cmake: Fix CPU architecture regexes"
      8fc13a87 cmake: Enable the libpng framework build by default on Apple systems
      acfd50ae cmake: Clean up functions, string operations, regular expressions, etc.
      2fff013a cmake: Raise the minimum required version to 3.6 and use its features
      85f866de cmake: Enable policy CMP0074 for ZLIB_ROOT; deprecate PNG_BUILD_ZLIB
      437b24a9 mips: Fix the build for generic ANSI C89 compilers
      0dfe422e Update the copyright year
      6abf8c1e Fix the API comment about `png_data_freer`
      c993ae4c pngminus: Update CMake file; rename test scripts; add .gitignore
      abb8d4a7 pngminus: Fix and improve the PNM processing
      bdbbcaa4 pngminus: Improve and modernize the PNG processing
      6beae586 pngminus: Expect all image transformations to be available in libpng
      b3521c60 pngminus: Delete the incomplete output files upon premature termination
      6b241f37 Do not rely on `INT_MAX` in png.h
      7dacc4d5 Rewrite various initializations for the benefit of various compilers
      2a4f0f5a De-volatilize the internal implementation of `png_safe_execute`
      a7fe3414 mips: Wrap up the MIPS/Loongson port and acknowledge the contributors
      7ec2bd28 Update the main Authors file
      438a5186 Update the main AUTHORS file
      67166184 build: Move scripts/*.m4 to scripts/autoconf/
      9a774b91 chore: Rerun `./autogen.sh --maintainer` and update .gitignore
      4edbb4da build: Move scripts/*.cmake.in to scripts/cmake/; add cmake/AUTHORS.md
      3285bf0d ci: Add help options; add checks for the boolean environment options
      6159bad8 ci: Relicense again the CI scripts, from Boost License to MIT License
      92b2128a chore: Add, relocate or rephrase debug statements, for better clarity
      27e548af chore: Clean up the return statements and update example.c accordingly
      ba980b8f Release libpng version 1.6.41
      ac944e2b Fix a regression introduced in "chore: Clean up the return statements"
      537c6666 chore: Fix and update the libpng manual
      31439b6b chore: Fix whitespace in pngpriv.h
      35d9f5ea Release libpng version 1.6.42
      4356cb07 Bump version to 1.6.43.git
      2d7da9db chore: Add .editorconfig files
      f0c57874 chore: Fix a comment in pngrtran.c
      3bd304e5 chore: Split lines in scripts/*.awk to pacify the editorconfig checker
      9138be34 Improve, refactor and clean up pngtest.c
      c9ac5bdb ci: Add a pre-build checkup stage to ci_verify_configure.sh
      aa9023bb test: Remove compile-time option `SINGLE_ROWBUF_ALLOC` from pngtest.c
      cc8006c4 test: Add consistency checks for the `PNG_LIBPNG_VER*` numbers
      920db2ec api: Introduce the `PNG_LIBPNG_VER_SHAREDLIB` macro; update pngwin.rc
      366c9c6a ci: Reformat all scripts using 1TBS
      49eeb1f8 ci: Add ci_shellify.sh
      46b79d47 ci: Update and rename ci_lint_ci.sh to ci_lint.sh; update .shellcheckrc
      c6ee62af ci: Add ci_verify_version.sh
      7a614829 ci: Update the ci_verify_*.sh scripts.

Dan Field (1):
      40342267 Remove obsolete/incorrect __LLVM,__asm section

Felix Hanau (1):
      04c016d7 scripts: Fix the remaining instance of ZLIB_INCLUDE_DIR

Gabor Kertesz (5):
      a1a81cc2 Fix arm neon config for win-arm64 with MSVC
      bbab5710 scripts: Add makefile for win-arm64
      1f20bc1e projects: Upgrade to Visual Studio 2019
      efdb24e5 projects: Fix C2220 warning errors for VS2019
      ed8840a3 projects: Add ARM64 to Visual Studio project

Gleb Mazovetskiy (1):
      cbf8c64b cmake: Correctly handle generated files

Gunther Nikl (1):
      aeb26da4 cmake: Use CMAKE_SHARED_LIBRARY_C_FLAGS in version script checks

Jeremy Maitin-Shepard (1):
      efa9c2e9 cmake: Rename the custom targets to have the png_ prefix

Jesús González (1):
      82097c21 Fix a doc typo in pnglibconf.dfa

John Bowler (17):
      790fef34 tools: Fix a memory leak in pngcp
      71b9b5e1 pngfix: ensure fclose happens last on file close
      2a232474 pngcp: remove GNU setjmp warning workround
      050ce505 pngfix: del workround for GCC7.1 -Wstrict-overflow
      b60316f4 Remove GCC7.1 arithmetic overflow fixup
      2ea11e22 Palette index checking fixes
      f9348b77 write palette check corrections
      da109d3e Improve test coverage with a "correctly" damaged palette index test
      2b814cde Regression test for off-by-one palette check error
      269b7534 Do not build unused Adler32 code
      6f8257e4 tests/pngtest-all: detect failures add tests
      1a0d7a74 Correct regression-palette-8.png
      144b348e Use --xfail for Adler32 check in pngtest-all
      8fb49b8b Relax pngtest-all message testing
      59a68c83 Fix contrib/conftest/pngcp.dfa
      805ed7a2 Correct row width check in png_check_IHDR
      ce1f1f00 API usage: add 'basic' configuration

Jon Creighton (1):
      cd0ea2a7 Fix for universal binaries on macOS

Kleber Tarcísio (1):
      2224c8ea Add a check to pngimage.c

Martin Storsjö (1):
      e56f79c0 cmake: Default to PNG_ARM_NEON=off for arm targets

Owen Rudge (1):
      8a354b41 cmake: Fix cross-compilation on macOS

Paul Eggert (1):
      074e2eaa configure: Fix possible regressions with trunk autoconf (vs 2.71)

Peter Kasting (1):
      5f5f98a1 Fix an instance of -Wunused-but-set-variable.

Qiang Zhou (1):
      c4bd411c Fix decode fail on image with invalid eXIf chunk

Samanta Navarro (1):
      eda0f47f Fix typo in libpng manual

Sami Boukortt (1):
      3ec225dd Fix a memory leak in png_set_tRNS

Stephen Kitt (1):
      9f9f8d8e Fix bashisms

Sui Jingfeng (1):
      2ed5a70b mips: Implement the run-time MIPS MSA discovery function correctly

Timothy Lyanguzov (2):
      f2294569 Use CMake 3.5 features
      1460b3ce cmake: Use Zlib as a package

Tyler Kropp (1):
      1547b335 cmake: Fix copying targets on Windows in multi-config build systems

Vadim Zeitlin (2):
      1f974dd2 Avoid -Wundef warnings for PNG_ARM_NEON_IMPLEMENTATION
      ad0245bb Avoid -Wundef for MIPS and PPC symbols too

Wan-Teh Chang (1):
      8be5c147 Don't report a valid tRNS chunk if it was canceled

Zixu Wang (1):
      893b8113 Fix unused platform check and configuration for macOS

guxiwei (1):
      2aebfb4a loongarch: Add cmake support

gxw (4):
      ce4b632d Optimize png16 with loongson mmi for 64-bit os
      46f1106a Loongson-mips: Fixed typo
      064f9921 Loongson: Fixed compilation warnings for undefined macros.
      70d10da3 MIPS: Fixed undefined MSA interfaces

jinbo (1):
      6b0d1bd7 Add loongarch support and LSX SIMD optimizations

luz paz (1):
      f16427e5 Fix various typos

musvaage (1):
      3c152a8e Fix typos

tangyaofang (1):
      9b548805 Fix comments

xmuli (1):
      f10c6bb6 Add spaces around '/*' and '*/'

Change-Id: I3fb6cc55bcceed561a68b9e3ed77abe6563b0fef
  • Loading branch information
LIBPNG Upstream authored and seanm committed Feb 11, 2024
1 parent 5770e1c commit 55292c9
Show file tree
Hide file tree
Showing 22 changed files with 1,675 additions and 714 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Expand Up @@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
PNG Reference Library License version 2
---------------------------------------

* Copyright (c) 1995-2020 The PNG Reference Library Authors.
* Copyright (c) 2018-2020 Cosmin Truta.
* Copyright (c) 1995-2024 The PNG Reference Library Authors.
* Copyright (c) 2018-2024 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
Expand Down
139 changes: 139 additions & 0 deletions arm/arm_init.c
@@ -0,0 +1,139 @@

/* arm_init.c - NEON optimised filter functions
*
* Copyright (c) 2018-2022 Cosmin Truta
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/

/* This module requires POSIX 1003.1 functions. */
#define _POSIX_SOURCE 1

#include "../pngpriv.h"

#ifdef PNG_READ_SUPPORTED

#if PNG_ARM_NEON_OPT > 0
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
/* WARNING: it is strongly recommended that you do not build libpng with
* run-time checks for CPU features if at all possible. In the case of the ARM
* NEON instructions there is no processor-specific way of detecting the
* presence of the required support, therefore run-time detection is extremely
* OS specific.
*
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
* a fragment of C source code which defines the png_have_neon function. There
* are a number of implementations in contrib/arm-neon, but the only one that
* has partial support is contrib/arm-neon/linux.c - a generic Linux
* implementation which reads /proc/cpufino.
*/
#include <signal.h> /* for sig_atomic_t */

#ifndef PNG_ARM_NEON_FILE
# if defined(__aarch64__) || defined(_M_ARM64)
/* ARM Neon is expected to be unconditionally available on ARM64. */
# error "PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on ARM64"
# elif defined(__ARM_NEON__) || defined(__ARM_NEON)
/* ARM Neon is expected to be available on the target CPU architecture. */
# error "PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on this CPU arch"
# elif defined(__linux__)
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
# else
# error "No support for run-time ARM Neon checking; use compile-time options"
# endif
#endif

static int png_have_neon(png_structp png_ptr);
#ifdef PNG_ARM_NEON_FILE
# include PNG_ARM_NEON_FILE
#endif
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */

#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
#endif

void
png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
{
/* The switch statement is compiled in for ARM_NEON_API, the call to
* png_have_neon is compiled in for ARM_NEON_CHECK. If both are defined
* the check is only performed if the API has not set the NEON option on
* or off explicitly. In this case the check controls what happens.
*
* If the CHECK is not compiled in and the option is UNSET the behavior prior
* to 1.6.7 was to use the NEON code - this was a bug caused by having the
* wrong order of the 'ON' and 'default' cases. UNSET now defaults to OFF,
* as documented in png.h
*/
png_debug(1, "in png_init_filter_functions_neon");
#ifdef PNG_ARM_NEON_API_SUPPORTED
switch ((pp->options >> PNG_ARM_NEON) & 3)
{
case PNG_OPTION_UNSET:
/* Allow the run-time check to execute if it has been enabled -
* thus both API and CHECK can be turned on. If it isn't supported
* this case will fall through to the 'default' below, which just
* returns.
*/
#endif /* PNG_ARM_NEON_API_SUPPORTED */
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED
{
static volatile sig_atomic_t no_neon = -1; /* not checked */

if (no_neon < 0)
no_neon = !png_have_neon(pp);

if (no_neon)
return;
}
#ifdef PNG_ARM_NEON_API_SUPPORTED
break;
#endif
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */

#ifdef PNG_ARM_NEON_API_SUPPORTED
default: /* OFF or INVALID */
return;

case PNG_OPTION_ON:
/* Option turned on */
break;
}
#endif

/* IMPORTANT: any new external functions used here must be declared using
* PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the
* 'prefix' option to configure works:
*
* ./configure --with-libpng-prefix=foobar_
*
* Verify you have got this right by running the above command, doing a build
* and examining pngprefix.h; it must contain a #define for every external
* function you add. (Notice that this happens automatically for the
* initialization function.)
*/
pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_neon;

if (bpp == 3)
{
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon;
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon;
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
png_read_filter_row_paeth3_neon;
}

else if (bpp == 4)
{
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_neon;
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_neon;
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
png_read_filter_row_paeth4_neon;
}
}
#endif /* PNG_ARM_NEON_OPT > 0 */
#endif /* READ */

0 comments on commit 55292c9

Please sign in to comment.