[devel] Imported from libpng-1.5.4beta05.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 3d44665..b5ccabb 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.5.4beta04 - June 16, 2011
+Libpng 1.5.4beta05 - June 18, 2011
 
 This is not intended to be a public release.  It will be replaced
 within a few weeks by a public version or by another test version.
@@ -9,20 +9,20 @@
 Source files with LF line endings (for Unix/Linux) and with a
 "configure" script
 
-   1.5.4beta04.tar.xz (LZMA-compressed, recommended)
-   1.5.4beta04.tar.gz
-   1.5.4beta04.tar.bz2
+   1.5.4beta05.tar.xz (LZMA-compressed, recommended)
+   1.5.4beta05.tar.gz
+   1.5.4beta05.tar.bz2
 
 Source files with CRLF line endings (for Windows), without the
 "configure" script
 
-   lp154b04.7z  (LZMA-compressed, recommended)
-   lp154b04.zip
+   lp154b05.7z  (LZMA-compressed, recommended)
+   lp154b05.zip
 
 Other information:
 
-   1.5.4beta04-README.txt
-   1.5.4beta04-LICENSE.txt
+   1.5.4beta05-README.txt
+   1.5.4beta05-LICENSE.txt
 
 Changes since the last public release (1.5.2):
 
@@ -220,6 +220,11 @@
     not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built.
   Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8
 
+Version 1.5.4beta05 [June 18, 2011]
+  Renamed png_set_strip_16() to png_set_scale_16() and renamed
+    png_set_chop_16() to png_set_strip(16) in an attempt to minimize the
+    behavior changes between libpng14 and libpng15.
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/CHANGES b/CHANGES
index 5771845..87178a2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3483,6 +3483,11 @@
     not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built.
   Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8
 
+Version 1.5.4beta05 [June 18, 2011]
+  Renamed png_set_strip_16() to png_set_scale_16() and renamed
+    png_set_chop_16() to png_set_strip(16) in an attempt to minimize the
+    behavior changes between libpng14 and libpng15.
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/LICENSE b/LICENSE
index 193226a..6c8d4a9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,7 +10,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.4beta05, June 16, 2011, are
+libpng versions 1.2.6, August 15, 2004, through 1.5.4beta05, June 18, 2011, are
 Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
@@ -108,4 +108,4 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-June 16, 2011
+June 18, 2011
diff --git a/README b/README
index 6a349d9..3e57eb2 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.5.4beta05 - June 16, 2011 (shared library 15.0)
+README for libpng version 1.5.4beta05 - June 18, 2011 (shared library 15.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
diff --git a/contrib/gregbook/readpng.c b/contrib/gregbook/readpng.c
index 208a883..df42c30 100644
--- a/contrib/gregbook/readpng.c
+++ b/contrib/gregbook/readpng.c
@@ -231,8 +231,8 @@
         png_set_expand(png_ptr);
 #ifdef PNG_READ_16_TO_8_SUPPORTED
     if (bit_depth == 16)
-#  ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
-        png_set_chop_16(png_ptr);
+#  ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+        png_set_scale_16(png_ptr);
 #  else
         png_set_strip_16(png_ptr);
 #  endif
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index 785772d..b9746b7 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -313,8 +313,8 @@
         png_set_expand(png_ptr);
 #ifdef PNG_READ_16_TO_8_SUPPORTED
     if (bit_depth == 16)
-#  ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
-        png_set_chop_16(png_ptr);
+#  ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+        png_set_scale_16(png_ptr);
 #  else
         png_set_strip_16(png_ptr);
 #  endif
diff --git a/contrib/pngminim/decoder/pngusr.dfa b/contrib/pngminim/decoder/pngusr.dfa
index d9a1ff2..31260c9 100644
--- a/contrib/pngminim/decoder/pngusr.dfa
+++ b/contrib/pngminim/decoder/pngusr.dfa
@@ -37,4 +37,4 @@
 option STDIO on
 option READ_EXPAND on
 option READ_16_TO_8 on
-option READ_16_TO_8_ACCURATE_SCALE on
+option READ_STRIP_16_TO_8 on
diff --git a/contrib/pngminim/preader/pngusr.dfa b/contrib/pngminim/preader/pngusr.dfa
index 1551377..e5eae52 100644
--- a/contrib/pngminim/preader/pngusr.dfa
+++ b/contrib/pngminim/preader/pngusr.dfa
@@ -37,5 +37,5 @@
 option READ_GAMMA on
 option READ_EXPAND on
 option READ_16_TO_8 on
-option READ_CHOP_16_TO_8 on
+option READ_STRIP_16_TO_8 on
 option READ_GRAY_TO_RGB on
diff --git a/contrib/visupng/PngFile.c b/contrib/visupng/PngFile.c
index 5cab576..3998c6d 100644
--- a/contrib/visupng/PngFile.c
+++ b/contrib/visupng/PngFile.c
@@ -177,8 +177,8 @@
 
 #ifdef PNG_READ_16_TO_8_SUPPORTED
     if (iBitDepth == 16)
-#  ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
-        png_set_chop_16(png_ptr);
+#  ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+        png_set_scale_16(png_ptr);
 #  else
         png_set_strip_16(png_ptr);
 #  endif
diff --git a/libpng-manual.txt b/libpng-manual.txt
index 6e131ed..f36a615 100644
--- a/libpng-manual.txt
+++ b/libpng-manual.txt
@@ -1,6 +1,6 @@
 libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.5.4beta04 - June 16, 2011
+ libpng version 1.5.4beta05 - June 18, 2011
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.5.4beta04 - June 16, 2011
+ libpng versions 0.97, January 1998, through 1.5.4beta05 - June 18, 2011
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
 
@@ -847,12 +847,12 @@
 settings and API calls required are:
 
 8-bit values:
-   PNG_TRANSFORM_STRIP_16 | PNG_EXPAND
-   png_set_expand(png_ptr); png_set_strip_16(png_ptr);
+   PNG_TRANSFORM_SCALE_16 | PNG_EXPAND
+   png_set_expand(png_ptr); png_set_scale_16(png_ptr);
 
    If you must get exactly the same inaccurate results
    produced by default in versions prior to libpng-1.5.4,
-   use PNG_TRANSFORM_CHOP_16 and png_set_chop_16(png_ptr)
+   use PNG_TRANSFORM_STRIP_16 and png_set_strip_16(png_ptr)
    instead.
 
 16-bit values:
@@ -878,8 +878,10 @@
 you want to do are limited to the following set:
 
     PNG_TRANSFORM_IDENTITY      No transformation
-    PNG_TRANSFORM_STRIP_16      Strip 16-bit samples to
-                                8-bit
+    PNG_TRANSFORM_SCALE_16      Strip 16-bit samples to
+                                8-bit accurately
+    PNG_TRANSFORM_STRIP_16      Chop 16-bit samples to
+                                8-bit less accurately
     PNG_TRANSFORM_STRIP_ALPHA   Discard the alpha channel
     PNG_TRANSFORM_PACKING       Expand 1, 2 and 4-bit
                                 samples to bytes
@@ -1404,12 +1406,12 @@
 in RGB RGB RGB format unless png_set_filler() or png_set_add_alpha()
 is called to insert filler bytes, either before or after each RGB triplet.
 16-bit RGB data will be returned RRGGBB RRGGBB, with the most significant
-byte of the color value first, unless png_set_strip_16() is called to
+byte of the color value first, unless png_set_scale_16() is called to
 transform it to regular RGB RGB triplets, or png_set_filler() or
 png_set_add alpha() is called to insert filler bytes, either before or
 after each RRGGBB triplet.  Similarly, 8-bit or 16-bit grayscale data can
-be modified with
-png_set_filler(), png_set_add_alpha(), or png_set_strip_16().
+be modified with png_set_filler(), png_set_add_alpha(), png_set_strip_16(),
+or png_set_scale_16().
 
 The following code transforms grayscale images of less than 8 to 8 bits,
 changes paletted images to RGB, and adds a full alpha channel if there is
@@ -1446,7 +1448,7 @@
 8 bits per channel, this will strip the pixels down to 8-bit.
 
     if (bit_depth == 16)
-       png_set_strip_16(png_ptr);
+       png_set_scale_16(png_ptr);
 
 If you need to process the alpha channel on the image separately from the image
 data (for example if you convert it to a bitmap mask) it is possible to have
@@ -4103,13 +4105,10 @@
 
 Prior to libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
 option was off by default, and slightly inaccurate scaling occurred.
-This option can no longer be turned off, and 16-to-8 scaling is always
-accurate.  This change will result in some different results while
-reading 16-bit images, with none of the pixels being off-by-one any
-longer (see Clause 13.12 of the PNG specification).  If you must
-have exactly the same inaccurate results that libpng produced by
-default previously, then you can use the png_set_chop_16() API instead
-of png_set_strip_16().
+This option can no longer be turned off, and the choice of accurate
+or inaccurate 16-to-8 scaling is by using the new png_set_scale_16_to_8()
+API for accurate scaling or the old png_set_strip_16_to_8() API for simple
+chopping.
 
 Prior to libpng-1.5.4, the png_set_user_limits() function could only be
 used to reduce the width and height limits from the value of
@@ -4425,13 +4424,13 @@
 
 XIV. Y2K Compliance in libpng
 
-June 16, 2011
+June 18, 2011
 
 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.5.4beta04 are Y2K compliant.  It is my belief that earlier
+upward through 1.5.4beta05 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/libpng.3 b/libpng.3
index fcf40e0..634f21e 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "June 16, 2011"
+.TH LIBPNG 3 "June 18, 2011"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta04
+libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta05
 .SH SYNOPSIS
 \fI\fB
 
@@ -955,7 +955,7 @@
 .SH LIBPNG.TXT
 libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.5.4beta04 - June 16, 2011
+ libpng version 1.5.4beta05 - June 18, 2011
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -966,7 +966,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.5.4beta04 - June 16, 2011
+ libpng versions 0.97, January 1998, through 1.5.4beta05 - June 18, 2011
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2011 Glenn Randers-Pehrson
 
@@ -1802,12 +1802,12 @@
 settings and API calls required are:
 
 8-bit values:
-   PNG_TRANSFORM_STRIP_16 | PNG_EXPAND
-   png_set_expand(png_ptr); png_set_strip_16(png_ptr);
+   PNG_TRANSFORM_SCALE_16 | PNG_EXPAND
+   png_set_expand(png_ptr); png_set_scale_16(png_ptr);
 
    If you must get exactly the same inaccurate results
    produced by default in versions prior to libpng-1.5.4,
-   use PNG_TRANSFORM_CHOP_16 and png_set_chop_16(png_ptr)
+   use PNG_TRANSFORM_STRIP_16 and png_set_strip_16(png_ptr)
    instead.
 
 16-bit values:
@@ -1833,8 +1833,10 @@
 you want to do are limited to the following set:
 
     PNG_TRANSFORM_IDENTITY      No transformation
-    PNG_TRANSFORM_STRIP_16      Strip 16-bit samples to
-                                8-bit
+    PNG_TRANSFORM_SCALE_16      Strip 16-bit samples to
+                                8-bit accurately
+    PNG_TRANSFORM_STRIP_16      Chop 16-bit samples to
+                                8-bit less accurately
     PNG_TRANSFORM_STRIP_ALPHA   Discard the alpha channel
     PNG_TRANSFORM_PACKING       Expand 1, 2 and 4-bit
                                 samples to bytes
@@ -2359,12 +2361,12 @@
 in RGB RGB RGB format unless png_set_filler() or png_set_add_alpha()
 is called to insert filler bytes, either before or after each RGB triplet.
 16-bit RGB data will be returned RRGGBB RRGGBB, with the most significant
-byte of the color value first, unless png_set_strip_16() is called to
+byte of the color value first, unless png_set_scale_16() is called to
 transform it to regular RGB RGB triplets, or png_set_filler() or
 png_set_add alpha() is called to insert filler bytes, either before or
 after each RRGGBB triplet.  Similarly, 8-bit or 16-bit grayscale data can
-be modified with
-png_set_filler(), png_set_add_alpha(), or png_set_strip_16().
+be modified with png_set_filler(), png_set_add_alpha(), png_set_strip_16(),
+or png_set_scale_16().
 
 The following code transforms grayscale images of less than 8 to 8 bits,
 changes paletted images to RGB, and adds a full alpha channel if there is
@@ -2401,7 +2403,7 @@
 8 bits per channel, this will strip the pixels down to 8-bit.
 
     if (bit_depth == 16)
-       png_set_strip_16(png_ptr);
+       png_set_scale_16(png_ptr);
 
 If you need to process the alpha channel on the image separately from the image
 data (for example if you convert it to a bitmap mask) it is possible to have
@@ -5058,13 +5060,10 @@
 
 Prior to libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
 option was off by default, and slightly inaccurate scaling occurred.
-This option can no longer be turned off, and 16-to-8 scaling is always
-accurate.  This change will result in some different results while
-reading 16-bit images, with none of the pixels being off-by-one any
-longer (see Clause 13.12 of the PNG specification).  If you must
-have exactly the same inaccurate results that libpng produced by
-default previously, then you can use the png_set_chop_16() API instead
-of png_set_strip_16().
+This option can no longer be turned off, and the choice of accurate
+or inaccurate 16-to-8 scaling is by using the new png_set_scale_16_to_8()
+API for accurate scaling or the old png_set_strip_16_to_8() API for simple
+chopping.
 
 Prior to libpng-1.5.4, the png_set_user_limits() function could only be
 used to reduce the width and height limits from the value of
@@ -5380,13 +5379,13 @@
 
 .SH XIV. Y2K Compliance in libpng
 
-June 16, 2011
+June 18, 2011
 
 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.5.4beta04 are Y2K compliant.  It is my belief that earlier
+upward through 1.5.4beta05 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
@@ -5579,7 +5578,7 @@
  1.5.3rc01-02        15    10503  15.so.15.3[.0]
  1.5.3beta11         15    10503  15.so.15.3[.0]
  1.5.3 [omitted]
- 1.5.4beta01-03      15    10504  15.so.15.4[.0]
+ 1.5.4beta01-05      15    10504  15.so.15.4[.0]
 
 Henceforth the source version will match the shared-library minor
 and patch numbers; the shared-library major version number will be
@@ -5636,7 +5635,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.5.4beta04 - June 16, 2011:
+Libpng version 1.5.4beta05 - June 18, 2011:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
 
@@ -5659,7 +5658,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.4beta04, June 16, 2011, are
+libpng versions 1.2.6, August 15, 2004, through 1.5.4beta05, June 18, 2011, are
 Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
@@ -5758,7 +5757,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-June 16, 2011
+June 18, 2011
 
 .\" end of man page
 
diff --git a/libpngpf.3 b/libpngpf.3
index e6478f1..a507ef2 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "June 16, 2011"
+.TH LIBPNGPF 3 "June 18, 2011"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta05
 (private functions)
diff --git a/png.5 b/png.5
index f1d2e83..881bb18 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "June 16, 2011"
+.TH PNG 5 "June 18, 2011"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/pngconf.h b/pngconf.h
index 1a8c81a..127568d 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.5.4beta05 - June 16, 2011
+ * libpng version 1.5.4beta05 - June 18, 2011
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt
index 9fd8dd6..628e78e 100644
--- a/projects/vstudio/readme.txt
+++ b/projects/vstudio/readme.txt
@@ -1,7 +1,7 @@
 
 VisualStudio instructions
 
-libpng version 1.5.4beta05 - June 16, 2011
+libpng version 1.5.4beta05 - June 18, 2011
 
 Copyright (c) 1998-2010 Glenn Randers-Pehrson
 
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index d532b17..011a192 100644
--- a/projects/vstudio/zlib.props
+++ b/projects/vstudio/zlib.props
@@ -2,7 +2,7 @@
 <!--
  * zlib.props - location of zlib source
  *
- * libpng version 1.5.4beta05 - June 16, 2011
+ * libpng version 1.5.4beta05 - June 18, 2011
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  *
diff --git a/scripts/README.txt b/scripts/README.txt
index d5e2fb4..58f4875 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
 
-Makefiles for  libpng version 1.5.4beta05 - June 16, 2011
+Makefiles for  libpng version 1.5.4beta05 - June 18, 2011
 
 pnglibconf.h.prebuilt       =>  Stores configuration settings
  makefile.linux    =>  Linux/ELF makefile
diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa
index fb90990..19920ce 100644
--- a/scripts/pnglibconf.dfa
+++ b/scripts/pnglibconf.dfa
@@ -556,7 +556,8 @@
 
 # added at libpng-1.5.4
 
-option READ_CHOP_16_TO_8 requires READ_16_TO_8
+option READ_SCALE_16_TO_8 requires READ_16_TO_8
+option READ_STRIP_16_TO_8 requires READ_16_TO_8
 
 option WRITE_OPTIMIZE_CMF requires WRITE
 
diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt
index 78df974..f377b01 100644
--- a/scripts/pnglibconf.h.prebuilt
+++ b/scripts/pnglibconf.h.prebuilt
@@ -76,7 +76,8 @@
 #define PNG_READ_BGR_SUPPORTED
 #define PNG_READ_bKGD_SUPPORTED
 #define PNG_READ_cHRM_SUPPORTED
-#define PNG_READ_CHOP_16_TO_8_SUPPORTED
+#define PNG_READ_SCALE_16_TO_8_SUPPORTED
+#define PNG_READ_STRIP_16_TO_8_SUPPORTED
 #define PNG_READ_COMPOSITE_NODIV_SUPPORTED
 #define PNG_READ_EXPAND_16_SUPPORTED
 #define PNG_READ_EXPAND_SUPPORTED