From f1cf90238bb54d547f111d17daef731fe23e7b78 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Tue, 7 Dec 2010 14:40:33 -0600 Subject: [PATCH] [devel] Documented the pngvalid gamma error summary with additional comments and print statements. --- ANNOUNCE | 2 ++ CHANGES | 2 ++ pngvalid.c | 22 ++++++++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 791b1833e..65780e60d 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -460,6 +460,8 @@ Version 1.5.0beta56 [December 7, 2010] Included documentation of changes in 1.5.0 from 1.4.x in libpng-manual.txt Version 1.5.0beta57 [December 7, 2010] + Documented the pngvalid gamma error summary with additional comments and + print statements. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index 7e76db460..5617f9426 100644 --- a/CHANGES +++ b/CHANGES @@ -3098,6 +3098,8 @@ Version 1.5.0beta56 [December 7, 2010] Included documentation of changes in 1.5.0 from 1.4.x in libpng-manual.txt Version 1.5.0beta57 [December 7, 2010] + Documented the pngvalid gamma error summary with additional comments and + print statements. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngvalid.c b/pngvalid.c index aa9207b9e..a545594f9 100644 --- a/pngvalid.c +++ b/pngvalid.c @@ -3463,7 +3463,19 @@ perform_gamma_test(png_modifier *pm, int speed, int summary) if (summary) { - printf("Gamma correction error summary (output value error):\n"); + printf("Gamma correction error summary\n\n"); + printf("The printed value is the maximum error in the pixel values\n"); + printf("calculated by the libpng gamma correction code. The error\n"); + printf("is calculated as the difference between the output pixel\n"); + printf("value (always an integer) and the ideal value from the\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("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("For performance reasons the value for 16 bit formats\n"); + printf("increases when the image file includes an sBIT chunk.\n\n"); + printf(" 2 bit gray: %.5f\n", pm->error_gray_2); printf(" 4 bit gray: %.5f\n", pm->error_gray_4); printf(" 8 bit gray: %.5f\n", pm->error_gray_8); @@ -3556,7 +3568,13 @@ int main(int argc, PNG_CONST char **argv) pm.sbitlow = 8U; /* because libpng doesn't do sBIT below 8! */ pm.use_input_precision_16to8 = 1U; /* Because of the way libpng does it */ - /* 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 + * transformations. The practial limits for human perception are described + * 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 + * images can never be good enough (regardless of encoding.) + */ pm.maxout8 = .1; /* Arithmetic error in *encoded* value */ pm.maxabs8 = .00005; /* 1/20000 */ pm.maxpc8 = .499; /* I.e. .499% fractional error */