Imported from libpng-1.2.19beta16.tar

This commit is contained in:
Glenn Randers-Pehrson 2007-06-18 20:53:52 -05:00
parent f7794ec181
commit 7945bdb88f
73 changed files with 2113 additions and 437 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.2.19beta15 - June 17, 2007
Libpng 1.2.19beta16 - June 19, 2007
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.
@ -9,32 +9,32 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
libpng-1.2.19beta15.tar.gz
libpng-1.2.19beta15.tar.bz2
libpng-1.2.19beta16.tar.gz
libpng-1.2.19beta16.tar.bz2
Source files with LF line endings (for Unix/Linux) without the
"configure" script
libpng-1.2.19beta15-no-config.tar.gz
libpng-1.2.19beta15-no-config.tar.bz2
libpng-1.2.19beta16-no-config.tar.gz
libpng-1.2.19beta16-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp1219b15.zip
lp1219b15.tar.bz2
lp1219b16.zip
lp1219b16.tar.bz2
Project files
libpng-1.2.19beta15-project-netware.zip
libpng-1.2.19beta15-project-wince.zip
libpng-1.2.19beta16-project-netware.zip
libpng-1.2.19beta16-project-wince.zip
Other information:
libpng-1.2.19beta15-README.txt
libpng-1.2.19beta15-KNOWNBUGS.txt
libpng-1.2.19beta15-LICENSE.txt
libpng-1.2.19beta15-Y2K-compliance.txt
libpng-1.2.19beta16-README.txt
libpng-1.2.19beta16-KNOWNBUGS.txt
libpng-1.2.19beta16-LICENSE.txt
libpng-1.2.19beta16-Y2K-compliance.txt
Changes since the last public release (1.2.18):
@ -97,6 +97,12 @@ version 1.2.19beta14 [June 16, 2007]
version 1.2.19beta15 [June 17, 2007]
Revised pnggccrd.c.
version 1.2.19beta16 [June 19, 2007]
Revised pnggccrd.c again.
Updated contrib/gregbook.
Changed '#include "$srcdir/pnggccrd.c"' 'include "$srcdir/pnggccrd.c"'
in configure.ac
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -1790,6 +1790,12 @@ version 1.2.19beta14 [June 16, 2007]
version 1.2.19beta15 [June 17, 2007]
Revised pnggccrd.c.
version 1.2.19beta16 [June 19, 2007]
Revised pnggccrd.c again.
Updated contrib/gregbook.
Changed '#include "$srcdir/pnggccrd.c"' 'include "$srcdir/pnggccrd.c"'
in configure.ac
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

20
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.2.19beta15 - June 17, 2007
Installing libpng version 1.2.19beta16 - June 19, 2007
On Unix/Linux and similar systems, you can simply type
@ -44,7 +44,7 @@ to have access to the 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.19beta15" or "lpng109" and "zlib-1.2.1"
might be called "libpng-1.2.19beta16" or "lpng109" and "zlib-1.2.1"
or "zlib121") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@ -101,14 +101,14 @@ include
CMakeLists.txt => "cmake" script
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.19beta15)
gcc, creates libpng12.so.0.1.2.19beta16)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.19beta15)
(gcc, creates libpng12.so.0.1.2.19beta16)
makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.19beta15,
(gcc, creates libpng12.so.0.1.2.19beta16,
uses assembler code tuned for Intel MMX platform)
makefile.nommx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.19beta15
(gcc, creates libpng12.so.0.1.2.19beta16
does not use Intel MMX assembler code)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@ -131,14 +131,14 @@ include
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.19beta15)
creates libpng12.so.0.1.2.19beta16)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng12.so.0.1.2.19beta15)
creates libpng12.so.0.1.2.19beta16)
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
creates libpng12.so.0.1.2.19beta15)
creates libpng12.so.0.1.2.19beta16)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng12.so.0.1.2.19beta15)
creates libpng12.so.0.1.2.19beta16)
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

View File

@ -1,5 +1,5 @@
Known bugs in libpng version 1.2.19beta15
Known bugs in libpng version 1.2.19beta16
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

View File

@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.2.19beta15, June 17, 2007, are
libpng versions 1.2.6, August 15, 2004, through 1.2.19beta16, June 19, 2007, are
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
June 17, 2007
June 19, 2007

14
README
View File

@ -1,4 +1,4 @@
README for libpng version 1.2.19beta15 - June 17, 2007 (shared library 12.0)
README for libpng version 1.2.19beta16 - June 19, 2007 (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.
@ -190,11 +190,11 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.19beta15)
gcc, creates libpng12.so.0.1.2.19beta16)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.19beta15)
(gcc, creates libpng12.so.0.1.2.19beta16)
makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.19beta15,
(gcc, creates libpng12.so.0.1.2.19beta16,
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
@ -216,12 +216,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
(gcc, creates libpng12.so.0.1.2.19beta15)
(gcc, creates libpng12.so.0.1.2.19beta16)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng12.so.0.1.2.19beta15)
(gcc, creates libpng12.so.0.1.2.19beta16)
makefile.so9 => Solaris 9 makefile
(gcc, creates libpng12.so.0.1.2.19beta15)
(gcc, creates libpng12.so.0.1.2.19beta16)
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

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng:
=========================
June 17, 2007
June 19, 2007
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.19beta15 are Y2K compliant. It is my belief that earlier
upward through 1.2.19beta16 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

24
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for libpng 1.2.19beta15.
# Generated by GNU Autoconf 2.61 for libpng 1.2.19beta16.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.2.19beta15'
PACKAGE_STRING='libpng 1.2.19beta15'
PACKAGE_VERSION='1.2.19beta16'
PACKAGE_STRING='libpng 1.2.19beta16'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
ac_unique_file="pngget.c"
@ -1405,7 +1405,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libpng 1.2.19beta15 to adapt to many kinds of systems.
\`configure' configures libpng 1.2.19beta16 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1475,7 +1475,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.2.19beta15:";;
short | recursive ) echo "Configuration of libpng 1.2.19beta16:";;
esac
cat <<\_ACEOF
@ -1585,7 +1585,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.2.19beta15
libpng configure 1.2.19beta16
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1599,7 +1599,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.2.19beta15, which was
It was created by libpng $as_me 1.2.19beta16, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@ -2269,7 +2269,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.2.19beta15'
VERSION='1.2.19beta16'
cat >>confdefs.h <<_ACEOF
@ -2440,7 +2440,7 @@ fi
PNGLIB_VERSION=1.2.19beta15
PNGLIB_VERSION=1.2.19beta16
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
PNGLIB_RELEASE=19
@ -20558,7 +20558,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include "pnggccrd.c"
#include "$srcdir/pnggccrd.c"
int
main ()
{
@ -21119,7 +21119,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.2.19beta15, which was
This file was extended by libpng $as_me 1.2.19beta16, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -21172,7 +21172,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
libpng config.status 1.2.19beta15
libpng config.status 1.2.19beta16
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -18,12 +18,12 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.2.19beta15], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.2.19beta16], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.2.19beta15
PNGLIB_VERSION=1.2.19beta16
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
PNGLIB_RELEASE=19
@ -62,7 +62,7 @@ LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
AC_MSG_CHECKING(
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
AC_TRY_COMPILE(
[#include "pnggccrd.c"],
[#include "$srcdir/pnggccrd.c"],
[return 0;],
AC_MSG_RESULT(yes)
LIBPNG_NO_MMX="",

340
contrib/gregbook/COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -1,12 +1,19 @@
---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -23,4 +30,21 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------

View File

@ -0,0 +1,130 @@
# Sample makefile for rpng-win / rpng2-win / wpng using mingw32-gcc and make.
# Greg Roelofs
# Last modified: 2 June 2007
#
# The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
#
# Invoke this makefile from a DOS-prompt window via:
#
# make -f Makefile.mingw32
#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are in subdirectories at the same level as the current subdirectory
# (as indicated by the PNGDIR and ZDIR macros below). It makes no assumptions
# at all about the mingw32 installation tree (W32DIR). Edit as appropriate.
#
# Note that the names of the dynamic and static libpng and zlib libraries
# used below may change in later releases of the libraries. This makefile
# builds both statically and dynamically linked executables by default.
# (You need only one set, but for testing it can be handy to have both.)
# macros --------------------------------------------------------------------
#PNGDIR = ../..# for libpng-x.y.z/contrib/gregbook builds
PNGDIR = ../libpng-win32
PNGINC = -I$(PNGDIR)
PNGLIBd = $(PNGDIR)/libpng.dll.a # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
#ZDIR = ../../../zlib-win32# for libpng-x.y.z/contrib/gregbook builds
ZDIR = ../zlib-win32
ZINC = -I$(ZDIR)
ZLIBd = $(ZDIR)/libzdll.a
ZLIBs = $(ZDIR)/libz.a
# change this to be the path where mingw32 installs its stuff:
W32DIR =
#W32DIR = /usr/local/cross-tools/i386-mingw32msvc
W32INC = -I$(W32DIR)/include
W32LIB = $(W32DIR)/lib/libuser32.a $(W32DIR)/lib/libgdi32.a
CC = gcc
#CC = i386-mingw32msvc-gcc # e.g., Linux -> Win32 cross-compilation
LD = $(CC)
RM = rm -f
CFLAGS = -O -Wall $(INCS) $(MINGW_CCFLAGS)
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used]
LDFLAGS = $(MINGW_LDFLAGS)
O = .o
E = .exe
INCS = $(PNGINC) $(ZINC) $(W32INC)
RLIBSd = $(PNGLIBd) $(ZLIBd) $(W32LIB) -lm
RLIBSs = $(PNGLIBs) $(ZLIBs) $(W32LIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd)
WLIBSs = $(PNGLIBs) $(ZLIBs)
RPNG = rpng-win
RPNG2 = rpng2-win
WPNG = wpng
ROBJSd = $(RPNG)$(O) readpng.pic$(O)
ROBJS2d = $(RPNG2)$(O) readpng2.pic$(O)
WOBJSd = $(WPNG)$(O) writepng.pic$(O)
RPNGs = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs = $(WPNG)-static
ROBJSs = $(RPNG)$(O) readpng$(O)
ROBJS2s = $(RPNG2)$(O) readpng2$(O)
WOBJSs = $(WPNG)$(O) writepng$(O)
STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
# implicit make rules -------------------------------------------------------
.c$(O):
$(CC) -c $(CFLAGS) $<
%.pic$(O): %.c
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
# dependencies --------------------------------------------------------------
all: $(EXES)
$(RPNGs)$(E): $(ROBJSs)
$(LD) $(LDFLAGS) -o $@ $(ROBJSs) $(RLIBSs)
$(RPNG)$(E): $(ROBJSd)
$(LD) $(LDFLAGS) -o $@ $(ROBJSd) $(RLIBSd)
$(RPNG2s)$(E): $(ROBJS2s)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2s) $(RLIBSs)
$(RPNG2)$(E): $(ROBJS2d)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2d) $(RLIBSd)
$(WPNGs)$(E): $(WOBJSs)
$(LD) $(LDFLAGS) -o $@ $(WOBJSs) $(WLIBSs)
$(WPNG)$(E): $(WOBJSd)
$(LD) $(LDFLAGS) -o $@ $(WOBJSd) $(WLIBSd)
$(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h
$(WPNG)$(O): $(WPNG).c writepng.h
readpng$(O) readpng.pic$(O): readpng.c readpng.h
readpng2$(O) readpng2.pic$(O): readpng2.c readpng2.h
writepng$(O) writepng.pic$(O): writepng.c writepng.h
# maintenance ---------------------------------------------------------------
clean:
$(RM) $(EXES)
$(RM) $(ROBJSs) $(ROBJS2s) $(WOBJSs)
$(RM) $(ROBJSd) $(ROBJS2d) $(WOBJSd)

View File

@ -1,73 +1,92 @@
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
# Greg Roelofs
# Last modified: 7 March 2002
# Last modified: 2 June 2007
#
# The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Buy some for friends
# and family, too. (Not that this is a blatant plug or anything.)
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
#
# Invoke this makefile from a shell prompt in the usual way; for example:
#
# make -f Makefile.unx
#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are both installed in /usr/local/{include,lib} (as indicated by the
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
# the PNGINC, PNGLIB, ZINC and ZLIB lines.
# and are installed in /usr/local/{include,lib} or as otherwise indicated by
# the PNG* and Z* macros below. Edit as appropriate--choose only ONE each of
# the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines.
#
# This makefile builds statically linked executables (against libpng and zlib,
# that is), but that can be changed by uncommenting the appropriate PNGLIB and
# ZLIB lines.
# This makefile builds both dynamically and statically linked executables
# (against libpng and zlib, that is), but that can be changed by modifying
# the "EXES =" line. (You need only one set, but for testing it can be handy
# to have both.)
# macros --------------------------------------------------------------------
PNGINC = -I/usr/local/include/libpng12
#PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng
PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng
#PNGDIR = /usr/local/lib
#PNGINC = -I/usr/local/include/libpng12
#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng
# or:
#PNGINC = -I../libpng
#PNGLIB = -L../libpng -lpng
#PNGLIB = ../libpng/libpng.a
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
#PNGDIR = ../libpng
PNGINC = -I$(PNGDIR)
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
ZDIR = /usr/local/lib
#ZDIR = /usr/lib64
ZINC = -I/usr/local/include
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
ZLIB = /usr/local/lib/libz.a # statically linked against zlib
#ZINC = -I../zlib
#ZLIB = -L../zlib -lz
#ZLIB = ../zlib/libz.a
ZLIBd = -L$(ZDIR) -lz # dynamically linked against zlib
ZLIBs = $(ZDIR)/libz.a # statically linked against zlib
# or:
#ZDIR = ../zlib
#ZINC = -I$(ZDIR)
#ZLIBd = -Wl,-rpath,$(ZDIR) -L$(ZDIR) -lz # -rpath allows in-place testing
#ZLIBs = $(ZDIR)/libz.a
#XINC = -I/usr/include # old-style, stock X distributions
#XLIB = -L/usr/lib/X11 -lX11
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
#XLIB = -L/usr/openwin/lib -lX11
XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
XLIB = -L/usr/X11R6/lib -lX11
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
INCS = $(PNGINC) $(ZINC) $(XINC)
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
WLIBS = $(PNGLIB) $(ZLIB)
RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
WLIBSs = $(PNGLIBs) $(ZLIBs)
CC = gcc
LD = gcc
RM = rm -f
CFLAGS = -O -Wall $(INCS)
CFLAGS = -O -Wall $(INCS) -DFEATURE_LOOP
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used]
LDFLAGS =
O = .o
E =
RPNG = rpng-x
RPNG2 = rpng2-x
WPNG = wpng
RPNG = rpng-x
RPNG2 = rpng2-x
WPNG = wpng
RPNGs = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs = $(WPNG)-static
ROBJS = $(RPNG)$(O) readpng$(O)
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
WOBJS = $(WPNG)$(O) writepng$(O)
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
# implicit make rules -------------------------------------------------------
@ -80,14 +99,23 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
all: $(EXES)
$(RPNGs)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs)
$(RPNG)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd)
$(RPNG2s)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs)
$(RPNG2)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd)
$(WPNGs)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs)
$(WPNG)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd)
$(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h

View File

@ -1,11 +1,12 @@
# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
# Greg Roelofs
# Last modified: 16 February 1999
# Last modified: 2 June 2007
#
# The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Buy some for friends
# and family, too. (Not that this is a blatant plug or anything.)
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
#
# Invoke this makefile from a DOS prompt window via:
#
@ -53,7 +54,7 @@ CC = cl
LD = link
RM = del
CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
# [note that -Wall is an MSVC-specific compilation flag ("all warnings on")]
# [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
# [see %devstudio%\vc\include\win32.mak for cvars macro definition]
O = .obj
E = .exe

View File

@ -22,7 +22,8 @@ below.
Files:
README this file
LICENSE terms of distribution and reuse (BSD-like)
LICENSE terms of distribution and reuse (BSD-like or GNU GPL)
COPYING GNU General Public License (GPL)
Makefile.unx Unix makefile
Makefile.w32 Windows (MSVC) makefile
@ -54,15 +55,15 @@ mation and links to the latest version of the source code, and Chapters
13-15 of the book for detailed discussion of the three programs.
Greg Roelofs
newt@pobox.com
30 June 2001
http://pobox.com/~newt/greg_contact.html
2 June 2007
BUILD INSTRUCTIONS
- Prerequisites (in order of compilation):
- zlib http://www.gzip.org/zlib/
- zlib http://zlib.net/
- libpng http://www.libpng.org/pub/png/libpng.html
- pngbook http://www.libpng.org/pub/png/book/sources.html
@ -150,9 +151,9 @@ BUILD INSTRUCTIONS
To run the programs, they probably first need to be set up as "foreign
symbols," with "disk" and "dir" set appropriately:
$ rpng == "$disk:[dir]rpng-x.exe"
$ rpng == "$disk:[dir]rpng-x.exe"
$ rpng2 == "$disk:[dir]rpng2-x.exe"
$ wpng == "$disk:[dir]wpng.exe"
$ wpng == "$disk:[dir]wpng.exe"
All three will print a basic usage screen when run without any command-
line arguments; see the book for more details. Note that the options
@ -176,7 +177,7 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
format (.pgm or .ppm) to PNG; for example,
wpng -time < toucan.ppm > toucan.png
wpng -time < toucan-notrans.ppm > toucan-notrans.png
would convert the specified PPM file (using redirection) to PNG, auto-
matically setting the PNG modification-time chunk.

View File

@ -4,13 +4,20 @@
---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#include <stdio.h>

View File

@ -4,13 +4,20 @@
---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#ifndef TRUE

View File

@ -4,19 +4,20 @@
---------------------------------------------------------------------------
Changelog:
- 1.01: initial public release
- 1.02: added code to skip unused chunks (GR-P)
---------------------------------------------------------------------------
Copyright (c) 1998-2002 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -33,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
@ -56,7 +74,7 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
void readpng2_version_info(void)
{
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
(defined(__i386__) || defined(_M_IX86)) && \
(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code
@ -79,7 +97,12 @@ void readpng2_version_info(void)
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
png_libpng_ver, compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown"));
fprintf(stderr, " Processor %s MMX instructions.\n",
fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
#if defined(__x86_64__)
"_64"
#else
"",
#endif
mmxsupport? "supports" : "does not support");
if (mmxsupport > 0) {
int num_optims = 0;
@ -179,40 +202,38 @@ int readpng2_init(mainprog_info *mainprog_ptr)
return 2;
}
/* prepare the reader to ignore all recognized chunks whose data isn't
* going to be used, i.e., all chunks recognized by libpng except for
* IHDR, PLTE, IDAT, IEND, tRNS, bKGD, gAMA, and sRGB : */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* prepare the reader to ignore all recognized chunks whose data won't be
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
{
#ifndef HANDLE_CHUNK_NEVER
/* prior to libpng-1.2.5, this macro was internal, so we define it here. */
# define HANDLE_CHUNK_NEVER 1
#endif
/* these byte strings were copied from png.h.
* If a future libpng version recognizes more chunks, add them
* to this list. If a future version of readpng2.c recognizes
* more chunks, delete them from this list. */
png_byte png_chunk_types_to_ignore[]=
{ 99, 72, 82, 77, '\0', /* cHRM */
104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */
105, 84, 88, 116, '\0', /* iTXt */
111, 70, 70, 115, '\0', /* oFFs */
112, 67, 65, 76, '\0', /* pCAL */
115, 67, 65, 76, '\0', /* sCAL */
112, 72, 89, 115, '\0', /* pHYs */
115, 66, 73, 84, '\0', /* sBIT */
115, 80, 76, 84, '\0', /* sPLT */
116, 69, 88, 116, '\0', /* tEXt */
116, 73, 77, 69, '\0', /* tIME */
122, 84, 88, 116, '\0'}; /* zTXt */
#define NUM_PNG_CHUNK_TYPES_TO_IGNORE 13
/* These byte strings were copied from png.h. If a future libpng
* version recognizes more chunks, add them to this list. If a
* future version of readpng2.c recognizes more chunks, delete them
* from this list. */
static const png_byte chunks_to_ignore[] = {
99, 72, 82, 77, '\0', /* cHRM */
104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */
105, 84, 88, 116, '\0', /* iTXt */
111, 70, 70, 115, '\0', /* oFFs */
112, 67, 65, 76, '\0', /* pCAL */
112, 72, 89, 115, '\0', /* pHYs */
115, 66, 73, 84, '\0', /* sBIT */
115, 67, 65, 76, '\0', /* sCAL */
115, 80, 76, 84, '\0', /* sPLT */
115, 84, 69, 82, '\0', /* sTER */
116, 69, 88, 116, '\0', /* tEXt */
116, 73, 77, 69, '\0', /* tIME */
122, 84, 88, 116, '\0' /* zTXt */
};
png_set_keep_unknown_chunks(png_ptr, HANDLE_CHUNK_NEVER,
png_chunk_types_to_ignore, NUM_PNG_CHUNK_TYPES_TO_IGNORE);
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
}
#endif
#endif /* PNG_UNKNOWN_CHUNKS_SUPPORTED */
/* instead of doing png_init_io() here, now we set up our callback
* functions for progressive decoding */
@ -237,7 +258,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
* png_set_asm_flags (png_ptr, flags);
*/
#if (defined(__i386__) || defined(_M_IX86)) && \
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code

View File

@ -4,13 +4,20 @@
---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#ifndef TRUE
@ -66,7 +90,7 @@ typedef struct _mainprog_info {
int rowbytes;
int channels;
int need_bgcolor;
#if (defined(__i386__) || defined(_M_IX86))
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
int nommxfilters;
int nommxcombine;
int nommxinterlace;

179
contrib/gregbook/readppm.c Normal file
View File

@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------
rpng - simple PNG display program readppm.c
---------------------------------------------------------------------------
This is a special-purpose replacement for readpng.c that allows binary
PPM files to be used in place of PNG images.
---------------------------------------------------------------------------
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. Redistributions of source code must retain the above copyright
notice, disclaimer, and this list of conditions.
2. Redistributions in binary form must reproduce the above copyright
notice, disclaimer, and this list of conditions in the documenta-
tion and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
This product includes software developed by Greg Roelofs
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "readpng.h" /* typedefs, common macros, public prototypes */
ulg width, height;
int bit_depth, color_type, channels;
uch *image_data = NULL;
FILE *saved_infile;
void readpng_version_info()
{
fprintf(stderr, " Compiled without libpng, zlib or PBMPLUS/NetPBM.\n");
}
/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */
int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
{
static uch ppmline[256];
int maxval;
saved_infile = infile;
fgets(ppmline, 256, infile);
if (ppmline[0] != 'P' || ppmline[1] != '6') {
fprintf(stderr, "ERROR: not a PPM file\n");
return 1;
}
/* possible color types: P5 = grayscale (0), P6 = RGB (2), P8 = RGBA (6) */
if (ppmline[1] == '6') {
color_type = 2;
channels = 3;
} else if (ppmline[1] == '8') {
color_type = 6;
channels = 4;
} else /* if (ppmline[1] == '5') */ {
color_type = 0;
channels = 1;
}
do {
fgets(ppmline, 256, infile);
} while (ppmline[0] == '#');
sscanf(ppmline, "%lu %lu", &width, &height);
do {
fgets(ppmline, 256, infile);
} while (ppmline[0] == '#');
sscanf(ppmline, "%d", &maxval);
if (maxval != 255) {
fprintf(stderr, "ERROR: maxval = %d\n", maxval);
return 2;
}
bit_depth = 8;
*pWidth = width;
*pHeight = height;
return 0;
}
/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error;
* scales values to 8-bit if necessary */
int readpng_get_bgcolor(uch *red, uch *green, uch *blue)
{
return 1;
}
/* display_exponent == LUT_exponent * CRT_exponent */
uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
{
ulg rowbytes;
/* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,
* transparency chunks to full alpha channel; strip 16-bit-per-sample
* images to 8 bits per sample; and convert grayscale to RGB[A] */
/* GRR WARNING: grayscale needs to be expanded and channels reset! */
*pRowbytes = rowbytes = channels*width;
*pChannels = channels;
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
return NULL;
}
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
/* now we can go ahead and just read the whole image */
fread(image_data, 1L, rowbytes*height, saved_infile);
return image_data;
}
void readpng_cleanup(int free_image_data)
{
if (free_image_data && image_data) {
free(image_data);
image_data = NULL;
}
}

View File

@ -22,16 +22,24 @@
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
command-line parsing bug
- 1.10: enabled "message window"/console (thanks to David Geldreich)
- 2.00: dual-licensed (added GNU GPL)
---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -48,11 +56,28 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#define PROGNAME "rpng-win"
#define LONGNAME "Simple PNG Viewer for Windows"
#define VERSION "1.20 of 28 May 2001"
#define VERSION "2.00 of 2 June 2007"
#include <stdio.h>
#include <stdlib.h>
@ -85,10 +110,9 @@ static void rpng_win_cleanup(void);
LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar;
static char titlebar[1024];
static char *progname = PROGNAME;
static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename;
static FILE *infile;
@ -325,9 +349,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
* check for one in the PNG file--if not, the initialized values of 0
* (black) will be used */
if (have_bg)
sscanf(bgstr+1, "%2x%2x%2x", &bg_red, &bg_green, &bg_blue);
else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
if (have_bg) {
unsigned r, g, b; /* this approach quiets compiler warnings */
sscanf(bgstr+1, "%2x%2x%2x", &r, &g, &b);
bg_red = (uch)r;
bg_green = (uch)g;
bg_blue = (uch)b;
} else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
readpng_cleanup(TRUE);
fprintf(stderr, PROGNAME
": libpng error while checking for background color\n");

View File

@ -9,7 +9,7 @@
by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking).
to do:
- 8-bit support
- 8-bit (colormapped) X support
- use %.1023s to simplify truncation of title-bar string?
---------------------------------------------------------------------------
@ -21,18 +21,27 @@
- 1.10: added support for non-default visuals; fixed X pixel-conversion
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
command-line parsing bug
- 1.12: fixed small X memory leak (thanks to Francois Petitjean)
- 1.13: fixed XFreeGC() crash bug
- 1.12: fixed some small X memory leaks (thanks to François Petitjean)
- 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
- 2.00: dual-licensed (added GNU GPL)
---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -49,11 +58,30 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#define PROGNAME "rpng-x"
#define LONGNAME "Simple PNG Viewer for X"
#define VERSION "1.13 of 16 August 2001"
#define VERSION "2.00 of 2 June 2007"
#define RESNAME "rpng" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */
#include <stdio.h>
#include <stdlib.h>
@ -91,6 +119,8 @@ static int rpng_x_msb(ulg u32val);
static char titlebar[1024], *window_name = titlebar;
static char *appname = LONGNAME;
static char *icon_name = PROGNAME;
static char *res_name = RESNAME;
static char *res_class = RESCLASS;
static char *filename;
static FILE *infile;
@ -399,11 +429,12 @@ static int rpng_x_create_window(void)
XEvent e;
XGCValues gcvalues;
XSetWindowAttributes attr;
XSizeHints *size_hints;
XTextProperty windowName, *pWindowName = &windowName;
XTextProperty iconName, *pIconName = &iconName;
XVisualInfo visual_info;
XSizeHints *size_hints;
XWMHints *wm_hints;
XClassHint *class_hints;
screen = DefaultScreen(display);
@ -526,7 +557,7 @@ static int rpng_x_create_window(void)
if (!XStringListToTextProperty(&icon_name, 1, pIconName))
pIconName = NULL;
/* OK if either hints allocation fails; XSetWMProperties() allows NULLs */
/* OK if any hints allocation fails; XSetWMProperties() allows NULLs */
if ((size_hints = XAllocSizeHints()) != NULL) {
/* window will not be resizable */
@ -542,8 +573,13 @@ static int rpng_x_create_window(void)
wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ;
}
if ((class_hints = XAllocClassHint()) != NULL) {
class_hints->res_name = res_name;
class_hints->res_class = res_class;
}
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
size_hints, wm_hints, NULL);
size_hints, wm_hints, class_hints);
/* various properties and hints no longer needed; free memory */
if (pWindowName)
@ -554,6 +590,8 @@ static int rpng_x_create_window(void)
XFree(size_hints);
if (wm_hints)
XFree(wm_hints);
if (class_hints)
XFree(class_hints);
XMapWindow(display, window);

View File

@ -27,16 +27,25 @@
- 1.10: enabled "message window"/console (thanks to David Geldreich)
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options
- 1.21: made minor tweak to usage screen to fit within 25-line console
- 1.22: added AMD64/EM64T support (__x86_64__)
- 2.00: dual-licensed (added GNU GPL)
---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -53,11 +62,28 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#define PROGNAME "rpng2-win"
#define LONGNAME "Progressive PNG Viewer for Windows"
#define VERSION "1.21 of 29 June 2001"
#define VERSION "2.00 of 2 June 2007"
#include <stdio.h>
#include <stdlib.h>
@ -119,10 +145,9 @@ static void rpng2_win_cleanup(void);
LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar;
static char titlebar[1024];
static char *progname = PROGNAME;
static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename;
static FILE *infile;
@ -367,7 +392,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
}
} else if (!strncmp(*argv, "-timing", 2)) {
timing = TRUE;
#if (defined(__i386__) || defined(_M_IX86))
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
@ -432,7 +457,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
readpng2_version_info();
fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
#if (defined(__i386__) || defined(_M_IX86))
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
#endif
" %*s file.png\n\n"
@ -447,17 +472,17 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
"\t\t transparent images; overrides -bgcolor option\n"
" -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\n"
#if (defined(__i386__) || defined(_M_IX86))
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
"\t\t combining rows, and expanding interlacing, respectively\n"
#endif
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
"Press Q or Esc to quit this usage screen. ",
PROGNAME,
#if (defined(__i386__) || defined(_M_IX86))
strlen(PROGNAME), " ",
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
(int)strlen(PROGNAME), " ",
#endif
strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
fflush(stderr);
do
ch = _getch();

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,10 @@
This program converts certain NetPBM binary files (grayscale and RGB,
maxval = 255) to PNG. Non-interlaced PNGs are written progressively;
interlaced PNGs are read and written in one memory-intensive blast.
Thanks to Jean-loup Gailly for providing the necessary trick to read
interactive text from the keyboard while stdin is redirected.
interactive text from the keyboard while stdin is redirected. Thanks
to Cosmin Truta for Cygwin fixes.
NOTE: includes provisional support for PNM type "8" (portable alphamap)
images, presumed to be a 32-bit interleaved RGBA format; no pro-
@ -24,16 +26,32 @@
- 1.02: modified to allow abbreviated options
- 1.03: removed extraneous character from usage screen; fixed bug in
command-line parsing
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
- 2.00: dual-licensed (added GNU GPL)
[REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line
dose not work! In order to do something useful I needed to redirect
both input and output, with cygwin and with bcc32 as well. Under
Linux, the same wpng appears to work fine. I don't know what is
the problem."]
---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -50,16 +68,35 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#define PROGNAME "wpng"
#define VERSION "1.03 of 19 March 2000"
#define VERSION "2.00 of 2 June 2007"
#define APPNAME "Simple PGM/PPM/PAM to PNG Converter"
#if defined(__MSDOS__) || defined(__OS2__)
# define DOS_OS2_W32
#elif defined(_WIN32) || defined(__WIN32__)
# define DOS_OS2_W32
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# ifndef __GNUC__ /* treat Win32 native ports of gcc as Unix environments */
# define DOS_OS2_W32
# endif
#endif
#include <stdio.h>

View File

@ -4,13 +4,20 @@
---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/

View File

@ -4,13 +4,20 @@
---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#ifndef TRUE

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.2.19beta15 - June 17, 2007
libpng version 1.2.19beta16 - June 19, 2007
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2007 Glenn Randers-Pehrson
@ -2921,13 +2921,13 @@ application:
IX. Y2K Compliance in libpng
June 17, 2007
June 19, 2007
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.19beta15 are Y2K compliant. It is my belief that earlier
upward through 1.2.19beta16 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

View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "June 17, 2007"
.TH LIBPNG 3 "June 19, 2007"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.19beta15
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.19beta16
.SH SYNOPSIS
\fB
#include <png.h>\fP
@ -410,7 +410,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.19beta15 - June 17, 2007
libpng version 1.2.19beta16 - June 19, 2007
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2007 Glenn Randers-Pehrson
@ -3331,13 +3331,13 @@ application:
.SH IX. Y2K Compliance in libpng
June 17, 2007
June 19, 2007
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.19beta15 are Y2K compliant. It is my belief that earlier
upward through 1.2.19beta16 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
@ -3526,7 +3526,7 @@ the first widely used release:
1.2.17 13 10217 12.so.0.17[.0]
1.0.26 10 10026 10.so.0.26[.0]
1.2.18 13 10218 12.so.0.18[.0]
1.2.19beta1-15 13 10219 12.so.0.19[.0]
1.2.19beta1-16 13 10219 12.so.0.19[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@ -3582,7 +3582,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.2.19beta15 - June 17, 2007:
Libpng version 1.2.19beta16 - June 19, 2007:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -3603,7 +3603,7 @@ included in the libpng distribution, the latter shall prevail.)
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.2.19beta15, June 17, 2007, are
libpng versions 1.2.6, August 15, 2004, through 1.2.19beta16, June 19, 2007, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@ -3702,7 +3702,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
June 17, 2007
June 19, 2007
.\" end of man page

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "June 17, 2007"
.TH LIBPNGPF 3 "June 19, 2007"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.19beta15
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.19beta16
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "June 17, 2007"
.TH PNG 5 "June 19, 2007"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

6
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 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_19beta15 Your_png_h_is_not_version_1_2_19beta15;
typedef version_1_2_19beta16 Your_png_h_is_not_version_1_2_19beta16;
/* Version information for C files. This had better match the version
* string defined in png.h. */
@ -706,7 +706,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
return ((png_charp) "\n libpng version 1.2.19beta15 - June 17, 2007\n\
return ((png_charp) "\n libpng version 1.2.19beta16 - June 19, 2007\n\
Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");

20
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.2.19beta15 - June 17, 2007
* libpng version 1.2.19beta16 - June 19, 2007
* Copyright (c) 1998-2007 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.)
@ -9,7 +9,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.19beta15 - June 17, 2007: Glenn
* libpng versions 0.97, January 1998, through 1.2.19beta16 - June 19, 2007: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -150,7 +150,7 @@
* 1.2.17 13 10217 12.so.0.17[.0]
* 1.0.26 10 10026 10.so.0.26[.0]
* 1.2.18 13 10218 12.so.0.18[.0]
* 1.2.19beta1-15 13 10219 12.so.0.19[.0]
* 1.2.19beta1-16 13 10219 12.so.0.19[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@ -180,7 +180,7 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* libpng versions 1.2.6, August 15, 2004, through 1.2.19beta15, June 17, 2007, are
* libpng versions 1.2.6, August 15, 2004, through 1.2.19beta16, June 19, 2007, are
* Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -292,13 +292,13 @@
* Y2K compliance in libpng:
* =========================
*
* June 17, 2007
* June 19, 2007
*
* 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.19beta15 are Y2K compliant. It is my belief that earlier
* upward through 1.2.19beta16 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
@ -354,9 +354,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.2.19beta15"
#define PNG_LIBPNG_VER_STRING "1.2.19beta16"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.2.19beta15 - June 17, 2007 (header)\n"
" libpng version 1.2.19beta16 - June 19, 2007 (header)\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@ -368,7 +368,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 15
#define PNG_LIBPNG_VER_BUILD 16
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@ -1407,7 +1407,7 @@ struct png_struct_def
/* 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_19beta15;
typedef png_structp version_1_2_19beta16;
typedef png_struct FAR * FAR * png_structpp;

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.2.19beta15 - June 17, 2007
* libpng version 1.2.19beta16 - June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -3,7 +3,7 @@
*
* For Intel x86 CPU (Pentium-MMX or later) and GNU C compiler.
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998 Intel Corporation
* Copyright (c) 1999-2002,2007 Greg Roelofs
@ -327,11 +327,14 @@
* 20070616:
* - finished replacing direct _FullLength accesses with register constraints
* (*ugly* conditional clobber-separator macros for avg and paeth, sigh)
* Changed all "ifdef *" to "if defined(*)"
*
*
* [TODO: reevaluate PNG_THREAD_UNSAFE_OK blocks for non-const global-var use]
*
* STILL TO DO:
* - fix final thread-unsafe code using stack vars and pointer? (paeth top,
* default, bottom only; default, bottom already 5 reg constraints; could
* replace bpp with pointer and group bpp/patemp/pbtemp/pctemp in array)
* - fix ebp/no-reg-constraint inefficiency (avg/paeth/sub top)
* - test png_do_read_interlace() 64-bit case (pixel_bytes == 8)
* - write MMX code for 48-bit case (pixel_bytes == 6)
* - figure out what's up with 24-bit case (pixel_bytes == 3):
@ -354,14 +357,14 @@
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD)
#if defined(__x86_64__) && defined(__PIC__)
# define PNG_x86_64_USE_GOTPCREL
#if defined(__x86_64__) && defined(__PIC__) // optionally comment out __PIC__:
# define PNG_x86_64_USE_GOTPCREL // GOTPCREL => full thread-safety
# define PNG_CLOBBER_x86_64_REGS_SUPPORTED // works as of gcc 3.4.3 ...
#endif
int PNGAPI png_mmx_support(void);
#ifdef PNG_USE_LOCAL_ARRAYS
#if defined(PNG_USE_LOCAL_ARRAYS)
static PNG_CONST int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
static PNG_CONST int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
static PNG_CONST int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
@ -400,7 +403,7 @@ static PNG_CONST int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
# define _amask0_2_6 amask0_2_6
# define _amask2_3_3 amask2_3_3
# define _amask4_2_2 amask4_2_2
# ifdef PNG_THREAD_UNSAFE_OK
# if defined(PNG_THREAD_UNSAFE_OK)
# define _patemp patemp
# define _pbtemp pbtemp
# define _pctemp pctemp
@ -412,7 +415,7 @@ static PNG_CONST int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
typedef unsigned long long ull;
#ifdef PNG_x86_64_USE_GOTPCREL
#if defined(PNG_x86_64_USE_GOTPCREL)
static PNG_CONST struct {
//ull _mask_array[26];
@ -579,13 +582,13 @@ static PNG_CONST ull _amask4_2_2 __attribute__((used, aligned(8))) = 0x00000000
#if defined(PNG_HAVE_MMX_READ_FILTER_ROW)
#ifdef PNG_THREAD_UNSAFE_OK // used only within thread-unsafe functions (at least for now)
#ifdef PNG_x86_64_USE_GOTPCREL
// this block is specific to png_read_filter_row_mmx_paeth()
#if defined(PNG_x86_64_USE_GOTPCREL)
# define pa_TEMP "%%r11d"
# define pb_TEMP "%%r12d"
# define pc_TEMP "%%r13d"
# ifdef PNG_CLOBBER_x86_64_REGS_SUPPORTED // works as of gcc 3.4.3 ...
# if defined(PNG_CLOBBER_x86_64_REGS_SUPPORTED) // works as of gcc 3.4.3 ...
# define SAVE_r11_r12_r13
# define RESTORE_r11_r12_r13
# define _CLOBBER_r11_r12_r13 ,"%r11", "%r12", "%r13"
@ -604,33 +607,35 @@ static PNG_CONST ull _amask4_2_2 __attribute__((used, aligned(8))) = 0x00000000
"movq _c64@GOTPCREL(%%rip), %%rbp \n\t"
# define RESTORE_rbp "popq %%rbp \n\t"
#else // 32-bit and/or non-PIC
// These variables are used in png_read_filter_row_mmx_paeth() and would be
// local variables if not for gcc-inline-assembly addressing limitations
// (some apparently related to ELF format, others to CPU type).
//
// WARNING: Their presence defeats the thread-safety of libpng.
static int _patemp __attribute__((used));
static int _pbtemp __attribute__((used));
static int _pctemp __attribute__((used));
# define pa_TEMP "_patemp"
# define pb_TEMP "_pbtemp" // temp variables for
# define pc_TEMP "_pctemp" // Paeth routine
# define SAVE_r11_r12_r13
# define RESTORE_r11_r12_r13
# define _CLOBBER_r11_r12_r13 // not using regs => not clobbering
# define CLOBBER_r11_r12_r13
# define LOAD_GOT_rbp
# define RESTORE_rbp
# if defined(PNG_THREAD_UNSAFE_OK)
// These variables are used in png_read_filter_row_mmx_paeth() and would be
// local variables if not for gcc-inline-assembly addressing limitations
// (some apparently related to ELF format, others to CPU type).
//
// WARNING: Their presence defeats the thread-safety of libpng.
static int _patemp __attribute__((used));
static int _pbtemp __attribute__((used));
static int _pctemp __attribute__((used));
# define pa_TEMP "_patemp"
# define pb_TEMP "_pbtemp" // temp variables for
# define pc_TEMP "_pctemp" // Paeth routine
# define SAVE_r11_r12_r13
# define RESTORE_r11_r12_r13
# define _CLOBBER_r11_r12_r13 // not using regs => not clobbering
# define CLOBBER_r11_r12_r13
# endif // PNG_THREAD_UNSAFE_OK
# define LOAD_GOT_rbp
# define RESTORE_rbp
#endif
#ifdef __x86_64__
#if defined(__x86_64__)
# define SAVE_ebp
# define RESTORE_ebp
# define _CLOBBER_ebp ,"%ebp"
# define CLOBBER_ebp "%ebp"
# define SAVE_FullLength "movl %%eax, %%r15d \n\t"
# define RESTORE_FullLength "movl %%r15d, " // may go into eax or ecx
# ifdef PNG_CLOBBER_x86_64_REGS_SUPPORTED // works as of gcc 3.4.3 ...
# if defined(PNG_CLOBBER_x86_64_REGS_SUPPORTED) // works as of gcc 3.4.3 ...
# define SAVE_r15
# define RESTORE_r15
# define _CLOBBER_r15 ,"%r15"
@ -690,11 +695,10 @@ static PNG_CONST ull _amask4_2_2 __attribute__((used, aligned(8))) = 0x00000000
# define CLOB_COLON_ebx_ebp_r1X : // clobbering ebp OR ebx OR r11_r12_r13
#endif
#endif // PNG_THREAD_UNSAFE_OK
#endif // PNG_HAVE_MMX_READ_FILTER_ROW
#ifdef __PIC__ // macros to save, restore index to Global Offset Table
# ifdef __x86_64__
#if defined(__PIC__) // macros to save, restore index to Global Offset Table
# if defined(__x86_64__)
# define SAVE_GOT_ebx "pushq %%rbx \n\t"
# define RESTORE_GOT_ebx "popq %%rbx \n\t"
# else
@ -747,7 +751,7 @@ png_mmx_support(void)
#if defined(PNG_MMX_CODE_SUPPORTED)
int result;
__asm__ __volatile__ (
#ifdef __x86_64__
#if defined(__x86_64__)
"pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
"pushq %%rcx \n\t" // so does rcx...
"pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
@ -799,7 +803,7 @@ png_mmx_support(void)
"0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
"movl $0, %%eax \n\t" // set return value to 0
"1: \n\t" // .RETURN: target label for jump instructions
#ifdef __x86_64__
#if defined(__x86_64__)
"popq %%rdx \n\t" // restore rdx
"popq %%rcx \n\t" // restore rcx
"popq %%rbx \n\t" // restore rbx
@ -889,7 +893,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && _mmx_supported */ )
@ -1017,7 +1021,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
"2" (len), // ecx
"1" (mask) // edx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -1234,7 +1238,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && _mmx_supported */ )
@ -1326,7 +1330,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
"2" (len), // ecx
"1" (mask) // edx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm4", "%mm6", "%mm7" // clobber list
#endif
);
@ -1377,7 +1381,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && _mmx_supported */ )
@ -1483,7 +1487,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
"3" (srcptr), // esi
"4" (dstptr) // edi
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm4" // clobber list
, "%mm5", "%mm6", "%mm7"
#endif
@ -1534,7 +1538,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && _mmx_supported */ )
@ -1655,7 +1659,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
"2" (len), // ecx
"1" (mask) // edx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -1706,7 +1710,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && _mmx_supported */ )
@ -1851,7 +1855,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
"2" (len), // ecx
"1" (mask) // edx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -2241,13 +2245,13 @@ png_do_read_interlace(png_structp png_ptr)
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width), // ecx
#ifdef PNG_x86_64_USE_GOTPCREL // formerly _const4:
#if defined(PNG_x86_64_USE_GOTPCREL) // formerly _const4:
"3" (&_c64._amask5_3_0) // (0x0000000000FFFFFFLL)
#else
"3" (&_amask5_3_0) // (0x0000000000FFFFFFLL)
#endif
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2" // clobber list
, "%mm3", "%mm4"
#endif
@ -2291,13 +2295,13 @@ png_do_read_interlace(png_structp png_ptr)
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width), // ecx
#ifdef PNG_x86_64_USE_GOTPCREL // formerly _const4:
#if defined(PNG_x86_64_USE_GOTPCREL) // formerly _const4:
"3" (&_c64._amask5_3_0) // (0x0000000000FFFFFFLL)
#else
"3" (&_amask5_3_0) // (0x0000000000FFFFFFLL)
#endif
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2" // clobber list
#endif
);
@ -2354,7 +2358,7 @@ png_do_read_interlace(png_structp png_ptr)
: "1" (sptr), // esi // input regs
"2" (dp), // edi
"0" (width_mmx), // ecx
#ifdef PNG_x86_64_USE_GOTPCREL // formerly _const4 and _const6:
#if defined(PNG_x86_64_USE_GOTPCREL) // formerly _const4 and _const6:
"3" (&_c64._amask5_3_0), // (0x0000000000FFFFFFLL)
"4" (&_c64._amask7_1_0) // (0x00000000000000FFLL)
#else
@ -2362,7 +2366,7 @@ png_do_read_interlace(png_structp png_ptr)
"4" (&_amask7_1_0) // (0x00000000000000FFLL)
#endif
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
, "%mm2", "%mm3"
#endif
@ -2435,7 +2439,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2" // clobber list
, "%mm3", "%mm4"
#endif
@ -2509,7 +2513,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
#endif
);
@ -2563,7 +2567,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
#endif
);
@ -2625,7 +2629,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
#endif
);
@ -2682,7 +2686,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
#endif
);
@ -2735,7 +2739,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0" // clobber list
#endif
);
@ -2802,7 +2806,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
#endif
);
@ -2860,7 +2864,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
#endif
);
@ -2916,7 +2920,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width_mmx) // ecx
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1" // clobber list
#endif
);
@ -2979,7 +2983,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width) // ecx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0" // clobber list
#endif
);
@ -3018,7 +3022,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width) // ecx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0" // clobber list
#endif
);
@ -3054,7 +3058,7 @@ png_do_read_interlace(png_structp png_ptr)
"2" (dp), // edi
"0" (width) // ecx
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0" // clobber list
#endif
);
@ -3156,7 +3160,7 @@ png_do_read_interlace(png_structp png_ptr)
png_memcpy(v, sptr, 4);
for (j = 0; j < png_pass_inc[pass]; j++)
{
#ifdef PNG_DEBUG
#if defined(PNG_DEBUG)
if (dp < row || dp+3 > row+png_ptr->row_buf_size)
{
printf("dp out of bounds: row=%d, dp=%d, rp=%d\n",
@ -3236,7 +3240,6 @@ png_do_read_interlace(png_structp png_ptr)
#if defined(PNG_HAVE_MMX_READ_FILTER_ROW)
#if defined(PNG_MMX_CODE_SUPPORTED)
#ifdef PNG_THREAD_UNSAFE_OK
//===========================================================================//
// //
// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ A V G //
@ -3261,7 +3264,6 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
bpp = (row_info->pixel_depth + 7) >> 3; // calc number of bytes per pixel
FullLength = row_info->rowbytes; // number of bytes to filter
//printf("GRR DEBUG: avgtop start\n"); fflush(stdout);
__asm__ __volatile__ (
SAVE_GOT_ebx
SAVE_r15
@ -3322,7 +3324,7 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
"subl %%eax, %%ecx \n\t" // drop over bytes from original length
//out "movl %%ecx, MMXLength \n\t"
"movl %%ebp, %%edi \n\t" // ebp = diff, but no reg constraint(?)
RESTORE_ebp
RESTORE_ebp // (could swap ebp and ecx functions)
RESTORE_r15
RESTORE_GOT_ebx
@ -3341,14 +3343,12 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
_CLOBBER_ebp
_CLOBBER_GOT_ebx
);
//printf("GRR DEBUG: avgtop end\n"); fflush(stdout);
// now do the math for the rest of the row
switch (bpp)
{
case 3:
{
//printf("GRR DEBUG: avg3 start\n"); fflush(stdout);
// _ShiftBpp = 24; // == 3 * 8
// _ShiftRem = 40; // == 64 - 24
@ -3454,12 +3454,11 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
);
//printf("GRR DEBUG: avg3 end\n"); fflush(stdout);
}
break; // end 3 bpp
@ -3552,7 +3551,7 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -3648,7 +3647,7 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -3787,7 +3786,7 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -3903,7 +3902,7 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2" // clobber list
, "%mm3", "%mm4", "%mm5"
#endif
@ -3913,7 +3912,7 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
default: // bpp != 1,2,3,4,6,8: doesn't exist
{
#ifdef PNG_DEBUG
#if defined(PNG_DEBUG)
// ERROR: SHOULD NEVER BE REACHED
png_debug(1,
"Internal libpng logic error (GCC png_read_filter_row_mmx_avg())\n");
@ -3923,7 +3922,6 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
} // end switch (bpp)
//printf("GRR DEBUG: avgbot start\n"); fflush(stdout);
__asm__ __volatile__ (
// MMX acceleration complete; now do clean-up
// check if any remaining bytes left to decode
@ -3980,14 +3978,13 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
CLOB_COMMA_ebx_ebp
CLOBBER_ebp
);
//printf("GRR DEBUG: avgbot end\n"); fflush(stdout);
} /* end png_read_filter_row_mmx_avg() */
#endif // PNG_THREAD_UNSAFE_OK
#ifdef PNG_THREAD_UNSAFE_OK
#if defined(PNG_x86_64_USE_GOTPCREL) || defined(PNG_THREAD_UNSAFE_OK)
//===========================================================================//
// //
// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ P A E T H //
@ -4012,7 +4009,6 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
bpp = (row_info->pixel_depth + 7) >> 3; // calc number of bytes per pixel
FullLength = row_info->rowbytes; // number of bytes to filter
//printf("GRR DEBUG: paethtop start\n"); fflush(stdout);
__asm__ __volatile__ (
SAVE_GOT_ebx
SAVE_r15
@ -4131,7 +4127,7 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
"subl %%eax, %%ecx \n\t" // drop over bytes from original length
//out "movl %%ecx, MMXLength \n\t"
"movl %%ebp, %%edi \n\t" // ebp = diff, but no reg constraint(?)
RESTORE_ebp
RESTORE_ebp // (could swap ebp and ecx functions)
RESTORE_r15
RESTORE_GOT_ebx
@ -4151,14 +4147,12 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
_CLOBBER_ebp
_CLOBBER_GOT_ebx
);
//printf("GRR DEBUG: paethtop end\n"); fflush(stdout);
// now do the math for the rest of the row
switch (bpp)
{
case 3:
{
//printf("GRR DEBUG: paeth3 start\n"); fflush(stdout);
// _ShiftBpp = 24; // == bpp * 8
// _ShiftRem = 40; // == 64 - _ShiftBpp
@ -4373,12 +4367,11 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
);
//printf("GRR DEBUG: paeth3 end\n"); fflush(stdout);
}
break; // end 3 bpp
@ -4538,7 +4531,7 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -4687,7 +4680,7 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -4836,7 +4829,7 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
"2" (diff), // ecx
"3" (MMXLength) // eax
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
: "%mm0", "%mm1", "%mm2", "%mm3" // clobber list
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -4966,7 +4959,6 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
} // end switch (bpp)
//printf("GRR DEBUG: paethend start\n"); fflush(stdout);
__asm__ __volatile__ (
// MMX acceleration complete; now do clean-up
// check if any remaining bytes left to decode
@ -5085,15 +5077,14 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
CLOB_COMMA_ebX_r1X
CLOBBER_r11_r12_r13
);
//printf("GRR DEBUG: paethend end\n"); fflush(stdout);
} /* end png_read_filter_row_mmx_paeth() */
#endif // PNG_THREAD_UNSAFE_OK
#endif // PNG_x86_64_USE_GOTPCREL || PNG_THREAD_UNSAFE_OK
#ifdef PNG_THREAD_UNSAFE_OK
//===========================================================================//
// //
// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ S U B //
@ -5117,7 +5108,6 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
FullLength = row_info->rowbytes - bpp; // number of bytes to filter
// (why do we subtract off bpp? not so in avg or paeth...)
//printf("GRR DEBUG: subtop start\n"); fflush(stdout);
__asm__ __volatile__ (
SAVE_r15
SAVE_ebp
@ -5166,14 +5156,12 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
_CLOBBER_r15
_CLOBBER_ebp
);
//printf("GRR DEBUG: subtop end\n"); fflush(stdout);
// now do the math for the rest of the row
switch (bpp)
{
case 3:
{
//printf("GRR DEBUG: sub3 start\n"); fflush(stdout);
// _ShiftBpp = 24; // == 3 * 8
// _ShiftRem = 40; // == 64 - 24
@ -5230,11 +5218,10 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
"3" (MMXLength) // eax
: "%esi" // clobber list
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
, "%mm0", "%mm1", "%mm6", "%mm7"
#endif
);
//printf("GRR DEBUG: sub3 end\n"); fflush(stdout);
}
break; // end 3 bpp
@ -5282,7 +5269,7 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
"3" (MMXLength) // eax
: "%esi" // clobber list
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
, "%mm0", "%mm1"
#endif
);
@ -5332,7 +5319,7 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
"3" (MMXLength) // eax
: "%esi" // clobber list
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
, "%mm0", "%mm1"
#endif
);
@ -5441,7 +5428,7 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
"3" (MMXLength) // eax
: "%esi" // clobber list
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
, "%mm0", "%mm1", "%mm5", "%mm6", "%mm7"
#endif
);
@ -5526,7 +5513,7 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
: "%esi" // clobber list
_CLOBBER_ebp
#ifdef CLOBBER_MMX_REGS_SUPPORTED
#if defined(CLOBBER_MMX_REGS_SUPPORTED)
, "%mm0", "%mm1", "%mm2", "%mm3"
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -5536,7 +5523,7 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
default: // bpp != 1,2,3,4,6,8: doesn't exist
{
#ifdef PNG_DEBUG
#if defined(PNG_DEBUG)
// ERROR: SHOULD NEVER BE REACHED
png_debug(1,
"Internal libpng logic error (GCC png_read_filter_row_mmx_sub())\n");
@ -5546,7 +5533,6 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
} // end switch (bpp)
//printf("GRR DEBUG: subend start\n"); fflush(stdout);
__asm__ __volatile__ (
//pre "movl MMXLength, %%eax \n\t"
//pre "movl row, %%edi \n\t"
@ -5581,10 +5567,8 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
: "%esi" // clobber list
);
//printf("GRR DEBUG: subend end\n"); fflush(stdout);
} // end of png_read_filter_row_mmx_sub()
#endif // PNG_THREAD_UNSAFE_OK
@ -5724,7 +5708,7 @@ png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
: "%eax", "%ecx" // clobber list (no input regs!)
_CLOBBER_GOT_ebx
#ifdef PNG_CLOBBER_MMX_REGS_SUPPORTED
#if defined(PNG_CLOBBER_MMX_REGS_SUPPORTED)
, "%mm0", "%mm1", "%mm2", "%mm3"
, "%mm4", "%mm5", "%mm6", "%mm7"
#endif
@ -5750,17 +5734,11 @@ void /* PRIVATE */
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
row, png_bytep prev_row, int filter)
{
#ifdef PNG_DEBUG
#if defined(PNG_DEBUG)
char filnm[10];
#endif
#if defined(PNG_MMX_CODE_SUPPORTED)
/* GRR: these are superseded by png_ptr->asm_flags: */
#define UseMMX_sub 1 // GRR: converted 20000730
#define UseMMX_up 1 // GRR: converted 20000729
#define UseMMX_avg 1 // GRR: converted 20000828 (+ 16-bit bugfix 20000916)
#define UseMMX_paeth 1 // GRR: converted 20000828
if (_mmx_supported == 2) {
#if !defined(PNG_1_0_X)
/* this should have happened in png_init_mmx_flags() already */
@ -5770,48 +5748,79 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
}
#endif /* PNG_MMX_CODE_SUPPORTED */
#ifdef PNG_DEBUG
#if defined(PNG_DEBUG)
png_debug(1, "in png_read_filter_row (pnggccrd.c)\n");
switch (filter)
{
case 0: png_snprintf(filnm, 10, "none");
case 0:
png_snprintf(filnm, 10, "none");
break;
case 1: png_snprintf(filnm, 10, "sub-%s",
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
case 1:
png_snprintf(filnm, 10, "sub-%s",
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" :
((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
_mmx_supported
#endif
? "MMX" :
#endif
"x86");
"x86");
break;
case 2: png_snprintf(filnm, 10, "up-%s",
#ifdef PNG_MMX_CODE_SUPPORTED
case 2:
png_snprintf(filnm, 10, "up-%s",
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" :
((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
_mmx_supported
#endif
? "MMX" :
#endif
"x86");
"x86");
break;
case 3: png_snprintf(filnm, 10, "avg-%s",
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
case 3:
png_snprintf(filnm, 10, "avg-%s",
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" :
((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
_mmx_supported
#endif
? "MMX" :
#endif
"x86");
"x86");
break;
case 4: png_snprintf(filnm, 10, "Paeth-%s",
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
case 4:
png_snprintf(filnm, 10, "Paeth-%s",
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":
((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
#else
_mmx_supported
#endif
? "MMX" :
#endif
"x86");
"x86");
break;
default: png_snprintf(filnm, 10, "unknw");
default:
png_snprintf(filnm, 10, "unknown");
break;
}
png_debug2(0, "row_number=%5ld, %5s, ", png_ptr->row_number, filnm);
png_debug2(0, "row_number=%5ld, %10s, ", png_ptr->row_number, filnm);
png_debug1(0, "row=0x%08lx, ", (unsigned long)row);
png_debug2(0, "pixdepth=%2d, bytes=%d, ", (int)row_info->pixel_depth,
(int)((row_info->pixel_depth + 7) >> 3));
@ -5824,7 +5833,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
case PNG_FILTER_VALUE_SUB:
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
@ -5881,7 +5890,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
case PNG_FILTER_VALUE_AVG:
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
@ -5919,7 +5928,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
case PNG_FILTER_VALUE_PAETH:
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
#if defined(PNG_MMX_CODE_SUPPORTED)
#if defined(PNG_x86_64_USE_GOTPCREL) || defined(PNG_THREAD_UNSAFE_OK)
#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
@ -5931,6 +5941,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
png_read_filter_row_mmx_paeth(row_info, row, prev_row);
}
else
#endif /* PNG_x86_64_USE_GOTPCREL || PNG_THREAD_UNSAFE_OK */
#endif /* PNG_MMX_CODE_SUPPORTED */
{
png_uint_32 i;
@ -5958,7 +5969,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
p = b - c;
pc = a - c;
#ifdef PNG_USE_ABS
#if defined(PNG_USE_ABS)
pa = abs(p);
pb = abs(pc);
pc = abs(p + pc);
@ -5995,4 +6006,4 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
#endif /* PNG_HAVE_MMX_READ_FILTER_ROW */
#endif /* PNG_USE_PNGGCCRD */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGGCCRD */

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1553,4 +1553,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_2_19beta15 your_png_h_is_not_version_1_2_19beta15;
typedef version_1_2_19beta16 your_png_h_is_not_version_1_2_19beta16;

View File

@ -3,7 +3,7 @@
*
* For Intel x86 CPU and Microsoft Visual C++ compiler
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* Last changed in libpng 1.2.19 June 17, 2007
* Last changed in libpng 1.2.19 June 19, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -179,7 +179,7 @@ configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
# SET UP LINKS
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 0.${PNGLIB_RELEASE}.1.2.19beta15
# VERSION 0.${PNGLIB_RELEASE}.1.2.19beta16
VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0
CLEAN_DIRECT_OUTPUT 1)

View File

@ -8,7 +8,7 @@
# Modeled after libxml-config.
version=1.2.19beta15
version=1.2.19beta16
prefix=""
libdir=""
libs=""

View File

@ -5,6 +5,6 @@ includedir=@includedir@/libpng12
Name: libpng
Description: Loads and saves PNG files
Version: 1.2.19beta15
Version: 1.2.19beta16
Libs: -L${libdir} -lpng12
Cflags: -I${includedir} @LIBPNG_NO_MMX@

View File

@ -5,6 +5,6 @@ includedir=@includedir@/libpng12
Name: libpng
Description: Loads and saves PNG files
Version: 1.2.19beta15
Version: 1.2.19beta16
Libs: -L${libdir} -lpng12
Cflags: -I${includedir}

View File

@ -8,7 +8,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -8,7 +8,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -20,7 +20,7 @@ LN_SF = ln -f -s
LIBNAME=libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local

View File

@ -8,7 +8,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -80,7 +80,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
LIBNAME = libpng12
PNGMAJ = 0
CYGDLL = 12
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(CYGDLL).dll

View File

@ -19,7 +19,7 @@ ZLIBINC=../zlib
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -5,7 +5,7 @@
# Library name:
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12

View File

@ -12,7 +12,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -16,7 +16,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -8,7 +8,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -6,7 +6,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -81,7 +81,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
LIBNAME = libpng12
PNGMAJ = 0
MINGDLL = 12
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=libpng$(MINGDLL).dll

View File

@ -14,7 +14,7 @@ INCSDIR=${LOCALBASE}/include/libpng12
LIB= png12
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.2.19beta15
SHLIB_MINOR= 1.2.19beta16
SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@ -14,7 +14,7 @@ INCSDIR=${LOCALBASE}/include/libpng
LIB= png
SHLIB_MAJOR= 3
SHLIB_MINOR= 1.2.19beta15
SHLIB_MINOR= 1.2.19beta16
SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@ -7,7 +7,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -8,7 +8,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.2.19beta15
SHLIB_MINOR= 1.2.19beta16
LIB= png
SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \

View File

@ -9,7 +9,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -6,7 +6,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -6,7 +6,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -8,7 +8,7 @@
# Library name:
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12

View File

@ -8,7 +8,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -8,7 +8,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
PNGMIN = 1.2.19beta15
PNGMIN = 1.2.19beta16
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:

View File

@ -2,7 +2,7 @@
; PNG.LIB module definition file for OS/2
;----------------------------------------
; Version 1.2.19beta15
; Version 1.2.19beta16
LIBRARY PNG
DESCRIPTION "PNG image compression library for OS/2"

View File

@ -5,7 +5,7 @@
LIBRARY
EXPORTS
;Version 1.2.19beta15
;Version 1.2.19beta16
png_build_grayscale_palette @1
png_check_sig @2
png_chunk_error @3