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

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

Issue 23600008: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 3 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/fdct8x8_test.cc ('k') | source/libvpx/test/sad_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
11 #ifndef LIBVPX_TEST_MD5_HELPER_H_ 11 #ifndef LIBVPX_TEST_MD5_HELPER_H_
12 #define LIBVPX_TEST_MD5_HELPER_H_ 12 #define LIBVPX_TEST_MD5_HELPER_H_
13 13
14 extern "C" { 14 extern "C" {
15 #include "./md5_utils.h" 15 #include "./md5_utils.h"
16 #include "vpx/vpx_decoder.h" 16 #include "vpx/vpx_decoder.h"
17 } 17 }
18 18
19 namespace libvpx_test { 19 namespace libvpx_test {
20 class MD5 { 20 class MD5 {
21 public: 21 public:
22 MD5() { 22 MD5() {
23 MD5Init(&md5_); 23 MD5Init(&md5_);
24 } 24 }
25 25
26 void Add(const vpx_image_t *img) { 26 void Add(const vpx_image_t *img) {
27 for (int plane = 0; plane < 3; ++plane) { 27 for (int plane = 0; plane < 3; ++plane) {
28 uint8_t *buf = img->planes[plane]; 28 const uint8_t *buf = img->planes[plane];
29 const int h = plane ? (img->d_h + 1) >> 1 : img->d_h; 29 // Calculate the width and height to do the md5 check. For the chroma
30 const int w = plane ? (img->d_w + 1) >> 1 : img->d_w; 30 // plane, we never want to round down and thus skip a pixel so if
31 // we are shifting by 1 (chroma_shift) we add 1 before doing the shift.
32 // This works only for chroma_shift of 0 and 1.
33 const int h = plane ? (img->d_h + img->y_chroma_shift) >>
34 img->y_chroma_shift : img->d_h;
35 const int w = plane ? (img->d_w + img->x_chroma_shift) >>
36 img->x_chroma_shift : img->d_w;
31 37
32 for (int y = 0; y < h; ++y) { 38 for (int y = 0; y < h; ++y) {
33 MD5Update(&md5_, buf, w); 39 MD5Update(&md5_, buf, w);
34 buf += img->stride[plane]; 40 buf += img->stride[plane];
35 } 41 }
36 } 42 }
37 } 43 }
38 44
39 const char *Get(void) { 45 const char *Get(void) {
40 static const char hex[16] = { 46 static const char hex[16] = {
(...skipping 14 matching lines...) Expand all
55 } 61 }
56 62
57 protected: 63 protected:
58 char res_[33]; 64 char res_[33];
59 MD5Context md5_; 65 MD5Context md5_;
60 }; 66 };
61 67
62 } // namespace libvpx_test 68 } // namespace libvpx_test
63 69
64 #endif // LIBVPX_TEST_MD5_HELPER_H_ 70 #endif // LIBVPX_TEST_MD5_HELPER_H_
OLDNEW
« no previous file with comments | « source/libvpx/test/fdct8x8_test.cc ('k') | source/libvpx/test/sad_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698