mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Improved the optimization of the zlib CMF byte
(see libpng-1.2.6beta03).
This commit is contained in:
parent
65a24d0638
commit
c3b3240a03
5
ANNOUNCE
5
ANNOUNCE
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.5.3beta02 - April 1, 2011
|
Libpng 1.5.3beta02 - April 2, 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.
|
||||||
@ -31,10 +31,11 @@ Version 1.5.3beta01 [April 1, 2011]
|
|||||||
Added API functions to set parameters for zlib compression of non-IDAT
|
Added API functions to set parameters for zlib compression of non-IDAT
|
||||||
chunks.
|
chunks.
|
||||||
|
|
||||||
Version 1.5.3beta02 [April 1, 2011]
|
Version 1.5.3beta02 [April 2, 2011]
|
||||||
Updated scripts/symbols.def with new API functions.
|
Updated scripts/symbols.def with new API functions.
|
||||||
Only compile the new zlib re-initializing code when text or iCCP is
|
Only compile the new zlib re-initializing code when text or iCCP is
|
||||||
supported, using PNG_WRITE_COMPRESSED_TEXT_SUPPORTED macro.
|
supported, using PNG_WRITE_COMPRESSED_TEXT_SUPPORTED macro.
|
||||||
|
Improved the optimization of the zlib CMF byte (see libpng-1.2.6beta03).
|
||||||
|
|
||||||
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
|
||||||
|
3
CHANGES
3
CHANGES
@ -3292,10 +3292,11 @@ Version 1.5.3beta01 [April 1, 2011]
|
|||||||
Added API functions to set parameters for zlib compression of non-IDAT
|
Added API functions to set parameters for zlib compression of non-IDAT
|
||||||
chunks.
|
chunks.
|
||||||
|
|
||||||
Version 1.5.3beta02 [April 1, 2011]
|
Version 1.5.3beta02 [April 2, 2011]
|
||||||
Updated scripts/symbols.def with new API functions.
|
Updated scripts/symbols.def with new API functions.
|
||||||
Only compile the new zlib re-initializing code when text or iCCP is
|
Only compile the new zlib re-initializing code when text or iCCP is
|
||||||
supported, using PNG_WRITE_COMPRESSED_TEXT_SUPPORTED macro.
|
supported, using PNG_WRITE_COMPRESSED_TEXT_SUPPORTED macro.
|
||||||
|
Improved the optimization of the zlib CMF byte (see libpng-1.2.6beta03).
|
||||||
|
|
||||||
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
|
||||||
|
16
pngwutil.c
16
pngwutil.c
@ -839,13 +839,23 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
if (length >= 2 &&
|
if (length >= 2 &&
|
||||||
png_ptr->height < 16384 && png_ptr->width < 16384)
|
png_ptr->height < 16384 && png_ptr->width < 16384)
|
||||||
{
|
{
|
||||||
/* Compute the maximum possible length of the datastream
|
/* Compute the maximum possible length of the datastream */
|
||||||
*
|
|
||||||
* To do: verify that this works with interlaced files
|
/* Number of pixels, plus for each row a filter byte and possible
|
||||||
|
* padding byte
|
||||||
*/
|
*/
|
||||||
png_uint_32 uncompressed_idat_size = png_ptr->height *
|
png_uint_32 uncompressed_idat_size = png_ptr->height *
|
||||||
((png_ptr->width *
|
((png_ptr->width *
|
||||||
png_ptr->channels * png_ptr->bit_depth + 15) >> 3);
|
png_ptr->channels * png_ptr->bit_depth + 15) >> 3);
|
||||||
|
|
||||||
|
/* If it's interlaced, each block of 8 rows is sent as up to
|
||||||
|
* 14 rows, i.e., 6 additional rows, each with a filter byte
|
||||||
|
* and possibly a padding byte
|
||||||
|
*/
|
||||||
|
if (png_ptr->interlaced)
|
||||||
|
uncompressed_idat_size += ((png_ptr->height + 7)/8) *
|
||||||
|
(png_ptr->bit_depth < 8 ? 12 : 6);
|
||||||
|
|
||||||
unsigned int z_cinfo = z_cmf >> 4;
|
unsigned int z_cinfo = z_cmf >> 4;
|
||||||
unsigned int half_z_window_size = 1 << (z_cinfo + 7);
|
unsigned int half_z_window_size = 1 << (z_cinfo + 7);
|
||||||
while (uncompressed_idat_size <= half_z_window_size &&
|
while (uncompressed_idat_size <= half_z_window_size &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user