50 bool isSubsampledPlane =
false;
58 isSubsampledPlane = planeIdx == 1 || planeIdx == 2;
65 isSubsampledPlane = planeIdx == 1;
87 int w = imageDimensions.
width();
88 int h = imageDimensions.
height();
93 auto down2 = [](
int x) {
return (
x + 1)/2; };
94 auto down4 = [](
int x) {
return (
x + 3)/4; };
147 switch (channelFlags) {
150 if (channelIdx == 0) {
156 switch (channelIdx) {
160 default:
return false;
163 if (channelIdx == 0) {
169 if (channelIdx == 0 || channelIdx == 1) {
175 if (channelIdx >= 0 && channelIdx <= 2) {
181 if (channelIdx >= 0 && channelIdx <= 3) {
192 const uint32_t* planeChannelFlags) {
196 struct PlaneAndIndex {
int plane, chanIdx;};
197 const PlaneAndIndex* planesAndIndices =
nullptr;
203 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {1, 0}, {2, 0}, {-1, -1}};
204 planesAndIndices = kPlanesAndIndices;
208 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {2, 0}, {1, 0}, {-1, -1}};
209 planesAndIndices = kPlanesAndIndices;
213 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {1, 0}, {1, 1}, {-1, -1}};
214 planesAndIndices = kPlanesAndIndices;
218 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {1, 1}, {1, 0}, {-1, -1}};
219 planesAndIndices = kPlanesAndIndices;
223 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {0, 1}, {0, 2}, {-1, -1}};
224 planesAndIndices = kPlanesAndIndices;
228 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 1}, {0, 0}, {0, 2}, {-1, -1}};
229 planesAndIndices = kPlanesAndIndices;
233 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {1, 0}, {2, 0}, {3, 0}};
234 planesAndIndices = kPlanesAndIndices;
238 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {2, 0}, {1, 0}, {3, 0}};
239 planesAndIndices = kPlanesAndIndices;
243 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {1, 0}, {1, 1}, {2, 0}};
244 planesAndIndices = kPlanesAndIndices;
248 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {1, 1}, {1, 0}, {2, 0}};
249 planesAndIndices = kPlanesAndIndices;
253 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 0}, {0, 1}, {0, 2}, {0, 3}};
254 planesAndIndices = kPlanesAndIndices;
258 static constexpr PlaneAndIndex kPlanesAndIndices[] = {{0, 1}, {0, 0}, {0, 2}, {0, 3}};
259 planesAndIndices = kPlanesAndIndices;
266 auto [plane, chanIdx] = planesAndIndices[
i];
272 yuvaLocations[
i] = {plane, channel};
278 return yuvaLocations;
309 : fDimensions(dimensions)
310 , fPlaneConfig(planeConfig)
311 , fSubsampling(subsampling)
312 , fYUVColorSpace(yuvColorSpace)
315 , fSitingY(sitingY) {
326 size_t planeSizes[kMaxPlanes])
const {
331 size_t totalBytes = 0;
334 for (
int i = 0;
i < n; ++
i) {
339 planeSizes[
i] =
size;
341 totalBytes = safe.
add(totalBytes,
size);
350 planeSizes[
i] = SIZE_MAX;
355 return safe.
ok() ? totalBytes : SIZE_MAX;
363 return {fDimensions, fPlaneConfig,
subsampling, fYUVColorSpace, fOrigin, fSitingX, fSitingY};
367 return {
dimensions, fPlaneConfig, fSubsampling, fYUVColorSpace, fOrigin, fSitingX, fSitingY};
371 return fPlaneConfig == that.fPlaneConfig &&
372 fSubsampling == that.fSubsampling &&
373 fYUVColorSpace == that.fYUVColorSpace &&
374 fDimensions == that.fDimensions &&
375 fSitingX == that.fSitingX &&
376 fSitingY == that.fSitingY &&
377 fOrigin == that.fOrigin;
@ kRGB_SkColorChannelFlags
@ kRGBA_SkColorChannelFlags
@ kRed_SkColorChannelFlag
@ kGrayAlpha_SkColorChannelFlags
@ kRG_SkColorChannelFlags
@ kAlpha_SkColorChannelFlag
@ kGray_SkColorChannelFlag
@ kLeftTop_SkEncodedOrigin
void swap(sk_sp< T > &a, sk_sp< T > &b)
static bool channel_index_to_channel(uint32_t channelFlags, int channelIdx, SkColorChannel *channel)
static bool is_plane_config_compatible_with_subsampling(SkYUVAInfo::PlaneConfig config, SkYUVAInfo::Subsampling subsampling)
size_t add(size_t x, size_t y)
size_t mul(size_t x, size_t y)
@ 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.
@ kY_V_U_A
Plane 0: Y, Plane 1: V, Plane 2: U, Plane 3: A.
@ 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.
static constexpr int kMaxPlanes
@ k440
1 set of UV values for each 1x2 block of Y values.
@ k420
1 set of UV values for each 2x2 block of Y values.
@ k410
1 set of UV values for each 4x2 block of Y values.
@ k411
1 set of UV values for each 4x1 block of Y values.
@ k422
1 set of UV values for each 2x1 block of Y values.
@ k444
No subsampling. UV values for each Y.
static YUVALocations GetYUVALocations(PlaneConfig, const uint32_t *planeChannelFlags)
size_t computeTotalBytes(const size_t rowBytes[kMaxPlanes], size_t planeSizes[kMaxPlanes]=nullptr) const
SkYUVAInfo makeDimensions(SkISize) const
YUVALocations toYUVALocations(const uint32_t *channelFlags) const
static constexpr int NumPlanes(PlaneConfig)
SkYUVAInfo makeSubsampling(SkYUVAInfo::Subsampling) const
PlaneConfig planeConfig() const
int planeDimensions(SkISize planeDimensions[kMaxPlanes]) const
static std::tuple< int, int > SubsamplingFactors(Subsampling)
std::array< YUVALocation, kYUVAChannelCount > YUVALocations
static int PlaneDimensions(SkISize imageDimensions, PlaneConfig, Subsampling, SkEncodedOrigin, SkISize planeDimensions[kMaxPlanes])
SkEncodedOrigin origin() const
static constexpr int kYUVAChannelCount
static bool HasAlpha(PlaneConfig)
static std::tuple< int, int > PlaneSubsamplingFactors(PlaneConfig, Subsampling, int planeIdx)
Subsampling subsampling() const
SkISize dimensions() const
bool operator==(const SkYUVAInfo &that) const
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
constexpr int32_t width() const
constexpr int32_t height() const