Bug 858578 - Update bundled libpng to version 1.5.15. r=joedrew
authorGlenn Randers-Pehrson <glennrp+bmo@gmail.com>
Fri, 12 Apr 2013 16:25:04 -0400
changeset 128659 9aac7a9d61be1375bcad24ee99d4f2224bfdd35f
parent 128658 f36ce9b95a0c528159faec9e73135c14af40e97c
child 128660 f81774f097c3c194f1bf7644ceca2e16421872dc
push id1513
push userryanvm@gmail.com
push dateSat, 13 Apr 2013 02:18:46 +0000
treeherderfx-team@5fc7f4b572ae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoedrew
bugs858578
milestone23.0a1
Bug 858578 - Update bundled libpng to version 1.5.15. r=joedrew
media/libpng/CHANGES
media/libpng/LICENSE
media/libpng/MOZCHANGES
media/libpng/README
media/libpng/apng.patch
media/libpng/arm/arm_init.c
media/libpng/arm/filter_neon.S
media/libpng/libpng-manual.txt
media/libpng/png.c
media/libpng/png.h
media/libpng/pngget.c
media/libpng/pngpriv.h
media/libpng/pngrutil.c
media/libpng/pngstruct.h
media/libpng/pngwrite.c
media/libpng/pngwutil.c
--- a/media/libpng/CHANGES
+++ b/media/libpng/CHANGES
@@ -3667,17 +3667,18 @@ Version 1.5.6rc03 [October 28, 2011]
     Under MSYS 'byte' is a name declared in a system header file, so we
     changed the name of a local variable to avoid the warnings that result.
   Added #define PNG_ALIGN_TYPE PNG_ALIGN_NONE to contrib/pngminim/*/pngusr.h
 
 Version 1.5.6 [November 3, 2011]
   No changes.
 
 Version 1.5.7beta01 [November 4, 2011]
-  Added support for ARM processor (Mans Rullgard)
+  Added support for ARM processor, when decoding all PNG up-filtered rows
+    and any other-filtered rows with 3 or 4 bytes per pixel (Mans Rullgard).
   Fixed bug in pngvalid on early allocation failure; fixed type cast in
     pngmem.c; pngvalid would attempt to call png_error() if the allocation
     of a png_struct or png_info failed. This would probably have led to a
     crash.  The pngmem.c implementation of png_malloc() included a cast
     to png_size_t which would fail on large allocations on 16-bit systems.
   Fix for the preprocessor of the Intel C compiler. The preprocessor
     splits adjacent @ signs with a space; this changes the concatentation
     token from @-@-@ to PNG_JOIN; that should work with all compiler
@@ -3978,21 +3979,100 @@ Version 1.5.14rc02 [January 17, 2013]
 
 Version 1.5.14rc03 [January 18, 2013]
   Check the validity of the "nentries" parameter of png_set_sPLT() and the
   "num_text" parameter of png_set_text_2().
 
 Version 1.5.14 [January 24, 2013]
   Removed an obsolete line from the manual.
 
-  ===========================================================================
-                       NOTICE November 17, 2012:
-     The location of the git repository at SourceForge has changed.
-               Visit http://libpng.sf.net/ for details.
-  ===========================================================================
+Version 1.5.15beta01 [February 4, 2013]
+  Enabled renaming of the extern (but not DLL exported) ARM filter functions.
+    Also enabled inclusion of pngpriv.h in non-C files by preventing C/C++
+    specific definitions if PNG_VERSION_INFO_ONLY is defined.
+  Added png_get_palette_max() function.
+
+Version 1.5.15beta02 [February 5, 2013]
+  Made a probably general fix for the preprocessing used to generate source
+    files. This change might make the check for a special C preprocessor
+    unnecessary, and it also eliminates the requirement for sed in the
+    configure build process.
+  Fix typo in Makefile.am, fix scripts/pnglibconf.mak and makefile.std
+  Rebuilt Makefile.in, configure, etc., with autoconf-2.69 and automake-1.13
+  Fix 'setting' handling in options.awk and fixed palette_max API
+
+Version 1.5.15beta03 [February 7, 2013]
+  Remove SUN OS cc -E workround - no longer required
+  Turn serial tests back on (recently turned off by autotools upgrade).
+
+Version 1.5.15beta04 [February 15, 2013]
+  Enclosed the new png_get_palette_max in #ifdef PNG_GET_PALETTE_MAX_SUPPORTED
+    block, and revised pnglibconf.h and pnglibconf.h.prebuilt accordingly.
+
+Version 1.5.15beta05 [February 17, 2013]
+  Use approved/supported Android method to check for NEON, use Linux/POSIX
+    1003.1 API to check /proc/self/auxv avoiding buffer allocation and other
+    library calls.
+  Fixed a race condition in the creation of the build 'scripts' directory
+    while building with a parallel make.
+  Use parentheses more consistently in "#if defined(MACRO)" tests.
+
+Version 1.5.15beta06 [February 22, 2013]
+  Fixed PNG_ALIGN(ED)_MEMORY and add ability to turn off ARM_NEON
+    runtime checks
+  Updated the INSTALL document.
+
+Version 1.5.15beta07 [February 27, 2013]
+  Revised INSTALL to recommend using CPPFLAGS instead of INCLUDES.
+  Revised scripts/makefile.freebsd to respect ZLIBLIB and ZLIBINC.
+  Revised scripts/dfn.awk to work with the buggy MSYS awk that has trouble
+    with CRLF line endings.
+
+Version 1.5.15beta08 [March 5, 2013]
+  Avoid a possible memory leak in contrib/gregbook/readpng.c
+  Made the _SUPPORTED macro definitions consistent. The change made in
+    libpng15 to #define *_SUPPORTED 1, to match the use of -D*_SUPPORTED
+    (which means -D*_SUPPORTED=1) and avoid compiler warnings from GCC was made
+    inconsistently and causes problems as a result, also some additions in
+    pnglibconf.h.prebuilt were inconsistent (omitting the 1). This changes 1.5
+    back to the scheme used both before (1.4) and after (1.6). This might cause
+    some build scripts to issue warnings, and might, in the extreme, cause some
+    applications to fail (but they would fail anyway against 1.6).  It seems
+    safer to go for consistency, given the change in 1.6, not correctness here,
+    particularly as 'make check' currently warns anyway on the symbols.dfn check
+    because of the inconsistencies.
+  Corrected Android builds and corrected libpng.vers with symbol
+    prefixing This adds an API to set optimization options externally,
+    providing an alternative and general solution for the non-portable
+    run-time tests used by the ARM Neon code.  It also makes those tests
+    compile and link on Android.
+  The order of settings vs options in pnglibconf.h is reversed to allow
+    settings to depend on options and options can now set (or override) the
+    defaults for settings.
+
+Version 1.5.15beta09 [March 13, 2013]
+  Fixed CMakelists.txt to allow building a single variant of the library
+    (Claudio Bley):
+  Introduced a PNG_LIB_TARGETS variable that lists all activated library
+    targets.  It is an error if this variable ends up empty, ie. you have
+    to build at least one library variant.
+  Made the *_COPY targets only depend on library targets actually being build.
+  Use PNG_LIB_TARGETS to unify a code path.
+  Changed the CREATE_SYMLINK macro to expect the full path to a file as the
+    first argument. When symlinking the filename component of that path is
+    determined and used as the link target.
+  Use copy_if_different in the CREATE_SYMLINK macro.
+  Eliminated two warnings from the Intel C compiler. The warnings are
+    technically valid, although a reasonable treatment of division would
+    show it to be incorrect.
+
+Version 1.5.15rc01 [March 21, 2013]
+  No changes.
+
+Version 1.5.15 [March 28, 2013]
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
 to subscribe)
 or to glennrp at users.sourceforge.net
 
 Glenn R-P
--- a/media/libpng/LICENSE
+++ b/media/libpng/LICENSE
@@ -5,17 +5,17 @@ included in the libpng distribution, the
 
 COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
 
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.14, January 24, 2013, are
+libpng versions 1.2.6, August 15, 2004, through 1.5.15, March 28, 2013, are
 Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
 
    Cosmin Truta
 
 libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
 Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
@@ -103,9 +103,9 @@ boxes and the like:
 Also, the PNG logo (in PNG format, of course) is supplied in the
 files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
 
 Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is a
 certification mark of the Open Source Initiative.
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-January 24, 2013
+March 28, 2013
--- a/media/libpng/MOZCHANGES
+++ b/media/libpng/MOZCHANGES
@@ -1,11 +1,13 @@
 
 Changes made to pristine png source by mozilla.org developers.
 
+2013/04/11  -- Synced with libpng-1.5.15 (bug #858578).
+
 2013/01/24  -- Synced with libpng-1.5.14 (bug #832487).
 
 2013/01/23  -- Disabled TEXT support in mozpngconf.h (bug #833594).
 
 2012/10/02  -- Synced with libpng-1.5.13 (bug #775662).
 
 2012/07/16  -- Add an "APNG-aware app" flag (bug #759067).
 
--- a/media/libpng/README
+++ b/media/libpng/README
@@ -1,9 +1,9 @@
-README for libpng version 1.5.14 - January 24, 2013 (shared library 15.0)
+README for libpng version 1.5.15 - March 28, 2013 (shared library 15.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
 
 Libpng comes in several distribution formats.  Get libpng-*.tar.gz,
 libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
 in the text files, or lpng*.zip if you want DOS-style line endings.
 
--- a/media/libpng/apng.patch
+++ b/media/libpng/apng.patch
@@ -1,19 +1,19 @@
-diff -up8 pngget.c pngget.c
---- pngget.c	2013-01-23 20:59:04.248740505 -0600
-+++ pngget.c	2013-01-23 23:45:07.921684477 -0600
-@@ -1122,9 +1122,171 @@ png_get_io_chunk_type (png_const_structp
- png_const_bytep PNGAPI
- png_get_io_chunk_name (png_structp png_ptr)
- {
-    PNG_CSTRING_FROM_CHUNK(png_ptr->io_chunk_string, png_ptr->chunk_name);
-    return png_ptr->io_chunk_string;
+diff --git Libpng15/pngget.c Libpng15-apng/pngget.c
+--- Libpng15/pngget.c	2013-03-27 20:21:25.997445906 -0500
++++ Libpng15-apng/pngget.c	2013-04-05 09:03:41.474710443 -0500
+@@ -1135,9 +1135,171 @@ png_get_palette_max(png_const_structp pn
+    if (png_ptr != NULL && info_ptr != NULL)
+       return png_ptr->num_palette_max;
+ 
+    return (-1);
  }
- #endif /* ?PNG_IO_STATE_SUPPORTED */
+ #  endif
+ #endif
  
 +#ifdef PNG_APNG_SUPPORTED
 +png_uint_32 PNGAPI
 +png_get_acTL(png_structp png_ptr, png_infop info_ptr,
 +             png_uint_32 *num_frames, png_uint_32 *num_plays)
 +{
 +    png_debug1(1, "in %s retrieval function", "acTL");
 +
@@ -168,27 +168,27 @@ diff -up8 pngget.c pngget.c
 +       return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
 +
 +    PNG_UNUSED(info_ptr)
 +
 +    return 0;
 +}
 +#endif /* PNG_APNG_SUPPORTED */
  #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
-diff -up8 png.h png.h
---- png.h	2013-01-23 20:59:04.140980775 -0600
-+++ png.h	2013-01-23 23:46:23.693288001 -0600
-@@ -430,24 +430,18 @@
+diff --git Libpng15/png.h Libpng15-apng/png.h
+--- Libpng15/png.h	2013-03-27 20:21:25.890862785 -0500
++++ Libpng15-apng/png.h	2013-04-05 09:08:47.597309275 -0500
+@@ -433,24 +433,18 @@
  /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
   * We must not include leading zeros.
   * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
   * version 1.0.0 was mis-numbered 100 instead of 10000).  From
   * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
   */
- #define PNG_LIBPNG_VER 10514 /* 1.5.14 */
+ #define PNG_LIBPNG_VER 10515 /* 1.5.15 */
  
 -/* Library configuration: these options cannot be changed after
 - * the library has been built.
 - */
 -#ifndef PNGLCONF_H
 -    /* If pnglibconf.h is missing, you can
 -     * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
 -     */
@@ -198,45 +198,17 @@ diff -up8 png.h png.h
  #endif
  
  #ifndef PNG_VERSION_INFO_ONLY
  #  ifndef PNG_BUILDING_SYMBOL_TABLE
    /*
     *   Standard header files (not needed for the version info or while
     *   building symbol table -- see scripts/pnglibconf.dfa)
     */
-@@ -547,16 +541,27 @@ extern "C" {
-  * Otherwise the calls are mapped to png_error.
-  */
- 
- /* Section 2: type definitions, including structures and compile time
-  * constants.
-  * See pngconf.h for base types that vary by machine/system
-  */
- 
-+#ifdef PNG_APNG_SUPPORTED
-+/* dispose_op flags from inside fcTL */
-+#define PNG_DISPOSE_OP_NONE        0x00
-+#define PNG_DISPOSE_OP_BACKGROUND  0x01
-+#define PNG_DISPOSE_OP_PREVIOUS    0x02
-+
-+/* blend_op flags from inside fcTL */
-+#define PNG_BLEND_OP_SOURCE        0x00
-+#define PNG_BLEND_OP_OVER          0x01
-+#endif /* PNG_APNG_SUPPORTED */
-+
- /* This triggers a compiler error in png.c, if png.c and png.h
-  * do not agree upon the version number.
-  */
- typedef char* png_libpng_version_1_5_14;
- 
- /* Three color definitions.  The order of the red, green, and blue, (and the
-  * exact size) is not important, although the size of the fields need to
-  * be png_byte or png_uint_16 (as defined below).
-@@ -830,16 +835,20 @@ typedef png_info FAR * FAR * png_infopp;
+@@ -833,16 +827,20 @@ typedef png_info FAR * FAR * png_infopp;
  #define PNG_INFO_oFFs 0x0100
  #define PNG_INFO_tIME 0x0200
  #define PNG_INFO_pCAL 0x0400
  #define PNG_INFO_sRGB 0x0800   /* GR-P, 0.96a */
  #define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */
  #define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */
  #define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */
  #define PNG_INFO_IDAT 0x8000   /* ESR, 1.0.6 */
@@ -247,17 +219,17 @@ diff -up8 png.h png.h
  
  /* This is used for the transformation routines, as some of them
   * change these values for the row.  It also should enable using
   * the routines for other purposes.
   */
  typedef struct png_row_info_struct
  {
     png_uint_32 width;    /* width of row */
-@@ -875,16 +884,20 @@ typedef PNG_CALLBACK(void, *png_flush_pt
+@@ -878,16 +876,20 @@ typedef PNG_CALLBACK(void, *png_flush_pt
  typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
      int));
  typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32,
      int));
  
  #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
  typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
@@ -268,119 +240,138 @@ diff -up8 png.h png.h
  
  /* The following callback receives png_uint_32 row_number, int pass for the
   * png_bytep data of the row.  When transforming an interlaced image the
   * row number is the row number within the sub-image of the interlace pass, so
   * the value will increase to the height of the sub-image (not the full image)
   * then reset to 0 for the next pass.
   *
   * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to
-@@ -2651,26 +2664,99 @@ PNG_EXPORT(207, void, png_save_uint_16,
- #endif
- 
- #if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
-     defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
+@@ -2657,16 +2659,96 @@ PNG_EXPORT(207, void, png_save_uint_16,
  PNG_EXPORT(234, void, png_set_check_for_invalid_index, (png_structp png_ptr,
      int allowed));
- #endif
+ #  ifdef PNG_GET_PALETTE_MAX_SUPPORTED
+ PNG_EXPORT(235, int, png_get_palette_max, (png_const_structp png_ptr,
+     png_const_infop info_ptr));
+ #  endif
+ #endif /* CHECK_FOR_INVALID_INDEX */
  
 +#ifdef PNG_APNG_SUPPORTED
-+PNG_EXPORT(235, png_uint_32, png_get_acTL, (png_structp png_ptr,
++/* dispose_op flags from inside fcTL */
++#define PNG_DISPOSE_OP_NONE        0x00
++#define PNG_DISPOSE_OP_BACKGROUND  0x01
++#define PNG_DISPOSE_OP_PREVIOUS    0x02
++
++/* blend_op flags from inside fcTL */
++#define PNG_BLEND_OP_SOURCE        0x00
++#define PNG_BLEND_OP_OVER          0x01
++#endif /* PNG_APNG_SUPPORTED */
++
++#ifdef PNG_APNG_SUPPORTED
++PNG_EXPORT(237, png_uint_32, png_get_acTL, (png_structp png_ptr,
 +   png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
 +
-+PNG_EXPORT(236, png_uint_32, png_set_acTL, (png_structp png_ptr,
++PNG_EXPORT(238, png_uint_32, png_set_acTL, (png_structp png_ptr,
 +   png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
 +
-+PNG_EXPORT(237, png_uint_32, png_get_num_frames, (png_structp png_ptr,
++PNG_EXPORT(239, png_uint_32, png_get_num_frames, (png_structp png_ptr,
 +   png_infop info_ptr));
 +
-+PNG_EXPORT(238, png_uint_32, png_get_num_plays, (png_structp png_ptr,
++PNG_EXPORT(240, png_uint_32, png_get_num_plays, (png_structp png_ptr,
 +   png_infop info_ptr));
 +
-+PNG_EXPORT(239, png_uint_32, png_get_next_frame_fcTL,
++PNG_EXPORT(241, png_uint_32, png_get_next_frame_fcTL,
 +   (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
 +   png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
 +   png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
 +   png_byte *blend_op));
 +
-+PNG_EXPORT(240, png_uint_32, png_set_next_frame_fcTL,
++PNG_EXPORT(242, png_uint_32, png_set_next_frame_fcTL,
 +   (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
 +   png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
 +   png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
 +   png_byte blend_op));
 +
-+PNG_EXPORT(241, png_uint_32, png_get_next_frame_width,
++PNG_EXPORT(243, png_uint_32, png_get_next_frame_width,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(242, png_uint_32, png_get_next_frame_height,
++PNG_EXPORT(244, png_uint_32, png_get_next_frame_height,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(243, png_uint_32, png_get_next_frame_x_offset,
++PNG_EXPORT(245, png_uint_32, png_get_next_frame_x_offset,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(244, png_uint_32, png_get_next_frame_y_offset,
++PNG_EXPORT(246, png_uint_32, png_get_next_frame_y_offset,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(245, png_uint_16, png_get_next_frame_delay_num,
++PNG_EXPORT(247, png_uint_16, png_get_next_frame_delay_num,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(246, png_uint_16, png_get_next_frame_delay_den,
++PNG_EXPORT(248, png_uint_16, png_get_next_frame_delay_den,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(247, png_byte, png_get_next_frame_dispose_op,
++PNG_EXPORT(249, png_byte, png_get_next_frame_dispose_op,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(248, png_byte, png_get_next_frame_blend_op,
++PNG_EXPORT(250, png_byte, png_get_next_frame_blend_op,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(249, png_byte, png_get_first_frame_is_hidden,
++PNG_EXPORT(251, png_byte, png_get_first_frame_is_hidden,
 +   (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(250, png_uint_32, png_set_first_frame_is_hidden,
++PNG_EXPORT(252, png_uint_32, png_set_first_frame_is_hidden,
 +   (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
 +
 +#ifdef PNG_READ_APNG_SUPPORTED
-+PNG_EXPORT(251, void, png_read_frame_head, (png_structp png_ptr,
++PNG_EXPORT(253, void, png_read_frame_head, (png_structp png_ptr,
 +   png_infop info_ptr));
 +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-+PNG_EXPORT(252, void, png_set_progressive_frame_fn, (png_structp png_ptr,
++PNG_EXPORT(254, void, png_set_progressive_frame_fn, (png_structp png_ptr,
 +   png_progressive_frame_ptr frame_info_fn,
 +   png_progressive_frame_ptr frame_end_fn));
 +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 +#endif /* PNG_READ_APNG_SUPPORTED */
 +
 +#ifdef PNG_WRITE_APNG_SUPPORTED
-+PNG_EXPORT(253, void, png_write_frame_head, (png_structp png_ptr,
++PNG_EXPORT(255, void, png_write_frame_head, (png_structp png_ptr,
 +   png_infop info_ptr, png_bytepp row_pointers,
 +   png_uint_32 width, png_uint_32 height,
 +   png_uint_32 x_offset, png_uint_32 y_offset,
 +   png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
 +   png_byte blend_op));
 +
-+PNG_EXPORT(254, void, png_write_frame_tail, (png_structp png_ptr,
++PNG_EXPORT(256, void, png_write_frame_tail, (png_structp png_ptr,
 +   png_infop info_ptr));
 +#endif /* PNG_WRITE_APNG_SUPPORTED */
 +#endif /* PNG_APNG_SUPPORTED */
 +
- /* Maintainer: Put new public prototypes here ^, in libpng.3, and project
+ /*******************************************************************************
+  *  IMPLEMENTATION OPTIONS
+  *******************************************************************************
+  *
+  * Support for arbitrary implementation-specific optimizations.  The API allows
+  * particular options to be turned on or off.  'Option' is the number of the
+  * option and 'onoff' is 0 (off) or non-0 (on).  The value returned is given
+  * by the PNG_OPTION_ defines below.
+@@ -2707,17 +2789,21 @@ PNG_EXPORT(236, int, png_set_option, (pn
   * defs
   */
  
  /* The last ordinal number (this is the *last* one already used; the next
   * one to use is one more than this.)  Maintainer, remember to add an entry to
   * scripts/symbols.def as well.
   */
  #ifdef PNG_EXPORT_LAST_ORDINAL
-+#ifdef PNG_APNG_SUPPORTED
-+  PNG_EXPORT_LAST_ORDINAL(254);
-+#else
-   PNG_EXPORT_LAST_ORDINAL(234);
-+#endif /* PNG_APNG_SUPPORTED */
++#  ifdef PNG_APNG_SUPPORTED
++  PNG_EXPORT_LAST_ORDINAL(256);
++#  else
+   PNG_EXPORT_LAST_ORDINAL(236);
++#  endif /* PNG_APNG_SUPPORTED */
  #endif
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* PNG_VERSION_INFO_ONLY */
  /* Do not put anything past this line */
-diff -up8 pnginfo.h pnginfo.h
---- pnginfo.h	2013-01-23 20:59:04.182337078 -0600
-+++ pnginfo.h	2013-01-23 23:45:07.928511742 -0600
+diff --git Libpng15/pnginfo.h Libpng15-apng/pnginfo.h
+--- Libpng15/pnginfo.h	2013-03-27 20:21:25.931778532 -0500
++++ Libpng15-apng/pnginfo.h	2013-04-05 08:35:44.489862426 -0500
 @@ -260,10 +260,23 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
  
  #ifdef PNG_INFO_IMAGE_SUPPORTED
     /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
        non-zero */
     /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
     png_bytepp row_pointers;        /* the image bits */
  #endif
@@ -395,19 +386,19 @@ diff -up8 pnginfo.h pnginfo.h
 +   png_uint_16 next_frame_delay_num;
 +   png_uint_16 next_frame_delay_den;
 +   png_byte next_frame_dispose_op;
 +   png_byte next_frame_blend_op;
 +#endif
 +
  };
  #endif /* PNGINFO_H */
-diff -up8 pngpread.c pngpread.c
---- pngpread.c	2013-01-23 20:59:04.270422980 -0600
-+++ pngpread.c	2013-01-23 23:45:07.934228351 -0600
+diff --git Libpng15/pngpread.c Libpng15-apng/pngpread.c
+--- Libpng15/pngpread.c	2013-03-27 20:21:26.018949507 -0500
++++ Libpng15-apng/pngpread.c	2013-04-05 08:35:44.500787013 -0500
 @@ -210,16 +210,119 @@ png_push_read_chunk(png_structp png_ptr,
        png_crc_read(png_ptr, chunk_tag, 4);
        png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
        png_check_chunk_name(png_ptr, png_ptr->chunk_name);
        png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
     }
  
     chunk_name = png_ptr->chunk_name;
@@ -725,20 +716,20 @@ diff -up8 pngpread.c pngpread.c
  png_voidp PNGAPI
  png_get_progressive_ptr(png_const_structp png_ptr)
  {
     if (png_ptr == NULL)
        return (NULL);
  
     return png_ptr->io_ptr;
  }
-diff -up8 pngpriv.h pngpriv.h
---- pngpriv.h	2013-01-23 20:59:04.166577343 -0600
-+++ pngpriv.h	2013-01-23 23:45:07.940481520 -0600
-@@ -462,16 +462,20 @@ typedef PNG_CONST png_uint_16p FAR * png
+diff --git Libpng15/pngpriv.h Libpng15-apng/pngpriv.h
+--- Libpng15/pngpriv.h	2013-03-27 20:21:25.916383806 -0500
++++ Libpng15-apng/pngpriv.h	2013-04-05 08:35:44.512724367 -0500
+@@ -456,16 +456,20 @@
  #define PNG_HAVE_sRGB               0x80
  #define PNG_HAVE_CHUNK_HEADER      0x100
  #define PNG_WROTE_tIME             0x200
  #define PNG_WROTE_INFO_BEFORE_PLTE 0x400
  #define PNG_BACKGROUND_IS_GRAY     0x800
  #define PNG_HAVE_PNG_SIGNATURE    0x1000
  #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
  #define PNG_HAVE_iCCP             0x4000
@@ -749,17 +740,17 @@ diff -up8 pngpriv.h pngpriv.h
  
  /* Flags for the transformations the PNG library does on the image data */
  #define PNG_BGR                 0x0001
  #define PNG_INTERLACE           0x0002
  #define PNG_PACK                0x0004
  #define PNG_SHIFT               0x0008
  #define PNG_SWAP_BYTES          0x0010
  #define PNG_INVERT_MONO         0x0020
-@@ -657,16 +661,26 @@ PNG_EXTERN png_fixed_point png_fixed PNG
+@@ -653,16 +657,26 @@ PNG_EXTERN png_fixed_point png_fixed PNG
  #define png_sPLT PNG_CHUNK(115,  80,  76,  84)
  #define png_sRGB PNG_CHUNK(115,  82,  71,  66)
  #define png_sTER PNG_CHUNK(115,  84,  69,  82)
  #define png_tEXt PNG_CHUNK(116,  69,  88, 116)
  #define png_tIME PNG_CHUNK(116,  73,  77,  69)
  #define png_tRNS PNG_CHUNK(116,  82,  78,  83)
  #define png_zTXt PNG_CHUNK(122,  84,  88, 116)
  
@@ -776,17 +767,17 @@ diff -up8 pngpriv.h pngpriv.h
  /* The following will work on (signed char*) strings, whereas the get_uint_32
   * macro will fail on top-bit-set values because of the sign extension.
   */
  #define PNG_CHUNK_FROM_STRING(s)\
     PNG_CHUNK(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
  
  /* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
   * signed and the argument is a (char[])  This macro will fail miserably on
-@@ -1336,16 +1350,55 @@ PNG_EXTERN void png_push_read_iTXt PNGAR
+@@ -1344,16 +1358,55 @@ PNG_EXTERN void png_push_read_iTXt PNGAR
  
  #ifdef PNG_MNG_FEATURES_SUPPORTED
  PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
      png_bytep row));
  PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
      png_bytep row));
  #endif
  
@@ -832,19 +823,19 @@ diff -up8 pngpriv.h pngpriv.h
  /* Added at libpng version 1.4.0 */
  #ifdef PNG_CHECK_cHRM_SUPPORTED
  PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
      png_fixed_point int_white_x, png_fixed_point int_white_y,
      png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
      int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
      png_fixed_point int_blue_y));
  #endif
-diff -up8 pngread.c pngread.c
---- pngread.c	2013-01-23 20:59:04.282855271 -0600
-+++ pngread.c	2013-01-23 23:45:07.948798424 -0600
+diff --git Libpng15/pngread.c Libpng15-apng/pngread.c
+--- Libpng15/pngread.c	2013-03-27 20:21:26.031382541 -0500
++++ Libpng15-apng/pngread.c	2013-04-05 08:35:44.521542241 -0500
 @@ -235,16 +235,19 @@ png_read_info(png_structp png_ptr, png_i
        {
           if (!(png_ptr->mode & PNG_HAVE_IHDR))
              png_error(png_ptr, "Missing IHDR before IDAT");
  
           else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
               !(png_ptr->mode & PNG_HAVE_PLTE))
              png_error(png_ptr, "Missing PLTE before IDAT");
@@ -1034,19 +1025,19 @@ diff -up8 pngread.c pngread.c
           break;
        }
  
        if (ret != Z_OK)
           png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
               "Decompression error");
  
     } while (png_ptr->zstream.avail_out);
-diff -up8 pngrutil.c pngrutil.c
---- pngrutil.c	2013-01-23 20:59:04.350499933 -0600
-+++ pngrutil.c	2013-01-23 23:45:07.955605241 -0600
+diff --git Libpng15/pngrutil.c Libpng15-apng/pngrutil.c
+--- Libpng15/pngrutil.c	2013-03-27 20:21:26.096904976 -0500
++++ Libpng15-apng/pngrutil.c	2013-04-05 08:35:44.532243804 -0500
 @@ -542,16 +542,21 @@ png_handle_IHDR(png_structp png_ptr, png
     width = png_get_uint_31(png_ptr, buf);
     height = png_get_uint_31(png_ptr, buf + 4);
     bit_depth = buf[8];
     color_type = buf[9];
     compression_type = buf[10];
     filter_type = buf[11];
     interlace_type = buf[12];
@@ -1336,19 +1327,19 @@ diff -up8 pngrutil.c pngrutil.c
 +    png_ptr->zstream.next_in = 0;
 +    png_ptr->zstream.next_out = png_ptr->row_buf;
 +    png_ptr->zstream.avail_out = (uInt)PNG_ROWBYTES(png_ptr->pixel_depth,
 +        png_ptr->iwidth) + 1;
 +}
 +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 +#endif /* PNG_READ_APNG_SUPPORTED */
  #endif /* PNG_READ_SUPPORTED */
-diff -up8 pngset.c pngset.c
---- pngset.c	2013-01-23 20:59:04.363117910 -0600
-+++ pngset.c	2013-01-23 23:45:07.963968924 -0600
+diff --git Libpng15/pngset.c Libpng15-apng/pngset.c
+--- Libpng15/pngset.c	2013-03-27 20:21:26.109362380 -0500
++++ Libpng15-apng/pngset.c	2013-04-05 08:35:44.543863869 -0500
 @@ -257,16 +257,21 @@ png_set_IHDR(png_structp png_ptr, png_in
         (PNG_UINT_32_MAX >> 3)      /* 8-byte RRGGBBAA pixels */
         - 48       /* bigrowbuf hack */
         - 1        /* filter byte */
         - 7*8      /* rounding of width to multiple of 8 pixels */
         - 8)       /* extra max_pixel_depth pad */
        info_ptr->rowbytes = 0;
     else
@@ -1519,19 +1510,19 @@ diff -up8 pngset.c pngset.c
  #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
  void PNGAPI
  png_set_unknown_chunks(png_structp png_ptr,
     png_infop info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
  {
     png_unknown_chunkp np;
     int i;
  
-diff -up8 pngstruct.h pngstruct.h
---- pngstruct.h	2013-01-23 20:59:04.174748840 -0600
-+++ pngstruct.h	2013-01-23 23:45:07.971386461 -0600
+diff --git Libpng15/pngstruct.h Libpng15-apng/pngstruct.h
+--- Libpng15/pngstruct.h	2013-03-27 20:21:25.924524405 -0500
++++ Libpng15-apng/pngstruct.h	2013-04-05 08:35:44.553970531 -0500
 @@ -288,16 +288,37 @@ struct png_struct_def
     png_uint_32 mng_features_permitted;
  #endif
  
  /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
  #ifdef PNG_MNG_FEATURES_SUPPORTED
     png_byte filter_type;
  #endif
@@ -1560,19 +1551,19 @@ diff -up8 pngstruct.h pngstruct.h
  /* New members added in libpng-1.2.0 */
  
  /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
  #ifdef PNG_USER_MEM_SUPPORTED
     png_voidp mem_ptr;             /* user supplied struct for mem functions */
     png_malloc_ptr malloc_fn;      /* function for allocating memory */
     png_free_ptr free_fn;          /* function for freeing memory */
  #endif
-diff -up8 pngwrite.c pngwrite.c
---- pngwrite.c	2013-01-23 20:59:04.424809701 -0600
-+++ pngwrite.c	2013-01-23 23:45:07.977302033 -0600
+diff --git Libpng15/pngwrite.c Libpng15-apng/pngwrite.c
+--- Libpng15/pngwrite.c	2013-03-27 20:21:26.156957173 -0500
++++ Libpng15-apng/pngwrite.c	2013-04-05 08:35:44.564786237 -0500
 @@ -53,16 +53,20 @@ png_write_info_before_PLTE(png_structp p
  #ifdef PNG_WRITE_INTERLACING_SUPPORTED
         info_ptr->interlace_type);
  #else
         0);
  #endif
     /* The rest of these check to see if the valid field has the appropriate
      * flag set, and if it does, writes the chunk.
@@ -1607,17 +1598,17 @@ diff -up8 pngwrite.c pngwrite.c
     /* See if user wants us to write information chunks */
     if (info_ptr != NULL)
     {
  #ifdef PNG_WRITE_TEXT_SUPPORTED
        int i; /* local index variable */
  #endif
  #ifdef PNG_WRITE_tIME_SUPPORTED
        /* Check to see if user has supplied a time chunk */
-@@ -1660,9 +1670,47 @@ png_write_png(png_structp png_ptr, png_i
+@@ -1662,9 +1672,47 @@ png_write_png(png_structp png_ptr, png_i
  
     /* It is REQUIRED to call this to finish writing the rest of the file */
     png_write_end(png_ptr, info_ptr);
  
     PNG_UNUSED(transforms)   /* Quiet compiler warnings */
     PNG_UNUSED(params)
  }
  #endif
@@ -1655,19 +1646,19 @@ diff -up8 pngwrite.c pngwrite.c
 +    png_debug(1, "in png_write_frame_tail");
 +
 +    png_ptr->num_frames_written++;
 +
 +    PNG_UNUSED(info_ptr)
 +}
 +#endif /* PNG_WRITE_APNG_SUPPORTED */
  #endif /* PNG_WRITE_SUPPORTED */
-diff -up8 pngwutil.c pngwutil.c
---- pngwutil.c	2013-01-23 20:59:04.456429005 -0600
-+++ pngwutil.c	2013-01-23 23:45:07.984682857 -0600
+diff --git Libpng15/pngwutil.c Libpng15-apng/pngwutil.c
+--- Libpng15/pngwutil.c	2013-03-27 20:21:26.188217743 -0500
++++ Libpng15-apng/pngwutil.c	2013-04-05 08:35:44.574964508 -0500
 @@ -813,16 +813,21 @@ png_write_IHDR(png_structp png_ptr, png_
     buf[9] = (png_byte)color_type;
     buf[10] = (png_byte)compression_type;
     buf[11] = (png_byte)filter_type;
     buf[12] = (png_byte)interlace_type;
  
     /* Write the chunk */
     png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
--- a/media/libpng/arm/arm_init.c
+++ b/media/libpng/arm/arm_init.c
@@ -1,59 +1,195 @@
 
 /* arm_init.c - NEON optimised filter functions
  *
  * Copyright (c) 2013 Glenn Randers-Pehrson
  * Written by Mans Rullgard, 2011.
- * Last changed in libpng 1.5.14 [January 24, 2013]
+ * Last changed in libpng 1.5.15 [March 28, 2013]
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
+/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
+ * called.
+ */
+#define _POSIX_SOURCE 1
+
 #include "../pngpriv.h"
 
-/* __arm__ is defined by GCC, MSVC defines _M_ARM to the ARM version number */
-#if defined __linux__ && defined __arm__
-#include <stdio.h>
+#ifdef PNG_ARM_NEON_SUPPORTED
+#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
+#include <signal.h> /* for sig_atomic_t */
+
+#ifdef __ANDROID__
+/* Linux provides access to information about CPU capabilites via
+ * /proc/self/auxv, however Android blocks this while still claiming to be
+ * Linux.  The Andoid NDK, however, provides appropriate support.
+ *
+ * Documentation: http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
+ */
+#include <cpu-features.h>
+
+static int
+png_have_neon(png_structp png_ptr)
+{
+   /* This is a whole lot easier than the mess below, however it is probably
+    * implemented as below, therefore it is better to cache the result (these
+    * function calls may be slow!)
+    */
+   PNG_UNUSED(png_ptr)
+   return android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM &&
+      (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
+}
+#elif defined(__linux__)
+/* The generic __linux__ implementation requires reading /proc/self/auxv and
+ * looking at each element for one that records NEON capabilities.
+ */
+#include <unistd.h> /* for POSIX 1003.1 */
+#include <errno.h>  /* for EINTR */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <elf.h>
 #include <asm/hwcap.h>
 
-static int png_have_hwcap(unsigned cap)
+/* A read call may be interrupted, in which case it returns -1 and sets errno to
+ * EINTR if nothing was done, otherwise (if something was done) a partial read
+ * may result.
+ */
+static size_t
+safe_read(png_structp png_ptr, int fd, void *buffer_in, size_t nbytes)
 {
-   FILE *f = fopen("/proc/self/auxv", "r");
+   size_t ntotal = 0;
+   char *buffer = png_voidcast(char*, buffer_in);
+
+   while (nbytes > 0)
+   {
+      unsigned int nread;
+      int iread;
+
+      /* Passing nread > INT_MAX to read is implementation defined in POSIX
+       * 1003.1, therefore despite the unsigned argument portable code must
+       * limit the value to INT_MAX!
+       */
+      if (nbytes > INT_MAX)
+         nread = INT_MAX;
+
+      else
+         nread = (unsigned int)/*SAFE*/nbytes;
+
+      iread = read(fd, buffer, nread);
+
+      if (iread == -1)
+      {
+         /* This is the devil in the details, a read can terminate early with 0
+          * bytes read because of EINTR, yet it still returns -1 otherwise end
+          * of file cannot be distinguished.
+          */
+         if (errno != EINTR)
+         {
+            png_warning(png_ptr, "/proc read failed");
+            return 0; /* I.e. a permanent failure */
+         }
+      }
+
+      else if (iread < 0)
+      {
+         /* Not a valid 'read' result: */
+         png_warning(png_ptr, "OS /proc read bug");
+         return 0;
+      }
+
+      else if (iread > 0)
+      {
+         /* Continue reading until a permanent failure, or EOF */
+         buffer += iread;
+         nbytes -= (unsigned int)/*SAFE*/iread;
+         ntotal += (unsigned int)/*SAFE*/iread;
+      }
+
+      else
+         return ntotal;
+   }
+
+   return ntotal; /* nbytes == 0 */
+}
+
+static int
+png_have_neon(png_structp png_ptr)
+{
+   int fd = open("/proc/self/auxv", O_RDONLY);
    Elf32_auxv_t aux;
-   int have_cap = 0;
 
-   if (!f)
+   /* Failsafe: failure to open means no NEON */
+   if (fd == -1)
+   {
+      png_warning(png_ptr, "/proc/self/auxv open failed");
       return 0;
+   }
 
-   while (fread(&aux, sizeof(aux), 1, f) > 0)
+   while (safe_read(png_ptr, fd, &aux, sizeof aux) == sizeof aux)
    {
-      if (aux.a_type == AT_HWCAP &&
-          aux.a_un.a_val & cap)
+      if (aux.a_type == AT_HWCAP && (aux.a_un.a_val & HWCAP_NEON) != 0)
       {
-         have_cap = 1;
-         break;
+         close(fd);
+         return 1;
       }
    }
 
-   fclose(f);
+   close(fd);
+   return 0;
+}
+#else
+   /* We don't know how to do a run-time check on this system */
+#  error "no support for run-time ARM NEON checks"
+#endif /* OS checks */
+#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
 
-   return have_cap;
-}
-#endif /* __linux__ && __arm__ */
+#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
+#  error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
+#endif
 
 void
 png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
 {
-#ifdef __arm__
-#ifdef __linux__
-   if (!png_have_hwcap(HWCAP_NEON))
-      return;
+#ifdef PNG_ARM_NEON_API_SUPPORTED
+   switch ((pp->options >> PNG_ARM_NEON) & 3)
+   {
+      case PNG_OPTION_UNSET:
+         /* Allow the run-time check to execute if it has been enabled -
+          * thus both API and CHECK can be turned on.  If it isn't supported
+          * this case will fall through to the 'default' below, which just
+          * returns.
+          */
+#endif /* PNG_ARM_NEON_API_SUPPORTED */
+#ifdef PNG_ARM_NEON_CHECK_SUPPORTED
+         {
+            static volatile sig_atomic_t no_neon = -1; /* not checked */
+
+            if (no_neon < 0)
+               no_neon = !png_have_neon(pp);
+
+            if (no_neon)
+               return;
+         }
+#ifdef PNG_ARM_NEON_API_SUPPORTED
+         break;
+#endif
+#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
+#ifdef PNG_ARM_NEON_API_SUPPORTED
+      case PNG_OPTION_ON:
+         /* Option turned on */
+         break;
+
+      default: /* OFF or INVALID */
+         return;
+   }
 #endif
 
    /* IMPORTANT: any new external functions used here must be declared using
     * PNG_INTERNAL_FUNCTION in ../pngpriv.h.  This is required so that the
     * 'prefix' option to configure works:
     *
     *    ./configure --with-libpng-prefix=foobar_
     *
@@ -74,13 +210,10 @@ png_init_filter_functions_neon(png_struc
 
    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;
    }
-#else
-   PNG_UNUSED(pp)
-   PNG_UNUSED(bpp)
-#endif
 }
+#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
--- a/media/libpng/arm/filter_neon.S
+++ b/media/libpng/arm/filter_neon.S
@@ -5,17 +5,24 @@
  * Written by Mans Rullgard, 2011.
  * Last changed in libpng 1.5.7 [December 15, 2011]
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
 
-#ifdef __arm__
+/* This is required to get the symbol renames, which are #defines, and also
+ * includes the value of PNG_FILTER_OPTIMIZATIONS.
+ */
+#define PNG_VERSION_INFO_ONLY
+#include "../pngpriv.h"
+
+#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
+   defined(__ARM_NEON__)
 #if defined(__linux__) && defined(__ELF__)
 .section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
 #endif
 
 #ifdef __ELF__
 #   define ELF
 #else
 #   define ELF @
@@ -220,9 +227,9 @@ 1:
         vmov            d4,  d19
         vadd.u8         d3,  d3,  d7
         vst1.32         {d3[0]},  [r1], r4
         subs            r12, r12, #12
         bgt             1b
 
         pop             {r4,pc}
 endfunc
-#endif
+#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
--- a/media/libpng/libpng-manual.txt
+++ b/media/libpng/libpng-manual.txt
@@ -1,24 +1,24 @@
 Libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.5.14 - January 24, 2013
+ libpng version 1.5.15 - March 28, 2013
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
- Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ Copyright (c) 1998-2013 Glenn Randers-Pehrson
 
  This document is released under the libpng license.
  For conditions of distribution and use, see the disclaimer
  and license in png.h
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.5.14 - January 24, 2013
+ libpng versions 0.97, January 1998, through 1.5.15 - March 28, 2013
  Updated and distributed by Glenn Randers-Pehrson
- Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ Copyright (c) 1998-2013 Glenn Randers-Pehrson
 
  libpng 1.0 beta 6  version 0.96 May 28, 1997
  Updated and distributed by Andreas Dilger
  Copyright (c) 1996, 1997 Andreas Dilger
 
  libpng 1.0 beta 2 - version 0.88  January 26, 1996
  For conditions of distribution and use, see copyright
  notice in png.h. Copyright (c) 1995, 1996 Guy Eric
@@ -43,17 +43,17 @@ For examples of libpng usage, see the fi
 and the files in the "contrib" directory, all of which are included in
 the libpng distribution.
 
 Libpng was written as a companion to the PNG specification, as a way
 of reducing the amount of time and effort it takes to support the PNG
 file format in application programs.
 
 The PNG specification (second edition), November 2003, is available as
-a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
+a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at
 <http://www.w3.org/TR/2003/REC-PNG-20031110/
 The W3C and ISO documents have identical technical content.
 
 The PNG-1.2 specification is available at
 <http://www.libpng.org/pub/png/documents/>.  It is technically equivalent
 to the PNG specification (second edition) but has some additional material.
 
 The PNG-1.0 specification is available
@@ -504,18 +504,17 @@ To inform libpng about your function, us
 
 This names not only the callback function, but also a user pointer that
 you can retrieve with
 
     png_get_user_chunk_ptr(png_ptr);
 
 If you call the png_set_read_user_chunk_fn() function, then all unknown
 chunks will be saved when read, in case your callback function will need
-one or more of them.  This behavior can be changed with the
-png_set_keep_unknown_chunks() function, described below.
+one or more of them.
 
 At this point, you can set up a callback function that will be
 called after each row has been read, which you can use to control
 a progress meter or the like.  It's demonstrated in pngtest.c.
 You must supply a function
 
     void read_row_callback(png_structp png_ptr,
        png_uint_32 row, int pass);
@@ -599,24 +598,28 @@ callback function:
         116,  73,  77,  69, (png_byte) '\0',   /* tIME */
       };
     #endif
 
     ...
 
     #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
       /* ignore all unknown chunks: */
+    #  if PNG_LIBPNG_VER < 10700
+      png_set_keep_unknown_chunks(read_ptr, 2, NULL, 0);
+    #  else
       png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0);
+    #  endif
 
       /* except for vpAg: */
       png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1);
 
       /* also ignore unused known chunks: */
       png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks,
-         (int)sizeof(unused_chunks)/5);
+         (int)png_sizeof(unused_chunks)/5);
     #endif
 
 User limits
 
 The PNG specification allows the width and height of an image to be as
 large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
 Since very few applications really need to process such large images,
 we have imposed an arbitrary 1-million limit on rows and columns.
@@ -4156,16 +4159,28 @@ 1.5.10.  When an invalid index is found,
 This is enabled by default but can be disabled in each png_ptr with
 
    png_set_check_for_invalid_index(png_ptr, allowed);
 
       allowed  - one of
                  0: disable
                  1: enable
 
+Retrieving the maximum palette index found was added at libpng-1.5.15.
+This statement must appear after png_read_png() or png_read_image() while
+reading, and after png_write_png() or png_write_image() while writing.
+
+   int max_palette = png_get_palette_max(png_ptr, info_ptr);
+
+This will return the maximum palette index found in the image, or "-1" if
+the palette was not checked, or "0" if no palette was found.  Note that this
+does not account for any palette index used by ancillary chunks such as the
+bKGD chunk; you must check those separately to determine the maximum
+palette index actually used.
+
 A. Changes that affect users of libpng
 
 There are no substantial API changes between the non-deprecated parts of
 the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
 members of the main libpng control structures, png_struct and png_info,
 deprecated in earlier versions of libpng, has been completely removed from
 libpng 1.5.
 
@@ -4573,54 +4588,55 @@ We mark all non-exported functions with 
     body;
  }
 
 The prototypes for non-exported functions (except for those in
 pngtest) appear in
 pngpriv.h
 above the comment that says
 
-  /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
+  /* Maintainer: Put new private prototypes here ^ */
 
 To avoid polluting the global namespace, the names of all exported
 functions and variables begin with "png_", and all publicly visible C
 preprocessor macros begin with "PNG".  We request that applications that
 use libpng *not* begin any of their own symbols with either of these strings.
 
 We put a space after each comma and after each semicolon
 in "for" statements, and we put spaces before and after each
 C binary operator and after "for" or "while", and before
 "?".  We don't put a space between a typecast and the expression
 being cast, nor do we put one between a function name and the
 left parenthesis that follows it:
 
     for (i = 2; i > 0; --i)
        y[i] = a(x) + (int)b;
 
-We prefer #ifdef and #ifndef to #if defined() and if !defined()
-when there is only one macro being tested.
+We prefer #ifdef and #ifndef to #if defined() and #if !defined()
+when there is only one macro being tested.  We always use parentheses
+with "defined".
 
 We prefer to express integers that are used as bit masks in hex format,
 with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
 
 We do not use the TAB character for indentation in the C sources.
 
 Lines do not exceed 80 characters.
 
 Other rules can be inferred by inspecting the libpng source.
 
 XIV. Y2K Compliance in libpng
 
-January 24, 2013
+March 28, 2013
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.5.14 are Y2K compliant.  It is my belief that earlier
+upward through 1.5.15 are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has two year fields.  One is a 2-byte unsigned integer that
 will hold years up to 65535.  The other holds the date in text
 format, and will hold years up to 9999.
 
 The integer is
     "png_uint_16 year" in png_time_struct.
--- a/media/libpng/png.c
+++ b/media/libpng/png.c
@@ -9,17 +9,17 @@
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
 
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_5_14 Your_png_h_is_not_version_1_5_14;
+typedef png_libpng_version_1_5_15 Your_png_h_is_not_version_1_5_15;
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
  * stream we can set num_bytes = 8 so that libpng will not attempt to read
  * or write any of the magic bytes before it starts on the IHDR.
  */
 
 #ifdef PNG_READ_SUPPORTED
--- a/media/libpng/png.h
+++ b/media/libpng/png.h
@@ -1,22 +1,22 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.5.14 - January 24, 2013
+ * libpng version 1.5.15 - March 28, 2013
  * 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.)
  *
  * This code is released under the libpng license (See LICENSE, below)
  *
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.5.14 - January 24, 2013: Glenn
+ *   libpng versions 0.97, January 1998, through 1.5.15 - March 28, 2013: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
  *
  *   Due to various miscommunications, unforeseen code incompatibilities
  *   and occasional factors outside the authors' control, version numbering
  *   on the library has not always been consistent and straightforward.
  *   The following table summarizes matters since version 0.89c, which was
@@ -179,16 +179,19 @@
  *    1.5.11                  15    10511  15.so.15.11[.0]
  *    1.5.12                  15    10512  15.so.15.12[.0]
  *    1.5.13beta01-02         15    10513  15.so.15.13[.0]
  *    1.5.13rc01              15    10513  15.so.15.13[.0]
  *    1.5.13                  15    10513  15.so.15.13[.0]
  *    1.5.14beta01-08         15    10514  15.so.15.14[.0]
  *    1.5.14rc01-03           15    10514  15.so.15.14[.0]
  *    1.5.14                  15    10514  15.so.15.14[.0]
+ *    1.5.15beta01-10         15    10515  15.so.15.15[.0]
+ *    1.5.15rc01              15    10515  15.so.15.15[.0]
+ *    1.5.15                  15    10515  15.so.15.15[.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
  *   PNG_LIBPNG_VER macro, which is not used within libpng but is available
  *   for applications, is an unsigned integer of the form xyyzz corresponding
  *   to the source version x.y.z (leading zeros in y and z).  Beta versions
  *   were given the previous public release number plus a letter, until
@@ -210,17 +213,17 @@
 /*
  * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
  *
  * If you modify libpng you may insert additional notices immediately following
  * this sentence.
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.5.14, January 24, 2013, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.5.15, March 28, 2013, are
  * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.2.5
  * with the following individual added to the list of Contributing Authors:
  *
  *    Cosmin Truta
  *
  * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
  * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
@@ -322,23 +325,23 @@
  *
  * Thanks to Frank J. T. Wojcik for helping with the documentation.
  */
 
 /*
  * Y2K compliance in libpng:
  * =========================
  *
- *    January 24, 2013
+ *    March 28, 2013
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.5.14 are Y2K compliant.  It is my belief that
+ *    upward through 1.5.15 are Y2K compliant.  It is my belief that
  *    earlier versions were also Y2K compliant.
  *
  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
  *    that will hold years up to 65535.  The other holds the date in text
  *    format, and will hold years up to 9999.
  *
  *    The integer is
  *        "png_uint_16 year" in png_time_struct.
@@ -387,27 +390,27 @@
  * with some code on which to build.  This file is useful for looking
  * at the actual function definitions and structure components.
  *
  * If you just need to read a PNG file and don't want to read the documentation
  * skip to the end of this file and read the section entitled 'simplified API'.
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.5.14"
+#define PNG_LIBPNG_VER_STRING "1.5.15"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.5.14 - January 24, 2013\n"
+     " libpng version 1.5.15 - March 28, 2013\n"
 
 #define PNG_LIBPNG_VER_SONUM   15
 #define PNG_LIBPNG_VER_DLLNUM  15
 
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   5
-#define PNG_LIBPNG_VER_RELEASE 14
+#define PNG_LIBPNG_VER_RELEASE 15
 
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
  */
 
 #define PNG_LIBPNG_VER_BUILD  0
 
 /* Release Status */
@@ -428,17 +431,17 @@
 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  */
-#define PNG_LIBPNG_VER 10514 /* 1.5.14 */
+#define PNG_LIBPNG_VER 10515 /* 1.5.15 */
 
 #ifndef MOZPNGCONF_H
 #   include "mozpngconf.h"
 #endif
 
 #ifndef PNG_VERSION_INFO_ONLY
 #  ifndef PNG_BUILDING_SYMBOL_TABLE
   /*
@@ -455,17 +458,17 @@
 #    ifdef PNG_CONVERT_tIME_SUPPORTED
        /* "time.h" functions are not supported on all operating systems */
 #      include <time.h>
 #    endif
 #  endif
 
 /* Machine specific configuration. */
 #  include "pngconf.h"
-#endif
+#endif /* PNG_VERSION_INFO_ONLY */
 
 /*
  * Added at libpng-1.2.8
  *
  * Ref MSDN: Private as priority over Special
  * VS_FF_PRIVATEBUILD File *was not* built using standard release
  * procedures. If this value is given, the StringFileInfo block must
  * contain a PrivateBuild string.
@@ -541,31 +544,20 @@ extern "C" {
  * Otherwise the calls are mapped to png_error.
  */
 
 /* Section 2: type definitions, including structures and compile time
  * constants.
  * See pngconf.h for base types that vary by machine/system
  */
 
-#ifdef PNG_APNG_SUPPORTED
-/* dispose_op flags from inside fcTL */
-#define PNG_DISPOSE_OP_NONE        0x00
-#define PNG_DISPOSE_OP_BACKGROUND  0x01
-#define PNG_DISPOSE_OP_PREVIOUS    0x02
-
-/* blend_op flags from inside fcTL */
-#define PNG_BLEND_OP_SOURCE        0x00
-#define PNG_BLEND_OP_OVER          0x01
-#endif /* PNG_APNG_SUPPORTED */
-
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_5_14;
+typedef char* png_libpng_version_1_5_15;
 
 /* Three color definitions.  The order of the red, green, and blue, (and the
  * exact size) is not important, although the size of the fields need to
  * be png_byte or png_uint_16 (as defined below).
  */
 typedef struct png_color_struct
 {
    png_byte red;
@@ -2658,105 +2650,160 @@ PNG_EXPORT(207, void, png_save_uint_16, 
        ((unsigned int)(*((buf) + 1)))))
 
 #  define png_get_int_32(buf) \
      ((png_int_32)((*(buf) & 0x80) \
       ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
       : (png_int_32)png_get_uint_32(buf)))
 #endif
 
-#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
-    defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
+#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
 PNG_EXPORT(234, void, png_set_check_for_invalid_index, (png_structp png_ptr,
     int allowed));
-#endif
+#  ifdef PNG_GET_PALETTE_MAX_SUPPORTED
+PNG_EXPORT(235, int, png_get_palette_max, (png_const_structp png_ptr,
+    png_const_infop info_ptr));
+#  endif
+#endif /* CHECK_FOR_INVALID_INDEX */
 
 #ifdef PNG_APNG_SUPPORTED
-PNG_EXPORT(235, png_uint_32, png_get_acTL, (png_structp png_ptr,
+/* dispose_op flags from inside fcTL */
+#define PNG_DISPOSE_OP_NONE        0x00
+#define PNG_DISPOSE_OP_BACKGROUND  0x01
+#define PNG_DISPOSE_OP_PREVIOUS    0x02
+
+/* blend_op flags from inside fcTL */
+#define PNG_BLEND_OP_SOURCE        0x00
+#define PNG_BLEND_OP_OVER          0x01
+#endif /* PNG_APNG_SUPPORTED */
+
+#ifdef PNG_APNG_SUPPORTED
+PNG_EXPORT(237, png_uint_32, png_get_acTL, (png_structp png_ptr,
    png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
 
-PNG_EXPORT(236, png_uint_32, png_set_acTL, (png_structp png_ptr,
+PNG_EXPORT(238, png_uint_32, png_set_acTL, (png_structp png_ptr,
    png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
 
-PNG_EXPORT(237, png_uint_32, png_get_num_frames, (png_structp png_ptr,
+PNG_EXPORT(239, png_uint_32, png_get_num_frames, (png_structp png_ptr,
    png_infop info_ptr));
 
-PNG_EXPORT(238, png_uint_32, png_get_num_plays, (png_structp png_ptr,
+PNG_EXPORT(240, png_uint_32, png_get_num_plays, (png_structp png_ptr,
    png_infop info_ptr));
 
-PNG_EXPORT(239, png_uint_32, png_get_next_frame_fcTL,
+PNG_EXPORT(241, png_uint_32, png_get_next_frame_fcTL,
    (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
    png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
    png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
    png_byte *blend_op));
 
-PNG_EXPORT(240, png_uint_32, png_set_next_frame_fcTL,
+PNG_EXPORT(242, png_uint_32, png_set_next_frame_fcTL,
    (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
    png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
    png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
    png_byte blend_op));
 
-PNG_EXPORT(241, png_uint_32, png_get_next_frame_width,
+PNG_EXPORT(243, png_uint_32, png_get_next_frame_width,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(242, png_uint_32, png_get_next_frame_height,
+PNG_EXPORT(244, png_uint_32, png_get_next_frame_height,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(243, png_uint_32, png_get_next_frame_x_offset,
+PNG_EXPORT(245, png_uint_32, png_get_next_frame_x_offset,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(244, png_uint_32, png_get_next_frame_y_offset,
+PNG_EXPORT(246, png_uint_32, png_get_next_frame_y_offset,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(245, png_uint_16, png_get_next_frame_delay_num,
+PNG_EXPORT(247, png_uint_16, png_get_next_frame_delay_num,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(246, png_uint_16, png_get_next_frame_delay_den,
+PNG_EXPORT(248, png_uint_16, png_get_next_frame_delay_den,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(247, png_byte, png_get_next_frame_dispose_op,
+PNG_EXPORT(249, png_byte, png_get_next_frame_dispose_op,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(248, png_byte, png_get_next_frame_blend_op,
+PNG_EXPORT(250, png_byte, png_get_next_frame_blend_op,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(249, png_byte, png_get_first_frame_is_hidden,
+PNG_EXPORT(251, png_byte, png_get_first_frame_is_hidden,
    (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(250, png_uint_32, png_set_first_frame_is_hidden,
+PNG_EXPORT(252, png_uint_32, png_set_first_frame_is_hidden,
    (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
 
 #ifdef PNG_READ_APNG_SUPPORTED
-PNG_EXPORT(251, void, png_read_frame_head, (png_structp png_ptr,
+PNG_EXPORT(253, void, png_read_frame_head, (png_structp png_ptr,
    png_infop info_ptr));
 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_EXPORT(252, void, png_set_progressive_frame_fn, (png_structp png_ptr,
+PNG_EXPORT(254, void, png_set_progressive_frame_fn, (png_structp png_ptr,
    png_progressive_frame_ptr frame_info_fn,
    png_progressive_frame_ptr frame_end_fn));
 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 #endif /* PNG_READ_APNG_SUPPORTED */
 
 #ifdef PNG_WRITE_APNG_SUPPORTED
-PNG_EXPORT(253, void, png_write_frame_head, (png_structp png_ptr,
+PNG_EXPORT(255, void, png_write_frame_head, (png_structp png_ptr,
    png_infop info_ptr, png_bytepp row_pointers,
    png_uint_32 width, png_uint_32 height,
    png_uint_32 x_offset, png_uint_32 y_offset,
    png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
    png_byte blend_op));
 
-PNG_EXPORT(254, void, png_write_frame_tail, (png_structp png_ptr,
+PNG_EXPORT(256, void, png_write_frame_tail, (png_structp png_ptr,
    png_infop info_ptr));
 #endif /* PNG_WRITE_APNG_SUPPORTED */
 #endif /* PNG_APNG_SUPPORTED */
 
+/*******************************************************************************
+ *  IMPLEMENTATION OPTIONS
+ *******************************************************************************
+ *
+ * Support for arbitrary implementation-specific optimizations.  The API allows
+ * particular options to be turned on or off.  'Option' is the number of the
+ * option and 'onoff' is 0 (off) or non-0 (on).  The value returned is given
+ * by the PNG_OPTION_ defines below.
+ *
+ * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions,
+ *           are detected at run time, however sometimes it may be impossible
+ *           to do this in user mode, in which case it is necessary to discover
+ *           the capabilities in an OS specific way.  Such capabilities are
+ *           listed here when libpng has support for them and must be turned
+ *           ON by the application if present.
+ *
+ * SOFTWARE: sometimes software optimizations actually result in performance
+ *           decrease on some architectures or systems, or with some sets of
+ *           PNG images.  'Software' options allow such optimizations to be
+ *           selected at run time.
+ */
+#ifdef PNG_SET_OPTION_SUPPORTED
+#ifdef PNG_ARM_NEON_API_SUPPORTED
+#  define PNG_ARM_NEON   0 /* HARDWARE: ARM Neon SIMD instructions supported */
+#endif
+#define PNG_OPTION_NEXT  2 /* Next option - numbers must be even */
+
+/* Return values: NOTE: there are four values and 'off' is *not* zero */
+#define PNG_OPTION_UNSET   0 /* Unset - defaults to off */
+#define PNG_OPTION_INVALID 1 /* Option number out of range */
+#define PNG_OPTION_OFF     2
+#define PNG_OPTION_ON      3
+
+PNG_EXPORT(236, int, png_set_option, (png_structp png_ptr, int option,
+   int onoff));
+#endif
+
+/*******************************************************************************
+ *  END OF HARDWARE OPTIONS
+ ******************************************************************************/
+
 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project
  * defs
  */
 
 /* The last ordinal number (this is the *last* one already used; the next
  * one to use is one more than this.)  Maintainer, remember to add an entry to
  * scripts/symbols.def as well.
  */
 #ifdef PNG_EXPORT_LAST_ORDINAL
-#ifdef PNG_APNG_SUPPORTED
-  PNG_EXPORT_LAST_ORDINAL(254);
-#else
-  PNG_EXPORT_LAST_ORDINAL(234);
-#endif /* PNG_APNG_SUPPORTED */
+#  ifdef PNG_APNG_SUPPORTED
+  PNG_EXPORT_LAST_ORDINAL(256);
+#  else
+  PNG_EXPORT_LAST_ORDINAL(236);
+#  endif /* PNG_APNG_SUPPORTED */
 #endif
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* PNG_VERSION_INFO_ONLY */
 /* Do not put anything past this line */
--- a/media/libpng/pngget.c
+++ b/media/libpng/pngget.c
@@ -1,13 +1,13 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * Last changed in libpng 1.5.14 [January 24, 2013]
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Last changed in libpng 1.5.15 [March 28, 2013]
+ * 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.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
  */
@@ -1122,16 +1122,29 @@ png_get_io_chunk_type (png_const_structp
 png_const_bytep PNGAPI
 png_get_io_chunk_name (png_structp png_ptr)
 {
    PNG_CSTRING_FROM_CHUNK(png_ptr->io_chunk_string, png_ptr->chunk_name);
    return png_ptr->io_chunk_string;
 }
 #endif /* ?PNG_IO_STATE_SUPPORTED */
 
+#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
+#  ifdef PNG_GET_PALETTE_MAX_SUPPORTED
+int PNGAPI
+png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
+{
+   if (png_ptr != NULL && info_ptr != NULL)
+      return png_ptr->num_palette_max;
+
+   return (-1);
+}
+#  endif
+#endif
+
 #ifdef PNG_APNG_SUPPORTED
 png_uint_32 PNGAPI
 png_get_acTL(png_structp png_ptr, png_infop info_ptr,
              png_uint_32 *num_frames, png_uint_32 *num_plays)
 {
     png_debug1(1, "in %s retrieval function", "acTL");
 
     if (png_ptr != NULL && info_ptr != NULL &&
--- a/media/libpng/pngpriv.h
+++ b/media/libpng/pngpriv.h
@@ -1,17 +1,17 @@
 
 /* pngpriv.h - private declarations for use inside libpng
  *
  * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ * 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.)
  *
- * Last changed in libpng 1.5.10 [March 29, 2012]
+ * Last changed in libpng 1.5.15 [March 28, 2013]
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
 
 /* The symbols declared in this file (including the functions declared
  * as PNG_EXTERN) are PRIVATE.  They are not part of the libpng public
@@ -34,23 +34,25 @@
  *
  * These macros only have an effect if the operating system supports either
  * POSIX 1003.1 or C99, or both.  On other operating systems (particularly
  * Windows/Visual Studio) there is no effect; the OS specific tests below are
  * still required (as of 2011-05-02.)
  */
 #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
 
+#ifndef PNG_VERSION_INFO_ONLY
 /* This is required for the definition of abort(), used as a last ditch
  * error handler when all else fails.
  */
 #include <stdlib.h>
 
 /* This is used to find 'offsetof', used below for alignment tests. */
 #include <stddef.h>
+#endif /* !PNG_VERSION_INFO_ONLY */
 
 #define PNGLIB_BUILD /*libpng is being built, not used*/
 
 #ifdef PNG_USER_CONFIG
 #  include "pngusr.h"
    /* These should have been defined in pngusr.h */
 #  ifndef PNG_USER_PRIVATEBUILD
 #    define PNG_USER_PRIVATEBUILD "Custom libpng build"
@@ -120,18 +122,16 @@
 #ifndef PNG_DEPRECATED
 #  define PNG_DEPRECATED
 #endif
 #ifndef PNG_PRIVATE
 #  define PNG_PRIVATE
 #endif
 
 #include "png.h"
-#include "pnginfo.h"
-#include "pngstruct.h"
 
 /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */
 #ifndef PNG_DLL_EXPORT
 #  define PNG_DLL_EXPORT
 #endif
 
 /* SECURITY and SAFETY:
  *
@@ -168,24 +168,16 @@
 #  ifndef PNG_USER_CHUNK_CACHE_MAX
 #     define PNG_USER_CHUNK_CACHE_MAX 0
 #  endif
 #  ifndef PNG_USER_CHUNK_MALLOC_MAX
 #     define PNG_USER_CHUNK_MALLOC_MAX 0
 #  endif
 #endif
 
-/* This is used for 16 bit gamma tables - only the top level pointers are const,
- * this could be changed:
- */
-typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
-
-/* Added at libpng-1.2.9 */
-/* Moved to pngpriv.h at libpng-1.5.0 */
-
 /* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure"
  * script.  We may need it here to get the correct configuration on things
  * like limits.
  */
 #ifdef PNG_CONFIGURE_LIBPNG
 #  ifdef HAVE_CONFIG_H
 #    include "config.h"
 #  endif
@@ -241,17 +233,17 @@ typedef PNG_CONST png_uint_16p FAR * png
  * done this work.
  */
 #ifdef PNG_CONFIGURE_LIBPNG
 #  define PNG_RESTRICT restrict
 #else
    /* Modern compilers support restrict, but assume not for anything not
     * recognized here:
     */
-#  if defined __GNUC__ || defined _MSC_VER || defined __WATCOMC__
+#  if defined(__GNUC__) || defined(_MSC_VER) || defined(__WATCOMC__)
 #     define PNG_RESTRICT restrict
 #  else
 #     define PNG_RESTRICT
 #  endif
 #endif
 
 /* If warnings or errors are turned off the code is disabled or redirected here.
  * From 1.5.4 functions have been added to allow very limited formatting of
@@ -303,16 +295,17 @@ typedef PNG_CONST png_uint_16p FAR * png
  * deals with this:
  */
 #ifdef PNG_FIXED_POINT_SUPPORTED
 #  define PNGFAPI PNGAPI
 #else
 #  define PNGFAPI /* PRIVATE */
 #endif
 
+#ifndef PNG_VERSION_INFO_ONLY
 /* Other defines specific to compilers can go here.  Try to keep
  * them inside an appropriate ifdef/endif pair for portability.
  */
 #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
     defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
    /* png.c requires the following ANSI-C constants if the conversion of
     * floating point to ASCII is implemented therein:
     *
@@ -347,16 +340,17 @@ typedef PNG_CONST png_uint_16p FAR * png
 #  include <mem.h>
 #  include <alloc.h>
 #endif
 
 #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
     defined(_WIN32) || defined(__WIN32__)
 #  include <windows.h>  /* defines _WINDOWS_ macro */
 #endif
+#endif /* !PNG_VERSION_INFO_ONLY */
 
 /* Moved here around 1.5.0beta36 from pngconf.h */
 /* Users may want to use these so they are not private.  Any library
  * functions that are passed far data must be model-independent.
  */
 
 /* Memory model/platform independent fns */
 #ifndef PNG_ABORT
@@ -616,18 +610,20 @@ typedef PNG_CONST png_uint_16p FAR * png
  *
  * NOTE: by default this is off - the macro is not used - because the
  * function call saves a lot of code.
  */
 #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
 #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
     ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
 #else
+#ifndef PNG_VERSION_INFO_ONLY
 PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp,
    png_const_charp text));
+#endif /* !PNG_VERSION_INFO_ONLY */
 #endif
 #endif
 
 /* Constants for known chunk types.  If you need to add a chunk, define the name
  * here.  For historical reasons these constants have the form png_<name>; i.e.
  * the prefix is lower case.  Please use decimal values as the parameters to
  * match the ISO PNG specification and to avoid relying on the C locale
  * interpretation of character values.
@@ -701,16 +697,28 @@ PNG_EXTERN png_fixed_point png_fixed PNG
 #define PNG_CHUNK_RESERVED(c)     (1 & ((c) >> 13))
 #define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >>  5))
 
 /* Gamma values (new at libpng-1.5.4): */
 #define PNG_GAMMA_MAC_OLD 151724  /* Assume '1.8' is really 2.2/1.45! */
 #define PNG_GAMMA_MAC_INVERSE 65909
 #define PNG_GAMMA_sRGB_INVERSE 45455
 
+/* Almost everything below is C specific; the #defines above can be used in
+ * non-C code (so long as it is C-preprocessed) the rest of this stuff cannot.
+ */
+#ifndef PNG_VERSION_INFO_ONLY
+
+#include "pngstruct.h"
+#include "pnginfo.h"
+
+/* This is used for 16 bit gamma tables -- only the top level pointers are
+ * const; this could be changed:
+ */
+typedef const png_uint_16p * png_const_uint_16pp;
 
 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
 /* These functions are used internally in the code.  They generally
  * shouldn't be used unless you are writing code to add or replace some
@@ -1677,17 +1685,17 @@ PNG_EXTERN int png_muldiv PNGARG((png_fi
 #endif
 
 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
 /* Same deal, but issue a warning on overflow and return 0. */
 PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr,
     png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by));
 #endif
 
-#if (defined PNG_READ_GAMMA_SUPPORTED) || (defined PNG_cHRM_SUPPORTED)
+#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_cHRM_SUPPORTED)
 /* Calculate a reciprocal - used for gamma values.  This returns
  * 0 if the argument is 0 in order to maintain an undefined value,
  * there are no warnings.
  */
 PNG_EXTERN png_fixed_point png_reciprocal PNGARG((png_fixed_point a));
 
 /* The same but gives a reciprocal of the product of two fixed point
  * values.  Accuracy is suitable for gamma calculations but this is
@@ -1785,9 +1793,10 @@ PNG_EXTERN void PNG_FILTER_OPTIMIZATIONS
 /* Maintainer: Put new private prototypes here ^ */
 
 #include "pngdebug.h"
 
 #ifdef __cplusplus
 }
 #endif
 
+#endif /* PNG_VERSION_INFO_ONLY */
 #endif /* PNGPRIV_H */
--- a/media/libpng/pngrutil.c
+++ b/media/libpng/pngrutil.c
@@ -1,12 +1,12 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * Last changed in libpng 1.5.14 [January 24, 2013]
+ * Last changed in libpng 1.5.15 [March 28, 2013]
  * 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.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
@@ -3334,17 +3334,17 @@ png_combine_row(png_structp png_ptr, png
                    */
                   if (png_isaligned(dp, png_uint_32) &&
                      png_isaligned(sp, png_uint_32) &&
                      bytes_to_copy % sizeof (png_uint_32) == 0 &&
                      bytes_to_jump % sizeof (png_uint_32) == 0)
                   {
                      png_uint_32p dp32 = (png_uint_32p)dp;
                      png_const_uint_32p sp32 = (png_const_uint_32p)sp;
-                     unsigned int skip = (bytes_to_jump-bytes_to_copy) /
+                     size_t skip = (bytes_to_jump-bytes_to_copy) /
                         sizeof (png_uint_32);
 
                      do
                      {
                         size_t c = bytes_to_copy;
                         do
                         {
                            *dp32++ = *sp32++;
@@ -3375,17 +3375,17 @@ png_combine_row(png_structp png_ptr, png
 
                   /* Else do it in 16-bit quantities, but only if the size is
                    * not too large.
                    */
                   else
                   {
                      png_uint_16p dp16 = (png_uint_16p)dp;
                      png_const_uint_16p sp16 = (png_const_uint_16p)sp;
-                     unsigned int skip = (bytes_to_jump-bytes_to_copy) /
+                     size_t skip = (bytes_to_jump-bytes_to_copy) /
                         sizeof (png_uint_16);
 
                      do
                      {
                         size_t c = bytes_to_copy;
                         do
                         {
                            *dp16++ = *sp16++;
--- a/media/libpng/pngstruct.h
+++ b/media/libpng/pngstruct.h
@@ -1,16 +1,16 @@
 
 /* pngstruct.h - header file for PNG reference library
  *
- * Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ * 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.)
  *
- * Last changed in libpng 1.5.9 [February 18, 2012]
+ * Last changed in libpng 1.5.15 [March 28, 2013]
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
 
 /* The structure that holds the information to read and write PNG files.
  * The only people who need to care about what is inside of this are the
@@ -368,12 +368,18 @@ struct png_struct_def
 #ifdef PNG_IO_STATE_SUPPORTED
 /* New member added in libpng-1.4.0 */
    png_uint_32 io_state;
 #endif
 
 /* New member added in libpng-1.5.6 */
    png_bytep big_prev_row;
 
+/* New member added in libpng-1.5.7 */
    void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
       png_bytep row, png_const_bytep prev_row);
+
+   /* Options */
+#ifdef PNG_SET_OPTION_SUPPORTED
+   png_byte options;           /* On/off state (up to 4 options) */
+#endif
 };
 #endif /* PNGSTRUCT_H */
--- a/media/libpng/pngwrite.c
+++ b/media/libpng/pngwrite.c
@@ -1,12 +1,12 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * Last changed in libpng 1.5.14 [January 24, 2013]
+ * Last changed in libpng 1.5.15 [March 28, 2013]
  * 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.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
@@ -309,16 +309,17 @@ png_write_end(png_structp png_ptr, png_i
    if (!(png_ptr->mode & PNG_HAVE_IDAT))
       png_error(png_ptr, "No IDATs written into file");
 
 #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
    if (png_ptr->num_palette_max > png_ptr->num_palette)
       png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
 #endif
 
+    /* See if user wants us to write information chunks */
 #ifdef PNG_WRITE_APNG_SUPPORTED
    if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
       png_error(png_ptr, "Not enough frames written");
 #endif
 
    /* See if user wants us to write information chunks */
    if (info_ptr != NULL)
    {
@@ -460,17 +461,19 @@ png_create_write_struct,(png_const_charp
     png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
 {
 #ifdef PNG_USER_MEM_SUPPORTED
    return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
        warn_fn, NULL, NULL, NULL));
 }
 
 /* Alternate initialize png_ptr structure, and allocate any memory needed */
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
 static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */
+#endif
 
 PNG_FUNCTION(png_structp,PNGAPI
 png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
     png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
     png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
 {
 #endif /* PNG_USER_MEM_SUPPORTED */
    volatile int png_cleanup_needed = 0;
--- a/media/libpng/pngwutil.c
+++ b/media/libpng/pngwutil.c
@@ -1041,17 +1041,17 @@ png_write_IDAT(png_structp png_ptr, png_
    if (png_ptr->num_frames_written == 0)
 #endif
    png_write_complete_chunk(png_ptr, png_IDAT, data, length);
 #ifdef PNG_WRITE_APNG_SUPPORTED
    else
    {
       png_byte buf[4];
 
-      png_write_chunk_header(png_ptr, png_fdAT, (png_uint_32)(4 + length));
+      png_write_chunk_header(png_ptr, png_fdAT, 4 + length);
 
       png_save_uint_32(buf, png_ptr->next_seq_num);
       png_write_chunk_data(png_ptr, buf, 4);
 
       png_write_chunk_data(png_ptr, data, length);
 
       png_write_chunk_end(png_ptr);