mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 15:32:53 +01:00
add WEBP_DISABLE_STATS
use to to make WebPPictureDistortion & WebPPlaneDistortion noops and clear some ssim code. Change-Id: I9b50b2318b7a114632e5a237a4002f64e95afbbc
This commit is contained in:
parent
8052c585b3
commit
eab5bab74f
@ -316,9 +316,11 @@ typedef double (*VP8SSIMGetFunc)(const uint8_t* src1, int stride1,
|
||||
extern VP8SSIMGetFunc VP8SSIMGet; // unclipped / unchecked
|
||||
extern VP8SSIMGetClippedFunc VP8SSIMGetClipped; // with clipping
|
||||
|
||||
#if !defined(WEBP_DISABLE_STATS)
|
||||
typedef uint32_t (*VP8AccumulateSSEFunc)(const uint8_t* src1,
|
||||
const uint8_t* src2, int len);
|
||||
extern VP8AccumulateSSEFunc VP8AccumulateSSE;
|
||||
#endif
|
||||
|
||||
// must be called before using any of the above directly
|
||||
void VP8SSIMDspInit(void);
|
||||
|
@ -109,6 +109,7 @@ static double SSIMGet_C(const uint8_t* src1, int stride1,
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if !defined(WEBP_DISABLE_STATS)
|
||||
static uint32_t AccumulateSSE_C(const uint8_t* src1,
|
||||
const uint8_t* src2, int len) {
|
||||
int i;
|
||||
@ -120,12 +121,15 @@ static uint32_t AccumulateSSE_C(const uint8_t* src1,
|
||||
}
|
||||
return sse2;
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
VP8SSIMGetFunc VP8SSIMGet;
|
||||
VP8SSIMGetClippedFunc VP8SSIMGetClipped;
|
||||
#if !defined(WEBP_DISABLE_STATS)
|
||||
VP8AccumulateSSEFunc VP8AccumulateSSE;
|
||||
#endif
|
||||
|
||||
extern void VP8SSIMDspInitSSE2(void);
|
||||
|
||||
@ -138,7 +142,10 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInit(void) {
|
||||
VP8SSIMGetClipped = SSIMGetClipped_C;
|
||||
VP8SSIMGet = SSIMGet_C;
|
||||
|
||||
#if !defined(WEBP_DISABLE_STATS)
|
||||
VP8AccumulateSSE = AccumulateSSE_C;
|
||||
#endif
|
||||
|
||||
if (VP8GetCPUInfo != NULL) {
|
||||
#if defined(WEBP_USE_SSE2)
|
||||
if (VP8GetCPUInfo(kSSE2)) {
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "src/dsp/common_sse2.h"
|
||||
|
||||
#if !defined(WEBP_DISABLE_STATS)
|
||||
|
||||
// Helper function
|
||||
static WEBP_INLINE void SubtractAndSquare_SSE2(const __m128i a, const __m128i b,
|
||||
__m128i* const sum) {
|
||||
@ -77,6 +79,7 @@ static uint32_t AccumulateSSE_SSE2(const uint8_t* src1,
|
||||
}
|
||||
return sse2;
|
||||
}
|
||||
#endif // !defined(WEBP_DISABLE_STATS)
|
||||
|
||||
static uint32_t HorizontalAdd16b_SSE2(const __m128i* const m) {
|
||||
uint16_t tmp[8];
|
||||
@ -143,7 +146,9 @@ static double SSIMGet_SSE2(const uint8_t* src1, int stride1,
|
||||
extern void VP8SSIMDspInitSSE2(void);
|
||||
|
||||
WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInitSSE2(void) {
|
||||
#if !defined(WEBP_DISABLE_STATS)
|
||||
VP8AccumulateSSE = AccumulateSSE_SSE2;
|
||||
#endif
|
||||
VP8SSIMGet = SSIMGet_SSE2;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,10 @@
|
||||
//
|
||||
// Author: Skal (pascal.massimino@gmail.com)
|
||||
|
||||
#include "src/webp/encode.h"
|
||||
|
||||
#if !defined(WEBP_DISABLE_STATS)
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -210,4 +214,34 @@ int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
|
||||
return ok;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#else // defined(WEBP_DISABLE_STATS)
|
||||
int WebPPlaneDistortion(const uint8_t* src, size_t src_stride,
|
||||
const uint8_t* ref, size_t ref_stride,
|
||||
int width, int height, size_t x_step,
|
||||
int type, float* distortion, float* result) {
|
||||
(void)src;
|
||||
(void)src_stride;
|
||||
(void)ref;
|
||||
(void)ref_stride;
|
||||
(void)width;
|
||||
(void)height;
|
||||
(void)x_step;
|
||||
(void)type;
|
||||
if (distortion == NULL || result == NULL) return 0;
|
||||
*distortion = 0.f;
|
||||
*result = 0.f;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
|
||||
int type, float results[5]) {
|
||||
int i;
|
||||
(void)src;
|
||||
(void)ref;
|
||||
(void)type;
|
||||
if (results == NULL) return 0;
|
||||
for (i = 0; i < 5; ++i) results[i] = 0.f;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // !defined(WEBP_DISABLE_STATS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user