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