[devel] Added "bit_depth" parameter to the private png_build_gamma_table()

function.  Pass bit_depth=8 to png_build_gamma_table() when bit_depth is 16
but the PNG_16_TO_8 transform has been set, to avoid unnecessary build of
16-bit tables.
This commit is contained in:
Glenn Randers-Pehrson 2009-12-13 08:14:40 -06:00
parent 0452bbcf84
commit ffa8924330
5 changed files with 33 additions and 16 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.4.0beta108 - December 11, 2009
Libpng 1.4.0beta109 - December 13, 2009
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.4.0beta108.tar.xz (LZMA-compressed, recommended)
1.4.0beta108.tar.gz
1.4.0beta108.tar.bz2
1.4.0beta109.tar.xz (LZMA-compressed, recommended)
1.4.0beta109.tar.gz
1.4.0beta109.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp140b108.zip
lp140b108.7z
lp140b109.zip
lp140b109.7z
Other information:
1.4.0beta108-README.txt
1.4.0beta108-LICENSE.txt
1.4.0beta109-README.txt
1.4.0beta109-LICENSE.txt
Changes since the last public release (1.2.10):
@ -734,6 +734,12 @@ version 1.4.0beta108 [December 11, 2009]
change in version 1.2.41beta08 caused transparency to be handled wrong
in some 16-bit datastreams (Yusaku Sugai).
version 1.4.0beta109 [December 13, 2009]
Added "bit_depth" parameter to the private png_build_gamma_table() function.
Pass bit_depth=8 to png_build_gamma_table() when bit_depth is 16 but the
PNG_16_TO_8 transform has been set, to avoid unnecessary build of 16-bit
tables.
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

@ -2421,6 +2421,12 @@ version 1.4.0beta108 [December 11, 2009]
change in version 1.2.41beta08 caused transparency to be handled wrong
in some 16-bit datastreams (Yusaku Sugai).
version 1.4.0beta109 [December 13, 2009]
Added "bit_depth" parameter to the private png_build_gamma_table() function.
Pass bit_depth=8 to png_build_gamma_table() when bit_depth is 16 but the
PNG_16_TO_8 transform has been set, to avoid unnecessary build of 16-bit
tables.
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

@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "December 11, 2009"
.TH LIBPNGPF 3 "December 13, 2009"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta108
(private functions)
@ -15,7 +15,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta108
\fI\fB
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
\fBvoid png_build_gamma_table (png_structp \fP\fIpng_ptr\fP\fB, png_byte \fIbit_depth\fP\fB);\fP
\fI\fB

View File

@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.4.0beta108 - December 11, 2009
* libpng version 1.4.0beta109 - December 13, 2009
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -475,7 +475,8 @@ PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
png_byte bit_depth));
#endif
/* Combine a row of data, dealing with alpha, etc. if requested */

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.4.0 [December 11, 2009]
* Last changed in libpng 1.4.0 [December 13, 2009]
* Copyright (c) 1998-2009 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.)
@ -886,7 +886,11 @@ png_init_read_transformations(png_structp png_ptr)
if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) &&
png_ptr->gamma != 0.0)
{
png_build_gamma_table(png_ptr);
if (png_ptr->transformations & PNG_16_TO_8)
png_build_gamma_table(png_ptr, 8);
else
png_build_gamma_table(png_ptr, png_ptr->bit_depth);
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->transformations & PNG_BACKGROUND)
{
@ -3910,11 +3914,11 @@ static PNG_CONST int png_gamma_shift[] =
*/
void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr)
png_build_gamma_table(png_structp png_ptr, png_byte bit_depth)
{
png_debug(1, "in png_build_gamma_table");
if (png_ptr->bit_depth <= 8)
if (bit_depth <= 8)
{
int i;
double g;