Bug 1883287 - Don't wait for the hidden window to be created on Linux to load the...
[gecko.git] / gfx / ycbcr / yuv_convert.h
blob336889081927cba3e4ef77890d19f37cf249a010
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.
5 // clang-format off
7 #ifndef MEDIA_BASE_YUV_CONVERT_H_
8 #define MEDIA_BASE_YUV_CONVERT_H_
10 #include "chromium_types.h"
11 #include "mozilla/gfx/Types.h"
13 namespace mozilla {
15 namespace gfx {
17 // Type of YUV surface.
18 // The value of these enums matter as they are used to shift vertical indices.
19 enum YUVType {
20 YV12 = 0, // YV12 is half width and half height chroma channels.
21 YV16 = 1, // YV16 is half width and full height chroma channels.
22 YV24 = 2, // YV24 is full width and full height chroma channels.
23 Y8 = 3 // Y8 is monochrome: no chroma channels.
26 // Mirror means flip the image horizontally, as in looking in a mirror.
27 // Rotate happens after mirroring.
28 enum Rotate {
29 ROTATE_0, // Rotation off.
30 ROTATE_90, // Rotate clockwise.
31 ROTATE_180, // Rotate upside down.
32 ROTATE_270, // Rotate counter clockwise.
33 MIRROR_ROTATE_0, // Mirror horizontally.
34 MIRROR_ROTATE_90, // Mirror then Rotate clockwise.
35 MIRROR_ROTATE_180, // Mirror vertically.
36 MIRROR_ROTATE_270 // Transpose.
39 // Filter affects how scaling looks.
40 enum ScaleFilter {
41 FILTER_NONE = 0, // No filter (point sampled).
42 FILTER_BILINEAR_H = 1, // Bilinear horizontal filter.
43 FILTER_BILINEAR_V = 2, // Bilinear vertical filter.
44 FILTER_BILINEAR = 3 // Bilinear filter.
47 // Convert a frame of YUV to 32 bit ARGB.
48 // Pass in YV16/YV12 depending on source format
49 void ConvertYCbCrToRGB32(const uint8_t* yplane,
50 const uint8_t* uplane,
51 const uint8_t* vplane,
52 uint8_t* rgbframe,
53 int pic_x,
54 int pic_y,
55 int pic_width,
56 int pic_height,
57 int ystride,
58 int uvstride,
59 int rgbstride,
60 YUVType yuv_type,
61 YUVColorSpace yuv_color_space,
62 ColorRange color_range);
64 void ConvertYCbCrToRGB32_deprecated(const uint8_t* yplane,
65 const uint8_t* uplane,
66 const uint8_t* vplane,
67 uint8_t* rgbframe,
68 int pic_x,
69 int pic_y,
70 int pic_width,
71 int pic_height,
72 int ystride,
73 int uvstride,
74 int rgbstride,
75 YUVType yuv_type);
77 // Scale a frame of YUV to 32 bit ARGB.
78 // Supports rotation and mirroring.
79 void ScaleYCbCrToRGB32(const uint8_t* yplane,
80 const uint8_t* uplane,
81 const uint8_t* vplane,
82 uint8_t* rgbframe,
83 int source_width,
84 int source_height,
85 int width,
86 int height,
87 int ystride,
88 int uvstride,
89 int rgbstride,
90 YUVType yuv_type,
91 YUVColorSpace yuv_color_space,
92 ScaleFilter filter);
94 void ScaleYCbCrToRGB32_deprecated(const uint8_t* yplane,
95 const uint8_t* uplane,
96 const uint8_t* vplane,
97 uint8_t* rgbframe,
98 int source_width,
99 int source_height,
100 int width,
101 int height,
102 int ystride,
103 int uvstride,
104 int rgbstride,
105 YUVType yuv_type,
106 Rotate view_rotate,
107 ScaleFilter filter);
109 void ConvertI420AlphaToARGB32(const uint8_t* yplane,
110 const uint8_t* uplane,
111 const uint8_t* vplane,
112 const uint8_t* aplane,
113 uint8_t* argbframe,
114 int pic_width,
115 int pic_height,
116 int yastride,
117 int uvstride,
118 int argbstride);
120 } // namespace gfx
121 } // namespace mozilla
123 #endif // MEDIA_BASE_YUV_CONVERT_H_