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

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

Issue 1162573005: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « source/libvpx/test/fdct8x8_test.cc ('k') | source/libvpx/test/partial_idct_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 24 matching lines...) Expand all
35 const int w = (plane ? (img->d_w + img->x_chroma_shift) >> 35 const int w = (plane ? (img->d_w + img->x_chroma_shift) >>
36 img->x_chroma_shift : img->d_w) * bytes_per_sample; 36 img->x_chroma_shift : img->d_w) * bytes_per_sample;
37 37
38 for (int y = 0; y < h; ++y) { 38 for (int y = 0; y < h; ++y) {
39 MD5Update(&md5_, buf, w); 39 MD5Update(&md5_, buf, w);
40 buf += img->stride[plane]; 40 buf += img->stride[plane];
41 } 41 }
42 } 42 }
43 } 43 }
44 44
45 void Add(const uint8_t *data, size_t size) {
46 MD5Update(&md5_, data, static_cast<uint32_t>(size));
47 }
48
45 const char *Get(void) { 49 const char *Get(void) {
46 static const char hex[16] = { 50 static const char hex[16] = {
47 '0', '1', '2', '3', '4', '5', '6', '7', 51 '0', '1', '2', '3', '4', '5', '6', '7',
48 '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 52 '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
49 }; 53 };
50 uint8_t tmp[16]; 54 uint8_t tmp[16];
51 MD5Context ctx_tmp = md5_; 55 MD5Context ctx_tmp = md5_;
52 56
53 MD5Final(tmp, &ctx_tmp); 57 MD5Final(tmp, &ctx_tmp);
54 for (int i = 0; i < 16; i++) { 58 for (int i = 0; i < 16; i++) {
55 res_[i * 2 + 0] = hex[tmp[i] >> 4]; 59 res_[i * 2 + 0] = hex[tmp[i] >> 4];
56 res_[i * 2 + 1] = hex[tmp[i] & 0xf]; 60 res_[i * 2 + 1] = hex[tmp[i] & 0xf];
57 } 61 }
58 res_[32] = 0; 62 res_[32] = 0;
59 63
60 return res_; 64 return res_;
61 } 65 }
62 66
63 protected: 67 protected:
64 char res_[33]; 68 char res_[33];
65 MD5Context md5_; 69 MD5Context md5_;
66 }; 70 };
67 71
68 } // namespace libvpx_test 72 } // namespace libvpx_test
69 73
70 #endif // TEST_MD5_HELPER_H_ 74 #endif // TEST_MD5_HELPER_H_
OLDNEW
« no previous file with comments | « source/libvpx/test/fdct8x8_test.cc ('k') | source/libvpx/test/partial_idct_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698