Bug 1468361 [wpt PR 11478] - Add test run time to wptreport.json format, a=testonly
[gecko.git] / gfx / ycbcr / yuv_convert.h
blob22217b8774e3b2d99a3127cb63863704288fa070
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 #ifndef MEDIA_BASE_YUV_CONVERT_H_
6 #define MEDIA_BASE_YUV_CONVERT_H_
8 #include "chromium_types.h"
9 #include "ImageTypes.h"
11 namespace mozilla {
13 namespace gfx {
15 // Type of YUV surface.
16 // The value of these enums matter as they are used to shift vertical indices.
17 enum YUVType {
18 YV12 = 0, // YV12 is half width and half height chroma channels.
19 YV16 = 1, // YV16 is half width and full height chroma channels.
20 YV24 = 2 // YV24 is full width and full height chroma channels.
23 // Mirror means flip the image horizontally, as in looking in a mirror.
24 // Rotate happens after mirroring.
25 enum Rotate {
26 ROTATE_0, // Rotation off.
27 ROTATE_90, // Rotate clockwise.
28 ROTATE_180, // Rotate upside down.
29 ROTATE_270, // Rotate counter clockwise.
30 MIRROR_ROTATE_0, // Mirror horizontally.
31 MIRROR_ROTATE_90, // Mirror then Rotate clockwise.
32 MIRROR_ROTATE_180, // Mirror vertically.
33 MIRROR_ROTATE_270 // Transpose.
36 // Filter affects how scaling looks.
37 enum ScaleFilter {
38 FILTER_NONE = 0, // No filter (point sampled).
39 FILTER_BILINEAR_H = 1, // Bilinear horizontal filter.
40 FILTER_BILINEAR_V = 2, // Bilinear vertical filter.
41 FILTER_BILINEAR = 3 // Bilinear filter.
44 YUVType TypeFromSize(int ywidth, int yheight, int cbcrwidth, int cbcrheight);
46 // Convert a frame of YUV to 32 bit ARGB.
47 // Pass in YV16/YV12 depending on source format
48 void ConvertYCbCrToRGB32(const uint8* yplane,
49 const uint8* uplane,
50 const uint8* vplane,
51 uint8* rgbframe,
52 int pic_x,
53 int pic_y,
54 int pic_width,
55 int pic_height,
56 int ystride,
57 int uvstride,
58 int rgbstride,
59 YUVType yuv_type,
60 YUVColorSpace yuv_color_space);
62 void ConvertYCbCrToRGB32_deprecated(const uint8* yplane,
63 const uint8* uplane,
64 const uint8* vplane,
65 uint8* rgbframe,
66 int pic_x,
67 int pic_y,
68 int pic_width,
69 int pic_height,
70 int ystride,
71 int uvstride,
72 int rgbstride,
73 YUVType yuv_type);
75 // Scale a frame of YUV to 32 bit ARGB.
76 // Supports rotation and mirroring.
77 void ScaleYCbCrToRGB32(const uint8* yplane,
78 const uint8* uplane,
79 const uint8* vplane,
80 uint8* rgbframe,
81 int source_width,
82 int source_height,
83 int width,
84 int height,
85 int ystride,
86 int uvstride,
87 int rgbstride,
88 YUVType yuv_type,
89 YUVColorSpace yuv_color_space,
90 ScaleFilter filter);
92 void ScaleYCbCrToRGB32_deprecated(const uint8* yplane,
93 const uint8* uplane,
94 const uint8* vplane,
95 uint8* rgbframe,
96 int source_width,
97 int source_height,
98 int width,
99 int height,
100 int ystride,
101 int uvstride,
102 int rgbstride,
103 YUVType yuv_type,
104 Rotate view_rotate,
105 ScaleFilter filter);
107 void ConvertYCbCrAToARGB32(const uint8* yplane,
108 const uint8* uplane,
109 const uint8* vplane,
110 const uint8* aplane,
111 uint8* argbframe,
112 int pic_width,
113 int pic_height,
114 int yastride,
115 int uvstride,
116 int argbstride);
118 } // namespace gfx
119 } // namespace mozilla
121 #endif // MEDIA_BASE_YUV_CONVERT_H_