提交 c3b3240a 编写于 作者: G Glenn Randers-Pehrson

[devel] Improved the optimization of the zlib CMF byte

(see libpng-1.2.6beta03).
上级 65a24d06
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
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
chunks.
Version 1.5.3beta02 [April 1, 2011]
Version 1.5.3beta02 [April 2, 2011]
Updated scripts/symbols.def with new API functions.
Only compile the new zlib re-initializing code when text or iCCP is
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:
(subscription required; visit
......
......@@ -3292,10 +3292,11 @@ Version 1.5.3beta01 [April 1, 2011]
Added API functions to set parameters for zlib compression of non-IDAT
chunks.
Version 1.5.3beta02 [April 1, 2011]
Version 1.5.3beta02 [April 2, 2011]
Updated scripts/symbols.def with new API functions.
Only compile the new zlib re-initializing code when text or iCCP is
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
(subscription required; visit
......
......@@ -839,13 +839,23 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
if (length >= 2 &&
png_ptr->height < 16384 && png_ptr->width < 16384)
{
/* Compute the maximum possible length of the datastream
*
* To do: verify that this works with interlaced files
/* Compute the maximum possible length of the datastream */
/* Number of pixels, plus for each row a filter byte and possible
* padding byte
*/
png_uint_32 uncompressed_idat_size = png_ptr->height *
((png_ptr->width *
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 half_z_window_size = 1 << (z_cinfo + 7);
while (uncompressed_idat_size <= half_z_window_size &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册