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

Side by Side Diff: remoting/host/differ_unittest.cc

Issue 6501005: Resubmit - Use SSE2 block differ for chromoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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 | « remoting/host/differ_block_sse2.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "remoting/host/differ.h" 6 #include "remoting/host/differ.h"
7 #include "remoting/host/differ_block.h"
7 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
8 9
9 namespace remoting { 10 namespace remoting {
10 11
11 // 96x96 screen gives a 3x3 grid of blocks. 12 // 96x96 screen gives a 4x4 grid of blocks.
12 const int kScreenWidth= 96; 13 const int kScreenWidth= 96;
13 const int kScreenHeight = 96; 14 const int kScreenHeight = 96;
14 const int kBytesPerPixel = 3;
15 const int kBytesPerRow = (kBytesPerPixel * kScreenWidth); 15 const int kBytesPerRow = (kBytesPerPixel * kScreenWidth);
16 16
17 class DifferTest : public testing::Test { 17 class DifferTest : public testing::Test {
18 public: 18 public:
19 DifferTest() { 19 DifferTest() {
20 } 20 }
21 21
22 protected: 22 protected:
23 virtual void SetUp() { 23 virtual void SetUp() {
24 InitDiffer(kScreenWidth, kScreenHeight, kBytesPerPixel, kBytesPerRow); 24 InitDiffer(kScreenWidth, kScreenHeight, kBytesPerPixel, kBytesPerRow);
(...skipping 18 matching lines...) Expand all
43 void ClearBuffer(uint8* buffer) { 43 void ClearBuffer(uint8* buffer) {
44 memset(buffer, 0, buffer_size_); 44 memset(buffer, 0, buffer_size_);
45 } 45 }
46 46
47 // Convenience wrapper for Differ's DiffBlock that calculates the appropriate 47 // Convenience wrapper for Differ's DiffBlock that calculates the appropriate
48 // offset to the start of the desired block. 48 // offset to the start of the desired block.
49 DiffInfo DiffBlock(int block_x, int block_y) { 49 DiffInfo DiffBlock(int block_x, int block_y) {
50 // Offset from upper-left of buffer to upper-left of requested block. 50 // Offset from upper-left of buffer to upper-left of requested block.
51 int block_offset = ((block_y * stride_) + (block_x * bytes_per_pixel_)) 51 int block_offset = ((block_y * stride_) + (block_x * bytes_per_pixel_))
52 * kBlockSize; 52 * kBlockSize;
53 return differ_->DiffBlock(prev_.get() + block_offset, 53 return BlockDifference(prev_.get() + block_offset,
54 curr_.get() + block_offset, 54 curr_.get() + block_offset,
55 stride_); 55 stride_);
56 } 56 }
57 57
58 // Write the pixel |value| into the specified block in the |buffer|. 58 // Write the pixel |value| into the specified block in the |buffer|.
59 // This is a convenience wrapper around WritePixel(). 59 // This is a convenience wrapper around WritePixel().
60 void WriteBlockPixel(uint8* buffer, int block_x, int block_y, 60 void WriteBlockPixel(uint8* buffer, int block_x, int block_y,
61 int pixel_x, int pixel_y, uint32 value) { 61 int pixel_x, int pixel_y, uint32 value) {
62 WritePixel(buffer, (block_x * kBlockSize) + pixel_x, 62 WritePixel(buffer, (block_x * kBlockSize) + pixel_x,
63 (block_y * kBlockSize) + pixel_y, value); 63 (block_y * kBlockSize) + pixel_y, value);
64 } 64 }
65 65
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 dirty.reset(new InvalidRects()); 521 dirty.reset(new InvalidRects());
522 differ_->MergeBlocks(dirty.get()); 522 differ_->MergeBlocks(dirty.get());
523 523
524 ASSERT_EQ(2UL, dirty->size()); 524 ASSERT_EQ(2UL, dirty->size());
525 CheckDirtyRect(*dirty.get(), 0, 0, 2, 2); 525 CheckDirtyRect(*dirty.get(), 0, 0, 2, 2);
526 CheckDirtyRect(*dirty.get(), 1, 2, 1, 1); 526 CheckDirtyRect(*dirty.get(), 1, 2, 1, 1);
527 } 527 }
528 528
529 } // namespace remoting 529 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/differ_block_sse2.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698