[devel] Made it possible to undefine PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED

to get the same (inaccurate) output as libpng-1.5.2 and earlier.
This commit is contained in:
Glenn Randers-Pehrson 2011-06-13 11:47:00 -05:00
parent 0cb906d804
commit 141d9e3c20
3 changed files with 29 additions and 8 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.3beta11 - June 11, 2011
Libpng 1.5.3beta12 - June 13, 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 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.5.3beta11.tar.xz (LZMA-compressed, recommended)
1.5.3beta11.tar.gz
1.5.3beta11.tar.bz2
1.5.3beta12.tar.xz (LZMA-compressed, recommended)
1.5.3beta12.tar.gz
1.5.3beta12.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp153b11.7z (LZMA-compressed, recommended)
lp153b11.zip
lp153b12.7z (LZMA-compressed, recommended)
lp153b12.zip
Other information:
1.5.3beta11-README.txt
1.5.3beta11-LICENSE.txt
1.5.3beta12-README.txt
1.5.3beta12-LICENSE.txt
Changes since the last public release (1.5.2):
@ -181,6 +181,10 @@ Version 1.5.3beta11 [June 11, 2011]
necessarily fully supportable, particularly png_strncpy and png_snprintf.
Added log option to pngvalid.c and attempted to improve gamma messages.
Version 1.5.3beta12 [June 13, 2011]
Made it possible to undefine PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
to get the same (inaccurate) output as libpng-1.5.2 and earlier.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@ -3444,6 +3444,10 @@ Version 1.5.3beta11 [June 11, 2011]
necessarily fully supportable, particularly png_strncpy and png_snprintf.
Added log option to pngvalid.c and attempted to improve gamma messages.
Version 1.5.3beta12 [June 13, 2011]
Made it possible to undefine PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
to get the same (inaccurate) output as libpng-1.5.2 and earlier.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@ -1439,7 +1439,11 @@ png_init_read_transformations(png_structp png_ptr)
* The PNG_BACKGROUND_EXPAND code above does not expand to 16 bits at
* present, so that case is ok (until do_expand_16 is moved.)
*/
#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
# define CHOP(x) (x)=((png_uint_16)(((png_uint_32)(x)*255+32895) >> 16))
#else
# define CHOP(x) ((png_uint_16)((2*(png_uint_32)(x) + 257)/514))
#endif
CHOP(png_ptr->background.red);
CHOP(png_ptr->background.green);
CHOP(png_ptr->background.blue);
@ -2494,9 +2498,18 @@ png_do_chop(png_row_infop row_info, png_bytep row)
*
* (V * 255 + 32895) >> 16
*/
#ifdef PNG_LEGACY_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
*dp = *sp + ((((int)(*(sp + 1)) - *sp) > 128) ? 1 : 0);
#else
png_int_32 tmp = *sp++; /* must be signed! */
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
tmp += (((int)*sp++ - tmp + 128) * 65535) >> 24;
# else
sp++;
# endif
*dp++ = (png_byte)tmp;
#endif
}
row_info->bit_depth = 8;