Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / base / simd / convert_rgb_to_yuv_ssse3.cc
blobe956926a1f5de6807d2378f8ad451880c17d3466
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 #include "media/base/simd/convert_rgb_to_yuv.h"
7 #include "build/build_config.h"
8 #include "media/base/simd/convert_rgb_to_yuv_ssse3.h"
10 namespace media {
12 void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe,
13 uint8* yplane,
14 uint8* uplane,
15 uint8* vplane,
16 int width,
17 int height,
18 int rgbstride,
19 int ystride,
20 int uvstride) {
21 for (; height >= 2; height -= 2) {
22 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
23 rgbframe += rgbstride;
24 yplane += ystride;
26 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
27 rgbframe += rgbstride;
28 yplane += ystride;
30 uplane += uvstride;
31 vplane += uvstride;
34 if (height)
35 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
38 void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe,
39 uint8* yplane,
40 uint8* uplane,
41 uint8* vplane,
42 int width,
43 int height,
44 int rgbstride,
45 int ystride,
46 int uvstride) {
47 for (; height >= 2; height -= 2) {
48 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
49 rgbframe += rgbstride;
50 yplane += ystride;
52 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
53 rgbframe += rgbstride;
54 yplane += ystride;
56 uplane += uvstride;
57 vplane += uvstride;
60 if (height)
61 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
64 } // namespace media