mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Squashed commit of the following:
commit fc4b42b1d56f95efeb1b9fe42dc35b7d98d246bb Merge: 74516c79eb1413Author: John Bowler <jbowler@acm.org> Date: Sun Nov 22 19:37:54 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit 74516c7257f1a28a69985684c5673caa390c700a Author: John Bowler <jbowler@acm.org> Date: Sun Nov 22 19:32:43 2015 -0800 Make check full pass on gcc/g++ x86_64 Signed-off-by: John Bowler <jbowler@acm.org> commit e891e34737fc0bc9ee873a5d56b83c1e777b990c Author: John Bowler <jbowler@acm.org> Date: Sun Nov 22 12:01:37 2015 -0800 Checkpoint: write buffering changes This version fails in pngvalid --size because of an error handling very narrow images, otherwise a standard build passes make check. Signed-off-by: John Bowler <jbowler@acm.org> commit 457a046ebdab737eefb477126cf855e49df6de50 Author: John Bowler <jbowler@acm.org> Date: Sun Nov 22 06:39:36 2015 -0800 Fix previous bad merge commit b4f426c97267317637d43f41fe0b05d1659bc63d Merge: 07b9b90a3458a6Author: John Bowler <jbowler@acm.org> Date: Sun Nov 22 06:32:34 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit 07b9b90dfd653b744dbc3710b096facf6b4605f6 Merge: ed433065592e0bAuthor: John Bowler <jbowler@acm.org> Date: Sat Nov 21 17:07:23 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit ed43306599f7039a90187862db82273fca3a4c3d Merge: 772aed7d3c0359Author: John Bowler <jbowler@acm.org> Date: Tue Nov 17 17:47:26 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit 772aed72378df9c8fccc5a4594b095d02d410a9c Merge: 73ae431801608fAuthor: John Bowler <jbowler@acm.org> Date: Mon Nov 16 14:26:38 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit 73ae4316cb6db7d7f6756583a1c213c35ca4e3f4 Merge: 687e6e3c09b3abAuthor: John Bowler <jbowler@acm.org> Date: Sun Nov 15 09:31:30 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit 687e6e393e9d0220c2a12ec474aa01b83c5e9f25 Merge: fedd6dae916d9bAuthor: John Bowler <jbowler@acm.org> Date: Thu Nov 5 08:45:14 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit fedd6da8798a14b2e002b0bc1379f5a09a03598a Merge: 2e2fc5fea41fd2Author: John Bowler <jbowler@acm.org> Date: Tue Nov 3 21:05:01 2015 -0800 Merge branch 'libpng17' into libpng17-filter-enhancements commit 2e2fc5f6d7678b710c52b7ea081ac4add677d8d5 Merge: 990d5f85b05197Author: John Bowler <jbowler@acm.org> Date: Mon Oct 12 08:28:30 2015 -0700 Merge branch 'libpng17' into libpng17-filter-enhancements commit 990d5f88688635dc0888657b689e30ffe7e7a7b3 Author: John Bowler <jbowler@acm.org> Date: Sun Oct 4 17:04:53 2015 -0700 Read row buffer changes The read code now allocates one row buffer of the size of the input PNG row and, only if required, one buffer of the size of the output. The output buffer is required for the progressive reader (always) and for the sequential reader if libpng is de-interlacing an image (because the output row is used multiple times if png_read_row is called with a display row parameter.) This should reduce memory utilization by libpng significantly, but it has no detectable effect on overall performance figures of the test programs, these are probably dominated by memory allocations for the whole image within the test programs. Signed-off-by: John Bowler <jbowler@acm.org> commit 527bf989bf0e30440f9e07a5544a6ebb1d6fd039 Merge: 50ebbc29099254Author: John Bowler <jbowler@acm.org> Date: Sat Oct 3 13:39:17 2015 -0700 Merge branch 'libpng17' into libpng17-filter-enhancements commit 50ebbc2c9a24cf1a6b428db53d55fbd5af4d6be6 Merge: 21a7f402cd6d56Author: John Bowler <jbowler@acm.org> Date: Sat Oct 3 11:16:32 2015 -0700 Merge branch 'libpng17' into libpng17-filter-enhancements commit 21a7f401ab40c79ead9e35882a8066e2cf1d6902 Merge: b512e1c15a143eAuthor: John Bowler <jbowler@acm.org> Date: Wed Sep 30 19:01:23 2015 -0700 Merge branch 'libpng17' into libpng17-filter-enhancements commit b512e1c2c5bfe6df8b6dca32f862d325ec22115e Author: John Bowler <jbowler@acm.org> Date: Wed Sep 30 17:33:34 2015 -0700 Transform rewrite: perform transforms in small chunks The intent of this change is to reduce the memory footprint during transform sequences by performing transforms in fixed (small) sized blocks of pixels. The change is incomplete; the filter code still works row-by-row, so the whole tranform also works row-by-row, the intent is to fix this so that everything works in small(ish) chunks. At present the change has no discernable effect on pngvalid --speed or pngstest with (e.g.) rgb-8-1.8.png; user time and (minor) page faults are the same in old and new versions. The same applies to real-world 15MP PNG images; even on these the presence of the filter code causes a cyclical progress through memory which will interfere with any caching otherwise possible (useful word, 'otherwise'.) Signed-off-by: John Bowler <jbowler@acm.org> commit 781cb3699b92beb0e6bc5e03cef8fba820267082 Author: John Bowler <jbowler@acm.org> Date: Wed Sep 30 17:12:53 2015 -0700 Fix NO_WRITE_INTERLACE in pngvalid.c The support for writing interlaced images directly from libpng 1.7 was unintentionally disabled (INTERLACE_LAST was defined incorrectly, excluding the interlaced images). This obscured the fact that the transform and error test case generators lacked the support for writing interlaced images from libpng. Signed-off-by: John Bowler <jbowler@acm.org> commit 406ee2fd7946a384f1d7713712dc646080c5c52c Author: John Bowler <jbowler@acm.org> Date: Wed Sep 30 17:11:40 2015 -0700 Add pngvalid --transform --interlace test This increases code coverage by generating test cases with smaller length rows as a result of the interlacing. Without this packswap handling was incompletely tested. Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
61
pngstruct.h
61
pngstruct.h
@@ -446,15 +446,20 @@ struct png_struct_def
|
||||
* filter byte (which is in next_filter.) All fields are only used during
|
||||
* IDAT processing and start of 0.
|
||||
*/
|
||||
png_bytep row_buffer; /* primary row buffer */
|
||||
#if defined(PNG_WRITE_FILTER_SUPPORTED) || defined(PNG_READ_SUPPORTED)
|
||||
png_bytep alt_buffer; /* if two row buffers needed */
|
||||
#endif
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
png_bytep write_row[2]; /* Two rows to test filers */
|
||||
#endif
|
||||
png_bytep row_buffer; /* primary row buffer */
|
||||
#endif /* WRITE_FILTER || READ */
|
||||
#if (defined(PNG_PROGRESSIVE_READ_SUPPORTED) ||\
|
||||
defined(PNG_READ_DEINTERLACE_SUPPORTED)) &&\
|
||||
defined(PNG_TRANSFORM_MECH_SUPPORTED)
|
||||
png_bytep transformed_row; /* pointer to the transformed row, if
|
||||
* required. May point to row_buffer.
|
||||
*/
|
||||
#endif /* (PROGRESSIVE_READ || READ_DEINTERLACE) && TRANSFORM_MECH */
|
||||
|
||||
png_alloc_size_t row_allocated_bytes; /* Total amount allocated */
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
png_alloc_size_t row_bytes_read; /* Total read in row */
|
||||
#endif /* READ */
|
||||
|
||||
png_uint_32 row_number; /* current row in pass */
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
@@ -484,16 +489,34 @@ struct png_struct_def
|
||||
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
unsigned int read_started :1; /* at least one call to png_read_row */
|
||||
#endif
|
||||
#if defined (PNG_READ_DEINTERLACE_SUPPORTED) ||\
|
||||
defined (PNG_WRITE_INTERLACE_SUPPORTED)
|
||||
unsigned int do_interlace :1; /* libpng handles the interlace */
|
||||
# endif /* READ_DEINTERLACE, WRITE_INTERLACE */
|
||||
unsigned int pass :3; /* current (interlace) pass (0 - 6) */
|
||||
|
||||
/* The next two fields are just used by the IDAT process functions to store
|
||||
* the state of IDAT processing; they should not be altered or used by other
|
||||
* functions.
|
||||
*/
|
||||
unsigned int prev_in_alt :1; /* previous row is stored in alt_buffer */
|
||||
unsigned int row_state :2; /* state of row parsing (internal) */
|
||||
|
||||
/* The following fields are set by png_row_init to the pixel depths of the
|
||||
* pixels at various states. If transforms are not supported they will
|
||||
* always be the same value:
|
||||
*
|
||||
* READ WRITE
|
||||
* input: PNG From application
|
||||
* output: To application PNG
|
||||
* max: Largest in transform
|
||||
*/
|
||||
unsigned int row_input_pixel_depth :8;
|
||||
unsigned int row_output_pixel_depth :8;
|
||||
unsigned int row_max_pixel_depth :8;
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
unsigned int filter_mask :8; /* mask of filters to consider on write */
|
||||
#endif /* WRITE_FILTER */
|
||||
|
||||
# define PNG_RF_BITS 9 /* Number of bits required for the row format (below) */
|
||||
#ifdef PNG_TRANSFORM_MECH_SUPPORTED
|
||||
/* The following fields describe the format of the user row; the output on
|
||||
@@ -528,9 +551,8 @@ struct png_struct_def
|
||||
* alpha or gray) have been inverted.
|
||||
* PNG_FORMAT_FLAG_INVALID NOT STORED HERE
|
||||
*/
|
||||
unsigned int row_max_pixel :8; /* maximum pixel depth used */
|
||||
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||
unsigned int info_format:PNG_RF_BITS;
|
||||
unsigned int info_format:PNG_RF_BITS;
|
||||
/* This field is used to validate the png_info used to write the
|
||||
* IHDR. This is a new check in 1.7.0; previously it was possible to pass
|
||||
* a png_info from a png_read with the read tranform information in the
|
||||
@@ -539,27 +561,20 @@ struct png_struct_def
|
||||
*/
|
||||
#endif /* WRITE_TRANSFORMS */
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
unsigned int write_invert_alpha :1;
|
||||
unsigned int write_invert_alpha :1;
|
||||
/* This indicates the png_set_invert_alpha was called, it is used by the
|
||||
* write code to implement the transform without needing to run the whole
|
||||
* transform mechanism on the PNG palette data.
|
||||
*/
|
||||
#endif /* WRITE_INVERT_ALPHA */
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
unsigned int rgb_to_gray_status :1;
|
||||
unsigned int rgb_to_gray_status :1;
|
||||
/* If set an RGB pixel was encountered by the RGB to gray transform
|
||||
* wherein !(r==g==b).
|
||||
*/
|
||||
#endif /* RGB_TO_GRAY */
|
||||
#endif /* TRANFORM_MECH */
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_FILTER_SUPPORTED)
|
||||
png_byte next_filter; /* Filter byte for upcoming row (read or
|
||||
* filters+masks to try (write, if WRITE_FILTER is
|
||||
* supported).
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* These, and IDAT_read_size below, control how much input and output (at
|
||||
* most) is available to zlib.
|
||||
@@ -629,7 +644,8 @@ struct png_struct_def
|
||||
* un-filter function, this allows per-image and per-processor optimization.
|
||||
*/
|
||||
void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_alloc_size_t row_bytes,
|
||||
unsigned int bpp, png_bytep row, png_const_bytep prev_row);
|
||||
unsigned int bpp, png_bytep row, png_const_bytep prev_row,
|
||||
png_const_bytep prev_pixels);
|
||||
#endif /* READ */
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
@@ -749,5 +765,10 @@ struct png_struct_def
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
unsigned int mng_features_permitted :3;
|
||||
#endif
|
||||
|
||||
/* SCRATCH buffers, used when control returns to the application or a read
|
||||
* loop.
|
||||
*/
|
||||
png_byte scratch[PNG_ROW_BUFFER_SIZE+16U];
|
||||
};
|
||||
#endif /* PNGSTRUCT_H */
|
||||
|
||||
Reference in New Issue
Block a user