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

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

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/host/differ_block.h"
6
7 #include "base/cpu.h"
8 #include "build/build_config.h"
9 #include "remoting/host/differ_block_internal.h"
10
11 namespace remoting {
12
13 int BlockDifference_C(const uint8* image1, const uint8* image2, int stride) {
14 int width_bytes = kBlockSize * kBytesPerPixel;
15
16 for (int y = 0; y < kBlockSize; y++) {
17 if (memcmp(image1, image2, width_bytes) != 0)
18 return 1;
19 image1 += stride;
20 image2 += stride;
21 }
22 return 0;
23 }
24
25 int BlockDifference(const uint8* image1, const uint8* image2, int stride) {
26 static int (*diff_proc)(const uint8*, const uint8*, int) = NULL;
27
28 if (!diff_proc) {
29 #if defined(ARCH_CPU_ARM_FAMILY)
30 // For ARM processors, always use C version.
31 // TODO(hclam): Implement a NEON version.
32 diff_proc = &BlockDifference_C;
33 #else
34 base::CPU cpu;
35 // For x86 processors, check if SSE2 is supported.
36 if (cpu.has_sse2() && kBlockSize == 32)
37 diff_proc = &BlockDifference_SSE2_W32;
38 else if (cpu.has_sse2() && kBlockSize == 16)
39 diff_proc = &BlockDifference_SSE2_W16;
40 else
41 diff_proc = &BlockDifference_C;
42 #endif
43 }
44
45 return diff_proc(image1, image2, stride);
46 }
47
48 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698