51 bool success = codec->queryYUVAInfo(kAllTypes,
nullptr);
54 success = codec->queryYUVAInfo(kNoTypes, &yuvaPixmapInfo);
57 success = codec->queryYUVAInfo(kAllTypes, &yuvaPixmapInfo);
64 int numPlanes = yuvaPixmapInfo.
numPlanes();
66 for (
int i = 0; i < numPlanes; ++i) {
110 codec_yuv(r,
"images/color_wheel.jpg", &expectations);
114 codec_yuv(r,
"images/mandrill_512_q075.jpg", &expectations);
118 codec_yuv(r,
"images/mandrill_h1v1.jpg", &expectations);
122 codec_yuv(r,
"images/mandrill_h2v1.jpg", &expectations);
126 codec_yuv(r,
"images/cropped_mandrill.jpg", &expectations);
129 codec_yuv(r,
"images/randPixels.jpg", &expectations);
133 codec_yuv(r,
"images/brickwork-texture.jpg", &expectations);
134 codec_yuv(r,
"images/brickwork_normal-map.jpg", &expectations);
137 codec_yuv(r,
"images/CMYK.jpg",
nullptr);
139 codec_yuv(r,
"images/grayscale.jpg",
nullptr);
141 codec_yuv(r,
"images/arrow.png",
nullptr);
162 for (
int plane = 0; plane <
a.numPlanes(); ++plane) {
166 const uint8_t* aData =
reinterpret_cast<const uint8_t*
>(aPlane.
addr());
167 const uint8_t* bData =
reinterpret_cast<const uint8_t*
>(bPlane.
addr());
168 for (
int row = 0; row < aPlane.
height(); ++row) {
170 int32_t aByte = aData[col];
171 int32_t bByte = bData[col];
182 const char* paths[] = {
183 "images/color_wheel.jpg",
184 "images/mandrill_512_q075.jpg",
185 "images/mandrill_h1v1.jpg",
186 "images/mandrill_h2v1.jpg",
187 "images/cropped_mandrill.jpg",
188 "images/randPixels.jpg",
190 for (
const auto* path : paths) {
223 const float tolerance = 1.0f/(1 << 18);
225 for (
auto cs : spaces) {
232 for (
int i = 0; i < 20; ++i) {
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
@ kUnknown_SkColorType
uninitialized
@ kTopLeft_SkEncodedOrigin
@ kBT2020_SkYUVColorSpace
@ kRec601_SkYUVColorSpace
@ kRec709_SkYUVColorSpace
@ kIdentity_SkYUVColorSpace
maps Y->R, U->G, V->B
@ kJPEG_Full_SkYUVColorSpace
describes full range
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
static constexpr bool SkToBool(const T &x)
#define DEF_TEST(name, reporter)
#define REPORTER_ASSERT(r, cond,...)
static void codec_yuv(skiatest::Reporter *reporter, const char path[], const SkYUVAInfo *expectedInfo)
static void verify_same(skiatest::Reporter *r, const SkYUVAPixmaps a, const SkYUVAPixmaps &b)
SkYUVAPixmaps decode_yuva(skiatest::Reporter *r, std::unique_ptr< SkStream > stream)
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)
static SkColorMatrix RGBtoYUV(SkYUVColorSpace)
void postConcat(const SkColorMatrix &mat)
static SkColorMatrix YUVtoRGB(SkYUVColorSpace)
void getRowMajor(float dst[20]) const
sk_sp< SkData > detachAsData()
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
const SkImageInfo & info() const
size_t computeByteSize() const
const void * addr() const
@ kY_U_V
Plane 0: Y, Plane 1: U, Plane 2: V.
static constexpr int kMaxPlanes
@ k420
1 set of UV values for each 2x2 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 constexpr SupportedDataTypes All()
size_t rowBytes(int i) const
const SkYUVAInfo & yuvaInfo() const
DataType dataType() const
static std::tuple< int, DataType > NumChannelsAndDataType(SkColorType)
const SkImageInfo & planeInfo(int i) const
static SkYUVAPixmaps Allocate(const SkYUVAPixmapInfo &yuvaPixmapInfo)
static constexpr auto kMaxPlanes
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
int bytesPerPixel() const
SkISize dimensions() const
SkColorType colorType() const
bool validRowBytes(size_t rowBytes) const