Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
YUVAPlanarConfig Class Reference

Public Member Functions

 YUVAPlanarConfig (YUVFormat format, bool opaque, SkEncodedOrigin origin)
 
int numPlanes () const
 
SkYUVAPixmaps makeYUVAPixmaps (SkISize dimensions, SkYUVColorSpace yuvColorSpace, const SkBitmap bitmaps[], int numBitmaps) const
 

Detailed Description

Definition at line 118 of file wacky_yuv_formats.cpp.

Constructor & Destructor Documentation

◆ YUVAPlanarConfig()

YUVAPlanarConfig::YUVAPlanarConfig ( YUVFormat  format,
bool  opaque,
SkEncodedOrigin  origin 
)
inline

Definition at line 120 of file wacky_yuv_formats.cpp.

120 : fOrigin(origin) {
121 switch (format) {
122 case kP016_YUVFormat:
123 case kP010_YUVFormat:
124 case kP016F_YUVFormat:
125 case kNV12_YUVFormat:
126 if (opaque) {
127 fPlaneConfig = SkYUVAInfo::PlaneConfig::kY_UV;
128 fSubsampling = SkYUVAInfo::Subsampling::k420;
129 } else {
131 fSubsampling = SkYUVAInfo::Subsampling::k420;
132 }
133 break;
134 case kY416_YUVFormat:
135 case kY410_YUVFormat:
136 if (opaque) {
137 fPlaneConfig = SkYUVAInfo::PlaneConfig::kUYV;
138 fSubsampling = SkYUVAInfo::Subsampling::k444;
139 } else {
140 fPlaneConfig = SkYUVAInfo::PlaneConfig::kUYVA;
141 fSubsampling = SkYUVAInfo::Subsampling::k444;
142 }
143 break;
144 case kAYUV_YUVFormat:
145 if (opaque) {
146 fPlaneConfig = SkYUVAInfo::PlaneConfig::kYUV;
147 fSubsampling = SkYUVAInfo::Subsampling::k444;
148 } else {
149 fPlaneConfig = SkYUVAInfo::PlaneConfig::kYUVA;
150 fSubsampling = SkYUVAInfo::Subsampling::k444;
151 }
152 break;
153 case kNV21_YUVFormat:
154 if (opaque) {
155 fPlaneConfig = SkYUVAInfo::PlaneConfig::kY_VU;
156 fSubsampling = SkYUVAInfo::Subsampling::k420;
157 } else {
159 fSubsampling = SkYUVAInfo::Subsampling::k420;
160 }
161 break;
162 case kI420_YUVFormat:
163 if (opaque) {
164 fPlaneConfig = SkYUVAInfo::PlaneConfig::kY_U_V;
165 fSubsampling = SkYUVAInfo::Subsampling::k420;
166 } else {
168 fSubsampling = SkYUVAInfo::Subsampling::k420;
169 }
170 break;
171 case kYV12_YUVFormat:
172 if (opaque) {
173 fPlaneConfig = SkYUVAInfo::PlaneConfig::kY_V_U;
174 fSubsampling = SkYUVAInfo::Subsampling::k420;
175 } else {
177 fSubsampling = SkYUVAInfo::Subsampling::k420;
178 }
179 break;
180 }
181 }
@ kY_U_V_A
Plane 0: Y, Plane 1: U, Plane 2: V, Plane 3: A.
@ kY_U_V
Plane 0: Y, Plane 1: U, Plane 2: V.
@ kYUVA
Plane 0: YUVA.
@ kY_V_U_A
Plane 0: Y, Plane 1: V, Plane 2: U, Plane 3: A.
@ kUYVA
Plane 0: UYVA.
@ kY_VU
Plane 0: Y, Plane 1: VU.
@ kY_UV
Plane 0: Y, Plane 1: UV.
@ kY_VU_A
Plane 0: Y, Plane 1: VU, Plane 2: A.
@ kY_V_U
Plane 0: Y, Plane 1: V, Plane 2: U.
@ kY_UV_A
Plane 0: Y, Plane 1: UV, Plane 2: A.
@ k420
1 set of UV values for each 2x2 block of Y values.
@ k444
No subsampling. UV values for each Y.
uint32_t uint32_t * format
@ kAYUV_YUVFormat
@ kNV21_YUVFormat
@ kNV12_YUVFormat
@ kP016F_YUVFormat
@ kP010_YUVFormat
@ kY410_YUVFormat
@ kI420_YUVFormat
@ kP016_YUVFormat
@ kYV12_YUVFormat
@ kY416_YUVFormat

Member Function Documentation

◆ makeYUVAPixmaps()

SkYUVAPixmaps YUVAPlanarConfig::makeYUVAPixmaps ( SkISize  dimensions,
SkYUVColorSpace  yuvColorSpace,
const SkBitmap  bitmaps[],
int  numBitmaps 
) const

Definition at line 196 of file wacky_yuv_formats.cpp.

199 {
200 SkYUVAInfo info(dimensions, fPlaneConfig, fSubsampling, yuvColorSpace, fOrigin);
202 int n = info.numPlanes();
203 if (numBitmaps < n) {
204 return {};
205 }
206 for (int i = 0; i < n; ++i) {
207 pmaps[i] = bitmaps[i].pixmap();
208 }
210}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
const SkPixmap & pixmap() const
Definition: SkBitmap.h:133
static constexpr int kMaxPlanes
Definition: SkYUVAInfo.h:98
static SkYUVAPixmaps FromExternalPixmaps(const SkYUVAInfo &, const SkPixmap[kMaxPlanes])

◆ numPlanes()

int YUVAPlanarConfig::numPlanes ( ) const
inline

Definition at line 183 of file wacky_yuv_formats.cpp.

183{ return SkYUVAInfo::NumPlanes(fPlaneConfig); }
static constexpr int NumPlanes(PlaneConfig)
Definition: SkYUVAInfo.h:253

The documentation for this class was generated from the following file: