Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: source/libvpx/tools_common.c

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/third_party/x86inc/x86inc.asm ('k') | source/libvpx/usage.dox » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 int plane; 239 int plane;
240 240
241 for (plane = 0; plane < 3; ++plane) { 241 for (plane = 0; plane < 3; ++plane) {
242 unsigned char *buf = img->planes[plane]; 242 unsigned char *buf = img->planes[plane];
243 const int stride = img->stride[plane]; 243 const int stride = img->stride[plane];
244 const int w = vpx_img_plane_width(img, plane); 244 const int w = vpx_img_plane_width(img, plane);
245 const int h = vpx_img_plane_height(img, plane); 245 const int h = vpx_img_plane_height(img, plane);
246 int y; 246 int y;
247 247
248 for (y = 0; y < h; ++y) { 248 for (y = 0; y < h; ++y) {
249 if (fread(buf, 1, w, file) != w) 249 if (fread(buf, 1, w, file) != (size_t)w)
250 return 0; 250 return 0;
251 buf += stride; 251 buf += stride;
252 } 252 }
253 } 253 }
254 254
255 return 1; 255 return 1;
256 } 256 }
257 257
258 // TODO(dkovalev) change sse_to_psnr signature: double -> int64_t 258 // TODO(dkovalev) change sse_to_psnr signature: double -> int64_t
259 double sse_to_psnr(double samples, double peak, double sse) { 259 double sse_to_psnr(double samples, double peak, double sse) {
260 static const double kMaxPSNR = 100.0; 260 static const double kMaxPSNR = 100.0;
261 261
262 if (sse > 0.0) { 262 if (sse > 0.0) {
263 const double psnr = 10.0 * log10(samples * peak * peak / sse); 263 const double psnr = 10.0 * log10(samples * peak * peak / sse);
264 return psnr > kMaxPSNR ? kMaxPSNR : psnr; 264 return psnr > kMaxPSNR ? kMaxPSNR : psnr;
265 } else { 265 } else {
266 return kMaxPSNR; 266 return kMaxPSNR;
267 } 267 }
268 } 268 }
OLDNEW
« no previous file with comments | « source/libvpx/third_party/x86inc/x86inc.asm ('k') | source/libvpx/usage.dox » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698