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