2 * Copyright (c) 2016 The WebM project authors. All Rights Reserved.
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.
11 #ifndef VPX_DSP_PSNR_H_
12 #define VPX_DSP_PSNR_H_
14 #include "vpx_scale/yv12config.h"
16 #define MAX_PSNR 100.0
23 double psnr[4]; // total/y/u/v
24 uint64_t sse[4]; // total/y/u/v
25 uint32_t samples[4]; // total/y/u/v
28 // TODO(dkovalev) change vpx_sse_to_psnr signature: double -> int64_t
30 /*!\brief Converts SSE to PSNR
32 * Converts sum of squared errros (SSE) to peak signal-to-noise ratio (PNSR).
34 * \param[in] samples Number of samples
35 * \param[in] peak Max sample value
36 * \param[in] sse Sum of squared errors
38 double vpx_sse_to_psnr(double samples, double peak, double sse);
39 int64_t vpx_get_y_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b);
40 #if CONFIG_VP9_HIGHBITDEPTH
41 int64_t vpx_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a,
42 const YV12_BUFFER_CONFIG *b);
43 void vpx_calc_highbd_psnr(const YV12_BUFFER_CONFIG *a,
44 const YV12_BUFFER_CONFIG *b, PSNR_STATS *psnr,
45 unsigned int bit_depth, unsigned int in_bit_depth);
47 void vpx_calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
50 double vpx_psnrhvs(const YV12_BUFFER_CONFIG *source,
51 const YV12_BUFFER_CONFIG *dest, double *phvs_y,
52 double *phvs_u, double *phvs_v, uint32_t bd, uint32_t in_bd);
57 #endif // VPX_DSP_PSNR_H_