compare.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #ifndef INCLUDE_LIBYUV_COMPARE_H_
  11. #define INCLUDE_LIBYUV_COMPARE_H_
  12. #include "libyuv/basic_types.h"
  13. #ifdef __cplusplus
  14. namespace libyuv {
  15. extern "C" {
  16. #endif
  17. // Compute a hash for specified memory. Seed of 5381 recommended.
  18. LIBYUV_API
  19. uint32_t HashDjb2(const uint8_t* src, uint64_t count, uint32_t seed);
  20. // Hamming Distance
  21. LIBYUV_API
  22. uint64_t ComputeHammingDistance(const uint8_t* src_a,
  23. const uint8_t* src_b,
  24. int count);
  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_t ARGBDetect(const uint8_t* argb,
  29. int stride_argb,
  30. int width,
  31. int height);
  32. // Sum Square Error - used to compute Mean Square Error or PSNR.
  33. LIBYUV_API
  34. uint64_t ComputeSumSquareError(const uint8_t* src_a,
  35. const uint8_t* src_b,
  36. int count);
  37. LIBYUV_API
  38. uint64_t ComputeSumSquareErrorPlane(const uint8_t* src_a,
  39. int stride_a,
  40. const uint8_t* src_b,
  41. int stride_b,
  42. int width,
  43. int height);
  44. static const int kMaxPsnr = 128;
  45. LIBYUV_API
  46. double SumSquareErrorToPsnr(uint64_t sse, uint64_t count);
  47. LIBYUV_API
  48. double CalcFramePsnr(const uint8_t* src_a,
  49. int stride_a,
  50. const uint8_t* src_b,
  51. int stride_b,
  52. int width,
  53. int height);
  54. LIBYUV_API
  55. double I420Psnr(const uint8_t* src_y_a,
  56. int stride_y_a,
  57. const uint8_t* src_u_a,
  58. int stride_u_a,
  59. const uint8_t* src_v_a,
  60. int stride_v_a,
  61. const uint8_t* src_y_b,
  62. int stride_y_b,
  63. const uint8_t* src_u_b,
  64. int stride_u_b,
  65. const uint8_t* src_v_b,
  66. int stride_v_b,
  67. int width,
  68. int height);
  69. LIBYUV_API
  70. double CalcFrameSsim(const uint8_t* src_a,
  71. int stride_a,
  72. const uint8_t* src_b,
  73. int stride_b,
  74. int width,
  75. int height);
  76. LIBYUV_API
  77. double I420Ssim(const uint8_t* src_y_a,
  78. int stride_y_a,
  79. const uint8_t* src_u_a,
  80. int stride_u_a,
  81. const uint8_t* src_v_a,
  82. int stride_v_a,
  83. const uint8_t* src_y_b,
  84. int stride_y_b,
  85. const uint8_t* src_u_b,
  86. int stride_u_b,
  87. const uint8_t* src_v_b,
  88. int stride_v_b,
  89. int width,
  90. int height);
  91. #ifdef __cplusplus
  92. } // extern "C"
  93. } // namespace libyuv
  94. #endif
  95. #endif // INCLUDE_LIBYUV_COMPARE_H_