mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Change "n bit" to "n-bit" in comments.
This commit is contained in:
parent
a472858297
commit
8b83ff3704
6
ANNOUNCE
6
ANNOUNCE
@ -1,4 +1,4 @@
|
|||||||
Libpng 1.6.19beta02 - August 7, 2015
|
Libpng 1.6.19beta02 - August 14, 2015
|
||||||
|
|
||||||
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.
|
||||||
@ -40,12 +40,14 @@ Version 1.6.19beta01 [July 30, 2015]
|
|||||||
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
|
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
|
||||||
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
|
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
|
||||||
|
|
||||||
Version 1.6.19beta02 [August 7, 2015]
|
Version 1.6.19beta02 [August 14, 2015]
|
||||||
Moved config.h.in~ from the "libpng_autotools_files" list to the
|
Moved config.h.in~ from the "libpng_autotools_files" list to the
|
||||||
"libpng_autotools_extra" list in autogen.sh because it was causing a
|
"libpng_autotools_extra" list in autogen.sh because it was causing a
|
||||||
false positive for missing files (bug report by Robert C. Seacord).
|
false positive for missing files (bug report by Robert C. Seacord).
|
||||||
Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
|
Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
|
||||||
to suppress clang warnings (Bug report by Viktor Szakats).
|
to suppress clang warnings (Bug report by Viktor Szakats).
|
||||||
|
Fixed some bad links in the man page.
|
||||||
|
Change "n bit" to "n-bit" in comments.
|
||||||
|
|
||||||
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
|
||||||
|
4
CHANGES
4
CHANGES
@ -5319,12 +5319,14 @@ Version 1.6.19beta01 [July 30, 2015]
|
|||||||
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
|
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
|
||||||
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
|
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
|
||||||
|
|
||||||
Version 1.6.19beta02 [August 7, 2015]
|
Version 1.6.19beta02 [August 14, 2015]
|
||||||
Moved config.h.in~ from the "libpng_autotools_files" list to the
|
Moved config.h.in~ from the "libpng_autotools_files" list to the
|
||||||
"libpng_autotools_extra" list in autogen.sh because it was causing a
|
"libpng_autotools_extra" list in autogen.sh because it was causing a
|
||||||
false positive for missing files (bug report by Robert C. Seacord).
|
false positive for missing files (bug report by Robert C. Seacord).
|
||||||
Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
|
Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
|
||||||
to suppress clang warnings (Bug report by Viktor Szakats).
|
to suppress clang warnings (Bug report by Viktor Szakats).
|
||||||
|
Fixed some bad links in the man page.
|
||||||
|
Change "n bit" to "n-bit" in comments.
|
||||||
|
|
||||||
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
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
/* Fake a PNG - just write it out directly. */
|
/* Fake a PNG - just write it out directly. */
|
||||||
|
*
|
||||||
|
* COPYRIGHT: Written by John Cunningham Bowler, 2014.
|
||||||
|
* To the extent possible under law, the author has waived all copyright and
|
||||||
|
* related or neighboring rights to this work. This work is published from:
|
||||||
|
* United States.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <zlib.h> /* for crc32 */
|
#include <zlib.h> /* for crc32 */
|
||||||
|
|
||||||
|
@ -2154,7 +2154,7 @@ typedef struct
|
|||||||
int in_opaque; /* Value of input alpha that is opaque */
|
int in_opaque; /* Value of input alpha that is opaque */
|
||||||
int is_palette; /* Sample values come from the palette */
|
int is_palette; /* Sample values come from the palette */
|
||||||
int accumulate; /* Accumlate component errors (don't log) */
|
int accumulate; /* Accumlate component errors (don't log) */
|
||||||
int output_8bit; /* Output is 8 bit (else 16 bit) */
|
int output_8bit; /* Output is 8-bit (else 16-bit) */
|
||||||
|
|
||||||
void (*in_gp)(Pixel*, png_const_voidp);
|
void (*in_gp)(Pixel*, png_const_voidp);
|
||||||
void (*out_gp)(Pixel*, png_const_voidp);
|
void (*out_gp)(Pixel*, png_const_voidp);
|
||||||
|
@ -361,9 +361,9 @@ standard_name_from_id(char *buffer, size_t bufsize, size_t pos, png_uint_32 id)
|
|||||||
WIDTH_FROM_ID(id), HEIGHT_FROM_ID(id), DO_INTERLACE_FROM_ID(id));
|
WIDTH_FROM_ID(id), HEIGHT_FROM_ID(id), DO_INTERLACE_FROM_ID(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convenience API and defines to list valid formats. Note that 16 bit read and
|
/* Convenience API and defines to list valid formats. Note that 16-bit read and
|
||||||
* write support is required to do 16 bit read tests (we must be able to make a
|
* write support is required to do 16-bit read tests (we must be able to make a
|
||||||
* 16 bit image to test!)
|
* 16-bit image to test!)
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
# define WRITE_BDHI 4
|
# define WRITE_BDHI 4
|
||||||
@ -416,7 +416,7 @@ next_format(png_bytep colour_type, png_bytep bit_depth,
|
|||||||
|
|
||||||
*bit_depth = (png_byte)(*bit_depth << 1);
|
*bit_depth = (png_byte)(*bit_depth << 1);
|
||||||
|
|
||||||
/* Palette images are restricted to 8 bit depth */
|
/* Palette images are restricted to 8-bit depth */
|
||||||
if (*bit_depth <= 8
|
if (*bit_depth <= 8
|
||||||
#ifdef DO_16BIT
|
#ifdef DO_16BIT
|
||||||
|| (*colour_type != 3 && *bit_depth <= 16)
|
|| (*colour_type != 3 && *bit_depth <= 16)
|
||||||
@ -723,7 +723,7 @@ store_pool_mark(png_bytep mark)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
/* Use this for random 32 bit values; this function makes sure the result is
|
/* Use this for random 32-bit values; this function makes sure the result is
|
||||||
* non-zero.
|
* non-zero.
|
||||||
*/
|
*/
|
||||||
static png_uint_32
|
static png_uint_32
|
||||||
@ -1950,7 +1950,7 @@ typedef struct png_modifier
|
|||||||
double log8; /* Absolute error in 8 bits to log */
|
double log8; /* Absolute error in 8 bits to log */
|
||||||
double log16; /* Absolute error in 16 bits to log */
|
double log16; /* Absolute error in 16 bits to log */
|
||||||
|
|
||||||
/* Logged 8 and 16 bit errors ('output' values): */
|
/* Logged 8-bit and 16-bit errors ('output' values): */
|
||||||
double error_gray_2;
|
double error_gray_2;
|
||||||
double error_gray_4;
|
double error_gray_4;
|
||||||
double error_gray_8;
|
double error_gray_8;
|
||||||
@ -2110,10 +2110,10 @@ modifier_init(png_modifier *pm)
|
|||||||
/* If pm->calculations_use_input_precision is set then operations will happen
|
/* If pm->calculations_use_input_precision is set then operations will happen
|
||||||
* with the precision of the input, not the precision of the output depth.
|
* with the precision of the input, not the precision of the output depth.
|
||||||
*
|
*
|
||||||
* If pm->assume_16_bit_calculations is set then even 8 bit calculations use 16
|
* If pm->assume_16_bit_calculations is set then even 8-bit calculations use
|
||||||
* bit precision. This only affects those of the following limits that pertain
|
* 16-bit precision. This only affects those of the following limits that
|
||||||
* to a calculation - not a digitization operation - unless the following API is
|
* pertain to a calculation - not a digitization operation - unless the
|
||||||
* called directly.
|
* following API is called directly.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||||
#if DIGITIZE
|
#if DIGITIZE
|
||||||
@ -2184,8 +2184,8 @@ static double pcerr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
|||||||
/* Output error - the error in the encoded value. This is determined by the
|
/* Output error - the error in the encoded value. This is determined by the
|
||||||
* digitization of the output so can be +/-0.5 in the actual output value. In
|
* digitization of the output so can be +/-0.5 in the actual output value. In
|
||||||
* the expand_16 case with the current code in libpng the expand happens after
|
* the expand_16 case with the current code in libpng the expand happens after
|
||||||
* all the calculations are done in 8 bit arithmetic, so even though the output
|
* all the calculations are done in 8-bit arithmetic, so even though the output
|
||||||
* depth is 16 the output error is determined by the 8 bit calculation.
|
* depth is 16 the output error is determined by the 8-bit calculation.
|
||||||
*
|
*
|
||||||
* This limit is not determined by the bit depth of internal calculations.
|
* This limit is not determined by the bit depth of internal calculations.
|
||||||
*
|
*
|
||||||
@ -2194,9 +2194,9 @@ static double pcerr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
|||||||
*/
|
*/
|
||||||
static double outerr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
static double outerr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
||||||
{
|
{
|
||||||
/* There is a serious error in the 2 and 4 bit grayscale transform because
|
/* There is a serious error in the 2- and 4-bit grayscale transform because
|
||||||
* the gamma table value (8 bits) is simply shifted, not rounded, so the
|
* the gamma table value (8 bits) is simply shifted, not rounded, so the
|
||||||
* error in 4 bit grayscale gamma is up to the value below. This is a hack
|
* error in 4-bit grayscale gamma is up to the value below. This is a hack
|
||||||
* to allow pngvalid to succeed:
|
* to allow pngvalid to succeed:
|
||||||
*
|
*
|
||||||
* TODO: fix this in libpng
|
* TODO: fix this in libpng
|
||||||
@ -2226,7 +2226,7 @@ static double outerr(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
|||||||
*/
|
*/
|
||||||
static double outlog(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
static double outlog(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
||||||
{
|
{
|
||||||
/* The command line parameters are either 8 bit (0..255) or 16 bit (0..65535)
|
/* The command line parameters are either 8-bit (0..255) or 16-bit (0..65535)
|
||||||
* and so must be adjusted for low bit depth grayscale:
|
* and so must be adjusted for low bit depth grayscale:
|
||||||
*/
|
*/
|
||||||
if (out_depth <= 8)
|
if (out_depth <= 8)
|
||||||
@ -2259,7 +2259,7 @@ static double outlog(PNG_CONST png_modifier *pm, int in_depth, int out_depth)
|
|||||||
|
|
||||||
/* This complements the above by providing the appropriate quantization for the
|
/* This complements the above by providing the appropriate quantization for the
|
||||||
* final value. Normally this would just be quantization to an integral value,
|
* final value. Normally this would just be quantization to an integral value,
|
||||||
* but in the 8 bit calculation case it's actually quantization to a multiple of
|
* but in the 8-bit calculation case it's actually quantization to a multiple of
|
||||||
* 257!
|
* 257!
|
||||||
*/
|
*/
|
||||||
static int output_quantization_factor(PNG_CONST png_modifier *pm, int in_depth,
|
static int output_quantization_factor(PNG_CONST png_modifier *pm, int in_depth,
|
||||||
@ -2357,7 +2357,7 @@ safecat_current_encoding(char *buffer, size_t bufsize, size_t pos,
|
|||||||
* 1) Nothing (no color space, no gamma).
|
* 1) Nothing (no color space, no gamma).
|
||||||
* 2) Just a gamma value from the gamma array (including 1.0)
|
* 2) Just a gamma value from the gamma array (including 1.0)
|
||||||
* 3) A color space from the encodings array with the corresponding gamma.
|
* 3) A color space from the encodings array with the corresponding gamma.
|
||||||
* 4) The same, but with gamma 1.0 (only really useful with 16 bit calculations)
|
* 4) The same, but with gamma 1.0 (only really useful with 16-bit calculations)
|
||||||
*
|
*
|
||||||
* The iterator selects these in turn, the randomizer selects one at random,
|
* The iterator selects these in turn, the randomizer selects one at random,
|
||||||
* which is used depends on the setting of the 'test_exhaustive' flag. Notice
|
* which is used depends on the setting of the 'test_exhaustive' flag. Notice
|
||||||
@ -2470,7 +2470,7 @@ modifier_set_encoding(png_modifier *pm)
|
|||||||
if (i >= pm->nencodings)
|
if (i >= pm->nencodings)
|
||||||
{
|
{
|
||||||
i %= pm->nencodings;
|
i %= pm->nencodings;
|
||||||
pm->current_gamma = 1; /* Linear, only in the 16 bit case */
|
pm->current_gamma = 1; /* Linear, only in the 16-bit case */
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -2517,7 +2517,7 @@ modifier_crc(png_bytep buffer)
|
|||||||
*/
|
*/
|
||||||
uInt datalen = png_get_uint_32(buffer);
|
uInt datalen = png_get_uint_32(buffer);
|
||||||
uLong crc = crc32(0, buffer+4, datalen+4);
|
uLong crc = crc32(0, buffer+4, datalen+4);
|
||||||
/* The cast to png_uint_32 is safe because a crc32 is always a 32 bit value.
|
/* The cast to png_uint_32 is safe because a crc32 is always a 32-bit value.
|
||||||
*/
|
*/
|
||||||
png_save_uint_32(buffer+datalen+8, (png_uint_32)crc);
|
png_save_uint_32(buffer+datalen+8, (png_uint_32)crc);
|
||||||
}
|
}
|
||||||
@ -2763,7 +2763,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi)
|
|||||||
|
|
||||||
/* This is another Horowitz and Hill random noise generator. In this case
|
/* This is another Horowitz and Hill random noise generator. In this case
|
||||||
* the aim is to stress the progressive reader with truly horrible variable
|
* the aim is to stress the progressive reader with truly horrible variable
|
||||||
* buffer sizes in the range 1..500, so a sequence of 9 bit random numbers
|
* buffer sizes in the range 1..500, so a sequence of 9-bit random numbers
|
||||||
* is generated. We could probably just count from 1 to 32767 and get as
|
* is generated. We could probably just count from 1 to 32767 and get as
|
||||||
* good a result.
|
* good a result.
|
||||||
*/
|
*/
|
||||||
@ -3420,8 +3420,8 @@ transform_row(png_const_structp pp, png_byte buffer[TRANSFORM_ROWMAX],
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
/* Generate all 65536 pixel values in order, which includes the 8 bit
|
/* Generate all 65536 pixel values in order, which includes the 8-bit
|
||||||
* GA case as well as the 16 bit G case.
|
* GA case as well as the 16-bit G case.
|
||||||
*/
|
*/
|
||||||
while (i<128)
|
while (i<128)
|
||||||
{
|
{
|
||||||
@ -3482,7 +3482,7 @@ transform_row(png_const_structp pp, png_byte buffer[TRANSFORM_ROWMAX],
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case 64:
|
case 64:
|
||||||
/* As above in the 32 bit case. */
|
/* As above in the 32-bit case. */
|
||||||
while (i<128)
|
while (i<128)
|
||||||
{
|
{
|
||||||
png_uint_32 t = v++;
|
png_uint_32 t = v++;
|
||||||
@ -5282,7 +5282,7 @@ test_size(png_modifier* PNG_CONST pm, png_byte PNG_CONST colour_type,
|
|||||||
{
|
{
|
||||||
/* Run the tests on each combination.
|
/* Run the tests on each combination.
|
||||||
*
|
*
|
||||||
* NOTE: on my 32 bit x86 each of the following blocks takes
|
* NOTE: on my 32-bit x86 each of the following blocks takes
|
||||||
* a total of 3.5 seconds if done across every combo of bit depth
|
* a total of 3.5 seconds if done across every combo of bit depth
|
||||||
* width and height. This is a waste of time in practice, hence the
|
* width and height. This is a waste of time in practice, hence the
|
||||||
* hinc and winc stuff:
|
* hinc and winc stuff:
|
||||||
@ -6162,9 +6162,9 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
|||||||
|
|
||||||
memset(out_palette, 0x5e, sizeof out_palette);
|
memset(out_palette, 0x5e, sizeof out_palette);
|
||||||
|
|
||||||
/* use-input-precision means assume that if the input has 8 bit (or less)
|
/* use-input-precision means assume that if the input has 8-bit (or less)
|
||||||
* samples and the output has 16 bit samples the calculations will be done
|
* samples and the output has 16-bit samples the calculations will be done
|
||||||
* with 8 bit precision, not 16.
|
* with 8-bit precision, not 16.
|
||||||
*/
|
*/
|
||||||
if (in_ct == PNG_COLOR_TYPE_PALETTE || in_bd < 16)
|
if (in_ct == PNG_COLOR_TYPE_PALETTE || in_bd < 16)
|
||||||
in_sample_depth = 8;
|
in_sample_depth = 8;
|
||||||
@ -6175,7 +6175,7 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
|||||||
!dp->pm->calculations_use_input_precision)
|
!dp->pm->calculations_use_input_precision)
|
||||||
digitization_error = .5;
|
digitization_error = .5;
|
||||||
|
|
||||||
/* Else calculations are at 8 bit precision, and the output actually
|
/* Else calculations are at 8-bit precision, and the output actually
|
||||||
* consists of scaled 8-bit values, so scale .5 in 8 bits to the 16 bits:
|
* consists of scaled 8-bit values, so scale .5 in 8 bits to the 16 bits:
|
||||||
*/
|
*/
|
||||||
else
|
else
|
||||||
@ -7063,7 +7063,7 @@ image_transform_png_set_rgb_to_gray_ini(PNG_CONST image_transform *this,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* With no gamma correction a large error comes from the truncation of the
|
/* With no gamma correction a large error comes from the truncation of the
|
||||||
* calculation in the 8 bit case, allow for that here.
|
* calculation in the 8-bit case, allow for that here.
|
||||||
*/
|
*/
|
||||||
if (that->this.bit_depth != 16 && !pm->assume_16_bit_calculations)
|
if (that->this.bit_depth != 16 && !pm->assume_16_bit_calculations)
|
||||||
that->pm->limit += 4E-3;
|
that->pm->limit += 4E-3;
|
||||||
@ -7301,7 +7301,7 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
|||||||
* coefficients add up to 32768 can cause a larger rounding error.
|
* coefficients add up to 32768 can cause a larger rounding error.
|
||||||
*
|
*
|
||||||
* The only time when rounding doesn't occur in 1.5.5 and later is when
|
* The only time when rounding doesn't occur in 1.5.5 and later is when
|
||||||
* the non-gamma code path is used for less than 16 bit data.
|
* the non-gamma code path is used for less than 16-bit data.
|
||||||
*/
|
*/
|
||||||
gray = r * data.red_coefficient + g * data.green_coefficient +
|
gray = r * data.red_coefficient + g * data.green_coefficient +
|
||||||
b * data.blue_coefficient;
|
b * data.blue_coefficient;
|
||||||
@ -8572,7 +8572,7 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
|||||||
# ifdef PNG_READ_16_TO_8_SUPPORTED
|
# ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||||
png_set_strip_16(pp);
|
png_set_strip_16(pp);
|
||||||
# else
|
# else
|
||||||
png_error(pp, "scale16 (16 to 8 bit conversion) not supported");
|
png_error(pp, "scale16 (16-bit to 8-bit conversion) not supported");
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@ -8580,7 +8580,7 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
|||||||
# ifdef PNG_READ_EXPAND_16_SUPPORTED
|
# ifdef PNG_READ_EXPAND_16_SUPPORTED
|
||||||
png_set_expand_16(pp);
|
png_set_expand_16(pp);
|
||||||
# else
|
# else
|
||||||
png_error(pp, "expand16 (8 to 16 bit conversion) not supported");
|
png_error(pp, "expand16 (8-bit to 16-bit conversion) not supported");
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (dp->do_background >= ALPHA_MODE_OFFSET)
|
if (dp->do_background >= ALPHA_MODE_OFFSET)
|
||||||
@ -9075,7 +9075,7 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi,
|
|||||||
/* If 'compose' is true the composition was done in linear space using
|
/* If 'compose' is true the composition was done in linear space using
|
||||||
* integer arithmetic. This introduces an extra error of +/- 0.5 (at
|
* integer arithmetic. This introduces an extra error of +/- 0.5 (at
|
||||||
* least) in the integer space used. 'maxcalc' records this, taking
|
* least) in the integer space used. 'maxcalc' records this, taking
|
||||||
* into account the possibility that even for 16 bit output 8 bit space
|
* into account the possibility that even for 16-bit output 8-bit space
|
||||||
* may have been used.
|
* may have been used.
|
||||||
*/
|
*/
|
||||||
if (compose && tmp < vi->maxcalc) tmp = vi->maxcalc;
|
if (compose && tmp < vi->maxcalc) tmp = vi->maxcalc;
|
||||||
@ -9251,7 +9251,7 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi,
|
|||||||
if (encoded_error < vi->outlog)
|
if (encoded_error < vi->outlog)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
pass = "within 8 bit limits:\n";
|
pass = "within 8-bit limits:\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@ -9993,8 +9993,8 @@ static void perform_gamma_sbit_tests(png_modifier *pm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note that this requires a 16 bit source image but produces 8 bit output, so
|
/* Note that this requires a 16-bit source image but produces 8-bit output, so
|
||||||
* we only need the 16bit write support, but the 16 bit images are only
|
* we only need the 16bit write support, but the 16-bit images are only
|
||||||
* generated if DO_16BIT is defined.
|
* generated if DO_16BIT is defined.
|
||||||
*/
|
*/
|
||||||
#ifdef DO_16BIT
|
#ifdef DO_16BIT
|
||||||
@ -10051,7 +10051,7 @@ static void perform_gamma_scale16_tests(png_modifier *pm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* 16 to 8 bit conversion */
|
#endif /* 16-bit to 8-bit conversion */
|
||||||
|
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||||
@ -10113,7 +10113,7 @@ static void gamma_composition_test(png_modifier *pm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Use random background values - the background is always presented in the
|
/* Use random background values - the background is always presented in the
|
||||||
* output space (8 or 16 bit components).
|
* output space (8-bit or 16-bit components).
|
||||||
*/
|
*/
|
||||||
if (expand_16 || bit_depth == 16)
|
if (expand_16 || bit_depth == 16)
|
||||||
{
|
{
|
||||||
@ -10148,7 +10148,7 @@ static void gamma_composition_test(png_modifier *pm,
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
else /* 8 bit colors */
|
else /* 8-bit colors */
|
||||||
{
|
{
|
||||||
png_uint_32 r = random_32();
|
png_uint_32 r = random_32();
|
||||||
|
|
||||||
@ -10278,16 +10278,16 @@ summarize_gamma_errors(png_modifier *pm, png_const_charp who, int low_bit_depth,
|
|||||||
|
|
||||||
if (low_bit_depth)
|
if (low_bit_depth)
|
||||||
{
|
{
|
||||||
print_one(" 2 bit gray: ", pm->error_gray_2);
|
print_one(" 2-bit gray: ", pm->error_gray_2);
|
||||||
print_one(" 4 bit gray: ", pm->error_gray_4);
|
print_one(" 4-bit gray: ", pm->error_gray_4);
|
||||||
print_one(" 8 bit gray: ", pm->error_gray_8);
|
print_one(" 8-bit gray: ", pm->error_gray_8);
|
||||||
print_one(" 8 bit color:", pm->error_color_8);
|
print_one(" 8-bit color:", pm->error_color_8);
|
||||||
if (indexed)
|
if (indexed)
|
||||||
print_one(" indexed: ", pm->error_indexed);
|
print_one(" indexed: ", pm->error_indexed);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_one("16 bit gray: ", pm->error_gray_16);
|
print_one("16-bit gray: ", pm->error_gray_16);
|
||||||
print_one("16 bit color:", pm->error_color_16);
|
print_one("16-bit color:", pm->error_color_16);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
@ -10325,10 +10325,10 @@ perform_gamma_test(png_modifier *pm, int summary)
|
|||||||
printf("value (always an integer) and the ideal value from the\n");
|
printf("value (always an integer) and the ideal value from the\n");
|
||||||
printf("libpng specification (typically not an integer).\n\n");
|
printf("libpng specification (typically not an integer).\n\n");
|
||||||
|
|
||||||
printf("Expect this value to be less than .5 for 8 bit formats,\n");
|
printf("Expect this value to be less than .5 for 8-bit formats,\n");
|
||||||
printf("less than 1 for formats with fewer than 8 bits and a small\n");
|
printf("less than 1 for formats with fewer than 8 bits and a small\n");
|
||||||
printf("number (typically less than 5) for the 16 bit formats.\n");
|
printf("number (typically less than 5) for the 16-bit formats.\n");
|
||||||
printf("For performance reasons the value for 16 bit formats\n");
|
printf("For performance reasons the value for 16-bit formats\n");
|
||||||
printf("increases when the image file includes an sBIT chunk.\n");
|
printf("increases when the image file includes an sBIT chunk.\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
@ -10366,16 +10366,16 @@ perform_gamma_test(png_modifier *pm, int summary)
|
|||||||
#ifdef DO_16BIT /* Should be READ_16BIT_SUPPORTED */
|
#ifdef DO_16BIT /* Should be READ_16BIT_SUPPORTED */
|
||||||
if (pm->test_gamma_scale16)
|
if (pm->test_gamma_scale16)
|
||||||
{
|
{
|
||||||
/* The 16 to 8 bit strip operations: */
|
/* The 16-bit to 8-bit strip operations: */
|
||||||
init_gamma_errors(pm);
|
init_gamma_errors(pm);
|
||||||
perform_gamma_scale16_tests(pm);
|
perform_gamma_scale16_tests(pm);
|
||||||
|
|
||||||
if (summary)
|
if (summary)
|
||||||
{
|
{
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
printf("\nGamma correction with 16 to 8 bit reduction:\n");
|
printf("\nGamma correction with 16-bit to 8-bit reduction:\n");
|
||||||
printf(" 16 bit gray: %.5f\n", pm->error_gray_16);
|
printf(" 16-bit gray: %.5f\n", pm->error_gray_16);
|
||||||
printf(" 16 bit color: %.5f\n", pm->error_color_16);
|
printf(" 16-bit color: %.5f\n", pm->error_color_16);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10395,7 +10395,7 @@ perform_gamma_test(png_modifier *pm, int summary)
|
|||||||
if (pm->test_gamma_expand16)
|
if (pm->test_gamma_expand16)
|
||||||
{
|
{
|
||||||
pm->calculations_use_input_precision = 1;
|
pm->calculations_use_input_precision = 1;
|
||||||
pm->maxout8 = .499; /* because the 16 bit background is smashed */
|
pm->maxout8 = .499; /* because the 16-bit background is smashed */
|
||||||
}
|
}
|
||||||
perform_gamma_composition_tests(pm, PNG_BACKGROUND_GAMMA_UNIQUE,
|
perform_gamma_composition_tests(pm, PNG_BACKGROUND_GAMMA_UNIQUE,
|
||||||
pm->test_gamma_expand16);
|
pm->test_gamma_expand16);
|
||||||
@ -10949,7 +10949,7 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
pm.assume_16_bit_calculations = PNG_LIBPNG_VER >= 10700;
|
pm.assume_16_bit_calculations = PNG_LIBPNG_VER >= 10700;
|
||||||
|
|
||||||
/* Currently 16 bit expansion happens at the end of the pipeline, so the
|
/* Currently 16-bit expansion happens at the end of the pipeline, so the
|
||||||
* calculations are done in the input bit depth not the output.
|
* calculations are done in the input bit depth not the output.
|
||||||
*
|
*
|
||||||
* TODO: fix this
|
* TODO: fix this
|
||||||
@ -10992,8 +10992,8 @@ int main(int argc, char **argv)
|
|||||||
/* Some default values (set the behavior for 'make check' here).
|
/* Some default values (set the behavior for 'make check' here).
|
||||||
* These values simply control the maximum error permitted in the gamma
|
* These values simply control the maximum error permitted in the gamma
|
||||||
* transformations. The practial limits for human perception are described
|
* transformations. The practial limits for human perception are described
|
||||||
* below (the setting for maxpc16), however for 8 bit encodings it isn't
|
* below (the setting for maxpc16), however for 8-bit encodings it isn't
|
||||||
* possible to meet the accepted capabilities of human vision - i.e. 8 bit
|
* possible to meet the accepted capabilities of human vision - i.e. 8-bit
|
||||||
* images can never be good enough, regardless of encoding.
|
* images can never be good enough, regardless of encoding.
|
||||||
*/
|
*/
|
||||||
pm.maxout8 = .1; /* Arithmetic error in *encoded* value */
|
pm.maxout8 = .1; /* Arithmetic error in *encoded* value */
|
||||||
@ -11009,8 +11009,8 @@ int main(int argc, char **argv)
|
|||||||
* perceive light level differences of 1% over a 100:1 range, so we need to
|
* perceive light level differences of 1% over a 100:1 range, so we need to
|
||||||
* maintain 1 in 10000 accuracy (in linear light space), which is what the
|
* maintain 1 in 10000 accuracy (in linear light space), which is what the
|
||||||
* following guarantees. It also allows significantly higher errors at
|
* following guarantees. It also allows significantly higher errors at
|
||||||
* higher 16 bit values, which is important for performance. The actual
|
* higher 16-bit values, which is important for performance. The actual
|
||||||
* maximum 16 bit error is about +/-1.9 in the fixed point implementation but
|
* maximum 16-bit error is about +/-1.9 in the fixed point implementation but
|
||||||
* this is only allowed for values >38149 by the following:
|
* this is only allowed for values >38149 by the following:
|
||||||
*/
|
*/
|
||||||
pm.maxpc16 = .005; /* I.e., 1/200% - 1/20000 */
|
pm.maxpc16 = .005; /* I.e., 1/200% - 1/20000 */
|
||||||
|
@ -634,7 +634,7 @@ int validation_muldiv(int count, int argc, char **argv)
|
|||||||
{
|
{
|
||||||
png_fixed_point result;
|
png_fixed_point result;
|
||||||
/* NOTE: your mileage may vary, a type is required below that can
|
/* NOTE: your mileage may vary, a type is required below that can
|
||||||
* hold 64 bits or more, if floating point is used a 64 bit or
|
* hold 64 bits or more, if floating point is used a 64-bit or
|
||||||
* better mantissa is required.
|
* better mantissa is required.
|
||||||
*/
|
*/
|
||||||
long long int fp, fpround;
|
long long int fp, fpround;
|
||||||
@ -721,7 +721,7 @@ int validation_muldiv(int count, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
while (--count > 0);
|
while (--count > 0);
|
||||||
|
|
||||||
printf("%d tests including %d overflows, %d passed, %d failed (%d 64 bit "
|
printf("%d tests including %d overflows, %d passed, %d failed (%d 64-bit "
|
||||||
"errors)\n", tested, overflow, passed, error, error64);
|
"errors)\n", tested, overflow, passed, error, error64);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -799,13 +799,13 @@ int validation_gamma(int argc, char **argv)
|
|||||||
if (i == 0 && png_log8bit(i) != 0xffffffff ||
|
if (i == 0 && png_log8bit(i) != 0xffffffff ||
|
||||||
i != 0 && png_log8bit(i) != floor(correct+.5))
|
i != 0 && png_log8bit(i) != floor(correct+.5))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "8 bit log error: %d: got %u, expected %f\n",
|
fprintf(stderr, "8-bit log error: %d: got %u, expected %f\n",
|
||||||
i, png_log8bit(i), correct);
|
i, png_log8bit(i), correct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("maximum 8 bit log error = %f\n", maxerr);
|
printf("maximum 8-bit log error = %f\n", maxerr);
|
||||||
|
|
||||||
maxerr = 0;
|
maxerr = 0;
|
||||||
for (i=0; i<65536; ++i)
|
for (i=0; i<65536; ++i)
|
||||||
@ -821,14 +821,14 @@ int validation_gamma(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (error > .68) /* By experiment error is less than .68 */
|
if (error > .68) /* By experiment error is less than .68 */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "16 bit log error: %d: got %u, expected %f"
|
fprintf(stderr, "16-bit log error: %d: got %u, expected %f"
|
||||||
" error: %f\n", i, png_log16bit(i), correct, error);
|
" error: %f\n", i, png_log16bit(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("maximum 16 bit log error = %f\n", maxerr);
|
printf("maximum 16-bit log error = %f\n", maxerr);
|
||||||
|
|
||||||
/* Now exponentiations. */
|
/* Now exponentiations. */
|
||||||
maxerr = 0;
|
maxerr = 0;
|
||||||
@ -841,13 +841,13 @@ int validation_gamma(int argc, char **argv)
|
|||||||
maxerr = fabs(error);
|
maxerr = fabs(error);
|
||||||
if (fabs(error) > 1883) /* By experiment. */
|
if (fabs(error) > 1883) /* By experiment. */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "32 bit exp error: %d: got %u, expected %f"
|
fprintf(stderr, "32-bit exp error: %d: got %u, expected %f"
|
||||||
" error: %f\n", i, png_exp(i), correct, error);
|
" error: %f\n", i, png_exp(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("maximum 32 bit exp error = %f\n", maxerr);
|
printf("maximum 32-bit exp error = %f\n", maxerr);
|
||||||
|
|
||||||
maxerr = 0;
|
maxerr = 0;
|
||||||
for (i=0; i<=0xfffff; ++i)
|
for (i=0; i<=0xfffff; ++i)
|
||||||
@ -859,13 +859,13 @@ int validation_gamma(int argc, char **argv)
|
|||||||
maxerr = fabs(error);
|
maxerr = fabs(error);
|
||||||
if (fabs(error) > .50002) /* By experiment */
|
if (fabs(error) > .50002) /* By experiment */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "8 bit exp error: %d: got %u, expected %f"
|
fprintf(stderr, "8-bit exp error: %d: got %u, expected %f"
|
||||||
" error: %f\n", i, png_exp8bit(i), correct, error);
|
" error: %f\n", i, png_exp8bit(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("maximum 8 bit exp error = %f\n", maxerr);
|
printf("maximum 8-bit exp error = %f\n", maxerr);
|
||||||
|
|
||||||
maxerr = 0;
|
maxerr = 0;
|
||||||
for (i=0; i<=0xfffff; ++i)
|
for (i=0; i<=0xfffff; ++i)
|
||||||
@ -877,13 +877,13 @@ int validation_gamma(int argc, char **argv)
|
|||||||
maxerr = fabs(error);
|
maxerr = fabs(error);
|
||||||
if (fabs(error) > .524) /* By experiment */
|
if (fabs(error) > .524) /* By experiment */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "16 bit exp error: %d: got %u, expected %f"
|
fprintf(stderr, "16-bit exp error: %d: got %u, expected %f"
|
||||||
" error: %f\n", i, png_exp16bit(i), correct, error);
|
" error: %f\n", i, png_exp16bit(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("maximum 16 bit exp error = %f\n", maxerr);
|
printf("maximum 16-bit exp error = %f\n", maxerr);
|
||||||
} /* !onlygamma */
|
} /* !onlygamma */
|
||||||
|
|
||||||
/* Test the overall gamma correction. */
|
/* Test the overall gamma correction. */
|
||||||
@ -913,7 +913,7 @@ int validation_gamma(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("gamma %f: maximum 8 bit error %f\n", g, maxerr);
|
printf("gamma %f: maximum 8-bit error %f\n", g, maxerr);
|
||||||
|
|
||||||
maxerr = 0;
|
maxerr = 0;
|
||||||
for (j=0; j<65536; ++j)
|
for (j=0; j<65536; ++j)
|
||||||
@ -932,7 +932,7 @@ int validation_gamma(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("gamma %f: maximum 16 bit error %f\n", g, maxerr);
|
printf("gamma %f: maximum 16-bit error %f\n", g, maxerr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -266,7 +266,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
|||||||
png_set_expand (png_ptr);
|
png_set_expand (png_ptr);
|
||||||
|
|
||||||
#ifdef NJET
|
#ifdef NJET
|
||||||
/* downgrade 16-bit images to 8 bit */
|
/* downgrade 16-bit images to 8-bit */
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
png_set_strip_16 (png_ptr);
|
png_set_strip_16 (png_ptr);
|
||||||
/* transform grayscale images into full-color */
|
/* transform grayscale images into full-color */
|
||||||
|
@ -134,7 +134,7 @@
|
|||||||
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The 8 byte signature as a pair of 32 bit quantities */
|
/* The 8-byte signature as a pair of 32-bit quantities */
|
||||||
#define sig1 PNG_U32(137, 80, 78, 71)
|
#define sig1 PNG_U32(137, 80, 78, 71)
|
||||||
#define sig2 PNG_U32( 13, 10, 26, 10)
|
#define sig2 PNG_U32( 13, 10, 26, 10)
|
||||||
|
|
||||||
@ -156,7 +156,7 @@
|
|||||||
*/
|
*/
|
||||||
#define UNREACHED 0
|
#define UNREACHED 0
|
||||||
|
|
||||||
/* 80-bit number handling - a PNG image can be up to (2^31-1)x(2^31-1) 8 byte
|
/* 80-bit number handling - a PNG image can be up to (2^31-1)x(2^31-1) 8-byte
|
||||||
* (16-bit RGBA) pixels in size; that's less than 2^65 bytes or 2^68 bits, so
|
* (16-bit RGBA) pixels in size; that's less than 2^65 bytes or 2^68 bits, so
|
||||||
* arithmetic of 80-bit numbers is sufficient. This representation uses an
|
* arithmetic of 80-bit numbers is sufficient. This representation uses an
|
||||||
* arbitrary length array of png_uint_16 digits (0..65535). The representation
|
* arbitrary length array of png_uint_16 digits (0..65535). The representation
|
||||||
@ -584,7 +584,7 @@ chunk_type_valid(png_uint_32 c)
|
|||||||
c &= ~PNG_U32(32,32,0,32);
|
c &= ~PNG_U32(32,32,0,32);
|
||||||
t = (c & ~0x1f1f1f1f) ^ 0x40404040;
|
t = (c & ~0x1f1f1f1f) ^ 0x40404040;
|
||||||
|
|
||||||
/* Subtract 65 for each 8 bit quantity, this must not overflow
|
/* Subtract 65 for each 8-bit quantity, this must not overflow
|
||||||
* and each byte must then be in the range 0-25.
|
* and each byte must then be in the range 0-25.
|
||||||
*/
|
*/
|
||||||
c -= PNG_U32(65,65,65,65);
|
c -= PNG_U32(65,65,65,65);
|
||||||
|
@ -370,7 +370,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
* are mutually exclusive.
|
* are mutually exclusive.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Tell libpng to strip 16 bit/color files down to 8 bits/color.
|
/* Tell libpng to strip 16 bits/color files down to 8 bits/color.
|
||||||
* Use accurate scaling if it's available, otherwise just chop off the
|
* Use accurate scaling if it's available, otherwise just chop off the
|
||||||
* low byte.
|
* low byte.
|
||||||
*/
|
*/
|
||||||
@ -466,7 +466,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
/* Quantize RGB files down to 8 bit palette or reduce palettes
|
/* Quantize RGB files down to 8-bit palette or reduce palettes
|
||||||
* to the number of colors available on your screen.
|
* to the number of colors available on your screen.
|
||||||
*/
|
*/
|
||||||
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
@ -518,7 +518,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||||
png_set_swap_alpha(png_ptr);
|
png_set_swap_alpha(png_ptr);
|
||||||
|
|
||||||
/* Swap bytes of 16 bit files to least significant byte first */
|
/* Swap bytes of 16-bit files to least significant byte first */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
||||||
@ -966,7 +966,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
/* Swap bytes of 16-bit files to most significant byte first */
|
/* Swap bytes of 16-bit files to most significant byte first */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* Swap bits of 1, 2, 4 bit packed pixel formats */
|
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
|
||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
|
|
||||||
/* Turn on interlace handling if you are not using png_write_image() */
|
/* Turn on interlace handling if you are not using png_write_image() */
|
||||||
|
4
png.c
4
png.c
@ -769,13 +769,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||||||
#else
|
#else
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.19beta02 - August 7, 2015" PNG_STRING_NEWLINE \
|
"libpng version 1.6.19beta02 - August 14, 2015" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE;
|
PNG_STRING_NEWLINE;
|
||||||
# else
|
# else
|
||||||
return "libpng version 1.6.19beta02 - August 7, 2015\
|
return "libpng version 1.6.19beta02 - August 14, 2015\
|
||||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||||
|
10
png.h
10
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.19beta02, July 30, 2015
|
* libpng version 1.6.19beta02, August 14, 2015
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -12,7 +12,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.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.19beta02, July 30, 2015: Glenn
|
* libpng versions 0.97, January 1998, through 1.6.19beta02, August 14, 2015: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
@ -251,7 +251,7 @@
|
|||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
*
|
*
|
||||||
* libpng versions 1.0.7, July 1, 2000, through 1.6.19beta02, July 30, 2015, are
|
* libpng versions 1.0.7, July 1, 2000, through 1.6.19beta02, August 14, 2015, are
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
||||||
* distributed according to the same disclaimer and license as libpng-1.0.6
|
* distributed according to the same disclaimer and license as libpng-1.0.6
|
||||||
* with the following individuals added to the list of Contributing Authors:
|
* with the following individuals added to the list of Contributing Authors:
|
||||||
@ -360,7 +360,7 @@
|
|||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* July 30, 2015
|
* August 14, 2015
|
||||||
*
|
*
|
||||||
* 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.
|
||||||
@ -430,7 +430,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.19beta02"
|
#define PNG_LIBPNG_VER_STRING "1.6.19beta02"
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.6.19beta02 - July 30, 2015\n"
|
" libpng version 1.6.19beta02 - August 14, 2015\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
|
||||||
|
12
pngconf.h
12
pngconf.h
@ -63,7 +63,7 @@
|
|||||||
*/
|
*/
|
||||||
#define PNG_CONST const /* backward compatibility only */
|
#define PNG_CONST const /* backward compatibility only */
|
||||||
|
|
||||||
/* This controls optimization of the reading of 16 and 32 bit values
|
/* This controls optimization of the reading of 16-bit and 32-bit values
|
||||||
* from PNG files. It can be set on a per-app-file basis - it
|
* from PNG files. It can be set on a per-app-file basis - it
|
||||||
* just changes whether a macro is used when the function is called.
|
* just changes whether a macro is used when the function is called.
|
||||||
* The library builder sets the default; if read functions are not
|
* The library builder sets the default; if read functions are not
|
||||||
@ -480,7 +480,7 @@
|
|||||||
#if CHAR_BIT == 8 && UCHAR_MAX == 255
|
#if CHAR_BIT == 8 && UCHAR_MAX == 255
|
||||||
typedef unsigned char png_byte;
|
typedef unsigned char png_byte;
|
||||||
#else
|
#else
|
||||||
# error "libpng requires 8 bit bytes"
|
# error "libpng requires 8-bit bytes"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if INT_MIN == -32768 && INT_MAX == 32767
|
#if INT_MIN == -32768 && INT_MAX == 32767
|
||||||
@ -488,7 +488,7 @@
|
|||||||
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
|
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
|
||||||
typedef short png_int_16;
|
typedef short png_int_16;
|
||||||
#else
|
#else
|
||||||
# error "libpng requires a signed 16 bit type"
|
# error "libpng requires a signed 16-bit type"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UINT_MAX == 65535
|
#if UINT_MAX == 65535
|
||||||
@ -496,7 +496,7 @@
|
|||||||
#elif USHRT_MAX == 65535
|
#elif USHRT_MAX == 65535
|
||||||
typedef unsigned short png_uint_16;
|
typedef unsigned short png_uint_16;
|
||||||
#else
|
#else
|
||||||
# error "libpng requires an unsigned 16 bit type"
|
# error "libpng requires an unsigned 16-bit type"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
|
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
|
||||||
@ -504,7 +504,7 @@
|
|||||||
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
|
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
|
||||||
typedef long int png_int_32;
|
typedef long int png_int_32;
|
||||||
#else
|
#else
|
||||||
# error "libpng requires a signed 32 bit (or more) type"
|
# error "libpng requires a signed 32-bit (or more) type"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UINT_MAX > 4294967294
|
#if UINT_MAX > 4294967294
|
||||||
@ -512,7 +512,7 @@
|
|||||||
#elif ULONG_MAX > 4294967294
|
#elif ULONG_MAX > 4294967294
|
||||||
typedef unsigned long int png_uint_32;
|
typedef unsigned long int png_uint_32;
|
||||||
#else
|
#else
|
||||||
# error "libpng requires an unsigned 32 bit (or more) type"
|
# error "libpng requires an unsigned 32-bit (or more) type"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
|
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
|
||||||
|
@ -563,7 +563,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
|||||||
* are of different types and we don't know which variable has the fewest
|
* are of different types and we don't know which variable has the fewest
|
||||||
* bits. Carefully select the smaller and cast it to the type of the
|
* bits. Carefully select the smaller and cast it to the type of the
|
||||||
* larger - this cannot overflow. Do not cast in the following test - it
|
* larger - this cannot overflow. Do not cast in the following test - it
|
||||||
* will break on either 16 or 64 bit platforms.
|
* will break on either 16-bit or 64-bit platforms.
|
||||||
*/
|
*/
|
||||||
if (idat_size < save_size)
|
if (idat_size < save_size)
|
||||||
save_size = (png_size_t)idat_size;
|
save_size = (png_size_t)idat_size;
|
||||||
|
@ -665,7 +665,7 @@
|
|||||||
/* The fixed point conversion performs range checking and evaluates
|
/* The fixed point conversion performs range checking and evaluates
|
||||||
* its argument multiple times, so must be used with care. The
|
* its argument multiple times, so must be used with care. The
|
||||||
* range checking uses the PNG specification values for a signed
|
* range checking uses the PNG specification values for a signed
|
||||||
* 32 bit fixed point value except that the values are deliberately
|
* 32-bit fixed point value except that the values are deliberately
|
||||||
* rounded-to-zero to an integral value - 21474 (21474.83 is roughly
|
* rounded-to-zero to an integral value - 21474 (21474.83 is roughly
|
||||||
* (2^31-1) * 100000). 's' is a string that describes the value being
|
* (2^31-1) * 100000). 's' is a string that describes the value being
|
||||||
* converted.
|
* converted.
|
||||||
@ -812,7 +812,7 @@
|
|||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
/* This is used for 16-bit gamma tables -- only the top level pointers are
|
||||||
* const; this could be changed:
|
* const; this could be changed:
|
||||||
*/
|
*/
|
||||||
typedef const png_uint_16p * png_const_uint_16pp;
|
typedef const png_uint_16p * png_const_uint_16pp;
|
||||||
|
2
pngrio.c
2
pngrio.c
@ -26,7 +26,7 @@
|
|||||||
* reads from a file pointer. Note that this routine sometimes gets called
|
* reads from a file pointer. Note that this routine sometimes gets called
|
||||||
* with very small lengths, so you should implement some kind of simple
|
* with very small lengths, so you should implement some kind of simple
|
||||||
* buffering if you are using unbuffered reads. This should never be asked
|
* buffering if you are using unbuffered reads. This should never be asked
|
||||||
* to read more than 64K on a 16 bit machine.
|
* to read more than 64K on a 16-bit machine.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||||
|
12
pngrtran.c
12
pngrtran.c
@ -1996,7 +1996,7 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# else
|
# else
|
||||||
/* No 16 bit support: force chopping 16-bit input down to 8, in this case
|
/* No 16-bit support: force chopping 16-bit input down to 8, in this case
|
||||||
* the app program can chose if both APIs are available by setting the
|
* the app program can chose if both APIs are available by setting the
|
||||||
* correct scaling to use.
|
* correct scaling to use.
|
||||||
*/
|
*/
|
||||||
@ -2381,8 +2381,8 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
while (sp < ep)
|
while (sp < ep)
|
||||||
{
|
{
|
||||||
/* The input is an array of 16 bit components, these must be scaled to
|
/* The input is an array of 16-bit components, these must be scaled to
|
||||||
* 8 bits each. For a 16 bit value V the required value (from the PNG
|
* 8 bits each. For a 16-bit value V the required value (from the PNG
|
||||||
* specification) is:
|
* specification) is:
|
||||||
*
|
*
|
||||||
* (V * 255) / 65535
|
* (V * 255) / 65535
|
||||||
@ -2403,7 +2403,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
|||||||
*
|
*
|
||||||
* The approximate differs from the exact answer only when (vlo-vhi) is
|
* The approximate differs from the exact answer only when (vlo-vhi) is
|
||||||
* 128; it then gives a correction of +1 when the exact correction is
|
* 128; it then gives a correction of +1 when the exact correction is
|
||||||
* 0. This gives 128 errors. The exact answer (correct for all 16 bit
|
* 0. This gives 128 errors. The exact answer (correct for all 16-bit
|
||||||
* input values) is:
|
* input values) is:
|
||||||
*
|
*
|
||||||
* error = (vlo-vhi+128)*65535 >> 24;
|
* error = (vlo-vhi+128)*65535 >> 24;
|
||||||
@ -3147,9 +3147,9 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
|||||||
if (red != green || red != blue)
|
if (red != green || red != blue)
|
||||||
rgb_error |= 1;
|
rgb_error |= 1;
|
||||||
|
|
||||||
/* From 1.5.5 in the 16 bit case do the accurate conversion even
|
/* From 1.5.5 in the 16-bit case do the accurate conversion even
|
||||||
* in the 'fast' case - this is because this is where the code
|
* in the 'fast' case - this is because this is where the code
|
||||||
* ends up when handling linear 16 bit data.
|
* ends up when handling linear 16-bit data.
|
||||||
*/
|
*/
|
||||||
gray16 = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
|
gray16 = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
|
||||||
15);
|
15);
|
||||||
|
@ -98,7 +98,7 @@ png_get_uint_16)(png_const_bytep buf)
|
|||||||
{
|
{
|
||||||
/* ANSI-C requires an int value to accomodate at least 16 bits so this
|
/* ANSI-C requires an int value to accomodate at least 16 bits so this
|
||||||
* works and allows the compiler not to worry about possible narrowing
|
* works and allows the compiler not to worry about possible narrowing
|
||||||
* on 32 bit systems. (Pre-ANSI systems did not make integers smaller
|
* on 32-bit systems. (Pre-ANSI systems did not make integers smaller
|
||||||
* than 16 bits either.)
|
* than 16 bits either.)
|
||||||
*/
|
*/
|
||||||
unsigned int val =
|
unsigned int val =
|
||||||
|
@ -30,7 +30,7 @@ png_set_bgr(png_structrp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* Turn on 16 bit byte swapping */
|
/* Turn on 16-bit byte swapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_swap(png_structrp png_ptr)
|
png_set_swap(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
@ -313,7 +313,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
#ifdef PNG_16BIT_SUPPORTED
|
#ifdef PNG_16BIT_SUPPORTED
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* Swaps byte order on 16 bit depth images */
|
/* Swaps byte order on 16-bit depth images */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
png_do_swap(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
|
2
pngwio.c
2
pngwio.c
@ -26,7 +26,7 @@
|
|||||||
* writes to a file pointer. Note that this routine sometimes gets called
|
* writes to a file pointer. Note that this routine sometimes gets called
|
||||||
* with very small lengths, so you should implement some kind of simple
|
* with very small lengths, so you should implement some kind of simple
|
||||||
* buffering if you are using unbuffered writes. This should never be asked
|
* buffering if you are using unbuffered writes. This should never be asked
|
||||||
* to write more than 64K on a 16 bit machine.
|
* to write more than 64K on a 16-bit machine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
|
@ -1422,7 +1422,7 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
|||||||
png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
|
png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Swap bits of 1, 2, 4 bit packed pixel formats */
|
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
|
||||||
if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
|
if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
|
||||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
@ -1998,7 +1998,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
/* Now set up the data transformations (*after* the header is written),
|
/* Now set up the data transformations (*after* the header is written),
|
||||||
* remove the handled transformations from the 'format' flags for checking.
|
* remove the handled transformations from the 'format' flags for checking.
|
||||||
*
|
*
|
||||||
* First check for a little endian system if writing 16 bit files.
|
* First check for a little endian system if writing 16-bit files.
|
||||||
*/
|
*/
|
||||||
if (write_16bit != 0)
|
if (write_16bit != 0)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* On 64 bit architectures 'length' may not fit in a png_uint_32. */
|
/* On 64-bit architectures 'length' may not fit in a png_uint_32. */
|
||||||
if (length > PNG_UINT_31_MAX)
|
if (length > PNG_UINT_31_MAX)
|
||||||
png_error(png_ptr, "length exceeds PNG maximum");
|
png_error(png_ptr, "length exceeds PNG maximum");
|
||||||
|
|
||||||
@ -1444,7 +1444,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
|||||||
|
|
||||||
else if (color_type == PNG_COLOR_TYPE_GRAY)
|
else if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
{
|
{
|
||||||
/* One 16 bit value */
|
/* One 16-bit value */
|
||||||
if (tran->gray >= (1 << png_ptr->bit_depth))
|
if (tran->gray >= (1 << png_ptr->bit_depth))
|
||||||
{
|
{
|
||||||
png_app_warning(png_ptr,
|
png_app_warning(png_ptr,
|
||||||
@ -1459,7 +1459,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
|||||||
|
|
||||||
else if (color_type == PNG_COLOR_TYPE_RGB)
|
else if (color_type == PNG_COLOR_TYPE_RGB)
|
||||||
{
|
{
|
||||||
/* Three 16 bit values */
|
/* Three 16-bit values */
|
||||||
png_save_uint_16(buf, tran->red);
|
png_save_uint_16(buf, tran->red);
|
||||||
png_save_uint_16(buf + 2, tran->green);
|
png_save_uint_16(buf + 2, tran->green);
|
||||||
png_save_uint_16(buf + 4, tran->blue);
|
png_save_uint_16(buf + 4, tran->blue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user