Line data Source code
1 : /*
2 : * Copyright 2012 The LibYuv Project Authors. All rights reserved.
3 : *
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
6 : * tree. An additional intellectual property rights grant can be found
7 : * in the file PATENTS. All contributing project authors may
8 : * be found in the AUTHORS file in the root of the source tree.
9 : */
10 :
11 : #include "libyuv/basic_types.h"
12 :
13 : #include "libyuv/compare_row.h"
14 :
15 : #ifdef __cplusplus
16 : namespace libyuv {
17 : extern "C" {
18 : #endif
19 :
20 0 : uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count) {
21 0 : uint32 sse = 0u;
22 : int i;
23 0 : for (i = 0; i < count; ++i) {
24 0 : int diff = src_a[i] - src_b[i];
25 0 : sse += (uint32)(diff * diff);
26 : }
27 0 : return sse;
28 : }
29 :
30 : // hash seed of 5381 recommended.
31 : // Internal C version of HashDjb2 with int sized count for efficiency.
32 0 : uint32 HashDjb2_C(const uint8* src, int count, uint32 seed) {
33 0 : uint32 hash = seed;
34 : int i;
35 0 : for (i = 0; i < count; ++i) {
36 0 : hash += (hash << 5) + src[i];
37 : }
38 0 : return hash;
39 : }
40 :
41 : #ifdef __cplusplus
42 : } // extern "C"
43 : } // namespace libyuv
44 : #endif
|