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 "media/base/simd/convert_rgb_to_yuv.h"
6
7#include "build/build_config.h"
8#include "media/base/simd/convert_rgb_to_yuv_ssse3.h"
9
10namespace media {
11
12void 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;
25
26    ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
27    rgbframe += rgbstride;
28    yplane += ystride;
29
30    uplane += uvstride;
31    vplane += uvstride;
32  }
33
34  if (height)
35    ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
36}
37
38void 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;
51
52    ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
53    rgbframe += rgbstride;
54    yplane += ystride;
55
56    uplane += uvstride;
57    vplane += uvstride;
58  }
59
60  if (height)
61    ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
62}
63
64}  // namespace media
65