Chromium Code Reviews| Index: media/base/yuv_convert.cc |
| =================================================================== |
| --- media/base/yuv_convert.cc (revision 91457) |
| +++ media/base/yuv_convert.cc (working copy) |
| @@ -19,6 +19,7 @@ |
| #include "build/build_config.h" |
| #include "media/base/cpu_features.h" |
| +#include "media/base/simd/yuv_convert.h" |
| #include "media/base/yuv_convert_internal.h" |
| #include "media/base/yuv_row.h" |
| @@ -34,6 +35,8 @@ |
| #include <emmintrin.h> |
| #endif |
| +#define USE_YASM |
|
Alpha Left Google
2011/08/22 14:16:59
It's better not to use this #ifdef.
|
| + |
| namespace media { |
| // 16.16 fixed point arithmetic |
| @@ -52,6 +55,14 @@ |
| int uv_pitch, |
| int rgb_pitch, |
| YUVType yuv_type) { |
| +#ifdef USE_YASM |
|
Alpha Left Google
2011/08/22 14:16:59
There seems to be a slow down using this new YUV->
|
| + if (hasSSE2()) { |
| + simd::ConvertYUVtoRGB32(y_buf, u_buf, v_buf, rgb_buf, width, height, |
| + y_pitch, uv_pitch, rgb_pitch, yuv_type); |
| + return; |
| + } |
| +#endif |
| + |
| unsigned int y_shift = yuv_type; |
| for (int y = 0; y < height; ++y) { |
| uint8* rgb_row = rgb_buf + y * rgb_pitch; |
| @@ -368,7 +379,11 @@ |
| #else |
| // For x86 processors, check if SSE2 is supported. |
| if (hasSSE2()) |
|
Alpha Left Google
2011/08/22 14:16:59
if hasSSE2() compiles on all platform we can get r
|
| +#ifdef USE_YASM |
|
Alpha Left Google
2011/08/22 14:16:59
Don't use an ifdef, just apply the new function.
|
| + convert_proc = &simd::ConvertRGB32toYUV; |
| +#else |
| convert_proc = &ConvertRGB32ToYUV_SSE2; |
|
Alpha Left Google
2011/08/22 14:16:59
Remove this line.
|
| +#endif |
| else |
| convert_proc = &ConvertRGB32ToYUV_C; |
| #endif |
| @@ -387,6 +402,13 @@ |
| int rgbstride, |
| int ystride, |
| int uvstride) { |
| +#ifdef USE_YASM |
|
Alpha Left Google
2011/08/22 14:16:59
Same here use if without ifdef. Also because with
|
| + if (hasSSE2()) { |
| + simd::ConvertRGB24toYUV(rgbframe, yplane, uplane, vplane, width, height, |
| + rgbstride, ystride, uvstride); |
| + return; |
| + } |
| +#endif |
| ConvertRGB24ToYUV_C(rgbframe, yplane, uplane, vplane, width, height, |
| rgbstride, ystride, uvstride); |
| } |