Contents

channelDescription(bufferType:)

Returns the range and clamp limits for a specified channel in a Core Video image format.

Declaration

func channelDescription(bufferType: vImage.BufferType) -> vImageChannelDescription?

Parameters

  • bufferType:

    The source buffer type.

Return Value

A vImageChannelDescription structure that describes the range and clamp limits for the specified channel.

Discussion

Use this function to return the vImageChannelDescription description for a specified channel in a Core Video format.

For example, the following code prints the description of each channel in a kCVPixelFormatType_420YpCbCr8Planar Core Video image format:

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

// Prints:
//    luminance   vImageChannelDescription(min: 0.0, zero: 16.0, full: 235.0, max: 255.0)
//    Cb          vImageChannelDescription(min: 0.0, zero: 128.0, full: 240.0, max: 255.0)
//    Cr          vImageChannelDescription(min: 0.0, zero: 128.0, full: 240.0, max: 255.0)
for channel in cvImageFormat.channels {
    let desc = cvImageFormat.channelDescription(bufferType: channel)!
    print("\(channel) \t\t \(desc)")
}

See Also

Related Documentation

Inspecting a Core Video image format’s properties