diff -ru4NwbB libpng-1.5.6/Makefile.am libpng-1.5.7beta01/Makefile.am --- libpng-1.5.6/Makefile.am 2011-11-02 22:42:58.022435114 -0500 +++ libpng-1.5.7beta01/Makefile.am 2011-11-04 14:00:56.791642989 -0500 @@ -35,8 +35,12 @@ pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\ pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\ png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h +if PNG_ARM_NEON +libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/filter_neon.S +endif + nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@ @@ -137,11 +141,11 @@ test -d scripts || mkdir scripts echo '#include "$<"' >dfn.c $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out - $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\ + $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\ dfn1.out >dfn2.out - $(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out + $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out rm -f dfn.c dfn[12].out mv dfn3.out $@ # The .dfn file for pnglibconf.h is machine generated diff -ru4NwbB libpng-1.5.6/configure.ac libpng-1.5.7beta01/configure.ac --- libpng-1.5.6/configure.ac 2011-11-02 22:42:58.029005391 -0500 +++ libpng-1.5.7beta01/configure.ac 2011-11-04 14:00:56.798100615 -0500 @@ -35,8 +35,9 @@ # Checks for programs. AC_LANG([C]) AC_PROG_CC +AM_PROG_AS AC_PROG_LD AC_PROG_CPP AC_CHECK_TOOL(SED, sed, :) AC_CHECK_TOOL(AWK, awk, :) @@ -176,8 +177,16 @@ fi], [binconfigs='${binconfigs}']) AC_SUBST([binconfigs]) +AC_ARG_ENABLE([arm-neon], + AC_HELP_STRING([--enable-arm-neon], [Enable ARM NEON optmizations]), + [if test "${enableval}" = yes; then + AC_DEFINE([PNG_ARM_NEON], [1], [Enable ARM NEON optmizations]) + AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1], [Align row buffers]) + fi]) +AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes]) + # Config files, substituting as above AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in]) AC_CONFIG_FILES([libpng-config:libpng-config.in], [chmod +x libpng-config]) diff -ru4NwbB libpng-1.5.6/example.c libpng-1.5.7beta01/example.c --- libpng-1.5.6/example.c 2011-11-02 22:42:50.387042477 -0500 +++ libpng-1.5.7beta01/example.c 2011-11-04 14:00:49.310244795 -0500 @@ -1,9 +1,9 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * This file has been placed in the public domain by the authors. * Maintained 1998-2011 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) diff -ru4NwbB libpng-1.5.6/png.c libpng-1.5.7beta01/png.c --- libpng-1.5.6/png.c 2011-11-02 22:42:50.399590772 -0500 +++ libpng-1.5.7beta01/png.c 2011-11-04 14:00:49.323044360 -0500 @@ -1,8 +1,8 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/png.h libpng-1.5.7beta01/png.h --- libpng-1.5.6/png.h 2011-11-02 22:42:50.344556602 -0500 +++ libpng-1.5.7beta01/png.h 2011-11-04 14:00:49.266945400 -0500 @@ -162,8 +162,9 @@ * 1.5.5 15 10505 15.so.15.5[.0] * 1.5.6beta01-07 15 10506 15.so.15.6[.0] * 1.5.6rc01-03 15 10506 15.so.15.6[.0] * 1.5.6 15 10506 15.so.15.6[.0] + * 1.5.7beta01 15 10507 15.so.15.7[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The diff -ru4NwbB libpng-1.5.6/pngerror.c libpng-1.5.7beta01/pngerror.c --- libpng-1.5.6/pngerror.c 2011-11-02 22:42:50.406539999 -0500 +++ libpng-1.5.7beta01/pngerror.c 2011-11-04 14:00:49.330169635 -0500 @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/pngget.c libpng-1.5.7beta01/pngget.c --- libpng-1.5.6/pngget.c 2011-11-02 22:42:50.414779399 -0500 +++ libpng-1.5.7beta01/pngget.c 2011-11-04 14:00:49.338378727 -0500 @@ -1,8 +1,8 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/pngmem.c libpng-1.5.7beta01/pngmem.c --- libpng-1.5.6/pngmem.c 2011-11-02 22:42:50.421685471 -0500 +++ libpng-1.5.7beta01/pngmem.c 2011-11-04 14:00:49.345275222 -0500 @@ -1,8 +1,8 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.5.4 [July 7, 2011] + * Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -55,11 +55,11 @@ # ifdef PNG_USER_MEM_SUPPORTED if (malloc_fn != NULL) { png_struct dummy_struct; - png_structp png_ptr = &dummy_struct; - png_ptr->mem_ptr=mem_ptr; - struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size); + memset(&dummy_struct, 0, sizeof dummy_struct); + dummy_struct.mem_ptr=mem_ptr; + struct_ptr = (*(malloc_fn))(&dummy_struct, (png_alloc_size_t)size); } else # endif /* PNG_USER_MEM_SUPPORTED */ @@ -89,11 +89,11 @@ # ifdef PNG_USER_MEM_SUPPORTED if (free_fn != NULL) { png_struct dummy_struct; - png_structp png_ptr = &dummy_struct; - png_ptr->mem_ptr=mem_ptr; - (*(free_fn))(png_ptr, struct_ptr); + memset(&dummy_struct, 0, sizeof dummy_struct); + dummy_struct.mem_ptr=mem_ptr; + (*(free_fn))(&dummy_struct, struct_ptr); return; } # endif /* PNG_USER_MEM_SUPPORTED */ @@ -142,9 +142,9 @@ return (NULL); # ifdef PNG_USER_MEM_SUPPORTED if (png_ptr->malloc_fn != NULL) - ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); + ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size)); else ret = (png_malloc_default(png_ptr, size)); diff -ru4NwbB libpng-1.5.6/pngpread.c libpng-1.5.7beta01/pngpread.c --- libpng-1.5.6/pngpread.c 2011-11-02 22:42:50.431199446 -0500 +++ libpng-1.5.7beta01/pngpread.c 2011-11-04 14:00:49.355194322 -0500 @@ -1,8 +1,8 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -984,9 +984,9 @@ if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) { if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST) - png_read_filter_row(&row_info, png_ptr->row_buf + 1, + png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1, png_ptr->prev_row + 1, png_ptr->row_buf[0]); else png_error(png_ptr, "bad adaptive filter value"); } diff -ru4NwbB libpng-1.5.6/pngpriv.h libpng-1.5.7beta01/pngpriv.h --- libpng-1.5.6/pngpriv.h 2011-11-02 22:42:50.361693834 -0500 +++ libpng-1.5.7beta01/pngpriv.h 2011-11-04 14:00:49.284563370 -0500 @@ -5,9 +5,9 @@ * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.7 [(PENDING RELEASE)] * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h @@ -921,11 +921,26 @@ /* Unfilter a row: check the filter value before calling this, there is no point * calling it for PNG_FILTER_VALUE_NONE. */ -PNG_EXTERN void png_read_filter_row PNGARG((png_row_infop row_info, +PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop row_info, png_bytep row, png_const_bytep prev_row, int filter)); +PNG_EXTERN void png_read_filter_row_up_neon PNGARG((png_row_infop row_info, + png_bytep row, png_const_bytep prev_row)); +PNG_EXTERN void png_read_filter_row_sub3_neon PNGARG((png_row_infop row_info, + png_bytep row, png_const_bytep prev_row)); +PNG_EXTERN void png_read_filter_row_sub4_neon PNGARG((png_row_infop row_info, + png_bytep row, png_const_bytep prev_row)); +PNG_EXTERN void png_read_filter_row_avg3_neon PNGARG((png_row_infop row_info, + png_bytep row, png_const_bytep prev_row)); +PNG_EXTERN void png_read_filter_row_avg4_neon PNGARG((png_row_infop row_info, + png_bytep row, png_const_bytep prev_row)); +PNG_EXTERN void png_read_filter_row_paeth3_neon PNGARG((png_row_infop row_info, + png_bytep row, png_const_bytep prev_row)); +PNG_EXTERN void png_read_filter_row_paeth4_neon PNGARG((png_row_infop row_info, + png_bytep row, png_const_bytep prev_row)); + /* Choose the best filter to use and filter the row data */ PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, png_row_infop row_info)); diff -ru4NwbB libpng-1.5.6/pngread.c libpng-1.5.7beta01/pngread.c --- libpng-1.5.6/pngread.c 2011-11-02 22:42:50.439731962 -0500 +++ libpng-1.5.7beta01/pngread.c 2011-11-04 14:00:49.363777396 -0500 @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -577,9 +577,9 @@ if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) { if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST) - png_read_filter_row(&row_info, png_ptr->row_buf + 1, + png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1, png_ptr->prev_row + 1, png_ptr->row_buf[0]); else png_error(png_ptr, "bad adaptive filter value"); } diff -ru4NwbB libpng-1.5.6/pngrtran.c libpng-1.5.7beta01/pngrtran.c --- libpng-1.5.6/pngrtran.c 2011-11-02 22:42:50.462840407 -0500 +++ libpng-1.5.7beta01/pngrtran.c 2011-11-04 14:00:49.387226419 -0500 @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/pngrutil.c libpng-1.5.7beta01/pngrutil.c --- libpng-1.5.6/pngrutil.c 2011-11-02 22:42:50.478366695 -0500 +++ libpng-1.5.7beta01/pngrutil.c 2011-11-04 14:00:49.403324530 -0500 @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -3497,36 +3497,30 @@ #endif } #endif /* PNG_READ_INTERLACING_SUPPORTED */ -/* 1.5.6: Changed to just take a png_row_info (not png_ptr) and to ignore bad - * adaptive filter bytes. - */ -void /* PRIVATE */ -png_read_filter_row(png_row_infop row_info, png_bytep row, - png_const_bytep prev_row, int filter) -{ - switch (filter) - { - case PNG_FILTER_VALUE_NONE: - break; - - case PNG_FILTER_VALUE_SUB: +static void +png_read_filter_row_sub(png_row_infop row_info, png_bytep row, + png_const_bytep prev_row) { png_size_t i; png_size_t istop = row_info->rowbytes; unsigned int bpp = (row_info->pixel_depth + 7) >> 3; png_bytep rp = row + bpp; png_bytep lp = row; + PNG_UNUSED(prev_row) + for (i = bpp; i < istop; i++) { *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); rp++; } - break; } - case PNG_FILTER_VALUE_UP: + +static void +png_read_filter_row_up(png_row_infop row_info, png_bytep row, + png_const_bytep prev_row) { png_size_t i; png_size_t istop = row_info->rowbytes; png_bytep rp = row; @@ -3536,11 +3530,13 @@ { *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); rp++; } - break; } - case PNG_FILTER_VALUE_AVG: + +static void +png_read_filter_row_avg(png_row_infop row_info, png_bytep row, + png_const_bytep prev_row) { png_size_t i; png_bytep rp = row; png_const_bytep pp = prev_row; @@ -3562,33 +3558,84 @@ (int)(*pp++ + *lp++) / 2 ) & 0xff); rp++; } - break; } - case PNG_FILTER_VALUE_PAETH: + +static void +png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row, + png_const_bytep prev_row) { - png_size_t i; - png_bytep rp = row; - png_const_bytep pp = prev_row; - png_bytep lp = row; - png_const_bytep cp = prev_row; - unsigned int bpp = (row_info->pixel_depth + 7) >> 3; - png_size_t istop=row_info->rowbytes - bpp; + png_bytep rp_end = row + row_info->rowbytes; + int a, c; - for (i = 0; i < bpp; i++) + /* First pixel/byte */ + c = *prev_row++; + a = *row + c; + *row++ = (png_byte)a; + + /* Remainder */ + while (row < rp_end) { - *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); - rp++; + int b, pa, pb, pc, p; + + a &= 0xff; /* From previous iteration or start */ + b = *prev_row++; + + p = b - c; + pc = a - c; + +# ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +# else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +# endif + + /* Find the best predictor, the least of pa, pb, pc favoring the earlier + * ones in the case of a tie. + */ + if (pb < pa) pa = pb, a = b; + if (pc < pa) a = c; + + /* Calculate the current pixel in a, and move the previous row pixel to c + * for the next time round the loop + */ + c = b; + a += *row; + *row++ = (png_byte)a; + } +} + +static void +png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, + png_const_bytep prev_row) +{ + int bpp = (row_info->pixel_depth + 7) >> 3; + png_bytep rp_end = row + bpp; + + /* Process the first pixel in the row completely (this is the same as 'up' + * because there is only one candidate predictor for the first row). + */ + while (row < rp_end) + { + int a = *row + *prev_row++; + *row++ = (png_byte)a; } - for (i = 0; i < istop; i++) /* Use leftover rp,pp */ + /* Remainder */ + rp_end += row_info->rowbytes - bpp; + + while (row < rp_end) { int a, b, c, pa, pb, pc, p; - a = *lp++; - b = *pp++; - c = *cp++; + c = *(prev_row - bpp); + a = *(row - bpp); + b = *prev_row++; p = b - c; pc = a - c; @@ -3601,30 +3648,63 @@ pb = pc < 0 ? -pc : pc; pc = (p + pc) < 0 ? -(p + pc) : p + pc; #endif - /* - if (pa <= pb && pa <= pc) - p = a; + if (pb < pa) pa = pb, a = b; + if (pc < pa) a = c; - else if (pb <= pc) - p = b; - - else - p = c; - */ + c = b; + a += *row; + *row++ = (png_byte)a; + } +} - p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c; +#ifdef PNG_ARM_NEON +static void +png_init_filter_functions_neon(png_structp pp, unsigned int bpp) +{ + pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_neon; - *rp = (png_byte)(((int)(*rp) + p) & 0xff); - rp++; + if (bpp == 3) { + pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon; + pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon; + pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_neon; + } else if (bpp == 4) { + pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_neon; + pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_neon; + pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_neon; } - break; } - default: - /* NOT REACHED */ - break; +#endif + +static void +png_init_filter_functions(png_structp pp) +{ + unsigned int bpp = (pp->pixel_depth + 7) >> 3; + + pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub; + pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up; + pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg; + if (bpp == 1) + pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = + png_read_filter_row_paeth_1byte_pixel; + else + pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = + png_read_filter_row_paeth_multibyte_pixel; + +#ifdef PNG_ARM_NEON + png_init_filter_functions_neon(pp, bpp); +#endif } + +void /* PRIVATE */ +png_read_filter_row(png_structp pp, png_row_infop row_info, png_bytep row, + png_const_bytep prev_row, int filter) +{ + if (pp->read_filter[0] == NULL) + png_init_filter_functions(pp); + if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST) + pp->read_filter[filter-1](row_info, row, prev_row); } #ifdef PNG_SEQUENTIAL_READ_SUPPORTED void /* PRIVATE */ diff -ru4NwbB libpng-1.5.6/pngset.c libpng-1.5.7beta01/pngset.c --- libpng-1.5.6/pngset.c 2011-11-02 22:42:50.486944000 -0500 +++ libpng-1.5.7beta01/pngset.c 2011-11-04 14:00:49.412010824 -0500 @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/pngstruct.h libpng-1.5.7beta01/pngstruct.h --- libpng-1.5.6/pngstruct.h 2011-11-02 22:42:50.368044918 -0500 +++ libpng-1.5.7beta01/pngstruct.h 2011-11-04 14:00:49.291058939 -0500 @@ -352,6 +352,9 @@ #endif /* New member added in libpng-1.5.6 */ png_bytep big_prev_row; + + void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info, + png_bytep row, png_const_bytep prev_row); }; #endif /* PNGSTRUCT_H */ diff -ru4NwbB libpng-1.5.6/pngtest.c libpng-1.5.7beta01/pngtest.c --- libpng-1.5.6/pngtest.c 2011-11-02 22:42:50.496589188 -0500 +++ libpng-1.5.7beta01/pngtest.c 2011-11-04 14:00:49.421954201 -0500 @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/pngvalid.c libpng-1.5.7beta01/pngvalid.c --- libpng-1.5.6/pngvalid.c 2011-11-02 22:42:50.531808873 -0500 +++ libpng-1.5.7beta01/pngvalid.c 2011-11-04 14:00:49.458059154 -0500 @@ -1,8 +1,8 @@ /* pngvalid.c - validate libpng by constructing then reading png files. * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Copyright (c) 2011 Glenn Randers-Pehrson * Written by John Cunningham Bowler * * This code is released under the libpng license. @@ -1331,9 +1331,23 @@ ++new; } else - store_pool_error(pool->store, pp, "out of memory"); + { + /* NOTE: the PNG user malloc function cannot use the png_ptr it is passed + * other than to retrieve the allocation pointer! libpng calls the + * store_malloc callback in two basic cases: + * + * 1) From png_malloc; png_malloc will do a png_error itself if NULL is + * returned. + * 2) From png_struct or png_info structure creation; png_malloc is + * to return so cleanup can be performed. + * + * To handle this store_malloc can log a message, but can't do anything + * else. + */ + store_log(pool->store, pp, "out of memory", 1 /* is_error */); + } return new; } @@ -1342,8 +1356,16 @@ { store_pool *pool = voidcast(store_pool*, png_get_mem_ptr(pp)); store_memory *this = voidcast(store_memory*, memory), **test; + /* Because libpng calls store_free with a dummy png_struct when deleting + * png_struct or png_info via png_destroy_struct_2 it is necessary to check + * the passed in png_structp to ensure it is valid, and not pass it to + * png_error if it is not. + */ + if (pp != pool->store->pread && pp != pool->store->pwrite) + pp = NULL; + /* First check that this 'memory' really is valid memory - it must be in the * pool list. If it is, use the shared memory_free function to free it. */ --this; diff -ru4NwbB libpng-1.5.6/pngwrite.c libpng-1.5.7beta01/pngwrite.c --- libpng-1.5.6/pngwrite.c 2011-11-02 22:42:50.547268135 -0500 +++ libpng-1.5.7beta01/pngwrite.c 2011-11-04 14:00:49.473520960 -0500 @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/pngwtran.c libpng-1.5.7beta01/pngwtran.c --- libpng-1.5.6/pngwtran.c 2011-11-02 22:42:50.554047247 -0500 +++ libpng-1.5.7beta01/pngwtran.c 2011-11-04 14:00:49.480300682 -0500 @@ -1,8 +1,8 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/pngwutil.c libpng-1.5.7beta01/pngwutil.c --- libpng-1.5.6/pngwutil.c 2011-11-02 22:42:50.567056497 -0500 +++ libpng-1.5.7beta01/pngwutil.c 2011-11-04 14:00:49.493359779 -0500 @@ -1,8 +1,8 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.5.6 [(PENDING RELEASE)] + * Last changed in libpng 1.5.6 [November 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.6/scripts/def.dfn libpng-1.5.7beta01/scripts/def.dfn --- libpng-1.5.6/scripts/def.dfn 2011-01-04 09:45:35.000000000 -0600 +++ libpng-1.5.7beta01/scripts/def.dfn 2011-11-03 16:13:57.000000000 -0500 @@ -26,13 +26,13 @@ S--E S-EXPORTS-E S-;Version 1.5.0beta58-E -/* NOTE: @@@ is interpreted by the calling script as a signal to +/* NOTE: PNG_JOIN is interpreted by the calling script as a signal to * join the two things on either side, so we can do symbol * substitution within the name, regular C ## joins the pp-tokens, * not their final values. */ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_DEFN_MAGIC- SYMBOL_PREFIX @@@ name-PNG_DEFN_END + PNG_DEFN_MAGIC- SYMBOL_PREFIX PNG_JOIN name-PNG_DEFN_END #include "../png.h" diff -ru4NwbB libpng-1.5.6/scripts/options.awk libpng-1.5.7beta01/scripts/options.awk --- libpng-1.5.6/scripts/options.awk 2011-05-07 10:30:44.000000000 -0500 +++ libpng-1.5.7beta01/scripts/options.awk 2011-11-03 16:13:57.000000000 -0500 @@ -34,15 +34,16 @@ pre=-1 # preprocess (first line) err=0 # in-line exit sets this start="PNG_DEFN_MAGIC-" # Arbitrary start end="-PNG_DEFN_END" # Arbitrary end - cx= "/@@@*" # Open C comment for output file + ct="PNG_JOIN" # Join two tokens + cx= "/" ct "*" # Open C comment for output file comment=start cx # Comment start cend="*/" end # Comment end - def=start "#define PNG_@@@" # Arbitrary define - sup="@@@_SUPPORTED" end # end supported option - und=comment "#undef PNG_@@@" # Unsupported option - une="@@@_SUPPORTED" cend # end unsupported option + def=start "#define PNG_" ct # Arbitrary define + sup=ct "_SUPPORTED" end # end supported option + und=comment "#undef PNG_" ct # Unsupported option + une=ct "_SUPPORTED" cend # end unsupported option error=start "ERROR:" # error message # Variables deb=0 # debug - set on command line diff -ru4NwbB libpng-1.5.6/scripts/sym.dfn libpng-1.5.7beta01/scripts/sym.dfn --- libpng-1.5.6/scripts/sym.dfn 2011-01-21 19:20:38.000000000 -0600 +++ libpng-1.5.7beta01/scripts/sym.dfn 2011-11-03 16:13:57.000000000 -0500 @@ -9,7 +9,7 @@ * and license in png.h */ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_DEFN_MAGIC-SYMBOL_PREFIX @@@ name-PNG_DEFN_END + PNG_DEFN_MAGIC-SYMBOL_PREFIX PNG_JOIN name-PNG_DEFN_END #include "../png.h" diff -ru4NwbB libpng-1.5.6/scripts/vers.dfn libpng-1.5.7beta01/scripts/vers.dfn --- libpng-1.5.6/scripts/vers.dfn 2011-01-21 19:20:50.000000000 -0600 +++ libpng-1.5.7beta01/scripts/vers.dfn 2011-11-03 16:13:57.000000000 -0500 @@ -10,15 +10,15 @@ */ #define HEADER PNG_DEFN_MAGIC-PNGLIB_LIBNAME {global:-PNG_DEFN_END -/* NOTE: @@@ is interpreted by the calling script as a signal to +/* NOTE: PNG_JOIN is interpreted by the calling script as a signal to * join the two things on either side, so we can do symbol * substitution within the name, regular C ## joins the pp-tokens, * not their final values. */ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_DEFN_MAGIC- SYMBOL_PREFIX @@@ name;-PNG_DEFN_END + PNG_DEFN_MAGIC- SYMBOL_PREFIX PNG_JOIN name;-PNG_DEFN_END #define TRAILER PNG_DEFN_MAGIC-local: *; };-PNG_DEFN_END HEADER