1 /* 2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license. 10 */ 11 12 #ifndef AOM_DSP_PSNR_H_ 13 #define AOM_DSP_PSNR_H_ 14 15 #include "EbPictureBufferDesc.h" 16 #include "EbDefinitions.h" 17 #include "EbUtility.h" 18 #define MAX_PSNR 100.0 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 typedef struct PsnrStats { 25 double psnr[4]; // total/y/u/v 26 uint64_t sse[4]; // total/y/u/v 27 uint32_t samples[4]; // total/y/u/v 28 } PsnrStats; 29 30 /*!\brief Converts SSE to PSNR 31 * 32 * Converts sum of squared errros (SSE) to peak signal-to-noise ratio (PNSR). 33 * 34 * \param[in] samples Number of samples 35 * \param[in] peak Max sample value 36 * \param[in] sse Sum of squared errors 37 */ 38 double svt_aom_sse_to_psnr(double samples, double peak, double sse); 39 40 int64_t svt_aom_get_y_sse_part(const Yv12BufferConfig *a, const Yv12BufferConfig *b, int32_t hstart, 41 int32_t width, int32_t vstart, int32_t height); 42 43 int64_t svt_aom_get_y_sse(const Yv12BufferConfig *a, const Yv12BufferConfig *b); 44 45 int64_t svt_aom_get_u_sse_part(const Yv12BufferConfig *a, const Yv12BufferConfig *b, int32_t hstart, 46 int32_t width, int32_t vstart, int32_t height); 47 48 int64_t svt_aom_get_u_sse(const Yv12BufferConfig *a, const Yv12BufferConfig *b); 49 50 int64_t svt_aom_get_v_sse_part(const Yv12BufferConfig *a, const Yv12BufferConfig *b, int32_t hstart, 51 int32_t width, int32_t vstart, int32_t height); 52 53 int64_t svt_aom_get_v_sse(const Yv12BufferConfig *a, const Yv12BufferConfig *b); 54 55 int64_t svt_aom_highbd_get_y_sse_part(const Yv12BufferConfig *a, const Yv12BufferConfig *b, 56 int32_t hstart, int32_t width, int32_t vstart, 57 int32_t height); 58 59 int64_t svt_aom_highbd_get_y_sse(const Yv12BufferConfig *a, const Yv12BufferConfig *b); 60 61 int64_t svt_aom_highbd_get_u_sse_part(const Yv12BufferConfig *a, const Yv12BufferConfig *b, 62 int32_t hstart, int32_t width, int32_t vstart, 63 int32_t height); 64 65 int64_t svt_aom_highbd_get_u_sse(const Yv12BufferConfig *a, const Yv12BufferConfig *b); 66 67 int64_t svt_aom_highbd_get_v_sse_part(const Yv12BufferConfig *a, const Yv12BufferConfig *b, 68 int32_t hstart, int32_t width, int32_t vstart, 69 int32_t height); 70 71 int64_t svt_aom_highbd_get_v_sse(const Yv12BufferConfig *a, const Yv12BufferConfig *b); 72 73 double aom_psnrhvs(const Yv12BufferConfig *source, const Yv12BufferConfig *dest, double *phvs_y, 74 double *phvs_u, double *phvs_v, uint32_t bd, uint32_t in_bd); 75 76 #ifdef __cplusplus 77 } // extern "C" 78 #endif 79 #endif // AOM_DSP_PSNR_H_ 80