diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 19:32:27 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 19:32:27 +0000 |
commit | 67637b8ab2e6bef2ba134048461d14c9ecfff0c6 (patch) | |
tree | 4f8385e55be8edbcf6d3445957c516de50f3a398 /media/base/yuv_convert.cc | |
parent | 018a96fdb1e10160e0f12f066d9389739b37a97e (diff) | |
download | chromium_src-67637b8ab2e6bef2ba134048461d14c9ecfff0c6.zip chromium_src-67637b8ab2e6bef2ba134048461d14c9ecfff0c6.tar.gz chromium_src-67637b8ab2e6bef2ba134048461d14c9ecfff0c6.tar.bz2 |
Runtime check to enable SSE2 color space conversion code
This will make text in chromoting view to looks much nicer.
BUG=72218
TEST=Text looks much better in chromoting
Review URL: http://codereview.chromium.org/6410127
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/yuv_convert.cc')
-rw-r--r-- | media/base/yuv_convert.cc | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc index bea0e50..f6e2857 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -17,7 +17,8 @@ #include "media/base/yuv_convert.h" -// Header for low level row functions. +#include "media/base/cpu_features.h" +#include "media/base/yuv_convert_internal.h" #include "media/base/yuv_row.h" #if USE_MMX @@ -343,4 +344,33 @@ void ScaleYUVToRGB32(const uint8* y_buf, EMMS(); } +void ConvertRGB32ToYUV(const uint8* rgbframe, + uint8* yplane, + uint8* uplane, + uint8* vplane, + int width, + int height, + int rgbstride, + int ystride, + int uvstride) { + static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*, + int, int, int, int, int) = NULL; + if (!convert_proc) { +#ifdef __arm__ + // For ARM processors, always use C version. + // TODO(hclam): Implement a NEON version. + convert_proc = &ConvertRGB32ToYUV_C; +#else + // For x86 processors, check if SSE2 is supported. + if (hasSSE2()) + convert_proc = &ConvertRGB32ToYUV_SSE2; + else + convert_proc = &ConvertRGB32ToYUV_C; +#endif + } + + convert_proc(rgbframe, yplane, uplane, vplane, width, height, + rgbstride, ystride, uvstride); +} + } // namespace media |