Contents

formatCode

The four-character code that encodes the pixel format of the Core Video image format.

Declaration

var formatCode: UInt32 { get }

Discussion

For example, the following code prints the format code of a kCVPixelFormatType_420YpCbCr8Planar Core Video image format that equals the expected type:

let cvImageFormat = vImageCVImageFormat.make(
    format: .format420YpCbCr8Planar,
    matrix: kvImage_ARGBToYpCbCrMatrix_ITU_R_709_2.pointee,
    chromaSiting: .center,
    colorSpace: CGColorSpace(name: CGColorSpace.sRGB)!,
    alphaIsOpaqueHint: true)!

// Prints "true".
print(cvImageFormat.formatCode == kCVPixelFormatType_420YpCbCr8Planar)

See Also

Related Documentation

Inspecting a Core Video image format’s properties