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