[devel] Revised pngvalid.c 16-to-8-big conversion tests

This commit is contained in:
Glenn Randers-Pehrson 2010-08-27 14:21:21 -05:00
parent 9c69091c9d
commit fded04fbf6
5 changed files with 28 additions and 8 deletions

View File

@ -7,6 +7,7 @@
# and license in png.h
# First all the build options off:
everything = off
# All that is required is some read code. This example switches
@ -31,7 +32,8 @@ option FLOATING_ARITHMETIC off
# program here, pngm2pnm, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on
option READ_EXPAND on
option READ_16BIT on
option READ_16_TO_8 on

View File

@ -7,26 +7,29 @@
# and license in png.h
# First all the build options off:
everything = off
option NO_16BIT on
# Switch on the write code - this makes a minimalist encoder
option WRITE on
# You must choose fixed or floating point arithmetic:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
# option FLOATING_ARITHMETIC on
option FLOATING_ARITHMETIC off
# Your program will probably need other options. The example
# program here, pnm2pngm, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on

View File

@ -7,18 +7,22 @@
# and license in png.h
# First all the build options off:
everything = off
# Just switch on the progressive read code
option PROGRESSIVE_READ on
# You may choose fixed or floating point APIs:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
option FLOATING_ARITHMETIC on
# option FLOATING_ARITHMETIC off
@ -26,6 +30,7 @@ option FLOATING_ARITHMETIC on
# program here, rpng2-x, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on
option READ_bKGD on

View File

@ -1,7 +1,7 @@
/* pngvalid.c - validate libpng by constructing then reading png files.
*
* Last changed in libpng 1.5.0 [August 26, 2010]
* Last changed in libpng 1.5.0 [August 27, 2010]
* Copyright (c) 2010 Glenn Randers-Pehrson
* Written by John C. Bowler
*
@ -2776,7 +2776,11 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
* PNG_MAX_GAMMA_8 when doing the following.
*/
if (dp->strip16)
png_set_strip_16(pp);
# ifdef PNG_READ_16_TO_8
png_set_strip_16(pp);
# else
png_error(pp, "strip16 (16 to 8 bit conversion) not supported");
# endif
png_read_update_info(pp, pi);
@ -3355,7 +3359,7 @@ static void perform_gamma_sbit_tests(png_modifier *pm, int speed)
/* Note that this requires a 16 bit source image but produces 8 bit output, so
* we only need the 16bit write support.
*/
#ifdef PNG_WRITE_16BIT_SUPPORTED
#ifdef PNG_16_TO_8_SUPPORTED
static void perform_gamma_strip16_tests(png_modifier *pm, int speed)
{
# ifndef PNG_MAX_GAMMA_8
@ -3408,7 +3412,7 @@ static void perform_gamma_strip16_tests(png_modifier *pm, int speed)
}
}
}
#endif
#endif /* 16 to 8 bit conversion */
static void
perform_gamma_test(png_modifier *pm, int speed, int summary)
@ -3461,7 +3465,7 @@ perform_gamma_test(png_modifier *pm, int speed, int summary)
#endif
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
#ifdef PNG_16_TO_8_SUPPORTED
/* The 16 to 8 bit strip operations: */
pm->error_gray_2 = pm->error_gray_4 = pm->error_gray_8 = pm->error_gray_16 =
pm->error_color_8 = pm->error_color_16 = 0;

View File

@ -291,6 +291,10 @@ setting USER_CHUNK_MALLOC_MAX default 0
option READ enables READ_INTERLACING
# Disabling READ_16BIT does not disable reading 16-bit PNG files, but it
# forces them to be chopped down to 8-bit, and disables any 16-bit
# processing after that has happened.
option READ_16BIT requires READ enables 16BIT
option READ_QUANTIZE requires READ
@ -345,6 +349,8 @@ option READ_16_TO_8_ACCURATE_SCALE requires READ disabled
option WRITE
# Disabling WRITE_16BIT prevents 16-bit PNG files from being
# generated.
option WRITE_16BIT requires WRITE enables 16BIT
option WRITE_TRANSFORMS requires WRITE