OLD | NEW |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 // | 9 // |
10 // WebPPicture tools for measuring distortion | 10 // WebPPicture tools for measuring distortion |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 tmp1[j * w + i] = src->argb[i + j * src->argb_stride] >> (c * 8); | 103 tmp1[j * w + i] = src->argb[i + j * src->argb_stride] >> (c * 8); |
104 tmp2[j * w + i] = ref->argb[i + j * ref->argb_stride] >> (c * 8); | 104 tmp2[j * w + i] = ref->argb[i + j * ref->argb_stride] >> (c * 8); |
105 } | 105 } |
106 } | 106 } |
107 if (type >= 2) { | 107 if (type >= 2) { |
108 AccumulateLSIM(tmp1, w, tmp2, w, w, h, &stats[c]); | 108 AccumulateLSIM(tmp1, w, tmp2, w, w, h, &stats[c]); |
109 } else { | 109 } else { |
110 VP8SSIMAccumulatePlane(tmp1, w, tmp2, w, w, h, &stats[c]); | 110 VP8SSIMAccumulatePlane(tmp1, w, tmp2, w, w, h, &stats[c]); |
111 } | 111 } |
112 } | 112 } |
113 free(tmp_plane); | 113 WebPSafeFree(tmp_plane); |
114 } | 114 } |
115 } else { | 115 } else { |
116 int has_alpha, uv_w, uv_h; | 116 int has_alpha, uv_w, uv_h; |
117 if (src->y == NULL || ref->y == NULL || | 117 if (src->y == NULL || ref->y == NULL || |
118 src->u == NULL || ref->u == NULL || | 118 src->u == NULL || ref->u == NULL || |
119 src->v == NULL || ref->v == NULL) { | 119 src->v == NULL || ref->v == NULL) { |
120 return 0; | 120 return 0; |
121 } | 121 } |
122 has_alpha = !!(src->colorspace & WEBP_CSP_ALPHA_BIT); | 122 has_alpha = !!(src->colorspace & WEBP_CSP_ALPHA_BIT); |
123 if (has_alpha != !!(ref->colorspace & WEBP_CSP_ALPHA_BIT) || | 123 if (has_alpha != !!(ref->colorspace & WEBP_CSP_ALPHA_BIT) || |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 result[c] = GetPSNR(v); | 168 result[c] = GetPSNR(v); |
169 } | 169 } |
170 // Accumulate forward | 170 // Accumulate forward |
171 if (c < 4) VP8SSIMAddStats(&stats[c], &stats[4]); | 171 if (c < 4) VP8SSIMAddStats(&stats[c], &stats[4]); |
172 } | 172 } |
173 } | 173 } |
174 return 1; | 174 return 1; |
175 } | 175 } |
176 | 176 |
177 //------------------------------------------------------------------------------ | 177 //------------------------------------------------------------------------------ |
OLD | NEW |