| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2014 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 VP9_ENCODER_VP9_SSIM_H_ | |
| 12 #define VP9_ENCODER_VP9_SSIM_H_ | |
| 13 | |
| 14 #ifdef __cplusplus | |
| 15 extern "C" { | |
| 16 #endif | |
| 17 | |
| 18 #include "vpx_scale/yv12config.h" | |
| 19 | |
| 20 // metrics used for calculating ssim, ssim2, dssim, and ssimc | |
| 21 typedef struct { | |
| 22 // source sum ( over 8x8 region ) | |
| 23 uint64_t sum_s; | |
| 24 | |
| 25 // reference sum (over 8x8 region ) | |
| 26 uint64_t sum_r; | |
| 27 | |
| 28 // source sum squared ( over 8x8 region ) | |
| 29 uint64_t sum_sq_s; | |
| 30 | |
| 31 // reference sum squared (over 8x8 region ) | |
| 32 uint64_t sum_sq_r; | |
| 33 | |
| 34 // sum of source times reference (over 8x8 region) | |
| 35 uint64_t sum_sxr; | |
| 36 | |
| 37 // calculated ssim score between source and reference | |
| 38 double ssim; | |
| 39 } Ssimv; | |
| 40 | |
| 41 // metrics collected on a frame basis | |
| 42 typedef struct { | |
| 43 // ssim consistency error metric ( see code for explanation ) | |
| 44 double ssimc; | |
| 45 | |
| 46 // standard ssim | |
| 47 double ssim; | |
| 48 | |
| 49 // revised ssim ( see code for explanation) | |
| 50 double ssim2; | |
| 51 | |
| 52 // ssim restated as an error metric like sse | |
| 53 double dssim; | |
| 54 | |
| 55 // dssim converted to decibels | |
| 56 double dssimd; | |
| 57 | |
| 58 // ssimc converted to decibels | |
| 59 double ssimcd; | |
| 60 } Metrics; | |
| 61 | |
| 62 double vp9_get_ssim_metrics(uint8_t *img1, int img1_pitch, uint8_t *img2, | |
| 63 int img2_pitch, int width, int height, Ssimv *sv2, | |
| 64 Metrics *m, int do_inconsistency); | |
| 65 | |
| 66 double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, | |
| 67 double *weight); | |
| 68 | |
| 69 double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, | |
| 70 double *ssim_y, double *ssim_u, double *ssim_v); | |
| 71 | |
| 72 double vp9_calc_fastssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, | |
| 73 double *ssim_y, double *ssim_u, double *ssim_v); | |
| 74 | |
| 75 double vp9_psnrhvs(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, | |
| 76 double *ssim_y, double *ssim_u, double *ssim_v); | |
| 77 | |
| 78 #if CONFIG_VP9_HIGHBITDEPTH | |
| 79 double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source, | |
| 80 YV12_BUFFER_CONFIG *dest, | |
| 81 double *weight, | |
| 82 unsigned int bd); | |
| 83 | |
| 84 double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source, | |
| 85 YV12_BUFFER_CONFIG *dest, | |
| 86 double *ssim_y, | |
| 87 double *ssim_u, | |
| 88 double *ssim_v, | |
| 89 unsigned int bd); | |
| 90 #endif // CONFIG_VP9_HIGHBITDEPTH | |
| 91 | |
| 92 #ifdef __cplusplus | |
| 93 } // extern "C" | |
| 94 #endif | |
| 95 | |
| 96 #endif // VP9_ENCODER_VP9_SSIM_H_ | |
| OLD | NEW |