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 24 matching lines...) Expand all Loading... |
35 for (j = 0; j < 8; j++) { | 35 for (j = 0; j < 8; j++) { |
36 *sum_s += s[j]; | 36 *sum_s += s[j]; |
37 *sum_r += r[j]; | 37 *sum_r += r[j]; |
38 *sum_sq_s += s[j] * s[j]; | 38 *sum_sq_s += s[j] * s[j]; |
39 *sum_sq_r += r[j] * r[j]; | 39 *sum_sq_r += r[j] * r[j]; |
40 *sum_sxr += s[j] * r[j]; | 40 *sum_sxr += s[j] * r[j]; |
41 } | 41 } |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 const static int64_t cc1 = 26634; // (64^2*(.01*255)^2 | 45 static const int64_t cc1 = 26634; // (64^2*(.01*255)^2 |
46 const static int64_t cc2 = 239708; // (64^2*(.03*255)^2 | 46 static const int64_t cc2 = 239708; // (64^2*(.03*255)^2 |
47 | 47 |
48 static double similarity(unsigned long sum_s, unsigned long sum_r, | 48 static double similarity(unsigned long sum_s, unsigned long sum_r, |
49 unsigned long sum_sq_s, unsigned long sum_sq_r, | 49 unsigned long sum_sq_s, unsigned long sum_sq_r, |
50 unsigned long sum_sxr, int count) { | 50 unsigned long sum_sxr, int count) { |
51 int64_t ssim_n, ssim_d; | 51 int64_t ssim_n, ssim_d; |
52 int64_t c1, c2; | 52 int64_t c1, c2; |
53 | 53 |
54 // scale the constants by number of pixels | 54 // scale the constants by number of pixels |
55 c1 = (cc1 * count * count) >> 12; | 55 c1 = (cc1 * count * count) >> 12; |
56 c2 = (cc2 * count * count) >> 12; | 56 c2 = (cc2 * count * count) >> 12; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 c = vp9_ssim2(source->v_buffer, dest->v_buffer, | 139 c = vp9_ssim2(source->v_buffer, dest->v_buffer, |
140 source->uv_stride, dest->uv_stride, | 140 source->uv_stride, dest->uv_stride, |
141 source->uv_crop_width, source->uv_crop_height); | 141 source->uv_crop_width, source->uv_crop_height); |
142 *ssim_y = a; | 142 *ssim_y = a; |
143 *ssim_u = b; | 143 *ssim_u = b; |
144 *ssim_v = c; | 144 *ssim_v = c; |
145 ssim_all = (a * 4 + b + c) / 6; | 145 ssim_all = (a * 4 + b + c) / 6; |
146 | 146 |
147 return ssim_all; | 147 return ssim_all; |
148 } | 148 } |
OLD | NEW |