Image-PNG-Simple
view release on metacpan or search on metacpan
libpng-1.6.17/libpng-manual.txt view on Meta::CPAN
19171918191919201921192219231924192519261927192819291930193119321933193419351936The
default
values
come from the PNG file cHRM chunk
if
present; otherwise, the
defaults correspond to the ITU-R recommendation 709, and also the sRGB color
space, as recommended in the Charles Poynton's Colour FAQ,
<http://www.poynton.com/>, in section 9:
Y = 0.2126 * R + 0.7152 * G + 0.0722 * B
Previous versions of this document, 1998 through 2002, recommended a slightly
different formula:
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
Libpng uses an integer approximation:
Y = (6968 * R + 23434 * G + 2366 * B)/32768
The calculation is done in a linear colorspace,
if
the image gamma
can be determined.
libpng-1.6.17/libpng.3 view on Meta::CPAN
24212422242324242425242624272428242924302431243224332434243524362437243824392440The
default
values
come from the PNG file cHRM chunk
if
present; otherwise, the
defaults correspond to the ITU-R recommendation 709, and also the sRGB color
space, as recommended in the Charles Poynton's Colour FAQ,
<http://www.poynton.com/>, in section 9:
Y = 0.2126 * R + 0.7152 * G + 0.0722 * B
Previous versions of this document, 1998 through 2002, recommended a slightly
different formula:
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
Libpng uses an integer approximation:
Y = (6968 * R + 23434 * G + 2366 * B)/32768
The calculation is done in a linear colorspace,
if
the image gamma
can be determined.
libpng-1.6.17/png.c view on Meta::CPAN
355435553556355735583559356035613562356335643565356635673568356935703571357235733574* We want log2(value/65535), we have log2(v'/255), where:
*
* value = v
' * 256 + v'
'
* = v' * f
*
* So f is value/v
', which is equal to (256+v'
'/v'
) since v' is in the range 128
* to 255 and v
''
is in the range 0 to 255 f will be in the range 256 to less
* than 258. The final factor also needs to correct
for
the fact that
our
8-bit
* value is scaled by 255, whereas the 16-bit
values
must be scaled by 65535.
*
* This gives a final formula using a calculated value
'x'
which is value/v' and
* scaling by 65536 to match the above table:
*
* log2(x/257) * 65536
*
* interpolation between the two end
values
256/257 (result -368.61) and 258/257
* (result 367.179). The
values
used below are scaled by a further 64 to give
* 16-bit precision in the interpolation:
*
* Start (256): -23591
libpng-1.6.17/pngrtran.c view on Meta::CPAN
462046214622462346244625462646274628462946304631463246334634463546364637463846394640int
r, g, b, p;
sp = row;
dp = row;
for
(i = 0; i < row_width; i++)
{
r =
*sp
++;
g =
*sp
++;
b =
*sp
++;
/* This looks real messy, but the compiler will reduce
* it down to a reasonable formula. For example,
with
* 5 bits per color, we get:
* p = (((r >> 3) & 0x1f) << 10) |
* (((g >> 3) & 0x1f) << 5) |
* ((b >> 3) & 0x1f);
*/
p = (((r >> (8 - PNG_QUANTIZE_RED_BITS)) &
((1 << PNG_QUANTIZE_RED_BITS) - 1)) <<
(PNG_QUANTIZE_GREEN_BITS + PNG_QUANTIZE_BLUE_BITS)) |
(((g >> (8 - PNG_QUANTIZE_GREEN_BITS)) &
((1 << PNG_QUANTIZE_GREEN_BITS) - 1)) <<
zlib-1.2.8/adler32.c view on Meta::CPAN
139140141142143144145146147148149150151152153154155156157158159
z_off64_t len2;
{
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/*
for
negative len,
return
invalid adler32 as a clue
for
debugging */
if
(len2 < 0)
return
0xffffffffUL;
/* the derivation of this formula is left as an exercise
for
the reader */
MOD63(len2); /* assumes len2 >= 0 */
rem = (unsigned)len2;
sum1 = adler1 & 0xffff;
sum2 = rem * sum1;
MOD(sum2);
sum1 += (adler2 & 0xffff) + BASE - 1;
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
if
(sum1 >= BASE) sum1 -= BASE;
if
(sum1 >= BASE) sum1 -= BASE;
if
(sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
( run in 0.729 second using v1.01-cache-2.11-cpan-5f2e87ce722 )