mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Moved contrib/intel/*.patch into INSTALL and added intel_sse.patch
This commit is contained in:
parent
da9d1d7aa6
commit
6c3d5bd2a0
@ -1,6 +1,11 @@
|
|||||||
# Makefile.am:
|
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||||
# Source file for Makefile.in (and hence Makefile)
|
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
|
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
# configure.ac
|
# configure.ac
|
||||||
|
|
||||||
|
# Copyright (c) 2004-2015 Glenn Randers-Pehrson
|
||||||
|
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
||||||
|
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl
|
dnl
|
||||||
dnl Minor upgrades (compatible ABI): increment the package version
|
dnl Minor upgrades (compatible ABI): increment the package version
|
||||||
|
@ -1,8 +1,84 @@
|
|||||||
|
Enabling SSE support
|
||||||
|
|
||||||
To enable SSE support in libpng, manually edit configure.ac and Makefile.am,
|
Copyright (c) 2016 Google, Inc.
|
||||||
following the instructions in the configure.ac.patch and Makefile.am.patch
|
Written by Mike Klein and Matt Sarett
|
||||||
files, then configure with -DPNG_INTEL_SSE in CPPFLAGS.
|
|
||||||
|
|
||||||
If you have moved the *.c files to a different directory, be sure to update
|
To enable SSE support in libpng, apply intel_sse.patch in your build
|
||||||
the '#include "../../pngpriv.h"' line in both files if necessary to point
|
directory. If you prefer, manually edit configure.ac and Makefile.am,
|
||||||
to the correct relative location of pngpriv.h.
|
following the instructions below.
|
||||||
|
|
||||||
|
Then configure libpng with -DPNG_INTEL_SSE in CPPFLAGS.
|
||||||
|
If you only want to optimize 4bpp images, also use -DPNG_NO_INTEL_SSE_3BPP.
|
||||||
|
|
||||||
|
If you have moved intel_init.c and filter_sse2_intrinsics.c to a different
|
||||||
|
directory, be sure to update the '#include "../../pngpriv.h"' line in both
|
||||||
|
files if necessary to point to the correct relative location of pngpriv.h
|
||||||
|
with respect to the new location of those files.
|
||||||
|
|
||||||
|
1. Insert the following lines above the copyright line near the top of
|
||||||
|
configure.ac:
|
||||||
|
|
||||||
|
-----------------cut----------------
|
||||||
|
# Copyright (c) 2016 Google, Inc.
|
||||||
|
# Written by Mike Klein and Matt Sarett
|
||||||
|
# Derived from the ARM supporting code in libpng/configure.ac, which was
|
||||||
|
-----------------cut----------------
|
||||||
|
|
||||||
|
2. Add the following code to configure.ac under HOST SPECIFIC OPTIONS
|
||||||
|
directly beneath the section for ARM:
|
||||||
|
|
||||||
|
-----------------cut----------------
|
||||||
|
# INTEL
|
||||||
|
# =====
|
||||||
|
#
|
||||||
|
# INTEL SSE (SIMD) support.
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([intel-sse],
|
||||||
|
AS_HELP_STRING([[[--enable-intel-sse]]],
|
||||||
|
[Enable Intel SSE optimizations: =no/off, yes/on:]
|
||||||
|
[no/off: disable the optimizations;]
|
||||||
|
[yes/on: enable the optimizations.]
|
||||||
|
[If not specified: determined by the compiler.]),
|
||||||
|
[case "$enableval" in
|
||||||
|
no|off)
|
||||||
|
# disable the default enabling:
|
||||||
|
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||||
|
[Disable Intel SSE optimizations])
|
||||||
|
# Prevent inclusion of the assembler files below:
|
||||||
|
enable_intel_sse=no;;
|
||||||
|
yes|on)
|
||||||
|
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||||
|
[Enable Intel SSE optimizations]);;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
|
||||||
|
esac])
|
||||||
|
|
||||||
|
# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
|
||||||
|
# or where Intel optimizations were explicitly requested (this allows a
|
||||||
|
# fallback if a future host CPU does not match 'x86*')
|
||||||
|
AM_CONDITIONAL([PNG_INTEL_SSE],
|
||||||
|
[test "$enable_intel_sse" != 'no' &&
|
||||||
|
case "$host_cpu" in
|
||||||
|
i?86|x86_64) :;;
|
||||||
|
*) test "$enable_intel_sse" != '';;
|
||||||
|
esac])
|
||||||
|
-----------------cut----------------
|
||||||
|
|
||||||
|
3. Insert the following lines above the copyright line near the top of
|
||||||
|
Makefile.am:
|
||||||
|
|
||||||
|
-----------------cut----------------
|
||||||
|
# Copyright (c) 2016 Google, Inc.
|
||||||
|
# Written by Mike Klein and Matt Sarett
|
||||||
|
# Derived from the ARM supporting code in libpng/configure.ac, which was
|
||||||
|
-----------------cut----------------
|
||||||
|
|
||||||
|
4. Add the following code to Makefile.am under HOST SPECIFIC OPTIONS
|
||||||
|
directly beneath the "if PNG_ARM_NEON ... endif" statement:
|
||||||
|
|
||||||
|
-----------------cut----------------
|
||||||
|
if PNG_INTEL_SSE
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\
|
||||||
|
contrib/intel/filter_sse2_intrinsics.c
|
||||||
|
endif
|
||||||
|
-----------------cut----------------
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
# Copyright (c) 2016 Google, Inc.
|
|
||||||
# Written by Mike Klein and Matt Sarett
|
|
||||||
# Derived from the ARM supporting code in libpng/Makefile.am, which was
|
|
||||||
# Copyright (c) 2004-2015 Glenn Randers-Pehrson
|
|
||||||
#
|
|
||||||
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
|
||||||
#
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
#
|
|
||||||
# In order to compile Intel SSE optimizations for libpng, please add
|
|
||||||
# the following code to Makefile.am under HOST SPECIFIC OPTIONS
|
|
||||||
# directly beneath the "if PNG_ARM_NEON ... endif" statement.
|
|
||||||
|
|
||||||
if PNG_INTEL_SSE
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\
|
|
||||||
contrib/intel/filter_sse2_intrinsics.c
|
|
||||||
endif
|
|
@ -1,50 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2016 Google, Inc.
|
|
||||||
# Written by Mike Klein and Matt Sarett
|
|
||||||
# Derived from the ARM supporting code in libpng/configure.ac, which was
|
|
||||||
# Copyright (c) 2004-2015 Glenn Randers-Pehrson
|
|
||||||
#
|
|
||||||
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
|
||||||
#
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
#
|
|
||||||
# In order to compile Intel SSE optimizations for libpng, please add
|
|
||||||
# the following code to configure.ac under HOST SPECIFIC OPTIONS
|
|
||||||
# directly beneath the section for ARM.
|
|
||||||
|
|
||||||
# INTEL
|
|
||||||
# =====
|
|
||||||
#
|
|
||||||
# INTEL SSE (SIMD) support.
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([intel-sse],
|
|
||||||
AS_HELP_STRING([[[--enable-intel-sse]]],
|
|
||||||
[Enable Intel SSE optimizations: =no/off, yes/on:]
|
|
||||||
[no/off: disable the optimizations;]
|
|
||||||
[yes/on: enable the optimizations.]
|
|
||||||
[If not specified: determined by the compiler.]),
|
|
||||||
[case "$enableval" in
|
|
||||||
no|off)
|
|
||||||
# disable the default enabling:
|
|
||||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
|
||||||
[Disable Intel SSE optimizations])
|
|
||||||
# Prevent inclusion of the assembler files below:
|
|
||||||
enable_intel_sse=no;;
|
|
||||||
yes|on)
|
|
||||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
|
||||||
[Enable Intel SSE optimizations]);;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
|
|
||||||
esac])
|
|
||||||
|
|
||||||
# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
|
|
||||||
# or where Intel optimizations were explicitly requested (this allows a
|
|
||||||
# fallback if a future host CPU does not match 'x86*')
|
|
||||||
AM_CONDITIONAL([PNG_INTEL_SSE],
|
|
||||||
[test "$enable_intel_sse" != 'no' &&
|
|
||||||
case "$host_cpu" in
|
|
||||||
i?86|x86_64) :;;
|
|
||||||
*) test "$enable_intel_sse" != '';;
|
|
||||||
esac])
|
|
@ -29,25 +29,30 @@
|
|||||||
* whichever of a, b, or c is closest to p=a+b-c.
|
* whichever of a, b, or c is closest to p=a+b-c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef PNG_NO_INTEL_SSE_3BPP
|
||||||
static __m128i load3(const void* p) {
|
static __m128i load3(const void* p) {
|
||||||
png_uint_32 packed;
|
png_uint_32 packed;
|
||||||
memcpy(&packed, p, 3);
|
memcpy(&packed, p, 3);
|
||||||
return _mm_cvtsi32_si128(packed);
|
return _mm_cvtsi32_si128(packed);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static __m128i load4(const void* p) {
|
static __m128i load4(const void* p) {
|
||||||
return _mm_cvtsi32_si128(*(const int*)p);
|
return _mm_cvtsi32_si128(*(const int*)p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PNG_NO_INTEL_SSE_3BPP
|
||||||
static void store3(void* p, __m128i v) {
|
static void store3(void* p, __m128i v) {
|
||||||
png_uint_32 packed = _mm_cvtsi128_si32(v);
|
png_uint_32 packed = _mm_cvtsi128_si32(v);
|
||||||
memcpy(p, &packed, 3);
|
memcpy(p, &packed, 3);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void store4(void* p, __m128i v) {
|
static void store4(void* p, __m128i v) {
|
||||||
*(int*)p = _mm_cvtsi128_si32(v);
|
*(int*)p = _mm_cvtsi128_si32(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PNG_NO_INTEL_SSE_3BPP
|
||||||
void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
||||||
png_const_bytep prev)
|
png_const_bytep prev)
|
||||||
{
|
{
|
||||||
@ -68,6 +73,7 @@ void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
|||||||
rb -= 3;
|
rb -= 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
||||||
png_const_bytep prev)
|
png_const_bytep prev)
|
||||||
@ -90,6 +96,7 @@ void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PNG_NO_INTEL_SSE_3BPP
|
||||||
void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
||||||
png_const_bytep prev)
|
png_const_bytep prev)
|
||||||
{
|
{
|
||||||
@ -122,6 +129,7 @@ void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
|||||||
rb -= 3;
|
rb -= 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row,
|
void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row,
|
||||||
png_const_bytep prev)
|
png_const_bytep prev)
|
||||||
@ -184,6 +192,7 @@ static __m128i if_then_else(__m128i c, __m128i t, __m128i e) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PNG_NO_INTEL_SSE_3BPP
|
||||||
void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
||||||
png_const_bytep prev)
|
png_const_bytep prev)
|
||||||
{
|
{
|
||||||
@ -242,6 +251,7 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
|||||||
rb -= 3;
|
rb -= 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row,
|
void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row,
|
||||||
png_const_bytep prev)
|
png_const_bytep prev)
|
||||||
|
107
contrib/intel/intel_sse.patch
Normal file
107
contrib/intel/intel_sse.patch
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
--- a/configure.ac 2016-02-22 14:31:48.000000000 -0600
|
||||||
|
+++ b/configure.ac 2016-02-22 14:40:13.665955674 -0600
|
||||||
|
@@ -1,10 +1,13 @@
|
||||||
|
# configure.ac
|
||||||
|
|
||||||
|
+# Copyright (c) 2016 Google, Inc.
|
||||||
|
+# Written by Mike Klein and Matt Sarett
|
||||||
|
+# Derived from the ARM supporting code in libpng/configure.ac, which was
|
||||||
|
# Copyright (c) 2004-2015 Glenn Randers-Pehrson
|
||||||
|
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
||||||
|
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
@@ -314,16 +317,50 @@ AC_ARG_ENABLE([arm-neon],
|
||||||
|
# future host CPU does not match 'arm*')
|
||||||
|
|
||||||
|
AM_CONDITIONAL([PNG_ARM_NEON],
|
||||||
|
[test "$enable_arm_neon" != 'no' &&
|
||||||
|
case "$host_cpu" in
|
||||||
|
arm*|aarch64*) :;;
|
||||||
|
*) test "$enable_arm_neon" != '';;
|
||||||
|
esac])
|
||||||
|
+
|
||||||
|
+# INTEL
|
||||||
|
+# =====
|
||||||
|
+#
|
||||||
|
+# INTEL SSE (SIMD) support.
|
||||||
|
+
|
||||||
|
+AC_ARG_ENABLE([intel-sse],
|
||||||
|
+ AS_HELP_STRING([[[--enable-intel-sse]]],
|
||||||
|
+ [Enable Intel SSE optimizations: =no/off, yes/on:]
|
||||||
|
+ [no/off: disable the optimizations;]
|
||||||
|
+ [yes/on: enable the optimizations.]
|
||||||
|
+ [If not specified: determined by the compiler.]),
|
||||||
|
+ [case "$enableval" in
|
||||||
|
+ no|off)
|
||||||
|
+ # disable the default enabling:
|
||||||
|
+ AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||||
|
+ [Disable Intel SSE optimizations])
|
||||||
|
+ # Prevent inclusion of the assembler files below:
|
||||||
|
+ enable_intel_sse=no;;
|
||||||
|
+ yes|on)
|
||||||
|
+ AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||||
|
+ [Enable Intel SSE optimizations]);;
|
||||||
|
+ *)
|
||||||
|
+ AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
|
||||||
|
+ esac])
|
||||||
|
+
|
||||||
|
+# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
|
||||||
|
+# or where Intel optimizations were explicitly requested (this allows a
|
||||||
|
+# fallback if a future host CPU does not match 'x86*')
|
||||||
|
+AM_CONDITIONAL([PNG_INTEL_SSE],
|
||||||
|
+ [test "$enable_intel_sse" != 'no' &&
|
||||||
|
+ case "$host_cpu" in
|
||||||
|
+ i?86|x86_64) :;;
|
||||||
|
+ *) test "$enable_intel_sse" != '';;
|
||||||
|
esac])
|
||||||
|
|
||||||
|
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||||
|
|
||||||
|
# Config files, substituting as above
|
||||||
|
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
|
||||||
|
AC_CONFIG_FILES([libpng-config:libpng-config.in],
|
||||||
|
[chmod +x libpng-config])
|
||||||
|
diff --git a/Makefile.am b/Makefile.am
|
||||||
|
--- a/Makefile.am 2016-02-22 14:31:47.000000000 -0600
|
||||||
|
+++ b/Makefile.am 2016-02-22 14:42:40.380041684 -0600
|
||||||
|
@@ -1,10 +1,13 @@
|
||||||
|
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||||
|
#
|
||||||
|
+# Copyright (c) 2016 Google, Inc.
|
||||||
|
+# Written by Mike Klein and Matt Sarett
|
||||||
|
+# Derived from the ARM supporting code in libpng/configure.ac, which was
|
||||||
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
|
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
@@ -83,16 +88,21 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SO
|
||||||
|
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
|
||||||
|
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
|
||||||
|
|
||||||
|
if PNG_ARM_NEON
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||||
|
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
+if PNG_INTEL_SSE
|
||||||
|
+libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\
|
||||||
|
+ contrib/intel/filter_sse2_intrinsics.c
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||||
|
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||||
|
-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
|
||||||
|
|
||||||
|
if HAVE_LD_VERSION_SCRIPT
|
||||||
|
# Versioned symbols and restricted exports
|
||||||
|
if HAVE_SOLARIS_LD
|
Loading…
x
Reference in New Issue
Block a user