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