OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/capturer/differ_block_sse2.h" | 5 #include "media/video/capture/screen/differ_block_sse2.h" |
6 | 6 |
7 #if defined(_MSC_VER) | 7 #if defined(_MSC_VER) |
8 #include <intrin.h> | 8 #include <intrin.h> |
9 #else | 9 #else |
10 #include <mmintrin.h> | 10 #include <mmintrin.h> |
11 #include <emmintrin.h> | 11 #include <emmintrin.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include "remoting/capturer/differ_block.h" | 14 #include "media/video/capture/screen/differ_block.h" |
15 | 15 |
16 namespace remoting { | 16 namespace media { |
17 | 17 |
18 extern int BlockDifference_SSE2_W16(const uint8* image1, const uint8* image2, | 18 extern int BlockDifference_SSE2_W16(const uint8* image1, const uint8* image2, |
19 int stride) { | 19 int stride) { |
20 __m128i acc = _mm_setzero_si128(); | 20 __m128i acc = _mm_setzero_si128(); |
21 __m128i v0; | 21 __m128i v0; |
22 __m128i v1; | 22 __m128i v1; |
23 __m128i sad; | 23 __m128i sad; |
24 for (int y = 0; y < kBlockSize; ++y) { | 24 for (int y = 0; y < kBlockSize; ++y) { |
25 const __m128i* i1 = reinterpret_cast<const __m128i*>(image1); | 25 const __m128i* i1 = reinterpret_cast<const __m128i*>(image1); |
26 const __m128i* i2 = reinterpret_cast<const __m128i*>(image2); | 26 const __m128i* i2 = reinterpret_cast<const __m128i*>(image2); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 sad = _mm_adds_epu16(sad, acc); | 102 sad = _mm_adds_epu16(sad, acc); |
103 int diff = _mm_cvtsi128_si32(sad); | 103 int diff = _mm_cvtsi128_si32(sad); |
104 if (diff) | 104 if (diff) |
105 return 1; | 105 return 1; |
106 image1 += stride; | 106 image1 += stride; |
107 image2 += stride; | 107 image2 += stride; |
108 } | 108 } |
109 return 0; | 109 return 0; |
110 } | 110 } |
111 | 111 |
112 } // namespace remoting | 112 } // namespace media |
OLD | NEW |