mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Revised pngvalid.c 16-to-8-big conversion tests
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|
||||||
# First all the build options off:
|
# First all the build options off:
|
||||||
|
|
||||||
everything = off
|
everything = off
|
||||||
|
|
||||||
# All that is required is some read code. This example switches
|
# 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
|
# program here, pngm2pnm, requires the following. Take a look
|
||||||
# at pnglibconf.h to find out the full set of what has to be
|
# at pnglibconf.h to find out the full set of what has to be
|
||||||
# enabled to make the following work.
|
# enabled to make the following work.
|
||||||
|
|
||||||
option SETJMP on
|
option SETJMP on
|
||||||
option STDIO on
|
option STDIO on
|
||||||
option READ_EXPAND on
|
option READ_EXPAND on
|
||||||
option READ_16BIT on
|
option READ_16_TO_8 on
|
||||||
|
|||||||
@@ -7,26 +7,29 @@
|
|||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|
||||||
# First all the build options off:
|
# First all the build options off:
|
||||||
|
|
||||||
everything = off
|
everything = off
|
||||||
|
|
||||||
option NO_16BIT on
|
|
||||||
|
|
||||||
# Switch on the write code - this makes a minimalist encoder
|
# Switch on the write code - this makes a minimalist encoder
|
||||||
|
|
||||||
option WRITE on
|
option WRITE on
|
||||||
|
|
||||||
# You must choose fixed or floating point arithmetic:
|
# You must choose fixed or floating point arithmetic:
|
||||||
# option FLOATING_POINT on
|
# option FLOATING_POINT on
|
||||||
|
|
||||||
option FIXED_POINT on
|
option FIXED_POINT on
|
||||||
|
|
||||||
# You must chose the internal fixed point implementation or to
|
# You must chose the internal fixed point implementation or to
|
||||||
# use the system floating point. The latter is considerably
|
# use the system floating point. The latter is considerably
|
||||||
# smaller (by about 1kbyte on an x86 system):
|
# smaller (by about 1kbyte on an x86 system):
|
||||||
# option FLOATING_ARITHMETIC on
|
# option FLOATING_ARITHMETIC on
|
||||||
|
|
||||||
option FLOATING_ARITHMETIC off
|
option FLOATING_ARITHMETIC off
|
||||||
|
|
||||||
# Your program will probably need other options. The example
|
# Your program will probably need other options. The example
|
||||||
# program here, pnm2pngm, requires the following. Take a look
|
# program here, pnm2pngm, requires the following. Take a look
|
||||||
# at pnglibconf.h to find out the full set of what has to be
|
# at pnglibconf.h to find out the full set of what has to be
|
||||||
# enabled to make the following work.
|
# enabled to make the following work.
|
||||||
|
|
||||||
option SETJMP on
|
option SETJMP on
|
||||||
option STDIO on
|
option STDIO on
|
||||||
|
|||||||
@@ -7,18 +7,22 @@
|
|||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|
||||||
# First all the build options off:
|
# First all the build options off:
|
||||||
|
|
||||||
everything = off
|
everything = off
|
||||||
|
|
||||||
# Just switch on the progressive read code
|
# Just switch on the progressive read code
|
||||||
|
|
||||||
option PROGRESSIVE_READ on
|
option PROGRESSIVE_READ on
|
||||||
|
|
||||||
# You may choose fixed or floating point APIs:
|
# You may choose fixed or floating point APIs:
|
||||||
# option FLOATING_POINT on
|
# option FLOATING_POINT on
|
||||||
|
|
||||||
option FIXED_POINT on
|
option FIXED_POINT on
|
||||||
|
|
||||||
# You must chose the internal fixed point implementation or to
|
# You must chose the internal fixed point implementation or to
|
||||||
# use the system floating point. The latter is considerably
|
# use the system floating point. The latter is considerably
|
||||||
# smaller (by about 1kbyte on an x86 system):
|
# smaller (by about 1kbyte on an x86 system):
|
||||||
|
|
||||||
option FLOATING_ARITHMETIC on
|
option FLOATING_ARITHMETIC on
|
||||||
# option FLOATING_ARITHMETIC off
|
# option FLOATING_ARITHMETIC off
|
||||||
|
|
||||||
@@ -26,6 +30,7 @@ option FLOATING_ARITHMETIC on
|
|||||||
# program here, rpng2-x, requires the following. Take a look
|
# program here, rpng2-x, requires the following. Take a look
|
||||||
# at pnglibconf.h to find out the full set of what has to be
|
# at pnglibconf.h to find out the full set of what has to be
|
||||||
# enabled to make the following work.
|
# enabled to make the following work.
|
||||||
|
|
||||||
option SETJMP on
|
option SETJMP on
|
||||||
option STDIO on
|
option STDIO on
|
||||||
option READ_bKGD on
|
option READ_bKGD on
|
||||||
|
|||||||
14
pngvalid.c
14
pngvalid.c
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngvalid.c - validate libpng by constructing then reading png files.
|
/* 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
|
* Copyright (c) 2010 Glenn Randers-Pehrson
|
||||||
* Written by John C. Bowler
|
* 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.
|
* PNG_MAX_GAMMA_8 when doing the following.
|
||||||
*/
|
*/
|
||||||
if (dp->strip16)
|
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);
|
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
|
/* Note that this requires a 16 bit source image but produces 8 bit output, so
|
||||||
* we only need the 16bit write support.
|
* 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)
|
static void perform_gamma_strip16_tests(png_modifier *pm, int speed)
|
||||||
{
|
{
|
||||||
# ifndef PNG_MAX_GAMMA_8
|
# 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
|
static void
|
||||||
perform_gamma_test(png_modifier *pm, int speed, int summary)
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
#ifdef PNG_16_TO_8_SUPPORTED
|
||||||
/* The 16 to 8 bit strip operations: */
|
/* 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_gray_2 = pm->error_gray_4 = pm->error_gray_8 = pm->error_gray_16 =
|
||||||
pm->error_color_8 = pm->error_color_16 = 0;
|
pm->error_color_8 = pm->error_color_16 = 0;
|
||||||
|
|||||||
@@ -291,6 +291,10 @@ setting USER_CHUNK_MALLOC_MAX default 0
|
|||||||
|
|
||||||
option READ enables READ_INTERLACING
|
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_16BIT requires READ enables 16BIT
|
||||||
|
|
||||||
option READ_QUANTIZE requires READ
|
option READ_QUANTIZE requires READ
|
||||||
@@ -345,6 +349,8 @@ option READ_16_TO_8_ACCURATE_SCALE requires READ disabled
|
|||||||
|
|
||||||
option WRITE
|
option WRITE
|
||||||
|
|
||||||
|
# Disabling WRITE_16BIT prevents 16-bit PNG files from being
|
||||||
|
# generated.
|
||||||
option WRITE_16BIT requires WRITE enables 16BIT
|
option WRITE_16BIT requires WRITE enables 16BIT
|
||||||
|
|
||||||
option WRITE_TRANSFORMS requires WRITE
|
option WRITE_TRANSFORMS requires WRITE
|
||||||
|
|||||||
Reference in New Issue
Block a user