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>
This commit is contained in:
parent
143434ac78
commit
ee5e39835c
@ -1,7 +1,7 @@
|
||||
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||
#
|
||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
||||
# Last changed in libpng 1.6.25beta03 [August 29, 2016]
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@ -97,6 +97,11 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||
endif
|
||||
|
||||
if PNG_MIPS_MSA
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
|
||||
mips/filter_msa_intrinsics.c
|
||||
endif
|
||||
|
||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||
|
49
configure.ac
49
configure.ac
@ -1,7 +1,7 @@
|
||||
# configure.ac
|
||||
|
||||
# Copyright (c) 2004-2015 Glenn Randers-Pehrson
|
||||
# Last changed in libpng 1.6.22 [May 26, 2016]
|
||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||
# Last changed in libpng 1.6.25beta03 [August 29, 2016]
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@ -346,6 +346,51 @@ AM_CONDITIONAL([PNG_ARM_NEON],
|
||||
*) test "$enable_arm_neon" != '';;
|
||||
esac])
|
||||
|
||||
# MIPS
|
||||
# ===
|
||||
#
|
||||
# MIPS MSA (SIMD) support.
|
||||
|
||||
AC_ARG_ENABLE([mips-msa],
|
||||
AS_HELP_STRING([[[--enable-mips-msa]]],
|
||||
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on:]
|
||||
[no/off: disable the optimizations; check: use internal checking code]
|
||||
[(deprecated and poorly supported); api: disable by default, enable by]
|
||||
[a call to png_set_option; yes/on: turn on unconditionally.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable the default enabling on __mips_msa systems:
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Disable MIPS MSA optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_mips_msa=no;;
|
||||
check)
|
||||
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
||||
[Check for MIPS MSA support at run-time]);;
|
||||
api)
|
||||
AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [],
|
||||
[Turn on MIPS MSA optimizations at run-time]);;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
||||
[Enable MIPS MSA optimizations])
|
||||
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if]
|
||||
[you want the optimizations unconditionally pass '-mmsa -mfp64']
|
||||
[to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
|
||||
esac])
|
||||
|
||||
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
|
||||
# where MIPS optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'mips*')
|
||||
|
||||
AM_CONDITIONAL([PNG_MIPS_MSA],
|
||||
[test "$enable_mips_msa" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
mipsel*|mips64el*) :;;
|
||||
esac])
|
||||
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
||||
# Config files, substituting as above
|
||||
|
83
contrib/mips-msa/README
Normal file
83
contrib/mips-msa/README
Normal file
@ -0,0 +1,83 @@
|
||||
OPERATING SYSTEM SPECIFIC MIPS MSA DETECTION
|
||||
--------------------------------------------
|
||||
|
||||
Detection of the ability to execute MIPS MSA on an MIPS processor requires
|
||||
operating system support. (The information is not available in user mode.)
|
||||
|
||||
HOW TO USE THIS
|
||||
---------------
|
||||
|
||||
This directory contains C code fragments that can be included in mips/mips_init.c
|
||||
by setting the macro PNG_MIPS_MSA_FILE to the file name in "" or <> at build
|
||||
time. This setting is not recorded in pnglibconf.h and can be changed simply by
|
||||
rebuilding mips/msa_init.o with the required macro definition.
|
||||
|
||||
For any of this code to be used the MIPS MSA code must be enabled and run time
|
||||
checks must be supported. I.e.:
|
||||
|
||||
#if PNG_MIPS_MSA_OPT > 0
|
||||
#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED
|
||||
|
||||
This is done in a 'configure' build by passing configure the argument:
|
||||
|
||||
--enable-mips-msa=check
|
||||
|
||||
Apart from the basic Linux implementation in contrib/mips-msa/linux.c this code
|
||||
is unsupported. That means that it is not even compiled on a regular basis and
|
||||
may be broken in any given minor release.
|
||||
|
||||
FILE FORMAT
|
||||
-----------
|
||||
|
||||
Each file documents its testing status as of the last time it was tested (which
|
||||
may have been a long time ago):
|
||||
|
||||
STATUS: one of:
|
||||
SUPPORTED: This indicates that the file is included in the regularly
|
||||
performed test builds and bugs are fixed when discovered.
|
||||
COMPILED: This indicates that the code did compile at least once. See the
|
||||
more detailed description for the extent to which the result was
|
||||
successful.
|
||||
TESTED: This means the code was fully compiled into the libpng test programs
|
||||
and these were run at least once.
|
||||
|
||||
BUG REPORTS: an email address to which to send reports of problems
|
||||
|
||||
The file is a fragment of C code. It should not define any 'extern' symbols;
|
||||
everything should be static. It must define the function:
|
||||
|
||||
static int png_have_msa(png_structp png_ptr);
|
||||
|
||||
That function must return 1 if MIPS MSA instructions are supported, 0 if not.
|
||||
It must not execute png_error unless it detects a bug. A png_error will prevent
|
||||
the reading of the PNG and in the future, writing too.
|
||||
|
||||
BUG REPORTS
|
||||
-----------
|
||||
|
||||
If you mail a bug report for any file that is not SUPPORTED there may only be
|
||||
limited response. Consider fixing it and sending a patch to fix the problem -
|
||||
this is more likely to result in action.
|
||||
|
||||
CONTRIBUTIONS
|
||||
-------------
|
||||
|
||||
You may send contributions of new implementations to
|
||||
png-mng-implement@sourceforge.net. Please write code in strict C90 C where
|
||||
possible. Obviously OS dependencies are to be expected. If you submit code you
|
||||
must have the authors permission and it must have a license that is acceptable
|
||||
to the current maintainer; in particular that license must permit modification
|
||||
and redistribution.
|
||||
|
||||
Please try to make the contribution a single file and give the file a clear and
|
||||
unambiguous name that identifies the target OS. If multiple files really are
|
||||
required put them all in a sub-directory.
|
||||
|
||||
You must also be prepared to handle bug reports from users of the code, either
|
||||
by joining the png-mng-implement mailing list or by providing an email for the
|
||||
"BUG REPORTS" entry or both. Please make sure that the header of the file
|
||||
contains the STATUS and BUG REPORTS fields as above.
|
||||
|
||||
Please list the OS requirements as precisely as possible. Ideally you should
|
||||
also list the environment in which the code has been tested and certainly list
|
||||
any environments where you suspect it might not work.
|
64
contrib/mips-msa/linux.c
Normal file
64
contrib/mips-msa/linux.c
Normal file
@ -0,0 +1,64 @@
|
||||
/* contrib/mips-msa/linux.c
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
* Written by Mandar Sahastrabuddhe, 2016.
|
||||
* Last changed in libpng 1.6.25beta03 [August 29, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* SEE contrib/mips-msa/README before reporting bugs
|
||||
*
|
||||
* STATUS: SUPPORTED
|
||||
* BUG REPORTS: png-mng-implement@sourceforge.net
|
||||
*
|
||||
* png_have_msa implemented for Linux by reading the widely available
|
||||
* pseudo-file /proc/cpuinfo.
|
||||
*
|
||||
* This code is strict ANSI-C and is probably moderately portable; it does
|
||||
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int
|
||||
png_have_msa(png_structp png_ptr)
|
||||
{
|
||||
FILE *f = fopen("/proc/cpuinfo", "rb");
|
||||
|
||||
char *string = "msa";
|
||||
char word[10];
|
||||
|
||||
if (f != NULL)
|
||||
{
|
||||
while(!feof(f))
|
||||
{
|
||||
int ch = fgetc(f);
|
||||
static int i = 0;
|
||||
|
||||
while(!(ch <= 32))
|
||||
{
|
||||
word[i++] = ch;
|
||||
ch = fgetc(f);
|
||||
}
|
||||
|
||||
int val = strcmp(string, word);
|
||||
|
||||
if (val == 0)
|
||||
return 1;
|
||||
|
||||
i = 0;
|
||||
memset(word, 0, 10);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
else
|
||||
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
182
mips/filter_msa_intrinsics.c
Normal file
182
mips/filter_msa_intrinsics.c
Normal file
@ -0,0 +1,182 @@
|
||||
|
||||
/* filter_msa_intrinsics.c - MSA optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
* Written by Mandar Sahastrabuddhe, August 2016.
|
||||
* Last changed in libpng 1.6.25beta03 [August 29, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* This code requires -mfpu=msa on the command line: */
|
||||
#if PNG_MIPS_MSA_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||
|
||||
#include <msa.h>
|
||||
|
||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
||||
* however this code will only work with appropriate alignment. mips/mips_init.c
|
||||
* checks for this (and will not compile unless it is done). This code uses
|
||||
* variants of png_aligncast to avoid compiler warnings.
|
||||
*/
|
||||
#define png_ptr(type,pointer) png_aligncast(type *,pointer)
|
||||
#define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer)
|
||||
|
||||
/* The following relies on a variable 'temp_pointer' being declared with type
|
||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
||||
* warning; note that the code is safe because there never is an alias between
|
||||
* the input and output pointers.
|
||||
*/
|
||||
#define png_ldr(type,pointer)\
|
||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||
|
||||
#if PNG_MIPS_MSA_OPT > 0
|
||||
|
||||
#define LD_B(RTYPE, psrc) *((RTYPE *) (psrc))
|
||||
#define LD_UB(...) LD_B(v16u8, __VA_ARGS__)
|
||||
#define LD_B2(RTYPE, psrc, stride, out0, out1) \
|
||||
{ \
|
||||
out0 = LD_B(RTYPE, (psrc)); \
|
||||
out1 = LD_B(RTYPE, (psrc) + stride); \
|
||||
}
|
||||
#define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__)
|
||||
#define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) \
|
||||
{ \
|
||||
LD_B2(RTYPE, (psrc), stride, out0, out1); \
|
||||
LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \
|
||||
}
|
||||
#define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__)
|
||||
|
||||
#define ST_B(RTYPE, in, pdst) *((RTYPE *) (pdst)) = (in)
|
||||
#define ST_UB(...) ST_B(v16u8, __VA_ARGS__)
|
||||
#define ST_B2(RTYPE, in0, in1, pdst, stride) \
|
||||
{ \
|
||||
ST_B(RTYPE, in0, (pdst)); \
|
||||
ST_B(RTYPE, in1, (pdst) + stride); \
|
||||
}
|
||||
#define ST_UB2(...) ST_B2(v16u8, __VA_ARGS__)
|
||||
#define ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride) \
|
||||
{ \
|
||||
ST_B2(RTYPE, in0, in1, (pdst), stride); \
|
||||
ST_B2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \
|
||||
}
|
||||
#define ST_UB4(...) ST_B4(v16u8, __VA_ARGS__)
|
||||
|
||||
#define ADD2(in0, in1, in2, in3, out0, out1) \
|
||||
{ \
|
||||
out0 = in0 + in1; \
|
||||
out1 = in2 + in3; \
|
||||
}
|
||||
#define ADD3(in0, in1, in2, in3, in4, in5, \
|
||||
out0, out1, out2) \
|
||||
{ \
|
||||
ADD2(in0, in1, in2, in3, out0, out1); \
|
||||
out2 = in4 + in5; \
|
||||
}
|
||||
#define ADD4(in0, in1, in2, in3, in4, in5, in6, in7, \
|
||||
out0, out1, out2, out3) \
|
||||
{ \
|
||||
ADD2(in0, in1, in2, in3, out0, out1); \
|
||||
ADD2(in4, in5, in6, in7, out2, out3); \
|
||||
}
|
||||
|
||||
void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i, cnt, cnt16, cnt32;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
|
||||
|
||||
for (i = 0; i < (istop >> 6); i++)
|
||||
{
|
||||
LD_UB4(rp, 16, src0, src1, src2, src3);
|
||||
LD_UB4(pp, 16, src4, src5, src6, src7);
|
||||
pp += 64;
|
||||
|
||||
ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
|
||||
src0, src1, src2, src3);
|
||||
|
||||
ST_UB4(src0, src1, src2, src3, rp, 16);
|
||||
rp += 64;
|
||||
}
|
||||
|
||||
if (istop & 0x3F)
|
||||
{
|
||||
cnt32 = istop & 0x20;
|
||||
cnt16 = istop & 0x10;
|
||||
cnt = istop & 0xF;
|
||||
|
||||
if(cnt32)
|
||||
{
|
||||
if (cnt16 && cnt)
|
||||
{
|
||||
LD_UB4(rp, 16, src0, src1, src2, src3);
|
||||
LD_UB4(pp, 16, src4, src5, src6, src7);
|
||||
|
||||
ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
|
||||
src0, src1, src2, src3);
|
||||
|
||||
ST_UB4(src0, src1, src2, src3, rp, 16);
|
||||
rp += 64;
|
||||
}
|
||||
else if (cnt16 || cnt)
|
||||
{
|
||||
LD_UB2(rp, 16, src0, src1);
|
||||
LD_UB2(pp, 16, src4, src5);
|
||||
pp += 32;
|
||||
src2 = LD_UB(rp + 32);
|
||||
src6 = LD_UB(pp);
|
||||
|
||||
ADD3(src0, src4, src1, src5, src2, src6, src0, src1, src2);
|
||||
|
||||
ST_UB2(src0, src1, rp, 16);
|
||||
rp += 32;
|
||||
ST_UB(src2, rp);
|
||||
rp += 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
LD_UB2(rp, 16, src0, src1);
|
||||
LD_UB2(pp, 16, src4, src5);
|
||||
|
||||
ADD2(src0, src4, src1, src5, src0, src1);
|
||||
|
||||
ST_UB2(src0, src1, rp, 16);
|
||||
rp += 32;
|
||||
}
|
||||
}
|
||||
else if (cnt16 && cnt)
|
||||
{
|
||||
LD_UB2(rp, 16, src0, src1);
|
||||
LD_UB2(pp, 16, src4, src5);
|
||||
|
||||
ADD2(src0, src4, src1, src5, src0, src1);
|
||||
|
||||
ST_UB2(src0, src1, rp, 16);
|
||||
rp += 32;
|
||||
}
|
||||
else if (cnt16 || cnt)
|
||||
{
|
||||
src0 = LD_UB(rp);
|
||||
src4 = LD_UB(pp);
|
||||
pp += 16;
|
||||
|
||||
src0 += src4;
|
||||
|
||||
ST_UB(src0, rp);
|
||||
rp += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
||||
#endif /* PNG_MIPS_MSA_IMPLEMENTATION == 1 (intrinsics) */
|
||||
#endif /* READ */
|
115
mips/mips_init.c
Normal file
115
mips/mips_init.c
Normal file
@ -0,0 +1,115 @@
|
||||
|
||||
/* mips_init.c - MSA optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
* Written by Mandar Sahastrabuddhe, 2016.
|
||||
* Last changed in libpng 1.6.25beta03 [August 29, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||
* called.
|
||||
*/
|
||||
#define _POSIX_SOURCE 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
#if PNG_MIPS_MSA_OPT > 0
|
||||
#ifdef PNG_MIPS_MSA_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 MIPS
|
||||
* MSA 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_MIPS_MSA_FILE to the file name of file containing
|
||||
* a fragment of C source code which defines the png_have_msa function. There
|
||||
* are a number of implementations in contrib/mips-msa, but the only one that
|
||||
* has partial support is contrib/mips-msa/linux.c - a generic Linux
|
||||
* implementation which reads /proc/cpufino.
|
||||
*/
|
||||
#ifndef PNG_MIPS_MSA_FILE
|
||||
# ifdef __linux__
|
||||
# define PNG_MIPS_MSA_FILE "contrib/mips-msa/linux.c"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_MIPS_MSA_FILE
|
||||
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
static int png_have_msa(png_structp png_ptr);
|
||||
#include PNG_MIPS_MSA_FILE
|
||||
|
||||
#else /* PNG_MIPS_MSA_FILE */
|
||||
# error "PNG_MIPS_MSA_FILE undefined: no support for run-time MIPS MSA checks"
|
||||
#endif /* PNG_MIPS_MSA_FILE */
|
||||
#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
|
||||
|
||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
|
||||
#endif
|
||||
|
||||
void
|
||||
png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
|
||||
{
|
||||
/* The switch statement is compiled in for MIPS_MSA_API, the call to
|
||||
* png_have_msa is compiled in for MIPS_MSA_CHECK. If both are defined
|
||||
* the check is only performed if the API has not set the MSA option on
|
||||
* or off explicitly. In this case the check controls what happens.
|
||||
*/
|
||||
|
||||
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
||||
switch ((pp->options >> PNG_MIPS_MSA) & 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_MIPS_MSA_API_SUPPORTED */
|
||||
#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED
|
||||
{
|
||||
static volatile sig_atomic_t no_msa = -1; /* not checked */
|
||||
|
||||
if (no_msa < 0)
|
||||
no_msa = !png_have_msa(pp);
|
||||
|
||||
if (no_msa)
|
||||
return;
|
||||
}
|
||||
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
||||
break;
|
||||
#endif
|
||||
#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MIPS_MSA_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_msa;
|
||||
}
|
||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
||||
#endif /* READ */
|
8
png.h
8
png.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.25beta03, August 18, 2016
|
||||
* libpng version 1.6.25beta03, August 29, 2016
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -29,7 +29,7 @@
|
||||
* files that are distributed with libpng have other copyright owners and
|
||||
* are released under other open source licenses.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.25beta03, August 18, 2016 are
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.25beta03, August 29, 2016 are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
||||
* derived from libpng-1.0.6, and are distributed according to the same
|
||||
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
@ -41,6 +41,7 @@
|
||||
* Cosmin Truta
|
||||
* Gilles Vollant
|
||||
* James Yu
|
||||
* Mandar Sahastrabuddhe
|
||||
*
|
||||
* and with the following additions to the disclaimer:
|
||||
*
|
||||
@ -3224,6 +3225,9 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
||||
#endif
|
||||
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
||||
# define PNG_MIPS_MSA 0 /* HARDWARE: MIPS Msa SIMD instructions supported */
|
||||
#endif
|
||||
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
||||
#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
|
||||
#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
|
||||
|
41
pngpriv.h
41
pngpriv.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.25 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.25beta [August 29, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -182,6 +182,35 @@
|
||||
# endif
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
|
||||
#ifndef PNG_MIPS_MSA_OPT
|
||||
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||
# define PNG_MIPS_MSA_OPT 2
|
||||
# else
|
||||
# define PNG_MIPS_MSA_OPT 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if PNG_MIPS_MSA_OPT > 0
|
||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
|
||||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||
# if defined(__mips_msa)
|
||||
# if defined(__clang__)
|
||||
# elif defined(__GNUC__)
|
||||
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
|
||||
# define PNG_MIPS_MSA_IMPLEMENTATION 2
|
||||
# endif /* no GNUC support */
|
||||
# endif /* __GNUC__ */
|
||||
# else /* !defined __mips_msa */
|
||||
# define PNG_MIPS_MSA_IMPLEMENTATION 2
|
||||
# endif /* __mips_msa */
|
||||
# endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
|
||||
|
||||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||
# define PNG_MIPS_MSA_IMPLEMENTATION 1
|
||||
# endif
|
||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
||||
|
||||
|
||||
/* Is this a build of a DLL where compilation of the object modules requires
|
||||
* different preprocessor settings to those required for a simple library? If
|
||||
* so PNG_BUILD_DLL must be set.
|
||||
@ -1191,6 +1220,11 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#if PNG_MIPS_MSA_OPT > 0
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
|
||||
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* Choose the best filter to use and filter the row data */
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
||||
png_row_infop row_info),PNG_EMPTY);
|
||||
@ -1921,6 +1955,11 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
|
||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#if PNG_MIPS_MSA_OPT > 0
|
||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
|
||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
||||
|
Loading…
Reference in New Issue
Block a user