OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 for (j = 0; j <= width - 8; j += 4) { | 88 for (j = 0; j <= width - 8; j += 4) { |
89 double v = ssim_8x8(img1 + j, stride_img1, img2 + j, stride_img2); | 89 double v = ssim_8x8(img1 + j, stride_img1, img2 + j, stride_img2); |
90 ssim_total += v; | 90 ssim_total += v; |
91 samples++; | 91 samples++; |
92 } | 92 } |
93 } | 93 } |
94 ssim_total /= samples; | 94 ssim_total /= samples; |
95 return ssim_total; | 95 return ssim_total; |
96 } | 96 } |
97 double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, | 97 double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, |
98 int lumamask, double *weight) { | 98 double *weight) { |
99 double a, b, c; | 99 double a, b, c; |
100 double ssimv; | 100 double ssimv; |
101 | 101 |
102 a = vp9_ssim2(source->y_buffer, dest->y_buffer, | 102 a = vp9_ssim2(source->y_buffer, dest->y_buffer, |
103 source->y_stride, dest->y_stride, | 103 source->y_stride, dest->y_stride, |
104 source->y_crop_width, source->y_crop_height); | 104 source->y_crop_width, source->y_crop_height); |
105 | 105 |
106 b = vp9_ssim2(source->u_buffer, dest->u_buffer, | 106 b = vp9_ssim2(source->u_buffer, dest->u_buffer, |
107 source->uv_stride, dest->uv_stride, | 107 source->uv_stride, dest->uv_stride, |
108 source->uv_crop_width, source->uv_crop_height); | 108 source->uv_crop_width, source->uv_crop_height); |
(...skipping 25 matching lines...) Expand all Loading... |
134 c = vp9_ssim2(source->v_buffer, dest->v_buffer, | 134 c = vp9_ssim2(source->v_buffer, dest->v_buffer, |
135 source->uv_stride, dest->uv_stride, | 135 source->uv_stride, dest->uv_stride, |
136 source->uv_crop_width, source->uv_crop_height); | 136 source->uv_crop_width, source->uv_crop_height); |
137 *ssim_y = a; | 137 *ssim_y = a; |
138 *ssim_u = b; | 138 *ssim_u = b; |
139 *ssim_v = c; | 139 *ssim_v = c; |
140 ssim_all = (a * 4 + b + c) / 6; | 140 ssim_all = (a * 4 + b + c) / 6; |
141 | 141 |
142 return ssim_all; | 142 return ssim_all; |
143 } | 143 } |
OLD | NEW |