Imported from libpng-1.0.1c.tar

This commit is contained in:
Glenn Randers-Pehrson 1998-05-09 10:02:29 -05:00
parent 1d96361273
commit d0dce40075
30 changed files with 373 additions and 200 deletions

View File

@ -1,14 +1,14 @@
Libpng 1.0.1b May 2, 1998
Libpng 1.0.1c May 9, 1998
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
Changes since the last public release:
libpng-1.0.1a:
version 1.0.1a [April 21, 1998]
Optimized Paeth calculations by replacing abs() function calls with intrinsics
plus other loop optimizations. Improves avg decoding speed by about 20 percent.
plus other loop optimizations. Improves avg decoding speed by about 20%.
Commented out i386istic "align" compiler flags in makefile.lnx.
Reduced the default warning level in some makefiles, to make them consistent.
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
@ -20,7 +20,8 @@ libpng-1.0.1a:
Moved a misplaced pngrutil code block that truncates tRNS if it has more
than num_palette entries -- test was done before num_palette was defined.
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
libpng-1.0.1b:
Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen).
version 1.0.1b [May 2, 1998]
Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
Relocated the png_composite macros from pngrtran.c to png.h (Greg).
Added makefile.sco (contributed by Mike Hopkirk).
@ -29,6 +30,18 @@ libpng-1.0.1b:
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
More work on loop optimization which may help when compiled with C++ compilers.
Added warnings when people try to use transforms they've defined out.
Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
version 1.0.1c [May 9, 1998]
Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for
filler bytes should have been 0xff instead of 0xf.
Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
Moved PNG_WRIGHT_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED,
for consistency, in pngconf.h
Added individual "ifndef PNG_NO_CAPABILITY" for the capabilities in pngconf.h
to make it easier to remove unwanted capabilities via the compile line
Send comments/corrections/commendations to
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu

12
CHANGES
View File

@ -310,3 +310,15 @@ version 1.0.1b [May 2, 1998]
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
More work on loop optimization which may help when compiled with C++ compilers.
Added warnings when people try to use transforms they've defined out.
Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran.
Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg)
version 1.0.1c [May 9, 1998]
Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for
filler bytes should have been 0xff instead of 0xf.
Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images.
Moved PNG_WRIGHT_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED
out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h
Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED,
for consistency, in pngconf.h
Added individual "ifndef PNG_NO_[CAPABILITY]" in pngconf.h to make it easier
to remove unwanted capabilities via the compile line

View File

@ -20,7 +20,8 @@ Known bugs and suggested enhancements in libpng-1.0.1
pngrtran.c: if-test for channels/FILLER may be incorrect
STATUS: Under investigation
STATUS: Under investigation. Appears to be working correctly
in libpng-1.0.1c.
4. March 15, 1998 -- BUG -- Kevin Bracey
@ -52,11 +53,12 @@ Known bugs and suggested enhancements in libpng-1.0.1
png_uint_32 i;
for(i=0; i < s->a*s->b; i++)
with
png_uint_32 i, count;
png_uint_32 i, istop;
istop = s->a*s->b;
for(i=0; i<istop; i++)
STATUS: Mostly done in libpng-1.0.1a, done for all important loops.
More done in libpng-1.0.1b.
c. Replace abs() with intrinsic ternary operations in Paeth
filtering -- Glenn R-P
@ -92,7 +94,7 @@ Known bugs and suggested enhancements in libpng-1.0.1
be made possible at run time, via calls to new png_set_malloc_fn()
and png_set_free_fn() functions.
STATUS: Will do in libpng-1.0.1b
STATUS: Under consideration
9. April 11, 1998 -- BUG -- incorrect truncation of tRNS data in
illegal PNG file where tRNS precedes PLTE -- Larry Reeve
@ -131,3 +133,26 @@ Known bugs and suggested enhancements in libpng-1.0.1
that a warning be issued in such cases.
STATUS: Done in libpng-1.0.1b
14. May 2, 1998 -- BUG -- incorrect mask for filler bytes
In pngrtran.c, png_do_filler(), the masks for hi_filler and low_filler
should be 0xff instead of 0xf
STATUS: Fixed in libpng-1.0.1c
15. May 3, 1998 -- BUG -- buffer overflow in png_do_read_filler()
In pngrutil.c, max_pixel_depth needs to be set to 32 when using
png_do_read_filler with palette images.
STATUS: Fixed in libpng-1.0.1c (see also items 1 and 3 above).
16. May 3, 1998 -- BUG -- type definitions wrong on error functions -- Tom Lane
In png_create_xxx_struct(), the error functions should have typedef
png_voidp instead of (void *). Needs to be corrected in the functions,
the prototypes in png.h, the example.c file, and libpng.txt and libpng.3
STATUS: Fixed in libpng-1.0.1c

2
TODO
View File

@ -1,7 +1,9 @@
TODO - list of things to do for libpng
fix problem with C++ and EXTERN "C"
add capability to set user malloc/free functions at run time
add "grayscale->palette" transformation and "palette->grayscale" detection
color to gray transformation
improved dithering
multi-lingual error and warning message support
sPLT chunk handling

View File

@ -83,7 +83,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
* was compiled with a compatible version of the library. REQUIRED
*/
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
(void *)user_error_ptr, user_error_fn, user_warning_fn);
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (png_ptr == NULL)
{
@ -362,7 +362,7 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
* linked libraries.
*/
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
(void *)user_error_ptr, user_error_fn, user_warning_fn);
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (*png_ptr == NULL)
{
@ -498,7 +498,7 @@ void write_png(char *file_name /* , ... other image information ... */)
* in case we are using dynamically linked libraries. REQUIRED.
*/
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
(void *)user_error_ptr, user_error_fn, user_warning_fn);
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (png_ptr == NULL)
{

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "May 2, 1998"
.TH LIBPNG 3 "May 9, 1998"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
.SH SYNOPSIS
@ -396,7 +396,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1b May 2, 1998
libpng version 1.0.1c May 9, 1998
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
@ -539,7 +539,7 @@ be NULL if the default error handlers are to be used). See the section
on Changes to Libpng below regarding the old initialization functions.
png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr,
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn);
if (!png_ptr)
return;
@ -974,21 +974,19 @@ RGB. This code will do that conversion:
png_set_gray_to_rgb(png_ptr);
If you have a grayscale and you are using png_set_expand() to change to
a higher bit-depth you must indicate if the supplied background gray
is supplied in the original file bit depth (need_expand = 1) or in the
expanded bit depth (need_expand = 0). Similarly, if you are reading
a paletted image, you must indicate if you have supplied the background
as a palette index that needs to be expanded (need_expand = 1). You can
also specify an RGB triplet that isn't in the palette when setting your
background for a paletted image.
a higher bit-depth, you must either supply the background color as a gray
value at the original file bit-depth (need_expand = 1) or else supply the
background color as an RGB triplet at the final, expanded bit depth
(need_expand = 0). Similarly, if you are reading a paletted image, you
must either supply the background color as a palette index (need_expand = 1)
or as an RGB triplet that may or may not be in the palette (need_expand = 0).
png_color_16 my_background;
png_color_16p image_background;
if (png_get_bKGD(png_ptr, info_ptr,
&image_background))
png_set_background(png_ptr, image_background),
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
if (png_get_bKGD(png_ptr, info_ptr, &image_background))
png_set_background(png_ptr, image_background,
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
else
png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
@ -1271,7 +1269,7 @@ png_infop info_ptr;
initialize_png_reader()
{
png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr,
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn);
if (!png_ptr)
return -1;
@ -1443,7 +1441,7 @@ both "png_ptr"; you can call them anything you like, such as
"read_ptr" and "write_ptr". Look at pngtest.c, for example.
png_structp png_ptr = png_create_write_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr,
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn);
if (!png_ptr)
return;
@ -2223,19 +2221,23 @@ Removing unwanted object code:
There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use an ability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space.
You can also turn a number of them off en masse with a compiler directive
that defines PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED, or
PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED, or all four,
never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space, or
you can turn off individual capabilities with defines that begin with
PNG_NO_.
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
want. The PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED directives disable
want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable
the extra transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks [except for sPLT].
Use of the PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED directive
Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive
produces a library that is incapable of reading or writing ancillary chunks.
If you are not using the progressive reading capability, you can
turn that off with PNG_PROGRESSIVE_READ_NOT_SUPPORTED (don't confuse
turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse
this with the INTERLACING capability, which you'll still have).
All the reading and writing specific code are in separate files, so the
@ -2372,7 +2374,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.1b May 2, 1998:
Libpng version 1.0.1c May 9, 1998:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1b May 2, 1998
libpng version 1.0.1c May 9, 1998
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
@ -143,7 +143,7 @@ be NULL if the default error handlers are to be used). See the section
on Changes to Libpng below regarding the old initialization functions.
png_structp png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr,
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn);
if (!png_ptr)
return;
@ -578,21 +578,19 @@ RGB. This code will do that conversion:
png_set_gray_to_rgb(png_ptr);
If you have a grayscale and you are using png_set_expand() to change to
a higher bit-depth you must indicate if the supplied background gray
is supplied in the original file bit depth (need_expand = 1) or in the
expanded bit depth (need_expand = 0). Similarly, if you are reading
a paletted image, you must indicate if you have supplied the background
as a palette index that needs to be expanded (need_expand = 1). You can
also specify an RGB triplet that isn't in the palette when setting your
background for a paletted image.
a higher bit-depth, you must either supply the background color as a gray
value at the original file bit-depth (need_expand = 1) or else supply the
background color as an RGB triplet at the final, expanded bit depth
(need_expand = 0). Similarly, if you are reading a paletted image, you
must either supply the background color as a palette index (need_expand = 1)
or as an RGB triplet that may or may not be in the palette (need_expand = 0).
png_color_16 my_background;
png_color_16p image_background;
if (png_get_bKGD(png_ptr, info_ptr,
&image_background))
png_set_background(png_ptr, image_background),
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
if (png_get_bKGD(png_ptr, info_ptr, &image_background))
png_set_background(png_ptr, image_background,
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
else
png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
@ -875,7 +873,7 @@ png_infop info_ptr;
initialize_png_reader()
{
png_ptr = png_create_read_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr,
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn);
if (!png_ptr)
return -1;
@ -1047,7 +1045,7 @@ both "png_ptr"; you can call them anything you like, such as
"read_ptr" and "write_ptr". Look at pngtest.c, for example.
png_structp png_ptr = png_create_write_struct
(PNG_LIBPNG_VER_STRING, (void *)user_error_ptr,
(PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
user_error_fn, user_warning_fn);
if (!png_ptr)
return;
@ -1827,19 +1825,23 @@ Removing unwanted object code:
There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use an ability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space.
You can also turn a number of them off en masse with a compiler directive
that defines PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED, or
PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED, or all four,
never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space, or
you can turn off individual capabilities with defines that begin with
PNG_NO_.
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
want. The PNG_READ[or WRITE]_TRANSFORMS_NOT_SUPPORTED directives disable
want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable
the extra transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks [except for sPLT].
Use of the PNG_READ[or WRITE]_ANCILLARY_CHUNKS_NOT_SUPPORTED directive
Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive
produces a library that is incapable of reading or writing ancillary chunks.
If you are not using the progressive reading capability, you can
turn that off with PNG_PROGRESSIVE_READ_NOT_SUPPORTED (don't confuse
turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse
this with the INTERLACING capability, which you'll still have).
All the reading and writing specific code are in separate files, so the

View File

@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "May 2, 1998"
.TH LIBPNGPF 3 "May 9, 1998"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
(private functions)

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "May 2, 1998"
.TH PNG 5 "May 9, 1998"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

6
png.c
View File

@ -1,12 +1,12 @@
/* png.c - location for general purpose libpng functions
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
#define PNG_INTERNAL
@ -16,7 +16,7 @@
/* Version information for C files. This had better match the version
* string defined in png.h.
*/
char png_libpng_ver[12] = "1.0.1b";
char png_libpng_ver[12] = "1.0.1c";
/* Place to hold the signature string for a PNG file. */
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};

15
png.h
View File

@ -1,12 +1,12 @@
/* png.h - header file for PNG reference library
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998 Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* Note about libpng version numbers:
*
@ -31,8 +31,9 @@
* 1.00 1.00 100 2.1.0 [int should be 10000]
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
* 1.0.1 1.0.1 10001 2.1.0
* 1.0.1a 1.0.1a 10002 2.1.0
* 1.0.1b 1.0.1b 10002 2.1.0
* 1.0.1a 1.0.1a 10002 2.1.0.1a
* 1.0.1b 1.0.1b 10002 2.1.0.1b
* 1.0.1c 1.0.1c 10002 2.1.0.1c
*
* Henceforth the source version will match the shared-library minor
* and patch numbers; the shared-library major version number will be
@ -119,7 +120,7 @@ extern "C" {
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.1b"
#define PNG_LIBPNG_VER_STRING "1.0.1c"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
@ -711,12 +712,12 @@ extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
extern PNG_EXPORT(png_structp,png_create_read_struct)
PNGARG((png_const_charp user_png_ver, voidp error_ptr,
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn));
/* Allocate and initialize png_ptr struct for reading, and any other memory */
extern PNG_EXPORT(png_structp,png_create_write_struct)
PNGARG((png_const_charp user_png_ver, voidp error_ptr,
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn));
/* Write a PNG chunk - size, type, (optional) data, CRC. */

156
pngconf.h
View File

@ -1,12 +1,12 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
/* Any machine specific code is near the front of this file, so if you
@ -237,72 +237,139 @@ __dont__ include it again
/* Any transformations you will not be using can be undef'ed here */
/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
to turn it off with "*TRANSFORMS_NOT_SUPPORTED" on the compile line,
then pick and choose which ones to define without having to edit
this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED if you
only want to have a png-compliant reader/writer but don't need
to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
on the compile line, then pick and choose which ones to define without
having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
if you only want to have a png-compliant reader/writer but don't need
any of the extra transformations. This saves about 80 kbytes in a
typical installation of the library.
typical installation of the library. (PNG_NO_* form added in version
1.0.1c, for consistency)
*/
#ifndef PNG_READ_TRANSFORMS_NOT_SUPPORTED
#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_TRANSFORMS)
#define PNG_READ_TRANSFORMS_SUPPORTED
#endif
#ifndef PNG_WRITE_TRANSFORMS_NOT_SUPPORTED
#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_TRANSFORMS)
#define PNG_WRITE_TRANSFORMS_SUPPORTED
#endif
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
#ifndef PNG_NO_READ_EXPAND
#define PNG_READ_EXPAND_SUPPORTED
#endif
#ifndef PNG_NO_READ_SHIFT
#define PNG_READ_SHIFT_SUPPORTED
#endif
#ifndef PNG_NO_READ_PACK
#define PNG_READ_PACK_SUPPORTED
#endif
#ifndef PNG_NO_READ_BGR
#define PNG_READ_BGR_SUPPORTED
#endif
#ifndef PNG_NO_READ_SWAP
#define PNG_READ_SWAP_SUPPORTED
#endif
#ifndef PNG_NO_READ_PACKSWAP
#define PNG_READ_PACKSWAP_SUPPORTED
#endif
#ifndef PNG_NO_READ_INVERT
#define PNG_READ_INVERT_SUPPORTED
#endif
#ifndef PNG_NO_READ_DITHER
#define PNG_READ_DITHER_SUPPORTED
#endif
#ifndef PNG_NO_READ_BACKGROUND
#define PNG_READ_BACKGROUND_SUPPORTED
#endif
#ifndef PNG_NO_READ_16_TO_8
#define PNG_READ_16_TO_8_SUPPORTED
#endif
#ifndef PNG_NO_READ_FILLER
#define PNG_READ_FILLER_SUPPORTED
#endif
#ifndef PNG_NO_READ_GAMMA
#define PNG_READ_GAMMA_SUPPORTED
#endif
#ifndef PNG_NO_READ_GRAY_TO_RGB
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#endif
#ifndef PNG_NO_READ_SWAP_ALPHA
#define PNG_READ_SWAP_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_READ_INVERT_ALPHA
#define PNG_READ_INVERT_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_READ_STRIP_ALPHA
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_READ_USER_TRANSFORM
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#endif
/* the following aren't implemented yet
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
*/
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
#ifndef PNG_PROGRESSIVE_READ_NOT_SUPPORTED /* if you don't do progressive */
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
!defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
#define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
#endif /* about interlacing capability! You'll */
/* still have interlacing unless you change the following line: */
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
#ifndef PNG_NO_READ_COMPOSITED_NODIV
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */
#endif
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
#ifndef PNG_NO_WRITE_SHIFT
#define PNG_WRITE_SHIFT_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_PACK
#define PNG_WRITE_PACK_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_BGR
#define PNG_WRITE_BGR_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_SWAP
#define PNG_WRITE_SWAP_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_PACKSWAP
#define PNG_WRITE_PACKSWAP_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_INVERT
#define PNG_WRITE_INVERT_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_FILLER
#define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */
#define PNG_WRITE_FLUSH_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_SWAP_ALPHA
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_INVERT_ALPHA
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_USER_TRANSFORM
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
encoders, but can cause trouble
if left undefined */
#if !defined(PNG_NO_STDIO)
#ifndef PNG_NO_WRITE_WEIGHTED_FILTER
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_FLUSH
#define PNG_WRITE_FLUSH_SUPPORTED
#endif
#ifndef PNG_NO_STDIO
#define PNG_TIME_RFC1123_SUPPORTED
#endif
@ -322,7 +389,7 @@ __dont__ include it again
* png_get_x_offset_microns()
* png_get_y_offset_microns()
*/
#if !defined(PNG_NO_EASY_ACCESS)
#ifndef PNG_NO_EASY_ACCESS
#define PNG_EASY_ACCESS_SUPPORTED
#endif
@ -351,45 +418,100 @@ __dont__ include it again
* a bit smaller.
*/
#ifndef PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED
#if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_ANCILLARY_CHUNKS)
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#endif
#ifndef PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED
#if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#endif
#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#ifndef PNG_NO_PNG_READ_bKGD
#define PNG_READ_bKGD_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_cHRM
#define PNG_READ_cHRM_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_gAMA
#define PNG_READ_gAMA_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_hIST
#define PNG_READ_hIST_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_oFFs
#define PNG_READ_oFFs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_pCAL
#define PNG_READ_pCAL_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_pHYs
#define PNG_READ_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_READ_sBIT
#define PNG_READ_sBIT_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_sRGB
#define PNG_READ_sRGB_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tEXt
#define PNG_READ_tEXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tIME
#define PNG_READ_tIME_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_tRNS
#define PNG_READ_tRNS_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_zTXt
#define PNG_READ_zTXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_READ_OPT_PLTE
#define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */
/* PLTE chunk in RGB and RGBA images */
#endif /* PLTE chunk in RGB and RGBA images */
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#ifndef PNG_NO_PNG_WRITE_bKGD
#define PNG_WRITE_bKGD_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_cHRM
#define PNG_WRITE_cHRM_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_gAMA
#define PNG_WRITE_gAMA_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_hIST
#define PNG_WRITE_hIST_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_oFFs
#define PNG_WRITE_oFFs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_pCAL
#define PNG_WRITE_pCAL_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_pHYs
#define PNG_WRITE_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_sBIT
#define PNG_WRITE_sBIT_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_sRGB
#define PNG_WRITE_sRGB_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tEXt
#define PNG_WRITE_tEXt_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tIME
#define PNG_WRITE_tIME_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_tRNS
#define PNG_WRITE_tRNS_SUPPORTED
#endif
#ifndef PNG_NO_PNG_WRITE_zTXt
#define PNG_WRITE_zTXt_SUPPORTED
#endif
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
/* need the time information for reading tIME chunks */

View File

@ -1,12 +1,12 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This file provides a location for all error handling. Users which
* need special error handling are expected to write replacement functions

View File

@ -1,12 +1,12 @@
/* pngget.c - retrieval of values from info struct
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
#define PNG_INTERNAL

View File

@ -1,12 +1,12 @@
/* pngmem.c - stub functions for memory allocation
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This file provides a location for all memory allocation. Users who
* need special memory handling are expected to modify the code in this file

View File

@ -1,12 +1,12 @@
/* pngpread.c - read a png file in push mode
*
* libpng 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
#define PNG_INTERNAL

View File

@ -1,12 +1,12 @@
/* pngread.c - read a PNG file
*
* libpng 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This file contains routines that an application calls directly to
* read a PNG file or stream.
@ -17,7 +17,7 @@
/* Create a PNG structure for reading, and allocate any memory needed. */
png_structp
png_create_read_struct(png_const_charp user_png_ver, voidp error_ptr,
png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn)
{
png_structp png_ptr;
@ -82,7 +82,7 @@ png_create_read_struct(png_const_charp user_png_ver, voidp error_ptr,
}
/* Initialize PNG structure for reading, and allocate any memory needed.
This interface is depreciated in favour of the png_create_read_struct(),
This interface is deprecated in favour of the png_create_read_struct(),
and it will eventually disappear. */
void
png_read_init(png_structp png_ptr)

View File

@ -1,12 +1,12 @@
/* pngrio.c - functions for data input
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This file provides a location for all input. Users which need
* special handling are expected to write a function which has the same

View File

@ -1,12 +1,12 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* libpng 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG.
@ -576,13 +576,16 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
void
png_init_read_transformations(png_structp png_ptr)
{
int color_type = png_ptr->color_type;
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if(png_ptr == NULL) return;
#endif
png_debug(1, "in png_init_read_transformations\n");
#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
if (png_ptr->transformations & PNG_BACKGROUND_EXPAND)
{
int color_type = png_ptr->color_type;
if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */
{
/* expand background chunk. */
@ -1322,10 +1325,10 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
for (bp = row, i = 0; i < istop; i++, bp++)
for (bp = row, i = 0; i < istop; i++)
{
*bp >>= 1;
*bp &= 0x55;
*bp++ &= 0x55;
}
break;
}
@ -1337,43 +1340,37 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
png_byte mask = (png_byte)(((int)0xf0 >> shift[0]) & (int)0xf0) |
(png_byte)((int)0xf >> shift[0]);
for (bp = row, i = 0; i < istop; i++, bp++)
for (bp = row, i = 0; i < istop; i++)
{
*bp >>= shift[0];
*bp &= mask;
*bp++ &= mask;
}
break;
}
case 8:
{
png_bytep bp;
png_bytep bp = row;
png_uint_32 i;
int cstop=(int)row_info->channels;
png_uint_32 istop = row_width * channels;
for (bp = row, i = 0; i < row_width; i++)
for (i = 0; i < istop; i++)
{
for (c = 0; c < cstop; c++, bp++)
{
*bp >>= shift[c];
}
*bp++ >>= shift[i%channels];
}
break;
}
case 16:
{
png_bytep bp;
png_size_t i;
int cstop=(int)row_info->channels;
png_bytep bp = row;
png_uint_32 i;
png_uint_32 istop = channels * row_width;
for (bp = row, i = 0; i < row_width; i++)
for (i = 0; i < istop; i++)
{
for (c = 0; c < cstop; c++, bp += 2)
{
value = (png_uint_16)((*bp << 8) + *(bp + 1));
value >>= shift[c];
*bp = (png_byte)(value >> 8);
*(bp + 1) = (png_byte)(value & 0xff);
}
value = (png_uint_16)((*bp << 8) + *(bp + 1));
value >>= shift[i%channels];
*bp++ = (png_byte)(value >> 8);
*bp++ = (png_byte)(value & 0xff);
}
break;
}
@ -1620,8 +1617,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_uint_32 i;
png_uint_32 row_width = row_info->width;
png_byte hi_filler = (png_byte)((filler>>8) & 0xf);
png_byte low_filler = (png_byte)(filler & 0xf);
png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
png_byte low_filler = (png_byte)(filler & 0xff);
png_debug(1, "in png_do_read_filler\n");
if (

View File

@ -1,12 +1,12 @@
/* pngrutil.c - utilities to read a PNG file
*
* 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This file contains routines which are only called from within
* libpng itself during the course of reading an image.
@ -73,7 +73,7 @@ png_crc_finish(png_structp png_ptr, png_uint_32 skip)
png_size_t i;
png_size_t istop = png_ptr->zbuf_size;
for (i = skip; i > istop; i -= istop)
for (i = (png_size_t)skip; i > istop; i -= istop)
{
png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
}
@ -2225,7 +2225,7 @@ void
png_read_start_row(png_structp png_ptr)
{
int max_pixel_depth;
png_uint_32 rowbytes;
png_uint_32 row_bytes;
png_debug(1, "in png_read_start_row\n");
png_ptr->zstream.avail_in = 0;
@ -2243,10 +2243,10 @@ png_read_start_row(png_structp png_ptr)
png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass];
rowbytes = ((png_ptr->iwidth *
row_bytes = ((png_ptr->iwidth *
(png_uint_32)png_ptr->pixel_depth + 7) >> 3) +1;
png_ptr->irowbytes = (png_size_t)rowbytes;
if((png_uint_32)png_ptr->irowbytes != rowbytes)
png_ptr->irowbytes = (png_size_t)row_bytes;
if((png_uint_32)png_ptr->irowbytes != row_bytes)
png_error(png_ptr, "Rowbytes overflow in png_read_start_row");
}
else
@ -2293,7 +2293,9 @@ png_read_start_row(png_structp png_ptr)
#if defined(PNG_READ_FILLER_SUPPORTED)
if (png_ptr->transformations & (PNG_FILLER))
{
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
max_pixel_depth = 32;
else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
{
if (max_pixel_depth <= 8)
max_pixel_depth = 16;
@ -2333,16 +2335,16 @@ png_read_start_row(png_structp png_ptr)
/* align the width on the next larger 8 pixels. Mainly used
for interlacing */
rowbytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
/* calculate the maximum bytes needed, adding a byte and a pixel
for safety's sake */
rowbytes = ((rowbytes * (png_uint_32)max_pixel_depth + 7) >> 3) +
row_bytes = ((row_bytes * (png_uint_32)max_pixel_depth + 7) >> 3) +
1 + ((max_pixel_depth + 7) >> 3);
#ifdef PNG_MAX_MALLOC_64K
if (rowbytes > (png_uint_32)65536L)
if (row_bytes > (png_uint_32)65536L)
png_error(png_ptr, "This image requires a row greater than 64KB");
#endif
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, rowbytes);
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
#ifdef PNG_MAX_MALLOC_64K
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)

View File

@ -1,12 +1,12 @@
/* pngset.c - storage of image information into info struct
*
* libpng 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data

View File

@ -1,12 +1,12 @@
/* pngtest.c - a simple test program to test libpng
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This program reads in a PNG image, writes it out again, and then
* compares the two files. If the files are identical, this shows that

View File

@ -1,12 +1,12 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* libpng 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
#define PNG_INTERNAL

View File

@ -1,12 +1,12 @@
/* pngwio.c - functions for data output
*
* libpng 1.0.1b
* libpng 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*
* This file provides a location for all output. Users which need
* special handling are expected to write functions which have the same

View File

@ -1,12 +1,12 @@
/* pngwrite.c - general routines to write a PNG file
*
* libpng 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
/* get internal access to png.h */
@ -281,7 +281,7 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
/* Initialize png_ptr structure, and allocate any memory needed */
png_structp
png_create_write_struct(png_const_charp user_png_ver, voidp error_ptr,
png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn)
{
png_structp png_ptr;

View File

@ -1,12 +1,12 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
#define PNG_INTERNAL
@ -218,9 +218,8 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
{
int shift_start[4], shift_dec[4];
int channels;
int channels = 0;
channels = 0;
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
{
shift_start[channels] = row_info->bit_depth - bit_depth->red;
@ -281,26 +280,23 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{
png_bytep bp = row;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
png_uint_32 istop = channels * row_info->width;
for (i = 0; i < row_width; i++)
for (i = 0; i < istop; i++, bp++)
{
int c;
for (c = 0; c < channels; c++, bp++)
png_uint_16 v;
int j;
int c = (int)(i%channels);
v = *bp;
*bp = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
png_uint_16 v;
int j;
v = *bp;
*bp = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
if (j > 0)
*bp |= (png_byte)((v << j) & 0xff);
else
*bp |= (png_byte)((v >> (-j)) & 0xff);
}
if (j > 0)
*bp |= (png_byte)((v << j) & 0xff);
else
*bp |= (png_byte)((v >> (-j)) & 0xff);
}
}
}
@ -308,29 +304,25 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{
png_bytep bp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
png_uint_32 istop = channels * row_info->width;
for (bp = row, i = 0; i < row_width; i++)
for (bp = row, i = 0; i < istop; i++)
{
int c;
int c = (int)(i%channels);
png_uint_16 value, v;
int j;
for (c = 0; c < channels; c++, bp += 2)
v = ((png_uint_16)(*bp) << 8) + *(bp + 1);
value = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
png_uint_16 value, v;
int j;
v = ((png_uint_16)(*bp) << 8) + *(bp + 1);
value = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
if (j > 0)
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
else
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
}
*bp = (png_byte)(value >> 8);
*(bp + 1) = (png_byte)(value & 0xff);
if (j > 0)
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
else
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
}
*bp++ = (png_byte)(value >> 8);
*bp++ = (png_byte)(value & 0xff);
}
}
}

View File

@ -1,12 +1,12 @@
/* pngwutil.c - utilities to write a PNG file
*
* 1.0.1b
* 1.0.1c
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* May 2, 1998
* May 9, 1998
*/
#define PNG_INTERNAL
@ -1432,7 +1432,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp;
png_uint_32 sum = 0;
png_uint_32 i;
int j;
int v;
for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
@ -1445,6 +1444,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
png_uint_32 sumhi, sumlo;
int j;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
@ -1484,7 +1484,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
png_bytep rp, lp, dp;
png_uint_32 i;
int j;
for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
i++, rp++, dp++)
{
@ -1503,7 +1502,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, lp;
png_uint_32 sum = 0, lmins = mins;
png_uint_32 i;
int j;
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
@ -1513,6 +1511,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
*/
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1561,6 +1560,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
@ -1615,13 +1615,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, pp;
png_uint_32 sum = 0, lmins = mins;
png_uint_32 i;
int j;
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1663,6 +1663,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
@ -1720,12 +1721,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, pp, lp;
png_uint_32 sum = 0, lmins = mins;
png_uint_32 i;
int j;
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1774,6 +1775,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
@ -1852,12 +1854,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep rp, dp, pp, cp, lp;
png_uint_32 sum = 0, lmins = mins;
png_uint_32 i;
int j;
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
@ -1938,6 +1940,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;

View File

@ -29,7 +29,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.1b
PNGMIN = 1.0.1c
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h

View File

@ -29,7 +29,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.1b
PNGMIN = 1.0.1c
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h

View File

@ -22,7 +22,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.1b
PNGMIN = 1.0.1c
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h