Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: media/base/simd/convert_rgb_to_yuv.cc

Issue 7003082: Implements RGB to YV12 conversion in YASM. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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/cpu_features.h"
9 #include "media/base/simd/convert_rgb_to_yuv_ssse3.h"
10
11 namespace media {
12 namespace simd {
13
14 void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe,
15 uint8* yplane,
16 uint8* uplane,
17 uint8* vplane,
18 int width,
19 int height,
20 int rgbstride,
21 int ystride,
22 int uvstride) {
23 #ifdef ENABLE_SUBSAMPLING
24 for (; height >= 2; height -= 2) {
25 ConvertARGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
26 rgbframe += rgbstride;
27 yplane += ystride;
28
29 ConvertARGBToYUVOdd_SSSE3(rgbframe, yplane, uplane, vplane, width);
30 rgbframe += rgbstride;
31 yplane += ystride;
32
33 uplane += uvstride;
34 vplane += uvstride;
35 }
36
37 if (height)
38 ConvertARGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
39 #else
40 for (; height >= 2; height -= 2) {
41 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
42 rgbframe += rgbstride;
43 yplane += ystride;
44
45 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
46 rgbframe += rgbstride;
47 yplane += ystride;
48
49 uplane += uvstride;
50 vplane += uvstride;
51 }
52
53 if (height)
54 ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
55 #endif
56 }
57
58 void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe,
59 uint8* yplane,
60 uint8* uplane,
61 uint8* vplane,
62 int width,
63 int height,
64 int rgbstride,
65 int ystride,
66 int uvstride) {
67 #ifdef ENABLE_SUBSAMPLING
68 for (; height >= 2; height -= 2) {
69 ConvertRGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
70 rgbframe += rgbstride;
71 yplane += ystride;
72
73 ConvertRGBToYUVOdd_SSSE3(rgbframe, yplane, uplane, vplane, width);
74 rgbframe += rgbstride;
75 yplane += ystride;
76
77 uplane += uvstride;
78 vplane += uvstride;
79 }
80
81 if (height)
82 ConvertRGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
83 #else
84 for (; height >= 2; height -= 2) {
85 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
86 rgbframe += rgbstride;
87 yplane += ystride;
88
89 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
90 rgbframe += rgbstride;
91 yplane += ystride;
92
93 uplane += uvstride;
94 vplane += uvstride;
95 }
96
97 if (height)
98 ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
99 #endif
100 }
101
102 } // namespace simd
103 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698