[devel] Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again.
If this is not enabled, png_set_strip_16() and png_do_scale_16_to_8()
aren't built.
diff --git a/ANNOUNCE b/ANNOUNCE
index eec50a2..f191d93 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
-Libpng 1.5.4beta04 - June 15, 2011
+Libpng 1.5.4beta04 - June 16, 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.
@@ -200,12 +200,12 @@
Removed the ACCURATE and LEGACY options (they are no longer useable)
Use the old scaling method for background if png_set_chop_16() was
called.
- Made png_set_chop_16() API removeable by disabling PNG_CHOP_16_TO_8_SUPPORTED
+ Made png_set_chop_16() API removeable with PNG_NO_READ_CHOP_16_TO_8_SUPPORTED
Version 1.5.4beta03 [June 15, 2011]
Fixed a problem in png_do_expand_palette() exposed by optimization in
1.5.3beta06
- Also removed a spurious (totally unused and confusing) member from png_info.
+ Also removed a spurious and confusing "trans" member ("trans") from png_info.
The palette expand optimization prevented expansion to an intermediate RGBA
form if tRNS was present but alpha was marked to be stripped; this exposed
a check for tRNS in png_do_expand_palette() which is inconsistent with the
@@ -213,9 +213,11 @@
Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h
-Version 1.5.4beta04 [June 15, 2011]
+Version 1.5.4beta04 [June 16, 2011]
Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms.
+ Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is
+ not enabled, png_set_strip_16() and png_do_scale_16_to_8 aren't built.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index a4d76da..8830977 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3468,7 +3468,7 @@
Version 1.5.4beta03 [June 15, 2011]
Fixed a problem in png_do_expand_palette() exposed by optimization in
1.5.3beta06
- Also removed a spurious (totally unused and confusing) member from png_info.
+ Also removed a spurious and confusing "trans" member ("trans") from png_info.
The palette expand optimization prevented expansion to an intermediate RGBA
form if tRNS was present but alpha was marked to be stripped; this exposed
a check for tRNS in png_do_expand_palette() which is inconsistent with the
@@ -3476,9 +3476,11 @@
Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h
-Version 1.5.4beta04 [June 15, 2011]
+Version 1.5.4beta04 [June 16, 2011]
Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms.
+ Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is
+ not enabled, png_set_strip_16() and png_do_scale_16_to_8 aren't built.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/png.h b/png.h
index 780b45e..50438a1 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.5.4beta04 - June 15, 2011
+ * libpng version 1.5.4beta04 - June 16, 2011
* Copyright (c) 1998-2011 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.)
@@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.5.4beta04 - June 15, 2011: Glenn
+ * libpng versions 0.97, January 1998, through 1.5.4beta04 - June 16, 2011: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -186,7 +186,7 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.5.4beta04, June 15, 2011, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.5.4beta04, June 16, 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:
@@ -298,7 +298,7 @@
* Y2K compliance in libpng:
* =========================
*
- * June 15, 2011
+ * June 16, 2011
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@@ -361,7 +361,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.4beta04"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.5.4beta04 - June 15, 2011\n"
+ " libpng version 1.5.4beta04 - June 16, 2011\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@@ -1424,10 +1424,10 @@
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
-/* The following is always done from 1.5.4: */
-#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
+# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
/* Scale a 16-bit depth file down to 8-bit, accurately. */
PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
+# endif
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Strip the second byte of information from a 16-bit depth file. */
PNG_EXPORT(229, void, png_set_chop_16, (png_structp png_ptr));
diff --git a/pngpriv.h b/pngpriv.h
index 5d4bda4..4c34e8c 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -819,15 +819,15 @@
png_bytep row));
#endif
-#ifdef PNG_READ_16_TO_8_SUPPORTED
+#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
png_bytep row));
+#endif
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
png_bytep row));
#endif
-#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
diff --git a/pngread.c b/pngread.c
index 408e07b..b67cf26 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1289,8 +1289,10 @@
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Tell libpng to strip 16-bit/color files down to 8 bits per color.
*/
+# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
if (transforms & PNG_TRANSFORM_STRIP_16)
png_set_strip_16(png_ptr);
+# endif
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Added at libpng-1.5.4. "chop_16" produces the same result that "strip_16"
* did in earlier versions, while "strip_16" is now more accurate.
diff --git a/pngrtran.c b/pngrtran.c
index 0070d35..2dd61b8 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -134,6 +134,7 @@
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Scale 16-bit depth files to 8-bit depth */
+# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
void PNGAPI
png_set_strip_16(png_structp png_ptr)
{
@@ -143,12 +144,13 @@
return;
png_ptr->transformations |= PNG_16_TO_8;
-#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
+# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_ptr->transformations &= ~PNG_CHOP_16_TO_8;
-#endif
+# endif
}
+# endif
-#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
+# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Chop 16-bit depth files to 8-bit depth */
void PNGAPI
png_set_chop_16(png_structp png_ptr)
@@ -159,9 +161,11 @@
return;
png_ptr->transformations |= PNG_CHOP_16_TO_8;
+# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
png_ptr->transformations &= ~PNG_16_TO_8;
+# endif
}
-#endif
+# endif
#endif /* PNG_READ_16_TO_8_SUPPORTED */
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
@@ -2142,7 +2146,7 @@
png_do_encode_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr);
#endif
-#ifdef PNG_READ_16_TO_8_SUPPORTED
+#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
if (png_ptr->transformations & PNG_16_TO_8)
png_do_scale_16_to_8(&(png_ptr->row_info), png_ptr->row_buf + 1);
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
diff --git a/pngvalid.c b/pngvalid.c
index 4bddd0f..189b4d9 100644
--- a/pngvalid.c
+++ b/pngvalid.c
@@ -5241,6 +5241,8 @@
#endif /* PNG_READ_EXPAND_16_SUPPORTED */
#ifdef PNG_READ_16_TO_8_SUPPORTED
+# if !defined(PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED) && \
+ !defined(PNG_READ_CHOP_16_TO_8_SUPPORTED) /* the default before 1.5.4 */
/* png_set_strip_16 */
static void
image_transform_png_set_strip_16_set(PNG_CONST image_transform *this,
@@ -5296,6 +5298,7 @@
IT(strip_16);
#undef PT
#define PT ITSTRUCT(strip_16)
+#endif
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED /* API added in 1.5.4 */
/* png_set_chop_16 */
diff --git a/scripts/README.txt b/scripts/README.txt
index 11ab7d1..dfcd3e8 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
-Makefiles for libpng version 1.5.4beta04 - June 15, 2011
+Makefiles for libpng version 1.5.4beta04 - June 16, 2011
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile
@@ -57,7 +57,7 @@
libpng-config-body.in => used by several makefiles to create libpng-config
libpng-config-head.in => used by several makefiles to create libpng-config
libpng.pc.in => Used by several makefiles to create libpng.pc
- pngwin.rc => Used by the visualc6 and visualc71 projects.
+ pngwin.rc => Used by the visualc71 project.
pngwin.def => Used by makefile.os2
pngwin.dfn => Used to maintain pngwin.def
SCOPTIONS.ppc => Used with smakefile.ppc
diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa
index b59bd47..fb90990 100644
--- a/scripts/pnglibconf.dfa
+++ b/scripts/pnglibconf.dfa
@@ -550,6 +550,10 @@
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL
+# enabled at libpng-1.5.4, was present but disabled by default
+
+option READ_16_TO_8_ACCURATE_SCALE requires READ_16_TO_8
+
# added at libpng-1.5.4
option READ_CHOP_16_TO_8 requires READ_16_TO_8