Merge pull request #15554 from alalek:pr15422_patch_files
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 20 Sep 2019 21:07:24 +0000 (00:07 +0300)
committerGitHub <noreply@github.com>
Fri, 20 Sep 2019 21:07:24 +0000 (00:07 +0300)
* 3rdparty: libpng v1.6.37 MSA patch (pr15422)

original files: https://github.com/glennrp/libpng/tree/v1.6.37/mips

* 3rdparty: libwebp MSA asm patch (pr15422)

3rdparty/libpng/patches/20190910-msa-patch.diff [new file with mode: 0644]
3rdparty/libwebp/patches/20190910-msa-asm-patch.diff [new file with mode: 0644]

diff --git a/3rdparty/libpng/patches/20190910-msa-patch.diff b/3rdparty/libpng/patches/20190910-msa-patch.diff
new file mode 100644 (file)
index 0000000..42f49f9
--- /dev/null
@@ -0,0 +1,53 @@
+diff --git a/3rdparty/libpng/mips/mips_init.c b/3rdparty/libpng/mips/mips_init.c
+index 8dd283deef..6a061cccfa 100644
+--- a/3rdparty/libpng/mips/mips_init.c
++++ b/3rdparty/libpng/mips/mips_init.c
+@@ -73,7 +73,6 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
+           * this case will fall through to the 'default' below, which just
+           * returns.
+           */
+-#endif /* PNG_MIPS_MSA_API_SUPPORTED */
+ #ifdef PNG_MIPS_MSA_CHECK_SUPPORTED
+          {
+             static volatile sig_atomic_t no_msa = -1; /* not checked */
+@@ -84,12 +83,9 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
+             if (no_msa)
+                return;
+          }
+-#ifdef PNG_MIPS_MSA_API_SUPPORTED
+-         break;
+-#endif
+ #endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
++         break;
+-#ifdef PNG_MIPS_MSA_API_SUPPORTED
+       default: /* OFF or INVALID */
+          return;
+@@ -97,8 +93,6 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
+          /* Option turned on */
+          break;
+    }
+-#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:
+@@ -118,13 +112,16 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
+       pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_msa;
+       pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_msa;
+    }
+-
+    else if (bpp == 4)
+    {
+       pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_msa;
+       pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_msa;
+       pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_msa;
+    }
++#else
++   (void)pp;
++   (void)bpp;
++#endif /* PNG_MIPS_MSA_API_SUPPORTED */
+ }
+ #endif /* PNG_MIPS_MSA_OPT > 0 */
+ #endif /* READ */
diff --git a/3rdparty/libwebp/patches/20190910-msa-asm-patch.diff b/3rdparty/libwebp/patches/20190910-msa-asm-patch.diff
new file mode 100644 (file)
index 0000000..1be2135
--- /dev/null
@@ -0,0 +1,22 @@
+diff --git a/3rdparty/libwebp/src/dsp/msa_macro.h b/3rdparty/libwebp/src/dsp/msa_macro.h
+index de026a1d9e..a16c0bb300 100644
+--- a/3rdparty/libwebp/src/dsp/msa_macro.h
++++ b/3rdparty/libwebp/src/dsp/msa_macro.h
+@@ -73,7 +73,7 @@
+   static inline TYPE FUNC_NAME(const void* const psrc) {  \
+     const uint8_t* const psrc_m = (const uint8_t*)psrc;   \
+     TYPE val_m;                                           \
+-    asm volatile (                                        \
++    __asm__ volatile (                                        \
+       "" #INSTR " %[val_m], %[psrc_m]  \n\t"              \
+       : [val_m] "=r" (val_m)                              \
+       : [psrc_m] "m" (*psrc_m));                          \
+@@ -86,7 +86,7 @@
+   static inline void FUNC_NAME(TYPE val, void* const pdst) { \
+     uint8_t* const pdst_m = (uint8_t*)pdst;                  \
+     TYPE val_m = val;                                        \
+-    asm volatile (                                           \
++    __asm__ volatile (                                           \
+       " " #INSTR "  %[val_m],  %[pdst_m]  \n\t"              \
+       : [pdst_m] "=m" (*pdst_m)                              \
+       : [val_m] "r" (val_m));                                \