| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // yuv_row internal functions to handle YUV conversion and scaling to RGB. | 5 // yuv_row internal functions to handle YUV conversion and scaling to RGB. |
| 6 // These functions are used from both yuv_convert.cc and yuv_scale.cc. | 6 // These functions are used from both yuv_convert.cc and yuv_scale.cc. |
| 7 | 7 |
| 8 // TODO(fbarchard): Write function that can handle rotation and scaling. |
| 9 |
| 8 #ifndef MEDIA_BASE_YUV_ROW_H_ | 10 #ifndef MEDIA_BASE_YUV_ROW_H_ |
| 9 #define MEDIA_BASE_YUV_ROW_H_ | 11 #define MEDIA_BASE_YUV_ROW_H_ |
| 10 | 12 |
| 11 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 12 | 14 |
| 13 namespace media { | 15 extern "C" { |
| 14 | |
| 15 // Can only do 1x. | 16 // Can only do 1x. |
| 16 // This is the second fastest of the scalers. | 17 // This is the second fastest of the scalers. |
| 17 void FastConvertYUVToRGB32Row(const uint8* y_buf, | 18 void FastConvertYUVToRGB32Row(const uint8* y_buf, |
| 18 const uint8* u_buf, | 19 const uint8* u_buf, |
| 19 const uint8* v_buf, | 20 const uint8* v_buf, |
| 20 uint8* rgb_buf, | 21 uint8* rgb_buf, |
| 21 int width); | 22 int width); |
| 22 | 23 |
| 23 // Can do 1x, half size or any scale down by an integer amount. | 24 // Can do 1x, half size or any scale down by an integer amount. |
| 24 // Step can be negative (mirroring, rotate 180). | 25 // Step can be negative (mirroring, rotate 180). |
| (...skipping 27 matching lines...) Expand all Loading... |
| 52 // Handles arbitrary scaling up or down. | 53 // Handles arbitrary scaling up or down. |
| 53 // Mirroring is supported, but not 90 or 270 degree rotation. | 54 // Mirroring is supported, but not 90 or 270 degree rotation. |
| 54 // Chroma is under sampled every 2 pixels for performance. | 55 // Chroma is under sampled every 2 pixels for performance. |
| 55 // This is the slowest of the scalers. | 56 // This is the slowest of the scalers. |
| 56 void ScaleYUVToRGB32Row(const uint8* y_buf, | 57 void ScaleYUVToRGB32Row(const uint8* y_buf, |
| 57 const uint8* u_buf, | 58 const uint8* u_buf, |
| 58 const uint8* v_buf, | 59 const uint8* v_buf, |
| 59 uint8* rgb_buf, | 60 uint8* rgb_buf, |
| 60 int width, | 61 int width, |
| 61 int scaled_dx); | 62 int scaled_dx); |
| 63 } // extern "C" |
| 62 | 64 |
| 63 // MMX for Windows; C++ for other platforms. | 65 #if !defined(USE_MMX) |
| 64 #ifndef USE_MMX | |
| 65 #if defined(_MSC_VER) | 66 #if defined(_MSC_VER) |
| 66 #define USE_MMX 1 | 67 #define USE_MMX 1 |
| 68 #elif defined(OS_LINUX) && !defined(ARCH_CPU_X86_64) |
| 69 #define USE_MMX 1 |
| 67 #else | 70 #else |
| 68 #define USE_MMX 0 | 71 #define USE_MMX 0 |
| 69 #endif | 72 #endif |
| 70 #endif | 73 #endif |
| 71 | 74 |
| 72 #if USE_MMX | 75 #if USE_MMX |
| 73 #if defined(_MSC_VER) | 76 #if defined(_MSC_VER) |
| 74 #define EMMS() __asm emms | 77 #define EMMS() __asm emms |
| 75 #else | 78 #else |
| 76 #define EMMS() asm("emms") | 79 #define EMMS() asm("emms") |
| 77 #endif | 80 #endif |
| 78 #else | 81 #else |
| 79 #define EMMS() | 82 #define EMMS() |
| 80 #endif | 83 #endif |
| 81 | 84 |
| 82 } // namespace media | |
| 83 | |
| 84 #endif // MEDIA_BASE_YUV_ROW_H_ | 85 #endif // MEDIA_BASE_YUV_ROW_H_ |
| 85 | 86 |
| OLD | NEW |