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 #ifndef MEDIA_BASE_YUV_ROW_H_ | 8 #ifndef MEDIA_BASE_YUV_ROW_H_ |
9 #define MEDIA_BASE_YUV_ROW_H_ | 9 #define MEDIA_BASE_YUV_ROW_H_ |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 void ConvertYV12ToRGB32Row(const uint8* y_buf, | 15 // Can only do 1x. |
16 const uint8* u_buf, | 16 // This is the second fastest of the scalers. |
17 const uint8* v_buf, | 17 void FastConvertYUVToRGB32Row(const uint8* y_buf, |
18 uint8* rgb_buf, | 18 const uint8* u_buf, |
19 int width); | 19 const uint8* v_buf, |
| 20 uint8* rgb_buf, |
| 21 int width); |
20 | 22 |
21 void HalfYV12ToRGB32Row(const uint8* y_buf, | 23 // Can do 1x, half size or any scale down by an integer amount. |
| 24 // Step can be negative (mirroring, rotate 180). |
| 25 // This is the third fastest of the scalers. |
| 26 void ConvertYUVToRGB32Row(const uint8* y_buf, |
| 27 const uint8* u_buf, |
| 28 const uint8* v_buf, |
| 29 uint8* rgb_buf, |
| 30 int width, |
| 31 int step); |
| 32 |
| 33 // Rotate is like Convert, but applies different step to Y versus U and V. |
| 34 // This allows rotation by 90 or 270, by stepping by stride. |
| 35 // This is the forth fastest of the scalers. |
| 36 void RotateConvertYUVToRGB32Row(const uint8* y_buf, |
| 37 const uint8* u_buf, |
| 38 const uint8* v_buf, |
| 39 uint8* rgb_buf, |
| 40 int width, |
| 41 int ystep, |
| 42 int uvstep); |
| 43 |
| 44 // Doubler does 4 pixels at a time. Each pixel is replicated. |
| 45 // This is the fastest of the scalers. |
| 46 void DoubleYUVToRGB32Row(const uint8* y_buf, |
| 47 const uint8* u_buf, |
| 48 const uint8* v_buf, |
| 49 uint8* rgb_buf, |
| 50 int width); |
| 51 |
| 52 // Handles arbitrary scaling up or down. |
| 53 // Mirroring is supported, but not 90 or 270 degree rotation. |
| 54 // Chroma is under sampled every 2 pixels for performance. |
| 55 // This is the slowest of the scalers. |
| 56 void ScaleYUVToRGB32Row(const uint8* y_buf, |
22 const uint8* u_buf, | 57 const uint8* u_buf, |
23 const uint8* v_buf, | 58 const uint8* v_buf, |
24 uint8* rgb_buf, | 59 uint8* rgb_buf, |
25 int width); | 60 int width, |
| 61 int scaled_dx); |
26 | 62 |
27 void ScaleYV12ToRGB32Row(const uint8* y_buf, | 63 // MMX for Windows; C++ for other platforms. |
28 const uint8* u_buf, | |
29 const uint8* v_buf, | |
30 uint8* rgb_buf, | |
31 int width, | |
32 int scaled_dx); | |
33 | |
34 void Half2Row(const uint8* in_row0, | |
35 const uint8* in_row1, | |
36 uint8* out_row, | |
37 int out_width); | |
38 | |
39 // MMX for Windows | |
40 // C++ code provided as a fall back. | |
41 | |
42 #ifndef USE_MMX | 64 #ifndef USE_MMX |
43 #if defined(_MSC_VER) | 65 #if defined(_MSC_VER) |
44 #define USE_MMX 1 | 66 #define USE_MMX 1 |
45 #else | 67 #else |
46 #define USE_MMX 0 | 68 #define USE_MMX 0 |
47 #endif | 69 #endif |
48 #endif | 70 #endif |
49 | 71 |
50 #if USE_MMX | 72 #if USE_MMX |
51 #if defined(_MSC_VER) | 73 #if defined(_MSC_VER) |
52 #define EMMS() __asm emms | 74 #define EMMS() __asm emms |
53 #else | 75 #else |
54 #define EMMS() asm("emms") | 76 #define EMMS() asm("emms") |
55 #endif | 77 #endif |
56 #else | 78 #else |
57 #define EMMS() | 79 #define EMMS() |
58 #endif | 80 #endif |
59 | 81 |
60 } // namespace media | 82 } // namespace media |
61 | 83 |
62 #endif // MEDIA_BASE_YUV_ROW_H_ | 84 #endif // MEDIA_BASE_YUV_ROW_H_ |
63 | 85 |
OLD | NEW |