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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/base/simd/convert_rgb_to_yuv.cc
===================================================================
--- media/base/simd/convert_rgb_to_yuv.cc (revision 0)
+++ media/base/simd/convert_rgb_to_yuv.cc (revision 0)
@@ -0,0 +1,101 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/simd/convert_rgb_to_yuv.h"
+
+#include "build/build_config.h"
+#include "media/base/cpu_features.h"
+#include "media/base/simd/convert_rgb_to_yuv_ssse3.h"
+
+namespace media {
+
+void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride) {
+#ifdef ENABLE_SUBSAMPLING
+ for (; height >= 2; height -= 2) {
+ ConvertARGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ ConvertARGBToYUVOdd_SSSE3(rgbframe, yplane, uplane, vplane, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ uplane += uvstride;
+ vplane += uvstride;
+ }
+
+ if (height)
+ ConvertARGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
+#else
+ for (; height >= 2; height -= 2) {
+ ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ uplane += uvstride;
+ vplane += uvstride;
+ }
+
+ if (height)
+ ConvertARGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
+#endif
+}
+
+void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride) {
+#ifdef ENABLE_SUBSAMPLING
+ for (; height >= 2; height -= 2) {
+ ConvertRGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ ConvertRGBToYUVOdd_SSSE3(rgbframe, yplane, uplane, vplane, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ uplane += uvstride;
+ vplane += uvstride;
+ }
+
+ if (height)
+ ConvertRGBToYUVEven_SSSE3(rgbframe, yplane, uplane, vplane, width);
+#else
+ for (; height >= 2; height -= 2) {
+ ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, NULL, NULL, width);
+ rgbframe += rgbstride;
+ yplane += ystride;
+
+ uplane += uvstride;
+ vplane += uvstride;
+ }
+
+ if (height)
+ ConvertRGBToYUVRow_SSSE3(rgbframe, yplane, uplane, vplane, width);
+#endif
+}
+
+} // namespace media
Property changes on: media\base\simd\convert_rgb_to_yuv.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698