[devel] Fix pngvalid.c with ACCURATE_SCALE

and update scripts/pnglibconf.h.prebuilt
This commit is contained in:
John Bowler 2011-06-22 23:13:01 -05:00 committed by Glenn Randers-Pehrson
parent 5bcd0a8c14
commit fcd7c13ffd
4 changed files with 62 additions and 56 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.4beta07 - June 19, 2011 Libpng 1.5.4beta08 - June 23, 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.
@ -9,20 +9,20 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
1.5.4beta07.tar.xz (LZMA-compressed, recommended) 1.5.4beta08.tar.xz (LZMA-compressed, recommended)
1.5.4beta07.tar.gz 1.5.4beta08.tar.gz
1.5.4beta07.tar.bz2 1.5.4beta08.tar.bz2
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lp154b07.7z (LZMA-compressed, recommended) lp154b08.7z (LZMA-compressed, recommended)
lp154b07.zip lp154b08.zip
Other information: Other information:
1.5.4beta07-README.txt 1.5.4beta08-README.txt
1.5.4beta07-LICENSE.txt 1.5.4beta08-LICENSE.txt
Changes since the last public release (1.5.2): Changes since the last public release (1.5.2):
@ -236,6 +236,9 @@ Version 1.5.4beta07 [June 19, 2011]
maintains some state so that positive, negative and zero values are maintains some state so that positive, negative and zero values are
identified. sCAL uses these to be strictly spec conformant. identified. sCAL uses these to be strictly spec conformant.
Version 1.5.4beta08 [June 23, 2011]
Fixed pngvalid if ACCURATE_SCALE is defined.
Updated scripts/pnglibconf.h.prebuilt.
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

@ -3499,6 +3499,10 @@ Version 1.5.4beta07 [June 19, 2011]
maintains some state so that positive, negative and zero values are maintains some state so that positive, negative and zero values are
identified. sCAL uses these to be strictly spec conformant. identified. sCAL uses these to be strictly spec conformant.
Version 1.5.4beta08 [June 23, 2011]
Fixed pngvalid if ACCURATE_SCALE is defined.
Updated scripts/pnglibconf.h.prebuilt.
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
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@ -6732,47 +6732,48 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi,
* This is only done for older libpng versions when the 'inaccurate' * This is only done for older libpng versions when the 'inaccurate'
* (chop) method of scaling was used. * (chop) method of scaling was used.
*/ */
# if !PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED && \ # ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
PNG_LIBPNG_VER < 10504 # if PNG_LIBPNG_VER < 10504
/* This may be required for other components in the future, but /* This may be required for other components in the future,
* at present the presence of gamma correction effectively * but at present the presence of gamma correction effectively
* prevents the errors in the component scaling (I don't quite * prevents the errors in the component scaling (I don't quite
* understand why, but since it's better this way I care not to * understand why, but since it's better this way I care not
* ask, JB 20110419.) * to ask, JB 20110419.)
*/ */
if (pass == 0 && alpha < 0 && vi->scale16 && vi->sbit > 8 && if (pass == 0 && alpha < 0 && vi->scale16 && vi->sbit > 8 &&
vi->sbit + vi->isbit_shift == 16) vi->sbit + vi->isbit_shift == 16)
{
tmp = ((id >> 8) - .5)/255;
if (tmp > 0)
{ {
is_lo = ceil(outmax * tmp - vi->maxout_total); tmp = ((id >> 8) - .5)/255;
if (is_lo < 0) is_lo = 0;
if (tmp > 0)
{
is_lo = ceil(outmax * tmp - vi->maxout_total);
if (is_lo < 0) is_lo = 0;
}
else
is_lo = 0;
tmp = ((id >> 8) + .5)/255;
if (tmp < 1)
{
is_hi = floor(outmax * tmp + vi->maxout_total);
if (is_hi > outmax) is_hi = outmax;
}
else
is_hi = outmax;
if (!(od < is_lo || od > is_hi))
{
if (encoded_error < vi->outlog)
return i;
pass = "within 8 bit limits:\n";
}
} }
# endif
else
is_lo = 0;
tmp = ((id >> 8) + .5)/255;
if (tmp < 1)
{
is_hi = floor(outmax * tmp + vi->maxout_total);
if (is_hi > outmax) is_hi = outmax;
}
else
is_hi = outmax;
if (!(od < is_lo || od > is_hi))
{
if (encoded_error < vi->outlog)
return i;
pass = "within 8 bit limits:\n";
}
}
# endif # endif
} }
else /* !use_input_precision */ else /* !use_input_precision */

View File

@ -3,7 +3,7 @@
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* libpng version 1.5.0 - last changed on February 11, 2011 */ /* libpng version 1.5.4 - last changed on June 22, 2011 */
/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
@ -49,6 +49,7 @@
#define PNG_CONSOLE_IO_SUPPORTED #define PNG_CONSOLE_IO_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED #define PNG_CONVERT_tIME_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED #define PNG_EASY_ACCESS_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED #define PNG_ERROR_TEXT_SUPPORTED
#define PNG_FIXED_POINT_SUPPORTED #define PNG_FIXED_POINT_SUPPORTED
#define PNG_FLOATING_ARITHMETIC_SUPPORTED #define PNG_FLOATING_ARITHMETIC_SUPPORTED
@ -68,17 +69,14 @@
#define PNG_POINTER_INDEXING_SUPPORTED #define PNG_POINTER_INDEXING_SUPPORTED
#define PNG_PROGRESSIVE_READ_SUPPORTED #define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED #define PNG_READ_16BIT_SUPPORTED
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
#define PNG_READ_16_TO_8_SUPPORTED
#define PNG_READ_ALPHA_MODE_SUPPORTED #define PNG_READ_ALPHA_MODE_SUPPORTED
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED #define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_BGR_SUPPORTED #define PNG_READ_BGR_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED #define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED #define PNG_READ_cHRM_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_COMPOSITE_NODIV_SUPPORTED
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
#define PNG_READ_EXPAND_16_SUPPORTED #define PNG_READ_EXPAND_16_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED #define PNG_READ_EXPAND_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED #define PNG_READ_FILLER_SUPPORTED
@ -101,10 +99,12 @@
#define PNG_READ_QUANTIZE_SUPPORTED #define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_RGB_TO_GRAY_SUPPORTED #define PNG_READ_RGB_TO_GRAY_SUPPORTED
#define PNG_READ_sBIT_SUPPORTED #define PNG_READ_sBIT_SUPPORTED
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
#define PNG_READ_sCAL_SUPPORTED #define PNG_READ_sCAL_SUPPORTED
#define PNG_READ_SHIFT_SUPPORTED #define PNG_READ_SHIFT_SUPPORTED
#define PNG_READ_sPLT_SUPPORTED #define PNG_READ_sPLT_SUPPORTED
#define PNG_READ_sRGB_SUPPORTED #define PNG_READ_sRGB_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED #define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_SUPPORTED #define PNG_READ_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED #define PNG_READ_SWAP_ALPHA_SUPPORTED
@ -118,7 +118,6 @@
#define PNG_READ_USER_CHUNKS_SUPPORTED #define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED #define PNG_READ_zTXt_SUPPORTED
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
#define PNG_SAVE_INT_32_SUPPORTED #define PNG_SAVE_INT_32_SUPPORTED
#define PNG_sBIT_SUPPORTED #define PNG_sBIT_SUPPORTED
#define PNG_sCAL_SUPPORTED #define PNG_sCAL_SUPPORTED
@ -147,6 +146,8 @@
#define PNG_WRITE_BGR_SUPPORTED #define PNG_WRITE_BGR_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED #define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
#define PNG_WRITE_FILLER_SUPPORTED #define PNG_WRITE_FILLER_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED #define PNG_WRITE_FILTER_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED #define PNG_WRITE_FLUSH_SUPPORTED
@ -157,7 +158,6 @@
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED #define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED #define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_INVERT_SUPPORTED #define PNG_WRITE_INVERT_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
#define PNG_WRITE_iTXt_SUPPORTED #define PNG_WRITE_iTXt_SUPPORTED
#define PNG_WRITE_oFFs_SUPPORTED #define PNG_WRITE_oFFs_SUPPORTED
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED #define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
@ -183,7 +183,5 @@
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_zTXt_SUPPORTED #define PNG_WRITE_zTXt_SUPPORTED
#define PNG_zTXt_SUPPORTED #define PNG_zTXt_SUPPORTED
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
/* end of options */ /* end of options */
#endif /* PNGLCONF_H */ #endif /* PNGLCONF_H */