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