psnr.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2016 The WebM 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 VPX_VPX_DSP_PSNR_H_
  11. #define VPX_VPX_DSP_PSNR_H_
  12. #include "vpx_scale/yv12config.h"
  13. #define MAX_PSNR 100.0
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. typedef struct {
  18. double psnr[4]; // total/y/u/v
  19. uint64_t sse[4]; // total/y/u/v
  20. uint32_t samples[4]; // total/y/u/v
  21. } PSNR_STATS;
  22. // TODO(dkovalev) change vpx_sse_to_psnr signature: double -> int64_t
  23. /*!\brief Converts SSE to PSNR
  24. *
  25. * Converts sum of squared errros (SSE) to peak signal-to-noise ratio (PNSR).
  26. *
  27. * \param[in] samples Number of samples
  28. * \param[in] peak Max sample value
  29. * \param[in] sse Sum of squared errors
  30. */
  31. double vpx_sse_to_psnr(double samples, double peak, double sse);
  32. int64_t vpx_get_y_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b);
  33. #if CONFIG_VP9_HIGHBITDEPTH
  34. int64_t vpx_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a,
  35. const YV12_BUFFER_CONFIG *b);
  36. void vpx_calc_highbd_psnr(const YV12_BUFFER_CONFIG *a,
  37. const YV12_BUFFER_CONFIG *b, PSNR_STATS *psnr,
  38. unsigned int bit_depth, unsigned int in_bit_depth);
  39. #endif
  40. void vpx_calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
  41. PSNR_STATS *psnr);
  42. double vpx_psnrhvs(const YV12_BUFFER_CONFIG *source,
  43. const YV12_BUFFER_CONFIG *dest, double *phvs_y,
  44. double *phvs_u, double *phvs_v, uint32_t bd, uint32_t in_bd);
  45. #ifdef __cplusplus
  46. } // extern "C"
  47. #endif
  48. #endif // VPX_VPX_DSP_PSNR_H_