1 /* 2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 */ 11 12 #ifndef INCLUDE_LIBYUV_COMPARE_H_ // NOLINT 13 #define INCLUDE_LIBYUV_COMPARE_H_ 14 15 #include "libyuv/basic_types.h" 16 17 #ifdef __cplusplus 18 namespace libyuv { 19 extern "C" { 20 #endif 21 22 // Compute a hash for specified memory. Seed of 5381 recommended. 23 LIBYUV_API 24 uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed); 25 26 // Scan an opaque argb image and return fourcc based on alpha offset. 27 // Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown. 28 LIBYUV_API 29 uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height); 30 31 // Sum Square Error - used to compute Mean Square Error or PSNR. 32 LIBYUV_API 33 uint64 ComputeSumSquareError(const uint8* src_a, 34 const uint8* src_b, int count); 35 36 LIBYUV_API 37 uint64 ComputeSumSquareErrorPlane(const uint8* src_a, int stride_a, 38 const uint8* src_b, int stride_b, 39 int width, int height); 40 41 static const int kMaxPsnr = 128; 42 43 LIBYUV_API 44 double SumSquareErrorToPsnr(uint64 sse, uint64 count); 45 46 LIBYUV_API 47 double CalcFramePsnr(const uint8* src_a, int stride_a, 48 const uint8* src_b, int stride_b, 49 int width, int height); 50 51 LIBYUV_API 52 double I420Psnr(const uint8* src_y_a, int stride_y_a, 53 const uint8* src_u_a, int stride_u_a, 54 const uint8* src_v_a, int stride_v_a, 55 const uint8* src_y_b, int stride_y_b, 56 const uint8* src_u_b, int stride_u_b, 57 const uint8* src_v_b, int stride_v_b, 58 int width, int height); 59 60 LIBYUV_API 61 double CalcFrameSsim(const uint8* src_a, int stride_a, 62 const uint8* src_b, int stride_b, 63 int width, int height); 64 65 LIBYUV_API 66 double I420Ssim(const uint8* src_y_a, int stride_y_a, 67 const uint8* src_u_a, int stride_u_a, 68 const uint8* src_v_a, int stride_v_a, 69 const uint8* src_y_b, int stride_y_b, 70 const uint8* src_u_b, int stride_u_b, 71 const uint8* src_v_b, int stride_v_b, 72 int width, int height); 73 74 #ifdef __cplusplus 75 } // extern "C" 76 } // namespace libyuv 77 #endif 78 79 #endif // INCLUDE_LIBYUV_COMPARE_H_ NOLINT 80