| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef VP9_ENCODER_VP9_SSIM_H_ | 11 #ifndef VP9_ENCODER_VP9_SSIM_H_ |
| 12 #define VP9_ENCODER_VP9_SSIM_H_ | 12 #define VP9_ENCODER_VP9_SSIM_H_ |
| 13 | 13 |
| 14 #ifdef __cplusplus | 14 #ifdef __cplusplus |
| 15 extern "C" { | 15 extern "C" { |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 #include "vpx_scale/yv12config.h" | 18 #include "vpx_scale/yv12config.h" |
| 19 | 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 |
| 20 double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, | 66 double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, |
| 21 double *weight); | 67 double *weight); |
| 22 | 68 |
| 23 double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, | 69 double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, |
| 24 double *ssim_y, double *ssim_u, double *ssim_v); | 70 double *ssim_y, double *ssim_u, double *ssim_v); |
| 25 | 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 |
| 26 #if CONFIG_VP9_HIGHBITDEPTH | 78 #if CONFIG_VP9_HIGHBITDEPTH |
| 27 double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source, | 79 double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source, |
| 28 YV12_BUFFER_CONFIG *dest, | 80 YV12_BUFFER_CONFIG *dest, |
| 29 double *weight, | 81 double *weight, |
| 30 unsigned int bd); | 82 unsigned int bd); |
| 31 | 83 |
| 32 double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source, | 84 double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source, |
| 33 YV12_BUFFER_CONFIG *dest, | 85 YV12_BUFFER_CONFIG *dest, |
| 34 double *ssim_y, | 86 double *ssim_y, |
| 35 double *ssim_u, | 87 double *ssim_u, |
| 36 double *ssim_v, | 88 double *ssim_v, |
| 37 unsigned int bd); | 89 unsigned int bd); |
| 38 #endif // CONFIG_VP9_HIGHBITDEPTH | 90 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 39 | 91 |
| 40 #ifdef __cplusplus | 92 #ifdef __cplusplus |
| 41 } // extern "C" | 93 } // extern "C" |
| 42 #endif | 94 #endif |
| 43 | 95 |
| 44 #endif // VP9_ENCODER_VP9_SSIM_H_ | 96 #endif // VP9_ENCODER_VP9_SSIM_H_ |
| OLD | NEW |