 |
Skia
2D Graphics Library
|
Go to the documentation of this file.
8 #ifndef SkYUVAInfo_DEFINED
9 #define SkYUVAInfo_DEFINED
11 #include "include/codec/SkEncodedOrigin.h"
25 static constexpr
int kYUVAChannelCount =
static_cast<int>(YUVAChannels::kLast + 1);
94 static constexpr
int kMaxPlanes = 4;
118 SkISize planeDimensions[kMaxPlanes]);
127 static constexpr
int NumChannelsInPlane(
PlaneConfig,
int i);
150 SkEncodedOrigin origin = kTopLeft_SkEncodedOrigin,
151 Siting sitingX = Siting::kCentered,
152 Siting sitingY = Siting::kCentered);
160 return PlaneSubsamplingFactors(fPlaneConfig, fSubsampling, planeIdx);
168 int width()
const {
return fDimensions.width(); }
169 int height()
const {
return fDimensions.height(); }
175 SkEncodedOrigin
origin()
const {
return fOrigin; }
178 return SkEncodedOriginToMatrix(fOrigin, this->width(), this->height());
181 bool hasAlpha()
const {
return HasAlpha(fPlaneConfig); }
189 return PlaneDimensions(fDimensions, fPlaneConfig, fSubsampling, fOrigin, planeDimensions);
198 size_t planeSizes[kMaxPlanes] =
nullptr)
const;
200 int numPlanes()
const {
return NumPlanes(fPlaneConfig); }
229 bool isValid()
const {
return fPlaneConfig != PlaneConfig::kUnknown; }
234 PlaneConfig fPlaneConfig = PlaneConfig::kUnknown;
235 Subsampling fSubsampling = Subsampling::kUnknown;
243 SkEncodedOrigin fOrigin = kTopLeft_SkEncodedOrigin;
245 Siting fSitingX = Siting::kCentered;
246 Siting fSitingY = Siting::kCentered;
275 return i >= 0 && i < 3 ? 1 : 0;
285 return i == 0 ? 3 : 0;
288 return i >= 0 && i < 4 ? 1 : 0;
299 return i == 0 ? 4 : 0;
static constexpr int NumPlanes(PlaneConfig)
Number of planes for a given PlaneConfig.
Definition: SkYUVAInfo.h:249
SkISize dimensions() const
Dimensions of the full resolution image (after planes have been oriented to how the image is displaye...
Definition: SkYUVAInfo.h:167
SkYUVColorSpace yuvColorSpace() const
Definition: SkYUVAInfo.h:171
SkYUVColorSpace
Definition: SkImageInfo.h:148
int width() const
Definition: SkYUVAInfo.h:168
std::tuple< int, int > planeSubsamplingFactors(int planeIdx) const
Definition: SkYUVAInfo.h:159
SkEncodedOrigin origin() const
Definition: SkYUVAInfo.h:175
SkYUVAInfo makeDimensions(SkISize) const
Makes a SkYUVAInfo that is identical to this one but with the passed dimensions.
PlaneConfig planeConfig() const
Definition: SkYUVAInfo.h:156
SkYUVAInfo(SkISize dimensions, PlaneConfig, Subsampling, SkYUVColorSpace, SkEncodedOrigin origin=kTopLeft_SkEncodedOrigin, Siting sitingX=Siting::kCentered, Siting sitingY=Siting::kCentered)
'dimensions' should specify the size of the full resolution image (after planes have been oriented to...
static std::tuple< int, int > SubsamplingFactors(Subsampling)
ratio of Y/A values to U/V values in x and y.
Siting sitingX() const
Definition: SkYUVAInfo.h:172
static YUVALocations GetYUVALocations(PlaneConfig, const uint32_t *planeChannelFlags)
Given a PlaneConfig and a set of channel flags for each plane, convert to YUVALocations representatio...
YUVAChannels
Definition: SkYUVAInfo.h:24
static bool HasAlpha(PlaneConfig)
Does the PlaneConfig have alpha values?
@ kY_UV_A
Plane 0: Y, Plane 1: UV, Plane 2: A.
@ kY_V_U
Plane 0: Y, Plane 1: V, Plane 2: U.
Subsampling
UV subsampling is also specified in the enum value names using J:a:b notation (e.g.
Definition: SkYUVAInfo.h:69
size_t computeTotalBytes(const size_t rowBytes[kMaxPlanes], size_t planeSizes[kMaxPlanes]=nullptr) const
Given a per-plane row bytes, determine size to allocate for all planes.
#define SK_API
Definition: SkTypes.h:181
int height() const
Definition: SkYUVAInfo.h:169
YUVALocations toYUVALocations(const uint32_t *channelFlags) const
Given a set of channel flags for each plane, converts this->planeConfig() to YUVALocations representa...
static std::tuple< int, int > PlaneSubsamplingFactors(PlaneConfig, Subsampling, int planeIdx)
SubsamplingFactors(Subsampling) if planedIdx refers to a U/V plane and otherwise {1,...
int planeDimensions(SkISize planeDimensions[kMaxPlanes]) const
Returns the number of planes and initializes planeDimensions[0]..planeDimensions[<ret>] to the expect...
Definition: SkYUVAInfo.h:188
static constexpr int NumChannelsInPlane(PlaneConfig, int i)
Number of Y, U, V, A channels in the ith plane for a given PlaneConfig (or 0 if i is invalid).
Definition: SkYUVAInfo.h:268
bool isValid() const
Definition: SkYUVAInfo.h:229
@ kY_VU_A
Plane 0: Y, Plane 1: VU, Plane 2: A.
Siting sitingY() const
Definition: SkYUVAInfo.h:173
SkMatrix originMatrix() const
Definition: SkYUVAInfo.h:177
bool operator==(const SkYUVAInfo &that) const
std::array< YUVALocation, kYUVAChannelCount > YUVALocations
Definition: SkYUVAInfo.h:28
int numChannelsInPlane(int i) const
Definition: SkYUVAInfo.h:202
#define SkUNREACHABLE
Definition: SkTypes.h:256
SkYUVAInfo makeSubsampling(SkYUVAInfo::Subsampling) const
Makes a SkYUVAInfo that is identical to this one but with the passed Subsampling.
Definition: SkMatrix.h:48
Specifies the structure of planes for a YUV image with optional alpha.
Definition: SkYUVAInfo.h:22
bool hasAlpha() const
Definition: SkYUVAInfo.h:181
int numPlanes() const
Definition: SkYUVAInfo.h:200
@ kY_UV
Plane 0: Y, Plane 1: UV.
static int PlaneDimensions(SkISize imageDimensions, PlaneConfig, Subsampling, SkEncodedOrigin, SkISize planeDimensions[kMaxPlanes])
Given image dimensions, a planer configuration, subsampling, and origin, determine the expected size ...
@ kIdentity_SkYUVColorSpace
maps Y->R, U->G, V->B
Definition: SkImageInfo.h:159
bool operator!=(const SkYUVAInfo &that) const
Definition: SkYUVAInfo.h:227
PlaneConfig
Specifies how YUV (and optionally A) are divided among planes.
Definition: SkYUVAInfo.h:43
SkYUVAInfo & operator=(const SkYUVAInfo &that)=default
Siting
Describes how subsampled chroma values are sited relative to luma values.
Definition: SkYUVAInfo.h:87
Subsampling subsampling() const
Definition: SkYUVAInfo.h:157
@ kY_V_U_A
Plane 0: Y, Plane 1: V, Plane 2: U, Plane 3: A.
SkYUVAInfo(const SkYUVAInfo &)=default
@ kY_U_V_A
Plane 0: Y, Plane 1: U, Plane 2: V, Plane 3: A.
@ kY_VU
Plane 0: Y, Plane 1: VU.
@ kY_U_V
Plane 0: Y, Plane 1: U, Plane 2: V.