OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Internal C version of HashDjb2 with int sized count for efficiency. | 30 // Internal C version of HashDjb2 with int sized count for efficiency. |
31 uint32 HashDjb2_C(const uint8* src, int count, uint32 seed); | 31 uint32 HashDjb2_C(const uint8* src, int count, uint32 seed); |
32 | 32 |
33 // This module is for Visual C x86 | 33 // This module is for Visual C x86 |
34 #if !defined(LIBYUV_DISABLE_X86) && \ | 34 #if !defined(LIBYUV_DISABLE_X86) && \ |
35 (defined(_M_IX86) || \ | 35 (defined(_M_IX86) || \ |
36 (defined(__x86_64__) || (defined(__i386__) && !defined(__pic__)))) | 36 (defined(__x86_64__) || (defined(__i386__) && !defined(__pic__)))) |
37 #define HAS_HASHDJB2_SSE41 | 37 #define HAS_HASHDJB2_SSE41 |
38 uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed); | 38 uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed); |
39 | 39 |
40 #if _MSC_VER >= 1700 | 40 #ifdef VISUALC_HAS_AVX2 |
41 #define HAS_HASHDJB2_AVX2 | 41 #define HAS_HASHDJB2_AVX2 |
42 uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed); | 42 uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed); |
43 #endif | 43 #endif |
44 | 44 |
45 #endif // HAS_HASHDJB2_SSE41 | 45 #endif // HAS_HASHDJB2_SSE41 |
46 | 46 |
47 // hash seed of 5381 recommended. | 47 // hash seed of 5381 recommended. |
48 LIBYUV_API | 48 LIBYUV_API |
49 uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) { | 49 uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) { |
50 const int kBlockSize = 1 << 15; // 32768; | 50 const int kBlockSize = 1 << 15; // 32768; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 #if !defined(LIBYUV_DISABLE_NEON) && \ | 131 #if !defined(LIBYUV_DISABLE_NEON) && \ |
132 (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__)) | 132 (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__)) |
133 #define HAS_SUMSQUAREERROR_NEON | 133 #define HAS_SUMSQUAREERROR_NEON |
134 uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count); | 134 uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count); |
135 #endif | 135 #endif |
136 #if !defined(LIBYUV_DISABLE_X86) && \ | 136 #if !defined(LIBYUV_DISABLE_X86) && \ |
137 (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) | 137 (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) |
138 #define HAS_SUMSQUAREERROR_SSE2 | 138 #define HAS_SUMSQUAREERROR_SSE2 |
139 uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count); | 139 uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count); |
140 #endif | 140 #endif |
141 // Visual C 2012 required for AVX2. | 141 |
142 #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && _MSC_VER >= 1700 | 142 #ifdef VISUALC_HAS_AVX2 |
143 #define HAS_SUMSQUAREERROR_AVX2 | 143 #define HAS_SUMSQUAREERROR_AVX2 |
144 uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count); | 144 uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count); |
145 #endif | 145 #endif |
146 | 146 |
147 // TODO(fbarchard): Refactor into row function. | 147 // TODO(fbarchard): Refactor into row function. |
148 LIBYUV_API | 148 LIBYUV_API |
149 uint64 ComputeSumSquareError(const uint8* src_a, const uint8* src_b, | 149 uint64 ComputeSumSquareError(const uint8* src_a, const uint8* src_b, |
150 int count) { | 150 int count) { |
151 // SumSquareError returns values 0 to 65535 for each squared difference. | 151 // SumSquareError returns values 0 to 65535 for each squared difference. |
152 // Up to 65536 of those can be summed and remain within a uint32. | 152 // Up to 65536 of those can be summed and remain within a uint32. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 const double ssim_v = CalcFrameSsim(src_v_a, stride_v_a, | 364 const double ssim_v = CalcFrameSsim(src_v_a, stride_v_a, |
365 src_v_b, stride_v_b, | 365 src_v_b, stride_v_b, |
366 width_uv, height_uv); | 366 width_uv, height_uv); |
367 return ssim_y * 0.8 + 0.1 * (ssim_u + ssim_v); | 367 return ssim_y * 0.8 + 0.1 * (ssim_u + ssim_v); |
368 } | 368 } |
369 | 369 |
370 #ifdef __cplusplus | 370 #ifdef __cplusplus |
371 } // extern "C" | 371 } // extern "C" |
372 } // namespace libyuv | 372 } // namespace libyuv |
373 #endif | 373 #endif |
OLD | NEW |