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 // Sum Square Error - used to compute Mean Square Error or PSNR. 26 LIBYUV_API 27 uint64 ComputeSumSquareError(const uint8* src_a, 28 const uint8* src_b, int count); 29 30 LIBYUV_API 31 uint64 ComputeSumSquareErrorPlane(const uint8* src_a, int stride_a, 32 const uint8* src_b, int stride_b, 33 int width, int height); 34 35 static const int kMaxPsnr = 128; 36 37 LIBYUV_API 38 double SumSquareErrorToPsnr(uint64 sse, uint64 count); 39 40 LIBYUV_API 41 double CalcFramePsnr(const uint8* src_a, int stride_a, 42 const uint8* src_b, int stride_b, 43 int width, int height); 44 45 LIBYUV_API 46 double I420Psnr(const uint8* src_y_a, int stride_y_a, 47 const uint8* src_u_a, int stride_u_a, 48 const uint8* src_v_a, int stride_v_a, 49 const uint8* src_y_b, int stride_y_b, 50 const uint8* src_u_b, int stride_u_b, 51 const uint8* src_v_b, int stride_v_b, 52 int width, int height); 53 54 LIBYUV_API 55 double CalcFrameSsim(const uint8* src_a, int stride_a, 56 const uint8* src_b, int stride_b, 57 int width, int height); 58 59 LIBYUV_API 60 double I420Ssim(const uint8* src_y_a, int stride_y_a, 61 const uint8* src_u_a, int stride_u_a, 62 const uint8* src_v_a, int stride_v_a, 63 const uint8* src_y_b, int stride_y_b, 64 const uint8* src_u_b, int stride_u_b, 65 const uint8* src_v_b, int stride_v_b, 66 int width, int height); 67 68 #ifdef __cplusplus 69 } // extern "C" 70 } // namespace libyuv 71 #endif 72 73 #endif // INCLUDE_LIBYUV_COMPARE_H_ NOLINT 74