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

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

Issue 2694113002: Delete media/base/yuv_convert and dependents. Prefer libyuv. (Closed)
Patch Set: Fix media_unittests. Created 3 years, 10 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
« no previous file with comments | « media/base/video_util.cc ('k') | media/base/yuv_convert.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #ifndef MEDIA_BASE_YUV_CONVERT_H_
6 #define MEDIA_BASE_YUV_CONVERT_H_
7
8 #include <stdint.h>
9
10 #include "build/build_config.h"
11 #include "media/base/media_export.h"
12
13 // Visual Studio 2010 does not support MMX intrinsics on x64.
14 // Some win64 yuv_convert code paths use SSE+MMX yasm, so without rewriting
15 // them, we use yasm EmptyRegisterState_MMX in place of _mm_empty() or
16 // hide the versions implemented with heavy use of MMX intrinsics.
17 // TODO(wolenetz): Use MMX intrinsics when compiling win64 with Visual
18 // Studio 2012? http://crbug.com/173450
19 #if defined(ARCH_CPU_X86_FAMILY) && \
20 !(defined(ARCH_CPU_X86_64) && defined(COMPILER_MSVC))
21 #define MEDIA_MMX_INTRINSICS_AVAILABLE
22 #endif
23
24 namespace media {
25
26 // Type of YUV surface.
27 enum YUVType {
28 YV16 = 0, // YV16 is half width and full height chroma channels.
29 YV12 = 1, // YV12 is half width and half height chroma channels.
30 YV12J = 2, // YV12J is the same as YV12, but in JPEG color range.
31 YV12HD = 3, // YV12HD is the same as YV12, but in 'HD' Rec709 color space.
32 };
33
34 // Get the appropriate value to bitshift by for vertical indices.
35 MEDIA_EXPORT int GetVerticalShift(YUVType type);
36
37 // Get the appropriate lookup table for a given YUV format.
38 MEDIA_EXPORT const int16_t* GetLookupTable(YUVType type);
39
40 // Mirror means flip the image horizontally, as in looking in a mirror.
41 // Rotate happens after mirroring.
42 enum Rotate {
43 ROTATE_0, // Rotation off.
44 ROTATE_90, // Rotate clockwise.
45 ROTATE_180, // Rotate upside down.
46 ROTATE_270, // Rotate counter clockwise.
47 MIRROR_ROTATE_0, // Mirror horizontally.
48 MIRROR_ROTATE_90, // Mirror then Rotate clockwise.
49 MIRROR_ROTATE_180, // Mirror vertically.
50 MIRROR_ROTATE_270, // Transpose.
51 };
52
53 // Filter affects how scaling looks.
54 enum ScaleFilter {
55 FILTER_NONE = 0, // No filter (point sampled).
56 FILTER_BILINEAR_H = 1, // Bilinear horizontal filter.
57 FILTER_BILINEAR_V = 2, // Bilinear vertical filter.
58 FILTER_BILINEAR = 3, // Bilinear filter.
59 };
60
61 MEDIA_EXPORT void InitializeCPUSpecificYUVConversions();
62
63 // Convert a frame of YUV to 32 bit ARGB.
64 // Pass in YV16/YV12 depending on source format
65 MEDIA_EXPORT void ConvertYUVToRGB32(const uint8_t* yplane,
66 const uint8_t* uplane,
67 const uint8_t* vplane,
68 uint8_t* rgbframe,
69 int width,
70 int height,
71 int ystride,
72 int uvstride,
73 int rgbstride,
74 YUVType yuv_type);
75
76 // Convert a frame of YUVA to 32 bit ARGB.
77 // Pass in YV12A
78 MEDIA_EXPORT void ConvertYUVAToARGB(const uint8_t* yplane,
79 const uint8_t* uplane,
80 const uint8_t* vplane,
81 const uint8_t* aplane,
82 uint8_t* rgbframe,
83 int width,
84 int height,
85 int ystride,
86 int uvstride,
87 int astride,
88 int rgbstride,
89 YUVType yuv_type);
90
91 // Scale a frame of YUV to 32 bit ARGB.
92 // Supports rotation and mirroring.
93 MEDIA_EXPORT void ScaleYUVToRGB32(const uint8_t* yplane,
94 const uint8_t* uplane,
95 const uint8_t* vplane,
96 uint8_t* rgbframe,
97 int source_width,
98 int source_height,
99 int width,
100 int height,
101 int ystride,
102 int uvstride,
103 int rgbstride,
104 YUVType yuv_type,
105 Rotate view_rotate,
106 ScaleFilter filter);
107
108 // Biliner Scale a frame of YV12 to 32 bits ARGB on a specified rectangle.
109 // |yplane|, etc and |rgbframe| should point to the top-left pixels of the
110 // source and destination buffers.
111 MEDIA_EXPORT void ScaleYUVToRGB32WithRect(const uint8_t* yplane,
112 const uint8_t* uplane,
113 const uint8_t* vplane,
114 uint8_t* rgbframe,
115 int source_width,
116 int source_height,
117 int dest_width,
118 int dest_height,
119 int dest_rect_left,
120 int dest_rect_top,
121 int dest_rect_right,
122 int dest_rect_bottom,
123 int ystride,
124 int uvstride,
125 int rgbstride);
126
127 MEDIA_EXPORT void ConvertRGB32ToYUV(const uint8_t* rgbframe,
128 uint8_t* yplane,
129 uint8_t* uplane,
130 uint8_t* vplane,
131 int width,
132 int height,
133 int rgbstride,
134 int ystride,
135 int uvstride);
136
137 MEDIA_EXPORT void ConvertRGB24ToYUV(const uint8_t* rgbframe,
138 uint8_t* yplane,
139 uint8_t* uplane,
140 uint8_t* vplane,
141 int width,
142 int height,
143 int rgbstride,
144 int ystride,
145 int uvstride);
146
147 // Empty SIMD register state after calling optimized scaler functions.
148 MEDIA_EXPORT void EmptyRegisterState();
149
150 } // namespace media
151
152 #endif // MEDIA_BASE_YUV_CONVERT_H_
OLDNEW
« no previous file with comments | « media/base/video_util.cc ('k') | media/base/yuv_convert.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698