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

Side by Side Diff: source/libvpx/test/md5_helper.h

Issue 375983002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 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/test/invalid_file_test.cc ('k') | source/libvpx/test/svc_test.cc » ('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) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 10 matching lines...) Expand all
21 MD5Init(&md5_); 21 MD5Init(&md5_);
22 } 22 }
23 23
24 void Add(const vpx_image_t *img) { 24 void Add(const vpx_image_t *img) {
25 for (int plane = 0; plane < 3; ++plane) { 25 for (int plane = 0; plane < 3; ++plane) {
26 const uint8_t *buf = img->planes[plane]; 26 const uint8_t *buf = img->planes[plane];
27 // Calculate the width and height to do the md5 check. For the chroma 27 // Calculate the width and height to do the md5 check. For the chroma
28 // plane, we never want to round down and thus skip a pixel so if 28 // plane, we never want to round down and thus skip a pixel so if
29 // we are shifting by 1 (chroma_shift) we add 1 before doing the shift. 29 // we are shifting by 1 (chroma_shift) we add 1 before doing the shift.
30 // This works only for chroma_shift of 0 and 1. 30 // This works only for chroma_shift of 0 and 1.
31 const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGH) ? 2 : 1;
31 const int h = plane ? (img->d_h + img->y_chroma_shift) >> 32 const int h = plane ? (img->d_h + img->y_chroma_shift) >>
32 img->y_chroma_shift : img->d_h; 33 img->y_chroma_shift : img->d_h;
33 const int w = plane ? (img->d_w + img->x_chroma_shift) >> 34 const int w = (plane ? (img->d_w + img->x_chroma_shift) >>
34 img->x_chroma_shift : img->d_w; 35 img->x_chroma_shift : img->d_w) * bytes_per_sample;
35 36
36 for (int y = 0; y < h; ++y) { 37 for (int y = 0; y < h; ++y) {
37 MD5Update(&md5_, buf, w); 38 MD5Update(&md5_, buf, w);
38 buf += img->stride[plane]; 39 buf += img->stride[plane];
39 } 40 }
40 } 41 }
41 } 42 }
42 43
43 const char *Get(void) { 44 const char *Get(void) {
44 static const char hex[16] = { 45 static const char hex[16] = {
(...skipping 14 matching lines...) Expand all
59 } 60 }
60 61
61 protected: 62 protected:
62 char res_[33]; 63 char res_[33];
63 MD5Context md5_; 64 MD5Context md5_;
64 }; 65 };
65 66
66 } // namespace libvpx_test 67 } // namespace libvpx_test
67 68
68 #endif // TEST_MD5_HELPER_H_ 69 #endif // TEST_MD5_HELPER_H_
OLDNEW
« no previous file with comments | « source/libvpx/test/invalid_file_test.cc ('k') | source/libvpx/test/svc_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698