Chromium Code Reviews| Index: media/base/simd/yuv_convert.cc |
| =================================================================== |
| --- media/base/simd/yuv_convert.cc (revision 0) |
| +++ media/base/simd/yuv_convert.cc (revision 0) |
| @@ -0,0 +1,129 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
Alpha Left Google
2011/08/22 14:16:59
These functions should be defined in yuv_convert_s
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "media/base/simd/yuv_convert.h" |
| + |
| +#include "build/build_config.h" |
| +#include "media/base/cpu_features.h" |
| +#include "media/base/simd/yuv_row.h" |
| + |
| +namespace media { |
| + |
| +namespace simd { |
| + |
| +void ConvertRGB32toYUV(const uint8* rgbframe, |
|
Alpha Left Google
2011/08/22 14:16:59
Call this ConvertRGB32toYUV_SSE2, you can call the
|
| + uint8* yplane, |
| + uint8* uplane, |
| + uint8* vplane, |
| + int width, |
| + int height, |
| + int rgbstride, |
| + int ystride, |
| + int uvstride) { |
| + for (; height >= 2; height -= 2) { |
| + ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| + rgbframe += rgbstride; |
| + yplane += ystride; |
| + |
| + ConvertARGBtoYUVRow(rgbframe, yplane, NULL, NULL, width); |
| + rgbframe += rgbstride; |
| + yplane += ystride; |
| + |
| + uplane += uvstride; |
| + vplane += uvstride; |
| + } |
| + |
| + if (height) |
| + ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| +} |
| + |
| +void ConvertRGB24toYUV(const uint8* rgbframe, |
|
Alpha Left Google
2011/08/22 14:16:59
Same for this one, call it ConvertRGB24toYUV_SSE2
|
| + uint8* yplane, |
| + uint8* uplane, |
| + uint8* vplane, |
| + int width, |
| + int height, |
| + int rgbstride, |
| + int ystride, |
| + int uvstride) { |
| + for (; height >= 2; height -= 2) { |
| + ConvertRGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| + rgbframe += rgbstride; |
| + yplane += ystride; |
| + |
| + ConvertRGBtoYUVRow(rgbframe, yplane, NULL, NULL, width); |
| + rgbframe += rgbstride; |
| + yplane += ystride; |
| + |
| + uplane += uvstride; |
| + vplane += uvstride; |
| + } |
| + |
| + if (height) |
| + ConvertARGBtoYUVRow(rgbframe, yplane, uplane, vplane, width); |
| +} |
| + |
| +void ConvertYUVtoRGB32(const uint8* y_buf, |
|
Alpha Left Google
2011/08/22 14:16:59
Call this ConvertYUVtoRGB32_SSE2.
|
| + const uint8* u_buf, |
| + const uint8* v_buf, |
| + uint8* rgb_buf, |
| + int width, |
| + int height, |
| + int y_pitch, |
| + int uv_pitch, |
| + int rgb_pitch, |
| + YUVType yuv_type) { |
| + if (yuv_type == YV12) { |
|
Alpha Left Google
2011/08/22 14:16:59
Please this use construct:
if (yuv_type != YV12)
|
| + for (; height >= 2; height -= 2) { |
| + ConvertYUVtoARGBRow(y_buf, u_buf, v_buf, rgb_buf, width); |
| + rgb_buf += rgb_pitch; |
| + y_buf += y_pitch; |
| + |
| + ConvertYUVtoARGBRow(y_buf, u_buf, v_buf, rgb_buf, width); |
| + rgb_buf += rgb_pitch; |
| + y_buf += y_pitch; |
| + |
| + u_buf += uv_pitch; |
| + v_buf += uv_pitch; |
| + } |
| + |
| + if (height) |
| + ConvertYUVtoARGBRow(y_buf, u_buf, v_buf, rgb_buf, width); |
| + } else { |
| + } |
| +} |
| + |
| +void ConvertYUVtoRGB24(const uint8* y_buf, |
|
Alpha Left Google
2011/08/22 14:16:59
Call this ConvertYUVtoRGB24_SSE2.
|
| + const uint8* u_buf, |
| + const uint8* v_buf, |
| + uint8* rgb_buf, |
| + int width, |
| + int height, |
| + int y_pitch, |
| + int uv_pitch, |
| + int rgb_pitch, |
| + YUVType yuv_type) { |
| + if (yuv_type == YV12) { |
|
Alpha Left Google
2011/08/22 14:16:59
Please this use construct:
if (yuv_type != YV12)
|
| + for (; height >= 2; height -= 2) { |
| + ConvertYUVtoRGBRow(y_buf, u_buf, v_buf, rgb_buf, width); |
| + rgb_buf += rgb_pitch; |
| + y_buf += y_pitch; |
| + |
| + ConvertYUVtoRGBRow(y_buf, u_buf, v_buf, rgb_buf, width); |
| + rgb_buf += rgb_pitch; |
| + y_buf += y_pitch; |
| + |
| + u_buf += uv_pitch; |
| + v_buf += uv_pitch; |
| + } |
| + |
| + if (height) |
| + ConvertYUVtoRGBRow(y_buf, u_buf, v_buf, rgb_buf, width); |
| + } else { |
| + } |
| +} |
| + |
| +} // namespace simd |
| + |
| +} // namespace media |
| Property changes on: media\base\simd\yuv_convert.cc |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |