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 <stdint.h> |
| 6 |
5 #if defined(_MSC_VER) | 7 #if defined(_MSC_VER) |
6 #include <intrin.h> | 8 #include <intrin.h> |
7 #else | 9 #else |
8 #include <mmintrin.h> | 10 #include <mmintrin.h> |
9 #include <emmintrin.h> | 11 #include <emmintrin.h> |
10 #endif | 12 #endif |
11 | 13 |
12 #include "media/base/simd/filter_yuv.h" | 14 #include "media/base/simd/filter_yuv.h" |
13 | 15 |
14 namespace media { | 16 namespace media { |
15 | 17 |
16 void FilterYUVRows_SSE2(uint8* dest, | 18 void FilterYUVRows_SSE2(uint8_t* dest, |
17 const uint8* src0, | 19 const uint8_t* src0, |
18 const uint8* src1, | 20 const uint8_t* src1, |
19 int width, | 21 int width, |
20 uint8 fraction) { | 22 uint8_t fraction) { |
21 int pixel = 0; | 23 int pixel = 0; |
22 | 24 |
23 // Process the unaligned bytes first. | 25 // Process the unaligned bytes first. |
24 int unaligned_width = | 26 int unaligned_width = |
25 (16 - (reinterpret_cast<uintptr_t>(dest) & 15)) & 15; | 27 (16 - (reinterpret_cast<uintptr_t>(dest) & 15)) & 15; |
26 while (pixel < width && pixel < unaligned_width) { | 28 while (pixel < width && pixel < unaligned_width) { |
27 dest[pixel] = (src0[pixel] * (256 - fraction) + | 29 dest[pixel] = (src0[pixel] * (256 - fraction) + |
28 src1[pixel] * fraction) >> 8; | 30 src1[pixel] * fraction) >> 8; |
29 ++pixel; | 31 ++pixel; |
30 } | 32 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 65 } |
64 | 66 |
65 while (pixel < width) { | 67 while (pixel < width) { |
66 dest[pixel] = (src0[pixel] * (256 - fraction) + | 68 dest[pixel] = (src0[pixel] * (256 - fraction) + |
67 src1[pixel] * fraction) >> 8; | 69 src1[pixel] * fraction) >> 8; |
68 ++pixel; | 70 ++pixel; |
69 } | 71 } |
70 } | 72 } |
71 | 73 |
72 } // namespace media | 74 } // namespace media |
OLD | NEW |