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

Side by Side Diff: remoting/capturer/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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "remoting/host/differ_block.h" 5 #include "remoting/capturer/differ_block.h"
6 6
7 #include "base/cpu.h" 7 #include "base/cpu.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "remoting/host/differ_block_internal.h" 9 #include "remoting/capturer/differ_block_sse2.h"
10 10
11 namespace remoting { 11 namespace remoting {
12 12
13 int BlockDifference_C(const uint8* image1, const uint8* image2, int stride) { 13 int BlockDifference_C(const uint8* image1, const uint8* image2, int stride) {
14 int width_bytes = kBlockSize * kBytesPerPixel; 14 int width_bytes = kBlockSize * kBytesPerPixel;
15 15
16 for (int y = 0; y < kBlockSize; y++) { 16 for (int y = 0; y < kBlockSize; y++) {
17 if (memcmp(image1, image2, width_bytes) != 0) 17 if (memcmp(image1, image2, width_bytes) != 0)
18 return 1; 18 return 1;
19 image1 += stride; 19 image1 += stride;
20 image2 += stride; 20 image2 += stride;
21 } 21 }
22 return 0; 22 return 0;
23 } 23 }
24 24
25 int BlockDifference(const uint8* image1, const uint8* image2, int stride) { 25 int BlockDifference(const uint8* image1, const uint8* image2, int stride) {
26 static int (*diff_proc)(const uint8*, const uint8*, int) = NULL; 26 static int (*diff_proc)(const uint8*, const uint8*, int) = NULL;
27 27
28 if (!diff_proc) { 28 if (!diff_proc) {
29 #if defined(ARCH_CPU_ARM_FAMILY) 29 #if defined(ARCH_CPU_ARM_FAMILY)
30 // For ARM processors, always use C version. 30 // For ARM processors, always use C version.
31 // TODO(hclam): Implement a NEON version. 31 // TODO(hclam): Implement a NEON version.
32 diff_proc = &BlockDifference_C; 32 diff_proc = &BlockDifference_C;
33 #else 33 #else
34 base::CPU cpu; 34 base::CPU cpu;
35 // For x86 processors, check if SSE2 is supported. 35 // For x86 processors, check if SSE2 is supported.
36 if (cpu.has_sse2() && kBlockSize == 32) 36 if (cpu.has_sse2() && kBlockSize == 32) {
37 diff_proc = &BlockDifference_SSE2_W32; 37 diff_proc = &BlockDifference_SSE2_W32;
38 else if (cpu.has_sse2() && kBlockSize == 16) 38 } else if (cpu.has_sse2() && kBlockSize == 16) {
39 diff_proc = &BlockDifference_SSE2_W16; 39 diff_proc = &BlockDifference_SSE2_W16;
40 else 40 } else {
41 diff_proc = &BlockDifference_C; 41 diff_proc = &BlockDifference_C;
42 }
42 #endif 43 #endif
43 } 44 }
44 45
45 return diff_proc(image1, image2, stride); 46 return diff_proc(image1, image2, stride);
46 } 47 }
47 48
48 } // namespace remoting 49 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698