summaryrefslogtreecommitdiff
path: root/thirdparty/libwebp/src/dsp/quant.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/libwebp/src/dsp/quant.h')
-rw-r--r--thirdparty/libwebp/src/dsp/quant.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/thirdparty/libwebp/src/dsp/quant.h b/thirdparty/libwebp/src/dsp/quant.h
index 5ba6f9c377..5e8dba8d19 100644
--- a/thirdparty/libwebp/src/dsp/quant.h
+++ b/thirdparty/libwebp/src/dsp/quant.h
@@ -10,6 +10,8 @@
#ifndef WEBP_DSP_QUANT_H_
#define WEBP_DSP_QUANT_H_
+#include <string.h>
+
#include "src/dsp/dsp.h"
#include "src/webp/types.h"
@@ -67,4 +69,17 @@ static WEBP_INLINE int IsFlat(const int16_t* levels, int num_blocks,
#endif // defined(WEBP_USE_NEON) && !defined(WEBP_ANDROID_NEON) &&
// !defined(WEBP_HAVE_NEON_RTCD)
+static WEBP_INLINE int IsFlatSource16(const uint8_t* src) {
+ const uint32_t v = src[0] * 0x01010101u;
+ int i;
+ for (i = 0; i < 16; ++i) {
+ if (memcmp(src + 0, &v, 4) || memcmp(src + 4, &v, 4) ||
+ memcmp(src + 8, &v, 4) || memcmp(src + 12, &v, 4)) {
+ return 0;
+ }
+ src += BPS;
+ }
+ return 1;
+}
+
#endif // WEBP_DSP_QUANT_H_