[devel] Fixed some spelling and indentation.
This commit is contained in:
parent
b9109e8254
commit
233357ef0e
84
png.c
84
png.c
@ -1342,7 +1342,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Here on buffer too small. */
|
/* Here on buffer too small. */
|
||||||
png_error(png_ptr, "ASCII convertion buffer too small");
|
png_error(png_ptr, "ASCII conversion buffer too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif /* FLOATING_POINT */
|
# endif /* FLOATING_POINT */
|
||||||
@ -1401,9 +1401,21 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
|||||||
#else
|
#else
|
||||||
int negative = 0;
|
int negative = 0;
|
||||||
png_uint_32 A, T, D;
|
png_uint_32 A, T, D;
|
||||||
if (a < 0) negative = 1, A = -a; else A = a;
|
|
||||||
if (times < 0) negative = !negative, T = -times; else T = times;
|
if (a < 0)
|
||||||
if (div < 0) negative = !negative, D = -div; else D = div;
|
negative = 1, A = -a;
|
||||||
|
else
|
||||||
|
A = a;
|
||||||
|
|
||||||
|
if (times < 0)
|
||||||
|
negative = !negative, T = -times;
|
||||||
|
else
|
||||||
|
T = times;
|
||||||
|
|
||||||
|
if (div < 0)
|
||||||
|
negative = !negative, D = -div;
|
||||||
|
else
|
||||||
|
D = div;
|
||||||
|
|
||||||
/* Following can't overflow because the arguments only
|
/* Following can't overflow because the arguments only
|
||||||
* have 31 bits each, however the result may be 32 bits.
|
* have 31 bits each, however the result may be 32 bits.
|
||||||
@ -1432,6 +1444,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
|||||||
while (--bitshift >= 0)
|
while (--bitshift >= 0)
|
||||||
{
|
{
|
||||||
png_uint_32 d32, d00;
|
png_uint_32 d32, d00;
|
||||||
|
|
||||||
if (bitshift > 0)
|
if (bitshift > 0)
|
||||||
d32 = D >> (32-bitshift), d00 = D << bitshift;
|
d32 = D >> (32-bitshift), d00 = D << bitshift;
|
||||||
else
|
else
|
||||||
@ -1442,7 +1455,8 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
|||||||
if (s00 < d00) --s32; /* carry */
|
if (s00 < d00) --s32; /* carry */
|
||||||
s32 -= d32, s00 -= d00, result += 1<<bitshift;
|
s32 -= d32, s00 -= d00, result += 1<<bitshift;
|
||||||
}
|
}
|
||||||
else if (s32 == d32 && s00 >= d00)
|
else
|
||||||
|
if (s32 == d32 && s00 >= d00)
|
||||||
s32 = 0, s00 -= d00, result += 1<<bitshift;
|
s32 = 0, s00 -= d00, result += 1<<bitshift;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1638,7 +1652,7 @@ png_8bit_l2[128] =
|
|||||||
24347096U, 0U
|
24347096U, 0U
|
||||||
#if 0
|
#if 0
|
||||||
/* The following are the values for 16 bit tables - these work fine for the 8
|
/* The following are the values for 16 bit tables - these work fine for the 8
|
||||||
* bit convertions but produce very slightly larger errors in the 16 bit log
|
* bit conversions but produce very slightly larger errors in the 16 bit log
|
||||||
* (about 1.2 as opposed to 0.7 absolute error in the final value). To use
|
* (about 1.2 as opposed to 0.7 absolute error in the final value). To use
|
||||||
* these all the shifts below must be adjusted appropriately.
|
* these all the shifts below must be adjusted appropriately.
|
||||||
*/
|
*/
|
||||||
@ -1667,10 +1681,18 @@ png_log8bit(unsigned x)
|
|||||||
* input), return 7.99998 for the overflow (log 0) case - so the result is
|
* input), return 7.99998 for the overflow (log 0) case - so the result is
|
||||||
* always at most 19 bits.
|
* always at most 19 bits.
|
||||||
*/
|
*/
|
||||||
if ((x &= 0xff) == 0) return 0xffffffff;
|
if ((x &= 0xff) == 0)
|
||||||
if ((x & 0xf0) == 0) log = 4, x <<= 4;
|
return 0xffffffff;
|
||||||
if ((x & 0xc0) == 0) log += 2, x <<= 2;
|
|
||||||
if ((x & 0x80) == 0) log += 1, x <<= 1;
|
if ((x & 0xf0) == 0)
|
||||||
|
log = 4, x <<= 4;
|
||||||
|
|
||||||
|
if ((x & 0xc0) == 0)
|
||||||
|
log += 2, x <<= 2;
|
||||||
|
|
||||||
|
if ((x & 0x80) == 0)
|
||||||
|
log += 1, x <<= 1;
|
||||||
|
|
||||||
return (log << 16) + ((png_8bit_l2[x-128]+32768)>>16);
|
return (log << 16) + ((png_8bit_l2[x-128]+32768)>>16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1710,11 +1732,20 @@ png_log16bit(png_uint_32 x)
|
|||||||
unsigned log = 0;
|
unsigned log = 0;
|
||||||
|
|
||||||
/* As above, but now the input has 16 bits. */
|
/* As above, but now the input has 16 bits. */
|
||||||
if ((x &= 0xffff) == 0) return 0xffffffff;
|
if ((x &= 0xffff) == 0)
|
||||||
if ((x & 0xff00) == 0) log = 8, x <<= 8;
|
return 0xffffffff;
|
||||||
if ((x & 0xf000) == 0) log += 4, x <<= 4;
|
|
||||||
if ((x & 0xc000) == 0) log += 2, x <<= 2;
|
if ((x & 0xff00) == 0)
|
||||||
if ((x & 0x8000) == 0) log += 1, x <<= 1;
|
log = 8, x <<= 8;
|
||||||
|
|
||||||
|
if ((x & 0xf000) == 0)
|
||||||
|
log += 4, x <<= 4;
|
||||||
|
|
||||||
|
if ((x & 0xc000) == 0)
|
||||||
|
log += 2, x <<= 2;
|
||||||
|
|
||||||
|
if ((x & 0x8000) == 0)
|
||||||
|
log += 1, x <<= 1;
|
||||||
|
|
||||||
/* Calculate the base logarithm from the top 8 bits as a 28 bit fractional
|
/* Calculate the base logarithm from the top 8 bits as a 28 bit fractional
|
||||||
* value.
|
* value.
|
||||||
@ -1800,12 +1831,23 @@ png_exp(png_uint_32 x)
|
|||||||
* converge on 45426 and this is used to allow linear interpolation of the
|
* converge on 45426 and this is used to allow linear interpolation of the
|
||||||
* low bits.
|
* low bits.
|
||||||
*/
|
*/
|
||||||
if (x & 0x800) e -= (((e >> 16) * 44938U) + 16U) >> 5;
|
if (x & 0x800)
|
||||||
if (x & 0x400) e -= (((e >> 16) * 45181U) + 32U) >> 6;
|
e -= (((e >> 16) * 44938U) + 16U) >> 5;
|
||||||
if (x & 0x200) e -= (((e >> 16) * 45303U) + 64U) >> 7;
|
|
||||||
if (x & 0x100) e -= (((e >> 16) * 45365U) + 128U) >> 8;
|
if (x & 0x400)
|
||||||
if (x & 0x080) e -= (((e >> 16) * 45395U) + 256U) >> 9;
|
e -= (((e >> 16) * 45181U) + 32U) >> 6;
|
||||||
if (x & 0x040) e -= (((e >> 16) * 45410U) + 512U) >> 10;
|
|
||||||
|
if (x & 0x200)
|
||||||
|
e -= (((e >> 16) * 45303U) + 64U) >> 7;
|
||||||
|
|
||||||
|
if (x & 0x100)
|
||||||
|
e -= (((e >> 16) * 45365U) + 128U) >> 8;
|
||||||
|
|
||||||
|
if (x & 0x080)
|
||||||
|
e -= (((e >> 16) * 45395U) + 256U) >> 9;
|
||||||
|
|
||||||
|
if (x & 0x040)
|
||||||
|
e -= (((e >> 16) * 45410U) + 512U) >> 10;
|
||||||
|
|
||||||
/* And handle the low 6 bits in a single block. */
|
/* And handle the low 6 bits in a single block. */
|
||||||
e -= (((e >> 16) * 355U * (x & 0x3fU)) + 256U) >> 9;
|
e -= (((e >> 16) * 355U * (x & 0x3fU)) + 256U) >> 9;
|
||||||
|
2
pngget.c
2
pngget.c
@ -295,7 +295,7 @@ static png_uint_32
|
|||||||
ppi_from_ppm(png_uint_32 ppm)
|
ppi_from_ppm(png_uint_32 ppm)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
/* The convertion is *(2.54/100), in binary (32 digits):
|
/* The conversion is *(2.54/100), in binary (32 digits):
|
||||||
* .00000110100000001001110101001001
|
* .00000110100000001001110101001001
|
||||||
*/
|
*/
|
||||||
png_uint_32 t1001, t1101;
|
png_uint_32 t1001, t1101;
|
||||||
|
@ -116,11 +116,11 @@
|
|||||||
*/
|
*/
|
||||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
|
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
|
||||||
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
|
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
|
||||||
/* pngarith.c requires the following ANSI-C constants if the convertion of
|
/* png.c requires the following ANSI-C constants if the conversion of
|
||||||
* floating point to ASCII is implemented therein:
|
* floating point to ASCII is implemented therein:
|
||||||
*
|
*
|
||||||
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
|
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
|
||||||
* DBL_MIN Smalles normalized fp number (can be set to an arbitrary value)
|
* DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
|
||||||
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
|
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
|
||||||
*/
|
*/
|
||||||
# include <float.h>
|
# include <float.h>
|
||||||
@ -366,7 +366,7 @@
|
|||||||
* when it is supposedly disabled.)
|
* when it is supposedly disabled.)
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
/* The floating point convertion can't overflow, though it can and
|
/* The floating point conversion can't overflow, though it can and
|
||||||
* does lose accuracy relative to the original fixed point value.
|
* does lose accuracy relative to the original fixed point value.
|
||||||
* In practice this doesn't matter because png_fixed_point only
|
* In practice this doesn't matter because png_fixed_point only
|
||||||
* stores numbers with very low precision. The png_ptr and s
|
* stores numbers with very low precision. The png_ptr and s
|
||||||
@ -375,7 +375,7 @@
|
|||||||
*/
|
*/
|
||||||
#define png_float(png_ptr, fixed, s) (.00001 * (fixed))
|
#define png_float(png_ptr, fixed, s) (.00001 * (fixed))
|
||||||
|
|
||||||
/* The fixed point convertion 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
|
||||||
|
@ -71,7 +71,7 @@ png_get_uint_32)(png_bytep buf)
|
|||||||
/* Grab a signed 32-bit integer from a buffer in big-endian format. The
|
/* Grab a signed 32-bit integer from a buffer in big-endian format. The
|
||||||
* data is stored in the PNG file in two's complement format and there
|
* data is stored in the PNG file in two's complement format and there
|
||||||
* is no guarantee that a 'png_int_32' is exactly 32 bits, therefore
|
* is no guarantee that a 'png_int_32' is exactly 32 bits, therefore
|
||||||
* the following code does a two's complement to native convertion.
|
* the following code does a two's complement to native conversion.
|
||||||
*/
|
*/
|
||||||
png_int_32 (PNGAPI
|
png_int_32 (PNGAPI
|
||||||
png_get_int_32)(png_bytep buf)
|
png_get_int_32)(png_bytep buf)
|
||||||
|
@ -1876,7 +1876,7 @@ static void perform_gamma_strip16_tests(png_modifier *pm, int speed)
|
|||||||
* used by the library - otherwise we will get spurious errors from the
|
* used by the library - otherwise we will get spurious errors from the
|
||||||
* internal sbit style approximation.
|
* internal sbit style approximation.
|
||||||
*
|
*
|
||||||
* The threshold test is here because otherwise the 16 to 8 convertion will
|
* The threshold test is here because otherwise the 16 to 8 conversion will
|
||||||
* proceed *without* gamma correction, and the tests above will fail (but not
|
* proceed *without* gamma correction, and the tests above will fail (but not
|
||||||
* by much) - this could be fixed, it only appears with the -g option.
|
* by much) - this could be fixed, it only appears with the -g option.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user