OLD | NEW |
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 <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 #endif | 11 #endif |
10 | 12 |
11 #include "media/base/simd/convert_yuv_to_rgb.h" | 13 #include "media/base/simd/convert_yuv_to_rgb.h" |
12 #include "media/base/yuv_convert.h" | 14 #include "media/base/yuv_convert.h" |
13 | 15 |
14 namespace media { | 16 namespace media { |
15 | 17 |
16 void ConvertYUVAToARGB_MMX(const uint8* yplane, | 18 void ConvertYUVAToARGB_MMX(const uint8_t* yplane, |
17 const uint8* uplane, | 19 const uint8_t* uplane, |
18 const uint8* vplane, | 20 const uint8_t* vplane, |
19 const uint8* aplane, | 21 const uint8_t* aplane, |
20 uint8* rgbframe, | 22 uint8_t* rgbframe, |
21 int width, | 23 int width, |
22 int height, | 24 int height, |
23 int ystride, | 25 int ystride, |
24 int uvstride, | 26 int uvstride, |
25 int astride, | 27 int astride, |
26 int rgbstride, | 28 int rgbstride, |
27 YUVType yuv_type) { | 29 YUVType yuv_type) { |
28 unsigned int y_shift = GetVerticalShift(yuv_type); | 30 unsigned int y_shift = GetVerticalShift(yuv_type); |
29 for (int y = 0; y < height; ++y) { | 31 for (int y = 0; y < height; ++y) { |
30 uint8* rgb_row = rgbframe + y * rgbstride; | 32 uint8_t* rgb_row = rgbframe + y * rgbstride; |
31 const uint8* y_ptr = yplane + y * ystride; | 33 const uint8_t* y_ptr = yplane + y * ystride; |
32 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; | 34 const uint8_t* u_ptr = uplane + (y >> y_shift) * uvstride; |
33 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; | 35 const uint8_t* v_ptr = vplane + (y >> y_shift) * uvstride; |
34 const uint8* a_ptr = aplane + y * astride; | 36 const uint8_t* a_ptr = aplane + y * astride; |
35 | 37 |
36 ConvertYUVAToARGBRow_MMX(y_ptr, | 38 ConvertYUVAToARGBRow_MMX(y_ptr, |
37 u_ptr, | 39 u_ptr, |
38 v_ptr, | 40 v_ptr, |
39 a_ptr, | 41 a_ptr, |
40 rgb_row, | 42 rgb_row, |
41 width, | 43 width, |
42 GetLookupTable(yuv_type)); | 44 GetLookupTable(yuv_type)); |
43 } | 45 } |
44 | 46 |
45 EmptyRegisterState(); | 47 EmptyRegisterState(); |
46 } | 48 } |
47 | 49 |
48 void ConvertYUVToRGB32_SSE(const uint8* yplane, | 50 void ConvertYUVToRGB32_SSE(const uint8_t* yplane, |
49 const uint8* uplane, | 51 const uint8_t* uplane, |
50 const uint8* vplane, | 52 const uint8_t* vplane, |
51 uint8* rgbframe, | 53 uint8_t* rgbframe, |
52 int width, | 54 int width, |
53 int height, | 55 int height, |
54 int ystride, | 56 int ystride, |
55 int uvstride, | 57 int uvstride, |
56 int rgbstride, | 58 int rgbstride, |
57 YUVType yuv_type) { | 59 YUVType yuv_type) { |
58 unsigned int y_shift = GetVerticalShift(yuv_type); | 60 unsigned int y_shift = GetVerticalShift(yuv_type); |
59 for (int y = 0; y < height; ++y) { | 61 for (int y = 0; y < height; ++y) { |
60 uint8* rgb_row = rgbframe + y * rgbstride; | 62 uint8_t* rgb_row = rgbframe + y * rgbstride; |
61 const uint8* y_ptr = yplane + y * ystride; | 63 const uint8_t* y_ptr = yplane + y * ystride; |
62 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; | 64 const uint8_t* u_ptr = uplane + (y >> y_shift) * uvstride; |
63 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; | 65 const uint8_t* v_ptr = vplane + (y >> y_shift) * uvstride; |
64 | 66 |
65 ConvertYUVToRGB32Row_SSE(y_ptr, | 67 ConvertYUVToRGB32Row_SSE(y_ptr, |
66 u_ptr, | 68 u_ptr, |
67 v_ptr, | 69 v_ptr, |
68 rgb_row, | 70 rgb_row, |
69 width, | 71 width, |
70 GetLookupTable(yuv_type)); | 72 GetLookupTable(yuv_type)); |
71 } | 73 } |
72 | 74 |
73 EmptyRegisterState(); | 75 EmptyRegisterState(); |
74 } | 76 } |
75 | 77 |
76 } // namespace media | 78 } // namespace media |
OLD | NEW |