compare.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 HashDjb2(const uint8* src, uint64 count, uint32 seed);
  20. // Hamming Distance
  21. LIBYUV_API
  22. uint64 ComputeHammingDistance(const uint8* src_a,
  23. const uint8* 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 ARGBDetect(const uint8* argb, int stride_argb, int width, int height);
  29. // Sum Square Error - used to compute Mean Square Error or PSNR.
  30. LIBYUV_API
  31. uint64 ComputeSumSquareError(const uint8* src_a, const uint8* src_b, int count);
  32. LIBYUV_API
  33. uint64 ComputeSumSquareErrorPlane(const uint8* src_a,
  34. int stride_a,
  35. const uint8* src_b,
  36. int stride_b,
  37. int width,
  38. int height);
  39. static const int kMaxPsnr = 128;
  40. LIBYUV_API
  41. double SumSquareErrorToPsnr(uint64 sse, uint64 count);
  42. LIBYUV_API
  43. double CalcFramePsnr(const uint8* src_a,
  44. int stride_a,
  45. const uint8* src_b,
  46. int stride_b,
  47. int width,
  48. int height);
  49. LIBYUV_API
  50. double I420Psnr(const uint8* src_y_a,
  51. int stride_y_a,
  52. const uint8* src_u_a,
  53. int stride_u_a,
  54. const uint8* src_v_a,
  55. int stride_v_a,
  56. const uint8* src_y_b,
  57. int stride_y_b,
  58. const uint8* src_u_b,
  59. int stride_u_b,
  60. const uint8* src_v_b,
  61. int stride_v_b,
  62. int width,
  63. int height);
  64. LIBYUV_API
  65. double CalcFrameSsim(const uint8* src_a,
  66. int stride_a,
  67. const uint8* src_b,
  68. int stride_b,
  69. int width,
  70. int height);
  71. LIBYUV_API
  72. double I420Ssim(const uint8* src_y_a,
  73. int stride_y_a,
  74. const uint8* src_u_a,
  75. int stride_u_a,
  76. const uint8* src_v_a,
  77. int stride_v_a,
  78. const uint8* src_y_b,
  79. int stride_y_b,
  80. const uint8* src_u_b,
  81. int stride_u_b,
  82. const uint8* src_v_b,
  83. int stride_v_b,
  84. int width,
  85. int height);
  86. #ifdef __cplusplus
  87. } // extern "C"
  88. } // namespace libyuv
  89. #endif
  90. #endif // INCLUDE_LIBYUV_COMPARE_H_