mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Removed the ACCURATE and LEGACY options (they are no longer useable)
Fixed some compiliation problems with scaling options.
This commit is contained in:
parent
413138a5ca
commit
550bab03fb
4
ANNOUNCE
4
ANNOUNCE
@ -195,7 +195,9 @@ Version 1.5.4beta01 [June 14, 2011]
|
||||
|
||||
Version 1.5.4beta02 [June 14, 2011]
|
||||
Fixed and clarified LEGACY 16-to-8 scaling code.
|
||||
Added png_set_chop_16() API.
|
||||
Added png_set_chop_16() API, to match inaccurate results from previous
|
||||
libpng versions.
|
||||
Removed the ACCURATE and LEGACY options (they are no longer useable)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
|
||||
(subscription required; visit
|
||||
|
4
CHANGES
4
CHANGES
@ -3458,7 +3458,9 @@ Version 1.5.4beta01 [June 14, 2011]
|
||||
|
||||
Version 1.5.4beta02 [June 14, 2011]
|
||||
Fixed and clarified LEGACY 16-to-8 scaling code.
|
||||
Added png_set_chop_16() API.
|
||||
Added png_set_chop_16() API, to match inaccurate results from previous
|
||||
libpng versions.
|
||||
Removed the ACCURATE and LEGACY options (they are no longer useable)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -2,7 +2,7 @@
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* This file has been placed in the public domain by the authors.
|
||||
* Maintained 1998-2011 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger)
|
||||
|
2
png.h
2
png.h
@ -1423,6 +1423,8 @@ PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr,
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||
/* The following is always done from 1.5.4: */
|
||||
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||
/* Scale a 16-bit depth file down to 8-bit, accurately. */
|
||||
PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
|
||||
/* Strip the second byte of information from a 16-bit depth file. */
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.5.4beta01 - June 14, 2011
|
||||
* libpng version 1.5.4beta02 - June 14, 2011
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
2
pngmem.c
2
pngmem.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
@ -6,7 +6,7 @@
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -298,7 +298,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
|
||||
#define PNG_ENCODE_ALPHA 0x800000L /* Added to libpng-1.5.3 */
|
||||
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
|
||||
#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
|
||||
/* 0x4000000L unused */
|
||||
#define PNG_CHOP_16_TO_8 0x4000000L
|
||||
/* 0x8000000L unused */
|
||||
/* 0x10000000L unused */
|
||||
/* 0x20000000L unused */
|
||||
@ -820,8 +820,13 @@ PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
|
||||
png_bytep row));
|
||||
|
||||
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
|
||||
png_bytep row));
|
||||
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
|
||||
png_bytep row));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
@ -1453,11 +1453,7 @@ 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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
@ -5,7 +5,7 @@
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
58
pngvalid.c
58
pngvalid.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngvalid.c - validate libpng by constructing then reading png files.
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 2011 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
*
|
||||
@ -5265,6 +5265,8 @@ image_transform_png_set_strip_16_mod(PNG_CONST image_transform *this,
|
||||
# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||
/* The strip 16 algorithm drops the low 8 bits rather than calculating
|
||||
* 1/257, so we need to adjust the permitted errors appropriately:
|
||||
* Notice that this is only relevant prior to the addition of the
|
||||
* png_set_chop_16 API in 1.5.4 (but 1.5.4+ always defines the above!)
|
||||
*/
|
||||
{
|
||||
PNG_CONST double d = (255-128.5)/65535;
|
||||
@ -5294,6 +5296,60 @@ image_transform_png_set_strip_16_add(image_transform *this,
|
||||
IT(strip_16);
|
||||
#undef PT
|
||||
#define PT ITSTRUCT(strip_16)
|
||||
|
||||
#if PNG_LIBPNG_VER >= 10504 /* API added in 1.5.4 */
|
||||
/* png_set_chop_16 */
|
||||
static void
|
||||
image_transform_png_set_chop_16_set(PNG_CONST image_transform *this,
|
||||
transform_display *that, png_structp pp, png_infop pi)
|
||||
{
|
||||
png_set_chop_16(pp);
|
||||
this->next->set(this->next, that, pp, pi);
|
||||
}
|
||||
|
||||
static void
|
||||
image_transform_png_set_chop_16_mod(PNG_CONST image_transform *this,
|
||||
image_pixel *that, png_structp pp, PNG_CONST transform_display *display)
|
||||
{
|
||||
if (that->bit_depth == 16)
|
||||
{
|
||||
that->sample_depth = that->bit_depth = 8;
|
||||
if (that->red_sBIT > 8) that->red_sBIT = 8;
|
||||
if (that->green_sBIT > 8) that->green_sBIT = 8;
|
||||
if (that->blue_sBIT > 8) that->blue_sBIT = 8;
|
||||
if (that->alpha_sBIT > 8) that->alpha_sBIT = 8;
|
||||
|
||||
/* From 1.5.4 there is a separate API to do the low byte drop; see the
|
||||
* comments above for why this requires the following:
|
||||
*/
|
||||
{
|
||||
PNG_CONST double d = (255-128.5)/65535;
|
||||
that->rede += d;
|
||||
that->greene += d;
|
||||
that->bluee += d;
|
||||
that->alphae += d;
|
||||
}
|
||||
}
|
||||
|
||||
this->next->mod(this->next, that, pp, display);
|
||||
}
|
||||
|
||||
static int
|
||||
image_transform_png_set_chop_16_add(image_transform *this,
|
||||
PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth)
|
||||
{
|
||||
UNUSED(colour_type)
|
||||
|
||||
this->next = *that;
|
||||
*that = this;
|
||||
|
||||
return bit_depth > 8;
|
||||
}
|
||||
|
||||
IT(chop_16);
|
||||
#undef PT
|
||||
#define PT ITSTRUCT(chop_16)
|
||||
#endif /* From libpng 1.5.4 */
|
||||
#endif /* PNG_READ_16_TO_8_SUPPORTED */
|
||||
|
||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
@ -5,7 +5,7 @@
|
||||
LIBRARY
|
||||
|
||||
EXPORTS
|
||||
;Version 1.5.4beta01
|
||||
;Version 1.5.4beta02
|
||||
png_access_version_number @1
|
||||
png_set_sig_bytes @2
|
||||
png_sig_cmp @3
|
||||
@ -234,3 +234,4 @@ EXPORTS
|
||||
png_set_text_compression_method @226
|
||||
png_set_alpha_mode @227
|
||||
png_set_alpha_mode_fixed @228
|
||||
png_set_chop_16 @229
|
||||
|
Loading…
x
Reference in New Issue
Block a user