summaryrefslogtreecommitdiff
path: root/src/3rdparty/libwebp/src/enc/picture_psnr_enc.c
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-05-14 13:07:15 +0200
committerLiang Qi <liang.qi@qt.io>2018-05-22 08:03:36 +0000
commit62082a63e112e9991b33c2045896ced78ffcb62e (patch)
tree04a66f057499c90be0a8abfe8b0375886c6f25df /src/3rdparty/libwebp/src/enc/picture_psnr_enc.c
parent92398950d9cfe5a88cb685ec166eb413aa8613ec (diff)
downloadqtimageformats-62082a63e112e9991b33c2045896ced78ffcb62e.tar.gz
Update bundled libwebp to version 1.0.0
This commit imports libwebp 1.0.0, including AUTHORS, COPYING, ChangeLog, NEWS, PATENTS, README and src directories. In src, only includes header and source files. Upstream changes since 0.6.1 have been merged in. Also updated version in qt_attribution.json. [ChangeLog][Third-Party Code] Update bundled libwebp to version 1.0.0. Change-Id: Ia30ccc90286d5dd3e48e091f101f1cae84785150 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/3rdparty/libwebp/src/enc/picture_psnr_enc.c')
-rw-r--r--src/3rdparty/libwebp/src/enc/picture_psnr_enc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/3rdparty/libwebp/src/enc/picture_psnr_enc.c b/src/3rdparty/libwebp/src/enc/picture_psnr_enc.c
index 362a7c7..1a2f0be 100644
--- a/src/3rdparty/libwebp/src/enc/picture_psnr_enc.c
+++ b/src/3rdparty/libwebp/src/enc/picture_psnr_enc.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <stdlib.h>
+#include "src/dsp/dsp.h"
#include "src/enc/vp8i_enc.h"
#include "src/utils/utils.h"
@@ -169,6 +170,12 @@ int WebPPlaneDistortion(const uint8_t* src, size_t src_stride,
return 1;
}
+#ifdef WORDS_BIGENDIAN
+#define BLUE_OFFSET 3 // uint32_t 0x000000ff is 0x00,00,00,ff in memory
+#else
+#define BLUE_OFFSET 0 // uint32_t 0x000000ff is 0xff,00,00,00 in memory
+#endif
+
int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
int type, float results[5]) {
int w, h, c;
@@ -195,8 +202,10 @@ int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
float distortion;
const size_t stride0 = 4 * (size_t)p0.argb_stride;
const size_t stride1 = 4 * (size_t)p1.argb_stride;
- if (!WebPPlaneDistortion((const uint8_t*)p0.argb + c, stride0,
- (const uint8_t*)p1.argb + c, stride1,
+ // results are reported as BGRA
+ const int offset = c ^ BLUE_OFFSET;
+ if (!WebPPlaneDistortion((const uint8_t*)p0.argb + offset, stride0,
+ (const uint8_t*)p1.argb + offset, stride1,
w, h, 4, type, &distortion, results + c)) {
goto Error;
}
@@ -214,6 +223,8 @@ int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
return ok;
}
+#undef BLUE_OFFSET
+
#else // defined(WEBP_DISABLE_STATS)
int WebPPlaneDistortion(const uint8_t* src, size_t src_stride,
const uint8_t* ref, size_t ref_stride,