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

Unified Diff: media/base/yuv_convert.cc

Issue 7003082: Implements RGB to YV12 conversion in YASM. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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/yuv_convert.cc
===================================================================
--- media/base/yuv_convert.cc (revision 99073)
+++ media/base/yuv_convert.cc (working copy)
@@ -19,6 +19,8 @@
#include "build/build_config.h"
#include "media/base/cpu_features.h"
+#include "media/base/simd/convert_rgb_to_yuv.h"
+#include "media/base/simd/convert_yuv_to_rgb.h"
#include "media/base/yuv_convert_internal.h"
#include "media/base/yuv_row.h"
@@ -52,6 +54,12 @@
int uv_pitch,
int rgb_pitch,
YUVType yuv_type) {
+ if (hasSSSE3()) {
+ simd::ConvertYUVtoRGB32(y_buf, u_buf, v_buf, rgb_buf, width, height,
+ y_pitch, uv_pitch, rgb_pitch, yuv_type);
+ return;
+ }
+
Alpha Left Google 2011/09/01 13:24:45 Add a comment here that we use the MMX version as
unsigned int y_shift = yuv_type;
for (int y = 0; y < height; ++y) {
uint8* rgb_row = rgb_buf + y * rgb_pitch;
@@ -366,8 +374,10 @@
// TODO(hclam): Implement a NEON version.
convert_proc = &ConvertRGB32ToYUV_C;
#else
- // For x86 processors, check if SSE2 is supported.
- if (hasSSE2())
+ // For x86 processors, check if SSSE3 (or SSE2) is supported.
+ if (hasSSSE3())
+ convert_proc = &simd::ConvertRGB32toYUV;
+ else if (hasSSE2())
convert_proc = &ConvertRGB32ToYUV_SSE2;
else
convert_proc = &ConvertRGB32ToYUV_C;
@@ -387,8 +397,21 @@
int rgbstride,
int ystride,
int uvstride) {
+#if defined(ARCH_CPU_ARM_FAMILY)
ConvertRGB24ToYUV_C(rgbframe, yplane, uplane, vplane, width, height,
rgbstride, ystride, uvstride);
+#else
+ static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*,
+ int, int, int, int, int) = NULL;
+ if (!convert_proc) {
+ if (hasSSSE3())
+ convert_proc = &simd::ConvertRGB24toYUV;
+ else
+ convert_proc = & ConvertRGB24ToYUV_C;
+ }
+ convert_proc(rgbframe, yplane, uplane, vplane, width, height,
+ rgbstride, ystride, uvstride);
+#endif
}
void ConvertYUY2ToYUV(const uint8* src,

Powered by Google App Engine
This is Rietveld 408576698