summaryrefslogtreecommitdiffstats
path: root/remoting/host/differ.cc
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 18:00:57 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 18:00:57 +0000
commitc59d845257c5245a476ffd4284c506ef58fe008d (patch)
tree7d6db0a3b735ec3fb944ad902506d638aa1cf1dd /remoting/host/differ.cc
parenteff69e3f36db0ed1e17281506cf315e51e07c2c3 (diff)
downloadchromium_src-c59d845257c5245a476ffd4284c506ef58fe008d.zip
chromium_src-c59d845257c5245a476ffd4284c506ef58fe008d.tar.gz
chromium_src-c59d845257c5245a476ffd4284c506ef58fe008d.tar.bz2
Revert 74571 - Use SSE2 block differ for chromoting
We have the SSE2 lying around in the tree just never being used. This will allow us to use it. A number of Windows bots have gone red in media_tests on the waterfall: http://build.chromium.org/p/chromium/builders/XP%20Tests%20%281%29 http://build.chromium.org/p/chromium/builders/XP%20Tests%20%281%29/builds/501/steps/media_unittests/logs/stdio This seems to be related to r74571. So am reverting to see. BUG=None TEST=Chromoting to a host machine and the diff will work correctly Review URL: http://codereview.chromium.org/6469022 TBR=hclam@chromium.org Review URL: http://codereview.chromium.org/6502002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/differ.cc')
-rw-r--r--remoting/host/differ.cc32
1 files changed, 30 insertions, 2 deletions
diff --git a/remoting/host/differ.cc b/remoting/host/differ.cc
index c473870..c7d28b0 100644
--- a/remoting/host/differ.cc
+++ b/remoting/host/differ.cc
@@ -5,7 +5,6 @@
#include "remoting/host/differ.h"
#include "base/logging.h"
-#include "remoting/host/differ_block.h"
namespace remoting {
@@ -73,7 +72,7 @@ void Differ::MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer) {
uint8* diff_info = diff_info_row_start;
for (int x = 0; x < x_full_blocks; x++) {
- DiffInfo diff = BlockDifference(prev_block, curr_block, bytes_per_row_);
+ DiffInfo diff = DiffBlock(prev_block, curr_block, bytes_per_row_);
if (diff != 0) {
// Mark this block as being modified so that it gets incorporated into
// a dirty rect.
@@ -99,6 +98,35 @@ void Differ::MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer) {
}
}
+DiffInfo Differ::DiffBlock(const uint8* prev_buffer, const uint8* curr_buffer,
+ int stride) {
+ const uint8* prev_row_start = prev_buffer;
+ const uint8* curr_row_start = curr_buffer;
+
+ // Number of uint64s in each row of the block.
+ // This must be an integral number.
+ int int64s_per_row = (kBlockSize * bytes_per_pixel_) / sizeof(uint64);
+ DCHECK(((kBlockSize * bytes_per_pixel_) % sizeof(uint64)) == 0);
+
+ for (int y = 0; y < kBlockSize; y++) {
+ const uint64* prev = reinterpret_cast<const uint64*>(prev_row_start);
+ const uint64* curr = reinterpret_cast<const uint64*>(curr_row_start);
+
+ // Check each row in uint64-sized chunks.
+ // Note that this check may straddle multiple pixels. This is OK because
+ // we're interested in identifying whether or not there was change - we
+ // don't care what the actual change is.
+ for (int x = 0; x < int64s_per_row; x++) {
+ if (*prev++ != *curr++) {
+ return 1;
+ }
+ }
+ prev_row_start += stride;
+ curr_row_start += stride;
+ }
+ return 0;
+}
+
DiffInfo Differ::DiffPartialBlock(const uint8* prev_buffer,
const uint8* curr_buffer,
int stride, int width, int height) {