Flutter Engine
The Flutter Engine
Functions
SkYUVMath.h File Reference

Go to the source code of this file.

Functions

void SkColorMatrix_RGB2YUV (SkYUVColorSpace, float m[20])
 
void SkColorMatrix_YUV2RGB (SkYUVColorSpace, float m[20])
 
void SkColorMatrix_DumpYUVMatrixTables ()
 

Function Documentation

◆ SkColorMatrix_DumpYUVMatrixTables()

void SkColorMatrix_DumpYUVMatrixTables ( )

Definition at line 672 of file SkYUVMath.cpp.

672 {
673 for (int i = 0; i < kLastEnum_SkYUVColorSpace; ++i) {
674 SkYUVColorSpace cs = static_cast<SkYUVColorSpace>(i);
675 float m[20];
677 dump(m, cs, true);
678 SkM44 m44, im44;
680 float im[20];
681#ifdef SK_DEBUG
682 // be sure our coversion between matrix44 and colormatrix is perfect
684 SkASSERT(memcmp(m, im, sizeof(im)) == 0);
685#endif
686 SkAssertResult(m44.invert(&im44));
687 matrix44_to_colormatrix(im44, im);
688 dump(im, cs, false);
689 }
690}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkYUVColorSpace
Definition: SkImageInfo.h:68
@ kLastEnum_SkYUVColorSpace
last valid value
Definition: SkImageInfo.h:95
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
Definition: SkYUVMath.cpp:629
static void make_rgb_to_yuv_matrix(float mx[20], SkYUVColorSpace cs)
Definition: SkYUVMath.cpp:588
static void matrix44_to_colormatrix(const SkM44 &src, float dst[20])
Definition: SkYUVMath.cpp:423
static void colormatrix_to_matrix44(const float src[20], SkM44 *dst)
Definition: SkYUVMath.cpp:414
Definition: SkM44.h:150
bool invert(SkM44 *inverse) const
Definition: SkM44.cpp:247

◆ SkColorMatrix_RGB2YUV()

void SkColorMatrix_RGB2YUV ( SkYUVColorSpace  cs,
float  m[20] 
)

Definition at line 389 of file SkYUVMath.cpp.

389 {
390 if ((unsigned)cs < (unsigned)kIdentity_SkYUVColorSpace) {
391 memcpy(m, rgb_to_yuv_array[(unsigned)cs], kSizeOfColorMatrix);
392 } else {
393 memset(m, 0, kSizeOfColorMatrix);
394 m[0] = m[6] = m[12] = m[18] = 1;
395 }
396}
@ kIdentity_SkYUVColorSpace
maps Y->R, U->G, V->B
Definition: SkImageInfo.h:93
constexpr size_t kSizeOfColorMatrix
Definition: SkYUVMath.cpp:387
const float * rgb_to_yuv_array[]
Definition: SkYUVMath.cpp:360

◆ SkColorMatrix_YUV2RGB()

void SkColorMatrix_YUV2RGB ( SkYUVColorSpace  cs,
float  m[20] 
)

Definition at line 398 of file SkYUVMath.cpp.

398 {
399 if ((unsigned)cs < (unsigned)kIdentity_SkYUVColorSpace) {
400 memcpy(m, yuv_to_rgb_array[(unsigned)cs], kSizeOfColorMatrix);
401 } else {
402 memset(m, 0, kSizeOfColorMatrix);
403 m[0] = m[6] = m[12] = m[18] = 1;
404 }
405}
const float * yuv_to_rgb_array[]
Definition: SkYUVMath.cpp:333