Imported from libpng-1.0.9beta10.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index a3dcaf0..ab7e36f 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.0.9beta1 - November 10, 2000
+Libpng 1.0.9beta10 - January 16, 2001
 
 This is a public release of libpng, intended for use in production codes.
 
@@ -15,7 +15,6 @@
      features, for testing purposes.
   Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h.
   Revised the 3 instances of WRITEFILE in pngtest.c.
-  Relocated "msvc" and "wince" project subdirectories into "dll" subdirectory.
   Updated png.rc in dll/msvc project
   Revised makefile.dec to define and use LIBPATH and INCPATH
   Increased size of global png_libpng_ver[] array from 12 to 18 chars.
@@ -25,6 +24,33 @@
   Revised makefile.cygwin
   Fixed bugs in iCCP support in pngrutil.c and pngwutil.c.
   Replaced png_set_empty_plte_permitted() with png_permit_mng_features().
+  Relocated "msvc" and "wince" project subdirectories into "projects"
+    subdirectory and added projects/borland project subdirectory.
+  Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
+  Add error message in png_set_compression_buffer_size() when malloc fails.
+  Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project.
+  Removed the png_flush() in pngwrite.c that crashes some applications
+    that don't set png_output_flush_fn.
+  Added makefile.macosx and makefile.aix to scripts directory.
+  Change png_chunk_warning to png_warning in png_check_keyword().
+  Increased the first part of msg buffer from 16 to 18 in png_chunk_error().
+  Added support for filter method 64 (for PNG datastreams embedded in MNG)
+  Revised png_set_filter() to accept filter method 64 when appropriate.
+  Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to
+    help prevent applications from using MNG features in PNG datastreams.
+  Revised libpng.3/libpng.txt.  Changed "filter type" to "filter method".
+  Fixed error handling of unknown compression type in png_decompress_chunk().
+  In pngconf.h, define __cdecl when _MSC_VER is defined.
+  Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places.
+  Revised memory management in png_set_hIST and png_handle_hIST in a backward
+    compatible manner.  PLTE and tRNS were revised similarly.
+  Revised the iCCP chunk reader to ignore trailing garbage.
+  Moved pngasmrd.h into pngconf.h.
+  Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop.
+  Added png_set_invalid, png_permit_mng_features, and png_mmx_supported to
+    wince and msvc project module definition files.
+  Fixed bug with progressive reading of narrow interlaced images in pngpread.c
+  Do not typedef png_FILE_io in pngconf.h when PNG_NO_STDIO is defined.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/CHANGES b/CHANGES
index 2519c27..23bd60a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -379,7 +379,7 @@
   Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco.
   Removed lines after Dynamic Dependencies" in makefile.aco .
   Revised makefile.dec to make a shared library (Jeremie Petit).
-  Removed trailing blanks from all files. 
+  Removed trailing blanks from all files.
 version 1.0.2a [January 6, 1999]
   Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h
   Added "if" tests to silence complaints about unused png_ptr in png.h and png.c
@@ -718,7 +718,7 @@
     the high-level interface, and unknown chunks support (all new in 1.0.6).
     This was necessary because of old applications that allocate the structs
     directly as authors were instructed to do in libpng-0.88 and earlier,
-    instead of using png_create_*(). 
+    instead of using png_create_*().
   Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which
     can be used to detect codes that directly allocate the structs, and
     code to check these modes in png_read_init() and png_write_init() and
@@ -798,7 +798,6 @@
   Fixed "DJBPP" typo in pnggccrd.c introduced in beta18.
 version 1.0.7 [July 1, 2000]
   Revised the definition of "trans_values" in libpng.3/libpng.txt
-version 1.0.9beta1 [November 10, 2000]
 version 1.0.8beta1 [July 8, 2000]
   Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
   Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
@@ -843,6 +842,46 @@
   Revised makefile.cygwin
   Fixed bugs in iCCP support in pngrutil.c and pngwutil.c.
   Replaced png_set_empty_plte_permitted() with png_permit_mng_features().
+version 1.0.9beta2 [November 19, 2000]
+  Renamed the "dll" subdirectory "projects".
+  Added borland project files to "projects" subdirectory.
+  Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
+  Add error message in png_set_compression_buffer_size() when malloc fails.
+version 1.0.9beta3 [November 23, 2000]
+  Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project.
+  Removed the png_flush() in pngwrite.c that crashes some applications
+    that don't set png_output_flush_fn.
+  Added makefile.macosx and makefile.aix to scripts directory.
+version 1.0.9beta4 [December 1, 2000]
+  Change png_chunk_warning to png_warning in png_check_keyword().
+  Increased the first part of msg buffer from 16 to 18 in png_chunk_error().
+version 1.0.9beta5 [December 15, 2000]
+  Added support for filter method 64 (for PNG datastreams embedded in MNG)
+version 1.0.9beta6 [December 18, 2000]
+  Revised png_set_filter() to accept filter method 64 when appropriate.
+  Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to
+    help prevent applications from using MNG features in PNG datastreams.
+  Revised libpng.3/libpng.txt.  Changed "filter type" to "filter method".
+version 1.0.9rc1 [December 23, 2000]
+  Revised test for PNG_HAVE_PNG_SIGNATURE in pngrutil.c
+  Fixed error handling of unknown compression type in png_decompress_chunk().
+  In pngconf.h, define __cdecl when _MSC_VER is defined.
+version 1.0.9beta7 [December 28, 2000]
+  Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places.
+  Revised memory management in png_set_hIST and png_handle_hIST in a backward
+    compatible manner.  PLTE and tRNS were revised similarly.
+  Revised the iCCP chunk reader to ignore trailing garbage.
+version 1.0.9beta8 [January 12, 2001]
+  Moved pngasmrd.h into pngconf.h.
+  Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop.
+version 1.0.9beta9 [January 15, 2001]
+  Added png_set_invalid, png_permit_mng_features, and png_mmx_supported to
+    wince and msvc project module definition files.
+  Minor revision of makefile.cygwin.
+  Fixed bug with progressive reading of narrow interlaced images in pngpread.c
+version 1.0.9beta10 [January 16, 2001]
+  Do not typedef png_FILE_io in pngconf.h when PNG_NO_STDIO is defined.
+  Fixe "png_mmx_supported" typo in project definition files 
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/INSTALL b/INSTALL
index c35948a..f8f400a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 
-Installing libpng version 1.0.9beta1 - November 10, 2000
+Installing libpng version 1.0.9beta10 - January 16, 2001
 
 Before installing libpng, you must first install zlib.  zlib
 can usually be found wherever you got libpng.  zlib can be
@@ -10,7 +10,7 @@
 version of zlib that's installed.
 
 You can rename the directories that you downloaded (they
-might be called "libpng-1.0.9beta1" or "lpng109" and "zlib-1.1.3"
+might be called "libpng-1.0.9beta10" or "lpng109" and "zlib-1.1.3"
 or "zlib113") so that you have directories called "zlib" and "libpng".
 
 Your directory structure should look like this:
@@ -27,7 +27,8 @@
              pngminus
              pngsuite
              visupng
-          dll
+          projects
+             borland
              msvc
              wince
           scripts
@@ -52,29 +53,31 @@
 
 Else enter the zlib directory and follow the instructions in zlib/README,
 then come back here and choose the appropriate makefile.sys in the scripts
-directory.  
+directory.
 
 The files that are presently available in the scripts directory
 include
 
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9beta1)
- makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9beta1,
+ makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9beta10)
+ makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9beta10,
                        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
                        ansi2knr (Requires ansi2knr.c from
                        ftp://ftp.cs.wisc.edu/ghost)
+ makefile.aix      =>  AIX makefile
  makefile.cygwin   =>  Cygwin/gcc makefile
  makefile.dec      =>  DEC Alpha UNIX makefile
  makefile.hpux     =>  HPUX (10.20 and 11.00) makefile
  makefile.ibmc     =>  IBM C/C++ version 3.x for Win32 and OS/2 (static)
  makefile.intel    =>  Intel C/C++ version 4.0 and later
  libpng.icc        =>  Project file for IBM VisualAge/C++ version 4.0 or later
+ makefile.macosx   =>  MACOS X Makefile
  makefile.sgi      =>  Silicon Graphics IRIX makefile (cc, creates static lib)
- makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.9beta1)
+ makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.9beta10)
  makefile.sunos    =>  Sun makefile
- makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.9beta1)
+ makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.9beta10)
  makefile.sco      =>  For SCO OSr5  ELF and Unixware 7 with Native cc
  makefile.mips     =>  MIPS makefile
  makefile.acorn    =>  Acorn makefile
@@ -128,4 +131,4 @@
 
 Further information can be found in the README and libpng.txt
 files, in the individual makefiles, in png.h, in the README files in
-subdirectories of the dll directory, and the manual pages libpng.3 and png.5.
+subdirectories of the LIB directory, and the manual pages libpng.3 and png.5.
diff --git a/KNOWNBUG b/KNOWNBUG
index d879ce0..716242c 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -1,65 +1,9 @@
 
-Known bugs and suggested enhancements in libpng-1.0.8
+Known bugs in libpng-1.0.9
 
-0: November 3, 2000 -- BUG -- incorrect iCCP chunk is written
+1: January 16, 2001 -- BUG -- progressive reading narrow interlaced PNGs
 
-   The compression_type byte in the iCCP chunk written by libpng is
-   usually incorrect.
+   A crash occurs in Mozilla when reading a 2x533 interlaced RGB image.
 
-   Status: Fixed in libpng-1.0.9beta1
-
-1. October 12, 2000 -- BUG -- pngtest fails
-
-   The three WRITEFILE calls in pngtest.c are incorrect.  They must be
-   changed to read
-
-   WRITEFILE((png_FILE_p)png_ptr->io_ptr,  data, length, check);
-   WRITEFILE(io_ptr, near_data, length, check);
-   WRITEFILE(io_ptr, buf, written, err);
-
-2. August 28, 2000 -- BUG -- pnggccrd.c
-
-   The interlacing() function has still not been fully converted and
-   will not compile under gcc-2.95.2; it is currently ifdef'ed out.
-
-   STATUS: Fixed in libpng-1.0.9.  There were also bugs in pngvcrd.c
-   which have been fixed.  The replacement files are available at the
-   PNG web site (http://www.libpng.org/pub/png).
-
-3. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
-
-   Loops need to be optimized everywhere
-
-   Make them count down instead of up -- Kevin Bracey
-
-   Optimizing compilers don't need this, and making
-   the change would be error prone -- Tom Lane, Glenn R-P
-
-   Question whether i-- or --i is better.
-
-   STATUS: Under investigation, postponed until after
-   libpng-2.0.0.  About 160 loops will be turned around
-   in libpng-2.0.x betaxx, for testing.
-
-4. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
-
-   libpng-1.0.5 and earlier transform colors to gamma=1.0 space for
-   merging with background, and then back to the image's gamma.  The
-   bit_depth of the intermediate (gamma=1.0) representation is probably
-   not sufficient.  In the typical gamma=1/2.2 situation, the linear
-   pixels need about 4 more bits than the gamma-encoded ones, to avoid
-   loss of precision.  A similar situation exists with the rgb_to_gray
-   operation.
-
-   STATUS: under development.
-
-5. September 1999 -- ENHANCEMENT --
-
-   It should be possible to use libpng without floating-point arithmetic.
-
-   STATUS: Under investigation, implementation postponed until after
-   libpng-2.0.0.
-
-   Much of this was completed in libpng-1.0.6, but gamma compensation
-   is not yet done in fixed-point arithmetic.
-
+   Status: Under investigation.  It appears that pngpread.c is not
+   taking care to skip empty passes.
diff --git a/LICENSE b/LICENSE
index 34345d3..1e0634d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -8,7 +8,7 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng versions 1.0.7, July 1, 2000, through 1.0.9beta1, November 10, 2000, are
+libpng versions 1.0.7, July 1, 2000, through 1.0.9beta10, January 16, 2001, are
 Copyright (c) 2000 Glenn Randers-Pehrson
 and are distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
@@ -99,4 +99,4 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-November 10, 2000
+January 16, 2001
diff --git a/README b/README
index c017a9b..749d435 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng 1.0.9beta1 - November 10, 2000 (shared library 2.1)
+README for libpng 1.0.9beta10 - January 16, 2001 (shared library 2.1)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -171,7 +171,9 @@
        pngminus     =>  Simple pnm2png and png2pnm programs
        pngsuite     =>  Test images
        visupng      =>  Contains a MSVC workspace for VisualPng
-      dll           =>  Contains project files and workspaces for building DLL
+      projects      =>  Contains project files and workspaces for building DLL
+       borland          =>  Contains a Borland workspace for building libpng
+                            and zlib
        msvc             =>  Contains a Microsoft Visual C++ (MSVC) workspace
                             for building libpng and zlib
        wince            =>  Contains a Microsoft Visual C++ (Windows CD Toolkit)
@@ -180,25 +182,27 @@
        descrip.mms      =>  VMS makefile for MMS or MMK
        makefile.std     =>  Generic UNIX makefile (cc, creates static libpng.a)
        makefile.linux   =>  Linux/ELF makefile
-                            (gcc, creates libpng.so.2.1.0.9beta1)
+                            (gcc, creates libpng.so.2.1.0.9beta10)
        makefile.gcmmx   =>  Linux/ELF makefile (gcc, creates
-                            libpng.so.2.1.0.9beta1, uses assembler code
+                            libpng.so.2.1.0.9beta10, 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
                             ansi2knr (Requires ansi2knr.c from
                             ftp://ftp.cs.wisc.edu/ghost)
+       makefile.aix     =>  AIX makefile
        makefile.cygwin  =>  Cygwin/gcc makefile
        makefile.dec     =>  DEC Alpha UNIX makefile
        makefile.hpux    =>  HPUX (10.20 and 11.00) makefile
        makefile.ibmc    =>  IBM C/C++ version 3.x for Win32 and OS/2 (static)
        makefile.intel   =>  Intel C/C++ version 4.0 and later
        libpng.icc       =>  Project file, IBM VisualAge/C++ 4.0 or later
+       makefile.macosx  =>  MACOS X Makefile
        makefile.sgi     =>  Silicon Graphics IRIX (cc, creates static lib)
-       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.9beta1)
+       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng.so.2.1.0.9beta10)
        makefile.sunos   =>  Sun makefile
        makefile.solaris =>  Solaris 2.X makefile
-                            (gcc, creates libpng.so.2.1.0.9beta1)
+                            (gcc, creates libpng.so.2.1.0.9beta10)
        makefile.sco     =>  For SCO OSr5  ELF and Unixware 7 with Native cc
        makefile.mips    =>  MIPS makefile
        makefile.acorn   =>  Acorn makefile
diff --git a/TODO b/TODO
index e1de86c..a5f6395 100644
--- a/TODO
+++ b/TODO
@@ -17,3 +17,8 @@
    (counting huffman bits/precompression?  filter inertia?  filter costs?).
 Histogram creation.
 Text conversion between different code pages (Latin-1 -> Mac and DOS).
+Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
+Build gamma tables using fixed point (and do away with floating point entirely).
+Use greater precision when changing to linear gamma for compositing against
+  background and doing rgb-to-gray transformation.
+Investigate pre-incremented loop counters and other loop constructions.
diff --git a/Y2KINFO b/Y2KINFO
index 6e6a46b..fa30507 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
    Y2K compliance in libpng:
    =========================
 
-      November 10, 2000
+      January 16, 2001
 
       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.0.9beta1 are Y2K compliant.  It is my belief that earlier
+      upward through 1.0.9beta10 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
diff --git a/configure b/configure
index 8e5992a..13340c5 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 echo "
-  There is no \"configure\" script for Libpng-1.0.9beta1.  Instead, please
+  There is no \"configure\" script for Libpng-1.0.9beta10.  Instead, please
   copy the appropriate makefile for your system from the \"scripts\"
   directory.  Read the INSTALL file for more details.
 "
diff --git a/contrib/gregbook/Makefile.sgi b/contrib/gregbook/Makefile.sgi
new file mode 100644
index 0000000..bba61fb
--- /dev/null
+++ b/contrib/gregbook/Makefile.sgi
@@ -0,0 +1,102 @@
+# Sample makefile for rpng-x / rpng2-x / wpng for SGI using cc and make.
+# Greg Roelofs
+# Last modified:  16 January 1000
+#
+#	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.)
+#
+# Invoke this makefile from a shell prompt in the usual way; for example:
+#
+#	make -f Makefile.sgi
+#
+# 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.
+#
+# This makefile builds dynamically linked executables (against libpng and zlib,
+# that is), but that can be changed by uncommenting the appropriate PNGLIB and
+# ZLIB lines.
+
+
+# macros --------------------------------------------------------------------
+
+PNGINC = -I/usr/local/include
+PNGLIB = -L/usr/local/lib -lpng	# dynamically linked against libpng
+#PNGLIB = /usr/local/lib/libpng.a	# statically linked against libpng
+# or:
+#PNGINC = -I../..
+#PNGLIB = -L../.. -lpng
+#PNGLIB = ../../libpng.a
+
+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
+
+XINC = -I/usr/include/X11		# old-style, stock X distributions
+XLIB = -L/usr/lib/X11 -lX11
+#XINC = -I/usr/openwin/include    	# Sun workstations (OpenWindows)
+#XLIB = -L/usr/openwin/lib -lX11
+#XINC = -I/usr/X11R6/include		# new X distributions (XFree86, etc.)
+#XLIB = -L/usr/X11R6/lib -lX11
+
+INCS = $(PNGINC) $(ZINC) $(XINC)
+RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
+WLIBS = $(PNGLIB) $(ZLIB)
+
+CC = cc
+LD = cc
+RM = rm -f
+CFLAGS = -O -fullwarn $(INCS)
+LDFLAGS =
+O = .o
+E =
+
+RPNG  = rpng-x
+RPNG2 = rpng2-x
+WPNG  = wpng
+
+ROBJS  = $(RPNG)$(O) readpng$(O)
+ROBJS2 = $(RPNG2)$(O) readpng2$(O)
+WOBJS  = $(WPNG)$(O) writepng$(O)
+
+EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
+
+
+# implicit make rules -------------------------------------------------------
+
+.c$(O):
+	$(CC) -c $(CFLAGS) $<
+
+
+# dependencies --------------------------------------------------------------
+
+all:  $(EXES)
+
+$(RPNG)$(E): $(ROBJS)
+	$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
+
+$(RPNG2)$(E): $(ROBJS2)
+	$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
+
+$(WPNG)$(E): $(WOBJS)
+	$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
+
+$(RPNG)$(O):	$(RPNG).c readpng.h
+$(RPNG2)$(O):	$(RPNG2).c readpng2.h
+$(WPNG)$(O):	$(WPNG).c writepng.h
+
+readpng$(O):	readpng.c readpng.h
+readpng2$(O):	readpng2.c readpng2.h
+writepng$(O):	writepng.c writepng.h
+
+
+# maintenance ---------------------------------------------------------------
+
+clean:
+	$(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index 8f70c83..498d967 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -4,7 +4,7 @@
 
   ---------------------------------------------------------------------------
 
-      Copyright (c) 1998-2000 Greg Roelofs.  All rights reserved.
+      Copyright (c) 1998-2001 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
@@ -51,6 +51,7 @@
 {
     fprintf(stderr, "   Compiled with libpng %s; using libpng %s.\n",
       PNG_LIBPNG_VER_STRING, png_libpng_ver);
+
     fprintf(stderr, "   Compiled with zlib %s; using zlib %s.\n",
       ZLIB_VERSION, zlib_version);
 }
@@ -110,7 +111,6 @@
     png_set_progressive_read_fn(png_ptr, mainprog_ptr,
       readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
 
-
     /* make sure we save our pointers for use in readpng2_decode_data() */
 
     mainprog_ptr->png_ptr = png_ptr;
diff --git a/contrib/gregbook/readpng2.h b/contrib/gregbook/readpng2.h
index cbc1fd8..7caa9d9 100644
--- a/contrib/gregbook/readpng2.h
+++ b/contrib/gregbook/readpng2.h
@@ -4,7 +4,7 @@
 
   ---------------------------------------------------------------------------
 
-      Copyright (c) 1998-2000 Greg Roelofs.  All rights reserved.
+      Copyright (c) 1998-2001 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
@@ -66,6 +66,11 @@
     int rowbytes;
     int channels;
     int need_bgcolor;
+#if (defined(__i386__) || defined(_M_IX86))
+    int nommxfilters;
+    int nommxcombine;
+    int nommxinterlace;
+#endif
     int done;
     uch bg_red;
     uch bg_green;
diff --git a/contrib/gregbook/rpng2-win.c b/contrib/gregbook/rpng2-win.c
index 9bc66c7..8a8d3e7 100644
--- a/contrib/gregbook/rpng2-win.c
+++ b/contrib/gregbook/rpng2-win.c
@@ -11,7 +11,6 @@
    Meulen for the "diamond" and "radial waves" patterns, respectively.
 
    to do:
-    - stdout/stderr don't work!  need message window (maybe scrollable?)
     - handle quoted command-line args (especially filenames with spaces)
     - finish resizable checkerboard-gradient (sizes 4-128?)
     - use %.1023s to simplify truncation of title-bar string?
@@ -25,10 +24,12 @@
     - 1.03:  modified to allow abbreviated options
     - 1.04:  removed bogus extra argument from usage fprintf() [Glenn R-P?];
               fixed command-line parsing bug
+    - 1.10:  enabled "message window" (console), thanks to David Geldreich
+    - 1.20:  added runtime MMX-enabling/disabling and new -mmx* options
 
   ---------------------------------------------------------------------------
 
-      Copyright (c) 1998-2000 Greg Roelofs.  All rights reserved.
+      Copyright (c) 1998-2001 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
@@ -55,7 +56,7 @@
 
 #define PROGNAME  "rpng2-win"
 #define LONGNAME  "Progressive PNG Viewer for Windows"
-#define VERSION   "1.04 of 19 March 2000"
+#define VERSION   "1.20 of 4 January 2001"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -64,6 +65,7 @@
 #include <time.h>
 #include <math.h>      /* only for PvdM background code */
 #include <windows.h>
+#include <conio.h>     /* only for _getch() */
 
 /* all for PvdM background code: */
 #ifndef PI
@@ -239,6 +241,16 @@
     memset(&rpng2_info, 0, sizeof(mainprog_info));
 
 
+    /* Next reenable console output, which normally goes to the bit bucket
+     * for windowed apps.  Closing the console window will terminate the
+     * app.  Thanks to David.Geldreich@realviz.com for supplying the magical
+     * incantation. */
+
+    AllocConsole();
+    freopen("CONOUT$", "a", stderr);
+    freopen("CONOUT$", "a", stdout);
+
+
     /* Set the default value for our display-system exponent, i.e., the
      * product of the CRT exponent and the exponent corresponding to
      * the frame-buffer's lookup table (LUT), if any.  This is not an
@@ -354,6 +366,14 @@
             }
         } else if (!strncmp(*argv, "-timing", 2)) {
             timing = TRUE;
+#if (defined(__i386__) || defined(_M_IX86))
+        } else if (!strncmp(*argv, "-nommxfilters", 7)) {
+            rpng2_info.nommxfilters = TRUE;
+        } else if (!strncmp(*argv, "-nommxcombine", 7)) {
+            rpng2_info.nommxcombine = TRUE;
+        } else if (!strncmp(*argv, "-nommxinterlace", 7)) {
+            rpng2_info.nommxinterlace = TRUE;
+#endif
         } else {
             if (**argv != '-') {
                 filename = *argv;
@@ -401,25 +421,47 @@
     /* usage screen */
 
     if (error) {
-        fprintf(stderr, "\n%s %s:  %s\n", PROGNAME, VERSION, appname);
+        int ch;
+
+        fprintf(stderr, "\n%s %s:  %s\n\n", PROGNAME, VERSION, appname);
         readpng2_version_info();
         fprintf(stderr, "\n"
-          "Usage:  %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]"
-          " file.png\n\n"
+          "Usage:  %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
+#if (defined(__i386__) || defined(_M_IX86))
+          "        %*s [-nommxfilters] [-nommxcombine] [-nommxinterlace]\n"
+#endif
+          "        %*s file.png\n\n"
           "    exp \ttransfer-function exponent (``gamma'') of the display\n"
           "\t\t  system in floating-point format (e.g., ``%.1f''); equal\n"
           "\t\t  to the product of the lookup-table exponent (varies)\n"
           "\t\t  and the CRT exponent (usually 2.2); must be positive\n"
           "    bg  \tdesired background color in 7-character hex RGB format\n"
           "\t\t  (e.g., ``#ff7700'' for orange:  same as HTML colors);\n"
-          "\t\t  used with transparent images; overrides -bgpat\n"
+          "\t\t  used with transparent images; overrides -bgpat option\n"
           "    pat \tdesired background pattern number (1-%d); used with\n"
-          "\t\t  transparent images; overrides -bgcolor\n"
+          "\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))
+          "    -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"
-          "\n", PROGNAME, default_display_exponent, num_bgpat);
+          "Press Q or Esc to quit this usage screen.\n"
+          "\n", PROGNAME,
+#if (defined(__i386__) || defined(_M_IX86))
+          strlen(PROGNAME), " ",
+#endif
+          strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
+        do
+            ch = _getch();
+        while (ch != 'q' && ch != 'Q' && ch != 0x1B);
         exit(1);
+    } else {
+        fprintf(stderr, "\n%s %s:  %s\n", PROGNAME, VERSION, appname);
+        fprintf(stderr,
+          "\n   [console window:  closing this window will terminate %s]\n\n",
+          PROGNAME);
     }
 
 
diff --git a/contrib/gregbook/rpng2-x.c b/contrib/gregbook/rpng2-x.c
index 47ab5b9..dd26fec 100644
--- a/contrib/gregbook/rpng2-x.c
+++ b/contrib/gregbook/rpng2-x.c
@@ -25,10 +25,11 @@
     - 1.10:  added support for non-default visuals; fixed X pixel-conversion
     - 1.11:  added -usleep option for demos; fixed command-line parsing bug
     - 1.12:  added -pause option for demos and testing
+    - 1.20:  added runtime MMX-enabling/disabling and new -mmx* options
 
   ---------------------------------------------------------------------------
 
-      Copyright (c) 1998-2000 Greg Roelofs.  All rights reserved.
+      Copyright (c) 1998-2001 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
@@ -55,7 +56,7 @@
 
 #define PROGNAME  "rpng2-x"
 #define LONGNAME  "Progressive PNG Viewer for X"
-#define VERSION   "1.12 of 19 March 2000"
+#define VERSION   "1.20 of 4 January 2001"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -359,6 +360,14 @@
             pause_after_pass = TRUE;
         } else if (!strncmp(*argv, "-timing", 2)) {
             timing = TRUE;
+#if (defined(__i386__) || defined(_M_IX86))
+        } else if (!strncmp(*argv, "-nommxfilters", 7)) {
+            rpng2_info.nommxfilters = TRUE;
+        } else if (!strncmp(*argv, "-nommxcombine", 7)) {
+            rpng2_info.nommxcombine = TRUE;
+        } else if (!strncmp(*argv, "-nommxinterlace", 7)) {
+            rpng2_info.nommxinterlace = TRUE;
+#endif
         } else {
             if (**argv != '-') {
                 filename = *argv;
@@ -414,10 +423,13 @@
     /* usage screen */
 
     if (error) {
-        fprintf(stderr, "\n%s %s:  %s\n", PROGNAME, VERSION, appname);
+        fprintf(stderr, "\n%s %s:  %s\n\n", PROGNAME, VERSION, appname);
         readpng2_version_info();
         fprintf(stderr, "\n"
           "Usage:  %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
+#if (defined(__i386__) || defined(_M_IX86))
+          "        %*s [-nommxfilters] [-nommxcombine] [-nommxinterlace]\n"
+#endif
           "        %*s [-usleep dur | -timing] [-pause] file.png\n\n"
           "    xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
           "    exp \ttransfer-function exponent (``gamma'') of the display\n"
@@ -429,6 +441,10 @@
           "\t\t  used with transparent images; overrides -bgpat\n"
           "    pat \tdesired background pattern number (1-%d); used with\n"
           "\t\t  transparent images; overrides -bgcolor\n"
+#if (defined(__i386__) || defined(_M_IX86))
+          "    -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
+          "\t\t  combining rows, and expanding interlacing, respectively\n"
+#endif
           "    dur \tduration in microseconds to wait after displaying each\n"
           "\t\t  row (for demo purposes)\n"
           "    -timing\tenables delay for every block read, to simulate modem\n"
@@ -436,8 +452,11 @@
           "    -pause\tpauses after displaying each pass until key pressed\n"
           "\nPress Q, Esc or mouse button 1 (within image window, after image\n"
           "is displayed) to quit.\n"
-          "\n", PROGNAME, strlen(PROGNAME), " ", default_display_exponent,
-          num_bgpat);
+          "\n", PROGNAME,
+#if (defined(__i386__) || defined(_M_IX86))
+          strlen(PROGNAME), " ",
+#endif
+          strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
         exit(1);
     }
 
diff --git a/contrib/msvctest/README.txt b/contrib/msvctest/README.txt
index 67360bc..09bffd3 100644
--- a/contrib/msvctest/README.txt
+++ b/contrib/msvctest/README.txt
@@ -1,8 +1,8 @@
 Microsoft Developer Studio Build File, Format Version 6.00 for
 msvctest
 
-Assumes that libpng DLLs and LIBs are in ..\..\dll\msvc\win32\libpng
-Assumes that zlib DLLs and LIBs are in ..\..\dll\msvc\win32\zlib
+Assumes that libpng DLLs and LIBs are in ..\..\projects\msvc\win32\libpng
+Assumes that zlib DLLs and LIBs are in ..\..\projects\msvc\win32\zlib
 
 To build:
 
diff --git a/contrib/msvctest/msvctest.dsp b/contrib/msvctest/msvctest.dsp
index c691e0e..df3034e 100644
--- a/contrib/msvctest/msvctest.dsp
+++ b/contrib/msvctest/msvctest.dsp
@@ -54,12 +54,12 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\..\dll\msvc\win32\libpng\dll\libpng1.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng1.lib /nologo /subsystem:console /machine:I386
 # Begin Special Build Tool
 OutDir=.\dll
 SOURCE="$(InputPath)"
 PostBuild_Desc=[Run Test]
-PostBuild_Cmds=set path=..\..\dll\msvc\win32\libpng\dll;..\..\dll\msvc\win32\zlib\dll;	$(outdir)\msvctest.exe ..\..\pngtest.png
+PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll;..\..\projects\msvc\win32\zlib\dll;	$(outdir)\msvctest.exe ..\..\pngtest.png
 # End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "msvctest - Win32 Debug DLL"
@@ -84,12 +84,12 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\..\dll\msvc\win32\libpng\dll_dbg\libpng1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
 # Begin Special Build Tool
 OutDir=.\dll_dbg
 SOURCE="$(InputPath)"
 PostBuild_Desc=[Run Test]
-PostBuild_Cmds=set path=..\..\dll\msvc\win32\libpng\dll_dbg;..\..\dll\msvc\win32\zlib\dll_dbg;	$(outdir)\msvctest.exe ..\..\pngtest.png
+PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_dbg;..\..\projects\msvc\win32\zlib\dll_dbg;	$(outdir)\msvctest.exe ..\..\pngtest.png
 # End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "msvctest - Win32 ASM DLL"
@@ -114,12 +114,12 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\..\dll\msvc\win32\libpng\dll_asm\libpng1a.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng1a.lib /nologo /subsystem:console /machine:I386
 # Begin Special Build Tool
 OutDir=.\dll_asm
 SOURCE="$(InputPath)"
 PostBuild_Desc=[Run Test]
-PostBuild_Cmds=set path=..\..\dll\msvc\win32\libpng\dll_asm;..\..\dll\msvc\win32\zlib\dll_asm;	$(outdir)\msvctest.exe ..\..\pngtest.png
+PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_asm;..\..\projects\msvc\win32\zlib\dll_asm;	$(outdir)\msvctest.exe ..\..\pngtest.png
 # End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "msvctest - Win32 Debug ASM DLL"
@@ -144,12 +144,12 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\..\dll\msvc\win32\libpng\dll_dbga\libpng1b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng1b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
 # Begin Special Build Tool
 OutDir=.\dll_dbga
 SOURCE="$(InputPath)"
 PostBuild_Desc=[Run Test]
-PostBuild_Cmds=set path=..\..\dll\msvc\win32\libpng\dll_dbga;..\..\dll\msvc\win32\zlib\dll_dbga;	$(outdir)\msvctest.exe ..\..\pngtest.png
+PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_dbga;..\..\projects\msvc\win32\zlib\dll_dbga;	$(outdir)\msvctest.exe ..\..\pngtest.png
 # End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "msvctest - Win32 LIB"
@@ -174,7 +174,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\..\dll\msvc\win32\libpng\lib\libpng.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\lib\libpng.lib /nologo /subsystem:console /machine:I386
 # Begin Special Build Tool
 OutDir=.\lib
 SOURCE="$(InputPath)"
@@ -204,7 +204,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\..\dll\msvc\win32\libpng\lib_dbg\libpng.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\lib_dbg\libpng.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
 # Begin Special Build Tool
 OutDir=.\lib_dbg
 SOURCE="$(InputPath)"
diff --git a/contrib/visupng/README.txt b/contrib/visupng/README.txt
index 94b1e58..4a753d8 100644
--- a/contrib/visupng/README.txt
+++ b/contrib/visupng/README.txt
@@ -13,8 +13,8 @@
 
 Assumes that
 
-   libpng DLLs and LIBs are in ..\..\dll\msvc\win32\libpng
-   zlib DLLs and LIBs are in   ..\..\dll\msvc\win32\zlib
+   libpng DLLs and LIBs are in ..\..\projects\msvc\win32\libpng
+   zlib DLLs and LIBs are in   ..\..\projects\msvc\win32\zlib
    libpng header files are in  ..\..\..\libpng
    zlib header files are in    ..\..\..\zlib
    the pngsuite images are in  ..\pngsuite
diff --git a/contrib/visupng/VisualPng.dsp b/contrib/visupng/VisualPng.dsp
index 77d2b5b..fec5219 100644
--- a/contrib/visupng/VisualPng.dsp
+++ b/contrib/visupng/VisualPng.dsp
@@ -60,11 +60,11 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib"
-# ADD LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\dll\msvc\win32\libpng\dll"
+# ADD LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
 # Begin Special Build Tool
 OutDir=.\dll
 SOURCE="$(InputPath)"
-PostBuild_Cmds=set path=..\..\dll\msvc\win32\libpng\dll;..\..\dll\msvc\win32\zlib\dll;	$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
+PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll;..\..\projects\msvc\win32\zlib\dll;	$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
 # End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "VisualPng - Win32 Debug DLL"
@@ -94,12 +94,12 @@
 LINK32=link.exe
 # ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib"
 # SUBTRACT BASE LINK32 /nodefaultlib
-# ADD LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\dll\msvc\win32\libpng\dll_dbg"
+# ADD LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
 # SUBTRACT LINK32 /nodefaultlib
 # Begin Special Build Tool
 OutDir=.\dll_dbg
 SOURCE="$(InputPath)"
-PostBuild_Cmds=set path=..\..\dll\msvc\win32\libpng\dll_dbg;..\..\dll\msvc\win32\zlib\dll_dbg;	$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
+PostBuild_Cmds=set path=..\..\projects\msvc\win32\libpng\dll_dbg;..\..\projects\msvc\win32\zlib\dll_dbg;	$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
 # End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "VisualPng - Win32 LIB"
@@ -128,8 +128,8 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\dll\msvc\win32\libpng\dll"
-# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\dll\msvc\win32\libpng\lib"
+# ADD BASE LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
+# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\lib"
 # Begin Special Build Tool
 OutDir=.\lib
 SOURCE="$(InputPath)"
@@ -161,9 +161,9 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\dll\msvc\win32\libpng\dll_dbg"
+# ADD BASE LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
 # SUBTRACT BASE LINK32 /nodefaultlib
-# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\dll\msvc\win32\libpng\lib_dbg"
+# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\lib_dbg"
 # SUBTRACT LINK32 /nodefaultlib
 # Begin Special Build Tool
 OutDir=.\lib_dbg
diff --git a/example.c b/example.c
index aa920fe..1e953c8 100644
--- a/example.c
+++ b/example.c
@@ -267,7 +267,7 @@
     */
    if (color_type & PNG_COLOR_MASK_COLOR)
    {
-      png_uint_32 num_palette;
+      int num_palette;
       png_colorp palette;
 
       /* This reduces the image to the application supplied palette */
@@ -603,9 +603,9 @@
       PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
 
    /* set the palette if there is one.  REQUIRED for indexed-color images */
-   palette = (png_colorp)png_malloc(png_ptr, 256 * sizeof (png_color));
+   palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH * sizeof (png_color));
    /* ... set palette colors ... */
-   png_set_PLTE(png_ptr, info_ptr, palette, 256);
+   png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
    /* You must not free palette here, because png_set_PLTE only makes a link to
       the palette that you malloced.  Wait until you are about to destroy
       the png structure. */
diff --git a/libpng.3 b/libpng.3
index 6fa1c77..2203540 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "November 10, 2000"
+.TH LIBPNG 3 "January 16, 2001"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta1
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta10
 .SH SYNOPSIS
 \fI\fB
 
@@ -100,6 +100,10 @@
 
 \fI\fB
 
+\fBpng_uint_32 png_get_asm_flags (png_structp \fIpng_ptr\fP\fB);\fP
+
+\fI\fB
+
 \fBpng_byte png_get_bit_depth (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
 
 \fI\fB
@@ -334,6 +338,10 @@
 
 \fI\fB
 
+\fBint png_mmx_support \fI(void\fP\fB);\fP
+
+\fI\fB
+
 \fBvoid png_permit_empty_plte (png_structp \fP\fIpng_ptr\fP\fB, int \fIempty_plte_permitted\fP\fB);\fP
 
 \fI\fB
@@ -384,6 +392,10 @@
 
 \fI\fB
 
+\fBpng_set_asm_flags (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIasm_flags\fP\fB);\fP
+
+\fI\fB
+
 \fBvoid png_set_background (png_structp \fP\fIpng_ptr\fP\fB, png_color_16p \fP\fIbackground_color\fP\fB, int \fP\fIbackground_gamma_code\fP\fB, int \fP\fIneed_expand\fP\fB, double \fIbackground_gamma\fP\fB);\fP
 
 \fI\fB
@@ -747,7 +759,7 @@
 .SH LIBPNG.TXT
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.0.9beta1 - November 10, 2000
+ libpng version 1.0.9beta10 - January 16, 2001
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -814,7 +826,7 @@
 
 Libpng uses zlib for its compression and decompression of PNG files.
 Further information about zlib, and the latest version of zlib, can
-be found at the zlib home page, <ftp://ftp.freesoftware.com/pub/infozip/zlib/>.
+be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>.
 The zlib compression utility is a general purpose utility that is
 useful for more than PNG files, and can be used without libpng.
 See the documentation delivered with zlib for more details.
@@ -1118,7 +1130,7 @@
    row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
    for (int i=0; i<height, i++)
       row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
-   png_set_rows(png_ptr, info_ptr, &row_pointers); 
+   png_set_rows(png_ptr, info_ptr, &row_pointers);
 
 Alternatively you could allocate your image in one big block and define
 row_pointers[i] to point into the proper places in your block.
@@ -1147,7 +1159,7 @@
 
     png_get_IHDR(png_ptr, info_ptr, &width, &height,
        &bit_depth, &color_type, &interlace_type,
-       &compression_type, &filter_type);
+       &compression_type, &filter_method);
 
     width          - holds the width of the image
                      in pixels (up to 2^31).
@@ -1175,15 +1187,18 @@
                      PNG_COLOR_MASK_COLOR
                      PNG_COLOR_MASK_ALPHA
 
-    filter_type    - (must be PNG_FILTER_TYPE_BASE
-                     for PNG 1.0)
+    filter_method  - (must be PNG_FILTER_TYPE_BASE
+                     for PNG 1.0, and can also be
+                     PNG_INTRAPIXEL_DIFFERENCING if
+                     the PNG datastream is embedded in
+                     a MNG-1.0 datastream)
     compression_type - (must be PNG_COMPRESSION_TYPE_BASE
                      for PNG 1.0)
     interlace_type - (PNG_INTERLACE_NONE or
                      PNG_INTERLACE_ADAM7)
     Any or all of interlace_type, compression_type, of
-                     filter_type can be NULL if you are not
-                     interested in their values.
+                     filter_method can be NULL if you are
+                     not interested in their values.
 
     channels = png_get_channels(png_ptr, info_ptr);
     channels       - number of channels of info for the
@@ -1213,7 +1228,7 @@
                          info_ptr);
     color_type       = png_get_color_type(png_ptr,
                          info_ptr);
-    filter_type      = png_get_filter_type(png_ptr,
+    filter_method    = png_get_filter_type(png_ptr,
                          info_ptr);
     compression_type = png_get_compression_type(png_ptr,
                          info_ptr);
@@ -1311,7 +1326,7 @@
                          (empty string for unknown).
     num_text       - number of comments (same as num_comments;
                      you can put NULL here to avoid the duplication)
-    Note while png_set_text() will accept text, language, and 
+    Note while png_set_text() will accept text, language, and
     translated keywords that can be NULL pointers, the structure
     returned by png_get_text will always contain regular
     zero-terminated C strings.  They might be empty strings but
@@ -1706,7 +1721,7 @@
       if (png_get_valid(png_ptr, info_ptr,
          PNG_INFO_PLTE))
       {
-         png_color_16p histogram;
+         png_uint_16p histogram;
 
          png_get_hIST(png_ptr, info_ptr,
             &histogram);
@@ -1994,7 +2009,7 @@
     png_set_invalid(png_ptr, info_ptr, mask);
     mask - identifies the chunks to be made invalid,
            containing the logical OR of one or
-           more of 
+           more of
              PNG_INFO_gAMA, PNG_INFO_sBIT,
              PNG_INFO_cHRM, PNG_INFO_PLTE,
              PNG_INFO_tRNS, PNG_INFO_bKGD,
@@ -2286,10 +2301,11 @@
 have no special needs in this area, let the library do what it wants by
 not calling this function at all, as it has been tuned to deliver a good
 speed/compression ratio. The second parameter to png_set_filter() is
-the filter method, for which the only valid value is '0' (as of the
-July 1999 PNG specification, version 1.2).  The third parameter is a
-flag that indicates which filter type(s) are to be tested for each
-scanline.  See the PNG specification for details on the specific filter
+the filter method, for which the only valid values are 0 (as of the
+July 1999 PNG specification, version 1.2) or 64 (if you are writing
+a PNG datastream that is to be embedded in a MNG datastream).  The third
+parameter is a flag that indicates which filter type(s) are to be tested
+for each scanline.  See the PNG specification for details on the specific filter
 types.
 
 
@@ -2310,6 +2326,9 @@
 row of pixels will be stored in case it's needed later), and then add
 and remove them after the start of compression.
 
+If you are writing a PNG datastream that is to be embedded in a MNG
+datastream, the second parameter can be either 0 or 64.
+
 The png_set_compression_*() functions interface to the zlib compression
 library, and should mostly be ignored unless you really know what you are
 doing.  The only generally useful call is png_set_compression_level()
@@ -2348,7 +2367,7 @@
 
     png_set_IHDR(png_ptr, info_ptr, width, height,
        bit_depth, color_type, interlace_type,
-       compression_type, filter_type)
+       compression_type, filter_method)
     width          - holds the width of the image
                      in pixels (up to 2^31).
     height         - holds the height of the image
@@ -2380,7 +2399,11 @@
                      PNG_INTERLACE_ADAM7
     compression_type - (must be
                      PNG_COMPRESSION_TYPE_DEFAULT)
-    filter_type    - (must be PNG_FILTER_TYPE_DEFAULT)
+    filter_method  - (must be PNG_FILTER_TYPE_DEFAULT
+                     or, if you are writing a PNG to
+                     be embedded in a MNG datastream,
+                     can also be
+                     PNG_INTRAPIXEL_DIFFERENCING)
 
     png_set_PLTE(png_ptr, info_ptr, palette,
        num_palette);
@@ -2978,13 +3001,22 @@
 
 .SH V. Modifying/Customizing libpng:
 
-There are two issues here.  The first is changing how libpng does
+There are three issues here.  The first is changing how libpng does
 standard things like memory allocation, input/output, and error handling.
 The second deals with more complicated things like adding new chunks,
 adding new transformations, and generally changing how libpng works.
+Both of those are compile-time issues; that is, they are generally
+determined at the time the code is written, and there is rarely a need
+to provide the user with a means of changing them.  The third is a
+run-time issue:  choosing between and/or tuning one or more alternate
+versions of computationally intensive routines; specifically, optimized
+assembly-language (and therefore compiler- and platform-dependent)
+versions.
+
+Memory allocation, input/output, and error handling
 
 All of the memory allocation, input/output, and error handling in libpng
-goes through callbacks that are user settable.  The default routines are
+goes through callbacks that are user-settable.  The default routines are
 in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively.  To change
 these functions, call the appropriate png_set_*_fn() function.
 
@@ -3217,6 +3249,10 @@
 
     png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
        filters);
+              The second parameter can also be PNG_INTRAPIXEL_DIFFERENCING
+              if you are writing a PNG to be embedded in a MNG
+              datastream.  This parameter must be the same as the
+              value of filter_method used in png_set_IHDR().
 
 It is also possible to influence how libpng chooses from among the
 available filters.  This is done in two ways - by telling it how
@@ -3328,7 +3364,33 @@
 having level = 0 will be printed.  There aren't any such statements in
 this version of libpng, but if you insert some they will be printed.
 
-.SH VI.  Changes to Libpng from version 0.88
+
+.SH VI.  MNG support
+
+The MNG specification (available at http://www.libpng.org/pub/mng) allows
+certain extensions to PNG for PNG images that are embedded in MNG datastreams.
+Libpng can support some of these extensions.  To enable them, use the
+png_permit_mng_features() function:
+
+   feature_set = png_permit_mng_features(png_ptr, mask)
+   mask is a png_uint_32 containing the logical OR of the
+        features you want to enable.  These include
+        PNG_FLAG_MNG_EMPTY_PLTE
+        PNG_FLAG_MNG_FILTER_64
+        PNG_ALL_MNG_FEATURES
+   feature_set is a png_32_uint that is the logical AND of
+      your mask with the set of MNG features that is
+      supported by the version of libpng that you are using.
+
+It is an error to use this function when reading or writing a standalone
+PNG file with the PNG 8-byte signature.  The PNG datastream must be wrapped
+in a MNG datastream.  As a minimum, it must have the MNG 8-byte signature
+and the MHDR and MEND chunks.  Libpng does not provide support for these
+or any other MNG chunks; your application must provide its own support for
+them.  You may wish to consider using libmng (available at
+http://www.libmng.com) instead.
+
+.SH VII.  Changes to Libpng from version 0.88
 
 It should be noted that versions of libpng later than 0.96 are not
 distributed by the original libpng author, Guy Schalnat, nor by
@@ -3377,15 +3439,15 @@
 
    png_uint_32 application_vn = PNG_LIBPNG_VER;
 
-.SH VII. Y2K Compliance in libpng
+.SH VIII. Y2K Compliance in libpng
 
-November 10, 2000
+January 16, 2001
 
 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.0.9beta1 are Y2K compliant.  It is my belief that earlier
+upward through 1.0.9beta10 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 +3588,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.0.9beta1 - November 10, 2000:
+Libpng version 1.0.9beta10 - January 16, 2001:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
 
@@ -3543,7 +3605,7 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng versions 1.0.7, July 1, 2000, through  1.0.9beta1, November 10, 2000, are
+libpng versions 1.0.7, July 1, 2000, through  1.0.9beta10, January 16, 2001, are
 Copyright (c) 2000 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
@@ -3634,7 +3696,7 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-November 10, 2000
+January 16, 2001
 
 .\" end of man page
 
diff --git a/libpng.txt b/libpng.txt
index 2809e28..9c01f86 100644
--- a/libpng.txt
+++ b/libpng.txt
@@ -1,6 +1,6 @@
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.0.9beta1 - November 10, 2000
+ libpng version 1.0.9beta10 - January 16, 2001
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -67,7 +67,7 @@
 
 Libpng uses zlib for its compression and decompression of PNG files.
 Further information about zlib, and the latest version of zlib, can
-be found at the zlib home page, <ftp://ftp.freesoftware.com/pub/infozip/zlib/>.
+be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>.
 The zlib compression utility is a general purpose utility that is
 useful for more than PNG files, and can be used without libpng.
 See the documentation delivered with zlib for more details.
@@ -371,7 +371,7 @@
    row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
    for (int i=0; i<height, i++)
       row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
-   png_set_rows(png_ptr, info_ptr, &row_pointers); 
+   png_set_rows(png_ptr, info_ptr, &row_pointers);
 
 Alternatively you could allocate your image in one big block and define
 row_pointers[i] to point into the proper places in your block.
@@ -400,7 +400,7 @@
 
     png_get_IHDR(png_ptr, info_ptr, &width, &height,
        &bit_depth, &color_type, &interlace_type,
-       &compression_type, &filter_type);
+       &compression_type, &filter_method);
 
     width          - holds the width of the image
                      in pixels (up to 2^31).
@@ -428,15 +428,18 @@
                      PNG_COLOR_MASK_COLOR
                      PNG_COLOR_MASK_ALPHA
 
-    filter_type    - (must be PNG_FILTER_TYPE_BASE
-                     for PNG 1.0)
+    filter_method  - (must be PNG_FILTER_TYPE_BASE
+                     for PNG 1.0, and can also be
+                     PNG_INTRAPIXEL_DIFFERENCING if
+                     the PNG datastream is embedded in
+                     a MNG-1.0 datastream)
     compression_type - (must be PNG_COMPRESSION_TYPE_BASE
                      for PNG 1.0)
     interlace_type - (PNG_INTERLACE_NONE or
                      PNG_INTERLACE_ADAM7)
     Any or all of interlace_type, compression_type, of
-                     filter_type can be NULL if you are not
-                     interested in their values.
+                     filter_method can be NULL if you are
+                     not interested in their values.
 
     channels = png_get_channels(png_ptr, info_ptr);
     channels       - number of channels of info for the
@@ -466,7 +469,7 @@
                          info_ptr);
     color_type       = png_get_color_type(png_ptr,
                          info_ptr);
-    filter_type      = png_get_filter_type(png_ptr,
+    filter_method    = png_get_filter_type(png_ptr,
                          info_ptr);
     compression_type = png_get_compression_type(png_ptr,
                          info_ptr);
@@ -564,7 +567,7 @@
                          (empty string for unknown).
     num_text       - number of comments (same as num_comments;
                      you can put NULL here to avoid the duplication)
-    Note while png_set_text() will accept text, language, and 
+    Note while png_set_text() will accept text, language, and
     translated keywords that can be NULL pointers, the structure
     returned by png_get_text will always contain regular
     zero-terminated C strings.  They might be empty strings but
@@ -959,7 +962,7 @@
       if (png_get_valid(png_ptr, info_ptr,
          PNG_INFO_PLTE))
       {
-         png_color_16p histogram;
+         png_uint_16p histogram;
 
          png_get_hIST(png_ptr, info_ptr,
             &histogram);
@@ -1247,7 +1250,7 @@
     png_set_invalid(png_ptr, info_ptr, mask);
     mask - identifies the chunks to be made invalid,
            containing the logical OR of one or
-           more of 
+           more of
              PNG_INFO_gAMA, PNG_INFO_sBIT,
              PNG_INFO_cHRM, PNG_INFO_PLTE,
              PNG_INFO_tRNS, PNG_INFO_bKGD,
@@ -1539,10 +1542,11 @@
 have no special needs in this area, let the library do what it wants by
 not calling this function at all, as it has been tuned to deliver a good
 speed/compression ratio. The second parameter to png_set_filter() is
-the filter method, for which the only valid value is '0' (as of the
-July 1999 PNG specification, version 1.2).  The third parameter is a
-flag that indicates which filter type(s) are to be tested for each
-scanline.  See the PNG specification for details on the specific filter
+the filter method, for which the only valid values are 0 (as of the
+July 1999 PNG specification, version 1.2) or 64 (if you are writing
+a PNG datastream that is to be embedded in a MNG datastream).  The third
+parameter is a flag that indicates which filter type(s) are to be tested
+for each scanline.  See the PNG specification for details on the specific filter
 types.
 
 
@@ -1563,6 +1567,9 @@
 row of pixels will be stored in case it's needed later), and then add
 and remove them after the start of compression.
 
+If you are writing a PNG datastream that is to be embedded in a MNG
+datastream, the second parameter can be either 0 or 64.
+
 The png_set_compression_*() functions interface to the zlib compression
 library, and should mostly be ignored unless you really know what you are
 doing.  The only generally useful call is png_set_compression_level()
@@ -1601,7 +1608,7 @@
 
     png_set_IHDR(png_ptr, info_ptr, width, height,
        bit_depth, color_type, interlace_type,
-       compression_type, filter_type)
+       compression_type, filter_method)
     width          - holds the width of the image
                      in pixels (up to 2^31).
     height         - holds the height of the image
@@ -1633,7 +1640,11 @@
                      PNG_INTERLACE_ADAM7
     compression_type - (must be
                      PNG_COMPRESSION_TYPE_DEFAULT)
-    filter_type    - (must be PNG_FILTER_TYPE_DEFAULT)
+    filter_method  - (must be PNG_FILTER_TYPE_DEFAULT
+                     or, if you are writing a PNG to
+                     be embedded in a MNG datastream,
+                     can also be
+                     PNG_INTRAPIXEL_DIFFERENCING)
 
     png_set_PLTE(png_ptr, info_ptr, palette,
        num_palette);
@@ -2231,13 +2242,22 @@
 
 V. Modifying/Customizing libpng:
 
-There are two issues here.  The first is changing how libpng does
+There are three issues here.  The first is changing how libpng does
 standard things like memory allocation, input/output, and error handling.
 The second deals with more complicated things like adding new chunks,
 adding new transformations, and generally changing how libpng works.
+Both of those are compile-time issues; that is, they are generally
+determined at the time the code is written, and there is rarely a need
+to provide the user with a means of changing them.  The third is a
+run-time issue:  choosing between and/or tuning one or more alternate
+versions of computationally intensive routines; specifically, optimized
+assembly-language (and therefore compiler- and platform-dependent)
+versions.
+
+Memory allocation, input/output, and error handling
 
 All of the memory allocation, input/output, and error handling in libpng
-goes through callbacks that are user settable.  The default routines are
+goes through callbacks that are user-settable.  The default routines are
 in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively.  To change
 these functions, call the appropriate png_set_*_fn() function.
 
@@ -2470,6 +2490,10 @@
 
     png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
        filters);
+              The second parameter can also be PNG_INTRAPIXEL_DIFFERENCING
+              if you are writing a PNG to be embedded in a MNG
+              datastream.  This parameter must be the same as the
+              value of filter_method used in png_set_IHDR().
 
 It is also possible to influence how libpng chooses from among the
 available filters.  This is done in two ways - by telling it how
@@ -2581,7 +2605,33 @@
 having level = 0 will be printed.  There aren't any such statements in
 this version of libpng, but if you insert some they will be printed.
 
-VI.  Changes to Libpng from version 0.88
+
+VI.  MNG support
+
+The MNG specification (available at http://www.libpng.org/pub/mng) allows
+certain extensions to PNG for PNG images that are embedded in MNG datastreams.
+Libpng can support some of these extensions.  To enable them, use the
+png_permit_mng_features() function:
+
+   feature_set = png_permit_mng_features(png_ptr, mask)
+   mask is a png_uint_32 containing the logical OR of the
+        features you want to enable.  These include
+        PNG_FLAG_MNG_EMPTY_PLTE
+        PNG_FLAG_MNG_FILTER_64
+        PNG_ALL_MNG_FEATURES
+   feature_set is a png_32_uint that is the logical AND of
+      your mask with the set of MNG features that is
+      supported by the version of libpng that you are using.
+
+It is an error to use this function when reading or writing a standalone
+PNG file with the PNG 8-byte signature.  The PNG datastream must be wrapped
+in a MNG datastream.  As a minimum, it must have the MNG 8-byte signature
+and the MHDR and MEND chunks.  Libpng does not provide support for these
+or any other MNG chunks; your application must provide its own support for
+them.  You may wish to consider using libmng (available at
+http://www.libmng.com) instead.
+
+VII.  Changes to Libpng from version 0.88
 
 It should be noted that versions of libpng later than 0.96 are not
 distributed by the original libpng author, Guy Schalnat, nor by
@@ -2630,15 +2680,15 @@
 
    png_uint_32 application_vn = PNG_LIBPNG_VER;
 
-VII. Y2K Compliance in libpng
+VIII. Y2K Compliance in libpng
 
-November 10, 2000
+January 16, 2001
 
 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.0.9beta1 are Y2K compliant.  It is my belief that earlier
+upward through 1.0.9beta10 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
diff --git a/libpngpf.3 b/libpngpf.3
index d1cc3ed..19e0d44 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "November 10, 2000"
+.TH LIBPNGPF 3 "January 16, 2001"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta1
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta10
 (private functions)
 .SH SYNOPSIS
 \fB#include <png.h>\fP
diff --git a/png.5 b/png.5
index e804e2e..8823781 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "November 10, 2000"
+.TH PNG 5 "January 16, 2001"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index 525422c..a8538e3 100644
--- a/png.c
+++ b/png.c
@@ -1,8 +1,8 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * libpng version 1.0.9beta1 - November 10, 2000
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * libpng version 1.0.9beta10 - January 16, 2001
+ * Copyright (c) 1998-2001 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.)
  *
@@ -13,14 +13,14 @@
 #include "png.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_0_9beta1 Your_png_h_is_not_version_1_0_9beta1;
+typedef version_1_0_9beta10 Your_png_h_is_not_version_1_0_9beta10;
 
 /* Version information for C files.  This had better match the version
  * string defined in png.h.  */
 
 #ifdef PNG_USE_GLOBAL_ARRAYS
 /* png_libpng_ver was changed to a function in version 1.0.5c */
-const char png_libpng_ver[18] = "1.0.9beta1";
+const char png_libpng_ver[18] = "1.0.9beta10";
 
 /* png_sig was changed to a function in version 1.0.5c */
 /* Place to hold the signature string for a PNG file. */
@@ -526,7 +526,7 @@
    png_debug(1, "in png_info_destroy\n");
 
    png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
-    
+
 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
    if (png_ptr->num_chunk_list)
    {
@@ -626,8 +626,8 @@
 png_get_copyright(png_structp png_ptr)
 {
    if (png_ptr != NULL || png_ptr == NULL)  /* silence compiler warning */
-   return ((png_charp) "\n libpng version 1.0.9beta1 - November 10, 2000\n\
-   Copyright (c) 1998-2000 Glenn Randers-Pehrson\n\
+   return ((png_charp) "\n libpng version 1.0.9beta10 - January 16, 2001\n\
+   Copyright (c) 1998-2001 Glenn Randers-Pehrson\n\
    Copyright (c) 1996, 1997 Andreas Dilger\n\
    Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
    return ((png_charp) "");
@@ -644,8 +644,8 @@
 {
    /* Version of *.c files used when building libpng */
    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
-      return((png_charp) "1.0.9beta1");
-   return((png_charp) "1.0.9beta1");
+      return((png_charp) "1.0.9beta10");
+   return((png_charp) "1.0.9beta10");
 }
 
 png_charp PNGAPI
@@ -697,3 +697,13 @@
    /* Version of *.c files used when building libpng */
    return((png_uint_32) 10009L);
 }
+
+
+/* this function was added to libpng 1.0.9 (porting aid to libpng-1.2.0) */
+#ifndef PNG_ASSEMBLER_CODE_SUPPORTED
+int PNGAPI
+png_mmx_support(void)
+{
+    return -1;
+}
+#endif
diff --git a/png.h b/png.h
index f25e5eb..247ae3d 100644
--- a/png.h
+++ b/png.h
@@ -1,15 +1,15 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.0.9beta1 - November 10, 2000
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * libpng version 1.0.9beta10 - January 16, 2001
+ * Copyright (c) 1998-2001 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.)
  *
  * 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.0.9beta1 - November 10, 2000: Glenn
+ *  libpng versions 0.97, January 1998, through 1.0.9beta10 - January 16, 2001: Glenn
  *  See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -58,12 +58,14 @@
  *    1.0.8beta1-4                  10008  2.1.0.8beta1-4
  *    1.0.8rc1                      10008  2.1.0.8rc1
  *    1.0.8                         10008  2.1.0.8
- *    1.0.9beta1                    10009  2.1.0.9
+ *    1.0.9beta1-6                  10009  2.1.0.9beta1-6
+ *    1.0.9rc1                      10009  2.1.0.9rc1
+ *    1.0.9beta7-10                 10009  2.1.0.9beta7-10
  *
  *    Henceforth the source version will match the shared-library major
  *    and minor numbers; the shared-library major version number will be
  *    used for changes in backward compatibility, as it is intended.  The
- *    PNG_PNGLIB_VER macro, which is not used within libpng but is available
+ *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
  *    for applications, is an unsigned integer of the form xyyzz corresponding
  *    to the source version x.y.z (leading zeros in y and z).  Beta versions
  *    were given the previous public release number plus a letter, until
@@ -85,8 +87,8 @@
  * If you modify libpng you may insert additional notices immediately following
  * this sentence.
  *
- * libpng versions 1.0.7, July 1, 2000, through  1.0.9beta1, November 10, 2000, are
- * Copyright (c) 2000 Glenn Randers-Pehrson, and are
+ * libpng versions 1.0.7, July 1, 2000, through  1.0.9beta10, January 16, 2001, are
+ * Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.0.6
  * with the following individuals added to the list of Contributing Authors
  *
@@ -190,13 +192,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    November 10, 2000
+ *    January 16, 2001
  *
  *    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.0.9beta1 are Y2K compliant.  It is my belief that earlier
+ *    upward through 1.0.9beta10 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
@@ -252,7 +254,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.0.9beta1"
+#define PNG_LIBPNG_VER_STRING "1.0.9beta10"
 
 #define PNG_LIBPNG_VER_SONUM   2
 
@@ -262,7 +264,16 @@
 #define PNG_LIBPNG_VER_RELEASE 9
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
-#define PNG_LIBPNG_VER_BUILD   1
+
+#define PNG_LIBPNG_VER_BUILD  10
+
+#define PNG_LIBPNG_BUILD_ALPHA    1
+#define PNG_LIBPNG_BUILD_BETA     2
+#define PNG_LIBPNG_BUILD_RC       3
+#define PNG_LIBPNG_BUILD_STABLE   4
+#define PNG_LIBPNG_BUILD_TYPEMASK 7
+#define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with STABLE only */
+#define PNG_LIBPNG_BUILD_TYPE 2
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
@@ -271,21 +282,14 @@
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release */
 #define PNG_LIBPNG_VER 10009 /* 1.0.9 */
 
-/* Note to maintainer: update this number in scripts/pngdef.pas as well */
-
 #ifndef PNG_VERSION_INFO_ONLY
 
 /* include the compression library's header */
 #include "zlib.h"
 
-/* include all user configurable info */
+/* include all user configurable info, including optional assembler routines */
 #include "pngconf.h"
 
-/* macros for optional assembler routines */
-#if defined(PNG_INTERNAL) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-#  include "pngasmrd.h"
-#endif
-
 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
 #ifdef __cplusplus
 extern "C" {
@@ -439,7 +443,7 @@
  * Two conversions are provided, both from time_t and struct tm.  There
  * is no portable way to convert to either of these structures, as far
  * as I know.  If you know of a portable way, send it to me.  As a side
- * note - PNG is Year 2000 compliant!
+ * note - PNG has always been Year 2000 compliant!
  */
 typedef struct png_time_struct
 {
@@ -497,20 +501,20 @@
  * The following members may have allocated storage attached that should be
  * cleaned up before the structure is discarded: palette, trans, text,
  * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
- * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these are
- * automatically freed when the info structure is deallocated, if they were
+ * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these
+ * are automatically freed when the info structure is deallocated, if they were
  * allocated internally by libpng.  This behavior can be changed by means
  * of the png_data_freer() function.
  *
- * More allocation details: all the chunk-reading functions that change these
- * members go through the corresponding png_set_* functions.  A function to
- * clear these members is available: see png_free_data().   Some of the
- * png_set_* functions do not depend on being able to point info structure
- * members to any of the storage they are passed (they make their own copies),
- * EXCEPT that the png_set_text functions use the same storage passed to them
- * in the text_ptr or itxt_ptr structure argument, and the png_set_tRNS,
- * png_set_PLTE, png_set_hIST, png_set_iCCP, png_set_rows, png_set_sPLT,
- * and png_set_unknowns do not make their own copies.
+ * More allocation details: all the chunk-reading functions that
+ * change these members go through the corresponding png_set_*
+ * functions.  A function to clear these members is available: see
+ * png_free_data().  The png_set_* functions do not depend on being
+ * able to point info structure members to any of the storage they are
+ * passed (they make their own copies), EXCEPT that the png_set_text
+ * functions use the same storage passed to them in the text_ptr or
+ * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
+ * functions do not make their own copies.
  */
 typedef struct png_info_struct
 {
@@ -696,6 +700,7 @@
    /* iCCP chunk data. */
    png_charp iccp_name;     /* profile name */
    png_charp iccp_profile;  /* International Color Consortium profile data */
+                            /* Note to maintainer: should be png_bytep */
    png_uint_32 iccp_proflen;  /* ICC profile data length */
    png_byte iccp_compression; /* Always zero */
 #endif
@@ -776,6 +781,7 @@
 
 /* This is for filter type. PNG 1.0-1.2 only define the single type. */
 #define PNG_FILTER_TYPE_BASE      0 /* Single row per-byte filtering */
+#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
 #define PNG_FILTER_TYPE_DEFAULT   PNG_FILTER_TYPE_BASE
 
 /* These are for the interlacing type.  These values should NOT be changed. */
@@ -816,6 +822,8 @@
 /* This is for text chunks */
 #define PNG_KEYWORD_MAX_LENGTH     79
 
+/* Maximum number of entries in PLTE/sPLT/tRNS arrays */
+#define PNG_MAX_PALETTE_LENGTH	   256
 
 /* These determine if an ancillary chunk's data has been successfully read
  * from the PNG header, or if the application has filled in the corresponding
@@ -910,8 +918,9 @@
 #define PNG_TRANSFORM_STRIP_FILLER   0x0800    /* WRITE only */
 
 /* Flags for MNG supported features */
-#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
-#define PNG_ALL_MNG_FEATURES    0x01
+#define PNG_FLAG_MNG_EMPTY_PLTE     0x01
+#define PNG_FLAG_MNG_FILTER_64      0x04
+#define PNG_ALL_MNG_FEATURES        0x05
 
 typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
 typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
@@ -1157,12 +1166,15 @@
    png_fixed_point int_gamma;
 #endif
 
+   png_byte filter_type;
+
 };
 
+
 /* This prevents a compiler error in png_get_copyright() in png.c if png.c
-and png.h are both at * version 1.0.9beta1
+and png.h are both at * version 1.0.9beta10
  */
-typedef png_structp version_1_0_9beta1;
+typedef png_structp version_1_0_9beta10;
 
 typedef png_struct FAR * FAR * png_structpp;
 
@@ -2014,12 +2026,14 @@
 extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
    png_infop info_ptr, png_charpp name, int *compression_type,
    png_charpp profile, png_uint_32 *proflen));
+   /* Note to maintainer: profile should be png_bytepp */
 #endif
 
 #if defined(PNG_iCCP_SUPPORTED)
 extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
    png_infop info_ptr, png_charp name, int compression_type,
    png_charp profile, png_uint_32 proflen));
+   /* Note to maintainer: profile should be png_bytep */
 #endif
 
 #if defined(PNG_READ_sPLT_SUPPORTED)
@@ -2200,8 +2214,13 @@
    png_ptr, png_uint_32 mng_features_permitted));
 #endif
 
+/* png.c, pnggccrd.c, or pngvcrd.c */
+extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
+
+/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
+
 #define PNG_HEADER_VERSION_STRING \
-   " libpng version 1.0.9beta1 - November 10, 2000 (header)\n"
+   " libpng version 1.0.9beta10 - January 16, 2001 (header)\n"
 
 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
 /* With these routines we avoid an integer divide, which will be slower on
@@ -2267,6 +2286,7 @@
 #define PNG_WROTE_tIME             0x200
 #define PNG_WROTE_INFO_BEFORE_PLTE 0x400
 #define PNG_BACKGROUND_IS_GRAY     0x800
+#define PNG_HAVE_PNG_SIGNATURE    0x1000
 
 /* flags for the transformations the PNG library does on the image data */
 #define PNG_BGR                0x0001
@@ -2428,7 +2448,7 @@
 #endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
 
 /* Initialize png_ptr struct for reading, and allocate any other memory.
- * (old interface - DEPRECATED).
+ * (old interface - DEPRECATED - use png_create_read_struct instead).
  */
 extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
 #define png_read_init(png_ptr) png_read_init_2(png_ptr, \
@@ -2438,7 +2458,7 @@
     png_info_size));
 
 /* Initialize png_ptr struct for writing, and allocate any other memory.
- * (old interface - DEPRECATED).
+ * (old interface - DEPRECATED - use png_create_write_struct instead).
  */
 extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
 #define png_write_init(png_ptr) png_write_init_2(png_ptr, \
@@ -2585,6 +2605,7 @@
 PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
    png_charp name, int compression_type,
    png_charp profile, int proflen));
+   /* Note to maintainer: profile should be png_bytep */
 #endif
 
 #if defined(PNG_WRITE_sPLT_SUPPORTED)
@@ -2679,10 +2700,15 @@
 
 #if defined(PNG_READ_INTERLACING_SUPPORTED)
 /* expand an interlaced row */
+/* OLD interface:
 PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
    png_bytep row, int pass, png_uint_32 transformations));
+ */
+PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
 #endif
 
+/* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */
+
 #if defined(PNG_WRITE_INTERLACING_SUPPORTED)
 /* grab pixels out of a row for an interlaced pass */
 PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
@@ -2987,6 +3013,15 @@
 
 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
+   png_bytep row));
+PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
+   png_bytep row));
+#endif
+
+/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
+
 #endif /* PNG_INTERNAL */
 
 #ifdef __cplusplus
diff --git a/pngasmrd.h b/pngasmrd.h
index 9aea66c..cab3fb5 100644
--- a/pngasmrd.h
+++ b/pngasmrd.h
@@ -1,39 +1,11 @@
 /* pngasmrd.h - assembler version of utilities to read a PNG file
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 2001 Glenn Randers-Pehrson
  *
  */
 
-#ifndef PNGASMRD_H
-#define PNGASMRD_H
-
-#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
-
-/* Set this in the makefile for VC++ on Pentium, not in pngconf.h */
-/* Platform must be Pentium.  Makefile must assemble and load pngvcrd.c .
- * MMX will be detected at run time and used if present.
+/* This file is obsolete in libpng-1.0.9 and later; its contents now appear
+ * at the end of pngconf.h.
  */
-#ifdef PNG_USE_PNGVCRD
-#  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
-#  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
-#  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
-#endif
-
-/* Set this in the makefile for gcc/as on Pentium, not in pngconf.h */
-/* Platform must be Pentium.  Makefile must assemble and load pnggccrd.c .
- * MMX will be detected at run time and used if present.
- */
-#ifdef PNG_USE_PNGGCCRD
-#  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
-#  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
-#  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
-#endif
-/*
-    GRR notes:
-      - see pnggccrd.c for info about what is currently enabled
- */
-
-#endif
-#endif /* PNGASMRD_H */
diff --git a/pngconf.h b/pngconf.h
index 19baba0..0f4f233 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,8 +1,8 @@
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  */
@@ -30,11 +30,11 @@
  */
 
 #ifndef PNG_ZBUF_SIZE
-#define PNG_ZBUF_SIZE 8192
+#  define PNG_ZBUF_SIZE 8192
 #endif
 
-#ifndef PNG_NO_FLOATING_POINT_SUPPORTED 
-#define PNG_FLOATING_POINT_SUPPORTED
+#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
+#  define PNG_FLOATING_POINT_SUPPORTED
 #endif
 
 /* If you are running on a machine where you cannot allocate more
@@ -46,14 +46,14 @@
 #define PNG_MAX_MALLOC_64K
  */
 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
-#define PNG_MAX_MALLOC_64K
+#  define PNG_MAX_MALLOC_64K
 #endif
 
 /* Special munging to support doing things the 'cygwin' way:
  * 'Normal' png-on-win32 defines/defaults:
  *   PNG_BUILD_DLL -- building dll
  *   PNG_USE_DLL   -- building an application, linking to dll
- *   (no define)   -- building static library, or building an 
+ *   (no define)   -- building static library, or building an
  *                    application and linking to the static lib
  * 'Cygwin' defines/defaults:
  *   PNG_BUILD_DLL -- building the dll
@@ -117,12 +117,12 @@
  */
 
 #if defined(_WIN32_WCE)
-#include <windows.h>
-/* Console I/O functions are not supported on WindowsCE */
-#define PNG_NO_CONSOLE_IO
-#ifdef PNG_DEBUG
-#  undef PNG_DEBUG
-#endif
+#  include <windows.h>
+   /* Console I/O functions are not supported on WindowsCE */
+#  define PNG_NO_CONSOLE_IO
+#  ifdef PNG_DEBUG
+#    undef PNG_DEBUG
+#  endif
 #endif
 
 #ifdef PNG_BUILD_DLL
@@ -159,13 +159,13 @@
 #ifndef PNGARG
 
 #ifdef OF /* zlib prototype munger */
-#define PNGARG(arglist) OF(arglist)
+#  define PNGARG(arglist) OF(arglist)
 #else
 
 #ifdef _NO_PROTO
-#define PNGARG(arglist) ()
+#  define PNGARG(arglist) ()
 #else
-#define PNGARG(arglist) arglist
+#  define PNGARG(arglist) arglist
 #endif /* _NO_PROTO */
 
 #endif /* OF */
@@ -177,15 +177,15 @@
  * on non-Mac platforms.
  */
 #ifndef MACOS
-#if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
-    defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
-#define MACOS
-#endif
+#  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
+      defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
+#    define MACOS
+#  endif
 #endif
 
 /* enough people need this for various reasons to include it here */
 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
-#include <sys/types.h>
+#  include <sys/types.h>
 #endif
 
 #ifndef PNG_SETJMP_NOT_SUPPORTED
@@ -206,10 +206,10 @@
       __png.h__ already includes setjmp.h;
       __dont__ include it again.;
 #    endif
-#endif /* __linux__ */
+#  endif /* __linux__ */
 
-/* include setjmp.h for error handling */
-#include <setjmp.h>
+   /* include setjmp.h for error handling */
+#  include <setjmp.h>
 
 #  ifdef __linux__
 #    ifdef PNG_SAVE_BSD_SOURCE
@@ -222,17 +222,18 @@
 #if defined(_AIX) && defined(__xlC__)
 /* This prevents "AIX/xlC" from generating an "index(s,c)" macro in strings.h
  * that conflicts with libpng's png_color_16.index */
-#undef __STR__
+#  undef __STR__
 #endif
 
 #ifdef BSD
-#include <strings.h>
+#  include <strings.h>
 #else
-#include <string.h>
+#  include <string.h>
 #endif
 
 /* Other defines for things like memory and the like can go here.  */
 #ifdef PNG_INTERNAL
+
 #include <stdlib.h>
 
 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
@@ -249,28 +250,28 @@
  */
 
 #if defined(PNG_FLOATING_POINT_SUPPORTED)
-#if defined(MACOS)
-/* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
-#if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-#include <fp.h>
-#endif
-#else
-#include <math.h>
-#endif
-#if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
-/* Amiga SAS/C: We must include builtin FPU functions when compiling using
- * MATH=68881
- */
-#include <m68881.h>
-#endif
+#  if defined(MACOS)
+     /* We need to check that <math.h> hasn't already been included earlier
+      * as it seems it doesn't agree with <fp.h>, yet we should really use
+      * <fp.h> if possible.
+      */
+#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
+#      include <fp.h>
+#    endif
+#  else
+#    include <math.h>
+#  endif
+#  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
+     /* Amiga SAS/C: We must include builtin FPU functions when compiling using
+      * MATH=68881
+      */
+#    include <m68881.h>
+#  endif
 #endif
 
 /* Codewarrior on NT has linking problems without this. */
 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
-#define PNG_ALWAYS_EXTERN
+#  define PNG_ALWAYS_EXTERN
 #endif
 
 /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
@@ -278,12 +279,12 @@
  * "feature"?
  */
 #ifdef __TURBOC__
-#include <mem.h>
-#include "alloc.h"
+#  include <mem.h>
+#  include "alloc.h"
 #endif
 
 #ifdef _MSC_VER
-#include <malloc.h>
+#  include <malloc.h>
 #endif
 
 /* This controls how fine the dithering gets.  As this allocates
@@ -291,13 +292,13 @@
  * with dithering quality can decrease some or all of these.
  */
 #ifndef PNG_DITHER_RED_BITS
-#define PNG_DITHER_RED_BITS 5
+#  define PNG_DITHER_RED_BITS 5
 #endif
 #ifndef PNG_DITHER_GREEN_BITS
-#define PNG_DITHER_GREEN_BITS 5
+#  define PNG_DITHER_GREEN_BITS 5
 #endif
 #ifndef PNG_DITHER_BLUE_BITS
-#define PNG_DITHER_BLUE_BITS 5
+#  define PNG_DITHER_BLUE_BITS 5
 #endif
 
 /* This controls how fine the gamma correction becomes when you
@@ -308,14 +309,14 @@
  */
 
 #ifndef PNG_MAX_GAMMA_8
-#define PNG_MAX_GAMMA_8 11
+#  define PNG_MAX_GAMMA_8 11
 #endif
 
 /* This controls how much a difference in gamma we can tolerate before
  * we actually start doing gamma conversion.
  */
 #ifndef PNG_GAMMA_THRESHOLD
-#define PNG_GAMMA_THRESHOLD 0.05
+#  define PNG_GAMMA_THRESHOLD 0.05
 #endif
 
 #endif /* PNG_INTERNAL */
@@ -380,163 +381,167 @@
  */
 
 #ifdef PNG_LEGACY_SUPPORTED
-#define PNG_NO_FREE_ME
-#define PNG_NO_READ_UNKNOWN_CHUNKS
-#define PNG_NO_WRITE_UNKNOWN_CHUNKS
-#define PNG_NO_READ_USER_CHUNKS
-#define PNG_NO_READ_iCCP
-#define PNG_NO_WRITE_iCCP
-#define PNG_NO_READ_iTXt
-#define PNG_NO_WRITE_iTXt
-#define PNG_NO_READ_sCAL
-#define PNG_NO_WRITE_sCAL
-#define PNG_NO_READ_sPLT
-#define PNG_NO_WRITE_sPLT
-#define PNG_NO_INFO_IMAGE
-#define PNG_NO_READ_RGB_TO_GRAY
-#define PNG_NO_READ_USER_TRANSFORM
-#define PNG_NO_WRITE_USER_TRANSFORM
-#define PNG_NO_USER_MEM
-#define PNG_NO_READ_EMPTY_PLTE
-#define PNG_NO_MNG_FEATURES
-#define PNG_NO_FIXED_POINT_SUPPORTED
+#  define PNG_NO_FREE_ME
+#  define PNG_NO_READ_UNKNOWN_CHUNKS
+#  define PNG_NO_WRITE_UNKNOWN_CHUNKS
+#  define PNG_NO_READ_USER_CHUNKS
+#  define PNG_NO_READ_iCCP
+#  define PNG_NO_WRITE_iCCP
+#  define PNG_NO_READ_iTXt
+#  define PNG_NO_WRITE_iTXt
+#  define PNG_NO_READ_sCAL
+#  define PNG_NO_WRITE_sCAL
+#  define PNG_NO_READ_sPLT
+#  define PNG_NO_WRITE_sPLT
+#  define PNG_NO_INFO_IMAGE
+#  define PNG_NO_READ_RGB_TO_GRAY
+#  define PNG_NO_READ_USER_TRANSFORM
+#  define PNG_NO_WRITE_USER_TRANSFORM
+#  define PNG_NO_USER_MEM
+#  define PNG_NO_READ_EMPTY_PLTE
+#  define PNG_NO_MNG_FEATURES
+#  define PNG_NO_FIXED_POINT_SUPPORTED
 #endif
 
 /* Ignore attempt to turn off both floating and fixed point support */
 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
- !defined(PNG_NO_FIXED_POINT_SUPPORTED)
-#define PNG_FIXED_POINT_SUPPORTED
+    !defined(PNG_NO_FIXED_POINT_SUPPORTED)
+#  define PNG_FIXED_POINT_SUPPORTED
 #endif
 
 #ifndef PNG_NO_FREE_ME
-#define PNG_FREE_ME_SUPPORTED
+#  define PNG_FREE_ME_SUPPORTED
 #endif
 
 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
     !defined(PNG_NO_READ_TRANSFORMS)
-#define PNG_READ_TRANSFORMS_SUPPORTED
+#  define PNG_READ_TRANSFORMS_SUPPORTED
 #endif
 #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
     !defined(PNG_NO_WRITE_TRANSFORMS)
-#define PNG_WRITE_TRANSFORMS_SUPPORTED
+#  define PNG_WRITE_TRANSFORMS_SUPPORTED
 #endif
 
 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
-#ifndef PNG_NO_READ_EXPAND
-#define PNG_READ_EXPAND_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_SHIFT
-#define PNG_READ_SHIFT_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_PACK
-#define PNG_READ_PACK_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_BGR
-#define PNG_READ_BGR_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_SWAP
-#define PNG_READ_SWAP_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_PACKSWAP
-#define PNG_READ_PACKSWAP_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_INVERT
-#define PNG_READ_INVERT_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_DITHER
-#define PNG_READ_DITHER_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_BACKGROUND
-#define PNG_READ_BACKGROUND_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_16_TO_8
-#define PNG_READ_16_TO_8_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_FILLER
-#define PNG_READ_FILLER_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_GAMMA
-#define PNG_READ_GAMMA_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_GRAY_TO_RGB
-#define PNG_READ_GRAY_TO_RGB_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_SWAP_ALPHA
-#define PNG_READ_SWAP_ALPHA_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_INVERT_ALPHA
-#define PNG_READ_INVERT_ALPHA_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_STRIP_ALPHA
-#define PNG_READ_STRIP_ALPHA_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_USER_TRANSFORM
-#define PNG_READ_USER_TRANSFORM_SUPPORTED
-#endif
-#ifndef PNG_NO_READ_RGB_TO_GRAY
-#define PNG_READ_RGB_TO_GRAY_SUPPORTED
-#endif
+#  ifndef PNG_NO_READ_EXPAND
+#    define PNG_READ_EXPAND_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_SHIFT
+#    define PNG_READ_SHIFT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_PACK
+#    define PNG_READ_PACK_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_BGR
+#    define PNG_READ_BGR_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_SWAP
+#    define PNG_READ_SWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_PACKSWAP
+#    define PNG_READ_PACKSWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_INVERT
+#    define PNG_READ_INVERT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_DITHER
+#    define PNG_READ_DITHER_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_BACKGROUND
+#    define PNG_READ_BACKGROUND_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_16_TO_8
+#    define PNG_READ_16_TO_8_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_FILLER
+#    define PNG_READ_FILLER_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_GAMMA
+#    define PNG_READ_GAMMA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_GRAY_TO_RGB
+#    define PNG_READ_GRAY_TO_RGB_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_SWAP_ALPHA
+#    define PNG_READ_SWAP_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_INVERT_ALPHA
+#    define PNG_READ_INVERT_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_STRIP_ALPHA
+#    define PNG_READ_STRIP_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_USER_TRANSFORM
+#    define PNG_READ_USER_TRANSFORM_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_RGB_TO_GRAY
+#    define PNG_READ_RGB_TO_GRAY_SUPPORTED
+#  endif
 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
 
 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
- !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive   */
-#define PNG_PROGRESSIVE_READ_SUPPORTED       /* reading.  This is not talking */
+ !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
+#  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
 #endif                               /* about interlacing capability!  You'll */
               /* still have interlacing unless you change the following line: */
+
 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
 
 #ifndef PNG_NO_READ_COMPOSITE_NODIV
-#ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
-#define PNG_READ_COMPOSITE_NODIV_SUPPORTED    /* well tested on Intel and SGI */
-#endif
+#  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
+#    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
+#  endif
 #endif
 
+/* Disable if you don't need to support PNGs that are embedded in MNG
+   datastreams */
 #ifndef PNG_NO_MNG_FEATURES
-#define PNG_MNG_FEATURES_SUPPORTED  /* Useful for MNG applications */
+#  define PNG_MNG_FEATURES_SUPPORTED
 #endif
-/* Deprecated, will be removed */
+
+/* Deprecated, will be removed from version 2.0.0 */
 #ifndef PNG_NO_READ_EMPTY_PLTE
-#define PNG_READ_EMPTY_PLTE_SUPPORTED
+#  define PNG_READ_EMPTY_PLTE_SUPPORTED
 #endif
 
 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
-#ifndef PNG_NO_WRITE_SHIFT
-#define PNG_WRITE_SHIFT_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_PACK
-#define PNG_WRITE_PACK_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_BGR
-#define PNG_WRITE_BGR_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_SWAP
-#define PNG_WRITE_SWAP_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_PACKSWAP
-#define PNG_WRITE_PACKSWAP_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_INVERT
-#define PNG_WRITE_INVERT_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_FILLER
-#define PNG_WRITE_FILLER_SUPPORTED  /* This is the same as WRITE_STRIP_ALPHA */
-#endif
-#ifndef PNG_NO_WRITE_SWAP_ALPHA
-#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_INVERT_ALPHA
-#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
-#endif
-#ifndef PNG_NO_WRITE_USER_TRANSFORM
-#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
-#endif
+#  ifndef PNG_NO_WRITE_SHIFT
+#    define PNG_WRITE_SHIFT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_PACK
+#    define PNG_WRITE_PACK_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_BGR
+#    define PNG_WRITE_BGR_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_SWAP
+#    define PNG_WRITE_SWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_PACKSWAP
+#    define PNG_WRITE_PACKSWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_INVERT
+#    define PNG_WRITE_INVERT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_FILLER
+#    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
+#  endif
+#  ifndef PNG_NO_WRITE_SWAP_ALPHA
+#    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_INVERT_ALPHA
+#    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_USER_TRANSFORM
+#    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
+#  endif
 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
 
 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
-defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
-#ifndef PNG_NO_USER_TRANSFORM_PTR
-#define PNG_USER_TRANSFORM_PTR_SUPPORTED
-#endif
+    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#  ifndef PNG_NO_USER_TRANSFORM_PTR
+#    define PNG_USER_TRANSFORM_PTR_SUPPORTED
+#  endif
 #endif
 
 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
@@ -545,20 +550,20 @@
 
 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
      defined(PNG_FLOATING_POINT_SUPPORTED)
-#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+#  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
 #endif
 
 #ifndef PNG_NO_WRITE_FLUSH
-#define PNG_WRITE_FLUSH_SUPPORTED
+#  define PNG_WRITE_FLUSH_SUPPORTED
 #endif
 
 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
 #ifndef PNG_NO_WRITE_EMPTY_PLTE
-#define PNG_WRITE_EMPTY_PLTE_SUPPORTED
+#  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
 #endif
 
 #ifndef PNG_NO_STDIO
-#define PNG_TIME_RFC1123_SUPPORTED
+#  define PNG_TIME_RFC1123_SUPPORTED
 #endif
 
 /* This adds extra functions in pngget.c for accessing data from the
@@ -578,12 +583,16 @@
  * png_get_y_offset_microns()
  */
 #ifndef PNG_NO_EASY_ACCESS
-#define PNG_EASY_ACCESS_SUPPORTED
+#  define PNG_EASY_ACCESS_SUPPORTED
 #endif
 
-#if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD) && \
-  !defined(PNG_NO_ASSEMBLER_CODE)
-#define PNG_ASSEMBLER_CODE_SUPPORTED
+/* PNG_ASSEMBLER_CODE will be enabled by default in version 1.2.0 
+   even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
+#ifndef PNG_NO_ASSEMBLER_CODE
+#  if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD)
+#    define PNG_ASSEMBLER_CODE_SUPPORTED
+#    define PNG_MMX_CODE_SUPPORTED
+#  endif
 #endif
 
 /* These are currently experimental features, define them if you want */
@@ -592,10 +601,10 @@
 /*
 #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
 #ifndef PNG_NO_USER_MEM
-#define PNG_USER_MEM_SUPPORTED
+#  define PNG_USER_MEM_SUPPORTED
 #endif
 #ifndef PNG_NO_ZALLOC_ZERO
-#define PNG_ZALLOC_ZERO
+#  define PNG_ZALLOC_ZERO
 #endif
 */
 
@@ -624,11 +633,11 @@
 
 #if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
-#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
+#  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
 #endif
 #if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
-#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
+#  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
 #endif
 
 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
@@ -730,13 +739,15 @@
 #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
 #endif                      /* optional PLTE chunk in RGB and RGBA images */
 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
-  defined(PNG_READ_zTXt_SUPPORTED)
+    defined(PNG_READ_zTXt_SUPPORTED)
 #  define PNG_READ_TEXT_SUPPORTED
 #  define PNG_TEXT_SUPPORTED
 #endif
+
 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
 
 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
+
 #ifdef PNG_NO_WRITE_TEXT
 #  define PNG_NO_WRITE_iTXt
 #  define PNG_NO_WRITE_tEXt
@@ -856,12 +867,13 @@
 #  endif
 #endif
 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
-  defined(PNG_WRITE_zTXt_SUPPORTED)
+    defined(PNG_WRITE_zTXt_SUPPORTED)
 #  define PNG_WRITE_TEXT_SUPPORTED
 #  ifndef PNG_TEXT_SUPPORTED
 #    define PNG_TEXT_SUPPORTED
 #  endif
 #endif
+
 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
 
 /* Turn this off to disable png_read_png() and
@@ -911,28 +923,26 @@
 /* Separate compiler dependencies (problem here is that zlib.h always
    defines FAR. (SJT) */
 #ifdef __BORLANDC__
-#if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
-#define LDATA 1
-#else
-#define LDATA 0
-#endif
-
-#if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
-#define PNG_MAX_MALLOC_64K
-#if (LDATA != 1)
-#ifndef FAR
-#define FAR __far
-#endif
-#define USE_FAR_KEYWORD
-#endif   /* LDATA != 1 */
-
-/* Possibly useful for moving data out of default segment.
- * Uncomment it if you want. Could also define FARDATA as
- * const if your compiler supports it. (SJT)
-#  define FARDATA FAR
- */
-#endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
-
+#  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
+#    define LDATA 1
+#  else
+#    define LDATA 0
+#  endif
+   /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
+#  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
+#    define PNG_MAX_MALLOC_64K
+#    if (LDATA != 1)
+#      ifndef FAR
+#        define FAR __far
+#      endif
+#      define USE_FAR_KEYWORD
+#    endif   /* LDATA != 1 */
+     /* Possibly useful for moving data out of default segment.
+      * Uncomment it if you want. Could also define FARDATA as
+      * const if your compiler supports it. (SJT)
+#    define FARDATA FAR
+      */
+#  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
 #endif   /* __BORLANDC__ */
 
 
@@ -944,20 +954,20 @@
 /* MSC Medium model */
 #if defined(FAR)
 #  if defined(M_I86MM)
-#     define USE_FAR_KEYWORD
-#     define FARDATA FAR
-#     include <dos.h>
+#    define USE_FAR_KEYWORD
+#    define FARDATA FAR
+#    include <dos.h>
 #  endif
 #endif
 
 /* SJT: default case */
 #ifndef FAR
-#   define FAR
+#  define FAR
 #endif
 
 /* At this point FAR is always defined */
 #ifndef FARDATA
-#define FARDATA
+#  define FARDATA
 #endif
 
 /* Typedef for floating-point numbers that are converted
@@ -974,11 +984,15 @@
 typedef PNG_CONST char  FAR * png_const_charp;
 typedef char            FAR * png_charp;
 typedef png_fixed_point FAR * png_fixed_point_p;
+
+#ifndef PNG_NO_STDIO
 #if defined(_WIN32_WCE)
 typedef HANDLE                png_FILE_p;
 #else
 typedef FILE                * png_FILE_p;
 #endif
+#endif
+
 #ifdef PNG_FLOATING_POINT_SUPPORTED
 typedef double          FAR * png_doublep;
 #endif
@@ -996,7 +1010,7 @@
 typedef double          FAR * FAR * png_doublepp;
 #endif
 
-/* Pointers to pointers to pointers; i.e. pointer to array */
+/* Pointers to pointers to pointers; i.e., pointer to array */
 typedef char            FAR * FAR * FAR * png_charppp;
 
 /* libpng typedefs for types in zlib. If zlib changes
@@ -1015,11 +1029,11 @@
  * It is equivalent to Microsoft predefined macro _DLL which is
  * automatically defined when you compile using the share
  * version of the CRT (C Run-Time library)
- * 
- * The cygwin mods make this behavior a little different: 
+ *
+ * The cygwin mods make this behavior a little different:
  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
  * Define PNG_STATIC if you are building a static library for use with cygwin,
- *   -or- if you are building an application that you want to link to the 
+ *   -or- if you are building an application that you want to link to the
  *   static library.
  * PNG_USE_DLL is defined by default (no user action needed) unless one of
  *   the other flags is defined.
@@ -1051,7 +1065,7 @@
 #    define PNG_USE_LOCAL_ARRAYS
 #  endif
 #endif
-    
+
 /* Do not use global arrays (helps with building DLL's)
  * They are no longer used in libpng itself, since version 1.0.5c,
  * but might be required for some pre-1.0.5c applications.
@@ -1064,15 +1078,15 @@
 #  endif
 #endif
 
-#ifndef PNGAPI
 
+#ifndef PNGAPI
 
 #if defined(__MINGW32__) || defined(__CYGWIN__) && !defined(PNG_MODULEDEF)
 #  ifndef PNG_NO_MODULEDEF
 #    define PNG_NO_MODULEDEF
 #  endif
-#endif 
- 
+#endif
+
 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
 #  define PNG_IMPEXP
 #endif
@@ -1082,7 +1096,7 @@
        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
 	  ) && !defined(__CYGWIN__))
 
-#  ifdef __GNUC__
+#  if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
 #    define PNGAPI __cdecl
 #  else
 #    define PNGAPI _cdecl
@@ -1150,9 +1164,9 @@
 #endif
 
 #ifdef PNG_USE_GLOBAL_ARRAYS
-#ifndef PNG_EXPORT_VAR
-#  define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
-#endif
+#  ifndef PNG_EXPORT_VAR
+#    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
+#  endif
 #endif
 
 /* User may want to use these so they are not in PNG_INTERNAL. Any library
@@ -1160,35 +1174,35 @@
  */
 
 #ifndef PNG_ABORT
-#   define PNG_ABORT() abort()
+#  define PNG_ABORT() abort()
 #endif
 
 #ifdef PNG_SETJMP_SUPPORTED
-#   define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
+#  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
 #else
-#   define png_jmpbuf(png_ptr) \
-    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
+#  define png_jmpbuf(png_ptr) \
+   (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
 #endif
 
 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
 /* use this to make far-to-near assignments */
-#   define CHECK   1
-#   define NOCHECK 0
-#   define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
-#   define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
-#   define png_strcpy _fstrcpy
-#   define png_strlen _fstrlen
-#   define png_memcmp _fmemcmp      /* SJT: added */
-#   define png_memcpy _fmemcpy
-#   define png_memset _fmemset
+#  define CHECK   1
+#  define NOCHECK 0
+#  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
+#  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
+#  define png_strcpy _fstrcpy
+#  define png_strlen _fstrlen
+#  define png_memcmp _fmemcmp      /* SJT: added */
+#  define png_memcpy _fmemcpy
+#  define png_memset _fmemset
 #else /* use the usual functions */
-#   define CVT_PTR(ptr)         (ptr)
-#   define CVT_PTR_NOCHECK(ptr) (ptr)
-#   define png_strcpy strcpy
-#   define png_strlen strlen
-#   define png_memcmp memcmp     /* SJT: added */
-#   define png_memcpy memcpy
-#   define png_memset memset
+#  define CVT_PTR(ptr)         (ptr)
+#  define CVT_PTR_NOCHECK(ptr) (ptr)
+#  define png_strcpy strcpy
+#  define png_strlen strlen
+#  define png_memcmp memcmp     /* SJT: added */
+#  define png_memcpy memcpy
+#  define png_memset memset
 #endif
 /* End of memory model independent support */
 
@@ -1196,9 +1210,48 @@
  * contradictory.
  */
 #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
-#undef PNG_ZBUF_SIZE
-#define PNG_ZBUF_SIZE 65536
+#  undef PNG_ZBUF_SIZE
+#  define PNG_ZBUF_SIZE 65536
 #endif
 
+/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
+#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_INTERNAL)
+
+/* These are the default thresholds before the MMX code kicks in; if either
+ * rowbytes or bitdepth is below the threshold, plain C code is used.  These
+ * can be overridden at runtime via the png_set_mmx_thresholds() call in
+ * libpng 1.2.0 and later.  The values below were chosen by Intel.
+ */
+
+#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
+#  define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT  128  /*  >=  */
+#endif
+#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
+#  define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT  9    /*  >=  */   
+#endif
+
+/* Set this in the makefile for VC++ on Pentium, not here. */
+/* Platform must be Pentium.  Makefile must assemble and load pngvcrd.c .
+ * MMX will be detected at run time and used if present.
+ */
+#ifdef PNG_USE_PNGVCRD
+#  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
+#  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
+#  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
+#endif
+
+/* Set this in the makefile for gcc/as on Pentium, not here. */
+/* Platform must be Pentium.  Makefile must assemble and load pnggccrd.c .
+ * MMX will be detected at run time and used if present.
+ */
+#ifdef PNG_USE_PNGGCCRD
+#  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
+#  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
+#  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
+#endif
+/* - see pnggccrd.c for info about what is currently enabled */
+
+#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
+
 #endif /* PNGCONF_H */
 
diff --git a/pngerror.c b/pngerror.c
index d8a5a37..dbccc1f 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,9 +1,9 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
@@ -99,7 +99,7 @@
 void PNGAPI
 png_chunk_error(png_structp png_ptr, png_const_charp message)
 {
-   char msg[16+64];
+   char msg[18+64];
    png_format_buffer(png_ptr, msg, message);
    png_error(png_ptr, msg);
 }
diff --git a/pnggccrd.c b/pnggccrd.c
index 513de9a..8877d5b 100644
--- a/pnggccrd.c
+++ b/pnggccrd.c
@@ -6,14 +6,14 @@
  *     and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
  *     for Intel's performance analysis of the MMX vs. non-MMX code.
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
  *
  * Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998.
  * Interface to libpng contributed by Gilles Vollant, 1999.
- * GNU C port by Greg Roelofs, 1999-2000.
+ * GNU C port by Greg Roelofs, 1999-2001.
  *
  * Lines 2350-4300 converted in place with intel2gas 1.3.1:
  *
@@ -198,11 +198,20 @@
  *     correctly (but 48-bit RGB just fine)
  *
  * 20000916:
- *  - fixed bug in png_read_filter_row_mmx_avg(), bpp == 2 case; three errors:  
+ *  - fixed bug in png_read_filter_row_mmx_avg(), bpp == 2 case; three errors:
  *     - "_ShiftBpp.use = 24;"      should have been   "_ShiftBpp.use = 16;"
  *     - "_ShiftRem.use = 40;"      should have been   "_ShiftRem.use = 48;"
  *     - "psllq _ShiftRem, %%mm2"   should have been   "psrlq _ShiftRem, %%mm2"
  *
+ * 20010103:
+ *  - renamed mmxsupport() to png_mmx_support(), with auto-set of mmx_supported,
+ *     and made it public
+ *
+ * 20010104:
+ *  - removed dependency on png_read_filter_row_c() (C code already duplicated
+ *     within MMX version of png_read_filter_row()) so no longer necessary to
+ *     compile it into pngrutil.o
+ *
  * STILL TO DO:
  *     - test png_do_read_interlace() 64-bit case (pixel_bytes == 8)
  *     - write MMX code for 48-bit case (pixel_bytes == 6)
@@ -211,7 +220,7 @@
  *        (only width_mmx case) (near line 1606)
  *     - rewrite all MMX interlacing code so it's aligned with beginning
  *        of the row buffer, not the end (see 19991007 for details)
- *     - pick one version of mmxsupport() and get rid of the other
+ *     x pick one version of mmxsupport() and get rid of the other
  *     - add error messages to any remaining bogus default cases
  *     - enable pixel_depth == 8 cases in png_read_filter_row()? (test speed)
  *     - add support for runtime enable/disable/query of various MMX routines
@@ -224,10 +233,6 @@
 
 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD)
 
-int mmxsupport(void);
-
-static int mmx_supported = 2;
-
 #ifdef PNG_USE_LOCAL_ARRAYS
 static const int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
 static const int FARDATA png_pass_inc[7]   = {8, 8, 4, 4, 2, 2, 1};
@@ -237,25 +242,26 @@
 // djgpp, Win32, and Cygwin add their own underscores to global variables,
 // so define them without:
 #if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__)
+#  define _mmx_supported  mmx_supported
 #  define _unmask         unmask
 #  define _const4         const4
 #  define _const6         const6
-#  define _mask8_0        mask8_0  
-#  define _mask16_1       mask16_1 
-#  define _mask16_0       mask16_0 
-#  define _mask24_2       mask24_2 
-#  define _mask24_1       mask24_1 
-#  define _mask24_0       mask24_0 
-#  define _mask32_3       mask32_3 
-#  define _mask32_2       mask32_2 
-#  define _mask32_1       mask32_1 
-#  define _mask32_0       mask32_0 
-#  define _mask48_5       mask48_5 
-#  define _mask48_4       mask48_4 
-#  define _mask48_3       mask48_3 
-#  define _mask48_2       mask48_2 
-#  define _mask48_1       mask48_1 
-#  define _mask48_0       mask48_0 
+#  define _mask8_0        mask8_0
+#  define _mask16_1       mask16_1
+#  define _mask16_0       mask16_0
+#  define _mask24_2       mask24_2
+#  define _mask24_1       mask24_1
+#  define _mask24_0       mask24_0
+#  define _mask32_3       mask32_3
+#  define _mask32_2       mask32_2
+#  define _mask32_1       mask32_1
+#  define _mask32_0       mask32_0
+#  define _mask48_5       mask48_5
+#  define _mask48_4       mask48_4
+#  define _mask48_3       mask48_3
+#  define _mask48_2       mask48_2
+#  define _mask48_1       mask48_1
+#  define _mask48_0       mask48_0
 #  define _FullLength     FullLength
 #  define _MMXLength      MMXLength
 #  define _dif            dif
@@ -271,6 +277,8 @@
 #  define _pctemp         pctemp
 #endif
 
+static int _mmx_supported = 2;
+
 /* These constants are used in the inlined MMX assembly code.
    Ignore gcc's "At top level: defined but not used" warnings. */
 
@@ -318,11 +326,6 @@
 static int          _pctemp;
 
 
-void /* PRIVATE */
-png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info,
-   png_bytep row, png_bytep prev_row, int filter);
-
-
 
 
 //===========================================================================//
@@ -352,16 +355,16 @@
 {
    png_debug(1,"in png_combine_row_asm\n");
 
-   if (mmx_supported == 2)
-       mmx_supported = mmxsupport();
+   if (_mmx_supported == 2) {
+       png_mmx_support();
+   }
 
    if (mask == 0xff)
    {
       png_memcpy(row, png_ptr->row_buf + 1,
        (png_size_t)((png_ptr->width * png_ptr->row_info.pixel_depth + 7) >> 3));
    }
-   /* GRR:  add "else if (mask == 0)" case?
-    *       or does png_combine_row() not even get called in that case? */
+   /* GRR:  png_combine_row() never called with mask == 0 */
    else
    {
       switch (png_ptr->row_info.pixel_depth)
@@ -537,7 +540,7 @@
             png_bytep srcptr;
             png_bytep dstptr;
 
-            if (mmx_supported)
+            if ( _mmx_supported  )
             {
                png_uint_32 len;
                int diff;
@@ -642,7 +645,7 @@
                   png_memcpy(dstptr, srcptr, rep_bytes);
                   srcptr += stride;
                   dstptr += stride;
-               } 
+               }
             } /* end of else */
 
             break;
@@ -653,7 +656,7 @@
             png_bytep srcptr;
             png_bytep dstptr;
 
-            if (mmx_supported)
+            if ( _mmx_supported )
             {
                png_uint_32 len;
                int diff;
@@ -774,7 +777,7 @@
                   png_memcpy(dstptr, srcptr, rep_bytes);
                   srcptr += stride;
                   dstptr += stride;
-               } 
+               }
             } /* end of else */
 
             break;
@@ -785,7 +788,7 @@
             png_bytep srcptr;
             png_bytep dstptr;
 
-            if (mmx_supported)
+            if ( _mmx_supported )
             {
                png_uint_32 len;
                int diff;
@@ -921,7 +924,7 @@
                   png_memcpy(dstptr, srcptr, rep_bytes);
                   srcptr += stride;
                   dstptr += stride;
-               } 
+               }
             } /* end of else */
 
             break;
@@ -932,7 +935,7 @@
             png_bytep srcptr;
             png_bytep dstptr;
 
-            if (mmx_supported)
+            if ( _mmx_supported )
             {
                png_uint_32 len;
                int diff;
@@ -1086,7 +1089,7 @@
             png_bytep srcptr;
             png_bytep dstptr;
 
-            if (mmx_supported)
+            if ( _mmx_supported )
             {
                png_uint_32 len;
                int diff;
@@ -1246,7 +1249,7 @@
                   png_memcpy(dstptr, srcptr, rep_bytes);
                   srcptr += stride;
                   dstptr += stride;
-               } 
+               }
             } /* end of else */
 
             break;
@@ -1273,7 +1276,7 @@
                png_memcpy(dstptr, srcptr, rep_bytes);
                srcptr += stride;
                dstptr += stride;
-            } 
+            }
             break;
          }       // end 64 bpp
 
@@ -1311,13 +1314,18 @@
  */
 
 void /* PRIVATE */
-png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
-   png_uint_32 transformations)
+png_do_read_interlace(png_structp png_ptr)
 {
+   png_row_infop row_info = &(png_ptr->row_info);
+   png_bytep row = png_ptr->row_buf + 1;
+   int pass = png_ptr->pass;
+   png_uint_32 transformations = png_ptr->transformations;
+
    png_debug(1,"in png_do_read_interlace\n");
 
-   if (mmx_supported == 2)
-       mmx_supported = mmxsupport();
+   if (_mmx_supported == 2) {
+       png_mmx_support();
+   }
 
    if (row != NULL && row_info != NULL)
    {
@@ -1520,7 +1528,7 @@
 
             // New code by Nirav Chhatrapati - Intel Corporation
 
-            if (mmx_supported)  // use MMX code if machine supports it
+            if ( _mmx_supported )
             {
                //--------------------------------------------------------------
                if (pixel_bytes == 3)
@@ -2095,7 +2103,7 @@
                            : "=c" (dummy_value_c),        // output regs (dummy)
                              "=S" (dummy_value_S),
                              "=D" (dummy_value_D)
- 
+
                            : "1" (sptr),      // esi      // input regs
                              "2" (dp),        // edi
                              "0" (width_mmx)  // ecx
@@ -2153,7 +2161,7 @@
                            : "=c" (dummy_value_c),        // output regs (dummy)
                              "=S" (dummy_value_S),
                              "=D" (dummy_value_D)
- 
+
                            : "1" (sptr),      // esi      // input regs
                              "2" (dp),        // edi
                              "0" (width_mmx)  // ecx
@@ -2398,7 +2406,7 @@
                      sptr-= pixel_bytes;
                   }
                }
-            } // end of mmx_supported =========================================
+            } // end of _mmx_supported ========================================
 
             else /* MMX not supported:  use modified C code - takes advantage
                   *   of inlining of memcpy for a constant */
@@ -4749,43 +4757,32 @@
    row, png_bytep prev_row, int filter)
 {
 #ifdef PNG_DEBUG
-   char filnm[6];
+   char filnm[10];
 #endif
 
-#define UseMMX 1
-
+/* 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)
-       mmx_supported = mmxsupport();
-
-   if (!mmx_supported)
-   {
-       png_read_filter_row_c(png_ptr, row_info, row, prev_row, filter);
-       return;
+   if (_mmx_supported == 2) {
+       png_mmx_support();
    }
 
 #ifdef PNG_DEBUG
    png_debug(1, "in png_read_filter_row\n");
-#if (UseMMX == 1)
-   png_debug1(0,"%s, ", "MMX");
-#else
-   png_debug1(0,"%s, ", "x86");
-#endif
    switch (filter)
    {
       case 0: sprintf(filnm, "none");
          break;
-      case 1: sprintf(filnm, "sub");
+      case 1: sprintf(filnm, "sub-%s", "MMX");
          break;
-      case 2: sprintf(filnm, "up");
+      case 2: sprintf(filnm, "up-%s", "MMX");
          break;
-      case 3: sprintf(filnm, "avg");
+      case 3: sprintf(filnm, "avg-%s", "MMX");
          break;
-      case 4: sprintf(filnm, "Paeth");
+      case 4: sprintf(filnm, "Paeth-%s", "MMX");
          break;
       default: sprintf(filnm, "unknw");
          break;
@@ -4795,7 +4792,7 @@
    png_debug2(0, "pixdepth=%2d, bytes=%d, ", (int)row_info->pixel_depth,
       (int)((row_info->pixel_depth + 7) >> 3));
    png_debug1(0,"rowbytes=%8ld\n", row_info->rowbytes);
-#endif
+#endif /* PNG_DEBUG */
 
    switch (filter)
    {
@@ -4803,13 +4800,13 @@
          break;
 
       case PNG_FILTER_VALUE_SUB:
-#if (UseMMX_sub == 1)
-         if ((row_info->pixel_depth > 8) && (row_info->rowbytes >= 128))
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_sub(row_info, row);
          }
          else
-#endif
          {
             png_uint_32 i;
             png_uint_32 istop = row_info->rowbytes;
@@ -4826,33 +4823,35 @@
          break;
 
       case PNG_FILTER_VALUE_UP:
-#if (UseMMX_up == 1)
-         if ((row_info->pixel_depth > 8) && (row_info->rowbytes >= 128))
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_up(row_info, row, prev_row);
          }
          else
-#endif
          {
-            png_bytep rp;
-            png_bytep pp;
             png_uint_32 i;
-            for (i = 0, rp = row, pp = prev_row;
-               i < row_info->rowbytes; i++, rp++, pp++)
+            png_uint_32 istop = row_info->rowbytes;
+            png_bytep rp = row;
+            png_bytep pp = prev_row;
+
+            for (i = 0; i < istop; ++i)
             {
-                  *rp = (png_byte)(((int)(*rp) + (int)(*pp)) & 0xff);
+               *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+               rp++;
             }
          }  //end !UseMMX_up
          break;
 
       case PNG_FILTER_VALUE_AVG:
-#if (UseMMX_avg == 1)
-         if ((row_info->pixel_depth > 8) && (row_info->rowbytes >= 128))
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_avg(row_info, row, prev_row);
          }
          else
-#endif
          {
             png_uint_32 i;
             png_bytep rp = row;
@@ -4878,13 +4877,13 @@
          break;
 
       case PNG_FILTER_VALUE_PAETH:
-#if (UseMMX_paeth == 1)
-         if ((row_info->pixel_depth > 8) && (row_info->rowbytes >= 128))
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_paeth(row_info, row, prev_row);
          }
          else
-#endif
          {
             png_uint_32 i;
             png_bytep rp = row;
@@ -4892,7 +4891,7 @@
             png_bytep lp = row;
             png_bytep cp = prev_row;
             png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3;
-            png_uint_32 istop=row_info->rowbytes - bpp;
+            png_uint_32 istop = row_info->rowbytes - bpp;
 
             for (i = 0; i < bpp; i++)
             {
@@ -4900,7 +4899,7 @@
                rp++;
             }
 
-            for (i = 0; i < istop; i++)   // use leftover rp,pp
+            for (i = 0; i < istop; i++)   /* use leftover rp,pp */
             {
                int a, b, c, pa, pb, pc, p;
 
@@ -4930,7 +4929,7 @@
                      p = c;
                 */
 
-               p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
+               p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c;
 
                *rp = (png_byte)(((int)(*rp) + p) & 0xff);
                rp++;
@@ -4939,7 +4938,7 @@
          break;
 
       default:
-         png_warning(png_ptr, "Ignoring bad adaptive filter type");
+         png_warning(png_ptr, "Ignoring bad row-filter type");
          *row=0;
          break;
    }
@@ -4964,85 +4963,24 @@
 //             [is there a way to signal that a *single* function should
 //              not be inlined?  is there a way to modify the label for
 //              each inlined instance, e.g., by appending _1, _2, etc.?
-//              maybe if don't use leading "." in label name? (not tested)]
+//              maybe if don't use leading "." in label name? (nope...sigh)]
 
-#ifdef ORIG_THAT_USED_TO_CLOBBER_EBX
-
-int mmxsupport(void)
-{
-    int mmx_supported_local = 0;
-
-    __asm__ __volatile__ (
-//      ".byte  0x66          \n\t"  // convert 16-bit pushf to 32-bit pushfd
-//      "pushf                \n\t"  // save Eflag to stack
-        "pushfl               \n\t"  // save Eflag to stack
-        "popl %%eax           \n\t"  // get Eflag from stack into eax
-        "movl %%eax, %%ecx    \n\t"  // make another copy of Eflag in ecx
-        "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
-        "pushl %%eax          \n\t"  // save modified Eflag back to stack
-//      ".byte  0x66          \n\t"  // convert 16-bit popf to 32-bit popfd
-//      "popf                 \n\t"  // restore modified value to Eflag reg
-        "popfl                \n\t"  // restore modified value to Eflag reg
-        "pushfl               \n\t"  // save Eflag to stack
-        "popl %%eax           \n\t"  // get Eflag from stack
-        "xorl %%ecx, %%eax    \n\t"  // compare new Eflag with original Eflag
-        "jz .NOT_SUPPORTED    \n\t"  // if same, CPUID instr. is not supported
-
-        "xorl %%eax, %%eax    \n\t"  // set eax to zero
-//      ".byte  0x0f, 0xa2    \n\t"  // CPUID instruction (two-byte opcode)
-        "cpuid                \n\t"  // get the CPU identification info
-        "cmpl $1, %%eax       \n\t"  // make sure eax return non-zero value
-        "jl .NOT_SUPPORTED    \n\t"  // if eax is zero, MMX is not supported
-
-        "xorl %%eax, %%eax    \n\t"  // set eax to zero and...
-        "incl %%eax           \n\t"  // ...increment eax to 1.  This pair is
-                                     // faster than the instruction "mov eax, 1"
-        "cpuid                \n\t"  // get the CPU identification info again
-        "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
-        "cmpl $0, %%edx       \n\t"  // 0 = MMX not supported
-        "jz .NOT_SUPPORTED    \n\t"  // non-zero = yes, MMX IS supported
-
-        "movl $1, %0          \n\t"  // set return value to 1 and fall through
-
-    ".NOT_SUPPORTED:          \n\t"  // target label for jump instructions
-        "movl %0, %%eax       \n\t"  // move return value to eax
-                                     // DONE
-
-        : "=m" (mmx_supported_local) // %0 (output list:  memory only)
-
-        :                            // any variables used on input (none)
-
-        : "%eax", "%ebx",            // clobber list
-          "%ecx", "%edx"
-//      , "memory"   // if write to a variable gcc thought was in a reg
-//      , "cc"       // "condition codes" (flag bits)
-    );
-
-    //mmx_supported_local=0; // test code for force don't support MMX
-    //printf("MMX : %u (1=MMX supported)\n",mmx_supported_local);
-
-    return mmx_supported_local;
-}
-
-
-#else /* !ORIG_THAT_USED_TO_CLOBBER_EBX */
-
-
-int mmxsupport(void)
+int PNGAPI
+png_mmx_support(void)
 {
     __asm__ __volatile__ (
         "pushl %%ebx          \n\t"  // ebx gets clobbered by CPUID instruction
         "pushl %%ecx          \n\t"  // so does ecx...
         "pushl %%edx          \n\t"  // ...and edx (but ecx & edx safe on Linux)
 //      ".byte  0x66          \n\t"  // convert 16-bit pushf to 32-bit pushfd
-//      "pushf                \n\t"  // save Eflag to stack
+//      "pushf                \n\t"  // 16-bit pushf
         "pushfl               \n\t"  // save Eflag to stack
         "popl %%eax           \n\t"  // get Eflag from stack into eax
         "movl %%eax, %%ecx    \n\t"  // make another copy of Eflag in ecx
         "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
         "pushl %%eax          \n\t"  // save modified Eflag back to stack
 //      ".byte  0x66          \n\t"  // convert 16-bit popf to 32-bit popfd
-//      "popf                 \n\t"  // restore modified value to Eflag reg
+//      "popf                 \n\t"  // 16-bit popf
         "popfl                \n\t"  // restore modified value to Eflag reg
         "pushfl               \n\t"  // save Eflag to stack
         "popl %%eax           \n\t"  // get Eflag from stack
@@ -5064,6 +5002,7 @@
         "jz .NOT_SUPPORTED    \n\t"  // non-zero = yes, MMX IS supported
 
         "movl $1, %%eax       \n\t"  // set return value to 1
+        "movl %%eax, _mmx_supported \n\t" // save in global static variable, too
         "popl %%edx           \n\t"  // restore edx
         "popl %%ecx           \n\t"  // restore ecx
         "popl %%ebx           \n\t"  // restore ebx ("row" in png_do_interlace)
@@ -5071,13 +5010,14 @@
 
     ".NOT_SUPPORTED:          \n\t"  // target label for jump instructions
         "movl $0, %%eax       \n\t"  // set return value to 0
+        "movl %%eax, _mmx_supported \n\t" // save in global static variable, too
         "popl %%edx           \n\t"  // restore edx
         "popl %%ecx           \n\t"  // restore ecx
         "popl %%ebx           \n\t"  // restore ebx ("row" in png_do_interlace)
 //      "ret                  \n\t"  // DONE:  no MMX support
                                      // (fall through to standard C "ret")
 
-        : // "=m" (mmx_supported_local) // %0 (output list:  memory only)
+        :                            // output list (none)
 
         :                            // any variables used on input (none)
 
@@ -5087,12 +5027,7 @@
 //      , "cc"       // "condition codes" (flag bits)
     );
 
-    //mmx_supported_local=0; // test code for force don't support MMX
-    //printf("MMX : %u (1=MMX supported)\n",mmx_supported_local);
-
-    //return mmx_supported_local;
+    // return %%eax;
 }
 
-#endif /* ?ORIG_THAT_USED_TO_CLOBBER_EBX */
-
 #endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGGCCRD */
diff --git a/pngget.c b/pngget.c
index b5bd846..cbb2ef5 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,9 +1,9 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  */
@@ -807,7 +807,7 @@
 png_byte PNGAPI
 png_get_rgb_to_gray_status (png_structp png_ptr)
 {
-   return png_ptr->rgb_to_gray_status;
+   return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
 }
 #endif
 
@@ -815,7 +815,7 @@
 png_voidp PNGAPI
 png_get_user_chunk_ptr(png_structp png_ptr)
 {
-   return (png_ptr->user_chunk_ptr);
+   return (png_ptr? png_ptr->user_chunk_ptr : NULL);
 }
 #endif
 
@@ -823,5 +823,6 @@
 png_uint_32 PNGAPI
 png_get_compression_buffer_size(png_structp png_ptr)
 {
-   return(png_ptr->zbuf_size);
+   return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
 }
+
diff --git a/pngmem.c b/pngmem.c
index 1d34c9d..37e4caf 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,9 +1,9 @@
 
 /* pngmem.c - stub functions for memory allocation
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
diff --git a/pngpread.c b/pngpread.c
index 0f3ba76..d019ac4 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,9 +1,9 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  */
@@ -772,18 +772,29 @@
    if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
    {
       if (png_ptr->pass < 6)
+/*       old interface (pre-1.0.9):
          png_do_read_interlace(&(png_ptr->row_info),
             png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
+ */
+         png_do_read_interlace(png_ptr);
 
-      switch (png_ptr->pass)
-      {
+    switch (png_ptr->pass)
+    {
          case 0:
          {
             int i;
             for (i = 0; i < 8 && png_ptr->pass == 0; i++)
             {
                png_push_have_row(png_ptr, png_ptr->row_buf + 1);
-               png_read_push_finish_row(png_ptr);
+               png_read_push_finish_row(png_ptr); /* updates png_ptr->pass */
+            }
+            if (png_ptr->pass == 2) /* pass 1 might be empty */
+            {
+               for (i = 0; i < 4 && png_ptr->pass == 2; i++)
+               {
+                  png_push_have_row(png_ptr, NULL);
+                  png_read_push_finish_row(png_ptr);
+               }
             }
             break;
          }
@@ -795,7 +806,7 @@
                png_push_have_row(png_ptr, png_ptr->row_buf + 1);
                png_read_push_finish_row(png_ptr);
             }
-            if (png_ptr->pass == 2)
+            if (png_ptr->pass == 2) /* skip top 4 generated rows */
             {
                for (i = 0; i < 4 && png_ptr->pass == 2; i++)
                {
@@ -818,6 +829,14 @@
                png_push_have_row(png_ptr, NULL);
                png_read_push_finish_row(png_ptr);
             }
+            if (png_ptr->pass == 4) /* pass 3 might be empty */
+            {
+               for (i = 0; i < 2 && png_ptr->pass == 4; i++)
+               {
+                  png_push_have_row(png_ptr, NULL);
+                  png_read_push_finish_row(png_ptr);
+               }
+            }
             break;
          }
          case 3:
@@ -828,7 +847,7 @@
                png_push_have_row(png_ptr, png_ptr->row_buf + 1);
                png_read_push_finish_row(png_ptr);
             }
-            if (png_ptr->pass == 4)
+            if (png_ptr->pass == 4) /* skip top two generated rows */
             {
                for (i = 0; i < 2 && png_ptr->pass == 4; i++)
                {
@@ -851,6 +870,11 @@
                png_push_have_row(png_ptr, NULL);
                png_read_push_finish_row(png_ptr);
             }
+            if (png_ptr->pass == 6) /* pass 5 might be empty */
+            {
+               png_push_have_row(png_ptr, NULL);
+               png_read_push_finish_row(png_ptr);
+            }
             break;
          }
          case 5:
@@ -861,7 +885,7 @@
                png_push_have_row(png_ptr, png_ptr->row_buf + 1);
                png_read_push_finish_row(png_ptr);
             }
-            if (png_ptr->pass == 6)
+            if (png_ptr->pass == 6) /* skip top generated row */
             {
                png_push_have_row(png_ptr, NULL);
                png_read_push_finish_row(png_ptr);
@@ -928,6 +952,11 @@
       do
       {
          png_ptr->pass++;
+         if ((png_ptr->pass == 1 && png_ptr->width < 5) ||
+             (png_ptr->pass == 3 && png_ptr->width < 3) ||
+             (png_ptr->pass == 5 && png_ptr->width < 2))
+           png_ptr->pass++;
+
          if (png_ptr->pass >= 7)
             break;
 
diff --git a/pngread.c b/pngread.c
index 7a849bc..9f9ec23 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,9 +1,9 @@
 
 /* pngread.c - read a PNG file
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
@@ -103,7 +103,7 @@
         removed from version 2.0.0 and beyond because the previous test
         would have already rejected it. */
 
-     if (user_png_ver[4] == '6' && user_png_ver[2] == '0' && 
+     if (user_png_ver[4] == '6' && user_png_ver[2] == '0' &&
          user_png_ver[0] == '1' && user_png_ver[5] == '\0')
      {
         png_error(png_ptr,
@@ -246,6 +246,8 @@
          else
             png_error(png_ptr, "PNG file corrupted by ASCII conversion");
       }
+      if (num_checked < 3)
+         png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
    }
 
    for(;;)
@@ -646,6 +648,15 @@
 
    png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf,
       png_ptr->rowbytes + 1);
+   
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+   if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
+      (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
+   {
+      /* Intrapixel differencing */
+      png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
+   }
+#endif
 
    if (png_ptr->transformations)
       png_do_read_transformations(png_ptr);
@@ -656,8 +667,11 @@
       (png_ptr->transformations & PNG_INTERLACE))
    {
       if (png_ptr->pass < 6)
+/*       old interface (pre-1.0.9):
          png_do_read_interlace(&(png_ptr->row_info),
             png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
+ */
+         png_do_read_interlace(png_ptr);
 
       if (dsp_row != NULL)
          png_combine_row(png_ptr, dsp_row,
@@ -701,7 +715,7 @@
  * not called png_set_interlace_handling(), the display_row buffer will
  * be ignored, so pass NULL to it.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9beta1
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9beta10
  */
 
 void PNGAPI
@@ -750,7 +764,7 @@
  * only call this function once.  If you desire to have an image for
  * each pass of a interlaced image, use png_read_rows() instead.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9beta1
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9beta10
  */
 void PNGAPI
 png_read_image(png_structp png_ptr, png_bytepp image)
diff --git a/pngrio.c b/pngrio.c
index 2571b00..42c504f 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,9 +1,9 @@
 
 /* pngrio.c - functions for data input
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
diff --git a/pngrtran.c b/pngrtran.c
index a7da0c1..81251b4 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,9 +1,9 @@
 
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
@@ -4053,3 +4053,63 @@
 /* To do: install integer version of png_build_gamma_table here */
 #endif
 
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+/* undoes intrapixel differencing  */
+void /* PRIVATE */
+png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
+{
+   png_debug(1, "in png_do_read_intrapixel\n");
+   if (
+#if defined(PNG_USELESS_TESTS_SUPPORTED)
+       row != NULL && row_info != NULL &&
+#endif
+       (row_info->color_type & PNG_COLOR_MASK_COLOR))
+   {
+      int bytes_per_pixel;
+      png_uint_32 row_width = row_info->width;
+      if (row_info->bit_depth == 8)
+      {
+         png_bytep rp;
+         png_uint_32 i;
+
+         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+            bytes_per_pixel = 3;
+         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+            bytes_per_pixel = 4;
+         else
+            return;
+
+         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+         {
+            *(rp) = (png_byte)((256 + *rp + *(rp+1))&0xff);
+            *(rp+2) = (png_byte)((256 + *(rp+2) + *(rp+1))&0xff);
+         }
+      }
+      else if (row_info->bit_depth == 16)
+      {
+         png_bytep rp;
+         png_uint_32 i;
+
+         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+            bytes_per_pixel = 6;
+         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+            bytes_per_pixel = 8;
+         else
+            return;
+
+         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+         {
+            png_uint_32 s0=*(rp  )<<8 | *(rp+1);
+            png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
+            png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
+            png_uint_32 red=(65536+s0+s1)&0xffff;
+            png_uint_32 blue=(65536+s2+s1)&0xffff;
+            *(rp  ) = (png_byte)((red>>8)&0xff);
+            *(rp+1) = (png_byte)(red&0xff);
+            *(rp+4) = (png_byte)((blue>>8)&0xff);
+            *(rp+5) = (png_byte)(blue&0xff);
+         }
+      }
+   }
+}
+#endif /* PNG_MNG_FEATURES_SUPPORTED */
diff --git a/pngrutil.c b/pngrutil.c
index 4912716..c7fde02 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,9 +1,9 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
@@ -174,7 +174,7 @@
    png_charp text = NULL;
    png_size_t text_size;
 
-   if (comp_type == PNG_TEXT_COMPRESSION_zTXt)
+   if (comp_type == PNG_COMPRESSION_TYPE_BASE)
    {
       int ret = Z_OK;
       png_ptr->zstream.next_in = (png_bytep)(chunkdata + prefix_size);
@@ -266,6 +266,13 @@
          png_warning(png_ptr,
             "Incomplete compressed datastream in chunk other than IDAT");
 #endif
+         text_size=prefix_size;
+         if (text ==  NULL)
+         {
+            text = (png_charp)png_malloc(png_ptr, text_size+1);
+            png_memcpy(text, chunkdata, prefix_size);
+         }
+         *(text + text_size) = 0x00;
       }
 
       inflateReset(&png_ptr->zstream);
@@ -275,7 +282,7 @@
       chunkdata = text;
       *newlength=text_size;
    }
-   else /* if (comp_type != PNG_TEXT_COMPRESSION_zTXt) */
+   else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
    {
 #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
       char umsg[50];
@@ -286,10 +293,8 @@
       png_warning(png_ptr, "Unknown zTXt compression type");
 #endif
 
-      /* Copy what we can of the error message into the text chunk */
-      text_size = (png_size_t)(chunklength - (text - chunkdata));
-      text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
-      png_memcpy(text, msg, text_size);
+      *(chunkdata + prefix_size) = 0x00;
+      *newlength=prefix_size;
    }
 
    return chunkdata;
@@ -353,8 +358,33 @@
    if (compression_type != PNG_COMPRESSION_TYPE_BASE)
       png_error(png_ptr, "Unknown compression method in IHDR");
 
-   if (filter_type != PNG_FILTER_TYPE_BASE)
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+   /* Accept filter_method 64 (intrapixel differencing) only if
+    * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
+    * 2. Libpng did not read a PNG signature (this filter_method is only
+    *    used in PNG datastreams that are embedded in MNG datastreams) and
+    * 3. The application called png_permit_mng_features with a mask that
+    *    included PNG_FLAG_MNG_FILTER_64 and
+    * 4. The filter_method is 64 and
+    * 5. The color_type is RGB or RGBA
+    */
+   if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&png_ptr->mng_features_permitted)
+      png_warning(png_ptr,"MNG features are not allowed in a PNG datastream\n");
+   if(filter_type != PNG_FILTER_TYPE_BASE)
+   {
+     if(!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
+        (filter_type == PNG_INTRAPIXEL_DIFFERENCING) &&
+        ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
+        (color_type == PNG_COLOR_TYPE_RGB || 
+         color_type == PNG_COLOR_TYPE_RGB_ALPHA)))
+        png_error(png_ptr, "Unknown filter method in IHDR");
+     if(png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)
+        png_warning(png_ptr, "Invalid filter method in IHDR");
+   }
+#else
+   if(filter_type != PNG_FILTER_TYPE_BASE)
       png_error(png_ptr, "Unknown filter method in IHDR");
+#endif
 
    /* set internal variables */
    png_ptr->width = width;
@@ -362,6 +392,7 @@
    png_ptr->bit_depth = (png_byte)bit_depth;
    png_ptr->interlaced = (png_byte)interlace_type;
    png_ptr->color_type = (png_byte)color_type;
+   png_ptr->filter_type = (png_byte)filter_type;
 
    /* find number of channels */
    switch (png_ptr->color_type)
@@ -397,7 +428,7 @@
 void /* PRIVATE */
 png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
 {
-   png_colorp palette;
+   png_color palette[PNG_MAX_PALETTE_LENGTH];
    int num, i;
 #ifndef PNG_NO_POINTER_INDEXING
    png_colorp pal_ptr;
@@ -426,7 +457,7 @@
    }
 #endif
 
-   if (length > 768 || length % 3)
+   if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3)
    {
       if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
       {
@@ -442,8 +473,6 @@
 
    num = (int)length / 3;
 
-   palette = (png_colorp)png_zalloc(png_ptr, (uInt)num, sizeof (png_color));
-
 #ifndef PNG_NO_POINTER_INDEXING
    for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
    {
@@ -493,7 +522,6 @@
          else
          {
             png_chunk_warning(png_ptr, "CRC error");
-            png_zfree(png_ptr, palette);
             return;
          }
       }
@@ -504,15 +532,7 @@
       }
    }
 #endif
-   png_ptr->palette = palette;
-   png_ptr->num_palette = (png_uint_16)num;
 
-#ifdef PNG_FREE_ME_SUPPORTED
-   png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
-   png_ptr->free_me |= PNG_FREE_PLTE;
-#else
-   png_ptr->flags |= PNG_FLAG_FREE_PLTE;
-#endif
    png_set_PLTE(png_ptr, info_ptr, palette, num);
 
 #if defined(PNG_READ_tRNS_SUPPORTED)
@@ -1050,6 +1070,8 @@
                                     slength, prefix_length, &data_length);
 
    profile_length = data_length - prefix_length;
+
+   /* Check the profile_size recorded in the first 32 bits of the ICC profile */
    profile_size = ((*(chunkdata+prefix_length))<<24) |
                   ((*(chunkdata+prefix_length+1))<<16) |
                   ((*(chunkdata+prefix_length+2))<< 8) |
@@ -1065,7 +1087,7 @@
    }
 
    png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type,
-                chunkdata + prefix_length, data_length-prefix_length);
+                chunkdata + prefix_length, profile_length);
    png_free(png_ptr, chunkdata);
 }
 #endif /* PNG_READ_iCCP_SUPPORTED */
@@ -1202,6 +1224,8 @@
 void /* PRIVATE */
 png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
 {
+   png_byte	readbuf[PNG_MAX_PALETTE_LENGTH];
+
    png_debug(1, "in png_handle_tRNS\n");
 
    if (!(png_ptr->mode & PNG_HAVE_IHDR))
@@ -1239,8 +1263,7 @@
          return;
       }
 
-      png_ptr->trans = (png_bytep)png_malloc(png_ptr, length);
-      png_crc_read(png_ptr, png_ptr->trans, (png_size_t)length);
+      png_crc_read(png_ptr, readbuf, (png_size_t)length);
       png_ptr->num_trans = (png_uint_16)length;
    }
    else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
@@ -1285,15 +1308,7 @@
    if (png_crc_finish(png_ptr, 0))
       return;
 
-#ifdef PNG_FREE_ME_SUPPORTED
-   png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
-   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
-      png_ptr->free_me |= PNG_FREE_TRNS;
-#else
-   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
-      png_ptr->flags |= PNG_FLAG_FREE_TRNS;
-#endif
-   png_set_tRNS(png_ptr, info_ptr, png_ptr->trans, png_ptr->num_trans,
+   png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans,
       &(png_ptr->trans_values));
 }
 #endif
@@ -1392,6 +1407,7 @@
 png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
 {
    int num, i;
+   png_uint_16	readbuf[PNG_MAX_PALETTE_LENGTH];
 
    png_debug(1, "in png_handle_hIST\n");
 
@@ -1416,34 +1432,26 @@
       return;
    }
 
-   if (length != (png_uint_32)(2 * png_ptr->num_palette))
+   num = (int)length / 2 ;
+   if (num != png_ptr->num_palette)
    {
       png_warning(png_ptr, "Incorrect hIST chunk length");
       png_crc_finish(png_ptr, length);
       return;
    }
 
-   num = (int)length / 2 ;
-   png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
-      (png_uint_32)(num * sizeof (png_uint_16)));
    for (i = 0; i < num; i++)
    {
       png_byte buf[2];
 
       png_crc_read(png_ptr, buf, 2);
-      png_ptr->hist[i] = png_get_uint_16(buf);
+      readbuf[i] = png_get_uint_16(buf);
    }
 
    if (png_crc_finish(png_ptr, 0))
       return;
 
-#ifdef PNG_FREE_ME_SUPPORTED
-   png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
-   png_ptr->free_me |= PNG_FREE_HIST;
-#else
-   png_ptr->flags |= PNG_FLAG_FREE_HIST;
-#endif
-   png_set_hIST(png_ptr, info_ptr, png_ptr->hist);
+   png_set_hIST(png_ptr, info_ptr, readbuf);
 }
 #endif
 
@@ -1922,6 +1930,11 @@
    else
    {
        comp_type = *(++text);
+       if (comp_type != PNG_TEXT_COMPRESSION_zTXt)
+       {
+          png_warning(png_ptr, "Unknown compression type in zTXt chunk");
+          comp_type = PNG_TEXT_COMPRESSION_zTXt;
+       }
        text++;        /* skip the compression_method byte */
    }
    prefix_len = text - chunkdata;
@@ -2152,13 +2165,9 @@
    a zero indicates the pixel is to be skipped.  This is in addition
    to any alpha or transparency value associated with the pixel.  If
    you want all pixels to be combined, pass 0xff (255) in mask.  */
+#ifndef PNG_HAVE_ASSEMBLER_COMBINE_ROW
 void /* PRIVATE */
-#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
-png_combine_row_c
-#else
-png_combine_row
-#endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */
-   (png_structp png_ptr, png_bytep row, int mask)
+png_combine_row(png_structp png_ptr, png_bytep row, int mask)
 {
    png_debug(1,"in png_combine_row\n");
    if (mask == 0xff)
@@ -2358,25 +2367,24 @@
       }
    }
 }
+#endif /* !PNG_HAVE_ASSEMBLER_COMBINE_ROW */
 
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
+#ifndef PNG_HAVE_ASSEMBLER_READ_INTERLACE   /* else in pngvcrd.c, pnggccrd.c */
 void /* PRIVATE */
-#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
-png_do_read_interlace_c
-#else
-png_do_read_interlace
-#endif /* PNG_HAVE_ASSEMBLER_READ_INTERLACE */
-   (png_row_infop row_info, png_bytep row, int pass,
-   png_uint_32 transformations)
+png_do_read_interlace(png_structp png_ptr)
 {
+   png_row_infop row_info = &(png_ptr->row_info);
+   png_bytep row = png_ptr->row_buf + 1;
+   int pass = png_ptr->pass;
+   png_uint_32 transformations = png_ptr->transformations;
 #ifdef PNG_USE_LOCAL_ARRAYS
    /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
-
    /* offset to next interlace block */
    const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 #endif
 
-   png_debug(1,"in png_do_read_interlace\n");
+   png_debug(1,"in png_do_read_interlace (stock C version)\n");
    if (row != NULL && row_info != NULL)
    {
       png_uint_32 final_width;
@@ -2586,15 +2594,12 @@
       return;
 #endif
 }
-#endif
+#endif /* !PNG_HAVE_ASSEMBLER_READ_INTERLACE */
+#endif /* PNG_READ_INTERLACING_SUPPORTED */
 
+#ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
 void /* PRIVATE */
-#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
-png_read_filter_row_c
-#else
-png_read_filter_row
-#endif /* PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */
-   (png_structp png_ptr, png_row_infop row_info, png_bytep row,
+png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
    png_bytep prev_row, int filter)
 {
    png_debug(1, "in png_read_filter_row\n");
@@ -2715,6 +2720,7 @@
          break;
    }
 }
+#endif /* !PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */
 
 void /* PRIVATE */
 png_read_finish_row(png_structp png_ptr)
diff --git a/pngset.c b/pngset.c
index 210f473..9501d35 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,9 +1,9 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
@@ -133,12 +133,31 @@
 void PNGAPI
 png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
 {
+   int	i;
+
    png_debug1(1, "in %s storage function\n", "hIST");
    if (png_ptr == NULL || info_ptr == NULL)
       return;
+   if (info_ptr->num_palette == 0)
+       png_warning(png_ptr,
+		   "Palette size 0, hIST allocation skipped.");
 
-   info_ptr->hist = hist;
+#ifdef PNG_FREE_ME_SUPPORTED
+   png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
+#endif
+   png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
+      (png_uint_32)(info_ptr->num_palette * sizeof (png_uint_16)));
+
+   for (i = 0; i < info_ptr->num_palette; i++)
+       png_ptr->hist[i] = hist[i];
+   info_ptr->hist = png_ptr->hist;
    info_ptr->valid |= PNG_INFO_hIST;
+
+#ifdef PNG_FREE_ME_SUPPORTED
+   info_ptr->free_me |= PNG_FREE_HIST;
+#else
+   png_ptr->flags |= PNG_FLAG_FREE_HIST;
+#endif
 }
 #endif
 
@@ -320,9 +339,26 @@
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
-   info_ptr->palette = palette;
+   /*
+    * It may not actually be necessary to set png_ptr->palette here;
+    * we do it for backward compatibility with the way the png_handle_tRNS
+    * function used to do the allocation.
+    */
+#ifdef PNG_FREE_ME_SUPPORTED
+   png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
+#endif
+   png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)num_palette,
+      sizeof (png_color));
+   memcpy(png_ptr->palette, palette, num_palette * sizeof (png_color));
+   info_ptr->palette = png_ptr->palette;
+   info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
 
-   info_ptr->num_palette = (png_uint_16)num_palette;
+#ifdef PNG_FREE_ME_SUPPORTED
+   info_ptr->free_me |= PNG_FREE_PLTE;
+#else
+   png_ptr->flags |= PNG_FLAG_FREE_PLTE;
+#endif
+
    info_ptr->valid |= PNG_INFO_PLTE;
 }
 
@@ -631,7 +667,23 @@
       return;
 
    if (trans != NULL)
-      info_ptr->trans = trans;
+   {
+       /*
+	* It may not actually be necessary to set png_ptr->trans here;
+	* we do it for backward compatibility with the way the png_handle_tRNS
+	* function used to do the allocation.
+	*/
+#ifdef PNG_FREE_ME_SUPPORTED
+       png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
+#endif
+       png_ptr->trans = info_ptr->trans = png_malloc(png_ptr, num_trans);
+       memcpy(info_ptr->trans, trans, num_trans);
+#ifdef PNG_FREE_ME_SUPPORTED
+       info_ptr->free_me |= PNG_FREE_TRNS;
+#else
+       png_ptr->flags |= PNG_FLAG_FREE_TRNS;
+#endif
+   }
 
    if (trans_values != NULL)
    {
@@ -730,7 +782,7 @@
 png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
    int chunk, int location)
 {
-   if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk < 
+   if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
          (int)info_ptr->unknown_chunks_num)
       info_ptr->unknown_chunks[chunk].location = (png_byte)location;
 }
@@ -842,6 +894,8 @@
        png_free(png_ptr, png_ptr->zbuf);
     png_ptr->zbuf_size = (png_size_t)size;
     png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
+    if(!png_ptr->zbuf)
+       png_error(png_ptr,"Unable to malloc zbuf");
     png_ptr->zstream.next_out = png_ptr->zbuf;
     png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
 }
@@ -852,3 +906,4 @@
    if (png_ptr && info_ptr)
       info_ptr->valid &= ~(mask);
 }
+
diff --git a/pngtest.c b/pngtest.c
index f397bcc..f7748e2 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,9 +1,9 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
@@ -50,6 +50,14 @@
 #  define FCLOSE(file) fclose(file)
 #endif
 
+#if defined(PNG_NO_STDIO)
+#if defined(_WIN32_WCE)
+typedef HANDLE                png_FILE_p;
+#else
+typedef FILE                * png_FILE_p;
+#endif
+#endif
+
 /* Makes pngtest verbose so we can find problems (needs to be before png.h) */
 #ifndef PNG_DEBUG
 #define PNG_DEBUG 0
@@ -257,6 +265,7 @@
    not reading from a standard C stream, you should create a replacement
    read_data function and use it at run time with png_set_read_fn(), rather
    than changing the library. */
+
 #ifndef USE_FAR_KEYWORD
 static void
 pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
@@ -1449,4 +1458,4 @@
 }
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_0_9beta1 your_png_h_is_not_version_1_0_9beta1;
+typedef version_1_0_9beta10 your_png_h_is_not_version_1_0_9beta10;
diff --git a/pngtrans.c b/pngtrans.c
index 834dc42..d6429b0 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,9 +1,9 @@
 
 /* pngtrans.c - transforms the data in a row (used by both readers and writers)
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  */
@@ -606,3 +606,4 @@
    return (NULL);
 #endif
 }
+
diff --git a/pngvcrd.c b/pngvcrd.c
index eafdc29..4bf3025 100644
--- a/pngvcrd.c
+++ b/pngvcrd.c
@@ -2,13 +2,20 @@
  *
  * For Intel x86 CPU and Microsoft Visual C++ compiler
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
  *
  * Contributed by Nirav Chhatrapati, Intel Corporation, 1998
  * Interface to libpng contributed by Gilles Vollant, 1999
+ * Debugging and cleanup by Greg Roelofs, 2000, 2001
+ *
+ * In png_do_read_interlace() in libpng versions 1.0.3a through 1.0.4d,
+ * a sign error in the post-MMX cleanup code for each pixel_depth resulted
+ * in bad pixels at the beginning of some rows of some images, and also
+ * (due to out-of-range memory reads and writes) caused heap corruption
+ * when compiled with MSVC 6.0.  The error was fixed in version 1.0.4e.
  *
  * [png_read_filter_row_mmx_avg() bpp == 2 bugfix, GRR 20000916]
  *
@@ -19,19 +26,11 @@
 
 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)
 
-/*
-   One of these might need to be defined.
-#define DISABLE_PNGVCRD_COMBINE
-#define DISABLE_PNGVCRD_INTERLACE
-*/
-
 static int mmx_supported=2;
 
-void /* PRIVATE */
-png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info,
-   png_bytep row, png_bytep prev_row, int filter);
 
-static int mmxsupport()
+int PNGAPI
+png_mmx_support(void)
 {
   int mmx_supported_local = 0;
   _asm {
@@ -83,6 +82,7 @@
   //mmx_supported_local=0; // test code for force don't support MMX
   //printf("MMX : %u (1=MMX supported)\n",mmx_supported_local);
 
+  mmx_supported = mmx_supported_local;
   return mmx_supported_local;
 }
 
@@ -106,19 +106,12 @@
 #ifdef PNG_USE_LOCAL_ARRAYS
    const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 #endif
-#ifdef DISABLE_PNGVCRD_COMBINE
-   int save_mmx_supported = mmx_supported;
-#endif
 
    png_debug(1,"in png_combine_row_asm\n");
 
-#ifdef DISABLE_PNGVCRD_COMBINE
-   if ((png_ptr->transformations & PNG_INTERLACE) && png_ptr->pass != 6)
-       mmx_supported = 0;
-   else
-#endif
-       if (mmx_supported == 2)
-           mmx_supported = mmxsupport();
+   if (mmx_supported == 2) {
+       png_mmx_support();
+   }
 
    if (mask == 0xff)
    {
@@ -307,7 +300,7 @@
 
             __int64 mask0=0x0102040810204080;
 
-            if (mmx_supported)
+            if ( mmx_supported )
             {
                srcptr = png_ptr->row_buf + 1;
                dstptr = row;
@@ -407,7 +400,7 @@
             __int64 mask1=0x0101020204040808,
                     mask0=0x1010202040408080;
 
-            if (mmx_supported)
+            if ( mmx_supported )
             {
                srcptr = png_ptr->row_buf + 1;
                dstptr = row;
@@ -527,7 +520,7 @@
             len     = (png_ptr->width)&~7;
             diff = (png_ptr->width)&7;
 
-            if (mmx_supported)
+            if ( mmx_supported )
             {
                _asm
                {
@@ -658,7 +651,7 @@
             len     = (png_ptr->width)&~7;
             diff = (png_ptr->width)&7;
 
-            if (mmx_supported)
+            if ( mmx_supported )
             {
                _asm
                {
@@ -792,7 +785,7 @@
                     mask1=0x2020202040404040,
                     mask0=0x4040808080808080;
 
-            if (mmx_supported)
+            if ( mmx_supported )
             {
                srcptr = png_ptr->row_buf + 1;
                dstptr = row;
@@ -963,43 +956,27 @@
       } /* end switch (png_ptr->row_info.pixel_depth) */
    } /* end if (non-trivial mask) */
 
-#ifdef DISABLE_PNGVCRD_COMBINE
-   mmx_supported = save_mmx_supported;
-#endif
-
 } /* end png_combine_row() */
 
 
 #if defined(PNG_READ_INTERLACING_SUPPORTED)
 
 void /* PRIVATE */
-png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
-   png_uint_32 transformations)
+png_do_read_interlace(png_structp png_ptr)
 {
+   png_row_infop row_info = &(png_ptr->row_info);
+   png_bytep row = png_ptr->row_buf + 1;
+   int pass = png_ptr->pass;
+   png_uint_32 transformations = png_ptr->transformations;
 #ifdef PNG_USE_LOCAL_ARRAYS
    const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 #endif
-#ifdef DISABLE_PNGVCRD_INTERLACE
-   int save_mmx_supported = mmx_supported;
-#endif
 
    png_debug(1,"in png_do_read_interlace\n");
 
-#ifdef DISABLE_PNGVCRD_INTERLACE
-   /* In libpng versions 1.0.3a through 1.0.4d,
-    * a sign error in the post-MMX cleanup code for each pixel_depth resulted
-    * in bad pixels at the beginning of some rows of some images, and also
-    * (due to out-of-range memory reads and writes) caused heap corruption
-    * when compiled with MSVC 6.0.  The error was fixed in version 1.0.4e,
-    * and the code appears to work completely correctly, so it is enabled
-    * by default.
-    */
-   if (1)  /* all passes caused a heap problem in the old code */
-      mmx_supported = 0;
-   else
-#endif
-       if (mmx_supported == 2)
-           mmx_supported = mmxsupport();
+   if (mmx_supported == 2) {
+       png_mmx_support();
+   }
 
    if (row != NULL && row_info != NULL)
    {
@@ -1197,7 +1174,8 @@
             // sign fix by GRR
             // NOTE:  there is NO MMX code for 48-bit and 64-bit images
 
-            if (mmx_supported) // use MMX routine if machine supports it
+            // use MMX routine if machine supports it
+            if ( mmx_supported )
             {
                if (pixel_bytes == 3)
                {
@@ -1885,9 +1863,6 @@
          (png_uint_32)row_info->pixel_depth + 7) >> 3);
    }
 
-#ifdef DISABLE_PNGVCRD_INTERLACE
-   mmx_supported = save_mmx_supported;
-#endif
 }
 
 #endif /* PNG_READ_INTERLACING_SUPPORTED */
@@ -3323,7 +3298,7 @@
       case 1:
       {
          // Placed here just in case this is a duplicate of the
-         // non-MMX code for the SUB filter in png_read_filter_row above
+         // non-MMX code for the SUB filter in png_read_filter_row below
          //
          //         png_bytep rp;
          //         png_bytep lp;
@@ -3658,61 +3633,50 @@
    row, png_bytep prev_row, int filter)
 {
 #ifdef PNG_DEBUG
-   char filnm[6];
+   char filnm[10];
 #endif
-#define UseMMX 1
 
-   if (mmx_supported == 2)
-       mmx_supported = mmxsupport();
-
-   if (!mmx_supported)
-   {
-       png_read_filter_row_c(png_ptr, row_info, row, prev_row, filter);
-       return ;
+   if (mmx_supported == 2) {
+       png_mmx_support();
    }
 
 #ifdef PNG_DEBUG
    png_debug(1, "in png_read_filter_row\n");
-#  if (UseMMX == 1)
-   png_debug1(0,"%s, ", "MMX");
-#  else
-   png_debug1(0,"%s, ", "x86");
-#  endif
    switch (filter)
    {
-      case 0: sprintf(filnm, "None ");
+      case 0: sprintf(filnm, "none");
          break;
-      case 1: sprintf(filnm, "Sub  ");
+      case 1: sprintf(filnm, "sub-%s", "MMX");
          break;
-      case 2: sprintf(filnm, "Up   ");
+      case 2: sprintf(filnm, "up-%s", "MMX");
          break;
-      case 3: sprintf(filnm, "Avg  ");
+      case 3: sprintf(filnm, "avg-%s", "MMX");
          break;
-      case 4: sprintf(filnm, "Paeth");
+      case 4: sprintf(filnm, "Paeth-%s", "MMX");
          break;
-      default: sprintf(filnm, "Unknw");
+      default: sprintf(filnm, "unknw");
          break;
    }
    png_debug2(0,"row=%5d, %s, ", png_ptr->row_number, filnm);
    png_debug2(0, "pd=%2d, b=%d, ", (int)row_info->pixel_depth,
       (int)((row_info->pixel_depth + 7) >> 3));
    png_debug1(0,"len=%8d, ", row_info->rowbytes);
-#endif
+#endif /* PNG_DEBUG */
 
    switch (filter)
    {
       case PNG_FILTER_VALUE_NONE:
          break;
+
       case PNG_FILTER_VALUE_SUB:
       {
-#if (UseMMX == 1)
-         if ((row_info->pixel_depth > 8) &&
-            (row_info->rowbytes >= 128) )
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_sub(row_info, row);
          }
          else
-#endif
          {
             png_uint_32 i;
             png_uint_32 istop = row_info->rowbytes;
@@ -3725,41 +3689,43 @@
                *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
                rp++;
             }
-         }  //end !UseMMX
+         }
          break;
       }
+
       case PNG_FILTER_VALUE_UP:
       {
-#if (UseMMX == 1)
-         if ((row_info->pixel_depth > 8) &&
-             (row_info->rowbytes >= 128) )
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_up(row_info, row, prev_row);
-         }  //end if UseMMX
+         }
          else
-#endif
          {
-            png_bytep rp;
-            png_bytep pp;
             png_uint_32 i;
-            for (i = 0, rp = row, pp = prev_row;
-               i < row_info->rowbytes; i++, rp++, pp++)
+            png_uint_32 istop = row_info->rowbytes;
+            png_bytep rp = row;
+            png_bytep pp = prev_row;
+
+            for (i = 0; i < istop; ++i)
             {
-                  *rp = (png_byte)(((int)(*rp) + (int)(*pp)) & 0xff);
+               *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+               rp++;
             }
-         }  //end !UseMMX
+         }
          break;
       }
+
       case PNG_FILTER_VALUE_AVG:
       {
-#if (UseMMX == 1)
-         if ((row_info->pixel_depth > 8) &&
-             (row_info->rowbytes >= 128) )
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_avg(row_info, row, prev_row);
-         }  //end if UseMMX
+         }
          else
-#endif
          {
             png_uint_32 i;
             png_bytep rp = row;
@@ -3781,19 +3747,19 @@
                   ((int)(*pp++ + *lp++) >> 1)) & 0xff);
                rp++;
             }
-         }  //end !UseMMX
+         }
          break;
       }
+
       case PNG_FILTER_VALUE_PAETH:
       {
-#if (UseMMX == 1)
-         if ((row_info->pixel_depth > 8) &&
-             (row_info->rowbytes >= 128) )
+         if (
+             (row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
+             (row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
          {
             png_read_filter_row_mmx_paeth(row_info, row, prev_row);
-         }  //end if UseMMX
+         }
          else
-#endif
          {
             png_uint_32 i;
             png_bytep rp = row;
@@ -3844,13 +3810,15 @@
                *rp = (png_byte)(((int)(*rp) + p) & 0xff);
                rp++;
             }
-         }  //end !UseMMX
+         }
          break;
       }
+
       default:
-         png_warning(png_ptr, "Ignoring bad adaptive filter type");
+         png_warning(png_ptr, "Ignoring bad row filter type");
          *row=0;
          break;
    }
 }
-#endif
+
+#endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGVCRD */
diff --git a/pngwio.c b/pngwio.c
index b808d0c..9340194 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,9 +1,9 @@
 
 /* pngwio.c - functions for data output
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  *
diff --git a/pngwrite.c b/pngwrite.c
index 203ad7b..1ae9476 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,9 +1,9 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  */
@@ -28,6 +28,13 @@
    if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
    {
    png_write_sig(png_ptr); /* write PNG signature */
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+   if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
+   {
+      png_warning(png_ptr,"MNG features are not allowed in a PNG datastream\n");
+      png_ptr->mng_features_permitted=0;
+   }
+#endif
    /* write IHDR information. */
    png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
       info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
@@ -57,7 +64,7 @@
 #endif
 #if defined(PNG_WRITE_iCCP_SUPPORTED)
    if (info_ptr->valid & PNG_INFO_iCCP)
-      png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_TEXT_COMPRESSION_zTXt,
+      png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE,
                      info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
 #endif
 #if defined(PNG_WRITE_sBIT_SUPPORTED)
@@ -375,7 +382,11 @@
 
    /* write end of PNG file */
    png_write_IEND(png_ptr);
+#if 0
+/* This flush, added in libpng-1.0.8,  causes some applications to crash
+   because they do not set png_ptr->output_flush_fn */
    png_flush(png_ptr);
+#endif
 }
 
 #if defined(PNG_WRITE_tIME_SUPPORTED)
@@ -488,7 +499,7 @@
         removed from version 2.0.0 and beyond because the previous test
         would have already rejected it. */
 
-     if (user_png_ver[4] == '6' && user_png_ver[2] == '0' && 
+     if (user_png_ver[4] == '6' && user_png_ver[2] == '0' &&
          user_png_ver[0] == '1' && user_png_ver[5] == '\0')
      {
         png_error(png_ptr,
@@ -769,6 +780,24 @@
    if (png_ptr->transformations)
       png_do_write_transformations(png_ptr);
 
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+   /* Write filter_method 64 (intrapixel differencing) only if
+    * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
+    * 2. Libpng did not write a PNG signature (this filter_method is only
+    *    used in PNG datastreams that are embedded in MNG datastreams) and
+    * 3. The application called png_permit_mng_features with a mask that
+    *    included PNG_FLAG_MNG_FILTER_64 and
+    * 4. The filter_method is 64 and
+    * 5. The color_type is RGB or RGBA
+    */
+   if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
+      (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
+   {
+      /* Intrapixel differencing */
+      png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
+   }
+#endif
+
    /* Find a filter if necessary, filter the row and write it out. */
    png_write_find_filter(png_ptr, &(png_ptr->row_info));
 
@@ -964,6 +993,11 @@
 png_set_filter(png_structp png_ptr, int method, int filters)
 {
    png_debug(1, "in png_set_filter\n");
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+   if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
+      (method == PNG_INTRAPIXEL_DIFFERENCING))
+         method = PNG_FILTER_TYPE_BASE;
+#endif
    if (method == PNG_FILTER_TYPE_BASE)
    {
       switch (filters & (PNG_ALL_FILTERS | 0x07))
diff --git a/pngwtran.c b/pngwtran.c
index 110c6e7..6b5fc27 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,9 +1,9 @@
 
 /* pngwtran.c - transforms the data in a row for PNG writers
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  */
@@ -498,3 +498,64 @@
    }
 }
 #endif
+
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+/* undoes intrapixel differencing  */
+void /* PRIVATE */
+png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
+{
+   png_debug(1, "in png_do_write_intrapixel\n");
+   if (
+#if defined(PNG_USELESS_TESTS_SUPPORTED)
+       row != NULL && row_info != NULL &&
+#endif
+       (row_info->color_type & PNG_COLOR_MASK_COLOR))
+   {
+      int bytes_per_pixel;
+      png_uint_32 row_width = row_info->width;
+      if (row_info->bit_depth == 8)
+      {
+         png_bytep rp;
+         png_uint_32 i;
+
+         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+            bytes_per_pixel = 3;
+         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+            bytes_per_pixel = 4;
+         else
+            return;
+
+         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+         {
+            *(rp)   = (png_byte)((*rp     - *(rp+1))&0xff);
+            *(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff);
+         }
+      }
+      else if (row_info->bit_depth == 16)
+      {
+         png_bytep rp;
+         png_uint_32 i;
+
+         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+            bytes_per_pixel = 6;
+         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+            bytes_per_pixel = 8;
+         else
+            return;
+
+         for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+         {
+            png_uint_32 s0=*(rp  )<<8 | *(rp+1);
+            png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
+            png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
+            png_uint_32 red=(s0-s1)&0xffff;
+            png_uint_32 blue=(s2-s1)&0xffff;
+            *(rp  ) = (png_byte)((red>>8)&0xff);
+            *(rp+1) = (png_byte)(red&0xff);
+            *(rp+4) = (png_byte)((blue>>8)&0xff);
+            *(rp+5) = (png_byte)(blue&0xff);
+         }
+      }
+   }
+}
+#endif /* PNG_MNG_FEATURES_SUPPORTED */
diff --git a/pngwutil.c b/pngwutil.c
index ea58d15..a8ef1a4 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,9 +1,9 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * libpng 1.0.9beta1 - November 10, 2000
+ * libpng 1.0.9beta10 - January 16, 2001
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2001 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.)
  */
@@ -131,6 +131,8 @@
    /* write the rest of the 8 byte signature */
    png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
       (png_size_t)8 - png_ptr->sig_bytes);
+   if(png_ptr->sig_bytes < 3)
+      png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
 }
 
 #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
@@ -419,7 +421,24 @@
       compression_type = PNG_COMPRESSION_TYPE_BASE;
    }
 
-   if (filter_type != PNG_FILTER_TYPE_BASE)
+   /* Write filter_method 64 (intrapixel differencing) only if
+    * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
+    * 2. Libpng did not write a PNG signature (this filter_method is only
+    *    used in PNG datastreams that are embedded in MNG datastreams) and
+    * 3. The application called png_permit_mng_features with a mask that
+    *    included PNG_FLAG_MNG_FILTER_64 and
+    * 4. The filter_method is 64 and
+    * 5. The color_type is RGB or RGBA
+    */
+   if (
+#if defined(PNG_MNG_FEATURES_SUPPORTED)
+      !((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
+      ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
+      (color_type == PNG_COLOR_TYPE_RGB || 
+       color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
+      (filter_type == PNG_INTRAPIXEL_DIFFERENCING)) &&
+#endif
+      filter_type != PNG_FILTER_TYPE_BASE)
    {
       png_warning(png_ptr, "Invalid filter type specified");
       filter_type = PNG_FILTER_TYPE_BASE;
@@ -440,6 +459,7 @@
    png_ptr->bit_depth = (png_byte)bit_depth;
    png_ptr->color_type = (png_byte)color_type;
    png_ptr->interlaced = (png_byte)interlace_type;
+   png_ptr->filter_type = (png_byte)filter_type;
    png_ptr->width = width;
    png_ptr->height = height;
 
@@ -657,7 +677,7 @@
       return;
    }
 
-   if (compression_type)
+   if (compression_type != PNG_COMPRESSION_TYPE_BASE)
       png_warning(png_ptr, "Unknown compression type in iCCP chunk");
 
    if (profile == NULL)
@@ -665,7 +685,7 @@
 
    if (profile_len)
        profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len,
-          PNG_TEXT_COMPRESSION_zTXt, &comp);
+          PNG_COMPRESSION_TYPE_BASE, &comp);
 
    /* make sure we include the NULL after the name and the compression type */
    png_write_chunk_start(png_ptr, (png_bytep)png_iCCP,
@@ -1072,13 +1092,14 @@
    png_size_t key_len;
    png_charp kp, dp;
    int kflag;
+   int kwarn=0;
 
    png_debug(1, "in png_check_keyword\n");
    *new_key = NULL;
 
    if (key == NULL || (key_len = png_strlen(key)) == 0)
    {
-      png_chunk_warning(png_ptr, "zero length keyword");
+      png_warning(png_ptr, "zero length keyword");
       return ((png_size_t)0);
    }
 
@@ -1095,9 +1116,9 @@
          char msg[40];
 
          sprintf(msg, "invalid keyword character 0x%02X", *kp);
-         png_chunk_warning(png_ptr, msg);
+         png_warning(png_ptr, msg);
 #else
-         png_chunk_warning(png_ptr, "invalid character in keyword");
+         png_warning(png_ptr, "invalid character in keyword");
 #endif
          *dp = ' ';
       }
@@ -1112,7 +1133,7 @@
    kp = *new_key + key_len - 1;
    if (*kp == ' ')
    {
-      png_chunk_warning(png_ptr, "trailing spaces removed from keyword");
+      png_warning(png_ptr, "trailing spaces removed from keyword");
 
       while (*kp == ' ')
       {
@@ -1125,7 +1146,7 @@
    kp = *new_key;
    if (*kp == ' ')
    {
-      png_chunk_warning(png_ptr, "leading spaces removed from keyword");
+      png_warning(png_ptr, "leading spaces removed from keyword");
 
       while (*kp == ' ')
       {
@@ -1147,6 +1168,7 @@
       else if (*kp == ' ')
       {
          key_len--;
+         kwarn=1;
       }
       else
       {
@@ -1155,17 +1177,19 @@
       }
    }
    *dp = '\0';
+   if(kwarn)
+      png_warning(png_ptr, "extra interior spaces removed from keyword");
 
    if (key_len == 0)
    {
       png_free(png_ptr, *new_key);
       *new_key=NULL;
-      png_chunk_warning(png_ptr, "Zero length keyword");
+      png_warning(png_ptr, "Zero length keyword");
    }
 
    if (key_len > 79)
    {
-      png_chunk_warning(png_ptr, "keyword length must be 1 - 79 characters");
+      png_warning(png_ptr, "keyword length must be 1 - 79 characters");
       new_key[79] = '\0';
       key_len = 79;
    }
diff --git a/projects/borland/libpng.bpf b/projects/borland/libpng.bpf
new file mode 100644
index 0000000..e796e3c
--- /dev/null
+++ b/projects/borland/libpng.bpf
@@ -0,0 +1,22 @@
+USEUNIT("libpng.cpp");
+USEUNIT("..\..\pngwutil.c");
+USEUNIT("..\..\pngerror.c");
+USEUNIT("..\..\pngget.c");
+USEUNIT("..\..\pngmem.c");
+USEUNIT("..\..\pngpread.c");
+USEUNIT("..\..\pngread.c");
+USEUNIT("..\..\pngrio.c");
+USEUNIT("..\..\pngrtran.c");
+USEUNIT("..\..\pngrutil.c");
+USEUNIT("..\..\pngset.c");
+USEUNIT("..\..\pngtrans.c");
+USEUNIT("..\..\pngwio.c");
+USEUNIT("..\..\pngwrite.c");
+USEUNIT("..\..\pngwtran.c");
+USEUNIT("..\..\png.c");
+USELIB("zlib.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+
+DllEntryPoint
\ No newline at end of file
diff --git a/projects/borland/libpng.bpg b/projects/borland/libpng.bpg
new file mode 100644
index 0000000..80c1977
--- /dev/null
+++ b/projects/borland/libpng.bpg
@@ -0,0 +1,25 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = libpngstat.lib libpng.dll
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+libpngstat.lib: libpngstat.bpr
+  $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+libpng.dll: libpng.bpr
+  $(ROOT)\bin\bpr2mak $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+
diff --git a/projects/borland/libpng.bpr b/projects/borland/libpng.bpr
new file mode 100644
index 0000000..f5f062b
--- /dev/null
+++ b/projects/borland/libpng.bpr
@@ -0,0 +1,157 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+  <MACROS>
+    <VERSION value="BCB.05.03"/>
+    <PROJECT value="libpng.dll"/>
+    <OBJFILES value="libpng.obj ..\..\pngwutil.obj ..\..\pngerror.obj ..\..\pngget.obj 
+      ..\..\pngmem.obj ..\..\pngpread.obj ..\..\pngread.obj ..\..\pngrio.obj 
+      ..\..\pngrtran.obj ..\..\pngrutil.obj ..\..\pngset.obj ..\..\pngtrans.obj 
+      ..\..\pngwio.obj ..\..\pngwrite.obj ..\..\pngwtran.obj ..\..\png.obj"/>
+    <RESFILES value=""/>
+    <DEFFILE value=""/>
+    <RESDEPEN value="$(RESFILES)"/>
+    <LIBFILES value="zlib.lib"/>
+    <LIBRARIES value="bcbsmp50.lib dclocx50.lib NMFast50.lib Tee50.lib Vclx50.lib Vcl50.lib"/>
+    <SPARELIBS value="Vcl50.lib Vclx50.lib Tee50.lib NMFast50.lib dclocx50.lib bcbsmp50.lib"/>
+    <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi 
+      ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi 
+      VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi 
+      dclocx50.bpi bcb97axserver50.bpi SIMULUSCOMPONENTS.bpi Simulus2.bpi"/>
+    <PATHCPP value=".;..\.."/>
+    <PATHPAS value=".;"/>
+    <PATHRC value=".;"/>
+    <PATHASM value=".;"/>
+    <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+    <RELEASELIBPATH value="$(BCB)\lib\release"/>
+    <LINKER value="tlink32"/>
+    <USERDEFINES value="ZLIB_DLL;Z_PREFIX;PNG_BUILD_DLL;PNG_NO_MODULEDEF"/>
+    <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL"/>
+    <MAINSOURCE value="libpng.bpf"/>
+    <INCLUDEPATH value="..\..;..\..\..\zlib;$(BCB)\include"/>
+    <LIBPATH value="..\..;$(BCB)\lib\obj;$(BCB)\lib"/>
+    <WARNINGS value="-w8092 -w8091 -w8090 -w8089 -w8087 -wprc -wucp -wstv -wstu -wsig -wpin 
+      -wnod -wnak -wdef -wcln -wbbf -wasm -wamp -wamb"/>
+  </MACROS>
+  <OPTIONS>
+    <CFLAG1 value="-WD -O2 -w -Vx -Ve -x- -RT- -X- -a8 -5 -b- -d -k- -vi -tWD -tWM -c"/>
+    <PFLAGS value="-$Y- -$L- -$D- -$C- -v -JPHNE -M"/>
+    <RFLAGS value=""/>
+    <AFLAGS value="/mx /w2 /zn"/>
+    <LFLAGS value="-D&quot;&quot; -aa -Tpd -x -Gn -Gi -w"/>
+  </OPTIONS>
+  <LINKER>
+    <ALLOBJ value="c0d32.obj $(OBJFILES)"/>
+    <ALLRES value="$(RESFILES)"/>
+    <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/>
+  </LINKER>
+  <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=1
+Locale=2057
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=18
+Item0=..\..;..\..\..\zlib;$(BCB)\include
+Item1=..\..;P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\include
+Item2=..\..;..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression\external;$(BCB)\include
+Item3=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression\external;$(BCB)\include
+Item4=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
+Item5=..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
+Item6=..\Source\ThirdParty\PortableNetworkGraphics;P:\Development\Source\ThirdParty\ZLibCompression;$(BCB)\include
+Item7=..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\include
+Item8=$(BCB)\include
+Item9=..\Source;..\Source\General\Templates;..\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
+Item10=P:\Development\Source\;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
+Item11=P:\Development\Source;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
+Item12=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
+Item13=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
+Item14=P:\Development\Source\General\Templates\;$(BCB)\include;$(BCB)\include\vcl
+Item15=P:\Development\Source\General\Templates;$(BCB)\include;$(BCB)\include\vcl
+Item16=P:\Development\Source;$(BCB)\include;$(BCB)\include\vcl
+Item17=$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=10
+Item0=..\..;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\..;..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
+Item3=..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
+Item4=$(BCB)\lib\obj;$(BCB)\lib
+Item5=..\Source\SIMUtilities;..\Source;$(BCB)\lib\obj;$(BCB)\lib
+Item6=P:\Development\Source\SIMUtilities\;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
+Item7=P:\Development\Source\SIMUtilities;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
+Item8=P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
+Item9=P:\Development\Source;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=20
+Item0=ZLIB_DLL;Z_PREFIX;PNG_BUILD_DLL;PNG_NO_MODULEDEF
+Item1=_DEBUG;ZLIB_DLL;Z_PREFIX;PNG_BUILD_DLL;PNG_NO_MODULEDEF
+Item2=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_NO_MODULEDEF
+Item3=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_NO_GLOBAL_ARRAYS
+Item4=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED;PNG_DEBUG_FILE=stderr
+Item5=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED
+Item6=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED
+Item7=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF
+Item8=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5
+Item9=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG
+Item10=PNG_BUILD_DLL;ZLIB_DLL
+Item11=PNG_BUILD_DLL
+Item12=PNG_DLL;PNG_BUILD_DLL;ZLIB_DLL
+Item13=PNG_DLL;PNG_BUILD_DLL;PNG_NO_GLOBAL_ARRAYS;ZLIB_DLL
+Item14=PNG_DLL;PNG_BUILD_DLL;PNG_NO_GLOBAL_ARRAYS
+Item15=PNG_DLL;PNG_BUILD_DLL
+Item16=PNG_DLL;PNG_BUILD_DLL;PNG_MODULEDEF
+Item17=_HTML_FORM
+Item18=_DEBUG;_HTML_FORM
+Item19=_DEBUG
+
+[HistoryLists\hlIntOutputDir]
+Count=2
+Item0=..\Obj
+Item1=P:\Development\Obj
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=P:\Development\Executables\LibPNGTestApp.exe
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+  </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
diff --git a/projects/borland/libpng.cpp b/projects/borland/libpng.cpp
new file mode 100644
index 0000000..4e2f274
--- /dev/null
+++ b/projects/borland/libpng.cpp
@@ -0,0 +1,29 @@
+//---------------------------------------------------------------------------
+#include <windows.h>
+//---------------------------------------------------------------------------
+//   Important note about DLL memory management when your DLL uses the
+//   static version of the RunTime Library:
+//
+//   If your DLL exports any functions that pass String objects (or structs/
+//   classes containing nested Strings) as parameter or function results,
+//   you will need to add the library MEMMGR.LIB to both the DLL project and
+//   any other projects that use the DLL.  You will also need to use MEMMGR.LIB
+//   if any other projects which use the DLL will be performing new or delete
+//   operations on any non-TObject-derived classes which are exported from the
+//   DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
+//   EXE's to use the BORLNDMM.DLL as their memory manager.  In these cases,
+//   the file BORLNDMM.DLL should be deployed along with your DLL.
+//
+//   To avoid using BORLNDMM.DLL, pass string information using "char *" or
+//   ShortString parameters.
+//
+//   If your DLL uses the dynamic version of the RTL, you do not need to
+//   explicitly add MEMMGR.LIB as this will be done implicitly for you
+//---------------------------------------------------------------------------
+
+int WINAPI DllEntryPoint(HINSTANCE, unsigned long, void*)
+{
+    return 1;
+}
+//---------------------------------------------------------------------------
+ 
\ No newline at end of file
diff --git a/projects/borland/libpng.readme.txt b/projects/borland/libpng.readme.txt
new file mode 100644
index 0000000..efe7cbd
--- /dev/null
+++ b/projects/borland/libpng.readme.txt
@@ -0,0 +1,19 @@
+Project files to build libpng using Borland C++ Builder v5.0
+
+To use this dll, you will need to:
+
+1) add the following conditional defines to your project
+
+PNG_USE_DLL
+Z_PREFIX
+
+2) add the paths to png.h and zlib.h to your include path
+
+3) add libpng.lib or libpngstat.lib to the project.
+
+If you are using libpng.dll, libpng.dll and zlib.dll will be required for the code to run.
+
+Alternatively, the libpng.dll can be built using zlibstat.lib to produce one dll containing both the zlib and png code.
+
+See the libpng documentation for instructions on how to use the code.
+
diff --git a/projects/borland/libpngstat.bpf b/projects/borland/libpngstat.bpf
new file mode 100644
index 0000000..9159d02
--- /dev/null
+++ b/projects/borland/libpngstat.bpf
@@ -0,0 +1,22 @@
+USELIB("zlibstat.lib");
+USEUNIT("..\..\pngerror.c");
+USEUNIT("..\..\png.c");
+USEUNIT("..\..\pngwutil.c");
+USEUNIT("..\..\pngmem.c");
+USEUNIT("..\..\pngpread.c");
+USEUNIT("..\..\pngread.c");
+USEUNIT("..\..\pngrio.c");
+USEUNIT("..\..\pngrtran.c");
+USEUNIT("..\..\pngrutil.c");
+USEUNIT("..\..\pngset.c");
+USEUNIT("..\..\pngtrans.c");
+USEUNIT("..\..\pngwio.c");
+USEUNIT("..\..\pngwrite.c");
+USEUNIT("..\..\pngwtran.c");
+USEUNIT("..\..\pngget.c");
+//---------------------------------------------------------------------------
+#define Library
+
+// To add a file to the library use the Project menu 'Add to Project'.
+
+ 
\ No newline at end of file
diff --git a/projects/borland/libpngstat.bpr b/projects/borland/libpngstat.bpr
new file mode 100644
index 0000000..0b97981
--- /dev/null
+++ b/projects/borland/libpngstat.bpr
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+  <MACROS>
+    <VERSION value="BCB.05.03"/>
+    <PROJECT value="libpngstat.lib"/>
+    <OBJFILES value="..\..\pngerror.obj ..\..\png.obj ..\..\pngwutil.obj ..\..\pngmem.obj 
+      ..\..\pngpread.obj ..\..\pngread.obj ..\..\pngrio.obj ..\..\pngrtran.obj 
+      ..\..\pngrutil.obj ..\..\pngset.obj ..\..\pngtrans.obj ..\..\pngwio.obj 
+      ..\..\pngwrite.obj ..\..\pngwtran.obj ..\..\pngget.obj"/>
+    <RESFILES value=""/>
+    <DEFFILE value=""/>
+    <RESDEPEN value="$(RESFILES)"/>
+    <LIBFILES value="zlibstat.lib"/>
+    <LIBRARIES value=""/>
+    <PACKAGES value=""/>
+    <PATHCPP value=".;..\.."/>
+    <PATHPAS value=".;"/>
+    <PATHRC value=".;"/>
+    <PATHASM value=".;"/>
+    <LINKER value="TLib"/>
+    <USERDEFINES value=""/>
+    <SYSDEFINES value="_RTLDLL;NO_STRICT"/>
+    <MAINSOURCE value="libpngstat.bpf"/>
+    <INCLUDEPATH value="..\..;..\..\..\zlib;$(BCB)\include"/>
+    <LIBPATH value="..\..;$(BCB)\lib\obj;$(BCB)\lib"/>
+    <WARNINGS value="-w-par"/>
+    <LISTFILE value=""/>
+  </MACROS>
+  <OPTIONS>
+    <CFLAG1 value="-O2 -w -Vx -Ve -X- -a8 -5 -b- -d -k- -vi -c -tW -tWM"/>
+    <PFLAGS value="-$Y- -$L- -$D- -$C- -v -JPHNE -M"/>
+    <AFLAGS value="/mx /w2 /zn"/>
+    <LFLAGS value=""/>
+  </OPTIONS>
+  <LINKER>
+    <ALLOBJ value="$(OBJFILES)"/>
+    <ALLLIB value=""/>
+  </LINKER>
+  <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=2057
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=..\..;P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\include
+Item1=..\..;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=..\..;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[HistoryLists\hlTlibPageSize]
+Count=1
+Item0=0x0010
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+  </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
diff --git a/projects/borland/zlib+libpng.bpg b/projects/borland/zlib+libpng.bpg
new file mode 100644
index 0000000..f8f4702
--- /dev/null
+++ b/projects/borland/zlib+libpng.bpg
@@ -0,0 +1,33 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = zlibstat.lib libpngstat.lib zlib.dll libpng.dll
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+libpng.dll: libpng.bpr
+  $(ROOT)\bin\bpr2mak $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+zlibstat.lib: zlibstat.bpr
+  $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+zlib.dll: zlib.bpr
+  $(ROOT)\bin\bpr2mak $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+libpngstat.lib: libpngstat.bpr
+  $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+
diff --git a/projects/borland/zlib.bpf b/projects/borland/zlib.bpf
new file mode 100644
index 0000000..7dca899
--- /dev/null
+++ b/projects/borland/zlib.bpf
@@ -0,0 +1,20 @@
+USEUNIT("zlib.cpp");
+USEUNIT("..\..\..\zlib\zutil.c");
+USEUNIT("..\..\..\zlib\compress.c");
+USEUNIT("..\..\..\zlib\crc32.c");
+USEUNIT("..\..\..\zlib\deflate.c");
+USEUNIT("..\..\..\zlib\gzio.c");
+USEUNIT("..\..\..\zlib\infblock.c");
+USEUNIT("..\..\..\zlib\infcodes.c");
+USEUNIT("..\..\..\zlib\inffast.c");
+USEUNIT("..\..\..\zlib\inflate.c");
+USEUNIT("..\..\..\zlib\inftrees.c");
+USEUNIT("..\..\..\zlib\infutil.c");
+USEUNIT("..\..\..\zlib\trees.c");
+USEUNIT("..\..\..\zlib\uncompr.c");
+USEUNIT("..\..\..\zlib\adler32.c");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+
+DllEntryPoint
\ No newline at end of file
diff --git a/projects/borland/zlib.bpg b/projects/borland/zlib.bpg
new file mode 100644
index 0000000..0292b48
--- /dev/null
+++ b/projects/borland/zlib.bpg
@@ -0,0 +1,25 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = zlibstat.lib zlib.dll
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+zlibstat.lib: zlibstat.bpr
+  $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+zlib.dll: zlib.bpr
+  $(ROOT)\bin\bpr2mak $**
+  $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+
diff --git a/projects/borland/zlib.bpr b/projects/borland/zlib.bpr
new file mode 100644
index 0000000..b3dda39
--- /dev/null
+++ b/projects/borland/zlib.bpr
@@ -0,0 +1,147 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+  <MACROS>
+    <VERSION value="BCB.05.03"/>
+    <PROJECT value="zlib.dll"/>
+    <OBJFILES value="zlib.obj ..\..\..\zlib\zutil.obj ..\..\..\zlib\compress.obj 
+      ..\..\..\zlib\crc32.obj ..\..\..\zlib\deflate.obj ..\..\..\zlib\gzio.obj 
+      ..\..\..\zlib\infblock.obj ..\..\..\zlib\infcodes.obj 
+      ..\..\..\zlib\inffast.obj ..\..\..\zlib\inflate.obj 
+      ..\..\..\zlib\inftrees.obj ..\..\..\zlib\infutil.obj 
+      ..\..\..\zlib\trees.obj ..\..\..\zlib\uncompr.obj ..\..\..\zlib\adler32.obj"/>
+    <RESFILES value=""/>
+    <DEFFILE value=""/>
+    <RESDEPEN value="$(RESFILES)"/>
+    <LIBFILES value=""/>
+    <LIBRARIES value="bcbsmp50.lib dclocx50.lib NMFast50.lib Tee50.lib Vclx50.lib Vcl50.lib"/>
+    <SPARELIBS value="Vcl50.lib Vclx50.lib Tee50.lib NMFast50.lib dclocx50.lib bcbsmp50.lib"/>
+    <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi 
+      ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi 
+      VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi 
+      dclocx50.bpi bcb97axserver50.bpi SIMULUSCOMPONENTS.bpi Simulus2.bpi"/>
+    <PATHCPP value=".;..\..\..\zlib"/>
+    <PATHPAS value=".;"/>
+    <PATHRC value=".;"/>
+    <PATHASM value=".;"/>
+    <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+    <RELEASELIBPATH value="$(BCB)\lib\release"/>
+    <LINKER value="tlink32"/>
+    <USERDEFINES value="ZLIB_DLL;Z_PREFIX"/>
+    <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL"/>
+    <MAINSOURCE value="zlib.bpf"/>
+    <INCLUDEPATH value="..\..\..\zlib;$(BCB)\include"/>
+    <LIBPATH value="..\..\..\zlib;$(BCB)\lib\obj;$(BCB)\lib"/>
+    <WARNINGS value="-w8092 -w8091 -w8090 -w8089 -w8087 -wprc -wuse -wucp -wstv -wstu -wpin 
+      -w-par -wnod -wnak -wdef -wcln -wbbf -w-aus -wasm -wamp -wamb"/>
+  </MACROS>
+  <OPTIONS>
+    <CFLAG1 value="-WD -O2 -w -Vx -Ve -x- -RT- -ff -X- -a8 -5 -b- -d -k- -vi -tWD -tWM -c"/>
+    <PFLAGS value="-$Y- -$L- -$D- -$C- -v -JPHNE -M"/>
+    <RFLAGS value=""/>
+    <AFLAGS value="/mx /w2 /zn"/>
+    <LFLAGS value="-D&quot;&quot; -aa -Tpd -x -Gn -Gi -w"/>
+  </OPTIONS>
+  <LINKER>
+    <ALLOBJ value="c0d32.obj $(OBJFILES)"/>
+    <ALLRES value="$(RESFILES)"/>
+    <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/>
+  </LINKER>
+  <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=1
+Locale=2057
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=16
+Item0=..\..\..\zlib;$(BCB)\include
+Item1=..\..\..;..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression;..\..\..\zlib;$(BCB)\include
+Item2=..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression;..\..\..\zlib;$(BCB)\include
+Item3=P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\include
+Item4=..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
+Item5=..\Source\ThirdParty\ZLibCompression;$(BCB)\include
+Item6=$(BCB)\include
+Item7=..\Source;..\Source\General\Templates;..\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
+Item8=P:\Development\Source\;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
+Item9=P:\Development\Source;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
+Item10=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
+Item11=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
+Item12=P:\Development\Source\General\Templates\;$(BCB)\include;$(BCB)\include\vcl
+Item13=P:\Development\Source\General\Templates;$(BCB)\include;$(BCB)\include\vcl
+Item14=P:\Development\Source;$(BCB)\include;$(BCB)\include\vcl
+Item15=$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=12
+Item0=..\..\..\zlib;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\..\..;..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression;..\..\..\zlib;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression;..\..\..\zlib;$(BCB)\lib\obj;$(BCB)\lib
+Item3=P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\lib\obj;$(BCB)\lib
+Item4=..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression;$(BCB)\lib\obj;$(BCB)\lib
+Item5=$(BCB)\lib\obj;$(BCB)\lib
+Item6=..\Source\ThirdParty\ZLibCompression;$(BCB)\lib\obj;$(BCB)\lib
+Item7=..\Source\SIMUtilities;..\Source;$(BCB)\lib\obj;$(BCB)\lib
+Item8=P:\Development\Source\SIMUtilities\;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
+Item9=P:\Development\Source\SIMUtilities;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
+Item10=P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
+Item11=P:\Development\Source;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=8
+Item0=ZLIB_DLL;Z_PREFIX
+Item1=ZLIB_DLL;_DEBUG;Z_PREFIX
+Item2=ZLIB_DLL;_DEBUG
+Item3=ZLIB_DLL
+Item4=_WINDOWS;ZLIB_DLL
+Item5=_HTML_FORM
+Item6=_DEBUG;_HTML_FORM
+Item7=_DEBUG
+
+[HistoryLists\hlIntOutputDir]
+Count=2
+Item0=..\Obj
+Item1=P:\Development\Obj
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+  </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
diff --git a/projects/borland/zlib.cpp b/projects/borland/zlib.cpp
new file mode 100644
index 0000000..2cef71d
--- /dev/null
+++ b/projects/borland/zlib.cpp
@@ -0,0 +1,30 @@
+//---------------------------------------------------------------------------
+
+#include <windows.h>
+//---------------------------------------------------------------------------
+//   Important note about DLL memory management when your DLL uses the
+//   static version of the RunTime Library:
+//
+//   If your DLL exports any functions that pass String objects (or structs/
+//   classes containing nested Strings) as parameter or function results,
+//   you will need to add the library MEMMGR.LIB to both the DLL project and
+//   any other projects that use the DLL.  You will also need to use MEMMGR.LIB
+//   if any other projects which use the DLL will be performing new or delete
+//   operations on any non-TObject-derived classes which are exported from the
+//   DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
+//   EXE's to use the BORLNDMM.DLL as their memory manager.  In these cases,
+//   the file BORLNDMM.DLL should be deployed along with your DLL.
+//
+//   To avoid using BORLNDMM.DLL, pass string information using "char *" or
+//   ShortString parameters.
+//
+//   If your DLL uses the dynamic version of the RTL, you do not need to
+//   explicitly add MEMMGR.LIB as this will be done implicitly for you
+//---------------------------------------------------------------------------
+
+int WINAPI DllEntryPoint(HINSTANCE, unsigned long, void*)
+{
+    return 1;
+}
+//---------------------------------------------------------------------------
+ 
\ No newline at end of file
diff --git a/projects/borland/zlibstat.bpf b/projects/borland/zlibstat.bpf
new file mode 100644
index 0000000..14c36bc
--- /dev/null
+++ b/projects/borland/zlibstat.bpf
@@ -0,0 +1,20 @@
+USEUNIT("..\..\..\zlib\zutil.c");
+USEUNIT("..\..\..\zlib\compress.c");
+USEUNIT("..\..\..\zlib\crc32.c");
+USEUNIT("..\..\..\zlib\deflate.c");
+USEUNIT("..\..\..\zlib\gzio.c");
+USEUNIT("..\..\..\zlib\infblock.c");
+USEUNIT("..\..\..\zlib\infcodes.c");
+USEUNIT("..\..\..\zlib\inffast.c");
+USEUNIT("..\..\..\zlib\inflate.c");
+USEUNIT("..\..\..\zlib\inftrees.c");
+USEUNIT("..\..\..\zlib\infutil.c");
+USEUNIT("..\..\..\zlib\trees.c");
+USEUNIT("..\..\..\zlib\uncompr.c");
+USEUNIT("..\..\..\zlib\adler32.c");
+//---------------------------------------------------------------------------
+#define Library
+
+// To add a file to the library use the Project menu 'Add to Project'.
+
+ 
\ No newline at end of file
diff --git a/projects/borland/zlibstat.bpr b/projects/borland/zlibstat.bpr
new file mode 100644
index 0000000..9e09038
--- /dev/null
+++ b/projects/borland/zlibstat.bpr
@@ -0,0 +1,131 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+  <MACROS>
+    <VERSION value="BCB.05.03"/>
+    <PROJECT value="zlibstat.lib"/>
+    <OBJFILES value="..\..\..\zlib\zutil.obj ..\..\..\zlib\compress.obj ..\..\..\zlib\crc32.obj 
+      ..\..\..\zlib\deflate.obj ..\..\..\zlib\gzio.obj 
+      ..\..\..\zlib\infblock.obj ..\..\..\zlib\infcodes.obj 
+      ..\..\..\zlib\inffast.obj ..\..\..\zlib\inflate.obj 
+      ..\..\..\zlib\inftrees.obj ..\..\..\zlib\infutil.obj 
+      ..\..\..\zlib\trees.obj ..\..\..\zlib\uncompr.obj ..\..\..\zlib\adler32.obj"/>
+    <RESFILES value=""/>
+    <DEFFILE value=""/>
+    <RESDEPEN value="$(RESFILES)"/>
+    <LIBFILES value=""/>
+    <LIBRARIES value=""/>
+    <PACKAGES value=""/>
+    <PATHCPP value=".;..\..\..\zlib"/>
+    <PATHPAS value=".;"/>
+    <PATHRC value=".;"/>
+    <PATHASM value=".;"/>
+    <LINKER value="TLib"/>
+    <USERDEFINES value="Z_PREFIX"/>
+    <SYSDEFINES value="_RTLDLL;NO_STRICT"/>
+    <MAINSOURCE value="zlibstat.bpf"/>
+    <INCLUDEPATH value="..\..\..\zlib;$(BCB)\include"/>
+    <LIBPATH value="..\..\..\zlib;$(BCB)\lib\obj;$(BCB)\lib"/>
+    <WARNINGS value="-w8092 -w8091 -w8090 -w8089 -w8087 -wprc -wuse -wucp -wstv -wstu -wpin 
+      -wnod -wnak -wdef -wcln -wbbf -w-aus -wasm -wamp -wamb"/>
+    <LISTFILE value=""/>
+  </MACROS>
+  <OPTIONS>
+    <CFLAG1 value="-O2 -w -Vx -Ve -x- -RT- -X- -a8 -5 -b- -d -k- -vi -c -tW -tWM"/>
+    <PFLAGS value="-$Y- -$L- -$D- -$C- -v -JPHNE -M"/>
+    <AFLAGS value="/mx /w2 /zn"/>
+    <LFLAGS value=""/>
+  </OPTIONS>
+  <LINKER>
+    <ALLOBJ value="$(OBJFILES)"/>
+    <ALLLIB value=""/>
+  </LINKER>
+  <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=2057
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=8
+Item0=..\..\..\zlib;$(BCB)\include
+Item1=..\Source\ThirdParty\ZLibCompression\external;..\..\..\zlib;$(BCB)\include
+Item2=P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\include
+Item3=..\Source\ThirdParty\ZLibCompression\external;$(BCB)\include
+Item4=..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression\ext;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
+Item5=..\Source\ThirdParty\ZLibCompression;$(BCB)\include
+Item6=$(BCB)\include
+Item7=$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=7
+Item0=..\..\..\zlib;$(BCB)\lib\obj;$(BCB)\lib
+Item1=$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\Source\ThirdParty\ZLibCompression\external;..\..\..\zlib;$(BCB)\lib\obj;$(BCB)\lib
+Item3=P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\lib\obj;$(BCB)\lib
+Item4=..\Source\ThirdParty\ZLibCompression\external;$(BCB)\lib\obj;$(BCB)\lib
+Item5=..\Source\ThirdParty\ZLibCompression\external;..\Source\ThirdParty\ZLibCompression\ext;..\Source\ThirdParty\ZLibCompression;$(BCB)\lib\obj;$(BCB)\lib
+Item6=..\Source\ThirdParty\ZLibCompression;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=3
+Item0=Z_PREFIX
+Item1=ZLIB_DLL
+Item2=_WINDOWS;ZLIB_DLL
+
+[HistoryLists\hlIntOutputDir]
+Count=2
+Item0=..\Obj
+Item1=P:\Development\Obj
+
+[HistoryLists\hlTlibPageSize]
+Count=1
+Item0=0x0010
+
+[Debugging]
+DebugSourceDirs=
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+  </IDEOPTIONS>
+</PROJECT>
\ No newline at end of file
diff --git a/dll/msvc/README.txt b/projects/msvc/README.txt
similarity index 97%
rename from dll/msvc/README.txt
rename to projects/msvc/README.txt
index 932f721..56a1ca9 100644
--- a/dll/msvc/README.txt
+++ b/projects/msvc/README.txt
@@ -1,5 +1,5 @@
 Microsoft Developer Studio Build File, Format Version 6.00 for
-libpng 1.0.9beta1 (November 10, 2000) and zlib
+libpng 1.0.9beta10 (January 16, 2001) and zlib
 
 Copyright (C) 2000 Simon-Pierre Cadieux
 For conditions of distribution and use, see copyright notice in png.h
diff --git a/dll/msvc/libpng.dsp b/projects/msvc/libpng.dsp
similarity index 100%
rename from dll/msvc/libpng.dsp
rename to projects/msvc/libpng.dsp
diff --git a/dll/msvc/libpng.dsw b/projects/msvc/libpng.dsw
similarity index 100%
rename from dll/msvc/libpng.dsw
rename to projects/msvc/libpng.dsw
diff --git a/dll/msvc/png.rc b/projects/msvc/png.rc
similarity index 85%
rename from dll/msvc/png.rc
rename to projects/msvc/png.rc
index dc21c2b..b9ef2d6 100644
--- a/dll/msvc/png.rc
+++ b/projects/msvc/png.rc
@@ -50,13 +50,27 @@
 #  define VS_SPECIALBUILD 0
 #endif /* SPECIALBUILD */
 
+#if ((PNG_LIBPNG_BUILD_TYPE & PNG_LIBPNG_BUILD_TYPEMASK) != \
+      PNG_LIBPNG_BUILD_STABLE)
+#  define VS_PRERELEASE VS_FF_PRERELEASE
+#  define VS_PATCHED 0
+#else
+#  define VS_PRERELEASE 0
+#  if (PNG_LIBPNG_BUILD_TYPE & PNG_LIBPNG_BUILD_PATCHED)
+#    define VS_PATCHED VS_FF_PATCHED
+#  else
+#    define VS_PATCHED 0
+#  endif
+#endif
+
 VS_VERSION_INFO VERSIONINFO 
 FILEVERSION PNG_LIBPNG_VER_MAJOR, PNG_LIBPNG_VER_MINOR, PNG_LIBPNG_VER_RELEASE, PNG_LIBPNG_VER_BUILD
 PRODUCTVERSION PNG_LIBPNG_VER_MAJOR, PNG_LIBPNG_VER_MINOR, PNG_LIBPNG_VER_RELEASE, PNG_LIBPNG_VER_BUILD
 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-FILEFLAGS VS_DEBUG | VS_PRIVATEBUILD | VS_SPECIALBUILD
+FILEFLAGS VS_DEBUG | VS_PRIVATEBUILD | VS_SPECIALBUILD | VS_PRERELEASE | VS_PATCHED
 FILEOS VOS__WINDOWS32
 FILETYPE VFT_DLL
+FILESUBTYPE VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN BLOCK "040904E4" /* Language type = U.S English(0x0409) and Character Set = Windows, Multilingual(0x04E4) */
diff --git a/dll/msvc/png32ms.def b/projects/msvc/png32ms.def
similarity index 96%
rename from dll/msvc/png32ms.def
rename to projects/msvc/png32ms.def
index 685e41c..a5c41f9 100644
--- a/dll/msvc/png32ms.def
+++ b/projects/msvc/png32ms.def
@@ -6,7 +6,7 @@
 DESCRIPTION "PNG image compression library for Windows"
 
 EXPORTS
-;Version 1.0.9beta1
+;Version 1.0.9beta10
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
@@ -176,3 +176,8 @@
   png_write_init_2    @167
   png_access_version_number  @168
 ;  png_sig_bytes    @169
+;  png_libpng_ver    @170
+  png_init_io    @171
+  png_convert_to_rfc1123     @172
+  png_set_invalid  @173
+  png_mmx_support  @174
diff --git a/dll/msvc/zlib.def b/projects/msvc/zlib.def
similarity index 100%
rename from dll/msvc/zlib.def
rename to projects/msvc/zlib.def
diff --git a/dll/msvc/zlib.dsp b/projects/msvc/zlib.dsp
similarity index 100%
rename from dll/msvc/zlib.dsp
rename to projects/msvc/zlib.dsp
diff --git a/dll/wince/READMEE.WCE b/projects/wince/READMEE.WCE
similarity index 79%
rename from dll/wince/READMEE.WCE
rename to projects/wince/READMEE.WCE
index e314c34..129c517 100644
--- a/dll/wince/READMEE.WCE
+++ b/projects/wince/READMEE.WCE
@@ -8,9 +8,9 @@
 
 Introduction
 ============
-This is libpng 1.0.9beta1 ported to WindowsCE 2.0 and 2.11.
-libpng 1.0.9beta1 is a PNG reference library.
-See README, a document of original libpng 1.0.9beta1.
+This is libpng 1.0.9beta10 ported to WindowsCE 2.0 and 2.11.
+libpng 1.0.9beta10 is a PNG reference library.
+See README, a document of original libpng 1.0.9beta10.
 
 zlib for WindowsCE
 ==================
@@ -23,7 +23,7 @@
 warranty.  In no event will the authors be held liable for any damages
 arising from the use of this software.
 
-See README and LICENSE, documents of original libpng 1.0.9beta1, for conditions
+See README and LICENSE, documents of original libpng 1.0.9beta10, for conditions
 of use and distribution.
 
 Files
diff --git a/dll/wince/READMEJ.WCE b/projects/wince/READMEJ.WCE
similarity index 98%
rename from dll/wince/READMEJ.WCE
rename to projects/wince/READMEJ.WCE
index 41e9a33..42c74a3 100644
--- a/dll/wince/READMEJ.WCE
+++ b/projects/wince/READMEJ.WCE
@@ -24,7 +24,7 @@
 ‚É‚È‚Á‚½‚¢‚©‚È‚é”íŠQ‚ɂ‚¢‚Ä‚àAìŽÒA”z•zŽÒA‚»‚Ì‘¼—˜—pŽÒˆÈŠO‚̐l•¨A
 ’c‘̂ɐӔC‚ð‚Æ‚é‹`–±‚Í‚È‚¢‚à‚Ì‚Æ‚µ‚Ü‚·B
 
-‚»‚Ì‘¼A‚±‚̃\ƒtƒgƒEƒFƒA‚Ì—˜—pðŒ‚ɂ‚¢‚ẮAŒ´”Å‚Å‚ ‚é libpng 1.0.9beta1‚É
+‚»‚Ì‘¼A‚±‚̃\ƒtƒgƒEƒFƒA‚Ì—˜—pðŒ‚ɂ‚¢‚ẮAŒ´”Å‚Å‚ ‚é libpng 1.0.9beta10‚É
 €‹’‚·‚é‚à‚Ì‚Æ‚µ‚Ü‚·BÚ‚µ‚­‚́A•t‘®‚Ì README,LICENSE ‚ð‚¨“Ç‚Ý‚­‚¾‚³‚¢B
 
 Žû˜^“à—e
diff --git a/dll/wince/READMEZE.WCE b/projects/wince/READMEZE.WCE
similarity index 100%
rename from dll/wince/READMEZE.WCE
rename to projects/wince/READMEZE.WCE
diff --git a/dll/wince/READMEZJ.WCE b/projects/wince/READMEZJ.WCE
similarity index 100%
rename from dll/wince/READMEZJ.WCE
rename to projects/wince/READMEZJ.WCE
diff --git a/projects/wince/grep b/projects/wince/grep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/wince/grep
diff --git a/dll/wince/lpngce.dsp b/projects/wince/lpngce.dsp
similarity index 93%
rename from dll/wince/lpngce.dsp
rename to projects/wince/lpngce.dsp
index b3a0b3d..7a24bcf 100644
--- a/dll/wince/lpngce.dsp
+++ b/projects/wince/lpngce.dsp
@@ -569,7 +569,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -583,7 +582,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -596,7 +594,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -607,7 +604,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -619,7 +615,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -631,7 +626,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -643,7 +637,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -655,7 +648,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -667,7 +659,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -679,7 +670,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -691,7 +681,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -703,7 +692,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -715,7 +703,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -727,7 +714,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -739,7 +725,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -751,7 +736,6 @@
 
 DEP_CPP_PNG_C=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNG_C=\
@@ -774,7 +758,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -788,7 +771,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -801,7 +783,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -812,7 +793,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -824,7 +804,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -836,7 +815,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -848,7 +826,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -860,7 +837,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -872,7 +848,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -884,7 +859,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -896,7 +870,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -908,7 +881,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -920,7 +892,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -932,7 +903,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -944,7 +914,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -956,7 +925,6 @@
 
 DEP_CPP_PNGER=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGER=\
@@ -975,7 +943,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -989,7 +956,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1002,7 +968,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1013,7 +978,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1025,7 +989,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1037,7 +1000,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1049,7 +1011,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1061,7 +1022,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1073,7 +1033,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1085,7 +1044,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1097,7 +1055,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1109,7 +1066,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1121,7 +1077,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1133,7 +1088,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1145,7 +1099,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1157,7 +1110,6 @@
 
 DEP_CPP_PNGGC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGC=\
@@ -1176,7 +1128,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1190,7 +1141,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1203,7 +1153,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1214,7 +1163,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1226,7 +1174,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1238,7 +1185,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1250,7 +1196,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1262,7 +1207,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1274,7 +1218,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1286,7 +1229,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1298,7 +1240,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1310,7 +1251,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1322,7 +1262,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1334,7 +1273,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1346,7 +1284,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1358,7 +1295,6 @@
 
 DEP_CPP_PNGGE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGGE=\
@@ -1377,7 +1313,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1391,7 +1326,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1404,7 +1338,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1415,7 +1348,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1427,7 +1359,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1439,7 +1370,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1451,7 +1381,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1463,7 +1392,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1475,7 +1403,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1487,7 +1414,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1499,7 +1425,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1511,7 +1436,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1523,7 +1447,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1535,7 +1458,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1547,7 +1469,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1559,7 +1480,6 @@
 
 DEP_CPP_PNGME=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGME=\
@@ -1578,7 +1498,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1592,7 +1511,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1605,7 +1523,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1616,7 +1533,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1628,7 +1544,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1640,7 +1555,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1652,7 +1566,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1664,7 +1577,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1676,7 +1588,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1688,7 +1599,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1700,7 +1610,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1712,7 +1621,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1724,7 +1632,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1736,7 +1643,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1748,7 +1654,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1760,7 +1665,6 @@
 
 DEP_CPP_PNGPR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGPR=\
@@ -1779,7 +1683,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1793,7 +1696,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1806,7 +1708,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1817,7 +1718,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1829,7 +1729,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1841,7 +1740,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1853,7 +1751,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1865,7 +1762,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1877,7 +1773,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1889,7 +1784,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1901,7 +1795,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1913,7 +1806,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1925,7 +1817,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1937,7 +1828,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1949,7 +1839,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1961,7 +1850,6 @@
 
 DEP_CPP_PNGRE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRE=\
@@ -1980,7 +1868,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -1994,7 +1881,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2007,7 +1893,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2018,7 +1903,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2030,7 +1914,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2042,7 +1925,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2054,7 +1936,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2066,7 +1947,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2078,7 +1958,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2090,7 +1969,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2102,7 +1980,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2114,7 +1991,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2126,7 +2002,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2138,7 +2013,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2150,7 +2024,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2162,7 +2035,6 @@
 
 DEP_CPP_PNGRI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRI=\
@@ -2181,7 +2053,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2195,7 +2066,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2208,7 +2078,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2219,7 +2088,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2231,7 +2099,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2243,7 +2110,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2255,7 +2121,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2267,7 +2132,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2279,7 +2143,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2291,7 +2154,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2303,7 +2165,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2315,7 +2176,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2327,7 +2187,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2339,7 +2198,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2351,7 +2209,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2363,7 +2220,6 @@
 
 DEP_CPP_PNGRT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRT=\
@@ -2382,7 +2238,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2396,7 +2251,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2409,7 +2263,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2420,7 +2273,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2432,7 +2284,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2444,7 +2295,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2456,7 +2306,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2468,7 +2317,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2480,7 +2328,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2492,7 +2339,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2504,7 +2350,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2516,7 +2361,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2528,7 +2372,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2540,7 +2383,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2552,7 +2394,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2564,7 +2405,6 @@
 
 DEP_CPP_PNGRU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGRU=\
@@ -2583,7 +2423,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2597,7 +2436,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2610,7 +2448,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2621,7 +2458,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2633,7 +2469,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2645,7 +2480,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2657,7 +2491,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2669,7 +2502,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2681,7 +2513,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2693,7 +2524,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2705,7 +2535,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2717,7 +2546,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2729,7 +2557,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2741,7 +2568,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2753,7 +2579,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2765,7 +2590,6 @@
 
 DEP_CPP_PNGSE=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGSE=\
@@ -2784,7 +2608,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2798,7 +2621,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2811,7 +2633,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2822,7 +2643,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2834,7 +2654,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2846,7 +2665,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2858,7 +2676,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2870,7 +2687,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2882,7 +2698,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2894,7 +2709,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2906,7 +2720,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2918,7 +2731,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2930,7 +2742,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2942,7 +2753,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2954,7 +2764,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2966,7 +2775,6 @@
 
 DEP_CPP_PNGTR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTR=\
@@ -2985,7 +2793,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -2999,7 +2806,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3012,7 +2818,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3023,7 +2828,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3035,7 +2839,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3047,7 +2850,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3059,7 +2861,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3071,7 +2872,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3083,7 +2883,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3095,7 +2894,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3107,7 +2905,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3119,7 +2916,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3131,7 +2927,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3143,7 +2938,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3155,7 +2949,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3167,7 +2960,6 @@
 
 DEP_CPP_PNGVC=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGVC=\
@@ -3186,7 +2978,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3200,7 +2991,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3213,7 +3003,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3224,7 +3013,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3236,7 +3024,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3248,7 +3035,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3260,7 +3046,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3272,7 +3057,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3284,7 +3068,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3296,7 +3079,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3308,7 +3090,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3320,7 +3101,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3332,7 +3112,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3344,7 +3123,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3356,7 +3134,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3368,7 +3145,6 @@
 
 DEP_CPP_PNGWI=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWI=\
@@ -3387,7 +3163,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3401,7 +3176,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3414,7 +3188,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3425,7 +3198,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3437,7 +3209,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3449,7 +3220,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3461,7 +3231,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3473,7 +3242,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3485,7 +3253,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3497,7 +3264,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3509,7 +3275,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3521,7 +3286,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3533,7 +3297,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3545,7 +3308,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3557,7 +3319,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3569,7 +3330,6 @@
 
 DEP_CPP_PNGWR=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWR=\
@@ -3588,7 +3348,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3602,7 +3361,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3615,7 +3373,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3626,7 +3383,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3638,7 +3394,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3650,7 +3405,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3662,7 +3416,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3674,7 +3427,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3686,7 +3438,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3698,7 +3449,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3710,7 +3460,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3722,7 +3471,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3734,7 +3482,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3746,7 +3493,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3758,7 +3504,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3770,7 +3515,6 @@
 
 DEP_CPP_PNGWT=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWT=\
@@ -3789,7 +3533,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3803,7 +3546,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3816,7 +3558,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3827,7 +3568,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3839,7 +3579,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3851,7 +3590,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3863,7 +3601,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3875,7 +3612,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3887,7 +3623,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3899,7 +3634,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3911,7 +3645,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3923,7 +3656,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3935,7 +3667,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3947,7 +3678,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3959,7 +3689,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3971,7 +3700,6 @@
 
 DEP_CPP_PNGWU=\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGWU=\
@@ -3992,10 +3720,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\pngasmrd.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\pngconf.h
 # End Source File
 # End Group
diff --git a/dll/wince/lpngce.dsw b/projects/wince/lpngce.dsw
similarity index 100%
rename from dll/wince/lpngce.dsw
rename to projects/wince/lpngce.dsw
diff --git a/dll/wince/png32ce.def b/projects/wince/png32ce.def
similarity index 98%
rename from dll/wince/png32ce.def
rename to projects/wince/png32ce.def
index 8f13791..c0adf3e 100644
--- a/dll/wince/png32ce.def
+++ b/projects/wince/png32ce.def
@@ -5,7 +5,7 @@
 LIBRARY lpngce
 
 EXPORTS
-;Version 1.0.9beta1
+;Version 1.0.9beta10
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
@@ -178,3 +178,5 @@
   png_libpng_ver    @170
   png_init_io    @171
   png_convert_to_rfc1123     @172
+  png_set_invalid  @173
+  png_mmx_support  @174
diff --git a/dll/wince/pngtest.dsp b/projects/wince/pngtest.dsp
similarity index 98%
rename from dll/wince/pngtest.dsp
rename to projects/wince/pngtest.dsp
index 4d1da2d..5ade500 100644
--- a/dll/wince/pngtest.dsp
+++ b/projects/wince/pngtest.dsp
@@ -571,7 +571,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -584,7 +583,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -597,7 +595,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -610,7 +607,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -623,7 +619,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -636,7 +631,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -649,7 +643,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -662,7 +655,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -675,7 +667,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -688,7 +679,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -701,7 +691,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -714,7 +703,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -727,7 +715,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -740,7 +727,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -753,7 +739,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
@@ -766,7 +751,6 @@
 	"..\..\..\zlib\zconf.h"\
 	"..\..\..\zlib\zlib.h"\
 	"..\..\png.h"\
-	"..\..\pngasmrd.h"\
 	"..\..\pngconf.h"\
 	
 NODEP_CPP_PNGTE=\
diff --git a/dll/wince/pngtest.dsw b/projects/wince/pngtest.dsw
similarity index 100%
rename from dll/wince/pngtest.dsw
rename to projects/wince/pngtest.dsw
diff --git a/dll/wince/winmain.c b/projects/wince/winmain.c
similarity index 100%
rename from dll/wince/winmain.c
rename to projects/wince/winmain.c
diff --git a/dll/wince/zlib.diff b/projects/wince/zlib.diff
similarity index 100%
rename from dll/wince/zlib.diff
rename to projects/wince/zlib.diff
diff --git a/dll/wince/zlibce.def b/projects/wince/zlibce.def
similarity index 100%
rename from dll/wince/zlibce.def
rename to projects/wince/zlibce.def
diff --git a/dll/wince/zlibce.dsp b/projects/wince/zlibce.dsp
similarity index 100%
rename from dll/wince/zlibce.dsp
rename to projects/wince/zlibce.dsp
diff --git a/scripts/makefile.acorn b/scripts/makefile.acorn
index 504a17f..470cf89 100644
--- a/scripts/makefile.acorn
+++ b/scripts/makefile.acorn
@@ -2,40 +2,40 @@
 
 
 # Toolflags:
-CCflags = -c -depend !Depend -IC:,Zlib: -g -throwback  -DRISCOS  -fnah 
+CCflags = -c -depend !Depend -IC:,Zlib: -g -throwback  -DRISCOS  -fnah
 C++flags = -c -depend !Depend -IC: -throwback
 Linkflags = -aif -c++ -o $@
 ObjAsmflags = -throwback -NoCache -depend !Depend
 CMHGflags = 
-LibFileflags = -c -l -o $@ 
+LibFileflags = -c -l -o $@
 Squeezeflags = -o $@
 
 
 # Final targets:
 @.libpng-lib:   @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
 	@.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \
-	@.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil 
+	@.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
 	LibFile $(LibFileflags) @.o.png @.o.pngerror @.o.pngrio @.o.pngrtran \
 	@.o.pngmem @.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngwio \
-	@.o.pngrutil @.o.pngtrans  @.o.pngwrite @.o.pngwtran @.o.pngwutil 
+	@.o.pngrutil @.o.pngtrans  @.o.pngwrite @.o.pngwtran @.o.pngwutil
 @.mm-libpng-lib:   @.mm.png @.mm.pngerror @.mm.pngrio @.mm.pngwio @.mm.pngmem \
 	@.mm.pngpread @.mm.pngset @.mm.pngget @.mm.pngread @.mm.pngrtran \
-	@.mm.pngrutil @.mm.pngtrans @.mm.pngwrite @.mm.pngwtran @.mm.pngwutil 
+	@.mm.pngrutil @.mm.pngtrans @.mm.pngwrite @.mm.pngwtran @.mm.pngwutil
 	LibFile $(LibFileflags) @.mm.png @.mm.pngerror @.mm.pngrio \
 	@.mm.pngwio @.mm.pngmem @.mm.pngpread @.mm.pngset @.mm.pngget \
 	@.mm.pngread @.mm.pngrtran @.mm.pngrutil @.mm.pngtrans @.mm.pngwrite \
-	@.mm.pngwtran @.mm.pngwutil 
+	@.mm.pngwtran @.mm.pngwutil
 
 
 # User-editable dependencies:
 # (C) Copyright 1997 Tom Tanner
-Test: @.pngtest 
+Test: @.pngtest
 	<Prefix$Dir>.pngtest
 	@remove <Prefix$Dir>.pngtest
 
 #It would be nice if you could stop "make" listing from here on!
-@.pngtest:   @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib 
-	Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib 
+@.pngtest:   @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
+	Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
 
 .SUFFIXES: .o .mm .c
 
diff --git a/scripts/makefile.aix b/scripts/makefile.aix
new file mode 100644
index 0000000..40ad862
--- /dev/null
+++ b/scripts/makefile.aix
@@ -0,0 +1,84 @@
+# makefile for libpng using gcc (generic, static library)
+# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
+# Copyright (C) 2000 Cosmin Truta
+# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
+# For conditions of distribution and use, see copyright notice in png.h
+
+# Location of the zlib library and include files
+ZLIBINC = ../zlib
+ZLIBLIB = ../zlib
+
+# Compiler, linker, lib and other tools
+CC = gcc
+LD = $(CC)
+AR = ar rcs
+RANLIB = ranlib
+RM = rm -f
+
+# read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
+# have to change it.
+PNGMAJ = 2
+PNGMIN = 1.0.9beta10
+PNGVER = $(PNGMAJ).$(PNGMIN)
+
+prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+
+CDEBUG = -g -DPNG_DEBUG=5
+LDDEBUG =
+CRELEASE = -O2
+LDRELEASE = -s
+CFLAGS = -I$(ZLIBINC) -Wall $(CRELEASE)
+LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm $(LDRELEASE)
+
+# File extensions
+O=.o
+A=.a
+E=
+
+# Variables
+OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
+	pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
+	pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
+
+# Targets
+all: libpng$(A) pngtest$(E)
+
+libpng$(A): $(OBJS)
+	$(AR) $@ $(OBJS)
+	$(RANLIB) $@
+
+test: pngtest$(E)
+	./pngtest$(E)
+
+pngtest$(E): pngtest$(O) libpng$(A)
+	$(LD) -o $@ pngtest$(O) $(LDFLAGS)
+
+install: libpng.a
+	-@if [ ! -d $(INCPATH)  ]; then mkdir $(INCPATH); fi
+	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
+	cp png.h pngconf.h $(INCPATH)
+	chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
+	cp libpng.a $(LIBPATH)
+
+clean:
+	/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
+
+png$(O): png.h pngconf.h
+pngerror$(O): png.h pngconf.h
+pngget$(O): png.h pngconf.h
+pngmem$(O): png.h pngconf.h
+pngpread$(O): png.h pngconf.h
+pngread$(O): png.h pngconf.h
+pngrio$(O): png.h pngconf.h
+pngrtran$(O): png.h pngconf.h
+pngrutil$(O): png.h pngconf.h
+pngset$(O): png.h pngconf.h
+pngtest$(O): png.h pngconf.h
+pngtrans$(O): png.h pngconf.h
+pngwio$(O): png.h pngconf.h
+pngwrite$(O): png.h pngconf.h
+pngwtran$(O): png.h pngconf.h
+pngwutil$(O): png.h pngconf.h
+
diff --git a/scripts/makefile.amiga b/scripts/makefile.amiga
index 4587088..79cb424 100644
--- a/scripts/makefile.amiga
+++ b/scripts/makefile.amiga
@@ -14,7 +14,7 @@
 #          So use V6.55 or set NOOPTGO!!!!!!!!!
 CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\
 	OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 INCLUDEDIR=$(ZLIB) \
-	DEFINE=PNG_INTERNAL 
+	DEFINE=PNG_INTERNAL
 #linker flags
 LDFLAGS= SD ND BATCH
 #link libs
diff --git a/scripts/makefile.bd32 b/scripts/makefile.bd32
index bc7e193..92a57ab 100644
--- a/scripts/makefile.bd32
+++ b/scripts/makefile.bd32
@@ -21,7 +21,7 @@
 
 CC=bcc32
 CFLAGS= -ps -O2 -N- -k- -d -r- -w-par -w-aus -I$(ZLIBDIR) \
-  -DPNG_NO_GLOBAL_ARRAYS #-DPNG_DEBUG=5
+	-DPNG_NO_GLOBAL_ARRAYS #-DPNG_DEBUG=5
 #LINK=tlink32
 #LINK=ilink32
 LINK=bcc32
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index 3893f2e..cd96e65 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -31,7 +31,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a, libpng.so*, and png.h
diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin
index 3b9e8ba..3fa5aa5 100644
--- a/scripts/makefile.cygwin
+++ b/scripts/makefile.cygwin
@@ -2,7 +2,7 @@
 #   builds both dll (with import lib) and static lib versions
 #   of the library, and builds two copies of pngtest: one
 #   statically linked and one dynamically linked.
-#   
+#
 #   based on makefile for linux-elf w/mmx by:
 # Copyright (C) 1998-2000 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
@@ -13,7 +13,7 @@
 
 CC=gcc
 
-# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
+# where "make install" puts libpng.a, libpng.so*, png.h, and pngconf.h
 prefix=/usr
 
 # Where the zlib library and include files are located
@@ -33,12 +33,13 @@
 #CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
 #        -fomit-frame-pointer  # $(WARNMORE) -g -DPNG_DEBUG=5
 CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
-        -fomit-frame-pointer 
+	-fomit-frame-pointer
 
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
+PNGMIN_BASE = 1.0.9
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 SHAREDLIB=cygpng$(PNGMAJ).dll
@@ -60,7 +61,7 @@
 BINPATH=$(prefix)/bin
 MANPATH=$(prefix)/man
 MAN3PATH=$(MANPATH)/man3
-DOCPATH=$(prefix)/doc/libpng-$(PNGMIN)
+DOCPATH=$(prefix)/doc/libpng-$(PNGMIN_BASE)
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -86,14 +87,14 @@
 
 all-shared: $(SHAREDLIB) pngtest$(EXE)
 
-pnggccrd.o:	png.h pngconf.h pngasmrd.h
+pnggccrd.o:	png.h pngconf.h
 	@echo ""
 	@echo '    You can ignore the single "control reaches end of non-void function"'
 	@echo '    warning and multiple "<variable> defined but not used" warnings:'
 	@echo ""
 	$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $*.c
 
-pnggccrd.pic.o:	png.h pngconf.h pngasmrd.h
+pnggccrd.pic.o:	png.h pngconf.h
 	@echo ""
 	@echo '    You can ignore the single "control reaches end of non-void function"'
 	@echo '    warning and multiple "<variable> defined but not used" warnings:'
@@ -108,7 +109,7 @@
 	cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' > $@
 
 $(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
-	$(LDSHARED) -o $@ $(LDEXTRA) $(OBJSDLL) -L. -L$(ZLIBLIB) -lz 
+	$(LDSHARED) -o $@ $(LDEXTRA) $(OBJSDLL) -L. -L$(ZLIBLIB) -lz
 
 pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
 	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
@@ -132,7 +133,7 @@
 
 install: install-static install-shared
 
-install-static: $(STATLIB) install-headers install-docs install-man 
+install-static: $(STATLIB) install-headers install-docs install-man
 	-@if [ ! -d $(LIBPATH) ]; then mkdir -p $(LIBPATH); fi
 	install -m 755 $(STATLIB) $(LIBPATH)
 
@@ -164,7 +165,7 @@
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
-png.o png.pic.o:		png.h pngconf.h png.c pngasmrd.h
+png.o png.pic.o:		png.h pngconf.h png.c
 pngerror.o pngerror.pic.o:	png.h pngconf.h pngerror.c
 pngrio.o pngrio.pic.o:		png.h pngconf.h pngrio.c
 pngwio.o pngwio.pic.o:		png.h pngconf.h pngwio.c
@@ -173,7 +174,7 @@
 pngget.o pngget.pic.o:		png.h pngconf.h pngget.c
 pngread.o pngread.pic.o:	png.h pngconf.h pngread.c
 pngrtran.o pngrtran.pic.o:	png.h pngconf.h pngrtran.c
-pngrutil.o pngrutil.pic.o:	png.h pngconf.h pngrutil.c pngasmrd.h
+pngrutil.o pngrutil.pic.o:	png.h pngconf.h pngrutil.c
 pngtrans.o pngtrans.pic.o:	png.h pngconf.h pngtrans.c
 pngwrite.o pngwrite.pic.o:	png.h pngconf.h pngwrite.c
 pngwtran.o pngwtran.pic.o:	png.h pngconf.h pngwtran.c
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index 91f4540..136f0b7 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -17,7 +17,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=cc
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index f97b2ff..0001f57 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -1,13 +1,17 @@
 # makefile for libpng on Linux ELF with gcc using MMX assembler code
 # Copyright 1996-1997 Andreas Dilger
-# Copyright 1998-2000 Greg Roelofs
+# Copyright 1998-2001 Greg Roelofs
 # For conditions of distribution and use, see copyright notice in png.h
 
 # CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier.
 
+# NOTE:  When testing MMX performance on a multitasking system, make sure
+#        there are no floating-point programs (e.g., SETI@Home) running in
+#        the background!  Context switches between MMX and FPU are expensive.
+
 CC=gcc
 
-# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
+# where "make install" puts libpng.a, libpng.so*, png.h, and pngconf.h
 prefix=/usr/local
 
 # Where the zlib library and include files are located
@@ -26,8 +30,18 @@
 
 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
 
+### for generic gcc:
 CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
-        -fomit-frame-pointer  # $(WARNMORE) -g -DPNG_DEBUG=5
+	-fomit-frame-pointer  # $(WARNMORE) -g -DPNG_DEBUG=5
+### for gcc 2.95.2 on 686:
+#CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \
+#	-mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \
+#	$(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer 
+### for gcc 2.7.2.3 on 486 and up:
+#CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \
+#	-m486 -malign-double -ffast-math \
+#	$(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer 
+
 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
 
@@ -37,7 +51,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
@@ -56,19 +70,21 @@
 
 all: libpng.a libpng.so pngtest pngtest-static
 
-pnggccrd.o:	pnggccrd.c png.h pngconf.h pngasmrd.h
+pnggccrd.o:	pnggccrd.c png.h pngconf.h
 	@echo ""
 	@echo '    You can ignore the single "control reaches end of non-void function"'
 	@echo '    warning and multiple "<variable> defined but not used" warnings:'
 	@echo ""
 	$(CC) -c $(CFLAGS) -o $@ $*.c
+	@echo ""
 
-pnggccrd.pic.o:	pnggccrd.c png.h pngconf.h pngasmrd.h
+pnggccrd.pic.o:	pnggccrd.c png.h pngconf.h
 	@echo ""
 	@echo '    You can ignore the single "control reaches end of non-void function"'
 	@echo '    warning and multiple "<variable> defined but not used" warnings:'
 	@echo ""
 	$(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
+	@echo ""
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
@@ -118,7 +134,7 @@
 writelock:
 	chmod a-w *.[ch35] $(DOCS) scripts/*
 
-png.o png.pic.o:		png.h pngconf.h png.c pngasmrd.h
+png.o png.pic.o:		png.h pngconf.h png.c
 pngerror.o pngerror.pic.o:	png.h pngconf.h pngerror.c
 pngrio.o pngrio.pic.o:		png.h pngconf.h pngrio.c
 pngwio.o pngwio.pic.o:		png.h pngconf.h pngwio.c
@@ -127,7 +143,7 @@
 pngget.o pngget.pic.o:		png.h pngconf.h pngget.c
 pngread.o pngread.pic.o:	png.h pngconf.h pngread.c
 pngrtran.o pngrtran.pic.o:	png.h pngconf.h pngrtran.c
-pngrutil.o pngrutil.pic.o:	png.h pngconf.h pngrutil.c pngasmrd.h
+pngrutil.o pngrutil.pic.o:	png.h pngconf.h pngrutil.c
 pngtrans.o pngtrans.pic.o:	png.h pngconf.h pngtrans.c
 pngwrite.o pngwrite.pic.o:	png.h pngconf.h pngwrite.c
 pngwtran.o pngwtran.pic.o:	png.h pngconf.h pngwtran.c
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index f13a014..d692a25 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -18,7 +18,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a and png.h
diff --git a/scripts/makefile.intel b/scripts/makefile.intel
index b552263..1cabe77 100644
--- a/scripts/makefile.intel
+++ b/scripts/makefile.intel
@@ -42,9 +42,9 @@
 
 O=.obj
 
-OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)\
-     pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)\
-     pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O)
+OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O) \
+pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O) \
+pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O)
 
 
 all: test
@@ -70,7 +70,7 @@
 pngrutil$(O): png.h pngconf.h
 	$(CC) $(CFLAGS) $*.c $(ERRFILE)
 
-pngvcrd$(O): png.h pngconf.h pngasmrd.h
+pngvcrd$(O): png.h pngconf.h
 	$(CC) $(CFLAGS) $*.c $(ERRFILE)
 
 pngerror$(O): png.h pngconf.h
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index 3512bfb..fcf78df 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -34,7 +34,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.macosx b/scripts/makefile.macosx
new file mode 100644
index 0000000..093ea77
--- /dev/null
+++ b/scripts/makefile.macosx
@@ -0,0 +1,72 @@
+# makefile for libpng, MACOS X
+# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
+# For conditions of distribution and use, see copyright notice in png.h
+
+# where make install puts libpng.a and png.h
+prefix=/usr/local
+
+# Where the zlib library and include files are located
+#ZLIBLIB=/usr/local/lib
+#ZLIBINC=/usr/local/include
+ZLIBLIB=../zlib
+ZLIBINC=../zlib
+
+CC=cc
+CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
+LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
+
+#RANLIB=echo
+RANLIB=ranlib
+
+OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
+	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
+	pngwtran.o pngmem.o pngerror.o pngpread.o
+
+all: libpng.a pngtest
+
+libpng.a: $(OBJS)
+	ar rc $@  $(OBJS)
+	$(RANLIB) $@
+
+pngtest: pngtest.o libpng.a
+	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
+
+test: pngtest
+	./pngtest
+
+install: libpng.a
+	-@mkdir $(prefix)/include
+	-@mkdir $(prefix)/lib
+	cp png.h $(prefix)/include
+	cp pngconf.h $(prefix)/include
+	chmod 644 $(prefix)/include/png.h
+	chmod 644 $(prefix)/include/pngconf.h
+	cp libpng.a $(prefix)/lib
+	chmod 644 $(prefix)/lib/libpng.a
+
+clean:
+	rm -f *.o libpng.a pngtest pngout.png
+
+DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
+writelock:
+	chmod a-w *.[ch35] $(DOCS) scripts/*
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+png.o: png.h pngconf.h
+pngerror.o: png.h pngconf.h
+pngrio.o: png.h pngconf.h
+pngwio.o: png.h pngconf.h
+pngmem.o: png.h pngconf.h
+pngset.o: png.h pngconf.h
+pngget.o: png.h pngconf.h
+pngread.o: png.h pngconf.h
+pngrtran.o: png.h pngconf.h
+pngrutil.o: png.h pngconf.h
+pngtest.o: png.h pngconf.h
+pngtrans.o: png.h pngconf.h
+pngwrite.o: png.h pngconf.h
+pngwtran.o: png.h pngconf.h
+pngwutil.o: png.h pngconf.h
+pngpread.o: png.h pngconf.h
+
diff --git a/scripts/makefile.msc b/scripts/makefile.msc
index 651281c..1cbfd91 100644
--- a/scripts/makefile.msc
+++ b/scripts/makefile.msc
@@ -9,7 +9,7 @@
 #-Ox generates bad code with MSC 5.1
 CC=cl
 LD=link
-LDFLAGS=/e/st:0x1500/noe 
+LDFLAGS=/e/st:0x1500/noe
 O=.obj
 
 #uncomment next to put error messages in a file
@@ -76,7 +76,7 @@
 	lib libpng $(OBJS2);
 	lib libpng $(OBJS3);
 
-pngtest.exe: pngtest.obj libpng.lib 
+pngtest.exe: pngtest.obj libpng.lib
 	$(LD) $(LDFLAGS) pngtest.obj,,,libpng.lib ..\zlib\zlib.lib ;
 
 test: pngtest.exe
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index dfbf813..83d5a3c 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -16,7 +16,7 @@
 ZLIBLIB=../zlib
 ZLIBINC=../zlib
 
-CFLAGS= -dy -belf -I$(ZLIBINC) -O3 
+CFLAGS= -dy -belf -I$(ZLIBINC) -O3
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 
 #RANLIB=ranlib
@@ -25,7 +25,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index 07ae805..7e59147 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -13,14 +13,14 @@
 
 CC=gcc
 
-WARNMORE=
-CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 # -g -DPNG_DEBUG=5
+WARNMORE= # -g -DPNG_DEBUG=5
+CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
 # zlib must also be compiled with n32
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 LDSHARED=gcc -shared
 
-VER=1.0.9beta1
-LIBS=libpng.so.1.0.9beta1
+VER=1.0.9beta10
+LIBS=libpng.so.1.0.9beta10
 SHAREDLIB=libpng.so
 libdir=$(prefix)/lib32
 
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 2a21411..fc77353 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -31,7 +31,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.9beta1
+PNGMIN = 1.0.9beta10
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.vcawin32 b/scripts/makefile.vcawin32
index 4c05ff4..812dd8f 100644
--- a/scripts/makefile.vcawin32
+++ b/scripts/makefile.vcawin32
@@ -46,10 +46,10 @@
 pngrtran$(O): png.h pngconf.h
 	$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
 
-pngrutil$(O): png.h pngconf.h pngasmrd.h
+pngrutil$(O): png.h pngconf.h
 	$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
 
-pngvcrd$(O): png.h pngconf.h pngasmrd.h
+pngvcrd$(O): png.h pngconf.h
 	$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
 
 pngerror$(O): png.h pngconf.h
@@ -84,7 +84,7 @@
 	del libpng.lib
 	lib /OUT:libpng.lib $(OBJS1) $(OBJS2) $(OBJS3)
 
-pngtest.exe: pngtest.obj libpng.lib 
+pngtest.exe: pngtest.obj libpng.lib
 	$(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib /OUT:pngtest.exe /SUBSYSTEM:CONSOLE
 
 test: pngtest.exe
diff --git a/scripts/makefile.vcwin32 b/scripts/makefile.vcwin32
index a2d8e27..64b762e 100644
--- a/scripts/makefile.vcwin32
+++ b/scripts/makefile.vcwin32
@@ -42,7 +42,7 @@
 pngrtran$(O): png.h pngconf.h
 	$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
 
-pngrutil$(O): png.h pngconf.h pngasmrd.h
+pngrutil$(O): png.h pngconf.h
 	$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
 
 pngerror$(O): png.h pngconf.h
@@ -77,7 +77,7 @@
 	del libpng.lib
 	lib /OUT:libpng.lib $(OBJS1) $(OBJS2) $(OBJS3)
 
-pngtest.exe: pngtest.obj libpng.lib 
+pngtest.exe: pngtest.obj libpng.lib
 	$(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib /OUT:pngtest.exe /SUBSYSTEM:CONSOLE
 
 test: pngtest.exe
diff --git a/scripts/makevms.com b/scripts/makevms.com
index 0037326..b9e3895 100644
--- a/scripts/makevms.com
+++ b/scripts/makevms.com
@@ -14,7 +14,7 @@
 $   set def [-.pngminus]
 $   @makevms
 $   set def [--]
-$   exit 
+$   exit
 $ endif
 $ Make = ""
 $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
@@ -54,7 +54,7 @@
 $  then
 $   dele pngtest.obj;*
 $   CALL MAKE png.OBJ "cc ''CCOPT' png" -
-	png.c png.h pngconf.h   
+	png.c png.h pngconf.h
 $   CALL MAKE pngpread.OBJ "cc ''CCOPT' pngpread" -
 					 pngpread.c png.h pngconf.h
 $   CALL MAKE pngset.OBJ "cc ''CCOPT' pngset" -
@@ -90,8 +90,8 @@
 $   write sys$output "Building pngtest..."
 $   CALL MAKE pngtest.OBJ "cc ''CCOPT' pngtest" -
 	pngtest.c png.h pngconf.h
-$   call make pngtest.exe - 
-	"LINK pngtest,libpng.olb/lib,''zlibsrc'libz.olb/lib" - 
+$   call make pngtest.exe -
+	"LINK pngtest,libpng.olb/lib,''zlibsrc'libz.olb/lib" -
 	pngtest.obj libpng.olb
 $   write sys$output "Testing Libpng..."
 $   run pngtest
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
index 7f0d5ad..b7bcdab 100644
--- a/scripts/pngdef.pas
+++ b/scripts/pngdef.pas
@@ -5,7 +5,7 @@
 interface
 
 const
-  PNG_LIBPNG_VER_STRING = '1.0.9beta1';
+  PNG_LIBPNG_VER_STRING = '1.0.9beta10';
   PNG_LIBPNG_VER        =  10009;
 
 type
@@ -209,7 +209,7 @@
   PNG_CRC_WARN_DISCARD = 2;  // (INVALID)           warn/discard data
   PNG_CRC_WARN_USE     = 3;  // warn/use data       warn/use data
   PNG_CRC_QUIET_USE    = 4;  // quiet/use data      quiet/use data
-  PNG_CRC_NO_CHANGE    = 5;  // use current value   use current value 
+  PNG_CRC_NO_CHANGE    = 5;  // use current value   use current value
 
 // Flags for png_set_filter() to say which filters to use.  The flags
 // are chosen so that they don't conflict with real filter types
@@ -241,7 +241,7 @@
   PNG_FILTER_HEURISTIC_DEFAULT    = 0;  // Currently "UNWEIGHTED"
   PNG_FILTER_HEURISTIC_UNWEIGHTED = 1;  // Used by libpng < 0.95
   PNG_FILTER_HEURISTIC_WEIGHTED   = 2;  // Experimental feature
-  PNG_FILTER_HEURISTIC_LAST       = 3;  // Not a valid value 
+  PNG_FILTER_HEURISTIC_LAST       = 3;  // Not a valid value
 
 procedure png_build_grayscale_palette(bit_depth: int; palette: png_colorp);
              stdcall;
@@ -340,7 +340,7 @@
              var unit_type: int): png_uint_32;
              stdcall;
 function png_get_sCAL(png_ptr: png_structp; info_ptr: png_infop;
-             var unit:int; var width: png_uint_32; height: png_uint_32): 
+             var unit:int; var width: png_uint_32; height: png_uint_32):
              png_uint_32;
              stdcall
 function png_get_pCAL(png_ptr: png_structp; info_ptr: png_infop;
@@ -373,7 +373,7 @@
              stdcall;
 function png_get_sRGB(png_ptr: png_structp; info_ptr: png_infop;
              var file_srgb_intent: int): png_uint_32;
-             stdcall; 
+             stdcall;
 function png_get_signature(png_ptr: png_structp; info_ptr: png_infop):
              png_bytep;
              stdcall;
diff --git a/scripts/pngos2.def b/scripts/pngos2.def
index dcb9a32..7d8841e 100644
--- a/scripts/pngos2.def
+++ b/scripts/pngos2.def
@@ -297,11 +297,11 @@
   png_pass_dsp_mask
 ; png_pass_width
 ; png_pass_height
-  png_get_iCCP 
+  png_get_iCCP
   png_get_sCAL
-  png_get_sPLT 
-  png_set_iCCP 
-  png_set_sPLT 
+  png_get_sPLT
+  png_set_iCCP
+  png_set_sPLT
   png_free_data
 
   png_IHDR
@@ -325,3 +325,6 @@
   png_tIME
   png_tRNS
   png_zTXt
+
+  png_mmx_supported
+  png_permit_empty_plte