| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This webpage shows layout of YV12 and other YUV formats | 5 // This webpage shows layout of YV12 and other YUV formats |
| 6 // http://www.fourcc.org/yuv.php | 6 // http://www.fourcc.org/yuv.php |
| 7 // The actual conversion is best described here | 7 // The actual conversion is best described here |
| 8 // http://en.wikipedia.org/wiki/YUV | 8 // http://en.wikipedia.org/wiki/YUV |
| 9 // An article on optimizing YUV conversion using tables instead of multiplies | 9 // An article on optimizing YUV conversion using tables instead of multiplies |
| 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf | 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf |
| 11 // | 11 // |
| 12 // YV12 is a full plane of Y and a half height, half width chroma planes | 12 // YV12 is a full plane of Y and a half height, half width chroma planes |
| 13 // YV16 is a full plane of Y and a full height, half width chroma planes | 13 // YV16 is a full plane of Y and a full height, half width chroma planes |
| 14 // | 14 // |
| 15 // ARGB pixel format is output, which on little endian is stored as BGRA. | 15 // ARGB pixel format is output, which on little endian is stored as BGRA. |
| 16 // The alpha is set to 255, allowing the application to use RGBA or RGB32. | 16 // The alpha is set to 255, allowing the application to use RGBA or RGB32. |
| 17 | 17 |
| 18 #include "media/base/yuv_convert.h" | 18 #include "media/base/yuv_convert.h" |
| 19 | 19 |
| 20 #include "build/build_config.h" |
| 20 #include "media/base/cpu_features.h" | 21 #include "media/base/cpu_features.h" |
| 21 #include "media/base/yuv_convert_internal.h" | 22 #include "media/base/yuv_convert_internal.h" |
| 22 #include "media/base/yuv_row.h" | 23 #include "media/base/yuv_row.h" |
| 23 | 24 |
| 24 #if USE_MMX | 25 #if USE_MMX |
| 25 #if defined(_MSC_VER) | 26 #if defined(_MSC_VER) |
| 26 #include <intrin.h> | 27 #include <intrin.h> |
| 27 #else | 28 #else |
| 28 #include <mmintrin.h> | 29 #include <mmintrin.h> |
| 29 #endif | 30 #endif |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 uint8* uplane, | 350 uint8* uplane, |
| 350 uint8* vplane, | 351 uint8* vplane, |
| 351 int width, | 352 int width, |
| 352 int height, | 353 int height, |
| 353 int rgbstride, | 354 int rgbstride, |
| 354 int ystride, | 355 int ystride, |
| 355 int uvstride) { | 356 int uvstride) { |
| 356 static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*, | 357 static void (*convert_proc)(const uint8*, uint8*, uint8*, uint8*, |
| 357 int, int, int, int, int) = NULL; | 358 int, int, int, int, int) = NULL; |
| 358 if (!convert_proc) { | 359 if (!convert_proc) { |
| 359 #ifdef __arm__ | 360 #if defined(ARCH_CPU_ARM_FAMILY) |
| 360 // For ARM processors, always use C version. | 361 // For ARM processors, always use C version. |
| 361 // TODO(hclam): Implement a NEON version. | 362 // TODO(hclam): Implement a NEON version. |
| 362 convert_proc = &ConvertRGB32ToYUV_C; | 363 convert_proc = &ConvertRGB32ToYUV_C; |
| 363 #else | 364 #else |
| 364 // For x86 processors, check if SSE2 is supported. | 365 // For x86 processors, check if SSE2 is supported. |
| 365 if (hasSSE2()) | 366 if (hasSSE2()) |
| 366 convert_proc = &ConvertRGB32ToYUV_SSE2; | 367 convert_proc = &ConvertRGB32ToYUV_SSE2; |
| 367 else | 368 else |
| 368 convert_proc = &ConvertRGB32ToYUV_C; | 369 convert_proc = &ConvertRGB32ToYUV_C; |
| 369 #endif | 370 #endif |
| 370 } | 371 } |
| 371 | 372 |
| 372 convert_proc(rgbframe, yplane, uplane, vplane, width, height, | 373 convert_proc(rgbframe, yplane, uplane, vplane, width, height, |
| 373 rgbstride, ystride, uvstride); | 374 rgbstride, ystride, uvstride); |
| 374 } | 375 } |
| 375 | 376 |
| 376 } // namespace media | 377 } // namespace media |
| OLD | NEW |