VPI - Vision Programming Interface

0.4.4 Release

Image formats

Utilities and definitions used when working with VPIImageFormat and VPIPixelFormat values. More...

Macros

#define VPI_MAKE_SWIZZLE(x, y, z, w)   ((VPISwizzle)VPI_DETAIL_MAKE_SWIZZLE(x, y, z, w))
 Creates an user-defined swizzle operation. More...
 
#define VPI_MAKE_IMAGE_FORMAT(colorSpace, chromaSubsamp, memLayout, dataType, swizzle, numPlanes, packing0, packing1, ...)
 Creates an user-defined image format constant using abbreviated parameters. More...
 
#define VPI_MAKE_PIXEL_FORMAT(memLayout, dataType, packing)
 Creates an user-defined pixel format constant using abbreviated parameters. More...
 

Enumerations

enum  VPIFormatPacking
 Defines how channels are packed into an image plane element. More...
 
enum  VPIFormatDataType
 Defines the channel data type. More...
 
enum  VPIMemLayout
 Defines how the 2D plane pixels are laid out in memory. More...
 
enum  VPISwizzleChannel
 Defines the format channel names. More...
 
enum  VPISwizzle
 Defines the supported channel swizzle operations. More...
 
enum  VPIColorModel
 Defines color models. More...
 
enum  VPIColorSpace
 Defines color spaces. More...
 
enum  VPIChromaSubsampling
 Defines how chroma-subsampling is done. More...
 
enum  VPIImageFormat
 Pre-defined image formats. More...
 
enum  VPIPixelFormat
 Pre-defined pixel formats. More...
 

Functions

VPISwizzle vpiMakeSwizzle (VPISwizzleChannel x, VPISwizzleChannel y, VPISwizzleChannel z, VPISwizzleChannel w)
 Creates an user-defined VPISwizzle operation. More...
 
VPIChromaSubsampling vpiMakeChromaSubsampling (int divHoriz, int divVert, int centerSampleHoriz, int centerSampleVert)
 Creates an user-defined VPIChromaSubsampling definition. More...
 
VPIFormatPacking vpiMakeFormatPacking (int fixed, int bitsX, int bitsY, int bitsZ, int bitsW)
 Returns a pre-defined VPIFormatPacking given the number of bits in each channel. More...
 
void vpiFormatPackingGetParams (VPIFormatPacking packing, int *fixed, int *bitsX, int *bitsY, int *bitsZ, int *bitsW)
 Returns channels' information from a format packing. More...
 
int vpiFormatPackingGetChannelCount (VPIFormatPacking packing)
 Returns the number of channels defined by the given packing. More...
 
int vpiFormatPackingGetBitsPerPixel (VPIFormatPacking packing)
 Returns the number of bits per pixel of the given packing. More...
 
VPIImageFormat vpiMakeImageFormat (VPIColorSpace colorSpace, VPIChromaSubsampling chromaSub, VPIMemLayout memLayout, VPIFormatDataType dataType, VPISwizzle swizzle, VPIFormatPacking packing0, VPIFormatPacking packing1, VPIFormatPacking packing2, VPIFormatPacking packing3)
 Creates an user-defined image format. More...
 
VPIFormatPacking vpiImageFormatGetPlanePacking (VPIImageFormat fmt, int plane)
 Get the packing for a given plane of an image format. More...
 
int vpiImageFormatGetPlaneBitsPerPixel (VPIImageFormat fmt, int plane)
 Get the image format's plane bits per pixel count. More...
 
VPIImageFormat vpiImageFormatSetDataType (VPIImageFormat fmt, VPIFormatDataType dataType)
 Set the image format's data type. More...
 
VPIFormatDataType vpiImageFormatGetDataType (VPIImageFormat fmt)
 Get the image format's data type. More...
 
VPISwizzle vpiImageFormatGetSwizzle (VPIImageFormat fmt)
 Get the image format's channel swizzle operation. More...
 
VPISwizzle vpiImageFormatGetPlaneSwizzle (VPIImageFormat fmt, int plane)
 Get the swizzle operation of the given image format's plane. More...
 
VPISwizzleChannel vpiImageFormatGetSwizzleX (VPIImageFormat fmt)
 Get the color model channel that corresponds to the first component of given image format. More...
 
VPISwizzleChannel vpiImageFormatGetSwizzleY (VPIImageFormat fmt)
 Get the color model channel that corresponds to the second component of given image format. More...
 
VPISwizzleChannel vpiImageFormatGetSwizzleZ (VPIImageFormat fmt)
 Get the color model channel that corresponds to the third component of given image format. More...
 
VPISwizzleChannel vpiImageFormatGetSwizzleW (VPIImageFormat fmt)
 Get the color model channel that corresponds to the fourth component of given image format. More...
 
VPIImageFormat vpiImageFormatSetMemLayout (VPIImageFormat fmt, VPIMemLayout memLayout)
 Set the image format's memory layout. More...
 
VPIMemLayout vpiImageFormatGetMemLayout (VPIImageFormat fmt)
 Get the image format's memory layout. More...
 
VPIImageFormat vpiImageFormatSetColorSpace (VPIImageFormat fmt, VPIColorSpace colorSpace)
 Set the image format's color space. More...
 
VPIColorSpace vpiImageFormatGetColorSpace (VPIImageFormat fmt)
 Get the image format's color space. More...
 
VPIColorModel vpiImageFormatGetColorModel (VPIImageFormat fmt)
 Get the image format's color model. More...
 
VPIImageFormat vpiImageFormatSetChromaSubsampling (VPIImageFormat fmt, VPIChromaSubsampling css)
 Set the image format's chroma subsampling type. More...
 
VPIChromaSubsampling vpiImageFormatGetChromaSubsampling (VPIImageFormat fmt)
 Get the image format's chroma subsampling type. More...
 
int vpiImageFormatGetChromaSubsamplingDivHoriz (VPIImageFormat fmt)
 Get the image format's chroma subsampling horizontal downscale factor. More...
 
int vpiImageFormatGetChromaSubsamplingDivVert (VPIImageFormat fmt)
 Get the image format's chroma subsampling vertical downscale factor. More...
 
int vpiImageFormatGetChromaSubsamplingCenterHoriz (VPIImageFormat fmt)
 Get the image format's chroma horizontal sample position. More...
 
int vpiImageFormatGetChromaSubsamplingCenterVert (VPIImageFormat fmt)
 Get the image format's chroma vertical sample position. More...
 
int vpiImageFormatGetPlaneChannelCount (VPIImageFormat fmt, int plane)
 Get the number of channels in a plane of an image format. More...
 
int vpiImageFormatGetPlaneCount (VPIImageFormat fmt)
 Get the number of planes of an image format. More...
 
int vpiImageFormatGetChannelCount (VPIImageFormat fmt)
 Get the total number of channels of an image format. More...
 
VPIPixelFormat vpiImageFormatGetPlanePixelFormat (VPIImageFormat fmt, int plane)
 Get the pixel format of image format's plane. More...
 
VPIImageFormat vpiImageFormatGetPlaneFormat (VPIImageFormat fmt, int plane)
 Get the plane format of an image format. More...
 
VPIImageFormat vpiMakeImageFormatFromPlanes (VPIImageFormat plane0, VPIImageFormat plane1, VPIImageFormat plane2, VPIImageFormat plane3)
 Constructs an image format given the format of each plane. More...
 
VPIPixelFormat vpiMakePixelFormat (VPIMemLayout memLayout, VPIFormatDataType dataType, VPIFormatPacking packing)
 Creates an user-defined pixel format. More...
 
VPIFormatPacking vpiPixelFormatGetPacking (VPIPixelFormat fmt)
 Get the packing of a pixel format. More...
 
int vpiPixelFormatGetBitsPerPixel (VPIPixelFormat fmt)
 Get the number of bits per pixel of a pixel format. More...
 
VPIFormatDataType vpiPixelFormatGetDataType (VPIPixelFormat fmt)
 Get the data type of a pixel format. More...
 
VPIMemLayout vpiPixelFormatGetMemLayout (VPIPixelFormat fmt)
 Get the memory layout of a pixel format. More...
 
int vpiPixelFormatGetChannelCount (VPIPixelFormat fmt)
 Get the number of channels of a pixel format. More...
 

Detailed Description

Utilities and definitions used when working with VPIImageFormat and VPIPixelFormat values.

Here the contituent parts of a VPIImageFormat and VPIPixelFormat are defined, along with functions to create and decompose them.

Macro Definition Documentation

◆ VPI_MAKE_IMAGE_FORMAT

#define VPI_MAKE_IMAGE_FORMAT (   colorSpace,
  chromaSubsamp,
  memLayout,
  dataType,
  swizzle,
  numPlanes,
  packing0,
  packing1,
  ... 
)

#include <vpi/ImageFormat.h>

Creates an user-defined image format constant using abbreviated parameters.

This macro allows passing abbreviated format parameters (without the parameter type prefix). Example to create a YUV422 ITU-R BT.709 block-linear format.

VPIImageFormat fmt = VPI_MAKE_IMAGE_FORMAT(YCbCr709, 422_COSITED, BL, UNSIGNED, XYZ0, 2, X8, X8_Y8);
Parameters
[in]colorSpaceVPIColorSpace to be used, without the VPI_COLOR_SPACE_ prefix.
[in]chromaSubsampVPIChromaSubsampling to be used, without the VPI_CHROMA_SUBSAMPLING_ prefix.
[in]memLayoutVPIMemLayout to be used, without the VPI_MEM_LAYOUT_ prefix.
[in]dataTypeVPIFormatDataType to be used, without the VPI_FORMAT_DATA_TYPE_ prefix.
[in]swizzleVPISwizzle operation to be performed on the channels, without the VPI_SWIZZLE_ prefix.
[in]numPlanesNumber of planes this format has.
[in]packing0,packing1,...Format packing of each plane, without the VPI_FORMAT_PACKING_ prefix.
Returns
The user-defined image format.

Definition at line 166 of file ImageFormat.h.

◆ VPI_MAKE_PIXEL_FORMAT

#define VPI_MAKE_PIXEL_FORMAT (   memLayout,
  dataType,
  packing 
)

#include <vpi/PixelFormat.h>

Creates an user-defined pixel format constant using abbreviated parameters.

This macro allows passing abbreviated format parameters (without the parameter type prefix). Example to create a block-linear format two interleaved 32-bit floating point channels:

VPIPixelFormat fmt = VPI_MAKE_PIXEL_FORMAT(BL, FLOAT, X32_Y32);
Parameters
[in]memLayoutVPIMemLayout to be used, without the VPI_MEM_LAYOUT_ prefix.
[in]dataTypeVPIFormatDataType to be used, without the VPI_FORMAT_DATA_TYPE_ prefix.
[in]packingFormat packing used, which also defines the number of channels, without the VPI_FORMAT_PACKING_ prefix.
Returns
The user-defined pixel format.

Definition at line 118 of file PixelFormat.h.

◆ VPI_MAKE_SWIZZLE

#define VPI_MAKE_SWIZZLE (   x,
  y,
  z,
 
)    ((VPISwizzle)VPI_DETAIL_MAKE_SWIZZLE(x, y, z, w))

#include <vpi/Format.h>

Creates an user-defined swizzle operation.

This macro is used to create an user-defined swizzle operation if it's not predefined xxx. Parameters are specified literally by X, Y, Z, 0, 1. They correpond to VPISwizzleChannel values. Example:

Parameters
[in]xChannel that will correspond to the first component.
[in]yChannel that will correspond to the second component.
[in]zChannel that will correspond to the third component.
[in]wChannel that will correspond to the component component.
Returns
the user-defined VPISwizzle operation.

Definition at line 334 of file Format.h.

Enumeration Type Documentation

◆ VPIChromaSubsampling

#include <vpi/Format.h>

Defines how chroma-subsampling is done.

This is only applicable to image formats whose color model is YUV. Other image formats must use VPI_CHROMA_SUBSAMPLING_NONE. Chroma subsampling is defined by 4 parameters:

  • Horizontal resolution relative to luma resolution.
  • Vertical resolution relative to luma resolution.
  • Horizontal sample position relative to current (x) and next (x+1) luma sample.
  • Vertical sample position relative to current (y) and next (y+1) luma sample.
Enumerator
VPI_CHROMA_SUBSAMPLING_444 

4:4:4 sub-sampling.

Chroma has full horizontal and vertical resolution, meaning no chroma subsampling.

VPI_CHROMA_SUBSAMPLING_422_BT601 

4:2:2 BT.601 sub-sampling.

Chroma has half horizontal and full vertical resolutions with chroma sample cosited with luma.

VPI_CHROMA_SUBSAMPLING_422_COSITED 

Alias to VPI_CHROMA_SUBSAMPLING_422_BT601.

VPI_CHROMA_SUBSAMPLING_420_COSITED 

4:2:0 sub-sampling.

Chroma has half horizontal and vertical resolutions with chroma sample cosited with luma.

VPI_CHROMA_SUBSAMPLING_420_MPEG1 

4:2:0 MPEG1 sub-sampling.

Chroma has half horizontal vertical resolutions with chroma sample centered horizontally and vertically.

VPI_CHROMA_SUBSAMPLING_420_MPEG2 

4:2:0 MPEG2 sub-sampling.

Chroma has half horizontal and vertical resolutions with chroma sample cosited horizontally and centered vertically.

VPI_CHROMA_SUBSAMPLING_NONE 

Used when no chroma subsampling takes place, specially for color spaces without chroma components.

Definition at line 459 of file Format.h.

◆ VPIColorModel

#include <vpi/Format.h>

Defines color models.

A color model gives meaning to each channel of an image format. They are specified in a canonical XYZW ordering that can then be swizzled to the desired ordering.

Enumerator
VPI_COLOR_MODEL_OTHER 

Other non-specified color model.

Canonical channel ordering can be inferred from the color space.

VPI_COLOR_MODEL_RGBA 

RGB + alpha color model.

VPI_COLOR_MODEL_YUV 

YUV color model.

VPI_COLOR_MODEL_RAW 

RAW color model, used for Bayer image formats.

Definition at line 340 of file Format.h.

◆ VPIColorSpace

#include <vpi/Format.h>

Defines color spaces.

Color space specifies how physical colors are organized in a particular representation. Each VPIColorSpace is associated with a VPIColorModel.

Enumerator
VPI_COLOR_SPACE_NONCOLOR 

Used in image formats that don't represent a color.

VPI_COLOR_SPACE_HSV 

Hue, saturation, value color space.

VPI_COLOR_SPACE_HSL 

Hue, saturation, lightness color space.

VPI_COLOR_SPACE_YIQ 

Luma and I/Q chrominance color space.

VPI_COLOR_SPACE_LAB 

CIE L*a*b* color space.

VPI_COLOR_SPACE_LUV 

CIE L*u*b* color space.

VPI_COLOR_SPACE_XYZ 

CIE XYZ tristimulus color space.

VPI_COLOR_SPACE_RGB 

RGBA color space.

Data in this color space is typically treated as linear, but in practice it contains gamma encoded data.

VPI_COLOR_SPACE_SensorRGB_LINEAR 

This color space is used to represent camera sensor data after debayering.

It isn't fully defined as specific characteristics of each camera sensor are needed to interpret the data. This is a linear color space, and should only be used with linear operations.

VPI_COLOR_SPACE_sRGB 

sRGB color space with linear alpha.

VPI_COLOR_SPACE_RGB709 

Non-linear RGB ITU-R BT.709 color space with linear alpha.

VPI_COLOR_SPACE_RGB709_LINEAR 

Linear RGBA color space with ITU-R BT.709/sRGB gamut.

VPI_COLOR_SPACE_DISPLAYP3_LINEAR 

Display-P3 color space (DCI-P3 primaries, linear encoding).

VPI_COLOR_SPACE_DISPLAYP3_NONLINEAR 

Display-P3 color space (DCI-P3 primaries, sRGB encoding).

VPI_COLOR_SPACE_RGB2020 

Non-linear RGB ITU-R BT.2020 color space with linear alpha.

VPI_COLOR_SPACE_RGB2020_LINEAR 

Linear RGBA color space with ITU-R BT.2020 gamut.

VPI_COLOR_SPACE_RGB2020_PQ 

Non-linear RGB color space encoded with SMPTE ST 2084 Perceptual Quantizer transfer function.

VPI_COLOR_SPACE_YCbCr601 

YCbCr ITU-R BT.601 color space with standard range luma (16-235)

VPI_COLOR_SPACE_YCbCr601_ER 

YCbCr ITU-R BT.601 color space with extended range luma (0-255)

VPI_COLOR_SPACE_YCbCr601_VC1 

YCbCr ITU-R BT.601 color space with range reduced YCbCr for VC1 decoded planes.

If picture layer of VC1 bit stream has RANGEREDFRM bit set, decoded YUV data has to be scaled up (range expanded). For this type of color space, clients should range expand the channels as follows:

\begin{align*} Y' &= \mathit{clip}(2(Y-128) + 128) \\ C_b' &= \mathit{clip}(2(C_b-128) + 128) \\ C_r' &= \mathit{clip}(2(C_r-128) + 128) \end{align*}

VPI_COLOR_SPACE_YCbCr709 

YCbCr ITU-R BT.709 color space with standard range luma (16-235).

VPI_COLOR_SPACE_YCbCr709_ER 

YCbCr ITU-R BT.709 color space with extended range luma (0-255).

VPI_COLOR_SPACE_YCbCr2020 

YCbCr ITU-R BT.2020 color space with standard range luma (16-235).

VPI_COLOR_SPACE_YCbCr2020_PQ_ER 

YCbCr ITU-R BT.2020 color space encoded with SMPTE ST 2084 Perceptual Quantizer transfer function with extended range luma (0-255).

VPI_COLOR_SPACE_BayerRGGB 

Bayer format with X channel mapped to samples as follows:

  • span 1: R G R G R G R G
  • span 2: G B G B G B G B (Y,Z,W are discarded)
VPI_COLOR_SPACE_BayerBGGR 

Bayer format with X channel mapped to samples as follows:

  • span 1: B G B G B G B G
  • span 2: G R G R G R G R
    (Y,Z,W are discarded)
VPI_COLOR_SPACE_BayerGRBG 

Bayer format with X channel mapped to samples as follows:

  • span 1: G R G R G R G R
  • span 2: B G B G B G B G
    (Y,Z,W are discarded)
VPI_COLOR_SPACE_BayerGBRG 

Bayer format with X channel mapped to samples as follows:

  • span 1: G B G B G B G B
  • span 2: R G R G R G R G
    (Y,Z,W are discarded)
VPI_COLOR_SPACE_BayerCCCC 

Bayer format with X channel mapped to samples as follows:

  • span 1: C C C C C C C C
  • span 2: C C C C C C C C
    (Y,Z,W are discarded)
VPI_COLOR_SPACE_BayerCRBC 

Bayer format with X channel mapped to samples as follows:

  • span 1: C R C R C R C R
  • span 2: B C B C B C B C
    (Y,Z,W are discarded)

Definition at line 355 of file Format.h.

◆ VPIFormatDataType

#include <vpi/Format.h>

Defines the channel data type.

Enumerator
VPI_FORMAT_DATA_TYPE_UNSIGNED 

Channels are unsigned integer values.

VPI_FORMAT_DATA_TYPE_SIGNED 

Channels are signed integer values.

VPI_FORMAT_DATA_TYPE_FLOAT 

Channel are floating point values.

Definition at line 210 of file Format.h.

◆ VPIFormatPacking

#include <vpi/Format.h>

Defines how channels are packed into an image plane element.

Packing encodes how many channels the plane element has, and how they are arranged in memory.

Up to 4 channels (denoted by X, Y, Z, W) can be packed into an image plane element, each one occupying a specified number of bits.

When two channels are specified one right after the other, they are ordered from most-significant bit to least-significant bit. Words are separated by underscores. For example:

X8Y8Z8W8 = a single 32-bit word containing 4 channels, 8 bits each.

In little-endian architectures:

     Address  0   ||  1   ||  2   ||  3
           WWWWWWWWZZZZZZZZYYYYYYYYXXXXXXXX

In big-endian architectures:

     Address  0   ||  1   ||  2   ||  3
           XXXXXXXXYYYYYYYYZZZZZZZZWWWWWWWW

X8_Y8_Z8_W8 = four consecutive 8-bit words, corresponding to 4 channels, 8 bits each.

In little-endian architectures:

     Address  0   ||  1   ||  2   ||  3
           XXXXXXXXYYYYYYYYZZZZZZZZWWWWWWWW

In big-endian architectures:

     Address  0   ||  1   ||  2   ||  3
           XXXXXXXXYYYYYYYYZZZZZZZZWWWWWWWW

In cases where a word is less than 8 bits (e.g., X1 1-bit channel), channels are ordered from LSB to MSB within a word.

Note
Also note equivalences such as the following:
In little-endian: X8_Y8_Z8_W8 = W8Z8Y8X8.
In big-endian: X8_Y8_Z8_W8 = X8Y8Z8W8.

Some formats allow different packings when pixels' horizontal coordinate is even or odd. For instance, every pixel of YUV422 packed format contains an Y channel, while only even pixels contain the U channel, and odd pixels contain V channel. Such formats use a double-underscore to separate the even pixels from the odd pixels. The packing just described might be referred to X8_Y8__X8_Z8, where X = luma, Y = U chroma, Z = V chroma.

Enumerator
VPI_FORMAT_PACKING_0 

No channels.

VPI_FORMAT_PACKING_INVALID 

Denotes an invalid packing.

VPI_FORMAT_PACKING_X1 

One 1-bit channel.

VPI_FORMAT_PACKING_X2 

One 2-bit channel.

VPI_FORMAT_PACKING_X4 

One 4-bit channel.

VPI_FORMAT_PACKING_X8 

One 8-bit channel.

VPI_FORMAT_PACKING_X4Y4 

Two 4-bit channels in one word.

VPI_FORMAT_PACKING_X3Y3Z2 

Three 3-, 3- and 2-bit channels in one 8-bit word.

VPI_FORMAT_PACKING_X16 

One 16-bit channel.

VPI_FORMAT_PACKING_X8_Y8 

Two 8-bit channels in two 8-bit words.

VPI_FORMAT_PACKING_X8Y8 

Two 8-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X6Y10 

Two 6- and 10-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X10Y6 

Two 10- and 6-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X2Y14 

Two 2- and 14-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X12Y4 

Two 12- and 4-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X4Y12 

Two 4- and 12-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X8_Y8__X8_Z8 

2 pixels of 2 8-bit channels each, totalling 4 8-bit words.

VPI_FORMAT_PACKING_Y8_X8__Z8_X8 

2 pixels of 2 swapped 8-bit channels each, totalling 4 8-bit words.

VPI_FORMAT_PACKING_X5Y5Z6 

Three 5-, 5- and 6-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X5Y6Z5 

Three 5-, 6- and 5-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X6Y5Z5 

Three 6-, 5- and 5-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X1Y5Z5W5 

Four 1-, 5-, 5- and 5-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X4Y4Z4W4 

Four 4-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X5Y1Z5W5 

Four 5-, 1-, 5- and 5-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X5Y5Z1W5 

Four 5-, 5-, 1- and 5-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X5Y5Z5W1 

Four 5-, 5-, 5- and 1-bit channels in one 16-bit word.

VPI_FORMAT_PACKING_X24 

One 24-bit channel.

VPI_FORMAT_PACKING_X8_Y8_Z8 

Three 8-bit channels in three 8-bit words.

VPI_FORMAT_PACKING_X32 

One 32-bit channel.

VPI_FORMAT_PACKING_X16_Y16 

Two 16-bit channels in one 16-bit words.

VPI_FORMAT_PACKING_X16Y16 

Two 16-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X12Y20 

Two 12- and 20-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X10Y11Z11 

Three 10-, 11- and 11-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X11Y11Z10 

Three 11-, 11- and 10-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X2Y10Z10W10 

Four 2-, 10-, 10- and 10-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X8Y8Z8W8 

Four 8-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X8_Y8_Z8_W8 

Four 8-bit channels in four 8-bit words.

VPI_FORMAT_PACKING_X10Y6Z10W6 

Four 10-, 6-, 10- and 6-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X10Y10Z10W2 

Four 10-, 10-, 10- and 2-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X12Y4Z12W4 

Four 12-, 4-, 12- and 4-bit channels in one 32-bit word.

VPI_FORMAT_PACKING_X48 

One 48-bit channel.

VPI_FORMAT_PACKING_X16_Y16_Z16 

Three 16-bit channels in three 16-bit words.

VPI_FORMAT_PACKING_X64 

One 64-bit channel.

VPI_FORMAT_PACKING_X32_Y32 

Two 32-bit channels in two 32-bit words.

VPI_FORMAT_PACKING_X16_Y16_Z16_W16 

Four 16-bit channels in four 16-bit words.

VPI_FORMAT_PACKING_X16Y16Z16W16 

Four 16-bit channels in one 64-bit word.

VPI_FORMAT_PACKING_X96 

One 96-bit channel.

VPI_FORMAT_PACKING_X32_Y32_Z32 

Three 32-bit channels in three 32-bit words.

VPI_FORMAT_PACKING_X128 

One 128-bit channel.

VPI_FORMAT_PACKING_X32_Y32_Z32_W32 

Four 32-bit channels in four 32-bit words.

VPI_FORMAT_PACKING_X32Y32Z32W32 

Four 32-bit channels in one 128-bit word.

Definition at line 131 of file Format.h.

◆ VPIImageFormat

#include <vpi/ImageFormat.h>

Pre-defined image formats.

An image format defines how image pixels are interpreted. Each image format is defined by the following components:

These pre-defined formats are guaranteed to work with algoriths that explicitly support them. Image formats can also be user-defined using vpiMakeImageFormat or vpiMakeImageFormatFromPlanes functions.

Using user-defined image formats with algorithms can lead to undefined behavior (segfaults, etc), but usually it works as expected. Result of algorithms using these image formats must be checked for correctness, as it's not guaranteed that they will work.

Enumerator
VPI_IMAGE_FORMAT_INVALID 

Denotes an invalid image format.

VPI_IMAGE_FORMAT_U8 

Single plane with one 8-bit unsigned integer channel.

Also used for grayscale images.

VPI_IMAGE_FORMAT_S8 

Single plane with one 8-bit signed integer channel.

Also used for grayscale images.

VPI_IMAGE_FORMAT_U16 

Single plane with one 16-bit unsigned integer channel.

Also used for grayscale images.

VPI_IMAGE_FORMAT_S16 

Single plane with one 16-bit signed integer channel.

Also used for grayscale images.

VPI_IMAGE_FORMAT_F32 

Single plane with one 32-bit floating point channel.

Also used for grayscale images.

VPI_IMAGE_FORMAT_F64 

Single plane with one 64-bit floating point channel.

Also used for grayscale images.

VPI_IMAGE_FORMAT_2F32 

Single plane with two interleaved 32-bit floating point channels.

VPI_IMAGE_FORMAT_NV12 

YUV420sp 8-bit pitch-linear format composed of two planes:

  1. One 8-bit channel with luma (Y).
  2. Two interleaved 8-bit channels with chroma (U/V), with half horizontal and vertical resolution of luma plane.
VPI_IMAGE_FORMAT_NV12_BL 

YUV420sp 8-bit block-linear format composed of two planes:

  1. One 8-bit channel with luma (Y).
  2. Two interleaved 8-bit channels with chroma (U/V), with half horizontal and vertical resolution of luma plane.
VPI_IMAGE_FORMAT_RGB8 

Single plane with interleaved RGB 8-bit channel.

VPI_IMAGE_FORMAT_BGR8 

Single plane with interleaved BGR 8-bit channel.

VPI_IMAGE_FORMAT_RGBA8 

Single plane with interleaved RGBA 8-bit channel.

VPI_IMAGE_FORMAT_BGRA8 

Single plane with interleaved BGRA 8-bit channel.

Definition at line 93 of file ImageFormat.h.

◆ VPIMemLayout

#include <vpi/Format.h>

Defines how the 2D plane pixels are laid out in memory.

This defines how a pixel are addressed, i.e., given its \((x,y)\) coordinate, what's its memory address. Block-linear formats have a proprietary memory representation and aren't supposed to be addressed by the user directly.

Enumerator
VPI_MEM_LAYOUT_PITCH_LINEAR 

Pixels are laid out in row-major order, i.e., \((x,y) = y \times \mathit{pitch} + x \times \mathit{pixel stride}\).

VPI_MEM_LAYOUT_BLOCK1_LINEAR 

Pixels are laid out in block-linear format with height = 1.

VPI_MEM_LAYOUT_BLOCK2_LINEAR 

Pixels are laid out in block-linear format with height = 2.

VPI_MEM_LAYOUT_BLOCK4_LINEAR 

Pixels are laid out in block-linear format with height = 4.

VPI_MEM_LAYOUT_BLOCK8_LINEAR 

Pixels are laid out in block-linear format with height = 8.

VPI_MEM_LAYOUT_BLOCK16_LINEAR 

Pixels are laid out in block-linear format with height = 16.

VPI_MEM_LAYOUT_BLOCK32_LINEAR 

Pixels are laid out in block-linear format with height = 32.

VPI_MEM_LAYOUT_BLOCK_LINEAR 

Default block-linear format.

It's guaranteed to be valid in all algorithms that support block-linear format.

VPI_MEM_LAYOUT_PL 

Useful alias.

VPI_MEM_LAYOUT_BL 

Useful alias.

Definition at line 223 of file Format.h.

◆ VPIPixelFormat

#include <vpi/PixelFormat.h>

Pre-defined pixel formats.

Pixel formats defines the geometry of pixels in a image plane without taking into account what the value represents. For example, a VPI_IMAGE_FORMAT_NV12 is composed of 2 planes, each one with the following pixel formats:

  1. VPI_PIXEL_FORMAT_U8 representing pixels as 8-bit unsigned values.
  2. VPI_PIXEL_FORMAT_2U8 representing pixels as two interleaved 32-bit floating-point values.
Enumerator
VPI_PIXEL_FORMAT_DEFAULT 

Used to signal that the pixel format must be inferred from image format.

VPI_PIXEL_FORMAT_INVALID 

Signal format conversion errors.

VPI_PIXEL_FORMAT_U8 

One channel of unsigned 8-bit values.

VPI_PIXEL_FORMAT_S8 

One channel of signed 8-bit values.

VPI_PIXEL_FORMAT_U16 

One channel of unsigned 16-bit values.

VPI_PIXEL_FORMAT_S16 

One channel of signed 16-bit values.

VPI_PIXEL_FORMAT_2U8 

Two interleaved channels of unsigned 8-bit values.

VPI_PIXEL_FORMAT_3U8 

Three interleaved channels of unsigned 8-bit values.

VPI_PIXEL_FORMAT_4U8 

Four interleaved channels of unsigned 8-bit values.

VPI_PIXEL_FORMAT_F32 

One channel of 32-bit float values.

VPI_PIXEL_FORMAT_2F32 

Two interleaved channels of 32-bit float values.

VPI_PIXEL_FORMAT_F64 

One channel of 64-bit float values.

Definition at line 79 of file PixelFormat.h.

◆ VPISwizzle

enum VPISwizzle

#include <vpi/Format.h>

Defines the supported channel swizzle operations.

The operations map an input vector \((x,y,z,w)\) into an output vector \((x',y',z',w')\). Any output channel can select any of the input channels, or the constants zero or one. For example, the swizzle "X000" selects the first channel, whereas swizzle "ZYXW" swaps the X and Z channels, needed for conversion between RGBA and BGRA image formats.

Enumerator
VPI_SWIZZLE_0000 

Swizzle operation.

VPI_SWIZZLE_1000 

Swizzle operation.

VPI_SWIZZLE_0001 

Swizzle operation.

VPI_SWIZZLE_XYZW 

Swizzle operation.

VPI_SWIZZLE_ZYXW 

Swizzle operation.

VPI_SWIZZLE_WXYZ 

Swizzle operation.

VPI_SWIZZLE_WZYX 

Swizzle operation.

VPI_SWIZZLE_YZWX 

Swizzle operation.

VPI_SWIZZLE_XYZ1 

Swizzle operation.

VPI_SWIZZLE_XYZ0 

Swizzle operation.

VPI_SWIZZLE_YZW1 

Swizzle operation.

VPI_SWIZZLE_XXX1 

Swizzle operation.

VPI_SWIZZLE_XZY1 

Swizzle operation.

VPI_SWIZZLE_ZYX1 

Swizzle operation.

VPI_SWIZZLE_ZYX0 

Swizzle operation.

VPI_SWIZZLE_WZY1 

Swizzle operation.

VPI_SWIZZLE_X000 

Swizzle operation.

VPI_SWIZZLE_0X00 

Swizzle operation.

VPI_SWIZZLE_00X0 

Swizzle operation.

VPI_SWIZZLE_000X 

Swizzle operation.

VPI_SWIZZLE_Y000 

Swizzle operation.

VPI_SWIZZLE_0Y00 

Swizzle operation.

VPI_SWIZZLE_00Y0 

Swizzle operation.

VPI_SWIZZLE_000Y 

Swizzle operation.

VPI_SWIZZLE_0XY0 

Swizzle operation.

VPI_SWIZZLE_XXXY 

Swizzle operation.

VPI_SWIZZLE_YYYX 

Swizzle operation.

VPI_SWIZZLE_0YX0 

Swizzle operation.

VPI_SWIZZLE_X00Y 

Swizzle operation.

VPI_SWIZZLE_Y00X 

Swizzle operation.

VPI_SWIZZLE_X001 

Swizzle operation.

VPI_SWIZZLE_XY01 

Swizzle operation.

VPI_SWIZZLE_XY00 

Swizzle operation.

VPI_SWIZZLE_0XZ0 

Swizzle operation.

VPI_SWIZZLE_0ZX0 

Swizzle operation.

VPI_SWIZZLE_XZY0 

Swizzle operation.

VPI_SWIZZLE_YZX1 

Swizzle operation.

VPI_SWIZZLE_ZYW1 

Swizzle operation.

Definition at line 275 of file Format.h.

◆ VPISwizzleChannel

#include <vpi/Format.h>

Defines the format channel names.

The channels are color model-agnostic.

Enumerator
VPI_SWIZZLE_CHANNEL_0 

Don't select a channel.

VPI_SWIZZLE_CHANNEL_X 

Selects the first channel of the color model.

VPI_SWIZZLE_CHANNEL_Y 

Selects the second channel of the color model.

VPI_SWIZZLE_CHANNEL_Z 

Selects the third channel of the color model.

VPI_SWIZZLE_CHANNEL_W 

Selects the fourth channel of the color model.

VPI_SWIZZLE_CHANNEL_1 

Sets the corresponding channel to have its maximum value.

Definition at line 258 of file Format.h.

Function Documentation

◆ vpiFormatPackingGetBitsPerPixel()

int vpiFormatPackingGetBitsPerPixel ( VPIFormatPacking  packing)

#include <vpi/Format.h>

Returns the number of bits per pixel of the given packing.

Parameters
[in]packingThe format packing to be queried.
Returns
Total number of bits per pixel of the given packing. It's the sum of number of bits occupied by all packing channels.

◆ vpiFormatPackingGetChannelCount()

int vpiFormatPackingGetChannelCount ( VPIFormatPacking  packing)

#include <vpi/Format.h>

Returns the number of channels defined by the given packing.

Parameters
[in]packingThe format packing to be queried.
Returns
Number of channels from the given format packing. It's value between 0 and 4.

◆ vpiFormatPackingGetParams()

void vpiFormatPackingGetParams ( VPIFormatPacking  packing,
int *  fixed,
int *  bitsX,
int *  bitsY,
int *  bitsZ,
int *  bitsW 
)

#include <vpi/Format.h>

Returns channels' information from a format packing.

Parameters
[in]packingThe format packing to be queried.
[out]fixed1 if each component is assigned to its own word, 0 if all components share the same word.
[out]bitsXNumber of bits in the first channel. Value can't be 0.
[out]bitsYNumber of bits in the second channel. Can be 0 if channel isn't used.
[out]bitsZNumber of bits in the second channel. Can be 0 if bitsY is 0 and this channel isn't used.
[out]bitsWNumber of bits in the second channel. Can be 0 if bitsZ is 0 and this channel isn't used.

◆ vpiImageFormatGetChannelCount()

int vpiImageFormatGetChannelCount ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the total number of channels of an image format.

Parameters
[in]fmtImage format to be queried.
Returns
The sum of all channel counts in all planes.

◆ vpiImageFormatGetChromaSubsampling()

VPIChromaSubsampling vpiImageFormatGetChromaSubsampling ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's chroma subsampling type.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's chroma subsampling type.

◆ vpiImageFormatGetChromaSubsamplingCenterHoriz()

int vpiImageFormatGetChromaSubsamplingCenterHoriz ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's chroma horizontal sample position.

Parameters
[in]fmtImage format to be queried.
Return values
0Chroma sample is horizontally aligned with the corresponding luma sample.
1Chroma sample is between the current (x) and the next (x+1) luma sample.

◆ vpiImageFormatGetChromaSubsamplingCenterVert()

int vpiImageFormatGetChromaSubsamplingCenterVert ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's chroma vertical sample position.

Parameters
[in]fmtImage format to be queried.
Return values
0Chroma sample is vertically aligned with the corresponding luma sample.
1Chroma sample is between the current (y) and the next (y+1) luma sample.

◆ vpiImageFormatGetChromaSubsamplingDivHoriz()

int vpiImageFormatGetChromaSubsamplingDivHoriz ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's chroma subsampling horizontal downscale factor.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's chroma subsampling horizontal downscale factor.

◆ vpiImageFormatGetChromaSubsamplingDivVert()

int vpiImageFormatGetChromaSubsamplingDivVert ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's chroma subsampling vertical downscale factor.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's chroma subsampling vertical downscale factor.

◆ vpiImageFormatGetColorModel()

VPIColorModel vpiImageFormatGetColorModel ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's color model.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's color model.

◆ vpiImageFormatGetColorSpace()

VPIColorSpace vpiImageFormatGetColorSpace ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's color space.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's color space.

◆ vpiImageFormatGetDataType()

VPIFormatDataType vpiImageFormatGetDataType ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's data type.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's data type.

◆ vpiImageFormatGetMemLayout()

VPIMemLayout vpiImageFormatGetMemLayout ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's memory layout.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's memory layout.

◆ vpiImageFormatGetPlaneBitsPerPixel()

int vpiImageFormatGetPlaneBitsPerPixel ( VPIImageFormat  fmt,
int  plane 
)

#include <vpi/ImageFormat.h>

Get the image format's plane bits per pixel count.

Parameters
[in]fmtImage format to be queried.
[in]planeWhich plane is to be queried. Valid values range from 0 (first plane) to 3 (fourth plane).
Returns
The number of bits per pixel the given format plane has.

◆ vpiImageFormatGetPlaneChannelCount()

int vpiImageFormatGetPlaneChannelCount ( VPIImageFormat  fmt,
int  plane 
)

#include <vpi/ImageFormat.h>

Get the number of channels in a plane of an image format.

Parameters
[in]fmtImage format to be queried.
[in]planePlane to be queried. Valid values range from 0 (first) to 3 (fourth and last) plane.
Returns
Number of channels in the given plane.

◆ vpiImageFormatGetPlaneCount()

int vpiImageFormatGetPlaneCount ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the number of planes of an image format.

Parameters
[in]fmtImage format to be queried.
Returns
Number of planes defined by the given image format.

◆ vpiImageFormatGetPlaneFormat()

VPIImageFormat vpiImageFormatGetPlaneFormat ( VPIImageFormat  fmt,
int  plane 
)

#include <vpi/ImageFormat.h>

Get the plane format of an image format.

Parameters
[in]fmtImage format to be queried.
[in]planePlane to be queried. Valid values range from 0 (first) to 3 (fourth and last) plane.
Returns
The image format of the given plane.

◆ vpiImageFormatGetPlanePacking()

VPIFormatPacking vpiImageFormatGetPlanePacking ( VPIImageFormat  fmt,
int  plane 
)

#include <vpi/ImageFormat.h>

Get the packing for a given plane of an image format.

Parameters
[in]fmtImage format to be queried.
[in]planeWhich plane whose packing must be returned. Valid values range from 0 (first plane) to 3 (fourth plane).
Returns
The plane's format packing, or VPI_FORMAT_PACKING_INVALID if the format doesn't have the given plane.

◆ vpiImageFormatGetPlanePixelFormat()

VPIPixelFormat vpiImageFormatGetPlanePixelFormat ( VPIImageFormat  fmt,
int  plane 
)

#include <vpi/ImageFormat.h>

Get the pixel format of image format's plane.

Parameters
[in]fmtImage format to be queried.
[in]planePlane to be queried. Valid values range from 0 (first) to 3 (fourth and last) plane.
Returns
The pixel format of the given plane.

◆ vpiImageFormatGetPlaneSwizzle()

VPISwizzle vpiImageFormatGetPlaneSwizzle ( VPIImageFormat  fmt,
int  plane 
)

#include <vpi/ImageFormat.h>

Get the swizzle operation of the given image format's plane.

Parameters
[in]fmtImage format to be queried.
[in]planePlane to be queried. Valid values range from 0 (first) to 3 (fourth and last) plane.
Returns
The channel swizzle operation performed in the given plane.

◆ vpiImageFormatGetSwizzle()

VPISwizzle vpiImageFormatGetSwizzle ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the image format's channel swizzle operation.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's swizzle operation.

◆ vpiImageFormatGetSwizzleW()

VPISwizzleChannel vpiImageFormatGetSwizzleW ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the color model channel that corresponds to the fourth component of given image format.

For example, given format VPI_IMAGE_FORMAT_BGRA8, its fourth component is alpha, which corresponds to the VPI_SWIZZLE_CHANNEL_W (fourth) channel of the color model VPI_COLOR_MODEL_RGBA.

Parameters
[in]fmtImage format to be queried.
Returns
The color model channel assigned to the fourth component.

◆ vpiImageFormatGetSwizzleX()

VPISwizzleChannel vpiImageFormatGetSwizzleX ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the color model channel that corresponds to the first component of given image format.

For example, given format VPI_IMAGE_FORMAT_BGRA8, its first component is blue, which corresponds to the VPI_SWIZZLE_CHANNEL_Z (third) channel of the color model VPI_COLOR_MODEL_RGBA.

Parameters
[in]fmtImage format to be queried.
Returns
The color model channel assigned to the first component.

◆ vpiImageFormatGetSwizzleY()

VPISwizzleChannel vpiImageFormatGetSwizzleY ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the color model channel that corresponds to the second component of given image format.

For example, given format VPI_IMAGE_FORMAT_BGRA8, its second component is green, which corresponds to the VPI_SWIZZLE_CHANNEL_Y (second) channel of the color model VPI_COLOR_MODEL_RGBA.

Parameters
[in]fmtImage format to be queried.
Returns
The color model channel assigned to the second component.

◆ vpiImageFormatGetSwizzleZ()

VPISwizzleChannel vpiImageFormatGetSwizzleZ ( VPIImageFormat  fmt)

#include <vpi/ImageFormat.h>

Get the color model channel that corresponds to the third component of given image format.

For example, given format VPI_IMAGE_FORMAT_BGRA8, its third component is red, which corresponds to the VPI_SWIZZLE_CHANNEL_X (first) channel of the color model VPI_COLOR_MODEL_RGBA.

Parameters
[in]fmtImage format to be queried.
Returns
The color model channel assigned to the third component.

◆ vpiImageFormatSetChromaSubsampling()

VPIImageFormat vpiImageFormatSetChromaSubsampling ( VPIImageFormat  fmt,
VPIChromaSubsampling  css 
)

#include <vpi/ImageFormat.h>

Set the image format's chroma subsampling type.

Parameters
[in]fmtImage format have its chroma subsampling type replaced.
[in]cssThe new chroma subsampling type.
Returns
The new image format based on input's, but with the user-provided chroma subsampling type.

◆ vpiImageFormatSetColorSpace()

VPIImageFormat vpiImageFormatSetColorSpace ( VPIImageFormat  fmt,
VPIColorSpace  colorSpace 
)

#include <vpi/ImageFormat.h>

Set the image format's color space.

Parameters
[in]fmtImage format have its color space replaced.
[in]colorSpaceThe new color space.
Returns
The new image format based on input's, but with the user-provided color space.

◆ vpiImageFormatSetDataType()

VPIImageFormat vpiImageFormatSetDataType ( VPIImageFormat  fmt,
VPIFormatDataType  dataType 
)

#include <vpi/ImageFormat.h>

Set the image format's data type.

Parameters
[in]fmtImage format have its data type replaced.
[in]dataTypeThe new data type.
Returns
The new image format based on input's, but with the user-provided data type.

◆ vpiImageFormatSetMemLayout()

VPIImageFormat vpiImageFormatSetMemLayout ( VPIImageFormat  fmt,
VPIMemLayout  memLayout 
)

#include <vpi/ImageFormat.h>

Set the image format's memory layout.

Parameters
[in]fmtImage format have its memory layout replaced.
[in]memLayoutThe new memory layout.
Returns
The new image format based on input's, but with the user-provided memory layout.

◆ vpiMakeChromaSubsampling()

VPIChromaSubsampling vpiMakeChromaSubsampling ( int  divHoriz,
int  divVert,
int  centerSampleHoriz,
int  centerSampleVert 
)

#include <vpi/Format.h>

Creates an user-defined VPIChromaSubsampling definition.

Parameters
[in]divHorizHow many horizontal luma samples correspond to each chroma component. Must be 1 or 2.
[in]divVertHow many vertical luma samples correspond to each chroma component. Must be 1 or 2.
[in]centerSampleHorizIf 0, chroma sample is aligned horizontally with corresponding luma sample. If 1, it's in the middle horizontally between its corresponding luma sample (x) and the next (x+1).
[in]centerSampleVertIf 0, chroma sample is aligned vertically with corresponding luma sample. If 1, it's in the middle vertically between its corresponding luma sample (y) and the next (y+1).
Returns
Chroma subsampling value corresponding to the parameters given.

◆ vpiMakeFormatPacking()

VPIFormatPacking vpiMakeFormatPacking ( int  fixed,
int  bitsX,
int  bitsY,
int  bitsZ,
int  bitsW 
)

#include <vpi/Format.h>

Returns a pre-defined VPIFormatPacking given the number of bits in each channel.

This function calculates the VPIFormatPacking based on the channel characteristics at run time.

Parameters
[in]fixed1 if each component is assigned to its own word, 0 if all components share the same word.
[in]bitsXNumber of bits in the first channel. Value can't be 0.
[in]bitsYNumber of bits in the second channel. Can be 0 if channel isn't used.
[in]bitsZNumber of bits in the second channel. Can be 0 if bitsY is 0 and this channel isn't used.
[in]bitsWNumber of bits in the second channel. Can be 0 if bitsZ is 0 and this channel isn't used.
Returns
the corresponding VPIFormatPacking, or VPI_FORMAT_PACKING_INVALID if packing isn't defined.

◆ vpiMakeImageFormat()

VPIImageFormat vpiMakeImageFormat ( VPIColorSpace  colorSpace,
VPIChromaSubsampling  chromaSub,
VPIMemLayout  memLayout,
VPIFormatDataType  dataType,
VPISwizzle  swizzle,
VPIFormatPacking  packing0,
VPIFormatPacking  packing1,
VPIFormatPacking  packing2,
VPIFormatPacking  packing3 
)

#include <vpi/ImageFormat.h>

Creates an user-defined image format.

When the pre-defined image formats aren't enough, user-defined image formats can be created.

Warning
It's not guaranteed that algorithms will work correctly with use-defined image formats. It's recommended to check if the results are correct prior deploying the solution in a production environment.
Parameters
[in]colorSpaceVPIColorSpace to be used.
[in]chromaSubVPIChromaSubsampling to be used.
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIFormatDataType to be used.
[in]swizzleVPISwizzle operation to be performed on the channels.
[in]packing0,packing1,packing2,packing3Format packing of each plane. When remaining planes aren't needed, pass VPI_FORMAT_PACKING_INVALID for them.
Returns
The user-defined image format.

◆ vpiMakeImageFormatFromPlanes()

VPIImageFormat vpiMakeImageFormatFromPlanes ( VPIImageFormat  plane0,
VPIImageFormat  plane1,
VPIImageFormat  plane2,
VPIImageFormat  plane3 
)

#include <vpi/ImageFormat.h>

Constructs an image format given the format of each plane.

Parameters
[in]plane0,plane1,plane2,plane3Image format of each plane. When plane doesn't exist, pass VPI_IMAGE_FORMAT_INVALID.
Returns
The image format whose planes has the given formats.

◆ vpiMakePixelFormat()

VPIPixelFormat vpiMakePixelFormat ( VPIMemLayout  memLayout,
VPIFormatDataType  dataType,
VPIFormatPacking  packing 
)

#include <vpi/PixelFormat.h>

Creates an user-defined pixel format.

When the pre-defined pixel formats aren't enough, user-defined formats can be created.

Parameters
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIFormatDataType to be used.
[in]packingFormat packing used, which also defines the number of channels.
Returns
The user-defined pixel format.

◆ vpiMakeSwizzle()

#include <vpi/Format.h>

Creates an user-defined VPISwizzle operation.

This is similar to VPI_MAKE_SWIZZLE, but accepts the swizzle channels as runtime variables.

Parameters
[in]xChannel that will correspond to the first component.
[in]yChannel that will correspond to the second component.
[in]zChannel that will correspond to the third component.
[in]wChannel that will correspond to the component component.
Returns
the user-defined VPISwizzle operation.

◆ vpiPixelFormatGetBitsPerPixel()

int vpiPixelFormatGetBitsPerPixel ( VPIPixelFormat  fmt)

#include <vpi/PixelFormat.h>

Get the number of bits per pixel of a pixel format.

Parameters
[in]fmtPixel format to be queried.
Returns
The number of bits per pixel.

◆ vpiPixelFormatGetChannelCount()

int vpiPixelFormatGetChannelCount ( VPIPixelFormat  fmt)

#include <vpi/PixelFormat.h>

Get the number of channels of a pixel format.

Parameters
[in]fmtPixel format to be queried.
Returns
The number of channels of the pixel format.

◆ vpiPixelFormatGetDataType()

VPIFormatDataType vpiPixelFormatGetDataType ( VPIPixelFormat  fmt)

#include <vpi/PixelFormat.h>

Get the data type of a pixel format.

Parameters
[in]fmtPixel format to be queried.
Returns
The data type of the pixel format.

◆ vpiPixelFormatGetMemLayout()

VPIMemLayout vpiPixelFormatGetMemLayout ( VPIPixelFormat  fmt)

#include <vpi/PixelFormat.h>

Get the memory layout of a pixel format.

Parameters
[in]fmtPixel format to be queried.
Returns
The memory layout of the pixel format.

◆ vpiPixelFormatGetPacking()

VPIFormatPacking vpiPixelFormatGetPacking ( VPIPixelFormat  fmt)

#include <vpi/PixelFormat.h>

Get the packing of a pixel format.

Parameters
[in]fmtPixeel format to be queried.
Returns
The format's packing.
VPISwizzle
VPISwizzle
Defines the supported channel swizzle operations.
Definition: Format.h:276
VPI_MAKE_PIXEL_FORMAT
#define VPI_MAKE_PIXEL_FORMAT(memLayout, dataType, packing)
Creates an user-defined pixel format constant using abbreviated parameters.
Definition: PixelFormat.h:118
VPI_MAKE_SWIZZLE
#define VPI_MAKE_SWIZZLE(x, y, z, w)
Creates an user-defined swizzle operation.
Definition: Format.h:334
VPIPixelFormat
VPIPixelFormat
Pre-defined pixel formats.
Definition: PixelFormat.h:80
VPI_MAKE_IMAGE_FORMAT
#define VPI_MAKE_IMAGE_FORMAT(colorSpace, chromaSubsamp, memLayout, dataType, swizzle, numPlanes, packing0, packing1,...)
Creates an user-defined image format constant using abbreviated parameters.
Definition: ImageFormat.h:166
VPIImageFormat
VPIImageFormat
Pre-defined image formats.
Definition: ImageFormat.h:94