GNU bug report logs - #34013
[PATCH 1/2] gnu: libjxr: Build and install shared library.

Previous Next

Package: guix-patches;

Reported by: Kei Kebreau <kkebreau <at> posteo.net>

Date: Tue, 8 Jan 2019 00:33:01 UTC

Severity: normal

Tags: patch

Done: Marius Bakke <mbakke <at> fastmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34013 in the body.
You can then email your comments to 34013 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#34013; Package guix-patches. (Tue, 08 Jan 2019 00:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kei Kebreau <kkebreau <at> posteo.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 08 Jan 2019 00:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kei Kebreau <kkebreau <at> posteo.net>
To: guix-patches <at> gnu.org
Cc: Kei Kebreau <kkebreau <at> posteo.net>
Subject: [PATCH 1/2] gnu: libjxr: Build and install shared library.
Date: Mon,  7 Jan 2019 19:32:02 -0500
* gnu/packages/image.scm (libjxr)[arguments]: Add -fPIC to CFLAGS for shared
library support.  Add 'build-shared-library' phase and modify 'install' phase
to install the shared libraries.
---
 gnu/packages/image.scm | 90 ++++++++++++++++++++++++++++--------------
 1 file changed, 60 insertions(+), 30 deletions(-)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 8771eb8ae..e78ef5618 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -370,36 +370,66 @@ lossless JPEG manipulations such as rotation, scaling or cropping:
               (patches (search-patches "libjxr-fix-function-signature.patch"
                                        "libjxr-fix-typos.patch"))))
     (build-system gnu-build-system)
-    (arguments '(#:make-flags '("CC=gcc")
-                 #:tests? #f ; no check target
-                 #:phases
-                 (modify-phases %standard-phases
-                   (delete 'configure) ; no configure script
-                   ;; The upstream makefile does not include an install phase.
-                   (replace 'install
-                     (lambda* (#:key outputs #:allow-other-keys)
-                       (let* ((out (assoc-ref outputs "out"))
-                              (bin (string-append out "/bin"))
-                              (lib (string-append out "/lib"))
-                              (include (string-append out "/include/jxrlib")))
-                         (for-each (lambda (file)
-                                     (install-file file include)
-                                     (delete-file file))
-                                   (append
-                                    '("jxrgluelib/JXRGlue.h"
-                                      "jxrgluelib/JXRMeta.h"
-                                      "jxrtestlib/JXRTest.h"
-                                      "image/sys/windowsmediaphoto.h")
-                                    (find-files "common/include" "\\.h$")))
-                         (for-each (lambda (file)
-                                     (install-file file lib)
-                                     (delete-file file))
-                                   (find-files "." "\\.a$"))
-                         (for-each (lambda (file)
-                                     (install-file file bin)
-                                     (delete-file file))
-                                   '("JxrDecApp" "JxrEncApp")))
-                       #t)))))
+    (arguments
+     '(#:make-flags
+       (list "CC=gcc"
+             ;; A substitute* procedure call would be enough to add the -fPIC
+             ;; flag if there was no file decoding error.
+             ;; The makefile is a "Non-ISO extended-ASCII text, with CRLF line
+             ;; terminators" according to the file(1) utility.
+             (string-append "CFLAGS=-I. -Icommon/include -Iimage/sys -fPIC "
+                            "-D__ANSI__ -DDISABLE_PERF_MEASUREMENT -w -O "))
+       #:tests? #f ; no check target
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure) ; no configure script
+         (add-after 'build 'build-shared-library
+           (lambda _
+             ;; The Makefile uses optimization level 1, so the same
+             ;; level is used here for consistency.
+             (invoke "gcc" "-shared" "-fPIC" "-O"
+                     ;; Common files.
+                     "adapthuff.o" "image.o" "strcodec.o" "strPredQuant.o"
+                     "strTransform.o" "perfTimerANSI.o"
+                     ;; Decoding files.
+                     "decode.o" "postprocess.o" "segdec.o" "strdec.o"
+                     "strInvTransform.o" "strPredQuantDec.o" "JXRTranscode.o"
+                     ;; Encoding files.
+                     "encode.o" "segenc.o" "strenc.o" "strFwdTransform.o"
+                     "strPredQuantEnc.o"
+                     "-o" "libjpegxr.so")
+             (invoke "gcc" "-shared" "-fPIC" "-O"
+                     ;; Glue files.
+                     "JXRGlue.o" "JXRMeta.o" "JXRGluePFC.o" "JXRGlueJxr.o"
+                     ;; Test files.
+                     "JXRTest.o" "JXRTestBmp.o" "JXRTestHdr.o" "JXRTestPnm.o"
+                     "JXRTestTif.o" "JXRTestYUV.o"
+                     "-o" "libjxrglue.so")))
+         ;; The upstream makefile does not include an install phase.
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (lib (string-append out "/lib"))
+                    (include (string-append out "/include/jxrlib")))
+               (for-each (lambda (file)
+                           (install-file file include)
+                           (delete-file file))
+                         (append
+                          '("jxrgluelib/JXRGlue.h"
+                            "jxrgluelib/JXRMeta.h"
+                            "jxrtestlib/JXRTest.h"
+                            "image/sys/windowsmediaphoto.h")
+                          (find-files "common/include" "\\.h$")))
+               (for-each (lambda (file)
+                           (install-file file lib)
+                           (delete-file file))
+                         (find-files "." "\\.(a|so)$"))
+               (for-each (lambda (file)
+                           (install-file file bin)
+                           (delete-file file))
+                         '("JxrDecApp" "JxrEncApp")))
+             #t)))))
     (synopsis "Implementation of the JPEG XR standard")
     (description "JPEG XR is an approved ISO/IEC International standard (its
 official designation is ISO/IEC 29199-2). This library is an implementation of that standard.")
-- 
2.20.1





Information forwarded to guix-patches <at> gnu.org:
bug#34013; Package guix-patches. (Tue, 08 Jan 2019 00:38:02 GMT) Full text and rfc822 format available.

Message #8 received at 34013 <at> debbugs.gnu.org (full text, mbox):

From: Kei Kebreau <kkebreau <at> posteo.net>
To: 34013 <at> debbugs.gnu.org
Cc: Kei Kebreau <kkebreau <at> posteo.net>
Subject: [PATCH 2/2] gnu: freeimage: Update to 3.18.0.
Date: Mon,  7 Jan 2019 19:36:49 -0500
* gnu/packages/image.scm (freeimage): Update to 3.18.0.
[source]: Modify snippet to remove the bundled libjxr. Remove obsolete
patches.
[arguments]: Add libjxr include directory to #:make-flags.
[inputs]: Add libjxr and substitute libjpeg-turbo for libjpeg.
* gnu/packages/patches/freeimage-CVE-2015-0852.patch,
gnu/packages/patches/freeimage-CVE-2016-5684.patch,
gnu/packages/patches/freeimage-fix-build-with-gcc-5.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Unregister patches.
* gnu/packages/patches/freeimage-unbundle.patch: Update patch.
---
 gnu/local.mk                                  |    3 -
 gnu/packages/image.scm                        |   20 +-
 .../patches/freeimage-CVE-2015-0852.patch     |  129 --
 .../patches/freeimage-CVE-2016-5684.patch     |   34 -
 .../freeimage-fix-build-with-gcc-5.patch      | 1453 -----------------
 gnu/packages/patches/freeimage-unbundle.patch |  366 ++++-
 6 files changed, 298 insertions(+), 1707 deletions(-)
 delete mode 100644 gnu/packages/patches/freeimage-CVE-2015-0852.patch
 delete mode 100644 gnu/packages/patches/freeimage-CVE-2016-5684.patch
 delete mode 100644 gnu/packages/patches/freeimage-fix-build-with-gcc-5.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index bc54b61c2..c083ae281 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -704,9 +704,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/flint-ldconfig.patch			\
   %D%/packages/patches/foomatic-filters-CVE-2015-8327.patch	\
   %D%/packages/patches/foomatic-filters-CVE-2015-8560.patch	\
-  %D%/packages/patches/freeimage-CVE-2015-0852.patch		\
-  %D%/packages/patches/freeimage-CVE-2016-5684.patch		\
-  %D%/packages/patches/freeimage-fix-build-with-gcc-5.patch	\
   %D%/packages/patches/freeimage-unbundle.patch		\
   %D%/packages/patches/fuse-overlapping-headers.patch				\
   %D%/packages/patches/gawk-shell.patch				\
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index e78ef5618..100566d92 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -807,7 +807,7 @@ supplies a generic doubly-linked list and some string functions.")
 (define-public freeimage
   (package
    (name "freeimage")
-   (version "3.17.0")
+   (version "3.18.0")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -817,7 +817,7 @@ supplies a generic doubly-linked list and some string functions.")
                   ".zip"))
             (sha256
              (base32
-              "12bz57asdcfsz3zr9i9nska0fb6h3z2aizy412qjqkixkginbz7v"))
+              "1z9qwi9mlq69d5jipr3v2jika2g0kszqdzilggm99nls5xl7j4zl"))
             (modules '((guix build utils)))
             (snippet
              '(begin
@@ -825,12 +825,8 @@ supplies a generic doubly-linked list and some string functions.")
                   (lambda (dir)
                     (delete-file-recursively (string-append "Source/" dir)))
                   '("LibJPEG" "LibOpenJPEG" "LibPNG" "LibRawLite"
-                    ;; "LibJXR"
-                    "LibWebP" "OpenEXR" "ZLib"))))
-            (patches (search-patches "freeimage-unbundle.patch"
-                                     "freeimage-CVE-2015-0852.patch"
-                                     "freeimage-CVE-2016-5684.patch"
-                                     "freeimage-fix-build-with-gcc-5.patch"))))
+                    "LibJXR" "LibWebP" "OpenEXR" "ZLib"))))
+            (patches (search-patches "freeimage-unbundle.patch"))))
    (build-system gnu-build-system)
    (arguments
     '(#:phases
@@ -861,15 +857,15 @@ supplies a generic doubly-linked list and some string functions.")
             ;; We need '-fpermissive' for Source/FreeImage.h.
             ;; libjxr doesn't have a pkg-config file.
             (string-append "CFLAGS+=-O2 -fPIC -fvisibility=hidden -fpermissive "
-                           ;"-I" (assoc-ref %build-inputs "libjxr") "/include/jxrlib"
-                           ))
+                           "-I" (assoc-ref %build-inputs "libjxr")
+                           "/include/jxrlib"))
       #:tests? #f)) ; no check target
    (native-inputs
     `(("pkg-config" ,pkg-config)
       ("unzip" ,unzip)))
    (inputs
-    `(("libjpeg" ,libjpeg)
-      ;("libjxr" ,libjxr)
+    `(("libjpeg" ,libjpeg-turbo)
+      ("libjxr" ,libjxr)
       ("libpng" ,libpng)
       ("libraw" ,libraw)
       ("libtiff" ,libtiff)
diff --git a/gnu/packages/patches/freeimage-CVE-2015-0852.patch b/gnu/packages/patches/freeimage-CVE-2015-0852.patch
deleted file mode 100644
index 34d538e92..000000000
--- a/gnu/packages/patches/freeimage-CVE-2015-0852.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-Copied from Debian.
-
-Description: fix integer overflow
-Origin: upstream
- http://freeimage.cvs.sourceforge.net/viewvc/freeimage/FreeImage/Source/FreeImage/PluginPCX.cpp?view=patch&r1=1.17&r2=1.18&pathrev=MAIN
- http://freeimage.cvs.sourceforge.net/viewvc/freeimage/FreeImage/Source/FreeImage/PluginPCX.cpp?view=patch&r1=1.18&r2=1.19&pathrev=MAIN
-Bug-Debian: https://bugs.debian.org/797165
-Last-Update: 2015-09-14
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: freeimage/Source/FreeImage/PluginPCX.cpp
-===================================================================
---- freeimage.orig/Source/FreeImage/PluginPCX.cpp
-+++ freeimage/Source/FreeImage/PluginPCX.cpp
-@@ -347,12 +347,14 @@ Load(FreeImageIO *io, fi_handle handle,
- 
- 	try {
- 		// check PCX identifier
--
--		long start_pos = io->tell_proc(handle);
--		BOOL validated = pcx_validate(io, handle);		
--		io->seek_proc(handle, start_pos, SEEK_SET);
--		if(!validated) {
--			throw FI_MSG_ERROR_MAGIC_NUMBER;
-+		// (note: should have been already validated using FreeImage_GetFileType but check again)
-+		{
-+			long start_pos = io->tell_proc(handle);
-+			BOOL validated = pcx_validate(io, handle);
-+			io->seek_proc(handle, start_pos, SEEK_SET);
-+			if(!validated) {
-+				throw FI_MSG_ERROR_MAGIC_NUMBER;
-+			}
- 		}
- 
- 		// process the header
-@@ -366,20 +368,38 @@ Load(FreeImageIO *io, fi_handle handle,
- 		SwapHeader(&header);
- #endif
- 
--		// allocate a new DIB
-+		// process the window
-+		const WORD *window = header.window;	// left, upper, right,lower pixel coord.
-+		const int left		= window[0];
-+		const int top		= window[1];
-+		const int right		= window[2];
-+		const int bottom	= window[3];
- 
--		unsigned width = header.window[2] - header.window[0] + 1;
--		unsigned height = header.window[3] - header.window[1] + 1;
--		unsigned bitcount = header.bpp * header.planes;
--
--		if (bitcount == 24) {
--			dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
--		} else {
--			dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);			
-+		// check image size
-+		if((left >= right) || (top >= bottom)) {
-+			throw FI_MSG_ERROR_PARSING;
- 		}
- 
--		// if the dib couldn't be allocated, throw an error
-+		const unsigned width = right - left + 1;
-+		const unsigned height = bottom - top + 1;
-+		const unsigned bitcount = header.bpp * header.planes;
-+
-+		// allocate a new DIB
-+		switch(bitcount) {
-+			case 1:
-+			case 4:
-+			case 8:
-+				dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
-+				break;
-+			case 24:
-+				dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
-+				break;
-+			default:
-+				throw FI_MSG_ERROR_DIB_MEMORY;
-+				break;
-+		}
- 
-+		// if the dib couldn't be allocated, throw an error
- 		if (!dib) {
- 			throw FI_MSG_ERROR_DIB_MEMORY;
- 		}
-@@ -426,19 +446,23 @@ Load(FreeImageIO *io, fi_handle handle,
- 
- 				if (palette_id == 0x0C) {
- 					BYTE *cmap = (BYTE*)malloc(768 * sizeof(BYTE));
--					io->read_proc(cmap, 768, 1, handle);
- 
--					pal = FreeImage_GetPalette(dib);
--					BYTE *pColormap = &cmap[0];
-+					if(cmap) {
-+						io->read_proc(cmap, 768, 1, handle);
- 
--					for(int i = 0; i < 256; i++) {
--						pal[i].rgbRed   = pColormap[0];
--						pal[i].rgbGreen = pColormap[1];
--						pal[i].rgbBlue  = pColormap[2];
--						pColormap += 3;
-+						pal = FreeImage_GetPalette(dib);
-+						BYTE *pColormap = &cmap[0];
-+
-+						for(int i = 0; i < 256; i++) {
-+							pal[i].rgbRed   = pColormap[0];
-+							pal[i].rgbGreen = pColormap[1];
-+							pal[i].rgbBlue  = pColormap[2];
-+							pColormap += 3;
-+						}
-+
-+						free(cmap);
- 					}
- 
--					free(cmap);
- 				}
- 
- 				// wrong palette ID, perhaps a gray scale is needed ?
-@@ -466,9 +490,9 @@ Load(FreeImageIO *io, fi_handle handle,
- 		// calculate the line length for the PCX and the DIB
- 
- 		// length of raster line in bytes
--		unsigned linelength = header.bytes_per_line * header.planes;
-+		const unsigned linelength = header.bytes_per_line * header.planes;
- 		// length of DIB line (rounded to DWORD) in bytes
--		unsigned pitch = FreeImage_GetPitch(dib);
-+		const unsigned pitch = FreeImage_GetPitch(dib);
- 
- 		// run-length encoding ?
- 
diff --git a/gnu/packages/patches/freeimage-CVE-2016-5684.patch b/gnu/packages/patches/freeimage-CVE-2016-5684.patch
deleted file mode 100644
index 2fc02d7b0..000000000
--- a/gnu/packages/patches/freeimage-CVE-2016-5684.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Debian Science Maintainers
- <debian-science-maintainers <at> lists.alioth.debian.org>
-Date: Mon, 10 Oct 2016 08:22:44 +0100
-Subject: CVE-2016-5684
-
----
- Source/FreeImage/PluginXPM.cpp | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/Source/FreeImage/PluginXPM.cpp b/Source/FreeImage/PluginXPM.cpp
-index a698321..cc7bd07 100644
---- a/Source/FreeImage/PluginXPM.cpp
-+++ b/Source/FreeImage/PluginXPM.cpp
-@@ -181,6 +181,11 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
- 		}
- 		free(str);
- 
-+		// check info string
-+		if((width <= 0) || (height <= 0) || (colors <= 0) || (cpp <= 0)) {
-+			throw "Improperly formed info string";
-+		}
-+
-         if (colors > 256) {
- 			dib = FreeImage_AllocateHeader(header_only, width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- 		} else {
-@@ -193,7 +198,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
- 			FILE_RGBA rgba;
- 
- 			str = ReadString(io, handle);
--			if(!str)
-+			if(!str || (strlen(str) < (size_t)cpp))
- 				throw "Error reading color strings";
- 
- 			std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars
diff --git a/gnu/packages/patches/freeimage-fix-build-with-gcc-5.patch b/gnu/packages/patches/freeimage-fix-build-with-gcc-5.patch
deleted file mode 100644
index 2c9f2c335..000000000
--- a/gnu/packages/patches/freeimage-fix-build-with-gcc-5.patch
+++ /dev/null
@@ -1,1453 +0,0 @@
-The original patch was downloaded from here:
-https://chromium-review.googlesource.com/c/297211
-
-The paths, file names, and line endings have been adapted.
-
-From eebaf97f5a1cb713d81d311308d8a48c124e5aef Mon Sep 17 00:00:00 2001
-From: James Zern <jzern <at> google.com>
-Date: Wed, 02 Sep 2015 23:21:13 -0700
-Subject: [PATCH] dsp/mips: add whitespace around stringizing operator
-
-fixes compile with gcc 5.1
-BUG=259
-
-Change-Id: Ideb39c6290ab8569b1b6cc835bea11c822d0286c
----
-
-diff --git a/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c b/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c
-index 6590f43..40e4d82 100644
---- a/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c
-+++ b/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c
-@@ -548,10 +548,10 @@
- // TEMP3 = SRC[D + D1 * BPS]
- #define LOAD_4_BYTES(TEMP0, TEMP1, TEMP2, TEMP3,                               \
-                      A, A1, B, B1, C, C1, D, D1, SRC)                          \
--  "lbu          %["#TEMP0"],   "#A"+"#A1"*"XSTR(BPS)"(%["#SRC"])     \n\t"     \
--  "lbu          %["#TEMP1"],   "#B"+"#B1"*"XSTR(BPS)"(%["#SRC"])     \n\t"     \
--  "lbu          %["#TEMP2"],   "#C"+"#C1"*"XSTR(BPS)"(%["#SRC"])     \n\t"     \
--  "lbu          %["#TEMP3"],   "#D"+"#D1"*"XSTR(BPS)"(%["#SRC"])     \n\t"     \
-+  "lbu      %[" #TEMP0 "],   " #A "+" #A1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t"     \
-+  "lbu      %[" #TEMP1 "],   " #B "+" #B1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t"     \
-+  "lbu      %[" #TEMP2 "],   " #C "+" #C1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t"     \
-+  "lbu      %[" #TEMP3 "],   " #D "+" #D1 "*"XSTR(BPS)"(%[" #SRC "]) \n\t"     \
- 
- static void SimpleHFilter16(uint8_t* p, int stride, int thresh) {
-   int i;
-@@ -623,8 +623,8 @@
- // DST[A * BPS]     = TEMP0
- // DST[B + C * BPS] = TEMP1
- #define STORE_8_BYTES(TEMP0, TEMP1, A, B, C, DST)                              \
--  "usw          %["#TEMP0"],   "#A"*"XSTR(BPS)"(%["#DST"])         \n\t"       \
--  "usw          %["#TEMP1"],   "#B"+"#C"*"XSTR(BPS)"(%["#DST"])    \n\t"
-+  "usw    %[" #TEMP0 "],   " #A "*"XSTR(BPS)"(%[" #DST "])         \n\t"       \
-+  "usw    %[" #TEMP1 "],   " #B "+" #C "*"XSTR(BPS)"(%[" #DST "])  \n\t"
- 
- static void VE4(uint8_t* dst) {    // vertical
-   const uint8_t* top = dst - BPS;
-@@ -725,8 +725,8 @@
- // TEMP0 = SRC[A * BPS]
- // TEMP1 = SRC[B + C * BPS]
- #define LOAD_8_BYTES(TEMP0, TEMP1, A, B, C, SRC)                               \
--  "ulw          %["#TEMP0"],   "#A"*"XSTR(BPS)"(%["#SRC"])         \n\t"       \
--  "ulw          %["#TEMP1"],   "#B"+"#C"*"XSTR(BPS)"(%["#SRC"])    \n\t"
-+  "ulw    %[" #TEMP0 "],   " #A "*"XSTR(BPS)"(%[" #SRC "])         \n\t"       \
-+  "ulw    %[" #TEMP1 "],   " #B "+" #C "*"XSTR(BPS)"(%[" #SRC "])  \n\t"
- 
- static void LD4(uint8_t* dst) {   // Down-Left
-   int temp0, temp1, temp2, temp3, temp4;
-@@ -873,24 +873,24 @@
- #define CLIPPING(SIZE)                                                         \
-   "preceu.ph.qbl   %[temp2],   %[temp0]                  \n\t"                 \
-   "preceu.ph.qbr   %[temp0],   %[temp0]                  \n\t"                 \
--".if "#SIZE" == 8                                        \n\t"                 \
-+".if " #SIZE " == 8                                      \n\t"                 \
-   "preceu.ph.qbl   %[temp3],   %[temp1]                  \n\t"                 \
-   "preceu.ph.qbr   %[temp1],   %[temp1]                  \n\t"                 \
- ".endif                                                  \n\t"                 \
-   "addu.ph         %[temp2],   %[temp2],   %[dst_1]      \n\t"                 \
-   "addu.ph         %[temp0],   %[temp0],   %[dst_1]      \n\t"                 \
--".if "#SIZE" == 8                                        \n\t"                 \
-+".if " #SIZE " == 8                                      \n\t"                 \
-   "addu.ph         %[temp3],   %[temp3],   %[dst_1]      \n\t"                 \
-   "addu.ph         %[temp1],   %[temp1],   %[dst_1]      \n\t"                 \
- ".endif                                                  \n\t"                 \
-   "shll_s.ph       %[temp2],   %[temp2],   7             \n\t"                 \
-   "shll_s.ph       %[temp0],   %[temp0],   7             \n\t"                 \
--".if "#SIZE" == 8                                        \n\t"                 \
-+".if " #SIZE " == 8                                      \n\t"                 \
-   "shll_s.ph       %[temp3],   %[temp3],   7             \n\t"                 \
-   "shll_s.ph       %[temp1],   %[temp1],   7             \n\t"                 \
- ".endif                                                  \n\t"                 \
-   "precrqu_s.qb.ph %[temp0],   %[temp2],   %[temp0]      \n\t"                 \
--".if "#SIZE" == 8                                        \n\t"                 \
-+".if " #SIZE " == 8                                      \n\t"                 \
-   "precrqu_s.qb.ph %[temp1],   %[temp3],   %[temp1]      \n\t"                 \
- ".endif                                                  \n\t"
- 
-@@ -899,7 +899,7 @@
-   int dst_1 = ((int)(DST)[-1] << 16) + (DST)[-1];                              \
-   int temp0, temp1, temp2, temp3;                                              \
-   __asm__ volatile (                                                           \
--  ".if "#SIZE" < 8                                       \n\t"                 \
-+  ".if " #SIZE " < 8                                     \n\t"                 \
-     "ulw             %[temp0],   0(%[top])               \n\t"                 \
-     "subu.ph         %[dst_1],   %[dst_1],    %[top_1]   \n\t"                 \
-     CLIPPING(4)                                                                \
-@@ -911,7 +911,7 @@
-     CLIPPING(8)                                                                \
-     "usw             %[temp0],   0(%[dst])               \n\t"                 \
-     "usw             %[temp1],   4(%[dst])               \n\t"                 \
--  ".if "#SIZE" == 16                                     \n\t"                 \
-+  ".if " #SIZE " == 16                                   \n\t"                 \
-     "ulw             %[temp0],   8(%[top])               \n\t"                 \
-     "ulw             %[temp1],   12(%[top])              \n\t"                 \
-     CLIPPING(8)                                                                \
-diff --git a/Source/LibWebP/src/dsp/dsp.enc_mips32.c b/Source/LibWebP/src/dsp/dsp.enc_mips32.c
-index c5837f1..b50e08b 100644
---- a/Source/LibWebP/src/dsp/dsp.enc_mips32.c
-+++ b/Source/LibWebP/src/dsp/dsp.enc_mips32.c
-@@ -31,26 +31,26 @@
- // TEMP0..TEMP3 - registers for corresponding tmp elements
- // TEMP4..TEMP5 - temporary registers
- #define VERTICAL_PASS(A, B, C, D, TEMP4, TEMP0, TEMP1, TEMP2, TEMP3)        \
--  "lh      %[temp16],      "#A"(%[temp20])                 \n\t"            \
--  "lh      %[temp18],      "#B"(%[temp20])                 \n\t"            \
--  "lh      %[temp17],      "#C"(%[temp20])                 \n\t"            \
--  "lh      %[temp19],      "#D"(%[temp20])                 \n\t"            \
--  "addu    %["#TEMP4"],    %[temp16],      %[temp18]       \n\t"            \
--  "subu    %[temp16],      %[temp16],      %[temp18]       \n\t"            \
--  "mul     %["#TEMP0"],    %[temp17],      %[kC2]          \n\t"            \
--  "mul     %[temp18],      %[temp19],      %[kC1]          \n\t"            \
--  "mul     %[temp17],      %[temp17],      %[kC1]          \n\t"            \
--  "mul     %[temp19],      %[temp19],      %[kC2]          \n\t"            \
--  "sra     %["#TEMP0"],    %["#TEMP0"],    16              \n\n"            \
--  "sra     %[temp18],      %[temp18],      16              \n\n"            \
--  "sra     %[temp17],      %[temp17],      16              \n\n"            \
--  "sra     %[temp19],      %[temp19],      16              \n\n"            \
--  "subu    %["#TEMP2"],    %["#TEMP0"],    %[temp18]       \n\t"            \
--  "addu    %["#TEMP3"],    %[temp17],      %[temp19]       \n\t"            \
--  "addu    %["#TEMP0"],    %["#TEMP4"],    %["#TEMP3"]     \n\t"            \
--  "addu    %["#TEMP1"],    %[temp16],      %["#TEMP2"]     \n\t"            \
--  "subu    %["#TEMP2"],    %[temp16],      %["#TEMP2"]     \n\t"            \
--  "subu    %["#TEMP3"],    %["#TEMP4"],    %["#TEMP3"]     \n\t"
-+  "lh      %[temp16],      " #A "(%[temp20])                 \n\t"          \
-+  "lh      %[temp18],      " #B "(%[temp20])                 \n\t"          \
-+  "lh      %[temp17],      " #C "(%[temp20])                 \n\t"          \
-+  "lh      %[temp19],      " #D "(%[temp20])                 \n\t"          \
-+  "addu    %[" #TEMP4 "],    %[temp16],      %[temp18]       \n\t"          \
-+  "subu    %[temp16],      %[temp16],      %[temp18]         \n\t"          \
-+  "mul     %[" #TEMP0 "],    %[temp17],      %[kC2]          \n\t"          \
-+  "mul     %[temp18],      %[temp19],      %[kC1]            \n\t"          \
-+  "mul     %[temp17],      %[temp17],      %[kC1]            \n\t"          \
-+  "mul     %[temp19],      %[temp19],      %[kC2]            \n\t"          \
-+  "sra     %[" #TEMP0 "],    %[" #TEMP0 "],    16            \n\n"          \
-+  "sra     %[temp18],      %[temp18],      16                \n\n"          \
-+  "sra     %[temp17],      %[temp17],      16                \n\n"          \
-+  "sra     %[temp19],      %[temp19],      16                \n\n"          \
-+  "subu    %[" #TEMP2 "],    %[" #TEMP0 "],    %[temp18]     \n\t"          \
-+  "addu    %[" #TEMP3 "],    %[temp17],      %[temp19]       \n\t"          \
-+  "addu    %[" #TEMP0 "],    %[" #TEMP4 "],    %[" #TEMP3 "] \n\t"          \
-+  "addu    %[" #TEMP1 "],    %[temp16],      %[" #TEMP2 "]   \n\t"          \
-+  "subu    %[" #TEMP2 "],    %[temp16],      %[" #TEMP2 "]   \n\t"          \
-+  "subu    %[" #TEMP3 "],    %[" #TEMP4 "],    %[" #TEMP3 "] \n\t"
- 
- // macro for one horizontal pass in ITransformOne
- // MUL and STORE macros inlined
-@@ -58,59 +58,59 @@
- // temp0..temp15 holds tmp[0]..tmp[15]
- // A - offset in bytes to load from ref and store to dst buffer
- // TEMP0, TEMP4, TEMP8 and TEMP12 - registers for corresponding tmp elements
--#define HORIZONTAL_PASS(A, TEMP0, TEMP4, TEMP8, TEMP12)                     \
--  "addiu   %["#TEMP0"],    %["#TEMP0"],    4               \n\t"            \
--  "addu    %[temp16],      %["#TEMP0"],    %["#TEMP8"]     \n\t"            \
--  "subu    %[temp17],      %["#TEMP0"],    %["#TEMP8"]     \n\t"            \
--  "mul     %["#TEMP0"],    %["#TEMP4"],    %[kC2]          \n\t"            \
--  "mul     %["#TEMP8"],    %["#TEMP12"],   %[kC1]          \n\t"            \
--  "mul     %["#TEMP4"],    %["#TEMP4"],    %[kC1]          \n\t"            \
--  "mul     %["#TEMP12"],   %["#TEMP12"],   %[kC2]          \n\t"            \
--  "sra     %["#TEMP0"],    %["#TEMP0"],    16              \n\t"            \
--  "sra     %["#TEMP8"],    %["#TEMP8"],    16              \n\t"            \
--  "sra     %["#TEMP4"],    %["#TEMP4"],    16              \n\t"            \
--  "sra     %["#TEMP12"],   %["#TEMP12"],   16              \n\t"            \
--  "subu    %[temp18],      %["#TEMP0"],    %["#TEMP8"]     \n\t"            \
--  "addu    %[temp19],      %["#TEMP4"],    %["#TEMP12"]    \n\t"            \
--  "addu    %["#TEMP0"],    %[temp16],      %[temp19]       \n\t"            \
--  "addu    %["#TEMP4"],    %[temp17],      %[temp18]       \n\t"            \
--  "subu    %["#TEMP8"],    %[temp17],      %[temp18]       \n\t"            \
--  "subu    %["#TEMP12"],   %[temp16],      %[temp19]       \n\t"            \
--  "lw      %[temp20],      0(%[args])                      \n\t"            \
--  "sra     %["#TEMP0"],    %["#TEMP0"],    3               \n\t"            \
--  "sra     %["#TEMP4"],    %["#TEMP4"],    3               \n\t"            \
--  "sra     %["#TEMP8"],    %["#TEMP8"],    3               \n\t"            \
--  "sra     %["#TEMP12"],   %["#TEMP12"],   3               \n\t"            \
--  "lbu     %[temp16],      0+"XSTR(BPS)"*"#A"(%[temp20])   \n\t"            \
--  "lbu     %[temp17],      1+"XSTR(BPS)"*"#A"(%[temp20])   \n\t"            \
--  "lbu     %[temp18],      2+"XSTR(BPS)"*"#A"(%[temp20])   \n\t"            \
--  "lbu     %[temp19],      3+"XSTR(BPS)"*"#A"(%[temp20])   \n\t"            \
--  "addu    %["#TEMP0"],    %[temp16],      %["#TEMP0"]     \n\t"            \
--  "addu    %["#TEMP4"],    %[temp17],      %["#TEMP4"]     \n\t"            \
--  "addu    %["#TEMP8"],    %[temp18],      %["#TEMP8"]     \n\t"            \
--  "addu    %["#TEMP12"],   %[temp19],      %["#TEMP12"]    \n\t"            \
--  "slt     %[temp16],      %["#TEMP0"],    $zero           \n\t"            \
--  "slt     %[temp17],      %["#TEMP4"],    $zero           \n\t"            \
--  "slt     %[temp18],      %["#TEMP8"],    $zero           \n\t"            \
--  "slt     %[temp19],      %["#TEMP12"],   $zero           \n\t"            \
--  "movn    %["#TEMP0"],    $zero,          %[temp16]       \n\t"            \
--  "movn    %["#TEMP4"],    $zero,          %[temp17]       \n\t"            \
--  "movn    %["#TEMP8"],    $zero,          %[temp18]       \n\t"            \
--  "movn    %["#TEMP12"],   $zero,          %[temp19]       \n\t"            \
--  "addiu   %[temp20],      $zero,          255             \n\t"            \
--  "slt     %[temp16],      %["#TEMP0"],    %[temp20]       \n\t"            \
--  "slt     %[temp17],      %["#TEMP4"],    %[temp20]       \n\t"            \
--  "slt     %[temp18],      %["#TEMP8"],    %[temp20]       \n\t"            \
--  "slt     %[temp19],      %["#TEMP12"],   %[temp20]       \n\t"            \
--  "movz    %["#TEMP0"],    %[temp20],      %[temp16]       \n\t"            \
--  "movz    %["#TEMP4"],    %[temp20],      %[temp17]       \n\t"            \
--  "lw      %[temp16],      8(%[args])                      \n\t"            \
--  "movz    %["#TEMP8"],    %[temp20],      %[temp18]       \n\t"            \
--  "movz    %["#TEMP12"],   %[temp20],      %[temp19]       \n\t"            \
--  "sb      %["#TEMP0"],    0+"XSTR(BPS)"*"#A"(%[temp16])   \n\t"            \
--  "sb      %["#TEMP4"],    1+"XSTR(BPS)"*"#A"(%[temp16])   \n\t"            \
--  "sb      %["#TEMP8"],    2+"XSTR(BPS)"*"#A"(%[temp16])   \n\t"            \
--  "sb      %["#TEMP12"],   3+"XSTR(BPS)"*"#A"(%[temp16])   \n\t"
-+#define HORIZONTAL_PASS(A, TEMP0, TEMP4, TEMP8, TEMP12)                       \
-+  "addiu   %[" #TEMP0 "],    %[" #TEMP0 "],    4             \n\t"            \
-+  "addu    %[temp16],      %[" #TEMP0 "],    %[" #TEMP8 "]   \n\t"            \
-+  "subu    %[temp17],      %[" #TEMP0 "],    %[" #TEMP8 "]   \n\t"            \
-+  "mul     %[" #TEMP0 "],    %[" #TEMP4 "],    %[kC2]        \n\t"            \
-+  "mul     %[" #TEMP8 "],    %[" #TEMP12 "],   %[kC1]        \n\t"            \
-+  "mul     %[" #TEMP4 "],    %[" #TEMP4 "],    %[kC1]        \n\t"            \
-+  "mul     %[" #TEMP12 "],   %[" #TEMP12 "],   %[kC2]        \n\t"            \
-+  "sra     %[" #TEMP0 "],    %[" #TEMP0 "],    16            \n\t"            \
-+  "sra     %[" #TEMP8 "],    %[" #TEMP8 "],    16            \n\t"            \
-+  "sra     %[" #TEMP4 "],    %[" #TEMP4 "],    16            \n\t"            \
-+  "sra     %[" #TEMP12 "],   %[" #TEMP12 "],   16            \n\t"            \
-+  "subu    %[temp18],      %[" #TEMP0 "],    %[" #TEMP8 "]   \n\t"            \
-+  "addu    %[temp19],      %[" #TEMP4 "],    %[" #TEMP12 "]  \n\t"            \
-+  "addu    %[" #TEMP0 "],    %[temp16],      %[temp19]       \n\t"            \
-+  "addu    %[" #TEMP4 "],    %[temp17],      %[temp18]       \n\t"            \
-+  "subu    %[" #TEMP8 "],    %[temp17],      %[temp18]       \n\t"            \
-+  "subu    %[" #TEMP12 "],   %[temp16],      %[temp19]       \n\t"            \
-+  "lw      %[temp20],      0(%[args])                        \n\t"            \
-+  "sra     %[" #TEMP0 "],    %[" #TEMP0 "],    3             \n\t"            \
-+  "sra     %[" #TEMP4 "],    %[" #TEMP4 "],    3             \n\t"            \
-+  "sra     %[" #TEMP8 "],    %[" #TEMP8 "],    3             \n\t"            \
-+  "sra     %[" #TEMP12 "],   %[" #TEMP12 "],   3             \n\t"            \
-+  "lbu     %[temp16],      0+"XSTR(BPS)"*" #A "(%[temp20])   \n\t"            \
-+  "lbu     %[temp17],      1+"XSTR(BPS)"*" #A "(%[temp20])   \n\t"            \
-+  "lbu     %[temp18],      2+"XSTR(BPS)"*" #A "(%[temp20])   \n\t"            \
-+  "lbu     %[temp19],      3+"XSTR(BPS)"*" #A "(%[temp20])   \n\t"            \
-+  "addu    %[" #TEMP0 "],    %[temp16],      %[" #TEMP0 "]   \n\t"            \
-+  "addu    %[" #TEMP4 "],    %[temp17],      %[" #TEMP4 "]   \n\t"            \
-+  "addu    %[" #TEMP8 "],    %[temp18],      %[" #TEMP8 "]   \n\t"            \
-+  "addu    %[" #TEMP12 "],   %[temp19],      %[" #TEMP12 "]  \n\t"            \
-+  "slt     %[temp16],      %[" #TEMP0 "],    $zero           \n\t"            \
-+  "slt     %[temp17],      %[" #TEMP4 "],    $zero           \n\t"            \
-+  "slt     %[temp18],      %[" #TEMP8 "],    $zero           \n\t"            \
-+  "slt     %[temp19],      %[" #TEMP12 "],   $zero           \n\t"            \
-+  "movn    %[" #TEMP0 "],    $zero,          %[temp16]       \n\t"            \
-+  "movn    %[" #TEMP4 "],    $zero,          %[temp17]       \n\t"            \
-+  "movn    %[" #TEMP8 "],    $zero,          %[temp18]       \n\t"            \
-+  "movn    %[" #TEMP12 "],   $zero,          %[temp19]       \n\t"            \
-+  "addiu   %[temp20],      $zero,          255               \n\t"            \
-+  "slt     %[temp16],      %[" #TEMP0 "],    %[temp20]       \n\t"            \
-+  "slt     %[temp17],      %[" #TEMP4 "],    %[temp20]       \n\t"            \
-+  "slt     %[temp18],      %[" #TEMP8 "],    %[temp20]       \n\t"            \
-+  "slt     %[temp19],      %[" #TEMP12 "],   %[temp20]       \n\t"            \
-+  "movz    %[" #TEMP0 "],    %[temp20],      %[temp16]       \n\t"            \
-+  "movz    %[" #TEMP4 "],    %[temp20],      %[temp17]       \n\t"            \
-+  "lw      %[temp16],      8(%[args])                        \n\t"            \
-+  "movz    %[" #TEMP8 "],    %[temp20],      %[temp18]       \n\t"            \
-+  "movz    %[" #TEMP12 "],   %[temp20],      %[temp19]       \n\t"            \
-+  "sb      %[" #TEMP0 "],    0+"XSTR(BPS)"*" #A "(%[temp16]) \n\t"            \
-+  "sb      %[" #TEMP4 "],    1+"XSTR(BPS)"*" #A "(%[temp16]) \n\t"            \
-+  "sb      %[" #TEMP8 "],    2+"XSTR(BPS)"*" #A "(%[temp16]) \n\t"            \
-+  "sb      %[" #TEMP12 "],   3+"XSTR(BPS)"*" #A "(%[temp16]) \n\t"
- 
- // Does one or two inverse transforms.
- static WEBP_INLINE void ITransformOne(const uint8_t* ref, const int16_t* in,
-@@ -161,9 +161,9 @@
- // K - offset in bytes (kZigzag[n] * 4)
- // N - offset in bytes (n * 2)
- #define QUANTIZE_ONE(J, K, N)                                               \
--  "lh           %[temp0],       "#J"(%[ppin])                       \n\t"   \
--  "lhu          %[temp1],       "#J"(%[ppsharpen])                  \n\t"   \
--  "lw           %[temp2],       "#K"(%[ppzthresh])                  \n\t"   \
-+  "lh           %[temp0],       " #J "(%[ppin])                     \n\t"   \
-+  "lhu          %[temp1],       " #J "(%[ppsharpen])                \n\t"   \
-+  "lw           %[temp2],       " #K "(%[ppzthresh])                \n\t"   \
-   "sra          %[sign],        %[temp0],           15              \n\t"   \
-   "xor          %[coeff],       %[temp0],           %[sign]         \n\t"   \
-   "subu         %[coeff],       %[coeff],           %[sign]         \n\t"   \
-@@ -172,9 +172,9 @@
-   "addiu        %[temp5],       $zero,              0               \n\t"   \
-   "addiu        %[level],       $zero,              0               \n\t"   \
-   "beqz         %[temp4],       2f                                  \n\t"   \
--  "lhu          %[temp1],       "#J"(%[ppiq])                       \n\t"   \
--  "lw           %[temp2],       "#K"(%[ppbias])                     \n\t"   \
--  "lhu          %[temp3],       "#J"(%[ppq])                        \n\t"   \
-+  "lhu          %[temp1],       " #J "(%[ppiq])                     \n\t"   \
-+  "lw           %[temp2],       " #K "(%[ppbias])                   \n\t"   \
-+  "lhu          %[temp3],       " #J "(%[ppq])                      \n\t"   \
-   "mul          %[level],       %[coeff],           %[temp1]        \n\t"   \
-   "addu         %[level],       %[level],           %[temp2]        \n\t"   \
-   "sra          %[level],       %[level],           17              \n\t"   \
-@@ -184,8 +184,8 @@
-   "subu         %[level],       %[level],           %[sign]         \n\t"   \
-   "mul          %[temp5],       %[level],           %[temp3]        \n\t"   \
- "2:                                                                 \n\t"   \
--  "sh           %[temp5],       "#J"(%[ppin])                       \n\t"   \
--  "sh           %[level],       "#N"(%[pout])                       \n\t"
-+  "sh           %[temp5],       " #J "(%[ppin])                     \n\t"   \
-+  "sh           %[level],       " #N "(%[pout])                     \n\t"
- 
- static int QuantizeBlock(int16_t in[16], int16_t out[16],
-                          const VP8Matrix* const mtx) {
-@@ -253,39 +253,39 @@
- // A - offset in bytes to load from a and b buffers
- // E..H - offsets in bytes to store first results to tmp buffer
- // E1..H1 - offsets in bytes to store second results to tmp buffer
--#define HORIZONTAL_PASS(A, E, F, G, H, E1, F1, G1, H1)              \
--  "lbu    %[temp0],  0+"XSTR(BPS)"*"#A"(%[a])  \n\t"                \
--  "lbu    %[temp1],  1+"XSTR(BPS)"*"#A"(%[a])  \n\t"                \
--  "lbu    %[temp2],  2+"XSTR(BPS)"*"#A"(%[a])  \n\t"                \
--  "lbu    %[temp3],  3+"XSTR(BPS)"*"#A"(%[a])  \n\t"                \
--  "lbu    %[temp4],  0+"XSTR(BPS)"*"#A"(%[b])  \n\t"                \
--  "lbu    %[temp5],  1+"XSTR(BPS)"*"#A"(%[b])  \n\t"                \
--  "lbu    %[temp6],  2+"XSTR(BPS)"*"#A"(%[b])  \n\t"                \
--  "lbu    %[temp7],  3+"XSTR(BPS)"*"#A"(%[b])  \n\t"                \
--  "addu   %[temp8],  %[temp0],    %[temp2]     \n\t"                \
--  "subu   %[temp0],  %[temp0],    %[temp2]     \n\t"                \
--  "addu   %[temp2],  %[temp1],    %[temp3]     \n\t"                \
--  "subu   %[temp1],  %[temp1],    %[temp3]     \n\t"                \
--  "addu   %[temp3],  %[temp4],    %[temp6]     \n\t"                \
--  "subu   %[temp4],  %[temp4],    %[temp6]     \n\t"                \
--  "addu   %[temp6],  %[temp5],    %[temp7]     \n\t"                \
--  "subu   %[temp5],  %[temp5],    %[temp7]     \n\t"                \
--  "addu   %[temp7],  %[temp8],    %[temp2]     \n\t"                \
--  "subu   %[temp2],  %[temp8],    %[temp2]     \n\t"                \
--  "addu   %[temp8],  %[temp0],    %[temp1]     \n\t"                \
--  "subu   %[temp0],  %[temp0],    %[temp1]     \n\t"                \
--  "addu   %[temp1],  %[temp3],    %[temp6]     \n\t"                \
--  "subu   %[temp3],  %[temp3],    %[temp6]     \n\t"                \
--  "addu   %[temp6],  %[temp4],    %[temp5]     \n\t"                \
--  "subu   %[temp4],  %[temp4],    %[temp5]     \n\t"                \
--  "sw     %[temp7],  "#E"(%[tmp])              \n\t"                \
--  "sw     %[temp2],  "#H"(%[tmp])              \n\t"                \
--  "sw     %[temp8],  "#F"(%[tmp])              \n\t"                \
--  "sw     %[temp0],  "#G"(%[tmp])              \n\t"                \
--  "sw     %[temp1],  "#E1"(%[tmp])             \n\t"                \
--  "sw     %[temp3],  "#H1"(%[tmp])             \n\t"                \
--  "sw     %[temp6],  "#F1"(%[tmp])             \n\t"                \
--  "sw     %[temp4],  "#G1"(%[tmp])             \n\t"
-+#define HORIZONTAL_PASS(A, E, F, G, H, E1, F1, G1, H1)                \
-+  "lbu    %[temp0],  0+"XSTR(BPS)"*" #A "(%[a])  \n\t"                \
-+  "lbu    %[temp1],  1+"XSTR(BPS)"*" #A "(%[a])  \n\t"                \
-+  "lbu    %[temp2],  2+"XSTR(BPS)"*" #A "(%[a])  \n\t"                \
-+  "lbu    %[temp3],  3+"XSTR(BPS)"*" #A "(%[a])  \n\t"                \
-+  "lbu    %[temp4],  0+"XSTR(BPS)"*" #A "(%[b])  \n\t"                \
-+  "lbu    %[temp5],  1+"XSTR(BPS)"*" #A "(%[b])  \n\t"                \
-+  "lbu    %[temp6],  2+"XSTR(BPS)"*" #A "(%[b])  \n\t"                \
-+  "lbu    %[temp7],  3+"XSTR(BPS)"*" #A "(%[b])  \n\t"                \
-+  "addu   %[temp8],  %[temp0],    %[temp2]       \n\t"                \
-+  "subu   %[temp0],  %[temp0],    %[temp2]       \n\t"                \
-+  "addu   %[temp2],  %[temp1],    %[temp3]       \n\t"                \
-+  "subu   %[temp1],  %[temp1],    %[temp3]       \n\t"                \
-+  "addu   %[temp3],  %[temp4],    %[temp6]       \n\t"                \
-+  "subu   %[temp4],  %[temp4],    %[temp6]       \n\t"                \
-+  "addu   %[temp6],  %[temp5],    %[temp7]       \n\t"                \
-+  "subu   %[temp5],  %[temp5],    %[temp7]       \n\t"                \
-+  "addu   %[temp7],  %[temp8],    %[temp2]       \n\t"                \
-+  "subu   %[temp2],  %[temp8],    %[temp2]       \n\t"                \
-+  "addu   %[temp8],  %[temp0],    %[temp1]       \n\t"                \
-+  "subu   %[temp0],  %[temp0],    %[temp1]       \n\t"                \
-+  "addu   %[temp1],  %[temp3],    %[temp6]       \n\t"                \
-+  "subu   %[temp3],  %[temp3],    %[temp6]       \n\t"                \
-+  "addu   %[temp6],  %[temp4],    %[temp5]       \n\t"                \
-+  "subu   %[temp4],  %[temp4],    %[temp5]       \n\t"                \
-+  "sw     %[temp7],  " #E "(%[tmp])              \n\t"                \
-+  "sw     %[temp2],  " #H "(%[tmp])              \n\t"                \
-+  "sw     %[temp8],  " #F "(%[tmp])              \n\t"                \
-+  "sw     %[temp0],  " #G "(%[tmp])              \n\t"                \
-+  "sw     %[temp1],  " #E1 "(%[tmp])             \n\t"                \
-+  "sw     %[temp3],  " #H1 "(%[tmp])             \n\t"                \
-+  "sw     %[temp6],  " #F1 "(%[tmp])             \n\t"                \
-+  "sw     %[temp4],  " #G1 "(%[tmp])             \n\t"
- 
- // macro for one vertical pass in Disto4x4 (TTransform)
- // two calls of function TTransform are merged into single one
-@@ -300,10 +300,10 @@
- // A1..D1 - offsets in bytes to load second results from tmp buffer
- // E..H - offsets in bytes to load from w buffer
- #define VERTICAL_PASS(A, B, C, D, A1, B1, C1, D1, E, F, G, H)     \
--  "lw     %[temp0],  "#A1"(%[tmp])           \n\t"                \
--  "lw     %[temp1],  "#C1"(%[tmp])           \n\t"                \
--  "lw     %[temp2],  "#B1"(%[tmp])           \n\t"                \
--  "lw     %[temp3],  "#D1"(%[tmp])           \n\t"                \
-+  "lw     %[temp0],  " #A1 "(%[tmp])         \n\t"                \
-+  "lw     %[temp1],  " #C1 "(%[tmp])         \n\t"                \
-+  "lw     %[temp2],  " #B1 "(%[tmp])         \n\t"                \
-+  "lw     %[temp3],  " #D1 "(%[tmp])         \n\t"                \
-   "addu   %[temp8],  %[temp0],    %[temp1]   \n\t"                \
-   "subu   %[temp0],  %[temp0],    %[temp1]   \n\t"                \
-   "addu   %[temp1],  %[temp2],    %[temp3]   \n\t"                \
-@@ -324,18 +324,18 @@
-   "subu   %[temp1],  %[temp1],    %[temp5]   \n\t"                \
-   "subu   %[temp0],  %[temp0],    %[temp6]   \n\t"                \
-   "subu   %[temp8],  %[temp8],    %[temp7]   \n\t"                \
--  "lhu    %[temp4],  "#E"(%[w])              \n\t"                \
--  "lhu    %[temp5],  "#F"(%[w])              \n\t"                \
--  "lhu    %[temp6],  "#G"(%[w])              \n\t"                \
--  "lhu    %[temp7],  "#H"(%[w])              \n\t"                \
-+  "lhu    %[temp4],  " #E "(%[w])            \n\t"                \
-+  "lhu    %[temp5],  " #F "(%[w])            \n\t"                \
-+  "lhu    %[temp6],  " #G "(%[w])            \n\t"                \
-+  "lhu    %[temp7],  " #H "(%[w])            \n\t"                \
-   "madd   %[temp4],  %[temp3]                \n\t"                \
-   "madd   %[temp5],  %[temp1]                \n\t"                \
-   "madd   %[temp6],  %[temp0]                \n\t"                \
-   "madd   %[temp7],  %[temp8]                \n\t"                \
--  "lw     %[temp0],  "#A"(%[tmp])            \n\t"                \
--  "lw     %[temp1],  "#C"(%[tmp])            \n\t"                \
--  "lw     %[temp2],  "#B"(%[tmp])            \n\t"                \
--  "lw     %[temp3],  "#D"(%[tmp])            \n\t"                \
-+  "lw     %[temp0],  " #A "(%[tmp])          \n\t"                \
-+  "lw     %[temp1],  " #C "(%[tmp])          \n\t"                \
-+  "lw     %[temp2],  " #B "(%[tmp])          \n\t"                \
-+  "lw     %[temp3],  " #D "(%[tmp])          \n\t"                \
-   "addu   %[temp8],  %[temp0],    %[temp1]   \n\t"                \
-   "subu   %[temp0],  %[temp0],    %[temp1]   \n\t"                \
-   "addu   %[temp1],  %[temp2],    %[temp3]   \n\t"                \
-@@ -412,71 +412,71 @@
- // temp0..temp15 holds tmp[0]..tmp[15]
- // A - offset in bytes to load from src and ref buffers
- // TEMP0..TEMP3 - registers for corresponding tmp elements
--#define HORIZONTAL_PASS(A, TEMP0, TEMP1, TEMP2, TEMP3)            \
--  "lw     %["#TEMP1"],  0(%[args])                       \n\t"    \
--  "lw     %["#TEMP2"],  4(%[args])                       \n\t"    \
--  "lbu    %[temp16],    0+"XSTR(BPS)"*"#A"(%["#TEMP1"])  \n\t"    \
--  "lbu    %[temp17],    0+"XSTR(BPS)"*"#A"(%["#TEMP2"])  \n\t"    \
--  "lbu    %[temp18],    1+"XSTR(BPS)"*"#A"(%["#TEMP1"])  \n\t"    \
--  "lbu    %[temp19],    1+"XSTR(BPS)"*"#A"(%["#TEMP2"])  \n\t"    \
--  "subu   %[temp20],    %[temp16],    %[temp17]          \n\t"    \
--  "lbu    %[temp16],    2+"XSTR(BPS)"*"#A"(%["#TEMP1"])  \n\t"    \
--  "lbu    %[temp17],    2+"XSTR(BPS)"*"#A"(%["#TEMP2"])  \n\t"    \
--  "subu   %["#TEMP0"],  %[temp18],    %[temp19]          \n\t"    \
--  "lbu    %[temp18],    3+"XSTR(BPS)"*"#A"(%["#TEMP1"])  \n\t"    \
--  "lbu    %[temp19],    3+"XSTR(BPS)"*"#A"(%["#TEMP2"])  \n\t"    \
--  "subu   %["#TEMP1"],  %[temp16],    %[temp17]          \n\t"    \
--  "subu   %["#TEMP2"],  %[temp18],    %[temp19]          \n\t"    \
--  "addu   %["#TEMP3"],  %[temp20],    %["#TEMP2"]        \n\t"    \
--  "subu   %["#TEMP2"],  %[temp20],    %["#TEMP2"]        \n\t"    \
--  "addu   %[temp20],    %["#TEMP0"],  %["#TEMP1"]        \n\t"    \
--  "subu   %["#TEMP0"],  %["#TEMP0"],  %["#TEMP1"]        \n\t"    \
--  "mul    %[temp16],    %["#TEMP2"],  %[c5352]           \n\t"    \
--  "mul    %[temp17],    %["#TEMP2"],  %[c2217]           \n\t"    \
--  "mul    %[temp18],    %["#TEMP0"],  %[c5352]           \n\t"    \
--  "mul    %[temp19],    %["#TEMP0"],  %[c2217]           \n\t"    \
--  "addu   %["#TEMP1"],  %["#TEMP3"],  %[temp20]          \n\t"    \
--  "subu   %[temp20],    %["#TEMP3"],  %[temp20]          \n\t"    \
--  "sll    %["#TEMP0"],  %["#TEMP1"],  3                  \n\t"    \
--  "sll    %["#TEMP2"],  %[temp20],    3                  \n\t"    \
--  "addiu  %[temp16],    %[temp16],    1812               \n\t"    \
--  "addiu  %[temp17],    %[temp17],    937                \n\t"    \
--  "addu   %[temp16],    %[temp16],    %[temp19]          \n\t"    \
--  "subu   %[temp17],    %[temp17],    %[temp18]          \n\t"    \
--  "sra    %["#TEMP1"],  %[temp16],    9                  \n\t"    \
--  "sra    %["#TEMP3"],  %[temp17],    9                  \n\t"
-+#define HORIZONTAL_PASS(A, TEMP0, TEMP1, TEMP2, TEMP3)                \
-+  "lw     %[" #TEMP1 "],  0(%[args])                         \n\t"    \
-+  "lw     %[" #TEMP2 "],  4(%[args])                         \n\t"    \
-+  "lbu    %[temp16],    0+"XSTR(BPS)"*" #A "(%[" #TEMP1 "])  \n\t"    \
-+  "lbu    %[temp17],    0+"XSTR(BPS)"*" #A "(%[" #TEMP2 "])  \n\t"    \
-+  "lbu    %[temp18],    1+"XSTR(BPS)"*" #A "(%[" #TEMP1 "])  \n\t"    \
-+  "lbu    %[temp19],    1+"XSTR(BPS)"*" #A "(%[" #TEMP2 "])  \n\t"    \
-+  "subu   %[temp20],    %[temp16],    %[temp17]              \n\t"    \
-+  "lbu    %[temp16],    2+"XSTR(BPS)"*" #A "(%[" #TEMP1 "])  \n\t"    \
-+  "lbu    %[temp17],    2+"XSTR(BPS)"*" #A "(%[" #TEMP2 "])  \n\t"    \
-+  "subu   %[" #TEMP0 "],  %[temp18],    %[temp19]            \n\t"    \
-+  "lbu    %[temp18],    3+"XSTR(BPS)"*" #A "(%[" #TEMP1 "])  \n\t"    \
-+  "lbu    %[temp19],    3+"XSTR(BPS)"*" #A "(%[" #TEMP2 "])  \n\t"    \
-+  "subu   %[" #TEMP1 "],  %[temp16],    %[temp17]            \n\t"    \
-+  "subu   %[" #TEMP2 "],  %[temp18],    %[temp19]            \n\t"    \
-+  "addu   %[" #TEMP3 "],  %[temp20],    %[" #TEMP2 "]        \n\t"    \
-+  "subu   %[" #TEMP2 "],  %[temp20],    %[" #TEMP2 "]        \n\t"    \
-+  "addu   %[temp20],    %[" #TEMP0 "],  %[" #TEMP1 "]        \n\t"    \
-+  "subu   %[" #TEMP0 "],  %[" #TEMP0 "],  %[" #TEMP1 "]      \n\t"    \
-+  "mul    %[temp16],    %[" #TEMP2 "],  %[c5352]             \n\t"    \
-+  "mul    %[temp17],    %[" #TEMP2 "],  %[c2217]             \n\t"    \
-+  "mul    %[temp18],    %[" #TEMP0 "],  %[c5352]             \n\t"    \
-+  "mul    %[temp19],    %[" #TEMP0 "],  %[c2217]             \n\t"    \
-+  "addu   %[" #TEMP1 "],  %[" #TEMP3 "],  %[temp20]          \n\t"    \
-+  "subu   %[temp20],    %[" #TEMP3 "],  %[temp20]            \n\t"    \
-+  "sll    %[" #TEMP0 "],  %[" #TEMP1 "],  3                  \n\t"    \
-+  "sll    %[" #TEMP2 "],  %[temp20],    3                    \n\t"    \
-+  "addiu  %[temp16],    %[temp16],    1812                   \n\t"    \
-+  "addiu  %[temp17],    %[temp17],    937                    \n\t"    \
-+  "addu   %[temp16],    %[temp16],    %[temp19]              \n\t"    \
-+  "subu   %[temp17],    %[temp17],    %[temp18]              \n\t"    \
-+  "sra    %[" #TEMP1 "],  %[temp16],    9                    \n\t"    \
-+  "sra    %[" #TEMP3 "],  %[temp17],    9                    \n\t"
- 
- // macro for one vertical pass in FTransform
- // temp0..temp15 holds tmp[0]..tmp[15]
- // A..D - offsets in bytes to store to out buffer
- // TEMP0, TEMP4, TEMP8 and TEMP12 - registers for corresponding tmp elements
--#define VERTICAL_PASS(A, B, C, D, TEMP0, TEMP4, TEMP8, TEMP12)  \
--  "addu   %[temp16],    %["#TEMP0"],  %["#TEMP12"]     \n\t"    \
--  "subu   %[temp19],    %["#TEMP0"],  %["#TEMP12"]     \n\t"    \
--  "addu   %[temp17],    %["#TEMP4"],  %["#TEMP8"]      \n\t"    \
--  "subu   %[temp18],    %["#TEMP4"],  %["#TEMP8"]      \n\t"    \
--  "mul    %["#TEMP8"],  %[temp19],    %[c2217]         \n\t"    \
--  "mul    %["#TEMP12"], %[temp18],    %[c2217]         \n\t"    \
--  "mul    %["#TEMP4"],  %[temp19],    %[c5352]         \n\t"    \
--  "mul    %[temp18],    %[temp18],    %[c5352]         \n\t"    \
--  "addiu  %[temp16],    %[temp16],    7                \n\t"    \
--  "addu   %["#TEMP0"],  %[temp16],    %[temp17]        \n\t"    \
--  "sra    %["#TEMP0"],  %["#TEMP0"],  4                \n\t"    \
--  "addu   %["#TEMP12"], %["#TEMP12"], %["#TEMP4"]      \n\t"    \
--  "subu   %["#TEMP4"],  %[temp16],    %[temp17]        \n\t"    \
--  "sra    %["#TEMP4"],  %["#TEMP4"],  4                \n\t"    \
--  "addiu  %["#TEMP8"],  %["#TEMP8"],  30000            \n\t"    \
--  "addiu  %["#TEMP12"], %["#TEMP12"], 12000            \n\t"    \
--  "addiu  %["#TEMP8"],  %["#TEMP8"],  21000            \n\t"    \
--  "subu   %["#TEMP8"],  %["#TEMP8"],  %[temp18]        \n\t"    \
--  "sra    %["#TEMP12"], %["#TEMP12"], 16               \n\t"    \
--  "sra    %["#TEMP8"],  %["#TEMP8"],  16               \n\t"    \
--  "addiu  %[temp16],    %["#TEMP12"], 1                \n\t"    \
--  "movn   %["#TEMP12"], %[temp16],    %[temp19]        \n\t"    \
--  "sh     %["#TEMP0"],  "#A"(%[temp20])                \n\t"    \
--  "sh     %["#TEMP4"],  "#C"(%[temp20])                \n\t"    \
--  "sh     %["#TEMP8"],  "#D"(%[temp20])                \n\t"    \
--  "sh     %["#TEMP12"], "#B"(%[temp20])                \n\t"
-+#define VERTICAL_PASS(A, B, C, D, TEMP0, TEMP4, TEMP8, TEMP12)    \
-+  "addu   %[temp16],    %[" #TEMP0 "],  %[" #TEMP12 "]   \n\t"    \
-+  "subu   %[temp19],    %[" #TEMP0 "],  %[" #TEMP12 "]   \n\t"    \
-+  "addu   %[temp17],    %[" #TEMP4 "],  %[" #TEMP8 "]    \n\t"    \
-+  "subu   %[temp18],    %[" #TEMP4 "],  %[" #TEMP8 "]    \n\t"    \
-+  "mul    %[" #TEMP8 "],  %[temp19],    %[c2217]         \n\t"    \
-+  "mul    %[" #TEMP12 "], %[temp18],    %[c2217]         \n\t"    \
-+  "mul    %[" #TEMP4 "],  %[temp19],    %[c5352]         \n\t"    \
-+  "mul    %[temp18],    %[temp18],    %[c5352]           \n\t"    \
-+  "addiu  %[temp16],    %[temp16],    7                  \n\t"    \
-+  "addu   %[" #TEMP0 "],  %[temp16],    %[temp17]        \n\t"    \
-+  "sra    %[" #TEMP0 "],  %[" #TEMP0 "],  4              \n\t"    \
-+  "addu   %[" #TEMP12 "], %[" #TEMP12 "], %[" #TEMP4 "]  \n\t"    \
-+  "subu   %[" #TEMP4 "],  %[temp16],    %[temp17]        \n\t"    \
-+  "sra    %[" #TEMP4 "],  %[" #TEMP4 "],  4              \n\t"    \
-+  "addiu  %[" #TEMP8 "],  %[" #TEMP8 "],  30000          \n\t"    \
-+  "addiu  %[" #TEMP12 "], %[" #TEMP12 "], 12000          \n\t"    \
-+  "addiu  %[" #TEMP8 "],  %[" #TEMP8 "],  21000          \n\t"    \
-+  "subu   %[" #TEMP8 "],  %[" #TEMP8 "],  %[temp18]      \n\t"    \
-+  "sra    %[" #TEMP12 "], %[" #TEMP12 "], 16             \n\t"    \
-+  "sra    %[" #TEMP8 "],  %[" #TEMP8 "],  16             \n\t"    \
-+  "addiu  %[temp16],    %[" #TEMP12 "], 1                \n\t"    \
-+  "movn   %[" #TEMP12 "], %[temp16],    %[temp19]        \n\t"    \
-+  "sh     %[" #TEMP0 "],  " #A "(%[temp20])              \n\t"    \
-+  "sh     %[" #TEMP4 "],  " #C "(%[temp20])              \n\t"    \
-+  "sh     %[" #TEMP8 "],  " #D "(%[temp20])              \n\t"    \
-+  "sh     %[" #TEMP12 "], " #B "(%[temp20])              \n\t"
- 
- static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) {
-   int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8;
-@@ -516,14 +516,14 @@
- #if !defined(WORK_AROUND_GCC)
- 
- #define GET_SSE_INNER(A, B, C, D)                               \
--  "lbu     %[temp0],    "#A"(%[a])                   \n\t"      \
--  "lbu     %[temp1],    "#A"(%[b])                   \n\t"      \
--  "lbu     %[temp2],    "#B"(%[a])                   \n\t"      \
--  "lbu     %[temp3],    "#B"(%[b])                   \n\t"      \
--  "lbu     %[temp4],    "#C"(%[a])                   \n\t"      \
--  "lbu     %[temp5],    "#C"(%[b])                   \n\t"      \
--  "lbu     %[temp6],    "#D"(%[a])                   \n\t"      \
--  "lbu     %[temp7],    "#D"(%[b])                   \n\t"      \
-+  "lbu     %[temp0],    " #A "(%[a])                 \n\t"      \
-+  "lbu     %[temp1],    " #A "(%[b])                 \n\t"      \
-+  "lbu     %[temp2],    " #B "(%[a])                 \n\t"      \
-+  "lbu     %[temp3],    " #B "(%[b])                 \n\t"      \
-+  "lbu     %[temp4],    " #C "(%[a])                 \n\t"      \
-+  "lbu     %[temp5],    " #C "(%[b])                 \n\t"      \
-+  "lbu     %[temp6],    " #D "(%[a])                 \n\t"      \
-+  "lbu     %[temp7],    " #D "(%[b])                 \n\t"      \
-   "subu    %[temp0],    %[temp0],     %[temp1]       \n\t"      \
-   "subu    %[temp2],    %[temp2],     %[temp3]       \n\t"      \
-   "subu    %[temp4],    %[temp4],     %[temp5]       \n\t"      \
-diff --git a/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c b/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c
-index 56db07c..44f6fd2 100644
---- a/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c
-+++ b/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c
-@@ -27,25 +27,25 @@
- // I - input (macro doesn't change it)
- #define ADD_SUB_HALVES_X4(O0, O1, O2, O3, O4, O5, O6, O7,                      \
-                           I0, I1, I2, I3, I4, I5, I6, I7)                      \
--  "addq.ph          %["#O0"],   %["#I0"],  %["#I1"]           \n\t"            \
--  "subq.ph          %["#O1"],   %["#I0"],  %["#I1"]           \n\t"            \
--  "addq.ph          %["#O2"],   %["#I2"],  %["#I3"]           \n\t"            \
--  "subq.ph          %["#O3"],   %["#I2"],  %["#I3"]           \n\t"            \
--  "addq.ph          %["#O4"],   %["#I4"],  %["#I5"]           \n\t"            \
--  "subq.ph          %["#O5"],   %["#I4"],  %["#I5"]           \n\t"            \
--  "addq.ph          %["#O6"],   %["#I6"],  %["#I7"]           \n\t"            \
--  "subq.ph          %["#O7"],   %["#I6"],  %["#I7"]           \n\t"
-+  "addq.ph          %[" #O0 "],   %[" #I0 "],  %[" #I1 "]     \n\t"            \
-+  "subq.ph          %[" #O1 "],   %[" #I0 "],  %[" #I1 "]     \n\t"            \
-+  "addq.ph          %[" #O2 "],   %[" #I2 "],  %[" #I3 "]     \n\t"            \
-+  "subq.ph          %[" #O3 "],   %[" #I2 "],  %[" #I3 "]     \n\t"            \
-+  "addq.ph          %[" #O4 "],   %[" #I4 "],  %[" #I5 "]     \n\t"            \
-+  "subq.ph          %[" #O5 "],   %[" #I4 "],  %[" #I5 "]     \n\t"            \
-+  "addq.ph          %[" #O6 "],   %[" #I6 "],  %[" #I7 "]     \n\t"            \
-+  "subq.ph          %[" #O7 "],   %[" #I6 "],  %[" #I7 "]     \n\t"
- 
- // IO - input/output
- #define ABS_X8(IO0, IO1, IO2, IO3, IO4, IO5, IO6, IO7)                         \
--  "absq_s.ph        %["#IO0"],   %["#IO0"]                    \n\t"            \
--  "absq_s.ph        %["#IO1"],   %["#IO1"]                    \n\t"            \
--  "absq_s.ph        %["#IO2"],   %["#IO2"]                    \n\t"            \
--  "absq_s.ph        %["#IO3"],   %["#IO3"]                    \n\t"            \
--  "absq_s.ph        %["#IO4"],   %["#IO4"]                    \n\t"            \
--  "absq_s.ph        %["#IO5"],   %["#IO5"]                    \n\t"            \
--  "absq_s.ph        %["#IO6"],   %["#IO6"]                    \n\t"            \
--  "absq_s.ph        %["#IO7"],   %["#IO7"]                    \n\t"
-+  "absq_s.ph        %[" #IO0 "],   %[" #IO0 "]                \n\t"            \
-+  "absq_s.ph        %[" #IO1 "],   %[" #IO1 "]                \n\t"            \
-+  "absq_s.ph        %[" #IO2 "],   %[" #IO2 "]                \n\t"            \
-+  "absq_s.ph        %[" #IO3 "],   %[" #IO3 "]                \n\t"            \
-+  "absq_s.ph        %[" #IO4 "],   %[" #IO4 "]                \n\t"            \
-+  "absq_s.ph        %[" #IO5 "],   %[" #IO5 "]                \n\t"            \
-+  "absq_s.ph        %[" #IO6 "],   %[" #IO6 "]                \n\t"            \
-+  "absq_s.ph        %[" #IO7 "],   %[" #IO7 "]                \n\t"
- 
- // dpa.w.ph $ac0 temp0 ,temp1
- //  $ac += temp0[31..16] * temp1[31..16] + temp0[15..0] * temp1[15..0]
-@@ -56,15 +56,15 @@
- #define MUL_HALF(O0, I0, I1, I2, I3, I4, I5, I6, I7,                           \
-                  I8, I9, I10, I11, I12, I13, I14, I15)                         \
-     "mult            $ac0,      $zero,     $zero              \n\t"            \
--    "dpa.w.ph        $ac0,      %["#I2"],  %["#I0"]           \n\t"            \
--    "dpax.w.ph       $ac0,      %["#I5"],  %["#I6"]           \n\t"            \
--    "dpa.w.ph        $ac0,      %["#I8"],  %["#I9"]           \n\t"            \
--    "dpax.w.ph       $ac0,      %["#I11"], %["#I4"]           \n\t"            \
--    "dpa.w.ph        $ac0,      %["#I12"], %["#I7"]           \n\t"            \
--    "dpax.w.ph       $ac0,      %["#I13"], %["#I1"]           \n\t"            \
--    "dpa.w.ph        $ac0,      %["#I14"], %["#I3"]           \n\t"            \
--    "dpax.w.ph       $ac0,      %["#I15"], %["#I10"]          \n\t"            \
--    "mflo            %["#O0"],  $ac0                          \n\t"
-+    "dpa.w.ph        $ac0,      %[" #I2 "],  %[" #I0 "]       \n\t"            \
-+    "dpax.w.ph       $ac0,      %[" #I5 "],  %[" #I6 "]       \n\t"            \
-+    "dpa.w.ph        $ac0,      %[" #I8 "],  %[" #I9 "]       \n\t"            \
-+    "dpax.w.ph       $ac0,      %[" #I11 "], %[" #I4 "]       \n\t"            \
-+    "dpa.w.ph        $ac0,      %[" #I12 "], %[" #I7 "]       \n\t"            \
-+    "dpax.w.ph       $ac0,      %[" #I13 "], %[" #I1 "]       \n\t"            \
-+    "dpa.w.ph        $ac0,      %[" #I14 "], %[" #I3 "]       \n\t"            \
-+    "dpax.w.ph       $ac0,      %[" #I15 "], %[" #I10 "]      \n\t"            \
-+    "mflo            %[" #O0 "],  $ac0                        \n\t"
- 
- #define OUTPUT_EARLY_CLOBBER_REGS_17()                                         \
-   OUTPUT_EARLY_CLOBBER_REGS_10(),                                              \
-@@ -77,69 +77,69 @@
- // A - offset in bytes to load from src and ref buffers
- // TEMP0..TEMP3 - registers for corresponding tmp elements
- #define HORIZONTAL_PASS(A, TEMP0, TEMP1, TEMP2, TEMP3)                         \
--  "lw              %["#TEMP0"],   0(%[args])                        \n\t"      \
--  "lw              %["#TEMP1"],   4(%[args])                        \n\t"      \
--  "lw              %["#TEMP2"],   "XSTR(BPS)"*"#A"(%["#TEMP0"])     \n\t"      \
--  "lw              %["#TEMP3"],   "XSTR(BPS)"*"#A"(%["#TEMP1"])     \n\t"      \
--  "preceu.ph.qbl   %["#TEMP0"],   %["#TEMP2"]                       \n\t"      \
--  "preceu.ph.qbl   %["#TEMP1"],   %["#TEMP3"]                       \n\t"      \
--  "preceu.ph.qbr   %["#TEMP2"],   %["#TEMP2"]                       \n\t"      \
--  "preceu.ph.qbr   %["#TEMP3"],   %["#TEMP3"]                       \n\t"      \
--  "subq.ph         %["#TEMP0"],   %["#TEMP0"],   %["#TEMP1"]        \n\t"      \
--  "subq.ph         %["#TEMP2"],   %["#TEMP2"],   %["#TEMP3"]        \n\t"      \
--  "rotr            %["#TEMP0"],   %["#TEMP0"],   16                 \n\t"      \
--  "addq.ph         %["#TEMP1"],   %["#TEMP2"],   %["#TEMP0"]        \n\t"      \
--  "subq.ph         %["#TEMP3"],   %["#TEMP2"],   %["#TEMP0"]        \n\t"      \
--  "seh             %["#TEMP0"],   %["#TEMP1"]                       \n\t"      \
--  "sra             %[temp16],     %["#TEMP1"],   16                 \n\t"      \
--  "seh             %[temp19],     %["#TEMP3"]                       \n\t"      \
--  "sra             %["#TEMP3"],   %["#TEMP3"],   16                 \n\t"      \
--  "subu            %["#TEMP2"],   %["#TEMP0"],   %[temp16]          \n\t"      \
--  "addu            %["#TEMP0"],   %["#TEMP0"],   %[temp16]          \n\t"      \
--  "mul             %[temp17],     %[temp19],     %[c2217]           \n\t"      \
--  "mul             %[temp18],     %["#TEMP3"],   %[c5352]           \n\t"      \
--  "mul             %["#TEMP1"],   %[temp19],     %[c5352]           \n\t"      \
--  "mul             %[temp16],     %["#TEMP3"],   %[c2217]           \n\t"      \
--  "sll             %["#TEMP2"],   %["#TEMP2"],   3                  \n\t"      \
--  "sll             %["#TEMP0"],   %["#TEMP0"],   3                  \n\t"      \
--  "subu            %["#TEMP3"],   %[temp17],     %[temp18]          \n\t"      \
--  "addu            %["#TEMP1"],   %[temp16],     %["#TEMP1"]        \n\t"      \
--  "addiu           %["#TEMP3"],   %["#TEMP3"],   937                \n\t"      \
--  "addiu           %["#TEMP1"],   %["#TEMP1"],   1812               \n\t"      \
--  "sra             %["#TEMP3"],   %["#TEMP3"],   9                  \n\t"      \
--  "sra             %["#TEMP1"],   %["#TEMP1"],   9                  \n\t"
-+  "lw              %[" #TEMP0 "],   0(%[args])                          \n\t"  \
-+  "lw              %[" #TEMP1 "],   4(%[args])                          \n\t"  \
-+  "lw              %[" #TEMP2 "],   "XSTR(BPS)"*" #A "(%[" #TEMP0 "])   \n\t"  \
-+  "lw              %[" #TEMP3 "],   "XSTR(BPS)"*" #A "(%[" #TEMP1 "])   \n\t"  \
-+  "preceu.ph.qbl   %[" #TEMP0 "],   %[" #TEMP2 "]                       \n\t"  \
-+  "preceu.ph.qbl   %[" #TEMP1 "],   %[" #TEMP3 "]                       \n\t"  \
-+  "preceu.ph.qbr   %[" #TEMP2 "],   %[" #TEMP2 "]                       \n\t"  \
-+  "preceu.ph.qbr   %[" #TEMP3 "],   %[" #TEMP3 "]                       \n\t"  \
-+  "subq.ph         %[" #TEMP0 "],   %[" #TEMP0 "],   %[" #TEMP1 "]      \n\t"  \
-+  "subq.ph         %[" #TEMP2 "],   %[" #TEMP2 "],   %[" #TEMP3 "]      \n\t"  \
-+  "rotr            %[" #TEMP0 "],   %[" #TEMP0 "],   16                 \n\t"  \
-+  "addq.ph         %[" #TEMP1 "],   %[" #TEMP2 "],   %[" #TEMP0 "]      \n\t"  \
-+  "subq.ph         %[" #TEMP3 "],   %[" #TEMP2 "],   %[" #TEMP0 "]      \n\t"  \
-+  "seh             %[" #TEMP0 "],   %[" #TEMP1 "]                       \n\t"  \
-+  "sra             %[temp16],     %[" #TEMP1 "],   16                   \n\t"  \
-+  "seh             %[temp19],     %[" #TEMP3 "]                         \n\t"  \
-+  "sra             %[" #TEMP3 "],   %[" #TEMP3 "],   16                 \n\t"  \
-+  "subu            %[" #TEMP2 "],   %[" #TEMP0 "],   %[temp16]          \n\t"  \
-+  "addu            %[" #TEMP0 "],   %[" #TEMP0 "],   %[temp16]          \n\t"  \
-+  "mul             %[temp17],     %[temp19],     %[c2217]               \n\t"  \
-+  "mul             %[temp18],     %[" #TEMP3 "],   %[c5352]             \n\t"  \
-+  "mul             %[" #TEMP1 "],   %[temp19],     %[c5352]             \n\t"  \
-+  "mul             %[temp16],     %[" #TEMP3 "],   %[c2217]             \n\t"  \
-+  "sll             %[" #TEMP2 "],   %[" #TEMP2 "],   3                  \n\t"  \
-+  "sll             %[" #TEMP0 "],   %[" #TEMP0 "],   3                  \n\t"  \
-+  "subu            %[" #TEMP3 "],   %[temp17],     %[temp18]            \n\t"  \
-+  "addu            %[" #TEMP1 "],   %[temp16],     %[" #TEMP1 "]        \n\t"  \
-+  "addiu           %[" #TEMP3 "],   %[" #TEMP3 "],   937                \n\t"  \
-+  "addiu           %[" #TEMP1 "],   %[" #TEMP1 "],   1812               \n\t"  \
-+  "sra             %[" #TEMP3 "],   %[" #TEMP3 "],   9                  \n\t"  \
-+  "sra             %[" #TEMP1 "],   %[" #TEMP1 "],   9                  \n\t"
- 
- // macro for one vertical pass in FTransform
- // temp0..temp15 holds tmp[0]..tmp[15]
- // A..D - offsets in bytes to store to out buffer
- // TEMP0, TEMP4, TEMP8 and TEMP12 - registers for corresponding tmp elements
- #define VERTICAL_PASS(A, B, C, D, TEMP0, TEMP4, TEMP8, TEMP12)                 \
--  "addu            %[temp16],     %["#TEMP0"],   %["#TEMP12"] \n\t"            \
--  "subu            %[temp19],     %["#TEMP0"],   %["#TEMP12"] \n\t"            \
--  "addu            %[temp17],     %["#TEMP4"],   %["#TEMP8"]  \n\t"            \
--  "subu            %[temp18],     %["#TEMP4"],   %["#TEMP8"]  \n\t"            \
--  "mul             %["#TEMP8"],   %[temp19],     %[c2217]     \n\t"            \
--  "mul             %["#TEMP12"],  %[temp18],     %[c2217]     \n\t"            \
--  "mul             %["#TEMP4"],   %[temp19],     %[c5352]     \n\t"            \
--  "mul             %[temp18],     %[temp18],     %[c5352]     \n\t"            \
--  "addiu           %[temp16],     %[temp16],     7            \n\t"            \
--  "addu            %["#TEMP0"],   %[temp16],     %[temp17]    \n\t"            \
--  "sra             %["#TEMP0"],   %["#TEMP0"],   4            \n\t"            \
--  "addu            %["#TEMP12"],  %["#TEMP12"],  %["#TEMP4"]  \n\t"            \
--  "subu            %["#TEMP4"],   %[temp16],     %[temp17]    \n\t"            \
--  "sra             %["#TEMP4"],   %["#TEMP4"],   4            \n\t"            \
--  "addiu           %["#TEMP8"],   %["#TEMP8"],   30000        \n\t"            \
--  "addiu           %["#TEMP12"],  %["#TEMP12"],  12000        \n\t"            \
--  "addiu           %["#TEMP8"],   %["#TEMP8"],   21000        \n\t"            \
--  "subu            %["#TEMP8"],   %["#TEMP8"],   %[temp18]    \n\t"            \
--  "sra             %["#TEMP12"],  %["#TEMP12"],  16           \n\t"            \
--  "sra             %["#TEMP8"],   %["#TEMP8"],   16           \n\t"            \
--  "addiu           %[temp16],     %["#TEMP12"],  1            \n\t"            \
--  "movn            %["#TEMP12"],  %[temp16],     %[temp19]    \n\t"            \
--  "sh              %["#TEMP0"],   "#A"(%[temp20])             \n\t"            \
--  "sh              %["#TEMP4"],   "#C"(%[temp20])             \n\t"            \
--  "sh              %["#TEMP8"],   "#D"(%[temp20])             \n\t"            \
--  "sh              %["#TEMP12"],  "#B"(%[temp20])             \n\t"
-+  "addu            %[temp16],     %[" #TEMP0 "],   %[" #TEMP12 "]   \n\t"      \
-+  "subu            %[temp19],     %[" #TEMP0 "],   %[" #TEMP12 "]   \n\t"      \
-+  "addu            %[temp17],     %[" #TEMP4 "],   %[" #TEMP8 "]    \n\t"      \
-+  "subu            %[temp18],     %[" #TEMP4 "],   %[" #TEMP8 "]    \n\t"      \
-+  "mul             %[" #TEMP8 "],   %[temp19],     %[c2217]         \n\t"      \
-+  "mul             %[" #TEMP12 "],  %[temp18],     %[c2217]         \n\t"      \
-+  "mul             %[" #TEMP4 "],   %[temp19],     %[c5352]         \n\t"      \
-+  "mul             %[temp18],     %[temp18],     %[c5352]           \n\t"      \
-+  "addiu           %[temp16],     %[temp16],     7                  \n\t"      \
-+  "addu            %[" #TEMP0 "],   %[temp16],     %[temp17]        \n\t"      \
-+  "sra             %[" #TEMP0 "],   %[" #TEMP0 "],   4              \n\t"      \
-+  "addu            %[" #TEMP12 "],  %[" #TEMP12 "],  %[" #TEMP4 "]  \n\t"      \
-+  "subu            %[" #TEMP4 "],   %[temp16],     %[temp17]        \n\t"      \
-+  "sra             %[" #TEMP4 "],   %[" #TEMP4 "],   4              \n\t"      \
-+  "addiu           %[" #TEMP8 "],   %[" #TEMP8 "],   30000          \n\t"      \
-+  "addiu           %[" #TEMP12 "],  %[" #TEMP12 "],  12000          \n\t"      \
-+  "addiu           %[" #TEMP8 "],   %[" #TEMP8 "],   21000          \n\t"      \
-+  "subu            %[" #TEMP8 "],   %[" #TEMP8 "],   %[temp18]      \n\t"      \
-+  "sra             %[" #TEMP12 "],  %[" #TEMP12 "],  16             \n\t"      \
-+  "sra             %[" #TEMP8 "],   %[" #TEMP8 "],   16             \n\t"      \
-+  "addiu           %[temp16],     %[" #TEMP12 "],  1                \n\t"      \
-+  "movn            %[" #TEMP12 "],  %[temp16],     %[temp19]        \n\t"      \
-+  "sh              %[" #TEMP0 "],   " #A "(%[temp20])               \n\t"      \
-+  "sh              %[" #TEMP4 "],   " #C "(%[temp20])               \n\t"      \
-+  "sh              %[" #TEMP8 "],   " #D "(%[temp20])               \n\t"      \
-+  "sh              %[" #TEMP12 "],  " #B "(%[temp20])               \n\t"
- 
- static void FTransform(const uint8_t* src, const uint8_t* ref, int16_t* out) {
-   const int c2217 = 2217;
-@@ -329,11 +329,11 @@
- // Intra predictions
- 
- #define FILL_PART(J, SIZE)                                          \
--    "usw        %[value],  0+"#J"*"XSTR(BPS)"(%[dst])    \n\t"      \
--    "usw        %[value],  4+"#J"*"XSTR(BPS)"(%[dst])    \n\t"      \
--  ".if "#SIZE" == 16                                     \n\t"      \
--    "usw        %[value],  8+"#J"*"XSTR(BPS)"(%[dst])    \n\t"      \
--    "usw        %[value], 12+"#J"*"XSTR(BPS)"(%[dst])    \n\t"      \
-+    "usw        %[value],  0+" #J "*"XSTR(BPS)"(%[dst])  \n\t"      \
-+    "usw        %[value],  4+" #J "*"XSTR(BPS)"(%[dst])  \n\t"      \
-+  ".if " #SIZE " == 16                                   \n\t"      \
-+    "usw        %[value],  8+" #J "*"XSTR(BPS)"(%[dst])  \n\t"      \
-+    "usw        %[value], 12+" #J "*"XSTR(BPS)"(%[dst])  \n\t"      \
-   ".endif                                                \n\t"
- 
- #define FILL_8_OR_16(DST, VALUE, SIZE) do {                         \
-@@ -348,7 +348,7 @@
-     FILL_PART( 5, SIZE)                                             \
-     FILL_PART( 6, SIZE)                                             \
-     FILL_PART( 7, SIZE)                                             \
--  ".if "#SIZE" == 16                                     \n\t"      \
-+  ".if " #SIZE " == 16                                   \n\t"      \
-     FILL_PART( 8, 16)                                               \
-     FILL_PART( 9, 16)                                               \
-     FILL_PART(10, 16)                                               \
-@@ -425,7 +425,7 @@
-     CLIPPING()                                                                 \
-     "usw             %[temp0],   0(%[dst])               \n\t"                 \
-     "usw             %[temp1],   4(%[dst])               \n\t"                 \
--  ".if "#SIZE" == 16                                     \n\t"                 \
-+  ".if " #SIZE " == 16                                   \n\t"                 \
-     "ulw             %[temp0],   8(%[top])               \n\t"                 \
-     "ulw             %[temp1],   12(%[top])              \n\t"                 \
-     CLIPPING()                                                                 \
-@@ -1060,8 +1060,8 @@
- #if !defined(WORK_AROUND_GCC)
- 
- #define GET_SSE_INNER(A)                                                  \
--  "lw               %[temp0],    "#A"(%[a])                    \n\t"      \
--  "lw               %[temp1],    "#A"(%[b])                    \n\t"      \
-+  "lw               %[temp0],    " #A "(%[a])                  \n\t"      \
-+  "lw               %[temp1],    " #A "(%[b])                  \n\t"      \
-   "preceu.ph.qbr    %[temp2],    %[temp0]                      \n\t"      \
-   "preceu.ph.qbl    %[temp0],    %[temp0]                      \n\t"      \
-   "preceu.ph.qbr    %[temp3],    %[temp1]                      \n\t"      \
-@@ -1185,28 +1185,28 @@
- // N - offset in bytes (n * 2)
- // N1 - offset in bytes ((n + 1) * 2)
- #define QUANTIZE_ONE(J, K, N, N1)                                         \
--  "ulw         %[temp1],     "#J"(%[ppin])                   \n\t"        \
--  "ulw         %[temp2],     "#J"(%[ppsharpen])              \n\t"        \
--  "lhu         %[temp3],     "#K"(%[ppzthresh])              \n\t"        \
--  "lhu         %[temp6],     "#K"+4(%[ppzthresh])            \n\t"        \
-+  "ulw         %[temp1],     " #J "(%[ppin])                 \n\t"        \
-+  "ulw         %[temp2],     " #J "(%[ppsharpen])            \n\t"        \
-+  "lhu         %[temp3],     " #K "(%[ppzthresh])            \n\t"        \
-+  "lhu         %[temp6],     " #K "+4(%[ppzthresh])          \n\t"        \
-   "absq_s.ph   %[temp4],     %[temp1]                        \n\t"        \
-   "ins         %[temp3],     %[temp6],         16,       16  \n\t"        \
-   "addu.ph     %[coeff],     %[temp4],         %[temp2]      \n\t"        \
-   "shra.ph     %[sign],      %[temp1],         15            \n\t"        \
-   "li          %[level],     0x10001                         \n\t"        \
-   "cmp.lt.ph   %[temp3],     %[coeff]                        \n\t"        \
--  "lhu         %[temp1],     "#J"(%[ppiq])                   \n\t"        \
-+  "lhu         %[temp1],     " #J "(%[ppiq])                 \n\t"        \
-   "pick.ph     %[temp5],     %[level],         $0            \n\t"        \
--  "lw          %[temp2],     "#K"(%[ppbias])                 \n\t"        \
-+  "lw          %[temp2],     " #K "(%[ppbias])               \n\t"        \
-   "beqz        %[temp5],     0f                              \n\t"        \
--  "lhu         %[temp3],     "#J"(%[ppq])                    \n\t"        \
-+  "lhu         %[temp3],     " #J "(%[ppq])                  \n\t"        \
-   "beq         %[temp5],     %[level],         1f            \n\t"        \
-   "andi        %[temp5],     %[temp5],         0x1           \n\t"        \
-   "andi        %[temp4],     %[coeff],         0xffff        \n\t"        \
-   "beqz        %[temp5],     2f                              \n\t"        \
-   "mul         %[level],     %[temp4],         %[temp1]      \n\t"        \
--  "sh          $0,           "#J"+2(%[ppin])                 \n\t"        \
--  "sh          $0,           "#N1"(%[pout])                  \n\t"        \
-+  "sh          $0,           " #J "+2(%[ppin])               \n\t"        \
-+  "sh          $0,           " #N1 "(%[pout])                \n\t"        \
-   "addu        %[level],     %[level],         %[temp2]      \n\t"        \
-   "sra         %[level],     %[level],         17            \n\t"        \
-   "slt         %[temp4],     %[max_level],     %[level]      \n\t"        \
-@@ -1216,15 +1216,15 @@
-   "subu        %[level],     %[level],         %[temp6]      \n\t"        \
-   "mul         %[temp5],     %[level],         %[temp3]      \n\t"        \
-   "or          %[ret],       %[ret],           %[level]      \n\t"        \
--  "sh          %[level],     "#N"(%[pout])                   \n\t"        \
--  "sh          %[temp5],     "#J"(%[ppin])                   \n\t"        \
-+  "sh          %[level],     " #N "(%[pout])                 \n\t"        \
-+  "sh          %[temp5],     " #J "(%[ppin])                 \n\t"        \
-   "j           3f                                            \n\t"        \
- "2:                                                          \n\t"        \
--  "lhu         %[temp1],     "#J"+2(%[ppiq])                 \n\t"        \
-+  "lhu         %[temp1],     " #J "+2(%[ppiq])               \n\t"        \
-   "srl         %[temp5],     %[coeff],         16            \n\t"        \
-   "mul         %[level],     %[temp5],         %[temp1]      \n\t"        \
--  "lw          %[temp2],     "#K"+4(%[ppbias])               \n\t"        \
--  "lhu         %[temp3],     "#J"+2(%[ppq])                  \n\t"        \
-+  "lw          %[temp2],     " #K "+4(%[ppbias])             \n\t"        \
-+  "lhu         %[temp3],     " #J "+2(%[ppq])                \n\t"        \
-   "addu        %[level],     %[level],         %[temp2]      \n\t"        \
-   "sra         %[level],     %[level],         17            \n\t"        \
-   "srl         %[temp6],     %[sign],          16            \n\t"        \
-@@ -1233,20 +1233,20 @@
-   "xor         %[level],     %[level],         %[temp6]      \n\t"        \
-   "subu        %[level],     %[level],         %[temp6]      \n\t"        \
-   "mul         %[temp5],     %[level],         %[temp3]      \n\t"        \
--  "sh          $0,           "#J"(%[ppin])                   \n\t"        \
--  "sh          $0,           "#N"(%[pout])                   \n\t"        \
-+  "sh          $0,           " #J "(%[ppin])                 \n\t"        \
-+  "sh          $0,           " #N "(%[pout])                 \n\t"        \
-   "or          %[ret],       %[ret],           %[level]      \n\t"        \
--  "sh          %[temp5],     "#J"+2(%[ppin])                 \n\t"        \
--  "sh          %[level],     "#N1"(%[pout])                  \n\t"        \
-+  "sh          %[temp5],     " #J "+2(%[ppin])               \n\t"        \
-+  "sh          %[level],     " #N1 "(%[pout])                \n\t"        \
-   "j           3f                                            \n\t"        \
- "1:                                                          \n\t"        \
--  "lhu         %[temp1],     "#J"(%[ppiq])                   \n\t"        \
--  "lw          %[temp2],     "#K"(%[ppbias])                 \n\t"        \
--  "ulw         %[temp3],     "#J"(%[ppq])                    \n\t"        \
-+  "lhu         %[temp1],     " #J "(%[ppiq])                 \n\t"        \
-+  "lw          %[temp2],     " #K "(%[ppbias])               \n\t"        \
-+  "ulw         %[temp3],     " #J "(%[ppq])                  \n\t"        \
-   "andi        %[temp5],     %[coeff],         0xffff        \n\t"        \
-   "srl         %[temp0],     %[coeff],         16            \n\t"        \
--  "lhu         %[temp6],     "#J"+2(%[ppiq])                 \n\t"        \
--  "lw          %[coeff],     "#K"+4(%[ppbias])               \n\t"        \
-+  "lhu         %[temp6],     " #J "+2(%[ppiq])               \n\t"        \
-+  "lw          %[coeff],     " #K "+4(%[ppbias])             \n\t"        \
-   "mul         %[level],     %[temp5],         %[temp1]      \n\t"        \
-   "mul         %[temp4],     %[temp0],         %[temp6]      \n\t"        \
-   "addu        %[level],     %[level],         %[temp2]      \n\t"        \
-@@ -1259,15 +1259,15 @@
-   "subu.ph     %[level],     %[level],         %[sign]       \n\t"        \
-   "mul.ph      %[temp3],     %[level],         %[temp3]      \n\t"        \
-   "or          %[ret],       %[ret],           %[level]      \n\t"        \
--  "sh          %[level],     "#N"(%[pout])                   \n\t"        \
-+  "sh          %[level],     " #N "(%[pout])                 \n\t"        \
-   "srl         %[level],     %[level],         16            \n\t"        \
--  "sh          %[level],     "#N1"(%[pout])                  \n\t"        \
--  "usw         %[temp3],     "#J"(%[ppin])                   \n\t"        \
-+  "sh          %[level],     " #N1 "(%[pout])                \n\t"        \
-+  "usw         %[temp3],     " #J "(%[ppin])                 \n\t"        \
-   "j           3f                                            \n\t"        \
- "0:                                                          \n\t"        \
--  "sh          $0,           "#N"(%[pout])                   \n\t"        \
--  "sh          $0,           "#N1"(%[pout])                  \n\t"        \
--  "usw         $0,           "#J"(%[ppin])                   \n\t"        \
-+  "sh          $0,           " #N "(%[pout])                 \n\t"        \
-+  "sh          $0,           " #N1 "(%[pout])                \n\t"        \
-+  "usw         $0,           " #J "(%[ppin])                 \n\t"        \
- "3:                                                          \n\t"
- 
- static int QuantizeBlock(int16_t in[16], int16_t out[16],
-@@ -1326,37 +1326,37 @@
- // A, B, C, D - offset in bytes to load from in buffer
- // TEMP0, TEMP1 - registers for corresponding tmp elements
- #define HORIZONTAL_PASS_WHT(A, B, C, D, TEMP0, TEMP1)                          \
--  "lh              %["#TEMP0"],  "#A"(%[in])                \n\t"              \
--  "lh              %["#TEMP1"],  "#B"(%[in])                \n\t"              \
--  "lh              %[temp8],     "#C"(%[in])                \n\t"              \
--  "lh              %[temp9],     "#D"(%[in])                \n\t"              \
--  "ins             %["#TEMP1"],  %["#TEMP0"],  16,  16      \n\t"              \
-+  "lh              %[" #TEMP0 "],  " #A "(%[in])            \n\t"              \
-+  "lh              %[" #TEMP1 "],  " #B "(%[in])            \n\t"              \
-+  "lh              %[temp8],     " #C "(%[in])              \n\t"              \
-+  "lh              %[temp9],     " #D "(%[in])              \n\t"              \
-+  "ins             %[" #TEMP1 "],  %[" #TEMP0 "],  16,  16  \n\t"              \
-   "ins             %[temp9],     %[temp8],     16,  16      \n\t"              \
--  "subq.ph         %[temp8],     %["#TEMP1"],  %[temp9]     \n\t"              \
--  "addq.ph         %[temp9],     %["#TEMP1"],  %[temp9]     \n\t"              \
--  "precrq.ph.w     %["#TEMP0"],  %[temp8],     %[temp9]     \n\t"              \
-+  "subq.ph         %[temp8],     %[" #TEMP1 "],  %[temp9]   \n\t"              \
-+  "addq.ph         %[temp9],     %[" #TEMP1 "],  %[temp9]   \n\t"              \
-+  "precrq.ph.w     %[" #TEMP0 "],  %[temp8],     %[temp9]   \n\t"              \
-   "append          %[temp8],     %[temp9],     16           \n\t"              \
--  "subq.ph         %["#TEMP1"],  %["#TEMP0"],  %[temp8]     \n\t"              \
--  "addq.ph         %["#TEMP0"],  %["#TEMP0"],  %[temp8]     \n\t"              \
--  "rotr            %["#TEMP1"],  %["#TEMP1"],  16           \n\t"
-+  "subq.ph         %[" #TEMP1 "],  %[" #TEMP0 "],  %[temp8] \n\t"              \
-+  "addq.ph         %[" #TEMP0 "],  %[" #TEMP0 "],  %[temp8] \n\t"              \
-+  "rotr            %[" #TEMP1 "],  %[" #TEMP1 "],  16       \n\t"
- 
- // macro for one vertical pass in FTransformWHT
- // temp0..temp7 holds tmp[0]..tmp[15]
- // A, B, C, D - offsets in bytes to store to out buffer
- // TEMP0, TEMP2, TEMP4 and TEMP6 - registers for corresponding tmp elements
- #define VERTICAL_PASS_WHT(A, B, C, D, TEMP0, TEMP2, TEMP4, TEMP6)              \
--  "addq.ph         %[temp8],     %["#TEMP0"],  %["#TEMP4"]  \n\t"              \
--  "addq.ph         %[temp9],     %["#TEMP2"],  %["#TEMP6"]  \n\t"              \
--  "subq.ph         %["#TEMP2"],  %["#TEMP2"],  %["#TEMP6"]  \n\t"              \
--  "subq.ph         %["#TEMP6"],  %["#TEMP0"],  %["#TEMP4"]  \n\t"              \
--  "addqh.ph        %["#TEMP0"],  %[temp8],     %[temp9]     \n\t"              \
--  "subqh.ph        %["#TEMP4"],  %["#TEMP6"],  %["#TEMP2"]  \n\t"              \
--  "addqh.ph        %["#TEMP2"],  %["#TEMP2"],  %["#TEMP6"]  \n\t"              \
--  "subqh.ph        %["#TEMP6"],  %[temp8],     %[temp9]     \n\t"              \
--  "usw             %["#TEMP0"],  "#A"(%[out])               \n\t"              \
--  "usw             %["#TEMP2"],  "#B"(%[out])               \n\t"              \
--  "usw             %["#TEMP4"],  "#C"(%[out])               \n\t"              \
--  "usw             %["#TEMP6"],  "#D"(%[out])               \n\t"
-+  "addq.ph         %[temp8],     %[" #TEMP0 "],  %[" #TEMP4 "]    \n\t"        \
-+  "addq.ph         %[temp9],     %[" #TEMP2 "],  %[" #TEMP6 "]    \n\t"        \
-+  "subq.ph         %[" #TEMP2 "],  %[" #TEMP2 "],  %[" #TEMP6 "]  \n\t"        \
-+  "subq.ph         %[" #TEMP6 "],  %[" #TEMP0 "],  %[" #TEMP4 "]  \n\t"        \
-+  "addqh.ph        %[" #TEMP0 "],  %[temp8],     %[temp9]         \n\t"        \
-+  "subqh.ph        %[" #TEMP4 "],  %[" #TEMP6 "],  %[" #TEMP2 "]  \n\t"        \
-+  "addqh.ph        %[" #TEMP2 "],  %[" #TEMP2 "],  %[" #TEMP6 "]  \n\t"        \
-+  "subqh.ph        %[" #TEMP6 "],  %[temp8],     %[temp9]         \n\t"        \
-+  "usw             %[" #TEMP0 "],  " #A "(%[out])                 \n\t"        \
-+  "usw             %[" #TEMP2 "],  " #B "(%[out])                 \n\t"        \
-+  "usw             %[" #TEMP4 "],  " #C "(%[out])                 \n\t"        \
-+  "usw             %[" #TEMP6 "],  " #D "(%[out])                 \n\t"
- 
- static void FTransformWHT(const int16_t* in, int16_t* out) {
-   int temp0, temp1, temp2, temp3, temp4;
-@@ -1385,10 +1385,10 @@
- // convert 8 coeffs at time
- // A, B, C, D - offsets in bytes to load from out buffer
- #define CONVERT_COEFFS_TO_BIN(A, B, C, D)                                      \
--  "ulw        %[temp0],  "#A"(%[out])                  \n\t"                   \
--  "ulw        %[temp1],  "#B"(%[out])                  \n\t"                   \
--  "ulw        %[temp2],  "#C"(%[out])                  \n\t"                   \
--  "ulw        %[temp3],  "#D"(%[out])                  \n\t"                   \
-+  "ulw        %[temp0],  " #A "(%[out])                \n\t"                   \
-+  "ulw        %[temp1],  " #B "(%[out])                \n\t"                   \
-+  "ulw        %[temp2],  " #C "(%[out])                \n\t"                   \
-+  "ulw        %[temp3],  " #D "(%[out])                \n\t"                   \
-   "absq_s.ph  %[temp0],  %[temp0]                      \n\t"                   \
-   "absq_s.ph  %[temp1],  %[temp1]                      \n\t"                   \
-   "absq_s.ph  %[temp2],  %[temp2]                      \n\t"                   \
-diff --git a/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c b/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c
-index 66f807d..8134af5 100644
---- a/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c
-+++ b/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c
-@@ -48,7 +48,7 @@
-       "srl       %[temp0],    %[length],    0x2         \n\t"                  \
-       "beqz      %[temp0],    4f                        \n\t"                  \
-       " andi     %[temp6],    %[length],    0x3         \n\t"                  \
--    ".if "#INVERSE"                                     \n\t"                  \
-+    ".if " #INVERSE "                                   \n\t"                  \
-       "lbu       %[temp1],    -1(%[src])                \n\t"                  \
-     "1:                                                 \n\t"                  \
-       "lbu       %[temp2],    0(%[src])                 \n\t"                  \
-@@ -84,7 +84,7 @@
-       "lbu       %[temp1],    -1(%[src])                \n\t"                  \
-       "lbu       %[temp2],    0(%[src])                 \n\t"                  \
-       "addiu     %[src],      %[src],       1           \n\t"                  \
--    ".if "#INVERSE"                                     \n\t"                  \
-+    ".if " #INVERSE "                                   \n\t"                  \
-       "addu      %[temp3],    %[temp1],     %[temp2]    \n\t"                  \
-       "sb        %[temp3],    -1(%[src])                \n\t"                  \
-     ".else                                              \n\t"                  \
-@@ -131,7 +131,7 @@
-       "ulw       %[temp3],    4(%[src])                 \n\t"                  \
-       "ulw       %[temp4],    4(%[pred])                \n\t"                  \
-       "addiu     %[src],      %[src],       8           \n\t"                  \
--    ".if "#INVERSE"                                     \n\t"                  \
-+    ".if " #INVERSE "                                   \n\t"                  \
-       "addu.qb   %[temp5],    %[temp1],     %[temp2]    \n\t"                  \
-       "addu.qb   %[temp6],    %[temp3],     %[temp4]    \n\t"                  \
-     ".else                                              \n\t"                  \
-@@ -152,7 +152,7 @@
-       "lbu       %[temp2],    0(%[pred])                \n\t"                  \
-       "addiu     %[src],      %[src],       1           \n\t"                  \
-       "addiu     %[pred],     %[pred],      1           \n\t"                  \
--    ".if "#INVERSE"                                     \n\t"                  \
-+    ".if " #INVERSE "                                   \n\t"                  \
-       "addu      %[temp3],    %[temp1],     %[temp2]    \n\t"                  \
-     ".else                                              \n\t"                  \
-       "subu      %[temp3],    %[temp1],     %[temp2]    \n\t"                  \
-@@ -177,7 +177,7 @@
-     __asm__ volatile (                                                         \
-       "lbu       %[temp1],   0(%[src])               \n\t"                     \
-       "lbu       %[temp2],   0(%[pred])              \n\t"                     \
--    ".if "#INVERSE"                                  \n\t"                     \
-+    ".if " #INVERSE "                                \n\t"                     \
-       "addu      %[temp3],   %[temp1],   %[temp2]    \n\t"                     \
-     ".else                                           \n\t"                     \
-       "subu      %[temp3],   %[temp1],   %[temp2]    \n\t"                     \
-diff --git a/Source/LibWebP/src/dsp/dsp.lossless_mips32.c b/Source/LibWebP/src/dsp/dsp.lossless_mips32.c
-index 8ae5958..cdf0e26 100644
---- a/Source/LibWebP/src/dsp/dsp.lossless_mips32.c
-+++ b/Source/LibWebP/src/dsp/dsp.lossless_mips32.c
-
-@@ -278,28 +278,28 @@
- // literal_ and successive histograms could be unaligned
- // so we must use ulw and usw
- #define ADD_TO_OUT(A, B, C, D, E, P0, P1, P2)           \
--    "ulw    %[temp0], "#A"(%["#P0"])        \n\t"       \
--    "ulw    %[temp1], "#B"(%["#P0"])        \n\t"       \
--    "ulw    %[temp2], "#C"(%["#P0"])        \n\t"       \
--    "ulw    %[temp3], "#D"(%["#P0"])        \n\t"       \
--    "ulw    %[temp4], "#A"(%["#P1"])        \n\t"       \
--    "ulw    %[temp5], "#B"(%["#P1"])        \n\t"       \
--    "ulw    %[temp6], "#C"(%["#P1"])        \n\t"       \
--    "ulw    %[temp7], "#D"(%["#P1"])        \n\t"       \
-+    "ulw    %[temp0], " #A "(%[" #P0 "])    \n\t"       \
-+    "ulw    %[temp1], " #B "(%[" #P0 "])    \n\t"       \
-+    "ulw    %[temp2], " #C "(%[" #P0 "])    \n\t"       \
-+    "ulw    %[temp3], " #D "(%[" #P0 "])    \n\t"       \
-+    "ulw    %[temp4], " #A "(%[" #P1 "])    \n\t"       \
-+    "ulw    %[temp5], " #B "(%[" #P1 "])    \n\t"       \
-+    "ulw    %[temp6], " #C "(%[" #P1 "])    \n\t"       \
-+    "ulw    %[temp7], " #D "(%[" #P1 "])    \n\t"       \
-     "addu   %[temp4], %[temp4],   %[temp0]  \n\t"       \
-     "addu   %[temp5], %[temp5],   %[temp1]  \n\t"       \
-     "addu   %[temp6], %[temp6],   %[temp2]  \n\t"       \
-     "addu   %[temp7], %[temp7],   %[temp3]  \n\t"       \
--    "addiu  %["#P0"],  %["#P0"],  16        \n\t"       \
--  ".if "#E" == 1                            \n\t"       \
--    "addiu  %["#P1"],  %["#P1"],  16        \n\t"       \
-+    "addiu  %[" #P0 "],  %[" #P0 "],  16    \n\t"       \
-+  ".if " #E " == 1                          \n\t"       \
-+    "addiu  %[" #P1 "],  %[" #P1 "],  16    \n\t"       \
-   ".endif                                   \n\t"       \
--    "usw    %[temp4], "#A"(%["#P2"])        \n\t"       \
--    "usw    %[temp5], "#B"(%["#P2"])        \n\t"       \
--    "usw    %[temp6], "#C"(%["#P2"])        \n\t"       \
--    "usw    %[temp7], "#D"(%["#P2"])        \n\t"       \
--    "addiu  %["#P2"], %["#P2"],   16        \n\t"       \
--    "bne    %["#P0"], %[LoopEnd], 1b        \n\t"       \
-+    "usw    %[temp4], " #A "(%[" #P2 "])    \n\t"       \
-+    "usw    %[temp5], " #B "(%[" #P2 "])    \n\t"       \
-+    "usw    %[temp6], " #C "(%[" #P2 "])    \n\t"       \
-+    "usw    %[temp7], " #D "(%[" #P2 "])    \n\t"       \
-+    "addiu  %[" #P2 "], %[" #P2 "],   16    \n\t"       \
-+    "bne    %[" #P0 "], %[LoopEnd], 1b      \n\t"       \
-     ".set   pop                             \n\t"       \
- 
- #define ASM_END_COMMON_0                                \
-diff --git a/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c b/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c
-index ad55f2c..90aed7f 100644
---- a/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c
-+++ b/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c
-@@ -29,14 +29,14 @@
-     for (x = 0; x < (width >> 2); ++x) {                                       \
-       int tmp1, tmp2, tmp3, tmp4;                                              \
-       __asm__ volatile (                                                       \
--      ".ifc        "#TYPE",  uint8_t                    \n\t"                  \
-+      ".ifc        " #TYPE ",  uint8_t                  \n\t"                  \
-         "lbu       %[tmp1],  0(%[src])                  \n\t"                  \
-         "lbu       %[tmp2],  1(%[src])                  \n\t"                  \
-         "lbu       %[tmp3],  2(%[src])                  \n\t"                  \
-         "lbu       %[tmp4],  3(%[src])                  \n\t"                  \
-         "addiu     %[src],   %[src],      4             \n\t"                  \
-       ".endif                                           \n\t"                  \
--      ".ifc        "#TYPE",  uint32_t                   \n\t"                  \
-+      ".ifc        " #TYPE ",  uint32_t                 \n\t"                  \
-         "lw        %[tmp1],  0(%[src])                  \n\t"                  \
-         "lw        %[tmp2],  4(%[src])                  \n\t"                  \
-         "lw        %[tmp3],  8(%[src])                  \n\t"                  \
-@@ -55,7 +55,7 @@
-         "lwx       %[tmp2],  %[tmp2](%[color_map])      \n\t"                  \
-         "lwx       %[tmp3],  %[tmp3](%[color_map])      \n\t"                  \
-         "lwx       %[tmp4],  %[tmp4](%[color_map])      \n\t"                  \
--      ".ifc        "#TYPE",  uint8_t                    \n\t"                  \
-+      ".ifc        " #TYPE ",  uint8_t                  \n\t"                  \
-         "ext       %[tmp1],  %[tmp1],     8,        8   \n\t"                  \
-         "ext       %[tmp2],  %[tmp2],     8,        8   \n\t"                  \
-         "ext       %[tmp3],  %[tmp3],     8,        8   \n\t"                  \
-@@ -66,7 +66,7 @@
-         "sb        %[tmp4],  3(%[dst])                  \n\t"                  \
-         "addiu     %[dst],   %[dst],      4             \n\t"                  \
-       ".endif                                           \n\t"                  \
--      ".ifc        "#TYPE",  uint32_t                   \n\t"                  \
-+      ".ifc        " #TYPE ",  uint32_t                 \n\t"                  \
-         "sw        %[tmp1],  0(%[dst])                  \n\t"                  \
-         "sw        %[tmp2],  4(%[dst])                  \n\t"                  \
-         "sw        %[tmp3],  8(%[dst])                  \n\t"                  \
-diff --git a/Source/LibWebP/src/dsp/mips_macro.h b/Source/LibWebP/src/dsp/mips_macro.h
-index 4cfb23c..e09d2c4 100644
---- a/Source/LibWebP/src/dsp/mips_macro.h
-+++ b/Source/LibWebP/src/dsp/mips_macro.h
-@@ -25,25 +25,25 @@
- // I - input (macro doesn't change it)
- #define ADD_SUB_HALVES(O0, O1,                                                 \
-                        I0, I1)                                                 \
--  "addq.ph          %["#O0"],   %["#I0"],  %["#I1"]           \n\t"            \
--  "subq.ph          %["#O1"],   %["#I0"],  %["#I1"]           \n\t"
-+  "addq.ph          %[" #O0 "],   %[" #I0 "],  %[" #I1 "]           \n\t"      \
-+  "subq.ph          %[" #O1 "],   %[" #I0 "],  %[" #I1 "]           \n\t"
- 
- // O - output
- // I - input (macro doesn't change it)
- // I[0/1] - offset in bytes
- #define LOAD_IN_X2(O0, O1,                                                     \
-                    I0, I1)                                                     \
--  "lh               %["#O0"],   "#I0"(%[in])                  \n\t"            \
--  "lh               %["#O1"],   "#I1"(%[in])                  \n\t"
-+  "lh               %[" #O0 "],   " #I0 "(%[in])                  \n\t"        \
-+  "lh               %[" #O1 "],   " #I1 "(%[in])                  \n\t"
- 
- // I0 - location
- // I1..I9 - offsets in bytes
- #define LOAD_WITH_OFFSET_X4(O0, O1, O2, O3,                                    \
-                             I0, I1, I2, I3, I4, I5, I6, I7, I8, I9)            \
--  "ulw    %["#O0"],    "#I1"+"XSTR(I9)"*"#I5"(%["#I0"])       \n\t"            \
--  "ulw    %["#O1"],    "#I2"+"XSTR(I9)"*"#I6"(%["#I0"])       \n\t"            \
--  "ulw    %["#O2"],    "#I3"+"XSTR(I9)"*"#I7"(%["#I0"])       \n\t"            \
--  "ulw    %["#O3"],    "#I4"+"XSTR(I9)"*"#I8"(%["#I0"])       \n\t"
-+  "ulw    %[" #O0 "],    " #I1 "+"XSTR(I9)"*" #I5 "(%[" #I0 "])       \n\t"    \
-+  "ulw    %[" #O1 "],    " #I2 "+"XSTR(I9)"*" #I6 "(%[" #I0 "])       \n\t"    \
-+  "ulw    %[" #O2 "],    " #I3 "+"XSTR(I9)"*" #I7 "(%[" #I0 "])       \n\t"    \
-+  "ulw    %[" #O3 "],    " #I4 "+"XSTR(I9)"*" #I8 "(%[" #I0 "])       \n\t"
- 
- // O - output
- // IO - input/output
-@@ -51,42 +51,42 @@
- #define MUL_SHIFT_SUM(O0, O1, O2, O3, O4, O5, O6, O7,                          \
-                       IO0, IO1, IO2, IO3,                                      \
-                       I0, I1, I2, I3, I4, I5, I6, I7)                          \
--  "mul              %["#O0"],   %["#I0"],   %[kC2]            \n\t"            \
--  "mul              %["#O1"],   %["#I0"],   %[kC1]            \n\t"            \
--  "mul              %["#O2"],   %["#I1"],   %[kC2]            \n\t"            \
--  "mul              %["#O3"],   %["#I1"],   %[kC1]            \n\t"            \
--  "mul              %["#O4"],   %["#I2"],   %[kC2]            \n\t"            \
--  "mul              %["#O5"],   %["#I2"],   %[kC1]            \n\t"            \
--  "mul              %["#O6"],   %["#I3"],   %[kC2]            \n\t"            \
--  "mul              %["#O7"],   %["#I3"],   %[kC1]            \n\t"            \
--  "sra              %["#O0"],   %["#O0"],   16                \n\t"            \
--  "sra              %["#O1"],   %["#O1"],   16                \n\t"            \
--  "sra              %["#O2"],   %["#O2"],   16                \n\t"            \
--  "sra              %["#O3"],   %["#O3"],   16                \n\t"            \
--  "sra              %["#O4"],   %["#O4"],   16                \n\t"            \
--  "sra              %["#O5"],   %["#O5"],   16                \n\t"            \
--  "sra              %["#O6"],   %["#O6"],   16                \n\t"            \
--  "sra              %["#O7"],   %["#O7"],   16                \n\t"            \
--  "addu             %["#IO0"],  %["#IO0"],  %["#I4"]          \n\t"            \
--  "addu             %["#IO1"],  %["#IO1"],  %["#I5"]          \n\t"            \
--  "subu             %["#IO2"],  %["#IO2"],  %["#I6"]          \n\t"            \
--  "subu             %["#IO3"],  %["#IO3"],  %["#I7"]          \n\t"
-+  "mul              %[" #O0 "],   %[" #I0 "],   %[kC2]        \n\t"            \
-+  "mul              %[" #O1 "],   %[" #I0 "],   %[kC1]        \n\t"            \
-+  "mul              %[" #O2 "],   %[" #I1 "],   %[kC2]        \n\t"            \
-+  "mul              %[" #O3 "],   %[" #I1 "],   %[kC1]        \n\t"            \
-+  "mul              %[" #O4 "],   %[" #I2 "],   %[kC2]        \n\t"            \
-+  "mul              %[" #O5 "],   %[" #I2 "],   %[kC1]        \n\t"            \
-+  "mul              %[" #O6 "],   %[" #I3 "],   %[kC2]        \n\t"            \
-+  "mul              %[" #O7 "],   %[" #I3 "],   %[kC1]        \n\t"            \
-+  "sra              %[" #O0 "],   %[" #O0 "],   16            \n\t"            \
-+  "sra              %[" #O1 "],   %[" #O1 "],   16            \n\t"            \
-+  "sra              %[" #O2 "],   %[" #O2 "],   16            \n\t"            \
-+  "sra              %[" #O3 "],   %[" #O3 "],   16            \n\t"            \
-+  "sra              %[" #O4 "],   %[" #O4 "],   16            \n\t"            \
-+  "sra              %[" #O5 "],   %[" #O5 "],   16            \n\t"            \
-+  "sra              %[" #O6 "],   %[" #O6 "],   16            \n\t"            \
-+  "sra              %[" #O7 "],   %[" #O7 "],   16            \n\t"            \
-+  "addu             %[" #IO0 "],  %[" #IO0 "],  %[" #I4 "]    \n\t"            \
-+  "addu             %[" #IO1 "],  %[" #IO1 "],  %[" #I5 "]    \n\t"            \
-+  "subu             %[" #IO2 "],  %[" #IO2 "],  %[" #I6 "]    \n\t"            \
-+  "subu             %[" #IO3 "],  %[" #IO3 "],  %[" #I7 "]    \n\t"
- 
- // O - output
- // I - input (macro doesn't change it)
- #define INSERT_HALF_X2(O0, O1,                                                 \
-                        I0, I1)                                                 \
--  "ins              %["#O0"],   %["#I0"], 16,    16           \n\t"            \
--  "ins              %["#O1"],   %["#I1"], 16,    16           \n\t"
-+  "ins              %[" #O0 "],   %[" #I0 "], 16,    16           \n\t"        \
-+  "ins              %[" #O1 "],   %[" #I1 "], 16,    16           \n\t"
- 
- // O - output
- // I - input (macro doesn't change it)
- #define SRA_16(O0, O1, O2, O3,                                                 \
-                I0, I1, I2, I3)                                                 \
--  "sra              %["#O0"],  %["#I0"],  16                  \n\t"            \
--  "sra              %["#O1"],  %["#I1"],  16                  \n\t"            \
--  "sra              %["#O2"],  %["#I2"],  16                  \n\t"            \
--  "sra              %["#O3"],  %["#I3"],  16                  \n\t"
-+  "sra              %[" #O0 "],  %[" #I0 "],  16                  \n\t"        \
-+  "sra              %[" #O1 "],  %[" #I1 "],  16                  \n\t"        \
-+  "sra              %[" #O2 "],  %[" #I2 "],  16                  \n\t"        \
-+  "sra              %[" #O3 "],  %[" #I3 "],  16                  \n\t"
- 
- // temp0[31..16 | 15..0] = temp8[31..16 | 15..0] + temp12[31..16 | 15..0]
- // temp1[31..16 | 15..0] = temp8[31..16 | 15..0] - temp12[31..16 | 15..0]
-@@ -96,22 +96,22 @@
- // I - input (macro doesn't change it)
- #define SHIFT_R_SUM_X2(O0, O1, O2, O3, O4, O5, O6, O7,                         \
-                        I0, I1, I2, I3, I4, I5, I6, I7)                         \
--  "addq.ph          %["#O0"],   %["#I0"],   %["#I4"]          \n\t"            \
--  "subq.ph          %["#O1"],   %["#I0"],   %["#I4"]          \n\t"            \
--  "addq.ph          %["#O2"],   %["#I1"],   %["#I5"]          \n\t"            \
--  "subq.ph          %["#O3"],   %["#I1"],   %["#I5"]          \n\t"            \
--  "addq.ph          %["#O4"],   %["#I2"],   %["#I6"]          \n\t"            \
--  "subq.ph          %["#O5"],   %["#I2"],   %["#I6"]          \n\t"            \
--  "addq.ph          %["#O6"],   %["#I3"],   %["#I7"]          \n\t"            \
--  "subq.ph          %["#O7"],   %["#I3"],   %["#I7"]          \n\t"            \
--  "shra.ph          %["#O0"],   %["#O0"],   3                 \n\t"            \
--  "shra.ph          %["#O1"],   %["#O1"],   3                 \n\t"            \
--  "shra.ph          %["#O2"],   %["#O2"],   3                 \n\t"            \
--  "shra.ph          %["#O3"],   %["#O3"],   3                 \n\t"            \
--  "shra.ph          %["#O4"],   %["#O4"],   3                 \n\t"            \
--  "shra.ph          %["#O5"],   %["#O5"],   3                 \n\t"            \
--  "shra.ph          %["#O6"],   %["#O6"],   3                 \n\t"            \
--  "shra.ph          %["#O7"],   %["#O7"],   3                 \n\t"
-+  "addq.ph          %[" #O0 "],   %[" #I0 "],   %[" #I4 "]    \n\t"            \
-+  "subq.ph          %[" #O1 "],   %[" #I0 "],   %[" #I4 "]    \n\t"            \
-+  "addq.ph          %[" #O2 "],   %[" #I1 "],   %[" #I5 "]    \n\t"            \
-+  "subq.ph          %[" #O3 "],   %[" #I1 "],   %[" #I5 "]    \n\t"            \
-+  "addq.ph          %[" #O4 "],   %[" #I2 "],   %[" #I6 "]    \n\t"            \
-+  "subq.ph          %[" #O5 "],   %[" #I2 "],   %[" #I6 "]    \n\t"            \
-+  "addq.ph          %[" #O6 "],   %[" #I3 "],   %[" #I7 "]    \n\t"            \
-+  "subq.ph          %[" #O7 "],   %[" #I3 "],   %[" #I7 "]    \n\t"            \
-+  "shra.ph          %[" #O0 "],   %[" #O0 "],   3             \n\t"            \
-+  "shra.ph          %[" #O1 "],   %[" #O1 "],   3             \n\t"            \
-+  "shra.ph          %[" #O2 "],   %[" #O2 "],   3             \n\t"            \
-+  "shra.ph          %[" #O3 "],   %[" #O3 "],   3             \n\t"            \
-+  "shra.ph          %[" #O4 "],   %[" #O4 "],   3             \n\t"            \
-+  "shra.ph          %[" #O5 "],   %[" #O5 "],   3             \n\t"            \
-+  "shra.ph          %[" #O6 "],   %[" #O6 "],   3             \n\t"            \
-+  "shra.ph          %[" #O7 "],   %[" #O7 "],   3             \n\t"
- 
- // precrq.ph.w temp0, temp8, temp2
- //   temp0 = temp8[31..16] | temp2[31..16]
-@@ -123,14 +123,14 @@
- #define PACK_2_HALVES_TO_WORD(O0, O1, O2, O3,                                  \
-                               IO0, IO1, IO2, IO3,                              \
-                               I0, I1, I2, I3)                                  \
--  "precrq.ph.w      %["#O0"],    %["#I0"],  %["#IO0"]         \n\t"            \
--  "precrq.ph.w      %["#O1"],    %["#I1"],  %["#IO1"]         \n\t"            \
--  "ins              %["#IO0"],   %["#I0"],  16,    16         \n\t"            \
--  "ins              %["#IO1"],   %["#I1"],  16,    16         \n\t"            \
--  "precrq.ph.w      %["#O2"],    %["#I2"],  %["#IO2"]         \n\t"            \
--  "precrq.ph.w      %["#O3"],    %["#I3"],  %["#IO3"]         \n\t"            \
--  "ins              %["#IO2"],   %["#I2"],  16,    16         \n\t"            \
--  "ins              %["#IO3"],   %["#I3"],  16,    16         \n\t"
-+  "precrq.ph.w      %[" #O0 "],    %[" #I0 "],  %[" #IO0 "]       \n\t"        \
-+  "precrq.ph.w      %[" #O1 "],    %[" #I1 "],  %[" #IO1 "]       \n\t"        \
-+  "ins              %[" #IO0 "],   %[" #I0 "],  16,    16         \n\t"        \
-+  "ins              %[" #IO1 "],   %[" #I1 "],  16,    16         \n\t"        \
-+  "precrq.ph.w      %[" #O2 "],    %[" #I2 "],  %[" #IO2 "]       \n\t"        \
-+  "precrq.ph.w      %[" #O3 "],    %[" #I3 "],  %[" #IO3 "]       \n\t"        \
-+  "ins              %[" #IO2 "],   %[" #I2 "],  16,    16         \n\t"        \
-+  "ins              %[" #IO3 "],   %[" #I3 "],  16,    16         \n\t"
- 
- // preceu.ph.qbr temp0, temp8
- //   temp0 = 0 | 0 | temp8[23..16] | temp8[7..0]
-@@ -140,14 +140,14 @@
- // I - input (macro doesn't change it)
- #define CONVERT_2_BYTES_TO_HALF(O0, O1, O2, O3, O4, O5, O6, O7,                \
-                                 I0, I1, I2, I3)                                \
--  "preceu.ph.qbr    %["#O0"],   %["#I0"]                      \n\t"            \
--  "preceu.ph.qbl    %["#O1"],   %["#I0"]                      \n\t"            \
--  "preceu.ph.qbr    %["#O2"],   %["#I1"]                      \n\t"            \
--  "preceu.ph.qbl    %["#O3"],   %["#I1"]                      \n\t"            \
--  "preceu.ph.qbr    %["#O4"],   %["#I2"]                      \n\t"            \
--  "preceu.ph.qbl    %["#O5"],   %["#I2"]                      \n\t"            \
--  "preceu.ph.qbr    %["#O6"],   %["#I3"]                      \n\t"            \
--  "preceu.ph.qbl    %["#O7"],   %["#I3"]                      \n\t"
-+  "preceu.ph.qbr    %[" #O0 "],   %[" #I0 "]                      \n\t"        \
-+  "preceu.ph.qbl    %[" #O1 "],   %[" #I0 "]                      \n\t"        \
-+  "preceu.ph.qbr    %[" #O2 "],   %[" #I1 "]                      \n\t"        \
-+  "preceu.ph.qbl    %[" #O3 "],   %[" #I1 "]                      \n\t"        \
-+  "preceu.ph.qbr    %[" #O4 "],   %[" #I2 "]                      \n\t"        \
-+  "preceu.ph.qbl    %[" #O5 "],   %[" #I2 "]                      \n\t"        \
-+  "preceu.ph.qbr    %[" #O6 "],   %[" #I3 "]                      \n\t"        \
-+  "preceu.ph.qbl    %[" #O7 "],   %[" #I3 "]                      \n\t"
- 
- // temp0[31..16 | 15..0] = temp0[31..16 | 15..0] + temp8[31..16 | 15..0]
- // temp0[31..16 | 15..0] = temp0[31..16 <<(s) 7 | 15..0 <<(s) 7]
-@@ -160,30 +160,30 @@
- #define STORE_SAT_SUM_X2(IO0, IO1, IO2, IO3, IO4, IO5, IO6, IO7,               \
-                          I0, I1, I2, I3, I4, I5, I6, I7,                       \
-                          I8, I9, I10, I11, I12, I13)                           \
--  "addq.ph          %["#IO0"],  %["#IO0"],  %["#I0"]          \n\t"            \
--  "addq.ph          %["#IO1"],  %["#IO1"],  %["#I1"]          \n\t"            \
--  "addq.ph          %["#IO2"],  %["#IO2"],  %["#I2"]          \n\t"            \
--  "addq.ph          %["#IO3"],  %["#IO3"],  %["#I3"]          \n\t"            \
--  "addq.ph          %["#IO4"],  %["#IO4"],  %["#I4"]          \n\t"            \
--  "addq.ph          %["#IO5"],  %["#IO5"],  %["#I5"]          \n\t"            \
--  "addq.ph          %["#IO6"],  %["#IO6"],  %["#I6"]          \n\t"            \
--  "addq.ph          %["#IO7"],  %["#IO7"],  %["#I7"]          \n\t"            \
--  "shll_s.ph        %["#IO0"],  %["#IO0"],  7                 \n\t"            \
--  "shll_s.ph        %["#IO1"],  %["#IO1"],  7                 \n\t"            \
--  "shll_s.ph        %["#IO2"],  %["#IO2"],  7                 \n\t"            \
--  "shll_s.ph        %["#IO3"],  %["#IO3"],  7                 \n\t"            \
--  "shll_s.ph        %["#IO4"],  %["#IO4"],  7                 \n\t"            \
--  "shll_s.ph        %["#IO5"],  %["#IO5"],  7                 \n\t"            \
--  "shll_s.ph        %["#IO6"],  %["#IO6"],  7                 \n\t"            \
--  "shll_s.ph        %["#IO7"],  %["#IO7"],  7                 \n\t"            \
--  "precrqu_s.qb.ph  %["#IO0"],  %["#IO1"],  %["#IO0"]         \n\t"            \
--  "precrqu_s.qb.ph  %["#IO2"],  %["#IO3"],  %["#IO2"]         \n\t"            \
--  "precrqu_s.qb.ph  %["#IO4"],  %["#IO5"],  %["#IO4"]         \n\t"            \
--  "precrqu_s.qb.ph  %["#IO6"],  %["#IO7"],  %["#IO6"]         \n\t"            \
--  "usw              %["#IO0"],  "XSTR(I13)"*"#I9"(%["#I8"])   \n\t"            \
--  "usw              %["#IO2"],  "XSTR(I13)"*"#I10"(%["#I8"])  \n\t"            \
--  "usw              %["#IO4"],  "XSTR(I13)"*"#I11"(%["#I8"])  \n\t"            \
--  "usw              %["#IO6"],  "XSTR(I13)"*"#I12"(%["#I8"])  \n\t"
-+  "addq.ph          %[" #IO0 "],  %[" #IO0 "],  %[" #I0 "]          \n\t"      \
-+  "addq.ph          %[" #IO1 "],  %[" #IO1 "],  %[" #I1 "]          \n\t"      \
-+  "addq.ph          %[" #IO2 "],  %[" #IO2 "],  %[" #I2 "]          \n\t"      \
-+  "addq.ph          %[" #IO3 "],  %[" #IO3 "],  %[" #I3 "]          \n\t"      \
-+  "addq.ph          %[" #IO4 "],  %[" #IO4 "],  %[" #I4 "]          \n\t"      \
-+  "addq.ph          %[" #IO5 "],  %[" #IO5 "],  %[" #I5 "]          \n\t"      \
-+  "addq.ph          %[" #IO6 "],  %[" #IO6 "],  %[" #I6 "]          \n\t"      \
-+  "addq.ph          %[" #IO7 "],  %[" #IO7 "],  %[" #I7 "]          \n\t"      \
-+  "shll_s.ph        %[" #IO0 "],  %[" #IO0 "],  7                   \n\t"      \
-+  "shll_s.ph        %[" #IO1 "],  %[" #IO1 "],  7                   \n\t"      \
-+  "shll_s.ph        %[" #IO2 "],  %[" #IO2 "],  7                   \n\t"      \
-+  "shll_s.ph        %[" #IO3 "],  %[" #IO3 "],  7                   \n\t"      \
-+  "shll_s.ph        %[" #IO4 "],  %[" #IO4 "],  7                   \n\t"      \
-+  "shll_s.ph        %[" #IO5 "],  %[" #IO5 "],  7                   \n\t"      \
-+  "shll_s.ph        %[" #IO6 "],  %[" #IO6 "],  7                   \n\t"      \
-+  "shll_s.ph        %[" #IO7 "],  %[" #IO7 "],  7                   \n\t"      \
-+  "precrqu_s.qb.ph  %[" #IO0 "],  %[" #IO1 "],  %[" #IO0 "]         \n\t"      \
-+  "precrqu_s.qb.ph  %[" #IO2 "],  %[" #IO3 "],  %[" #IO2 "]         \n\t"      \
-+  "precrqu_s.qb.ph  %[" #IO4 "],  %[" #IO5 "],  %[" #IO4 "]         \n\t"      \
-+  "precrqu_s.qb.ph  %[" #IO6 "],  %[" #IO7 "],  %[" #IO6 "]         \n\t"      \
-+  "usw              %[" #IO0 "],  "XSTR(I13)"*" #I9 "(%[" #I8 "])   \n\t"      \
-+  "usw              %[" #IO2 "],  "XSTR(I13)"*" #I10 "(%[" #I8 "])  \n\t"      \
-+  "usw              %[" #IO4 "],  "XSTR(I13)"*" #I11 "(%[" #I8 "])  \n\t"      \
-+  "usw              %[" #IO6 "],  "XSTR(I13)"*" #I12 "(%[" #I8 "])  \n\t"
- 
- #define OUTPUT_EARLY_CLOBBER_REGS_10()                                         \
-   : [temp1]"=&r"(temp1), [temp2]"=&r"(temp2), [temp3]"=&r"(temp3),             \
-diff --git a/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c b/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c
-index 9c9665f..46f207b 100644
---- a/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c
-+++ b/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c
-@@ -34,15 +34,15 @@
-     G = G - t2 + kGCst;                                                        \
-     B = B + kBCst;                                                             \
-     __asm__ volatile (                                                         \
--      "shll_s.w         %["#R"],      %["#R"],        9              \n\t"     \
--      "shll_s.w         %["#G"],      %["#G"],        9              \n\t"     \
--      "shll_s.w         %["#B"],      %["#B"],        9              \n\t"     \
--      "precrqu_s.qb.ph  %["#R"],      %["#R"],        $zero          \n\t"     \
--      "precrqu_s.qb.ph  %["#G"],      %["#G"],        $zero          \n\t"     \
--      "precrqu_s.qb.ph  %["#B"],      %["#B"],        $zero          \n\t"     \
--      "srl              %["#R"],      %["#R"],        24             \n\t"     \
--      "srl              %["#G"],      %["#G"],        24             \n\t"     \
--      "srl              %["#B"],      %["#B"],        24             \n\t"     \
-+      "shll_s.w         %[" #R "],      %[" #R "],        9          \n\t"     \
-+      "shll_s.w         %[" #G "],      %[" #G "],        9          \n\t"     \
-+      "shll_s.w         %[" #B "],      %[" #B "],        9          \n\t"     \
-+      "precrqu_s.qb.ph  %[" #R "],      %[" #R "],        $zero      \n\t"     \
-+      "precrqu_s.qb.ph  %[" #G "],      %[" #G "],        $zero      \n\t"     \
-+      "precrqu_s.qb.ph  %[" #B "],      %[" #B "],        $zero      \n\t"     \
-+      "srl              %[" #R "],      %[" #R "],        24         \n\t"     \
-+      "srl              %[" #G "],      %[" #G "],        24         \n\t"     \
-+      "srl              %[" #B "],      %[" #B "],        24         \n\t"     \
-       : [R]"+r"(R), [G]"+r"(G), [B]"+r"(B)                                     \
-       :                                                                        \
-     );                                                                         \
-diff --git a/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c b/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c
-index 43f02cc..45a2200 100644
---- a/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c
-+++ b/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c
-@@ -39,12 +39,12 @@
-   "addu             %[temp5],   %[temp0],       %[temp1]        \n\t"          \
-   "subu             %[temp6],   %[temp0],       %[temp2]        \n\t"          \
-   "addu             %[temp7],   %[temp0],       %[temp4]        \n\t"          \
--".if "#K"                                                       \n\t"          \
-+".if " #K "                                                     \n\t"          \
-   "lbu              %[temp0],   1(%[y])                         \n\t"          \
- ".endif                                                         \n\t"          \
-   "shll_s.w         %[temp5],   %[temp5],       9               \n\t"          \
-   "shll_s.w         %[temp6],   %[temp6],       9               \n\t"          \
--".if "#K"                                                       \n\t"          \
-+".if " #K "                                                     \n\t"          \
-   "mul              %[temp0],   %[t_con_5],     %[temp0]        \n\t"          \
- ".endif                                                         \n\t"          \
-   "shll_s.w         %[temp7],   %[temp7],       9               \n\t"          \
-@@ -54,9 +54,9 @@
-   "srl              %[temp5],   %[temp5],       24              \n\t"          \
-   "srl              %[temp6],   %[temp6],       24              \n\t"          \
-   "srl              %[temp7],   %[temp7],       24              \n\t"          \
--  "sb               %[temp5],   "#R"(%[dst])                    \n\t"          \
--  "sb               %[temp6],   "#G"(%[dst])                    \n\t"          \
--  "sb               %[temp7],   "#B"(%[dst])                    \n\t"          \
-+  "sb               %[temp5],   " #R "(%[dst])                  \n\t"          \
-+  "sb               %[temp6],   " #G "(%[dst])                  \n\t"          \
-+  "sb               %[temp7],   " #B "(%[dst])                  \n\t"          \
- 
- #define ASM_CLOBBER_LIST()                                                     \
-   : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2),             \
diff --git a/gnu/packages/patches/freeimage-unbundle.patch b/gnu/packages/patches/freeimage-unbundle.patch
index ca907d327..7580539ef 100644
--- a/gnu/packages/patches/freeimage-unbundle.patch
+++ b/gnu/packages/patches/freeimage-unbundle.patch
@@ -1,8 +1,8 @@
-https://src.fedoraproject.org/cgit/rpms/freeimage.git/tree/FreeImage-3.17.0_unbundle.patch
+https://src.fedoraproject.org/cgit/rpms/freeimage.git/tree/FreeImage_unbundle.patch
 
 diff -rupN FreeImage/genfipsrclist.sh FreeImage-new/genfipsrclist.sh
---- FreeImage/genfipsrclist.sh	2015-02-20 10:52:16.000000000 +0100
-+++ FreeImage-new/genfipsrclist.sh	2015-09-05 02:13:52.041353305 +0200
+--- FreeImage/genfipsrclist.sh	2018-07-28 18:53:18.000000000 +0200
++++ FreeImage-new/genfipsrclist.sh	2018-07-31 23:37:58.552953202 +0200
 @@ -1,6 +1,6 @@
  #!/bin/sh
  
@@ -19,19 +19,19 @@ diff -rupN FreeImage/genfipsrclist.sh FreeImage-new/genfipsrclist.sh
  echo >> fipMakefile.srcs
  
 diff -rupN FreeImage/gensrclist.sh FreeImage-new/gensrclist.sh
---- FreeImage/gensrclist.sh	2015-02-20 10:51:50.000000000 +0100
-+++ FreeImage-new/gensrclist.sh	2015-09-05 02:13:52.041353305 +0200
+--- FreeImage/gensrclist.sh	2018-07-28 18:52:50.000000000 +0200
++++ FreeImage-new/gensrclist.sh	2018-07-31 23:37:58.555953202 +0200
 @@ -1,6 +1,6 @@
  #!/bin/sh
  
 -DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/OpenEXR/IexMath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib"
-+DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib"
++DIRLIST=". Source Source/Metadata Source/FreeImageToolkit"
  
  echo "VER_MAJOR = 3" > Makefile.srcs
- echo "VER_MINOR = 17.0" >> Makefile.srcs
+ echo "VER_MINOR = 18.0" >> Makefile.srcs
 diff -rupN FreeImage/Makefile.fip FreeImage-new/Makefile.fip
---- FreeImage/Makefile.fip	2015-03-08 18:03:56.000000000 +0100
-+++ FreeImage-new/Makefile.fip	2015-09-05 02:14:09.212684028 +0200
+--- FreeImage/Makefile.fip	2015-03-10 08:03:56.000000000 +0100
++++ FreeImage-new/Makefile.fip	2018-07-31 23:37:58.556953201 +0200
 @@ -17,20 +17,22 @@ MODULES = $(SRCS:.c=.o)
  MODULES := $(MODULES:.cpp=.o)
  CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
@@ -73,8 +73,8 @@ diff -rupN FreeImage/Makefile.fip FreeImage-new/Makefile.fip
  install:
  	install -d $(INCDIR) $(INSTALLDIR)
 diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
---- FreeImage/Makefile.gnu	2015-03-08 18:04:00.000000000 +0100
-+++ FreeImage-new/Makefile.gnu	2015-09-05 02:14:04.810599259 +0200
+--- FreeImage/Makefile.gnu	2015-03-10 08:04:00.000000000 +0100
++++ FreeImage-new/Makefile.gnu	2018-07-31 23:37:58.556953201 +0200
 @@ -16,21 +16,11 @@ LIBRARIES = -lstdc++
  MODULES = $(SRCS:.c=.o)
  MODULES := $(MODULES:.cpp=.o)
@@ -90,8 +90,8 @@ diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
 -# LibJXR
 -CXXFLAGS += -D__ANSI__
 -CXXFLAGS += $(INCLUDE)
-+override CFLAGS += $(INCLUDE) -D__ANSI__ $(shell pkg-config --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
-+override LDFLAGS += -ljpeg $(shell pkg-config --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
++override CFLAGS += $(INCLUDE) -D__ANSI__ -I/usr/include/jxrlib $(shell pkg-config --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
++override LDFLAGS += -ljpeg -ljpegxr -ljxrglue $(shell pkg-config --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
  
  ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
 -	CFLAGS += -fPIC
@@ -117,8 +117,8 @@ diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
  install:
  	install -d $(INCDIR) $(INSTALLDIR)
 diff -rupN FreeImage/Source/FreeImage/J2KHelper.cpp FreeImage-new/Source/FreeImage/J2KHelper.cpp
---- FreeImage/Source/FreeImage/J2KHelper.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/J2KHelper.cpp	2015-09-05 02:13:52.042353324 +0200
+--- FreeImage/Source/FreeImage/J2KHelper.cpp	2015-03-03 23:07:08.000000000 +0100
++++ FreeImage-new/Source/FreeImage/J2KHelper.cpp	2018-07-31 23:37:58.557953201 +0200
 @@ -21,7 +21,7 @@
  
  #include "FreeImage.h"
@@ -129,8 +129,8 @@ diff -rupN FreeImage/Source/FreeImage/J2KHelper.cpp FreeImage-new/Source/FreeIma
  
  // --------------------------------------------------------------------------
 diff -rupN FreeImage/Source/FreeImage/Plugin.cpp FreeImage-new/Source/FreeImage/Plugin.cpp
---- FreeImage/Source/FreeImage/Plugin.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/Plugin.cpp	2015-09-05 02:13:52.042353324 +0200
+--- FreeImage/Source/FreeImage/Plugin.cpp	2017-02-18 14:09:28.000000000 +0100
++++ FreeImage-new/Source/FreeImage/Plugin.cpp	2018-07-31 23:37:58.558953201 +0200
 @@ -263,7 +263,12 @@ FreeImage_Initialise(BOOL load_local_plu
  			s_plugins->AddNode(InitDDS);
  	        s_plugins->AddNode(InitGIF);
@@ -146,8 +146,8 @@ diff -rupN FreeImage/Source/FreeImage/Plugin.cpp FreeImage-new/Source/FreeImage/
  			s_plugins->AddNode(InitEXR);
  			s_plugins->AddNode(InitJ2K);
 diff -rupN FreeImage/Source/FreeImage/PluginEXR.cpp FreeImage-new/Source/FreeImage/PluginEXR.cpp
---- FreeImage/Source/FreeImage/PluginEXR.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginEXR.cpp	2015-09-05 02:13:52.042353324 +0200
+--- FreeImage/Source/FreeImage/PluginEXR.cpp	2015-03-03 23:07:08.000000000 +0100
++++ FreeImage-new/Source/FreeImage/PluginEXR.cpp	2018-07-31 23:37:58.559953201 +0200
 @@ -28,16 +28,16 @@
  #pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
  #endif 
@@ -176,8 +176,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginEXR.cpp FreeImage-new/Source/FreeIma
  
  // ==========================================================
 diff -rupN FreeImage/Source/FreeImage/PluginJ2K.cpp FreeImage-new/Source/FreeImage/PluginJ2K.cpp
---- FreeImage/Source/FreeImage/PluginJ2K.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginJ2K.cpp	2015-09-05 02:13:52.043353343 +0200
+--- FreeImage/Source/FreeImage/PluginJ2K.cpp	2015-03-03 23:07:08.000000000 +0100
++++ FreeImage-new/Source/FreeImage/PluginJ2K.cpp	2018-07-31 23:37:58.559953201 +0200
 @@ -21,7 +21,7 @@
  
  #include "FreeImage.h"
@@ -188,8 +188,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginJ2K.cpp FreeImage-new/Source/FreeIma
  
  // ==========================================================
 diff -rupN FreeImage/Source/FreeImage/PluginJP2.cpp FreeImage-new/Source/FreeImage/PluginJP2.cpp
---- FreeImage/Source/FreeImage/PluginJP2.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginJP2.cpp	2015-09-05 02:13:52.043353343 +0200
+--- FreeImage/Source/FreeImage/PluginJP2.cpp	2015-03-03 23:07:08.000000000 +0100
++++ FreeImage-new/Source/FreeImage/PluginJP2.cpp	2018-07-31 23:37:58.560953201 +0200
 @@ -21,7 +21,7 @@
  
  #include "FreeImage.h"
@@ -200,8 +200,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginJP2.cpp FreeImage-new/Source/FreeIma
  
  // ==========================================================
 diff -rupN FreeImage/Source/FreeImage/PluginJPEG.cpp FreeImage-new/Source/FreeImage/PluginJPEG.cpp
---- FreeImage/Source/FreeImage/PluginJPEG.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginJPEG.cpp	2015-09-05 02:13:52.043353343 +0200
+--- FreeImage/Source/FreeImage/PluginJPEG.cpp	2018-07-28 19:22:22.000000000 +0200
++++ FreeImage-new/Source/FreeImage/PluginJPEG.cpp	2018-07-31 23:37:58.561953201 +0200
 @@ -35,9 +35,9 @@ extern "C" {
  #undef FAR
  #include <setjmp.h>
@@ -215,9 +215,138 @@ diff -rupN FreeImage/Source/FreeImage/PluginJPEG.cpp FreeImage-new/Source/FreeIm
  }
  
  #include "FreeImage.h"
+@@ -485,116 +485,6 @@ marker_is_icc(jpeg_saved_marker_ptr mark
+ }
+ 
+ /**
+-  See if there was an ICC profile in the JPEG file being read;
+-  if so, reassemble and return the profile data.
+-
+-  TRUE is returned if an ICC profile was found, FALSE if not.
+-  If TRUE is returned, *icc_data_ptr is set to point to the
+-  returned data, and *icc_data_len is set to its length.
+-  
+-  IMPORTANT: the data at **icc_data_ptr has been allocated with malloc()
+-  and must be freed by the caller with free() when the caller no longer
+-  needs it.  (Alternatively, we could write this routine to use the
+-  IJG library's memory allocator, so that the data would be freed implicitly
+-  at jpeg_finish_decompress() time.  But it seems likely that many apps
+-  will prefer to have the data stick around after decompression finishes.)
+-  
+-  NOTE: if the file contains invalid ICC APP2 markers, we just silently
+-  return FALSE.  You might want to issue an error message instead.
+-*/
+-static BOOL 
+-jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned *icc_data_len) {
+-	jpeg_saved_marker_ptr marker;
+-	int num_markers = 0;
+-	int seq_no;
+-	JOCTET *icc_data;
+-	unsigned total_length;
+-
+-	const int MAX_SEQ_NO = 255;			// sufficient since marker numbers are bytes
+-	BYTE marker_present[MAX_SEQ_NO+1];	// 1 if marker found
+-	unsigned data_length[MAX_SEQ_NO+1];	// size of profile data in marker
+-	unsigned data_offset[MAX_SEQ_NO+1];	// offset for data in marker
+-	
+-	*icc_data_ptr = NULL;		// avoid confusion if FALSE return
+-	*icc_data_len = 0;
+-	
+-	/**
+-	this first pass over the saved markers discovers whether there are
+-	any ICC markers and verifies the consistency of the marker numbering.
+-	*/
+-	
+-	memset(marker_present, 0, (MAX_SEQ_NO + 1));
+-	
+-	for(marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
+-		if (marker_is_icc(marker)) {
+-			if (num_markers == 0) {
+-				// number of markers
+-				num_markers = GETJOCTET(marker->data[13]);
+-			}
+-			else if (num_markers != GETJOCTET(marker->data[13])) {
+-				return FALSE;		// inconsistent num_markers fields 
+-			}
+-			// sequence number
+-			seq_no = GETJOCTET(marker->data[12]);
+-			if (seq_no <= 0 || seq_no > num_markers) {
+-				return FALSE;		// bogus sequence number 
+-			}
+-			if (marker_present[seq_no]) {
+-				return FALSE;		// duplicate sequence numbers 
+-			}
+-			marker_present[seq_no] = 1;
+-			data_length[seq_no] = marker->data_length - ICC_HEADER_SIZE;
+-		}
+-	}
+-	
+-	if (num_markers == 0)
+-		return FALSE;
+-		
+-	/**
+-	check for missing markers, count total space needed,
+-	compute offset of each marker's part of the data.
+-	*/
+-	
+-	total_length = 0;
+-	for(seq_no = 1; seq_no <= num_markers; seq_no++) {
+-		if (marker_present[seq_no] == 0) {
+-			return FALSE;		// missing sequence number
+-		}
+-		data_offset[seq_no] = total_length;
+-		total_length += data_length[seq_no];
+-	}
+-	
+-	if (total_length <= 0)
+-		return FALSE;		// found only empty markers ?
+-	
+-	// allocate space for assembled data 
+-	icc_data = (JOCTET *) malloc(total_length * sizeof(JOCTET));
+-	if (icc_data == NULL)
+-		return FALSE;		// out of memory
+-	
+-	// and fill it in
+-	for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
+-		if (marker_is_icc(marker)) {
+-			JOCTET FAR *src_ptr;
+-			JOCTET *dst_ptr;
+-			unsigned length;
+-			seq_no = GETJOCTET(marker->data[12]);
+-			dst_ptr = icc_data + data_offset[seq_no];
+-			src_ptr = marker->data + ICC_HEADER_SIZE;
+-			length = data_length[seq_no];
+-			while (length--) {
+-				*dst_ptr++ = *src_ptr++;
+-			}
+-		}
+-	}
+-	
+-	*icc_data_ptr = icc_data;
+-	*icc_data_len = total_length;
+-	
+-	return TRUE;
+-}
+-
+-/**
+ 	Read JPEG_APPD marker (IPTC or Adobe Photoshop profile)
+ */
+ static BOOL 
+diff -rupN FreeImage/Source/FreeImage/PluginJXR.cpp FreeImage-new/Source/FreeImage/PluginJXR.cpp
+--- FreeImage/Source/FreeImage/PluginJXR.cpp	2015-03-03 23:07:08.000000000 +0100
++++ FreeImage-new/Source/FreeImage/PluginJXR.cpp	2018-07-31 23:37:58.561953201 +0200
+@@ -23,7 +23,7 @@
+ #include "Utilities.h"
+ #include "../Metadata/FreeImageTag.h"
+ 
+-#include "../LibJXR/jxrgluelib/JXRGlue.h"
++#include <JXRGlue.h>
+ 
+ // ==========================================================
+ // Plugin Interface
 diff -rupN FreeImage/Source/FreeImage/PluginPNG.cpp FreeImage-new/Source/FreeImage/PluginPNG.cpp
---- FreeImage/Source/FreeImage/PluginPNG.cpp	2015-03-10 20:16:12.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginPNG.cpp	2015-09-05 02:13:52.044353363 +0200
+--- FreeImage/Source/FreeImage/PluginPNG.cpp	2018-07-28 20:15:24.000000000 +0200
++++ FreeImage-new/Source/FreeImage/PluginPNG.cpp	2018-07-31 23:37:58.561953201 +0200
 @@ -40,8 +40,8 @@
  
  // ----------------------------------------------------------
@@ -230,8 +359,8 @@ diff -rupN FreeImage/Source/FreeImage/PluginPNG.cpp FreeImage-new/Source/FreeIma
  // ----------------------------------------------------------
  
 diff -rupN FreeImage/Source/FreeImage/PluginRAW.cpp FreeImage-new/Source/FreeImage/PluginRAW.cpp
---- FreeImage/Source/FreeImage/PluginRAW.cpp	2015-03-08 20:12:04.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginRAW.cpp	2015-09-05 02:13:52.044353363 +0200
+--- FreeImage/Source/FreeImage/PluginRAW.cpp	2015-03-10 10:12:04.000000000 +0100
++++ FreeImage-new/Source/FreeImage/PluginRAW.cpp	2018-07-31 23:37:58.561953201 +0200
 @@ -19,7 +19,7 @@
  // Use at your own risk!
  // ==========================================================
@@ -242,58 +371,125 @@ diff -rupN FreeImage/Source/FreeImage/PluginRAW.cpp FreeImage-new/Source/FreeIma
  #include "FreeImage.h"
  #include "Utilities.h"
 diff -rupN FreeImage/Source/FreeImage/PluginTIFF.cpp FreeImage-new/Source/FreeImage/PluginTIFF.cpp
---- FreeImage/Source/FreeImage/PluginTIFF.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginTIFF.cpp	2015-09-05 02:13:52.044353363 +0200
+--- FreeImage/Source/FreeImage/PluginTIFF.cpp	2018-07-29 00:24:43.000000000 +0200
++++ FreeImage-new/Source/FreeImage/PluginTIFF.cpp	2018-07-31 23:52:38.774904514 +0200
 @@ -37,9 +37,9 @@
- 
- #include "FreeImage.h"
- #include "Utilities.h"
--#include "../LibTIFF4/tiffiop.h"
-+#include <tiffio.h>
- #include "../Metadata/FreeImageTag.h"
--#include "../OpenEXR/Half/half.h"
-+#include <OpenEXR/half.h>
- 
- #include "FreeImageIO.h"
- #include "PSDParser.h"
-@@ -194,16 +194,6 @@ TIFFFdOpen(thandle_t handle, const char
- 	return tif;
- }
- 
--/**
--Open a TIFF file for reading or writing
--@param name
--@param mode
--*/
--TIFF*
--TIFFOpen(const char* name, const char* mode) {
--	return 0;
--}
--
- // ----------------------------------------------------------
- //   TIFF library FreeImage-specific routines.
- // ----------------------------------------------------------
+ 
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibTIFF4/tiffiop.h"
++#include <tiffio.h>
+ #include "../Metadata/FreeImageTag.h"
+-#include "../OpenEXR/Half/half.h"
++#include <OpenEXR/half.h>
+ 
+ #include "FreeImageIO.h"
+ #include "PSDParser.h"
+@@ -193,17 +193,6 @@ TIFFFdOpen(thandle_t handle, const char
+ 
+ 	return tif;
+ }
+-
+-/**
+-Open a TIFF file for reading or writing
+-@param name
+-@param mode
+-*/
+-TIFF*
+-TIFFOpen(const char* name, const char* mode) {
+-	return 0;
+-}
+-
+ // ----------------------------------------------------------
+ //   TIFF library FreeImage-specific routines.
+ // ----------------------------------------------------------
 diff -rupN FreeImage/Source/FreeImage/PluginWebP.cpp FreeImage-new/Source/FreeImage/PluginWebP.cpp
---- FreeImage/Source/FreeImage/PluginWebP.cpp	2015-03-02 02:07:08.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/PluginWebP.cpp	2015-09-05 02:13:52.044353363 +0200
-@@ -24,10 +24,10 @@
+--- FreeImage/Source/FreeImage/PluginWebP.cpp	2016-06-15 15:48:12.000000000 +0200
++++ FreeImage-new/Source/FreeImage/PluginWebP.cpp	2018-07-31 23:38:40.531950880 +0200
+@@ -24,9 +24,9 @@
  
  #include "../Metadata/FreeImageTag.h"
  
 -#include "../LibWebP/src/webp/decode.h"
 -#include "../LibWebP/src/webp/encode.h"
--#include "../LibWebP/src/enc/vp8enci.h"
 -#include "../LibWebP/src/webp/mux.h"
 +#include <webp/decode.h>
 +#include <webp/encode.h>
-+// #include "../LibWebP/src/enc/vp8enci.h"
 +#include <webp/mux.h>
  
  // ==========================================================
  // Plugin Interface
+diff -rupN FreeImage/Source/FreeImage/PSDParser.cpp FreeImage-new/Source/FreeImage/PSDParser.cpp
+--- FreeImage/Source/FreeImage/PSDParser.cpp	2016-02-11 03:18:02.000000000 +0100
++++ FreeImage-new/Source/FreeImage/PSDParser.cpp	2018-08-01 00:17:18.323822675 +0200
+@@ -133,8 +133,8 @@ public:
+ template <>
+ class PSDGetValue<8> {
+ public:
+-	static inline UINT64 get(const BYTE * iprBuffer) {
+-		UINT64 v = ((const UINT64*)iprBuffer)[0];
++	static inline uint64_t get(const BYTE * iprBuffer) {
++		uint64_t v = ((const uint64_t*)iprBuffer)[0];
+ #ifndef FREEIMAGE_BIGENDIAN
+ 		SwapInt64(&v);
+ #endif
+@@ -147,7 +147,7 @@ public:
+ 
+ // --------------------------------------------------------------------------
+ 
+-static UINT64
++static uint64_t
+ psdReadSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header) {
+ 	if(header._Version == 1) {
+ 		BYTE Length[4];
+@@ -199,11 +199,11 @@ public:
+ template <>
+ class PSDSetValue<8> {
+ public:
+-	static inline void set(const BYTE * iprBuffer, UINT64 v) {
++	static inline void set(const BYTE * iprBuffer, uint64_t v) {
+ #ifndef FREEIMAGE_BIGENDIAN
+ 		SwapInt64(&v);
+ #endif
+-		((UINT64*)iprBuffer)[0] = v;
++		((uint64_t*)iprBuffer)[0] = v;
+ 	}
+ };
+ 
+@@ -213,7 +213,7 @@ public:
+ // --------------------------------------------------------------------------
+ 
+ static inline bool
+-psdWriteSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header, UINT64 v) {
++psdWriteSize(FreeImageIO *io, fi_handle handle, const psdHeaderInfo& header, uint64_t v) {
+ 	if(header._Version == 1) {
+ 		BYTE Length[4];
+ 		psdSetLongValue(Length, sizeof(Length), (DWORD)v);
+@@ -1063,10 +1063,10 @@ unsigned psdParser::GetChannelOffset(FIB
+ bool psdParser::ReadLayerAndMaskInfoSection(FreeImageIO *io, fi_handle handle)	{
+ 	bool bSuccess = true;
+ 
+-	UINT64 nTotalBytes = psdReadSize(io, handle, _headerInfo);
++	uint64_t nTotalBytes = psdReadSize(io, handle, _headerInfo);
+ 
+ 	// Hack to handle large PSB files without using fseeko().
+-	if (sizeof(long) < sizeof(UINT64)) {
++	if (sizeof(long) < sizeof(uint64_t)) {
+ 		const long offset = 0x10000000;
+ 		while (nTotalBytes > offset) {
+ 			if (io->seek_proc(handle, offset, SEEK_CUR) != 0) {
+@@ -1672,7 +1672,7 @@ bool psdParser::WriteLayerAndMaskInfoSec
+ 	// Short section with no layers.
+ 	BYTE IntValue[4];
+ 
+-	UINT64 size;
++	uint64_t size;
+ 	if(_headerInfo._Version == 1) {
+ 		size = 8;
+ 	} else {
 diff -rupN FreeImage/Source/FreeImage/ZLibInterface.cpp FreeImage-new/Source/FreeImage/ZLibInterface.cpp
---- FreeImage/Source/FreeImage/ZLibInterface.cpp	2015-03-02 02:07:10.000000000 +0100
-+++ FreeImage-new/Source/FreeImage/ZLibInterface.cpp	2015-09-05 02:13:52.044353363 +0200
+--- FreeImage/Source/FreeImage/ZLibInterface.cpp	2015-03-03 23:07:10.000000000 +0100
++++ FreeImage-new/Source/FreeImage/ZLibInterface.cpp	2018-07-31 23:37:58.563953201 +0200
 @@ -19,10 +19,9 @@
  // Use at your own risk!
  // ==========================================================
@@ -316,8 +512,8 @@ diff -rupN FreeImage/Source/FreeImage/ZLibInterface.cpp FreeImage-new/Source/Fre
  	        memcpy(target + 4 + dest_len, &crc, 4);
  	        memcpy(target + 8 + dest_len, &source_size, 4);
 diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
---- FreeImage/Source/FreeImage.h	2015-03-04 02:17:54.000000000 +0100
-+++ FreeImage-new/Source/FreeImage.h	2015-09-05 02:13:52.045353382 +0200
+--- FreeImage/Source/FreeImage.h	2018-03-25 18:42:20.000000000 +0200
++++ FreeImage-new/Source/FreeImage.h	2018-08-01 00:16:34.704825088 +0200
 @@ -155,8 +155,11 @@ typedef uint8_t BYTE;
  typedef uint16_t WORD;
  typedef uint32_t DWORD;
@@ -363,7 +559,7 @@ diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
  
  /** Tone mapping operators.
  Constants used in FreeImage_ToneMapping.
-@@ -1076,7 +1089,10 @@ DLL_API const char* DLL_CALLCONV FreeIma
+@@ -1088,7 +1101,10 @@ DLL_API const char* DLL_CALLCONV FreeIma
  // --------------------------------------------------------------------------
  // JPEG lossless transformation routines
  // --------------------------------------------------------------------------
@@ -375,7 +571,7 @@ diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
  DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
  DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
  DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
-@@ -1085,6 +1101,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEG
+@@ -1097,6 +1113,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEG
  DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
  DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
  DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
@@ -384,8 +580,8 @@ diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
  
  // --------------------------------------------------------------------------
 diff -rupN FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp
---- FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp	2015-03-02 02:07:10.000000000 +0100
-+++ FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp	2015-09-05 02:13:52.045353382 +0200
+--- FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp	2015-03-03 23:07:10.000000000 +0100
++++ FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp	2018-07-31 23:37:58.563953201 +0200
 @@ -26,10 +26,10 @@ extern "C" {
  #undef FAR
  #include <setjmp.h>
@@ -402,8 +598,8 @@ diff -rupN FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp FreeImage-new/Sou
  
  #include "FreeImage.h"
 diff -rupN FreeImage/Source/Metadata/TagConversion.cpp FreeImage-new/Source/Metadata/TagConversion.cpp
---- FreeImage/Source/Metadata/TagConversion.cpp	2015-03-02 02:07:10.000000000 +0100
-+++ FreeImage-new/Source/Metadata/TagConversion.cpp	2015-09-05 02:13:52.045353382 +0200
+--- FreeImage/Source/Metadata/TagConversion.cpp	2018-03-25 12:30:54.000000000 +0200
++++ FreeImage-new/Source/Metadata/TagConversion.cpp	2018-07-31 23:37:58.564953201 +0200
 @@ -30,6 +30,11 @@
  
  #define MAX_TEXT_EXTENT	512
@@ -417,8 +613,8 @@ diff -rupN FreeImage/Source/Metadata/TagConversion.cpp FreeImage-new/Source/Meta
  Convert a tag to a C string
  */
 diff -rupN FreeImage/Source/Metadata/XTIFF.cpp FreeImage-new/Source/Metadata/XTIFF.cpp
---- FreeImage/Source/Metadata/XTIFF.cpp	2015-03-02 02:07:10.000000000 +0100
-+++ FreeImage-new/Source/Metadata/XTIFF.cpp	2015-09-05 02:13:52.045353382 +0200
+--- FreeImage/Source/Metadata/XTIFF.cpp	2015-03-03 23:07:10.000000000 +0100
++++ FreeImage-new/Source/Metadata/XTIFF.cpp	2018-07-31 23:37:58.564953201 +0200
 @@ -29,13 +29,18 @@
  #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
  #endif
@@ -536,3 +732,21 @@ diff -rupN FreeImage/Source/Metadata/XTIFF.cpp FreeImage-new/Source/Metadata/XTI
  
  		if(skip_write_field(tif, tag_id)) {
  			// skip tags that are already handled by the LibTIFF writing process
+diff -rupN FreeImage/Source/Utilities.h FreeImage-new/Source/Utilities.h
+--- FreeImage/Source/Utilities.h	2016-04-11 15:15:32.000000000 +0200
++++ FreeImage-new/Source/Utilities.h	2018-08-01 00:16:29.826825358 +0200
+@@ -446,12 +446,12 @@ SwapLong(DWORD *lp) {
+ }
+  
+ inline void
+-SwapInt64(UINT64 *arg) {
++SwapInt64(uint64_t *arg) {
+ #if defined(_MSC_VER) && _MSC_VER >= 1310
+ 	*arg = _byteswap_uint64(*arg);
+ #else
+ 	union Swap {
+-		UINT64 sv;
++		uint64_t sv;
+ 		DWORD ul[2];
+ 	} tmp, result;
+ 	tmp.sv = *arg;
-- 
2.20.1






Reply sent to Marius Bakke <mbakke <at> fastmail.com>:
You have taken responsibility. (Wed, 25 Sep 2019 15:49:03 GMT) Full text and rfc822 format available.

Notification sent to Kei Kebreau <kkebreau <at> posteo.net>:
bug acknowledged by developer. (Wed, 25 Sep 2019 15:49:03 GMT) Full text and rfc822 format available.

Message #13 received at 34013-done <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Kei Kebreau <kkebreau <at> posteo.net>, 34013-done <at> debbugs.gnu.org
Subject: Re: [bug#34013] [PATCH 2/2] gnu: freeimage: Update to 3.18.0.
Date: Wed, 25 Sep 2019 17:48:39 +0200
[Message part 1 (text/plain, inline)]
Kei Kebreau <kkebreau <at> posteo.net> writes:

> * gnu/packages/image.scm (freeimage): Update to 3.18.0.
> [source]: Modify snippet to remove the bundled libjxr. Remove obsolete
> patches.
> [arguments]: Add libjxr include directory to #:make-flags.
> [inputs]: Add libjxr and substitute libjpeg-turbo for libjpeg.
> * gnu/packages/patches/freeimage-CVE-2015-0852.patch,
> gnu/packages/patches/freeimage-CVE-2016-5684.patch,
> gnu/packages/patches/freeimage-fix-build-with-gcc-5.patch: Delete files.
> * gnu/local.mk (dist_patch_DATA): Unregister patches.
> * gnu/packages/patches/freeimage-unbundle.patch: Update patch.

Pushed in 8dc3c2a7d5, thanks!  I had to manually modify the unbundling
patch to make it apply.  Hope I did not mess anything up :-)

As an added bonus, all freeimage dependents are now working again \o/
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Oct 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 179 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.