Imported from libpng-1.2.6rc1.tar
This commit is contained in:
parent
5fea36fb00
commit
272489dc69
19
ANNOUNCE
19
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.2.6beta4 - July 28, 2004
|
||||
Libpng 1.2.6rc1 - August 4, 2004
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@ -76,9 +76,24 @@ Changes since the last public release (1.2.5):
|
||||
Revised "clobber list" in pnggccrd.c so it will compile under gcc-3.4.
|
||||
Revised Borland portion of png_malloc() to return NULL or issue
|
||||
png_error() according to setting of PNG_FLAG_MALLOC_NULL_MEM_OK.
|
||||
Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove
|
||||
sequential read support.
|
||||
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
||||
#ifdef'ed out some redundancy in png_malloc_default().
|
||||
Use png_malloc instead of png_zalloc to allocate the pallete.
|
||||
Rearranged order of processing of color types in png_handle_tRNS().
|
||||
Added PNG_ROWBYTES macro to calculate rowbytes without integer overflow.
|
||||
Updated makefile.darwin and removed makefile.macosx from scripts directory.
|
||||
Imposed default one million column, one-million row limits on the image
|
||||
dimensions, and added png_set_user_limits() function and
|
||||
PNG_SET_USER_LIMITS_SUPPORTED macro to override them..
|
||||
Fixed wrong cast of returns from png_get_user_width|height_max().
|
||||
Fixed buffer overflow vulnerability in png_handle_tRNS()
|
||||
Fixed integer arithmetic overflow vulnerability in png_read_png().
|
||||
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
|
||||
duplicate chunk types to go undetected.
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to glennrp@users.sourceforge.net
|
||||
|
||||
Glenn R-P
|
||||
|
||||
|
25
CHANGES
25
CHANGES
@ -1241,7 +1241,7 @@ version 1.2.6beta3 [July 18, 2004]
|
||||
Updated contrib/visupng/VisualPng.dsp (Cosmin).
|
||||
Updated contrib/visupng/cexcept.h to version 2.0.0 (Cosmin).
|
||||
Added a separate distribution with "configure" and supporting files (Junichi).
|
||||
version 1.2.6beta4 [July 28, 2004]
|
||||
version 1.2.6beta4 [August 4, 2004]
|
||||
Added user ability to change png_size_t via a PNG_SIZE_T macro.
|
||||
Added png_sizeof() and png_convert_size() functions.
|
||||
Added PNG_SIZE_MAX (maximum value of a png_size_t variable.
|
||||
@ -1256,6 +1256,7 @@ version 1.2.6beta4 [July 28, 2004]
|
||||
overflow.
|
||||
Turn on PNG_NO_ZALLOC_ZERO by default in version 1.2.x
|
||||
Revised "clobber list" in pnggccrd.c so it will compile under gcc-3.4.
|
||||
version 1.2.6beta4 [July 28, 2004]
|
||||
Revised Borland portion of png_malloc() to return NULL or issue
|
||||
png_error() according to setting of PNG_FLAG_MALLOC_NULL_MEM_OK.
|
||||
Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove
|
||||
@ -1263,7 +1264,27 @@ version 1.2.6beta4 [July 28, 2004]
|
||||
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
||||
#ifdef'ed out some redundancy in png_malloc_default().
|
||||
Use png_malloc instead of png_zalloc to allocate the pallete.
|
||||
|
||||
version 1.2.6beta4d [July 28, 2004]
|
||||
Fixed buffer overflow vulnerability in png_handle_tRNS()
|
||||
Fixed integer arithmetic overflow vulnerability in png_read_png().
|
||||
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
|
||||
duplicate chunk types to go undetected.
|
||||
Fixed some timestamps in the -config version
|
||||
version 1.2.6beta4e [July 28, 2004]
|
||||
Fixed some timestamps in the -config version
|
||||
version 1.2.6beta4f [July 28, 2004]
|
||||
Rearranged order of processing of color types in png_handle_tRNS().
|
||||
version 1.2.6beta4g [July 31, 2004]
|
||||
Added ROWBYTES macro to calculate rowbytes without integer overflow.
|
||||
Updated makefile.darwin and removed makefile.macosx from scripts directory.
|
||||
version 1.2.6beta4h [August 1, 2004]
|
||||
Imposed default one million column, one-million row limits on the image
|
||||
dimensions, and added png_set_user_limits() function to override them.
|
||||
Revised use of PNG_SET_USER_LIMITS_SUPPORTED macro.
|
||||
version 1.2.6beta4j [August 1, 2004]
|
||||
Fixed wrong cast of returns from png_get_user_width|height_max().
|
||||
version 1.2.6rc6 [August 4, 2004]
|
||||
Changed some "keep the compiler happy" from empty statements to returns,
|
||||
|
||||
Send comments/corrections/commendations to
|
||||
png-implement@ccrc.wustl.edu or to glennrp@users.sourceforge.net
|
||||
|
17
INSTALL
17
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.2.6beta4 - July 28, 2004
|
||||
Installing libpng version 1.2.6rc1 - August 4, 2004
|
||||
|
||||
Before installing libpng, you must first install zlib. zlib
|
||||
can usually be found wherever you got libpng. zlib can be
|
||||
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
|
||||
version of zlib that's installed.
|
||||
|
||||
You can rename the directories that you downloaded (they
|
||||
might be called "libpng-1.2.6beta4" or "lpng109" and "zlib-1.1.3"
|
||||
might be called "libpng-1.2.6rc1" or "lpng109" and "zlib-1.1.3"
|
||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
@ -64,8 +64,8 @@ The files that are presently available in the scripts directory
|
||||
include
|
||||
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.6beta4)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.6beta4,
|
||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.6rc1)
|
||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.6rc1,
|
||||
uses assembler code tuned for Intel MMX platform)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
@ -73,7 +73,7 @@ include
|
||||
ftp://ftp.cs.wisc.edu/ghost)
|
||||
makefile.aix => AIX/gcc makefile
|
||||
makefile.cygwin => Cygwin/gcc makefile
|
||||
makefile.darwin => Darwin makefile
|
||||
makefile.darwin => Darwin makefile, can use on MacosX
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.hpgcc => FreeBSD makefile
|
||||
makefile.hpgcc => HPUX makefile using gcc
|
||||
@ -81,15 +81,14 @@ include
|
||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||
makefile.intel => Intel C/C++ version 4.0 and later
|
||||
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
||||
makefile.macosx => MACOS X Makefile
|
||||
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
|
||||
makefile.ne0bsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng0.so
|
||||
makefile.openbsd => OpenBSD makefile
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.6beta4)
|
||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.6rc1)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.6beta4)
|
||||
makefile.so9 => Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.6beta4)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.6rc1)
|
||||
makefile.so9 => Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.6rc1)
|
||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
|
2
KNOWNBUG
2
KNOWNBUG
@ -1,5 +1,5 @@
|
||||
|
||||
Known bugs in libpng version 1.2.6beta4
|
||||
Known bugs in libpng version 1.2.6rc1
|
||||
|
||||
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
|
||||
reading interlaced PNG files, when assembler code is enabled but running
|
||||
|
4
LICENSE
4
LICENSE
@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng version 1.2.6, July 28, 2004, is
|
||||
libpng version 1.2.6, August 4, 2004, is
|
||||
Copyright (c) 2004 Glenn Randers-Pehrson, and is
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
@ -107,4 +107,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp@users.sourceforge.net
|
||||
July 28, 2004
|
||||
August 4, 2004
|
||||
|
2
README
2
README
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.2.6beta4 - July 28, 2004 (shared library 12.0)
|
||||
README for libpng version 1.2.6rc1 - August 4, 2004 (shared library 12.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
4
Y2KINFO
4
Y2KINFO
@ -1,13 +1,13 @@
|
||||
Y2K compliance in libpng:
|
||||
=========================
|
||||
|
||||
July 28, 2004
|
||||
August 4, 2004
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.2.6beta4 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.2.6rc1 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
|
4
configure
vendored
4
configure
vendored
@ -1,13 +1,13 @@
|
||||
#!/bin/sh
|
||||
echo "
|
||||
There is no \"configure\" script in this distribution of
|
||||
libpng-1.2.6beta4.
|
||||
libpng-1.2.6rc1.
|
||||
|
||||
Instead, please copy the appropriate makefile for your system from the
|
||||
\"scripts\" directory. Read the INSTALL file for more details.
|
||||
|
||||
Update, July 2004: you can get a "configure" based distribution
|
||||
from the libpng distribution sites. Download the file
|
||||
libpng-1.2.6beta4-config.tar.gz
|
||||
libpng-1.2.6rc1-config.tar.gz
|
||||
"
|
||||
|
||||
|
292
libpng.3
292
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "July 28, 2004"
|
||||
.TH LIBPNG 3 "August 4, 2004"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6beta4
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6rc1
|
||||
.SH SYNOPSIS
|
||||
\fI\fB
|
||||
|
||||
@ -266,10 +266,18 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6beta4
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBpng_uint_32 png_get_user_height_max( png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBpng_voidp png_get_user_transform_ptr (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBpng_uint_32 png_get_user_width_max (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBpng_uint_32 png_get_valid (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIflag\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
@ -650,6 +658,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6beta4
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_set_user_limits (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIuser_width_max\fP\fB, png_uint_32 \fIuser_height_max\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_set_user_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIuser_transform_ptr\fP\fB, int \fP\fIuser_transform_depth\fP\fB, int \fIuser_transform_channels\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
@ -761,7 +773,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
|
||||
.SH LIBPNG.TXT
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.2.6beta4 - July 28, 2004
|
||||
libpng version 1.2.6rc1 - August 4, 2004
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp@users.sourceforge.net>
|
||||
Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
@ -1061,6 +1073,28 @@ To inform libpng about your function, use
|
||||
|
||||
png_set_read_status_fn(png_ptr, read_row_callback);
|
||||
|
||||
%-%.SS Width and height limits
|
||||
%-%
|
||||
%-%The PNG specification allows the width and height of an image to be as
|
||||
%-%large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||
%-%Since very few applications really need to process such large images,
|
||||
%-%we have imposed an arbitrary 1-million limit on rows and columns.
|
||||
%-%Larger images will be rejected immediately with a png_error() call. If
|
||||
%-%you wish to override this limit, you can use
|
||||
%-%
|
||||
%-% png_set_user_limits(png_ptr, width_max, height_max);
|
||||
%-%
|
||||
%-%to set your own limits, or use width_max = height_max = 0x7fffffffL
|
||||
%-%to allow all valid dimensions (libpng may reject some very large images
|
||||
%-%anyway because of potential buffer overflow conditions).
|
||||
%-%
|
||||
%-%You should put this statement after you create the PNG structure and
|
||||
%-%before calling png_read_info(), png_read_png(), or png_process_data().
|
||||
%-%If you need to retrieve the limits that are being applied, use
|
||||
%-%
|
||||
%-% width_max = png_get_user_width_max(png_ptr);
|
||||
%-% height_max = png_get_user_height_max(png_ptr);
|
||||
%-%
|
||||
.SS Unknown-chunk handling
|
||||
|
||||
Now you get to set the way the library processes unknown chunks in the
|
||||
@ -1069,7 +1103,7 @@ behavior is that known chunks will be parsed into information in
|
||||
various info_ptr members; unknown chunks will be discarded. To change
|
||||
this, you can call:
|
||||
|
||||
png_set_keep_unknown_chunks(png_ptr, info_ptr, keep,
|
||||
png_set_keep_unknown_chunks(png_ptr, keep,
|
||||
chunk_list, num_chunks);
|
||||
keep - 0: do not keep
|
||||
1: keep only if safe-to-copy
|
||||
@ -3420,125 +3454,125 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
||||
having level = 0 will be printed. There aren't any such statements in
|
||||
this version of libpng, but if you insert some they will be printed.
|
||||
|
||||
.SH VI. Runtime optimization
|
||||
|
||||
A new feature in libpng 1.2.0 is the ability to dynamically switch between
|
||||
standard and optimized versions of some routines. Currently these are
|
||||
limited to three computationally intensive tasks when reading PNG files:
|
||||
decoding row filters, expanding interlacing, and combining interlaced or
|
||||
transparent row data with previous row data. Currently the optimized
|
||||
versions are available only for x86 (Intel, AMD, etc.) platforms with
|
||||
MMX support, though this may change in future versions. (For example,
|
||||
the non-MMX assembler optimizations for zlib might become similarly
|
||||
runtime-selectable in future releases, in which case libpng could be
|
||||
extended to support them. Alternatively, the compile-time choice of
|
||||
floating-point versus integer routines for gamma correction might become
|
||||
runtime-selectable.)
|
||||
|
||||
Because such optimizations tend to be very platform- and compiler-dependent,
|
||||
both in how they are written and in how they perform, the new runtime code
|
||||
in libpng has been written to allow programs to query, enable, and disable
|
||||
either specific optimizations or all such optimizations. For example, to
|
||||
enable all possible optimizations (bearing in mind that some "optimizations"
|
||||
may actually run more slowly in rare cases):
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
png_uint_32 mask, flags;
|
||||
|
||||
flags = png_get_asm_flags(png_ptr);
|
||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
||||
png_set_asm_flags(png_ptr, flags | mask);
|
||||
#endif
|
||||
|
||||
To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ
|
||||
by itself when calling png_get_asm_flagmask(); similarly for optimizing
|
||||
only writing. To disable all optimizations:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
flags = png_get_asm_flags(png_ptr);
|
||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
||||
png_set_asm_flags(png_ptr, flags & ~mask);
|
||||
#endif
|
||||
|
||||
To enable or disable only MMX-related features, use png_get_mmx_flagmask()
|
||||
in place of png_get_asm_flagmask(). The mmx version takes one additional
|
||||
parameter:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
int selection = PNG_SELECT_READ | PNG_SELECT_WRITE;
|
||||
int compilerID;
|
||||
|
||||
mask = png_get_mmx_flagmask(selection, &compilerID);
|
||||
#endif
|
||||
|
||||
On return, compilerID will indicate which version of the MMX assembler
|
||||
optimizations was compiled. Currently two flavors exist: Microsoft
|
||||
Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2).
|
||||
On non-x86 platforms or on systems compiled without MMX optimizations, a
|
||||
value of -1 is used.
|
||||
|
||||
Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return
|
||||
all valid, settable optimization bits for the version of the library that's
|
||||
currently in use. In the case of shared (dynamically linked) libraries,
|
||||
this may include optimizations that did not exist at the time the code was
|
||||
written and compiled. It is also possible, of course, to enable only known,
|
||||
specific optimizations; for example:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
flags = PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||
png_set_asm_flags(png_ptr, flags);
|
||||
#endif
|
||||
|
||||
This method would enable only the MMX read-optimizations available at the
|
||||
time of libpng 1.2.0's release, regardless of whether a later version of
|
||||
the DLL were actually being used. (Also note that these functions did not
|
||||
exist in versions older than 1.2.0, so any attempt to run a dynamically
|
||||
linked app on such an older version would fail.)
|
||||
|
||||
To determine whether the processor supports MMX instructions at all, use
|
||||
the png_mmx_support() function:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
mmxsupport = png_mmx_support();
|
||||
#endif
|
||||
|
||||
It returns -1 if MMX support is not compiled into libpng, 0 if MMX code
|
||||
is compiled but MMX is not supported by the processor, or 1 if MMX support
|
||||
is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(),
|
||||
and png_get_asm_flagmask() all may be called without allocating and ini-
|
||||
tializing any PNG structures (for example, as part of a usage screen or
|
||||
"about" box).
|
||||
|
||||
The following code can be used to prevent an application from using the
|
||||
thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK
|
||||
defined:
|
||||
|
||||
#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
|
||||
&& defined(PNG_THREAD_UNSAFE_OK)
|
||||
/* Disable thread-unsafe features of pnggccrd */
|
||||
if (png_access_version() >= 10200)
|
||||
{
|
||||
png_uint_32 mmx_disable_mask = 0;
|
||||
png_uint_32 asm_flags;
|
||||
|
||||
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
||||
asm_flags = png_get_asm_flags(png_ptr);
|
||||
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
||||
}
|
||||
#endif
|
||||
|
||||
For more extensive examples of runtime querying, enabling and disabling
|
||||
of optimized features, see contrib/gregbook/readpng2.c in the libpng
|
||||
source-code distribution.
|
||||
|
||||
%-%.SH VI. Runtime optimization
|
||||
%-%
|
||||
%-%A new feature in libpng 1.2.0 is the ability to dynamically switch between
|
||||
%-%standard and optimized versions of some routines. Currently these are
|
||||
%-%limited to three computationally intensive tasks when reading PNG files:
|
||||
%-%decoding row filters, expanding interlacing, and combining interlaced or
|
||||
%-%transparent row data with previous row data. Currently the optimized
|
||||
%-%versions are available only for x86 (Intel, AMD, etc.) platforms with
|
||||
%-%MMX support, though this may change in future versions. (For example,
|
||||
%-%the non-MMX assembler optimizations for zlib might become similarly
|
||||
%-%runtime-selectable in future releases, in which case libpng could be
|
||||
%-%extended to support them. Alternatively, the compile-time choice of
|
||||
%-%floating-point versus integer routines for gamma correction might become
|
||||
%-%runtime-selectable.)
|
||||
%-%
|
||||
%-%Because such optimizations tend to be very platform- and compiler-dependent,
|
||||
%-%both in how they are written and in how they perform, the new runtime code
|
||||
%-%in libpng has been written to allow programs to query, enable, and disable
|
||||
%-%either specific optimizations or all such optimizations. For example, to
|
||||
%-%enable all possible optimizations (bearing in mind that some "optimizations"
|
||||
%-%may actually run more slowly in rare cases):
|
||||
%-%
|
||||
%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
%-% png_uint_32 mask, flags;
|
||||
%-%
|
||||
%-% flags = png_get_asm_flags(png_ptr);
|
||||
%-% mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
||||
%-% png_set_asm_flags(png_ptr, flags | mask);
|
||||
%-% #endif
|
||||
%-%
|
||||
%-%To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ
|
||||
%-%by itself when calling png_get_asm_flagmask(); similarly for optimizing
|
||||
%-%only writing. To disable all optimizations:
|
||||
%-%
|
||||
%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
%-% flags = png_get_asm_flags(png_ptr);
|
||||
%-% mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
||||
%-% png_set_asm_flags(png_ptr, flags & ~mask);
|
||||
%-% #endif
|
||||
%-%
|
||||
%-%To enable or disable only MMX-related features, use png_get_mmx_flagmask()
|
||||
%-%in place of png_get_asm_flagmask(). The mmx version takes one additional
|
||||
%-%parameter:
|
||||
%-%
|
||||
%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
%-% int selection = PNG_SELECT_READ | PNG_SELECT_WRITE;
|
||||
%-% int compilerID;
|
||||
%-%
|
||||
%-% mask = png_get_mmx_flagmask(selection, &compilerID);
|
||||
%-% #endif
|
||||
%-%
|
||||
%-%On return, compilerID will indicate which version of the MMX assembler
|
||||
%-%optimizations was compiled. Currently two flavors exist: Microsoft
|
||||
%-%Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2).
|
||||
%-%On non-x86 platforms or on systems compiled without MMX optimizations, a
|
||||
%-%value of -1 is used.
|
||||
%-%
|
||||
%-%Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return
|
||||
%-%all valid, settable optimization bits for the version of the library that's
|
||||
%-%currently in use. In the case of shared (dynamically linked) libraries,
|
||||
%-%this may include optimizations that did not exist at the time the code was
|
||||
%-%written and compiled. It is also possible, of course, to enable only known,
|
||||
%-%specific optimizations; for example:
|
||||
%-%
|
||||
%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
%-% flags = PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||
%-% png_set_asm_flags(png_ptr, flags);
|
||||
%-% #endif
|
||||
%-%
|
||||
%-%This method would enable only the MMX read-optimizations available at the
|
||||
%-%time of libpng 1.2.0's release, regardless of whether a later version of
|
||||
%-%the DLL were actually being used. (Also note that these functions did not
|
||||
%-%exist in versions older than 1.2.0, so any attempt to run a dynamically
|
||||
%-%linked app on such an older version would fail.)
|
||||
%-%
|
||||
%-%To determine whether the processor supports MMX instructions at all, use
|
||||
%-%the png_mmx_support() function:
|
||||
%-%
|
||||
%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
%-% mmxsupport = png_mmx_support();
|
||||
%-% #endif
|
||||
%-%
|
||||
%-%It returns -1 if MMX support is not compiled into libpng, 0 if MMX code
|
||||
%-%is compiled but MMX is not supported by the processor, or 1 if MMX support
|
||||
%-%is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(),
|
||||
%-%and png_get_asm_flagmask() all may be called without allocating and ini-
|
||||
%-%tializing any PNG structures (for example, as part of a usage screen or
|
||||
%-%"about" box).
|
||||
%-%
|
||||
%-%The following code can be used to prevent an application from using the
|
||||
%-%thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK
|
||||
%-%defined:
|
||||
%-%
|
||||
%-%#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
|
||||
%-% && defined(PNG_THREAD_UNSAFE_OK)
|
||||
%-% /* Disable thread-unsafe features of pnggccrd */
|
||||
%-% if (png_access_version() >= 10200)
|
||||
%-% {
|
||||
%-% png_uint_32 mmx_disable_mask = 0;
|
||||
%-% png_uint_32 asm_flags;
|
||||
%-%
|
||||
%-% mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||
%-% | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
||||
%-% asm_flags = png_get_asm_flags(png_ptr);
|
||||
%-% png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
||||
%-% }
|
||||
%-%#endif
|
||||
%-%
|
||||
%-%For more extensive examples of runtime querying, enabling and disabling
|
||||
%-%of optimized features, see contrib/gregbook/readpng2.c in the libpng
|
||||
%-%source-code distribution.
|
||||
%-%
|
||||
.SH VI. MNG support
|
||||
|
||||
The MNG specification (available at http://www.libpng.org/pub/mng) allows
|
||||
@ -3615,13 +3649,13 @@ application:
|
||||
|
||||
.SH VII. Y2K Compliance in libpng
|
||||
|
||||
July 28, 2004
|
||||
August 4, 2004
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.2.6beta4 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.2.6rc1 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||
@ -3761,6 +3795,8 @@ the first widely used release:
|
||||
1.0.15 10 10015 10.so.0.1.0.15
|
||||
1.2.5 13 10205 12.so.0.1.2.5
|
||||
1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
|
||||
1.0.16rc1-4 10 10016 10.so.0.1.0.16rc1-4
|
||||
1.2.6rc1-4 13 10206 12.so.0.1.2.6rc1-4
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@ -3818,7 +3854,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.2.6beta4 - July 28, 2004:
|
||||
Libpng version 1.2.6rc1 - August 4, 2004:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp@users.sourceforge.net).
|
||||
|
||||
@ -3835,7 +3871,7 @@ included in the libpng distribution, the latter shall prevail.)
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng version 1.2.6, July 28, 2004, is
|
||||
libpng version 1.2.6, August 4, 2004, is
|
||||
Copyright (c) 2004 Glenn Randers-Pehrson, and is
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
@ -3935,7 +3971,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp@users.sourceforge.net
|
||||
July 28, 2004
|
||||
August 4, 2004
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
30
libpng.txt
30
libpng.txt
@ -1,6 +1,6 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.2.6beta4 - July 28, 2004
|
||||
libpng version 1.2.6rc1 - August 4, 2004
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp@users.sourceforge.net>
|
||||
Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
@ -300,6 +300,28 @@ To inform libpng about your function, use
|
||||
|
||||
png_set_read_status_fn(png_ptr, read_row_callback);
|
||||
|
||||
Width and height limits
|
||||
|
||||
The PNG specification allows the width and height of an image to be as
|
||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||
Since very few applications really need to process such large images,
|
||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
||||
Larger images will be rejected immediately with a png_error() call. If
|
||||
you wish to override this limit, you can use
|
||||
|
||||
png_set_user_limits(png_ptr, width_max, height_max);
|
||||
|
||||
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
||||
to allow all valid dimensions (libpng may reject some very large images
|
||||
anyway because of potential buffer overflow conditions).
|
||||
|
||||
You should put this statement after you create the PNG structure and
|
||||
before calling png_read_info(), png_read_png(), or png_process_data().
|
||||
If you need to retrieve the limits that are being applied, use
|
||||
|
||||
width_max = png_get_user_width_max(png_ptr);
|
||||
height_max = png_get_user_height_max(png_ptr);
|
||||
|
||||
Unknown-chunk handling
|
||||
|
||||
Now you get to set the way the library processes unknown chunks in the
|
||||
@ -308,7 +330,7 @@ behavior is that known chunks will be parsed into information in
|
||||
various info_ptr members; unknown chunks will be discarded. To change
|
||||
this, you can call:
|
||||
|
||||
png_set_keep_unknown_chunks(png_ptr, info_ptr, keep,
|
||||
png_set_keep_unknown_chunks(png_ptr, keep,
|
||||
chunk_list, num_chunks);
|
||||
keep - 0: do not keep
|
||||
1: keep only if safe-to-copy
|
||||
@ -2854,13 +2876,13 @@ application:
|
||||
|
||||
VII. Y2K Compliance in libpng
|
||||
|
||||
July 28, 2004
|
||||
August 4, 2004
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.2.6beta4 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.2.6rc1 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||
|
@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "July 28, 2004"
|
||||
.TH LIBPNGPF 3 "August 4, 2004"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6beta4
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6rc1
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB\fB#include <png.h>\fP\fP
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "July 28, 2004"
|
||||
.TH PNG 5 "August 4, 2004"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
6
png.c
6
png.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* libpng version 1.2.6beta4 - July 28, 2004
|
||||
* libpng version 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -13,7 +13,7 @@
|
||||
#include "png.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_2_6beta4 Your_png_h_is_not_version_1_2_6beta4;
|
||||
typedef version_1_2_6rc1 Your_png_h_is_not_version_1_2_6rc1;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h. */
|
||||
@ -678,7 +678,7 @@ png_charp PNGAPI
|
||||
png_get_copyright(png_structp png_ptr)
|
||||
{
|
||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) "\n libpng version 1.2.6beta4 - July 28, 2004\n\
|
||||
return ((png_charp) "\n libpng version 1.2.6rc1 - August 4, 2004\n\
|
||||
Copyright (c) 1998-2004 Glenn Randers-Pehrson\n\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\n\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
||||
|
47
png.h
47
png.h
@ -1,6 +1,6 @@
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.2.6beta4 - July 28, 2004
|
||||
* libpng version 1.2.6rc1 - August 4, 2004
|
||||
* Copyright (c) 1998-2004 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.)
|
||||
@ -8,7 +8,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.2.6beta4 - July 28, 2004: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.2.6rc1 - August 4, 2004: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -99,6 +99,8 @@
|
||||
* 1.0.15 10 10015 10.so.0.1.0.15
|
||||
* 1.2.5 13 10205 12.so.0.1.2.5
|
||||
* 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
|
||||
* 1.0.16rc1-4 10 10016 10.so.0.1.0.16rc1-4
|
||||
* 1.2.6rc1-4 13 10206 12.so.0.1.2.6rc1-4
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -128,7 +130,7 @@
|
||||
* If you modify libpng you may insert additional notices immediately following
|
||||
* this sentence.
|
||||
*
|
||||
* libpng version 1.2.6, July 28, 2004, is
|
||||
* libpng version 1.2.6, August 4, 2004, is
|
||||
* Copyright (c) 2004 Glenn Randers-Pehrson, and is
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individuals added to the list of Contributing Authors
|
||||
@ -241,13 +243,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* July 28, 2004
|
||||
* August 4, 2004
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.2.6beta4 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.2.6rc1 are Y2K compliant. It is my belief that earlier
|
||||
* versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
@ -303,9 +305,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.2.6beta4"
|
||||
#define PNG_LIBPNG_VER_STRING "1.2.6rc1"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.2.6beta4 - July 28, 2004 (header)\n"
|
||||
" libpng version 1.2.6rc1 - August 4, 2004 (header)\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 0
|
||||
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
|
||||
@ -317,7 +319,7 @@
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
||||
|
||||
#define PNG_LIBPNG_VER_BUILD 4
|
||||
#define PNG_LIBPNG_VER_BUILD 1
|
||||
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
#define PNG_LIBPNG_BUILD_BETA 2
|
||||
@ -325,7 +327,7 @@
|
||||
#define PNG_LIBPNG_BUILD_STABLE 4
|
||||
#define PNG_LIBPNG_BUILD_TYPEMASK 7
|
||||
#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with STABLE only */
|
||||
#define PNG_LIBPNG_BUILD_TYPE 2
|
||||
#define PNG_LIBPNG_BUILD_TYPE 3
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||
* We must not include leading zeros.
|
||||
@ -1294,16 +1296,22 @@ struct png_struct_def
|
||||
png_bytep palette_to_index; /* which original index points to this */
|
||||
/* palette color */
|
||||
#endif
|
||||
/* New member added in libpng-1.0.16 and 1.2.6 */
|
||||
|
||||
/* New members added in libpng-1.0.16 and 1.2.6 */
|
||||
png_byte compression_type;
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
png_uint_32 user_width_max;
|
||||
png_uint_32 user_height_max;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef png_structp version_1_2_6beta4;
|
||||
typedef png_structp version_1_2_6rc1;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@ -2453,8 +2461,19 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
|
||||
extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
|
||||
png_ptr, png_uint_32 strip_mode));
|
||||
#endif
|
||||
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* Added at libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
|
||||
png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));
|
||||
extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
|
||||
png_ptr));
|
||||
extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
|
||||
png_ptr));
|
||||
#endif
|
||||
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
|
||||
|
||||
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||
@ -2598,6 +2617,12 @@ extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
|
||||
PNG_FLAG_CRC_CRITICAL_MASK)
|
||||
|
||||
/* save typing and make code easier to understand */
|
||||
|
||||
#define PNG_ROWBYTES(pixel_bits, width) \
|
||||
((pixel_bits) >= 8 ? \
|
||||
((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \
|
||||
(( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
|
||||
|
||||
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
|
||||
abs((int)((c1).green) - (int)((c2).green)) + \
|
||||
abs((int)((c1).blue) - (int)((c2).blue)))
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.2.6beta4 - July 28, 2004
|
||||
* libpng 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 2002-2004 Glenn Randers-Pehrson
|
||||
*
|
||||
|
27
pngconf.h
27
pngconf.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.2.6beta4 - July 28, 2004
|
||||
* libpng version 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -669,6 +669,25 @@
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* Added at libpng-1.2.6 */
|
||||
#if !defined(PNG_1_0_X)
|
||||
#ifndef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
|
||||
# define PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#endif
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
|
||||
* how large, set these limits to 0x7fffffffL
|
||||
*/
|
||||
#ifndef PNG_USER_WIDTH_MAX
|
||||
# define PNG_USER_WIDTH_MAX 1000000L
|
||||
#endif
|
||||
#ifndef PNG_USER_HEIGHT_MAX
|
||||
# define PNG_USER_HEIGHT_MAX 1000000L
|
||||
#endif
|
||||
|
||||
/* These are currently experimental features, define them if you want */
|
||||
|
||||
/* very little testing */
|
||||
@ -683,10 +702,8 @@
|
||||
/* This is only for PowerPC big-endian and 680x0 systems */
|
||||
/* some testing */
|
||||
/*
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
# ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED
|
||||
# define PNG_READ_BIG_ENDIAN_SUPPORTED
|
||||
# endif
|
||||
#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
|
||||
# define PNG_READ_BIG_ENDIAN_SUPPORTED
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
18
pngerror.c
18
pngerror.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* libpng version 1.2.6beta4 - July 28, 2004
|
||||
* libpng version 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -35,9 +35,9 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
||||
char msg[16];
|
||||
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||
{
|
||||
int offset = 0;
|
||||
if (*error_message == '#')
|
||||
{
|
||||
int offset;
|
||||
for (offset=1; offset<15; offset++)
|
||||
if (*(error_message+offset) == ' ')
|
||||
break;
|
||||
@ -190,9 +190,6 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||
else
|
||||
#endif
|
||||
fprintf(stderr, "libpng error: %s\n", error_message);
|
||||
#else
|
||||
if (error_message)
|
||||
/* make compiler happy */ ;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
@ -206,10 +203,15 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||
longjmp(png_ptr->jmpbuf, 1);
|
||||
# endif
|
||||
#else
|
||||
/* make compiler happy */ ;
|
||||
if (png_ptr)
|
||||
/* make compiler happy */ ;
|
||||
PNG_ABORT();
|
||||
#endif
|
||||
#ifdef PNG_NO_CONSOLE_IO
|
||||
/* make compiler happy */ ;
|
||||
if (&error_message != NULL)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function is called when there is a warning, but the library thinks
|
||||
@ -245,9 +247,11 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||
# endif
|
||||
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||
#else
|
||||
/* make compiler happy */ ;
|
||||
if (warning_message)
|
||||
/* appease compiler */ ;
|
||||
return;
|
||||
#endif
|
||||
/* make compiler happy */ ;
|
||||
if (png_ptr)
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
|
||||
* for Intel's performance analysis of the MMX vs. non-MMX code.
|
||||
*
|
||||
* libpng version 1.2.6beta4 - July 28, 2004
|
||||
* libpng version 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998, Intel Corporation
|
||||
@ -428,7 +428,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
{
|
||||
png_debug(2,"mask == 0xff: doing single png_memcpy()\n");
|
||||
png_memcpy(row, png_ptr->row_buf + 1,
|
||||
(png_size_t)((png_ptr->width * png_ptr->row_info.pixel_depth + 7) >> 3));
|
||||
(png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,png_ptr->width));
|
||||
}
|
||||
else /* (png_combine_row() is never called with mask == 0) */
|
||||
{
|
||||
@ -2733,8 +2733,8 @@ png_do_read_interlace(png_structp png_ptr)
|
||||
} /* end switch (row_info->pixel_depth) */
|
||||
|
||||
row_info->width = final_width;
|
||||
row_info->rowbytes = ((final_width *
|
||||
(png_uint_32)row_info->pixel_depth + 7) >> 3);
|
||||
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
|
||||
}
|
||||
|
||||
} /* end png_do_read_interlace() */
|
||||
|
43
pngget.c
43
pngget.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* libpng 1.2.6beta4 - July 28, 2004
|
||||
* libpng 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -540,9 +540,6 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
|
||||
bit_depth != NULL && color_type != NULL)
|
||||
{
|
||||
int pixel_depth, channels;
|
||||
png_uint_32 rowbytes_per_pixel;
|
||||
|
||||
png_debug1(1, "in %s retrieval function\n", "IHDR");
|
||||
*width = info_ptr->width;
|
||||
*height = info_ptr->height;
|
||||
@ -560,23 +557,18 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||
*interlace_type = info_ptr->interlace_type;
|
||||
|
||||
/* check for potential overflow of rowbytes */
|
||||
if (*color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
channels = 1;
|
||||
else if (*color_type & PNG_COLOR_MASK_COLOR)
|
||||
channels = 3;
|
||||
else
|
||||
channels = 1;
|
||||
if (*color_type & PNG_COLOR_MASK_ALPHA)
|
||||
channels++;
|
||||
pixel_depth = *bit_depth * channels;
|
||||
rowbytes_per_pixel = (pixel_depth + 7) >> 3;
|
||||
if (width == 0 || *width > PNG_UINT_31_MAX)
|
||||
png_error(png_ptr, "Invalid image width");
|
||||
if (height == 0 || *height > PNG_UINT_31_MAX)
|
||||
png_error(png_ptr, "Invalid image height");
|
||||
if (*width > PNG_UINT_32_MAX/rowbytes_per_pixel - 64)
|
||||
if (info_ptr->width > (PNG_UINT_32_MAX
|
||||
>> 3) /* 8-byte RGBA pixels */
|
||||
- 64 /* bigrowbuf hack */
|
||||
- 1 /* filter byte */
|
||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
||||
- 8) /* extra max_pixel_depth pad */
|
||||
{
|
||||
png_error(png_ptr,
|
||||
png_warning(png_ptr,
|
||||
"Width too large for libpng to process image data.");
|
||||
}
|
||||
return (1);
|
||||
@ -923,5 +915,20 @@ png_get_mmx_rowbytes_threshold (png_structp png_ptr)
|
||||
{
|
||||
return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L);
|
||||
}
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_1_0_X */
|
||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
/* these functions were added to libpng 1.2.6 */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_user_width_max (png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr? png_ptr->user_width_max : 0);
|
||||
}
|
||||
png_uint_32 PNGAPI
|
||||
png_get_user_height_max (png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr? png_ptr->user_height_max : 0);
|
||||
}
|
||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||
|
||||
#endif /* ?PNG_1_0_X */
|
||||
|
7
pngmem.c
7
pngmem.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* libpng version 1.2.6beta4 - July 28, 2004
|
||||
* libpng version 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -423,10 +423,10 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
png_voidp ret;
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if (png_ptr == NULL || size == 0)
|
||||
return (NULL);
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
if(png_ptr->malloc_fn != NULL)
|
||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
||||
else
|
||||
@ -442,6 +442,9 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||
png_voidp ret;
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
if (png_ptr == NULL || size == 0)
|
||||
return (NULL);
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (size > (png_uint_32)65536L)
|
||||
{
|
||||
|
10
pngpread.c
10
pngpread.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* libpng version 1.2.6beta4 - July 28, 2004
|
||||
* libpng version 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -782,8 +782,8 @@ png_push_process_row(png_structp png_ptr)
|
||||
png_ptr->row_info.bit_depth = png_ptr->bit_depth;
|
||||
png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
|
||||
|
||||
png_ptr->row_info.rowbytes = ((png_ptr->row_info.width *
|
||||
(png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
|
||||
png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
|
||||
png_ptr->row_info.width);
|
||||
|
||||
png_read_filter_row(png_ptr, &(png_ptr->row_info),
|
||||
png_ptr->row_buf + 1, png_ptr->prev_row + 1,
|
||||
@ -1008,8 +1008,8 @@ png_read_push_finish_row(png_structp png_ptr)
|
||||
png_pass_start[png_ptr->pass]) /
|
||||
png_pass_inc[png_ptr->pass];
|
||||
|
||||
png_ptr->irowbytes = ((png_ptr->iwidth *
|
||||
png_ptr->pixel_depth + 7) >> 3) + 1;
|
||||
png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
|
||||
png_ptr->iwidth);
|
||||
|
||||
if (png_ptr->transformations & PNG_INTERLACE)
|
||||
break;
|
||||
|
60
pngread.c
60
pngread.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* libpng 1.2.6beta4 - July 28, 2004
|
||||
* libpng 1.2.6rc1 - August 4, 2004
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -59,6 +59,12 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* added at libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
|
||||
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
@ -266,6 +272,12 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
|
||||
#endif
|
||||
|
||||
/* added at libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
|
||||
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
|
||||
#endif
|
||||
|
||||
/* initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
@ -712,8 +724,8 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
png_ptr->row_info.channels = png_ptr->channels;
|
||||
png_ptr->row_info.bit_depth = png_ptr->bit_depth;
|
||||
png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
|
||||
png_ptr->row_info.rowbytes = ((png_ptr->row_info.width *
|
||||
(png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
|
||||
png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
|
||||
png_ptr->row_info.width);
|
||||
|
||||
if(png_ptr->row_buf[0])
|
||||
png_read_filter_row(png_ptr, &(png_ptr->row_info),
|
||||
@ -791,7 +803,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
* not called png_set_interlace_handling(), the display_row buffer will
|
||||
* be ignored, so pass NULL to it.
|
||||
*
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.6beta4
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.6rc1
|
||||
*/
|
||||
|
||||
void PNGAPI
|
||||
@ -841,7 +853,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
||||
* only call this function once. If you desire to have an image for
|
||||
* each pass of a interlaced image, use png_read_rows() instead.
|
||||
*
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.6beta4
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.6rc1
|
||||
*/
|
||||
void PNGAPI
|
||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||
@ -1071,8 +1083,8 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
|
||||
png_structp png_ptr = NULL;
|
||||
png_infop info_ptr = NULL, end_info_ptr = NULL;
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_free_ptr free_fn = NULL;
|
||||
png_voidp mem_ptr = NULL;
|
||||
png_free_ptr free_fn;
|
||||
png_voidp mem_ptr;
|
||||
#endif
|
||||
|
||||
png_debug(1, "in png_destroy_read_struct\n");
|
||||
@ -1295,34 +1307,38 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
int row;
|
||||
|
||||
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
|
||||
/* invert the alpha channel from opacity to transparency */
|
||||
/* invert the alpha channel from opacity to transparency
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
|
||||
png_set_invert_alpha(png_ptr);
|
||||
#endif
|
||||
|
||||
/* The call to png_read_info() gives us all of the information from the
|
||||
/* png_read_info() gives us all of the information from the
|
||||
* PNG file before the first IDAT (image data chunk).
|
||||
*/
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
if (info_ptr->height > PNG_UINT_32_MAX/png_sizeof(png_bytep))
|
||||
png_error(png_ptr,"Image is too high to process with png_read_png()");
|
||||
|
||||
/* -------------- image transformations start here ------------------- */
|
||||
|
||||
#if defined(PNG_READ_16_TO_8_SUPPORTED)
|
||||
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
||||
/* tell libpng to strip 16 bit/color files down to 8 bits per color
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_STRIP_16)
|
||||
png_set_strip_16(png_ptr);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||
/* Strip alpha bytes from the input data without combining with the
|
||||
* background (not recommended).
|
||||
/* Strip alpha bytes from the input data without combining with
|
||||
* the background (not recommended).
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_STRIP_ALPHA)
|
||||
png_set_strip_alpha(png_ptr);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED)
|
||||
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
|
||||
/* Extract multiple pixels with bit depths of 1, 2, or 4 from a single
|
||||
* byte into separate bytes (useful for paletted and grayscale images).
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_PACKING)
|
||||
@ -1331,7 +1347,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||
/* Change the order of packed pixels to least significant bit first
|
||||
* (not useful if you are using png_set_packing). */
|
||||
* (not useful if you are using png_set_packing).
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_PACKSWAP)
|
||||
png_set_packswap(png_ptr);
|
||||
#endif
|
||||
@ -1349,10 +1366,12 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
png_set_expand(png_ptr);
|
||||
#endif
|
||||
|
||||
/* We don't handle background color or gamma transformation or dithering. */
|
||||
/* We don't handle background color or gamma transformation or dithering.
|
||||
*/
|
||||
|
||||
#if defined(PNG_READ_INVERT_SUPPORTED)
|
||||
/* invert monochrome files to have 0 as white and 1 as black */
|
||||
/* invert monochrome files to have 0 as white and 1 as black
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_INVERT_MONO)
|
||||
png_set_invert_mono(png_ptr);
|
||||
#endif
|
||||
@ -1373,19 +1392,22 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BGR_SUPPORTED)
|
||||
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||
/* flip the RGB pixels to BGR (or RGBA to BGRA)
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_BGR)
|
||||
png_set_bgr(png_ptr);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
|
||||
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR)
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
|
||||
png_set_swap_alpha(png_ptr);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED)
|
||||
/* swap bytes of 16 bit files to least significant byte first */
|
||||
/* swap bytes of 16 bit files to least significant byte first
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
|
||||