1
0
mirror of https://github.com/glennrp/libpng.git synced 2026-10-24 08:39:18 +03:00

289 Commits

Author SHA1 Message Date
Cosmin Truta
d9b8b8ca78 fix(build): Link pnggetset against libpng2 in the configure build
This fixes a regression introduced during the merge of tag 'v1.6.57'
into branch 'libpng18' and further into branch 'develop'. That merge
brought in `pnggetset_LDADD` with the libpng 1.x library name
`libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la`, which incorrectly resolved
to `libpng20.la` on 'develop'. The correct library name on this branch
is `libpng2.la`.
2026-10-02 18:47:30 +03:00
Cosmin Truta
4543ed7c00 Merge tag 'v1.6.57' into branch 'libpng18' into develop 2026-04-13 11:45:26 +03:00
Cosmin Truta
306b1a1517 Merge tag 'v1.6.57' into libpng18 2026-04-13 11:45:26 +03:00
Cosmin Truta
398cbe3df0 fix: Handle self-referencing pointers in getter-to-setter aliasing
Apply a robustness fix for a caller-side API usage pattern involving
the getters and the setters for PLTE, tRNS, and hIST.

Passing a pointer returned by the PLTE, tRNS, or hIST getters back
into the corresponding setters used to cause the setters to read from
a stale pointer. The fix consists in snapshotting the caller's data
into a stack-local buffer before freeing the old internal storage.

Fixes pnggroup/libpng#836

Reported-by: Iv4n <Iv4n550@noreply.github.com>
2026-03-30 17:35:30 +03:00
Cosmin Truta
eb1662b428 Merge tag 'v1.6.56' into branch 'libpng18' into develop 2026-03-27 13:44:48 +02:00
Cosmin Truta
ef37879423 Merge tag 'v1.6.56' into libpng18 2026-03-27 13:44:48 +02:00
Cosmin Truta
98019f6e70 test: Add negative-stride test coverage to pngstest
Add the option --negative-stride to pngstest. When set, the row stride
is negated after buffer allocation but before calling the library, so
that `png_image_finish_read` and `png_image_write_to_file` exercise the
bottom-up (negative stride) code paths.

Add CI targets for the CMake build and for the configure build:

 - pngstest-negative-stride:
   Bottom-up layout with images covering colormapped, truecolor, alpha,
   8-bit, 16-bit, and short-height paths.
 - pngstest-negative-stride-extra:
   Same with --stride-extra 7 for non-aligned padding with bottom-up
   layout.

Note: the interlaced pngsuite images (`ibasn*.png`) are incompatible
with pngstest's format conversion comparison framework, so the
`png_image_read_direct_scaled` path (interlaced 16-to-8 conversion) is
not exercised by this test. A dedicated test for that path will require
interlaced images generated with the correct gamma properties for
pngstest's comparison logic, which is TODO.
2026-03-23 20:41:12 +02:00
Cosmin Truta
00002286bf fix(test): Add missing test and tidy up the test list in Makefile.am
Add `pngstest-large-stride` to the test list in Makefile.am.

The test `pngstest-large-stride` has a shell script driver in the test
script directory, as well as a target in the CMake file, but it hasn't
been added to the test list in Makefile.am. For this reason, this test
hasn't been run by the configure build.

Also reformat the test list to one entry per line.
2026-03-23 20:06:56 +02:00
Cosmin Truta
151523b6b3 Create the branch 'develop' for libpng version 2 alpha 2025-06-14 19:00:00 +03:00
Filip Wasil
5b62726ced riscv: Fix autodetection of RVV support
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-06-12 18:44:02 +03:00
Filip Wasil
ffb8e8b26f Fix and improve the RISC-V Vector (RVV) implementation
Changes include manually merged code from Manfred SCHLAEGL.

Co-authored-by: Manfred SCHLAEGL <manfred.schlaegl@gmx.at>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-01 17:44:00 +03:00
Dragoș Tiselice
cc5ee6b213 Add optimized RISC-V Vector functions
Largely based off of the ARM NEON implementation.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-05-01 17:44:00 +03:00
John Bowler
b35a98b873 Fix two build regressions
This fixes commit f6aa44850c.
The path to symbols.def in Makefile.am was incorrect.

This also fixes commit 12877b1f39
and commit 9ed344abdd.
The unnecessary ';' after PNG_REMOVED in png.h broke compilation in
pedantic mode.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2025-02-26 18:01:49 +02:00
Cosmin Truta
f6aa44850c build: Move the pnglibconf files and scripts to scripts/pnglibconf/
Considering that pnglibconf is a whole mini-system for configuring and
building libpng, it should be placed in its own dedicated subdirectory.
Any future additions, including tests and documentation, should go into
this subdirectory.

One exception: pnglibconf.h.prebuilt is moved to the top-level source
directory, where pnglibconf.h would be. This follows the organization
pattern typically used with the "*.in" files, for example.

All references to the pnglibconf artifacts, found in machine-readable
code and in human-readable comments, are updated accordingly.
2025-02-02 22:18:39 +02:00
Cosmin Truta
d60d8888c9 Merge tag 'v1.6.46' into libpng18
Sync with libpng version 1.6.46
2025-01-27 17:44:52 +02:00
Cosmin Truta
deadeea7a2 chore: Fix a typo in Makefile.am; rerun ./autogen.sh --maintainer 2025-01-22 15:15:58 +02:00
John Bowler
ed689982c2 Update the support for target-specific code
The change removes the need for build configuration of target specific
code such as SIMD enhancements.

The extensible framework is based on checks in the new file named
pngtarget.h and allows per target description of requirements and
capabilities using macros with the prefix PNG_TARGET_.  These macros are
interpreted by the core libpng code in a target independent way.

The PNG_TARGET_ prefixed macros describe the target specific
implementation and document how to include it.  The actual inclusion of
the code is done, at present, by a single target independent core file
named pngsimd.c.

This approach ensures that no special configuration in the build system
is required on any system.  It is not required on a system which is
compiling for the build host where we can reasonably assume that the
compiler is correctly set up.  Neither is it required for cross builds
so long as the toolchain is correctly set up.  In this case the
toolchain means the cross build system and any ancilliary programs it
requires.

More details of the implementation are included in the source files
named pngtarget.h and pngsimd.c.  These files document in C comments how
additional target specific code might be added.

The changes consist primarily of movement of target specific code from
the core libpng source files to the existing target specific
subdirectories such as the ones named intel and arm.  This isolates the
code into the corresponding subdirectory and eliminates the requirement
for changes across the libpng structure.

As part of this the ARM processor NEON instruction set specific palette
to RGB code has been generalised to allow implementation in other
architectures.  The resultant updated version of the original (ARM Ltd)
implementation has been moved to the subdirectory named arm.

In addition some selected changes have been included to allow testing
with higher warning levels than the typical compiler defaults.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-10-10 21:28:34 +03:00
John Bowler
82f43f71b1 configure: Remove architecture-specific checks for hardware optimization
This mirrors the CMakeLists.txt improvements in configure.ac and
Makefile.am.

The complex compiler check is removed from Loongarch so that it is done
the same way as everything else along with the curious use of a library
in Makefile.am (never done in CMakeLists.txt)

The hard-disable of the Intel SSE optimizations done in libpng1.6 to
ensure that the configure options did not change mid-version is now
removed so the SSE optimizations are on by default (change already made
in 1.6 CMakeLists.txt but not configure.)

Signed-off-by: John Bowler <jbowler@acm.org>
2024-10-08 22:07:35 -07:00
Cosmin Truta
ed4cf84819 doc: Move all manuals to the manuals/ directory
Create the manuals/ directory for storing the software manuals and the
man pages. The upcoming Markdown versions of these document are also
planned to be added here.

Move in the manual files as follows:
 * Move libpng.3 and libpng.5 to manuals/libpng.3 and manuals/libpng.5
 * Move libpng-manual.txt to manuals/libpng-manual.txt
 * Move INSTALL.txt to manuals/libpng-install.txt
 * Remove libpngpf.3

Finally, update the README file, as well as the makefiles and the CMake
file, in order to reflect these changes.
2024-09-14 23:00:13 +03:00
Ross Burton
9e538750d9 arm: Remove obsolete assembler implementation filter_neon.S
This file contains hand-coded assembler implementations of the filter
functions for 32-bit Arm platforms.  These are only used when the
compiler doesn't support neon intrinsics (added to GCC 4.3 in 2008) or
is exactly GCC 4.5.4 (released 2012), both of which are sufficiently
unlikely to be true that it's fair to say the assembler is no longer
used.

This commit deletes filter_neon.S and removes the now obsolete
preprocessor logic in pngpriv.h.

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-06-15 23:09:34 +03:00
John Bowler
ceed2a3cf6 SECURITY: disable build of filter_neon.S on arm
This fixes the bug https://github.com/pnggroup/libpng/issues/505
"libpng does not support PAC/BTI on aarch64 targets" which arises
because the build mechanisms (both cmake and configure) assemble
arm/filter_neon.S even though it ends up completely empty.  The empty
file effectively poisons the so that the PAC/BTI support gets disabled.

The fix is minimal; it simply removes arm/filter_neon.S from the list of
sources included in the 64-bit ARM builds build.  Note that this was
already done in cmake for MSVC - it's not clear whether this change was
a partial fix for the same issue.

This version of the fix ONLY affects aarch64 (arm64) builds; 32-bit ARM
systems can still invoke the assembler if required and, indeed, there
should be no change whatsover to those builds.

The assembler code could not be used on 64-bit systems in any case so
in practice there is no material change to 64-bit builds either.

TESTING: pull the changes then type "autoreconf" if using configure (not
required for cmake).

TESTS: cmake has not been tested because cross-builds with cmake
currently fail to find the zlib installation from the cmake system root
path.  The following has been tested with configure cross builds:

armv7-linux-gnueabi [no neon support]
armv7a-linux-gnueabi [no neon support]
armv7a-hardfloat-linux-gnueabi [neon support not enabled]
armv7a-hardfloat-linux-gnueabi -mfpu=neon [uses intrinics]
armv7a-hardfloat-linux-gnueabi -mfpu=neon
        -DPNG_ARM_NEON_IMPLEMENTATION=2 [uses assembler]
aarch64-linux-gnu [uses intrinsics]
aarch64-linux-gnu -DPNG_ARM_NEON_OPT=0 [neon support disabled]

Signed-off-by: John Bowler <jbowler@acm.org>
2024-05-31 10:18:28 -07:00
Cosmin Truta
671661849a build: Move scripts/*.m4 to scripts/autoconf/
Move all Autoconf macro files (except for those that need to be in
the top-level directory) to their own subdirectory scripts/autoconf/

In this commit, we introduce a better way to organize the scripts dir,
and we make a better separation between the build scripts under the
libpng license vs. the build scripts that fall under other licenses.

Please see scripts/autoconf/README.md for more information.
2024-01-22 15:16:10 +02:00
gxw
ce4b632dd7 Optimize png16 with loongson mmi for 64-bit os 2024-01-17 22:46:16 +02:00
jinbo
6b0d1bd75b Add loongarch support and LSX SIMD optimizations
Enable LSX by default:
    ./configure && make

Disable LSX:
    ./configure --enable-loongarch-lsx=no && make

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-01-17 22:42:02 +02:00
Cosmin Truta
22ad62c25e configure: Rename the recently-added options
Rename
    --enable-png-tests/--disable-png-tests
    --enable-png-tools/--disable-png-tools
to
    --enable-tests/--disable-tests
    --enable-tools/--disable-tools
respectively.

While the `PNG_` prefix is necessary in CMakeLists.txt, a corresponding
`--...-png-` option qualifier would be redundant in a configure script.
2023-08-02 21:42:10 +03:00
Carlo Bramini
71475b064f configure: allow to disable building of tools and test
This PR adds two set of options to the configure script:
    --enable-png-tests/--disable-png-tests
and
    --enable-png-tools/--disable-png-tools

By using this feature, a user will be allowed to build only library if
needed, which will be useful on platforms not able to build the tools
and/or the tests.
This PR leaves the existing behaviour as default setting, by building
both the tools and the tests if the options are not used.

CMakeLists.txt already supports this feature with the options PNG_TESTS
and PNG_EXECUTABLES. After this commit, Autotools will provide the same
feature.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2023-08-02 17:39:36 +03:00
Cosmin Truta
72fa126446 Avoid random test failures by running pngtest sequentially only
It is unreliable to run pngtest in parallel, due to competing writes
to the same intermediate/output file ("pngout.png").

Customization of this output file name should be possible, but it is
currently broken.
2019-04-21 00:30:14 -04:00
Cosmin Truta
eddf902320 Release libpng version 1.6.36 2018-12-01 09:36:00 -05:00
Cosmin Truta
94429a335b Remove the "last changed" version information from source comments 2018-09-04 00:58:55 -04:00
Richard Townsend
7734cda20c Optimize png_do_expand_palette for ARM
ARM-specific optimization processes 8 or 4 pixels at once.
Improves performance by around 10-22% on a recent ARM Chromebook.
2018-09-04 00:04:58 -04:00
Glenn Randers-Pehrson
3d7f3e57b5 [libpng16] Imported from libpng-1.6.32beta10.tar 2017-08-04 20:06:23 -05:00
Vadim Barkov
c47ddcf22b Merge branch 'libpng16' into libpng16 2017-01-30 18:44:09 +03:00
Vadim Barkov
2b6e59d968 Added initial code for PowerPC VSX optimisation 2017-01-14 16:05:33 +03:00
Glenn Randers-Pehrson
8c6c9e6d56 [libpng16] Update credits to include Google Inc, for the Intel/SSE patch. 2017-01-12 09:45:02 -06:00
Glenn Randers-Pehrson
93b3476358 [libpng16] Imported from libpng-1.6.28rc03.tar 2017-01-03 22:25:10 -06:00
Glenn Randers-Pehrson
3785125faf [libpng16] Imported from libpng-1.6.28rc02.tar 2017-01-03 19:23:10 -06:00
Glenn Randers-Pehrson
858cb585d7 [libpng16] Bump version to 1.6.27beta01 2016-10-28 15:25:26 -05:00
Glenn Randers-Pehrson
0c440812db [libpng16] Imported from libpng-1.6.26.tar 2016-10-19 19:11:38 -05:00
Glenn Randers-Pehrson
c9d7b865b6 [libpng16] Bump version to 1.6.26beta01 2016-08-31 23:19:25 -05:00
Glenn Randers-Pehrson
e3a6631123 [libpng16] Imported from libpng-1.6.25.tar 2016-08-31 22:30:47 -05:00
Glenn Randers-Pehrson
2e7c3a6e70 [libpng16] Imported from libpng-1.6.25rc02.tar 2016-08-29 10:45:13 -05:00
Mandar Sahastrabuddhe
ee5e39835c Added build support for MIPS MSA
Also added one msa optimized function: png_read_filter_row_up_msa

Signed-off-by: Mandar Sahastrabuddhe <Mandar.Sahastrabuddhe@imgtec.com>
2016-08-29 19:07:25 +05:30
Glenn Randers-Pehrson
39df0ced18 [libpng16] Don't install pngcp; it conflicts with pngcp in the pngtools package.
Moved it from bin_PROGRAMS to check_PROGRAMS in Makefile.am so it will be
built but not installed.
2016-08-13 21:23:42 -05:00
John Bowler
0ac91cc657 pngcp: tool to copy PNG files
This adds pngcp to the build together with a pngcp.dfa configuration test; the
test revealed some configuration bugs which are fixed by corrections to the
_SUPPORTED macros.

pngcp builds on all tested configurations and a number of bugs have been fixed
to make this happen relative to the version in libpng 1.7 contrib/examples.
pngcp.dfa will have to be different for 1.7 but pngcp.c should work fine (not
yet tested).  pngcp itself is still missing a usage message; this is a
preliminary version, although since it behaves the same way as 'cp' most unoids
shouldn't have a problem using it correctly.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 11:27:43 -07:00
Glenn Randers-Pehrson
d6e5a72c84 [libpng16] Restored contrib/timepng to default build but check for check for
presence of clock_gettime() in configure.ac and Makefile.am.
2016-05-17 18:35:59 -05:00
Glenn Randers-Pehrson
45ad37b31b [libpng16] Removed contrib/timepng from default build; it does not build
on platforms that don't supply clock_gettime().
2016-05-16 16:14:12 -05:00
Glenn Randers-Pehrson
e0acad59cb [libpng16] Imported from libpng-1.6.22beta04.tar 2016-04-05 19:38:22 -05:00
Glenn Randers-Pehrson
6c3d5bd2a0 [libpng16] Moved contrib/intel/*.patch into INSTALL and added intel_sse.patch 2016-02-22 16:38:10 -06:00
John Bowler
23ddeb58a5 pngvalid tests: add --strict, fix test names
Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-25 17:06:58 -07:00
John Bowler
fa5ba2e026 New test PNG files incorporated into make check
tests/pngstest-* are changed so that the new test files are divided into 8
groups by gamma and alpha channel.  This makes each test take just under 5
seconds on a moderately up-to-date x86_64 system using libpng16 (test times are
somewhat variable under libpng17 at present because of the lack of optimization
in some gamma processing paths.)

These tests have considerably better code and pixel-value coverage than
contrib/pngsuite however coverage is still incomplete.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-25 12:41:56 -07:00