• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2011 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 #ifndef INCLUDE_LIBYUV_COMPARE_H_  // NOLINT
12 #define INCLUDE_LIBYUV_COMPARE_H_
13 
14 #include "libyuv/basic_types.h"
15 
16 #ifdef __cplusplus
17 namespace libyuv {
18 extern "C" {
19 #endif
20 
21 // Compute a hash for specified memory. Seed of 5381 recommended.
22 LIBYUV_API
23 uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed);
24 
25 // Scan an opaque argb image and return fourcc based on alpha offset.
26 // Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown.
27 LIBYUV_API
28 uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height);
29 
30 // Sum Square Error - used to compute Mean Square Error or PSNR.
31 LIBYUV_API
32 uint64 ComputeSumSquareError(const uint8* src_a,
33                              const uint8* src_b, int count);
34 
35 LIBYUV_API
36 uint64 ComputeSumSquareErrorPlane(const uint8* src_a, int stride_a,
37                                   const uint8* src_b, int stride_b,
38                                   int width, int height);
39 
40 static const int kMaxPsnr = 128;
41 
42 LIBYUV_API
43 double SumSquareErrorToPsnr(uint64 sse, uint64 count);
44 
45 LIBYUV_API
46 double CalcFramePsnr(const uint8* src_a, int stride_a,
47                      const uint8* src_b, int stride_b,
48                      int width, int height);
49 
50 LIBYUV_API
51 double I420Psnr(const uint8* src_y_a, int stride_y_a,
52                 const uint8* src_u_a, int stride_u_a,
53                 const uint8* src_v_a, int stride_v_a,
54                 const uint8* src_y_b, int stride_y_b,
55                 const uint8* src_u_b, int stride_u_b,
56                 const uint8* src_v_b, int stride_v_b,
57                 int width, int height);
58 
59 LIBYUV_API
60 double CalcFrameSsim(const uint8* src_a, int stride_a,
61                      const uint8* src_b, int stride_b,
62                      int width, int height);
63 
64 LIBYUV_API
65 double I420Ssim(const uint8* src_y_a, int stride_y_a,
66                 const uint8* src_u_a, int stride_u_a,
67                 const uint8* src_v_a, int stride_v_a,
68                 const uint8* src_y_b, int stride_y_b,
69                 const uint8* src_u_b, int stride_u_b,
70                 const uint8* src_v_b, int stride_v_b,
71                 int width, int height);
72 
73 #ifdef __cplusplus
74 }  // extern "C"
75 }  // namespace libyuv
76 #endif
77 
78 #endif  // INCLUDE_LIBYUV_COMPARE_H_  NOLINT
79