[libpng15] Delay calling png_init_filter_functions() until a row with nonzero

filter is found.
diff --git a/ANNOUNCE b/ANNOUNCE
index 9da702a..59bbc46 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.5.18beta01 - June 29, 2013
+Libpng 1.5.18beta01 - August 21, 2013
 
 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.
@@ -24,46 +24,11 @@
    1.5.18beta01-README.txt
    1.5.18beta01-LICENSE.txt
 
-Changes since the last public release (1.5.16):
+Changes since the last public release (1.5.17):
 
-Version 1.5.17beta01 [June 8, 2013]
-  Removed a redundant test from png_set_IHDR().
-  Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt)
-  Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt
-  Make ARM NEON support work at compile time (not just configure time).
-    This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
-    using a compiler that compiles for multiple architectures at one time.
-  Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
-    pnglibconf.h, allowing more of the decisions to be made internally
-    (pngpriv.h) during the compile.  Without this, symbol prefixing is broken
-    under certain circumstances on ARM platforms.  Now only the API parts of
-    the optimizations ('check' vs 'api') are exposed in the public header files
-    except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
-    decision about whether or not to use the optimizations.
-  Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
-    Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
-    on __ARM_NEON__ from configure time to compile time.  This breaks symbol
-    prefixing because the definition of the special png_init_filter_functions
-    call was hidden at configure time if the relevant compiler arguments are
-    passed in CFLAGS as opposed to CC.  This change attempts to avoid all
-    the confusion that would result by declaring the init function even when
-    it is not used, so that it will always get prefixed.
-
-Version 1.5.17rc01 [June 29, 2013]
-  No changes.
-
-Version 1.5.17rc02 [June 18, 2013]
-  Revised libpng.3 so that "doclifter" can process it.
-
-Version 1.5.17rc03 [June 25, 2013]
-  Revised example.c to illustrate use of PNG_DEFAULT_sRGB and PNG_GAMMA_MAC_18
-    as parameters for png_set_gamma().  These have been available since
-    libpng-1.5.4.
-
-Version 1.5.17 [June 27, 2013]
-  No changes.
-
-Version 1.5.18beta01 [June 29, 2013]
+Version 1.5.18beta01 [August 21, 2013]
+  Delay calling png_init_filter_functions() until a row with nonzero filter
+    is found.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index f2b5f78..d9c6df9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4150,7 +4150,9 @@
 Version 1.5.17 [June 27, 2013]
   No changes.
 
-Version 1.5.18beta01 [June 29, 2013]
+Version 1.5.18beta01 [August 21, 2013]
+  Delay calling png_init_filter_functions() until a row with nonzero filter
+    is found.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/pngrutil.c b/pngrutil.c
index 0d82f02..987e59f 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * Last changed in libpng 1.5.16 [May 23, 2013]
+ * Last changed in libpng 1.5.18 [%RDATE%]
  * Copyright (c) 1998-2013 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.)
@@ -3700,10 +3700,13 @@
 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)
+   {
+      if (pp->read_filter[0] == NULL)
+         png_init_filter_functions(pp);
+
       pp->read_filter[filter-1](row_info, row, prev_row);
+   }
 }
 
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED