[libpng16] Revised #if PNG_DO_BC blocks in png.c (use #ifdef and add #else)

This commit is contained in:
Glenn Randers-Pehrson 2011-11-28 11:29:10 -06:00
parent 0b26ac5dee
commit 8888ea4479
3 changed files with 12 additions and 7 deletions

View File

@ -130,6 +130,7 @@ Version 1.6.0alpha01 [November 28, 2011]
image that has a sufficiently large row size (rather than simply failing image that has a sufficiently large row size (rather than simply failing
to read such images). to read such images).
Replaced an "#if" with "ifdef" in pngrtran.c Replaced an "#if" with "ifdef" in pngrtran.c
Revised #if PNG_DO_BC blocks in png.c (use #ifdef and add #else)
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

View File

@ -3775,6 +3775,7 @@ Version 1.6.0alpha01 [November 28, 2011]
image that has a sufficiently large row size (rather than simply failing image that has a sufficiently large row size (rather than simply failing
to read such images). to read such images).
Replaced an "#if" with "ifdef" in pngrtran.c Replaced an "#if" with "ifdef" in pngrtran.c
Revised #if PNG_DO_BC blocks in png.c (use #ifdef and add #else)
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

17
png.c
View File

@ -655,13 +655,13 @@ png_get_copyright(png_const_structp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.0alpha01 - November 27, 2011" PNG_STRING_NEWLINE \ "libpng version 1.6.0alpha01 - November 28, 2011" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2011 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.0alpha01 - November 27, 2011\ return "libpng version 1.6.0alpha01 - November 28, 2011\
Copyright (c) 1998-2011 Glenn Randers-Pehrson\ Copyright (c) 1998-2011 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.";
@ -2174,9 +2174,9 @@ png_64bit_product (long v1, long v2, unsigned long *hi_product,
static png_uint_32 static png_uint_32
png_8bit_l2[128] = png_8bit_l2[128] =
{ {
# if PNG_DO_BC # ifdef PNG_DO_BC
for (i=128;i<256;++i) { .5 - l(i/255)/l(2)*65536*65536; } for (i=128;i<256;++i) { .5 - l(i/255)/l(2)*65536*65536; }
# endif # else
4270715492U, 4222494797U, 4174646467U, 4127164793U, 4080044201U, 4033279239U, 4270715492U, 4222494797U, 4174646467U, 4127164793U, 4080044201U, 4033279239U,
3986864580U, 3940795015U, 3895065449U, 3849670902U, 3804606499U, 3759867474U, 3986864580U, 3940795015U, 3895065449U, 3849670902U, 3804606499U, 3759867474U,
3715449162U, 3671346997U, 3627556511U, 3584073329U, 3540893168U, 3498011834U, 3715449162U, 3671346997U, 3627556511U, 3584073329U, 3540893168U, 3498011834U,
@ -2199,6 +2199,8 @@ png_8bit_l2[128] =
324227938U, 298676034U, 273229066U, 247886176U, 222646516U, 197509248U, 324227938U, 298676034U, 273229066U, 247886176U, 222646516U, 197509248U,
172473545U, 147538590U, 122703574U, 97967701U, 73330182U, 48790236U, 172473545U, 147538590U, 122703574U, 97967701U, 73330182U, 48790236U,
24347096U, 0U 24347096U, 0U
# endif
#if 0 #if 0
/* The following are the values for 16-bit tables - these work fine for the /* The following are the values for 16-bit tables - these work fine for the
* 8-bit conversions but produce very slightly larger errors in the 16-bit * 8-bit conversions but produce very slightly larger errors in the 16-bit
@ -2344,17 +2346,18 @@ png_log16bit(png_uint_32 x)
static png_uint_32 static png_uint_32
png_32bit_exp[16] = png_32bit_exp[16] =
{ {
# if PNG_DO_BC # ifdef PNG_DO_BC
for (i=0;i<16;++i) { .5 + e(-i/16*l(2))*2^32; } for (i=0;i<16;++i) { .5 + e(-i/16*l(2))*2^32; }
# endif # else
/* NOTE: the first entry is deliberately set to the maximum 32-bit value. */ /* NOTE: the first entry is deliberately set to the maximum 32-bit value. */
4294967295U, 4112874773U, 3938502376U, 3771522796U, 3611622603U, 3458501653U, 4294967295U, 4112874773U, 3938502376U, 3771522796U, 3611622603U, 3458501653U,
3311872529U, 3171459999U, 3037000500U, 2908241642U, 2784941738U, 2666869345U, 3311872529U, 3171459999U, 3037000500U, 2908241642U, 2784941738U, 2666869345U,
2553802834U, 2445529972U, 2341847524U, 2242560872U 2553802834U, 2445529972U, 2341847524U, 2242560872U
# endif
}; };
/* Adjustment table; provided to explain the numbers in the code below. */ /* Adjustment table; provided to explain the numbers in the code below. */
#if PNG_DO_BC #ifdef PNG_DO_BC
for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"} for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"}
11 44937.64284865548751208448 11 44937.64284865548751208448
10 45180.98734845585101160448 10 45180.98734845585101160448