[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.
This commit is contained in:
Glenn Randers-Pehrson 2011-06-16 09:05:40 -05:00
parent 733b131545
commit 5f0b9276ec
9 changed files with 39 additions and 22 deletions

View File

@ -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 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. within a few weeks by a public version or by another test version.
@ -200,12 +200,12 @@ Version 1.5.4beta02 [June 14, 2011]
Removed the ACCURATE and LEGACY options (they are no longer useable) Removed the ACCURATE and LEGACY options (they are no longer useable)
Use the old scaling method for background if png_set_chop_16() was Use the old scaling method for background if png_set_chop_16() was
called. 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] Version 1.5.4beta03 [June 15, 2011]
Fixed a problem in png_do_expand_palette() exposed by optimization in Fixed a problem in png_do_expand_palette() exposed by optimization in
1.5.3beta06 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 The palette expand optimization prevented expansion to an intermediate RGBA
form if tRNS was present but alpha was marked to be stripped; this exposed 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 a check for tRNS in png_do_expand_palette() which is inconsistent with the
@ -213,9 +213,11 @@ Version 1.5.4beta03 [June 15, 2011]
Correction to the expand_16 code; removed extra instance of Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h 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 a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms. 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: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -3468,7 +3468,7 @@ Version 1.5.4beta02 [June 14, 2011]
Version 1.5.4beta03 [June 15, 2011] Version 1.5.4beta03 [June 15, 2011]
Fixed a problem in png_do_expand_palette() exposed by optimization in Fixed a problem in png_do_expand_palette() exposed by optimization in
1.5.3beta06 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 The palette expand optimization prevented expansion to an intermediate RGBA
form if tRNS was present but alpha was marked to be stripped; this exposed 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 a check for tRNS in png_do_expand_palette() which is inconsistent with the
@ -3476,9 +3476,11 @@ Version 1.5.4beta03 [June 15, 2011]
Correction to the expand_16 code; removed extra instance of Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h 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 a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

14
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* 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 * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * 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.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. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -186,7 +186,7 @@
* *
* This code is released under the libpng license. * 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 * Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -298,7 +298,7 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* June 15, 2011 * June 16, 2011
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
@ -361,7 +361,7 @@
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.4beta04" #define PNG_LIBPNG_VER_STRING "1.5.4beta04"
#define PNG_HEADER_VERSION_STRING \ #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_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15 #define PNG_LIBPNG_VER_DLLNUM 15
@ -1424,10 +1424,10 @@ PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr,
#endif #endif
#ifdef PNG_READ_16_TO_8_SUPPORTED #ifdef PNG_READ_16_TO_8_SUPPORTED
/* The following is always done from 1.5.4: */ # ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
/* Scale a 16-bit depth file down to 8-bit, accurately. */ /* Scale a 16-bit depth file down to 8-bit, accurately. */
PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr)); PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
# endif
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED # ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Strip the second byte of information from a 16-bit depth file. */ /* Strip the second byte of information from a 16-bit depth file. */
PNG_EXPORT(229, void, png_set_chop_16, (png_structp png_ptr)); PNG_EXPORT(229, void, png_set_chop_16, (png_structp png_ptr));

View File

@ -819,15 +819,15 @@ PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
png_bytep row)); png_bytep row));
#endif #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_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
png_bytep row)); png_bytep row));
#endif
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED #ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
png_bytep row)); png_bytep row));
#endif #endif
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED #ifdef PNG_READ_QUANTIZE_SUPPORTED
PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info, PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,

View File

@ -1289,8 +1289,10 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_READ_16_TO_8_SUPPORTED #ifdef PNG_READ_16_TO_8_SUPPORTED
/* Tell libpng to strip 16-bit/color files down to 8 bits per color. /* 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) if (transforms & PNG_TRANSFORM_STRIP_16)
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
# endif
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED # ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Added at libpng-1.5.4. "chop_16" produces the same result that "strip_16" /* 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. * did in earlier versions, while "strip_16" is now more accurate.

View File

@ -134,6 +134,7 @@ png_set_background(png_structp png_ptr,
#ifdef PNG_READ_16_TO_8_SUPPORTED #ifdef PNG_READ_16_TO_8_SUPPORTED
/* Scale 16-bit depth files to 8-bit depth */ /* Scale 16-bit depth files to 8-bit depth */
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
void PNGAPI void PNGAPI
png_set_strip_16(png_structp png_ptr) png_set_strip_16(png_structp png_ptr)
{ {
@ -147,6 +148,7 @@ png_set_strip_16(png_structp png_ptr)
png_ptr->transformations &= ~PNG_CHOP_16_TO_8; 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 */ /* Chop 16-bit depth files to 8-bit depth */
@ -159,7 +161,9 @@ png_set_chop_16(png_structp png_ptr)
return; return;
png_ptr->transformations |= PNG_CHOP_16_TO_8; png_ptr->transformations |= PNG_CHOP_16_TO_8;
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
png_ptr->transformations &= ~PNG_16_TO_8; png_ptr->transformations &= ~PNG_16_TO_8;
# endif
} }
# endif # endif
#endif /* PNG_READ_16_TO_8_SUPPORTED */ #endif /* PNG_READ_16_TO_8_SUPPORTED */
@ -2142,7 +2146,7 @@ png_do_read_transformations(png_structp png_ptr)
png_do_encode_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr); png_do_encode_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr);
#endif #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) if (png_ptr->transformations & PNG_16_TO_8)
png_do_scale_16_to_8(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_scale_16_to_8(&(png_ptr->row_info), png_ptr->row_buf + 1);
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED # ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED

View File

@ -5241,6 +5241,8 @@ IT(expand_16);
#endif /* PNG_READ_EXPAND_16_SUPPORTED */ #endif /* PNG_READ_EXPAND_16_SUPPORTED */
#ifdef PNG_READ_16_TO_8_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 */ /* png_set_strip_16 */
static void static void
image_transform_png_set_strip_16_set(PNG_CONST image_transform *this, image_transform_png_set_strip_16_set(PNG_CONST image_transform *this,
@ -5296,6 +5298,7 @@ image_transform_png_set_strip_16_add(image_transform *this,
IT(strip_16); IT(strip_16);
#undef PT #undef PT
#define PT ITSTRUCT(strip_16) #define PT ITSTRUCT(strip_16)
#endif
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED /* API added in 1.5.4 */ #ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED /* API added in 1.5.4 */
/* png_set_chop_16 */ /* png_set_chop_16 */

View File

@ -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 pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
@ -57,7 +57,7 @@ Other supporting scripts:
libpng-config-body.in => used by several makefiles to create libpng-config 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-config-head.in => used by several makefiles to create libpng-config
libpng.pc.in => Used by several makefiles to create libpng.pc 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.def => Used by makefile.os2
pngwin.dfn => Used to maintain pngwin.def pngwin.dfn => Used to maintain pngwin.def
SCOPTIONS.ppc => Used with smakefile.ppc SCOPTIONS.ppc => Used with smakefile.ppc

View File

@ -550,6 +550,10 @@ option SAVE_INT_32 requires WRITE
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL # 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 # added at libpng-1.5.4
option READ_CHOP_16_TO_8 requires READ_16_TO_8 option READ_CHOP_16_TO_8 requires READ_16_TO_8