Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: media/base/yuv_row.h

Issue 7888012: Reorganize YUV scalers (Continued) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
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.
7
8 // TODO(fbarchard): Write function that can handle rotation and scaling.
9
10 #ifndef MEDIA_BASE_YUV_ROW_H_
11 #define MEDIA_BASE_YUV_ROW_H_
12
13 #include "base/basictypes.h"
14
15 extern "C" {
16 // Can only do 1x.
17 // This is the second fastest of the scalers.
18 void FastConvertYUVToRGB32Row(const uint8* y_buf,
19 const uint8* u_buf,
20 const uint8* v_buf,
21 uint8* rgb_buf,
22 int width);
23
24 // Can do 1x, half size or any scale down by an integer amount.
25 // Step can be negative (mirroring, rotate 180).
26 // This is the third fastest of the scalers.
27 void ConvertYUVToRGB32Row(const uint8* y_buf,
28 const uint8* u_buf,
29 const uint8* v_buf,
30 uint8* rgb_buf,
31 int width,
32 int step);
33
34 // Rotate is like Convert, but applies different step to Y versus U and V.
35 // This allows rotation by 90 or 270, by stepping by stride.
36 // This is the forth fastest of the scalers.
37 void RotateConvertYUVToRGB32Row(const uint8* y_buf,
38 const uint8* u_buf,
39 const uint8* v_buf,
40 uint8* rgb_buf,
41 int width,
42 int ystep,
43 int uvstep);
44
45 // Doubler does 4 pixels at a time. Each pixel is replicated.
46 // This is the fastest of the scalers.
47 void DoubleYUVToRGB32Row(const uint8* y_buf,
48 const uint8* u_buf,
49 const uint8* v_buf,
50 uint8* rgb_buf,
51 int width);
52
53 // Handles arbitrary scaling up or down.
54 // Mirroring is supported, but not 90 or 270 degree rotation.
55 // Chroma is under sampled every 2 pixels for performance.
56 void ScaleYUVToRGB32Row(const uint8* y_buf,
57 const uint8* u_buf,
58 const uint8* v_buf,
59 uint8* rgb_buf,
60 int width,
61 int source_dx);
62
63 // Handles arbitrary scaling up or down with bilinear filtering.
64 // Mirroring is supported, but not 90 or 270 degree rotation.
65 // Chroma is under sampled every 2 pixels for performance.
66 // This is the slowest of the scalers.
67 void LinearScaleYUVToRGB32Row(const uint8* y_buf,
68 const uint8* u_buf,
69 const uint8* v_buf,
70 uint8* rgb_buf,
71 int width,
72 int source_dx);
73
74 void FastConvertRGB32ToYUVRow(const uint8* rgb_buf_1,
75 const uint8* rgb_buf_2,
76 uint8* y_buf_1,
77 uint8* y_buf_2,
78 uint8* u_buf,
79 uint8* v_buf,
80 int width);
81
82 #if defined(_MSC_VER)
83 #define SIMD_ALIGNED(var) __declspec(align(16)) var
84 #else
85 #define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
86 #endif
87 extern SIMD_ALIGNED(int16 kCoefficientsRgbY[768][4]);
88
89 // Method to force C version.
90 //#define USE_MMX 0
91 //#define USE_SSE2 0
92
93 #if !defined(USE_MMX)
94 // Windows, Mac and Linux/BSD use MMX
95 #if defined(__MMX__) || defined(_MSC_VER)
96 #define USE_MMX 1
97 #else
98 #define USE_MMX 0
99 #endif
100 #endif
101
102 #if !defined(USE_SSE2)
103 #if defined(__SSE2__) || defined(ARCH_CPU_X86_64) || _M_IX86_FP==2
104 #define USE_SSE2 1
105 #else
106 #define USE_SSE2 0
107 #endif
108 #endif
109
110 // x64 uses MMX2 (SSE) so emms is not required.
111 // Warning C4799: function has no EMMS instruction.
112 // EMMS() is slow and should be called by the calling function once per image.
113 #if USE_MMX && !defined(ARCH_CPU_X86_64)
114 #if defined(_MSC_VER)
115 #define EMMS() __asm emms
116 #pragma warning(disable: 4799)
117 #else
118 #define EMMS() asm("emms")
119 #endif
120 #else
121 #define EMMS()
122 #endif
123
124 } // extern "C"
125
126 #endif // MEDIA_BASE_YUV_ROW_H_
OLDNEW
« no previous file with comments | « media/base/yuv_convert_unittest.cc ('k') | media/base/yuv_row_posix.cc » ('j') | media/media.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698