提交 ab1477d6 编写于 作者: J John Bowler 提交者: Glenn Randers-Pehrson

[libpng16] Made PNG_NO_READ_GAMMA switch off interfaces that depend on

READ_GAMMA.  Prior to 1.6.0 switching off READ_GAMMA did unpredictable things
to the interfaces that use it (specifically, png_do_background in 1.4 would
simply display composite for grayscale images but do composition
with the incorrect arithmetic for color ones). In 1.6 the semantic
of -DPNG_NO_READ_GAMMA is changed to simply disable any interface that
depends on it; this obliges people who set it to consider whether they
really want it off if they happen to use any of the interfaces in
question (typically most users who disable it won't).
上级 f0fb1746
Libpng 1.6.0beta31 - October 26, 2012
Libpng 1.6.0beta31 - October 27, 2012
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.
......@@ -525,7 +525,7 @@ Version 1.6.0beta30 [October 24, 2012]
Fixed build when using #define PNG_NO_READ_GAMMA in png_do_compose() in
pngrtran.c (Domani Hannes).
Version 1.6.0beta31 [October 26, 2012]
Version 1.6.0beta31 [October 27, 2012]
Undid the erroneous change to vstudio/pngvalid build in libpng-1.6.0beta30.
Made pngvalid so that it will build outside the libpng source tree.
Changed ICC profile support to allow use of an external color management
......@@ -538,7 +538,16 @@ Version 1.6.0beta31 [October 26, 2012]
has been changed to allow an external CMS to be used. This code is
temporarily disabled until a suitable set of test cases using one or more
external CMS implementations have been implemented.
Make builds -DPNG_NO_READ_GAMMA compile (the unit tests still fail).
Made builds -DPNG_NO_READ_GAMMA compile (the unit tests still fail).
Made PNG_NO_READ_GAMMA switch off interfaces that depend on READ_GAMMA.
Prior to 1.6.0 switching off READ_GAMMA did unpredictable things to the
interfaces that use it (specifically, png_do_background in 1.4 would
simply display composite for grayscale images but do composition
with the incorrect arithmetic for color ones). In 1.6 the semantic
of -DPNG_NO_READ_GAMMA is changed to simply disable any interface that
depends on it; this obliges people who set it to consider whether they
really want it off if they happen to use any of the interfaces in
question (typically most users who disable it won't).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
......
......@@ -4277,7 +4277,7 @@ Version 1.6.0beta30 [October 24, 2012]
Fixed build when using #define PNG_NO_READ_GAMMA in png_do_compose() in
pngrtran.c (Domani Hannes).
Version 1.6.0beta31 [October 26, 2012]
Version 1.6.0beta31 [October 27, 2012]
Undid the erroneous change to vstudio/pngvalid build in libpng-1.6.0beta30.
Made pngvalid so that it will build outside the libpng source tree.
Changed ICC profile support to allow use of an external color management
......@@ -4290,7 +4290,16 @@ Version 1.6.0beta31 [October 26, 2012]
has been changed to allow an external CMS to be used. This code is
temporarily disabled until a suitable set of test cases using one or more
external CMS implementations have been implemented.
Make builds -DPNG_NO_READ_GAMMA compile (the unit tests still fail).
Made builds -DPNG_NO_READ_GAMMA compile (the unit tests still fail).
Made PNG_NO_READ_GAMMA switch off interfaces that depend on READ_GAMMA.
Prior to 1.6.0 switching off READ_GAMMA did unpredictable things to the
interfaces that use it (specifically, png_do_background in 1.4 would
simply display composite for grayscale images but do composition
with the incorrect arithmetic for color ones). In 1.6 the semantic
of -DPNG_NO_READ_GAMMA is changed to simply disable any interface that
depends on it; this obliges people who set it to consider whether they
really want it off if they happen to use any of the interfaces in
question (typically most users who disable it won't).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
......
......@@ -244,6 +244,7 @@ random_mod(unsigned int max)
return x % max; /* 0 .. max-1 */
}
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
static int
random_choice(void)
{
......@@ -253,6 +254,7 @@ random_choice(void)
return x & 1;
}
#endif
#endif /* PNG_READ_SUPPORTED */
/* A numeric ID based on PNG file characteristics. The 'do_interlace' field
......@@ -1714,6 +1716,7 @@ white_point(PNG_CONST color_encoding *encoding)
return white;
}
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
static void
normalize_color_encoding(color_encoding *encoding)
{
......@@ -1733,6 +1736,7 @@ normalize_color_encoding(color_encoding *encoding)
encoding->blue.Z /= whiteY;
}
}
#endif
static size_t
safecat_color_encoding(char *buffer, size_t bufsize, size_t pos,
......@@ -1967,6 +1971,7 @@ modifier_init(png_modifier *pm)
* to a calculation - not a digitization operation - unless the following API is
* called directly.
*/
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
static double digitize(PNG_CONST png_modifier *pm, double value,
int sample_depth, int do_round)
{
......@@ -1991,7 +1996,10 @@ static double digitize(PNG_CONST png_modifier *pm, double value,
if (do_round) value += .5;
return floor(value)/digitization_factor;
}
#endif
#if (defined PNG_READ_GAMMA_SUPPORTED) ||\
(defined PNG_READ_RGB_TO_GRAY_SUPPORTED)
static double abserr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
{
/* Absolute error permitted in linear values - affected by the bit depth of
......@@ -2003,6 +2011,7 @@ static double abserr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
else
return pm->maxabs8;
}
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
static double calcerr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
......@@ -2174,6 +2183,7 @@ modification_init(png_modification *pmm)
modification_reset(pmm);
}
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
static void
modifier_current_encoding(PNG_CONST png_modifier *pm, color_encoding *ce)
{
......@@ -2185,6 +2195,7 @@ modifier_current_encoding(PNG_CONST png_modifier *pm, color_encoding *ce)
ce->gamma = pm->current_gamma;
}
#endif
static size_t
safecat_current_encoding(char *buffer, size_t bufsize, size_t pos,
......@@ -6004,6 +6015,7 @@ image_transform_default_ini(PNG_CONST image_transform *this,
this->next->ini(this->next, that);
}
#ifdef PNG_READ_BACKGROUND_SUPPORTED
static int
image_transform_default_add(image_transform *this,
PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth)
......@@ -6016,6 +6028,7 @@ image_transform_default_add(image_transform *this,
return 1;
}
#endif
#ifdef PNG_READ_EXPAND_SUPPORTED
/* png_set_palette_to_rgb */
......@@ -7694,6 +7707,7 @@ gamma_component_compose(int do_background, double input_sample, double alpha,
{
switch (do_background)
{
#ifdef PNG_READ_BACKGROUND_SUPPORTED
case PNG_BACKGROUND_GAMMA_SCREEN:
case PNG_BACKGROUND_GAMMA_FILE:
case PNG_BACKGROUND_GAMMA_UNIQUE:
......@@ -7711,6 +7725,7 @@ gamma_component_compose(int do_background, double input_sample, double alpha,
input_sample = background;
}
break;
#endif
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
case ALPHA_MODE_OFFSET + PNG_ALPHA_STANDARD:
......@@ -7743,6 +7758,9 @@ gamma_component_compose(int do_background, double input_sample, double alpha,
/* Standard cases where no compositing is done (so the component
* value is already correct.)
*/
UNUSED(alpha)
UNUSED(background)
UNUSED(compose)
break;
}
......@@ -8142,11 +8160,13 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi,
*/
switch (do_background)
{
case PNG_BACKGROUND_GAMMA_SCREEN:
case PNG_BACKGROUND_GAMMA_FILE:
case PNG_BACKGROUND_GAMMA_UNIQUE:
use_background = (alpha >= 0 && alpha < 1);
/*FALL THROUGH*/
# ifdef PNG_READ_BACKGROUND_SUPPORTED
case PNG_BACKGROUND_GAMMA_SCREEN:
case PNG_BACKGROUND_GAMMA_FILE:
case PNG_BACKGROUND_GAMMA_UNIQUE:
use_background = (alpha >= 0 && alpha < 1);
/*FALL THROUGH*/
# endif
# ifdef PNG_READ_ALPHA_MODE_SUPPORTED
case ALPHA_MODE_OFFSET + PNG_ALPHA_STANDARD:
case ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN:
......@@ -9065,7 +9085,9 @@ perform_gamma_test(png_modifier *pm, int summary)
/* Save certain values for the temporary overrides below. */
unsigned int calculations_use_input_precision =
pm->calculations_use_input_precision;
double maxout8 = pm->maxout8;
# ifdef PNG_READ_BACKGROUND_SUPPORTED
double maxout8 = pm->maxout8;
# endif
/* First some arbitrary no-transform tests: */
if (!pm->this.speed && pm->test_gamma_threshold)
......
......@@ -147,6 +147,12 @@ logunsupported = 1
@# endif
@#endif
# IN DEVELOPMENT
# These are currently experimental features; define them if you want (NOTE:
# experimental options must be disabled before they are defined in this file!)
option ICC disabled
# Note that PNG_USR_CONFIG only has an effect when building
# pnglibconf.h
......@@ -312,6 +318,20 @@ setting USER_CHUNK_MALLOC_MAX
option SAFE_LIMITS enables USER_LIMITS disabled
= SAFE_LIMITS SAFE_LIMITS
# ICC profile support; basic ICC profile support is enabled if iCCP chunk read
# or write is enabled. The application must perform all iCCP profile handling
# itself. If full support is enabled with the option below libpng will attempt
# to do more processing using the profile data itself, this includes setting
# appropriate values for cHRM and gAMA chunks if not present in the stream.
#
# ICC profile support is not build in to core libpng because of the size of the
# code required; an external ICC implementation must be passed to libpng to
# enable it.
#
# WARNING: this option is CURRENTLY UNTESTED because a test CMS implementation
# has not yet been written, as a result it is disabled in current beta builds.
option ICC requires iCCP enables SAVE_INT_32
# All of the following options relate to code capabilities for
# processing image data before creating a PNG or after reading one.
# You can remove these capabilities safely and still be PNG
......@@ -319,6 +339,19 @@ option SAFE_LIMITS enables USER_LIMITS disabled
# See the comments above about how to change options and settings.
# READ options
#
# WARNING: in libpng 1.5 maintained configuration compatibility with earlier
# versions. In some cases turning off an option turned off other options, in
# others it was ineffective unless dependent options were also turned off.
# Libpng 1.6 changes this: in general if you turn off an option that affects
# APIs it stays off and simply disables APIs that depend on it.
#
# As a result if you simply port the libpng 1.5 configuration to libpng 1.6 you
# will probably see build failures due to missing APIs. Fixing these failures
# requires some, perhaps considerable, knowledge of what your libpng using
# applications are doing, fortunately there is no great reason for you to move
# to libpng 1.6; the new interfaces in 1.6 will take several years to become
# popular.
option READ enables READ_INTERLACING
......@@ -336,27 +369,42 @@ option READ_QUANTIZE requires READ
option READ_TRANSFORMS requires READ
= NO_READ_TRANSFORMS READ_TRANSFORMS_NOT_SUPPORTED
option READ_EXPAND requires READ_TRANSFORMS
option READ_EXPAND_16 requires READ_TRANSFORMS READ_16BIT enables READ_EXPAND
option READ_SHIFT requires READ_TRANSFORMS
option READ_PACK requires READ_TRANSFORMS
# Read gamma handling. Gamma processing is a core part of libpng and many of
# the capabilities are dependent on libpng performing gamma correction.
#
# In libpng 1.6 disabling gamma processing (setting PNG_NO_READ_GAMMA)
# consistently disables those parts of the API that depend on it. Prior to
# 1.6.0 this was not true; the results were unpredictable and varied between
# releases.
#
# If you disable gamma processing and your program no longer compiles you need
# to ask whether you really need the APIs that are missing. If you do then you
# almost certainly need the gamma processing.
#
# If you handle gamma issues outside libpng then you do not need the libpng
# gamma processing; and it is an enormous waste of space. You just need to
# remove the use of libpng APIs that depend on it.
option READ_GAMMA requires READ_TRANSFORMS READ_gAMA
option READ_ALPHA_MODE requires READ_TRANSFORMS READ_GAMMA
option READ_BACKGROUND requires READ_TRANSFORMS READ_STRIP_ALPHA READ_GAMMA
option READ_BGR requires READ_TRANSFORMS
option READ_SWAP requires READ_TRANSFORMS READ_16BIT
option READ_PACKSWAP requires READ_TRANSFORMS
option READ_INVERT requires READ_TRANSFORMS
option READ_BACKGROUND requires READ_TRANSFORMS enables READ_STRIP_ALPHA
option READ_STRIP_16_TO_8 requires READ_TRANSFORMS
option READ_SCALE_16_TO_8 requires READ_TRANSFORMS
option READ_EXPAND_16 requires READ_TRANSFORMS READ_16BIT READ_EXPAND
option READ_EXPAND requires READ_TRANSFORMS
option READ_FILLER requires READ_TRANSFORMS
option READ_GAMMA requires READ_TRANSFORMS enables READ_gAMA
option READ_GRAY_TO_RGB requires READ_TRANSFORMS
option READ_ALPHA_MODE requires READ_TRANSFORMS enables READ_GAMMA
option READ_SWAP_ALPHA requires READ_TRANSFORMS
option READ_INVERT_ALPHA requires READ_TRANSFORMS
option READ_INVERT requires READ_TRANSFORMS
option READ_PACK requires READ_TRANSFORMS
option READ_PACKSWAP requires READ_TRANSFORMS
option READ_RGB_TO_GRAY requires READ_TRANSFORMS READ_GAMMA
option READ_SCALE_16_TO_8 requires READ_TRANSFORMS
option READ_SHIFT requires READ_TRANSFORMS
option READ_STRIP_16_TO_8 requires READ_TRANSFORMS
option READ_STRIP_ALPHA requires READ_TRANSFORMS
option READ_SWAP_ALPHA requires READ_TRANSFORMS
option READ_SWAP requires READ_TRANSFORMS READ_16BIT
option READ_USER_TRANSFORM requires READ_TRANSFORMS
option READ_RGB_TO_GRAY requires READ_TRANSFORMS
option PROGRESSIVE_READ requires READ
option SEQUENTIAL_READ requires READ
......@@ -380,11 +428,6 @@ option INCH_CONVERSIONS
option BUILD_GRAYSCALE_PALETTE
# IN DEVELOPMENT
# These are currently experimental features; define them if you want
# NOTHING HERE
# WRITE options
option WRITE
......@@ -478,20 +521,6 @@ option WRITE_TEXT requires WRITE_ANCILLARY_CHUNKS enables TEXT
option GAMMA disabled
option COLORSPACE enables GAMMA disabled
# ICC profile support; basic ICC profile support is enabled if iCCP chunk read
# or write is enabled. The application must perform all iCCP profile handling
# itself. If full support is enabled with the option below libpng will attempt
# to do more processing using the profile data itself, this includes setting
# appropriate values for cHRM and gAMA chunks if not present in the stream.
#
# ICC profile support is not build in to core libpng because of the size of the
# code required; an external ICC implementation must be passed to libpng to
# enable it.
#
# WARNING: this option is CURRENTLY UNTESTED because a test CMS implementation
# has not yet been written, as a result it is disabled in current beta builds.
option ICC requires iCCP enables SAVE_INT_32 disabled
# When an ICC profile is read, or png_set, it will be checked for a match
# against known sRGB profiles if the sRGB handling is enabled. This
# setting controls how much work is done during the check:
......@@ -749,7 +778,7 @@ option WRITE_CHECK_FOR_INVALID_INDEX requires WRITE CHECK_FOR_INVALID_INDEX
# Simplified API options (added at libpng-1.6.0)
# Read:
option SIMPLIFIED_READ requires SEQUENTIAL_READ READ_TRANSFORMS SETJMP
option SIMPLIFIED_READ requires BENIGN_ERRORS
option SIMPLIFIED_READ requires BENIGN_ERRORS READ_GAMMA
option SIMPLIFIED_READ enables READ_EXPAND READ_16BIT READ_EXPAND_16
option SIMPLIFIED_READ enables READ_SCALE_16_TO_8 READ_RGB_TO_GRAY
option SIMPLIFIED_READ enables READ_ALPHA_MODE READ_BACKGROUND READ_STRIP_ALPHA
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册