mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Added PNG_IMAGE_FLAG_FAST for the benefit of applications that
store intermediate files, or intermediate in-memory data, while processing image data with the simplified API. The option makes the files larger but faster to write and read. pngstest now uses this by default; this can be disabled with the --slow option.
This commit is contained in:
parent
1c25b9b06b
commit
dee7577330
9
ANNOUNCE
9
ANNOUNCE
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.6.0beta15 - February 29, 2012
|
Libpng 1.6.0beta15 - March 2, 2012
|
||||||
|
|
||||||
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.
|
||||||
@ -234,12 +234,17 @@ Version 1.6.0beta14 [February 27, 2012]
|
|||||||
Added information about the new limits in the manual.
|
Added information about the new limits in the manual.
|
||||||
Updated Makefile.in
|
Updated Makefile.in
|
||||||
|
|
||||||
Version 1.6.0beta15 [February 29, 2012]
|
Version 1.6.0beta15 [March 2, 2012]
|
||||||
Removed unused "current_text" members of png_struct and the png_free()
|
Removed unused "current_text" members of png_struct and the png_free()
|
||||||
of png_ptr->current_text from pngread.c
|
of png_ptr->current_text from pngread.c
|
||||||
Rewrote pngstest.c for substantial speed improvement.
|
Rewrote pngstest.c for substantial speed improvement.
|
||||||
Fixed transparent pixel and 16-bit rgb tests in pngstest and removed a
|
Fixed transparent pixel and 16-bit rgb tests in pngstest and removed a
|
||||||
spurious check in pngwrite.c
|
spurious check in pngwrite.c
|
||||||
|
Added PNG_IMAGE_FLAG_FAST for the benefit of applications that store
|
||||||
|
intermediate files, or intermediate in-memory data, while processing
|
||||||
|
image data with the simplified API. The option makes the files larger
|
||||||
|
but faster to write and read. pngstest now uses this by default; this
|
||||||
|
can be disabled with the --slow option.
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
7
CHANGES
7
CHANGES
@ -3986,12 +3986,17 @@ Version 1.6.0beta14 [February 27, 2012]
|
|||||||
Added information about the new limits in the manual.
|
Added information about the new limits in the manual.
|
||||||
Updated Makefile.in
|
Updated Makefile.in
|
||||||
|
|
||||||
Version 1.6.0beta15 [February 29, 2012]
|
Version 1.6.0beta15 [March 2, 2012]
|
||||||
Removed unused "current_text" members of png_struct and the png_free()
|
Removed unused "current_text" members of png_struct and the png_free()
|
||||||
of png_ptr->current_text from pngread.c
|
of png_ptr->current_text from pngread.c
|
||||||
Rewrote pngstest.c for substantial speed improvement.
|
Rewrote pngstest.c for substantial speed improvement.
|
||||||
Fixed transparent pixel and 16-bit rgb tests in pngstest and removed a
|
Fixed transparent pixel and 16-bit rgb tests in pngstest and removed a
|
||||||
spurious check in pngwrite.c
|
spurious check in pngwrite.c
|
||||||
|
Added PNG_IMAGE_FLAG_FAST for the benefit of applications that store
|
||||||
|
intermediate files, or intermediate in-memory data, while processing
|
||||||
|
image data with the simplified API. The option makes the files larger
|
||||||
|
but faster to write and read. pngstest now uses this by default; this
|
||||||
|
can be disabled with the --slow option.
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@ -304,6 +304,7 @@ compare_16bit(int v1, int v2, int error_limit, int multiple_algorithms)
|
|||||||
#define KEEP_TMPFILES 16 /* else delete temporary files */
|
#define KEEP_TMPFILES 16 /* else delete temporary files */
|
||||||
#define KEEP_GOING 32
|
#define KEEP_GOING 32
|
||||||
#define ACCUMULATE 64
|
#define ACCUMULATE 64
|
||||||
|
#define FAST_WRITE 128
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_opts(png_uint_32 opts)
|
print_opts(png_uint_32 opts)
|
||||||
@ -1932,7 +1933,7 @@ static png_uint_16 gpc_error[16/*in*/][16/*out*/][4/*a*/] =
|
|||||||
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
|
||||||
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
|
||||||
}, { /* input: sRGB-rgb */
|
}, { /* input: sRGB-rgb */
|
||||||
{ 0, 0, 17, 0 }, { 0, 0, 17, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
|
{ 0, 0, 19, 0 }, { 0, 0, 19, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
|
||||||
{ 0, 0, 863, 0 }, { 0, 0, 863, 0 }, { 0, 0, 811, 0 }, { 0, 0, 811, 0 },
|
{ 0, 0, 863, 0 }, { 0, 0, 863, 0 }, { 0, 0, 811, 0 }, { 0, 0, 811, 0 },
|
||||||
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
|
||||||
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
|
||||||
@ -2010,7 +2011,7 @@ static png_uint_16 gpc_error_via_linear[16][4/*out*/][4] =
|
|||||||
}, { /* input: sRGB-gray+alpha */
|
}, { /* input: sRGB-gray+alpha */
|
||||||
{ 0, 6, 3, 0 }, { 0, 53, 3, 0 }, { 0, 6, 3, 0 }, { 0, 53, 3, 0 }
|
{ 0, 6, 3, 0 }, { 0, 53, 3, 0 }, { 0, 6, 3, 0 }, { 0, 53, 3, 0 }
|
||||||
}, { /* input: sRGB-rgb */
|
}, { /* input: sRGB-rgb */
|
||||||
{ 0, 0, 17, 0 }, { 0, 0, 17, 0 }, { 0, 0, 14, 0 }, { 0, 0, 14, 0 }
|
{ 0, 0, 19, 0 }, { 0, 0, 19, 0 }, { 0, 0, 15, 0 }, { 0, 0, 15, 0 }
|
||||||
}, { /* input: sRGB-rgb+alpha */
|
}, { /* input: sRGB-rgb+alpha */
|
||||||
{ 0, 8, 10, 0 }, { 0, 13, 10, 0 }, { 0, 12, 8, 0 }, { 0, 53, 8, 0 }
|
{ 0, 8, 10, 0 }, { 0, 13, 10, 0 }, { 0, 12, 8, 0 }, { 0, 53, 8, 0 }
|
||||||
}, { /* input: linear-gray */
|
}, { /* input: linear-gray */
|
||||||
@ -3083,6 +3084,9 @@ read_one_file(Image *image)
|
|||||||
static int
|
static int
|
||||||
write_one_file(Image *output, Image *image, int convert_to_8bit)
|
write_one_file(Image *output, Image *image, int convert_to_8bit)
|
||||||
{
|
{
|
||||||
|
if (image->opts & FAST_WRITE)
|
||||||
|
image->image.flags |= PNG_IMAGE_FLAG_FAST;
|
||||||
|
|
||||||
if (image->opts & USE_STDIO)
|
if (image->opts & USE_STDIO)
|
||||||
{
|
{
|
||||||
FILE *f = tmpfile();
|
FILE *f = tmpfile();
|
||||||
@ -3303,7 +3307,7 @@ testimage(Image *image, png_uint_32 opts, format_list *pf)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
png_uint_32 opts = 0;
|
png_uint_32 opts = FAST_WRITE;
|
||||||
format_list formats;
|
format_list formats;
|
||||||
const char *touch = NULL;
|
const char *touch = NULL;
|
||||||
int log_pass = 0;
|
int log_pass = 0;
|
||||||
@ -3347,6 +3351,10 @@ main(int argc, char **argv)
|
|||||||
opts &= ~KEEP_TMPFILES;
|
opts &= ~KEEP_TMPFILES;
|
||||||
else if (strcmp(arg, "--keep-going") == 0)
|
else if (strcmp(arg, "--keep-going") == 0)
|
||||||
opts |= KEEP_GOING;
|
opts |= KEEP_GOING;
|
||||||
|
else if (strcmp(arg, "--fast") == 0)
|
||||||
|
opts |= FAST_WRITE;
|
||||||
|
else if (strcmp(arg, "--slow") == 0)
|
||||||
|
opts &= ~FAST_WRITE;
|
||||||
else if (strcmp(arg, "--accumulate") == 0)
|
else if (strcmp(arg, "--accumulate") == 0)
|
||||||
opts |= ACCUMULATE;
|
opts |= ACCUMULATE;
|
||||||
else if (strcmp(arg, "--redundant") == 0)
|
else if (strcmp(arg, "--redundant") == 0)
|
||||||
|
|||||||
21
png.h
21
png.h
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.0beta15 - February 27, 2012
|
* libpng version 1.6.0beta15 - March 2, 2012
|
||||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.0beta15 - February 27, 2012: Glenn
|
* libpng versions 0.97, January 1998, through 1.6.0beta15 - March 2, 2012: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
@ -198,7 +198,7 @@
|
|||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
*
|
*
|
||||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.0beta15, February 27, 2012, are
|
* libpng versions 1.2.6, August 15, 2004, through 1.6.0beta15, March 2, 2012, are
|
||||||
* Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
|
* Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
|
||||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
* with the following individual added to the list of Contributing Authors:
|
* with the following individual added to the list of Contributing Authors:
|
||||||
@ -310,7 +310,7 @@
|
|||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* February 27, 2012
|
* March 2, 2012
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
@ -376,7 +376,7 @@
|
|||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.0beta15"
|
#define PNG_LIBPNG_VER_STRING "1.6.0beta15"
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.6.0beta15 - February 27, 2012\n"
|
" libpng version 1.6.0beta15 - March 2, 2012\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
@ -2943,6 +2943,17 @@ typedef struct
|
|||||||
* correspond to the red, green and blue end-points defined by sRGB.
|
* correspond to the red, green and blue end-points defined by sRGB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define PNG_IMAGE_FLAG_FAST 0x02
|
||||||
|
/* On write emphasise speed over compression; the resultant PNG file will be
|
||||||
|
* larger but will be produced significantly faster, particular for large
|
||||||
|
* images. Do not use this option for images which will be distributed, only
|
||||||
|
* used it when producing intermediate files that will be read back in
|
||||||
|
* repeatedly. For a typical 24-bit image the option will double the read
|
||||||
|
* speed at the cost of increasing the image size by 25%, however for many
|
||||||
|
* more compressible images the PNG file can be 10 times larger with only a
|
||||||
|
* slight speed gain.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
|
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
/* READ APIs
|
/* READ APIs
|
||||||
* ---------
|
* ---------
|
||||||
|
|||||||
21
pngwrite.c
21
pngwrite.c
@ -731,6 +731,15 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* To do: implement png_do_check_palette_indexes() */
|
||||||
|
/* Check for out-of-range palette index */
|
||||||
|
if (png_ptr->num_palette < (1 << png_ptr->bit_depth))
|
||||||
|
png_do_check_palette_indexes(&row_info, png_ptr->row_buf + 1,
|
||||||
|
png_ptr->num_palette_max);
|
||||||
|
if (png_ptr->num_palette_max > num_palette + 1)
|
||||||
|
png_warning(png_ptr, "Palette index exceeded num_palette");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Find a filter if necessary, filter the row and write it out. */
|
/* Find a filter if necessary, filter the row and write it out. */
|
||||||
png_write_find_filter(png_ptr, &row_info);
|
png_write_find_filter(png_ptr, &row_info);
|
||||||
|
|
||||||
@ -2109,6 +2118,18 @@ png_image_write_main(png_voidp argument)
|
|||||||
display->row_bytes = row_bytes;
|
display->row_bytes = row_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Apply 'fast' options if the flag is set. */
|
||||||
|
if ((image->flags & PNG_IMAGE_FLAG_FAST) != 0)
|
||||||
|
{
|
||||||
|
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, PNG_NO_FILTERS);
|
||||||
|
/* NOTE: determined by experiment using pngstest, this reflects some
|
||||||
|
* balance between the time to write the image once and the time to read
|
||||||
|
* it about 50 times. The speed-up in pngstest was about 10-20% of the
|
||||||
|
* total (user) time on a heavily loaded system.
|
||||||
|
*/
|
||||||
|
png_set_compression_level(png_ptr, 3);
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for the cases that currently require a pre-transform on the row
|
/* Check for the cases that currently require a pre-transform on the row
|
||||||
* before it is written. This only applies when the input is 16-bit and
|
* before it is written. This only applies when the input is 16-bit and
|
||||||
* either there is an alpha channel or it is converted to 8-bit.
|
* either there is an alpha channel or it is converted to 8-bit.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user