VPI - Vision Programming Interface

1.0 Release

ImageFormat.h File Reference

Defines types and functions to handle image formats. More...

#include "ColorSpec.h"
#include "DataLayout.h"
#include "PixelType.h"
#include <assert.h>
+ Include dependency graph for ImageFormat.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

#define VPI_MAKE_YCbCr_IMAGE_FORMAT_ABBREV(colorSpec, chromaSubsamp, memLayout, dataType, swizzle, numPlanes, packing0, packing1, ...)
 Creates a user-defined YCbCr color image format constant using abbreviated parameters. More...
 
#define VPI_MAKE_YCbCr_IMAGE_FORMAT(colorModel, colorSpec, chromaSubsamp, memLayout, dataType, swizzle, numPlanes, packing0, packing1, ...)
 Creates a user-defined YCbCr color image format constant. More...
 
#define VPI_MAKE_COLOR_IMAGE_FORMAT_ABBREV(colorModel, colorSpec, memLayout, dataType, swizzle, numPlanes, packing0, packing1, ...)
 Creates a user-defined color image format constant using abbreviated parameters. More...
 
#define VPI_MAKE_COLOR_IMAGE_FORMAT(colorModel, colorSpec, memLayout, dataType, swizzle, numPlanes, packing0, packing1, ...)
 Creates a user-defined color image format constant. More...
 
#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT_ABBREV(memLayout, dataType, numPlanes, packing0, packing1, ...)
 Creates a user-defined non-color image format constant using abbreviated parameters. More...
 
#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT(memLayout, dataType, numPlanes, packing0, packing1, ...)
 Creates a user-defined non-color image format constant. More...
 
#define VPI_MAKE_RAW_IMAGE_FORMAT_ABBREV(rawPattern, memLayout, dataType, numPlanes, swizzle, packing)
 Creates a user-defined raw (Bayer pattern) image format constant using abbreviated parameters. More...
 
#define VPI_MAKE_RAW_IMAGE_FORMAT(rawPattern, memLayout, dataType, numPlanes, swizzle, packing)
 Creates a user-defined raw (Bayer pattern) image format constant. More...
 
enum  VPIImageFormat
 Pre-defined image formats. More...
 
VPIImageFormat vpiMakeYCbCrImageFormat (VPIColorSpec colorSpec, VPIChromaSubsampling chromaSub, VPIMemLayout memLayout, VPIDataType dataType, VPISwizzle swizzle, VPIPacking packing0, VPIPacking packing1, VPIPacking packing2, VPIPacking packing3)
 Creates a user-defined YCbCr color image format. More...
 
VPIImageFormat vpiMakeColorImageFormat (VPIColorModel colorModel, VPIColorSpec colorSpec, VPIMemLayout memLayout, VPIDataType dataType, VPISwizzle swizzle, VPIPacking packing0, VPIPacking packing1, VPIPacking packing2, VPIPacking packing3)
 Creates a user-defined color image format. More...
 
VPIImageFormat vpiMakeNonColorImageFormat (VPIMemLayout memLayout, VPIDataType dataType, VPISwizzle swizzle, VPIPacking packing0, VPIPacking packing1, VPIPacking packing2, VPIPacking packing3)
 Creates a user-defined non-color image format. More...
 
VPIImageFormat vpiMakeRawImageFormat (VPIRawPattern rawPattern, VPIMemLayout memLayout, VPIDataType dataType, VPISwizzle swizzle, VPIPacking packing0, VPIPacking packing1, VPIPacking packing2, VPIPacking packing3)
 Creates a user-defined raw image format. More...
 
VPIImageFormat vpiMakeImageFormatFromFourCC (uint32_t fourcc, VPIColorSpec colorSpec, VPIMemLayout memLayout)
 Creates a image format from a FourCC code. More...
 
uint32_t vpiImageFormatGetFourCC (VPIImageFormat fmt)
 Returns the FourCC code corresponding to an image format. More...
 
VPIPacking vpiImageFormatGetPlanePacking (VPIImageFormat fmt, int plane)
 Get the packing for a given plane of an image format. More...
 
VPIImageFormat vpiImageFormatSetSwizzleAndPacking (VPIImageFormat fmt, VPISwizzle swizzle, VPIPacking packing0, VPIPacking packing1, VPIPacking packing2, VPIPacking packing3)
 Replaces the swizzle and packing of an existing image format. More...
 
int vpiImageFormatGetPlaneBitsPerPixel (VPIImageFormat fmt, int plane)
 Get the image format's plane bits per pixel count. More...
 
VPIImageFormat vpiImageFormatSetDataType (VPIImageFormat fmt, VPIDataType dataType)
 Set the image format's data type. More...
 
VPIDataType 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...
 
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 vpiImageFormatSetColorSpec (VPIImageFormat fmt, VPIColorSpec colorSpec)
 Set the image format's color standard. More...
 
VPIColorSpec vpiImageFormatGetColorSpec (VPIImageFormat fmt)
 Get the image format's color standard. 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 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...
 
void vpiImageFormatGetBitsPerChannel (VPIImageFormat fmt, int32_t *bits)
 Get the image format's bit size for each channel. More...
 
VPIPixelType vpiImageFormatGetPlanePixelType (VPIImageFormat fmt, int plane)
 Get the pixel type 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...
 
const char * vpiImageFormatGetName (VPIImageFormat fmt)
 Returns a string representation of the image format. More...
 
VPIRawPattern vpiImageFormatGetRawPattern (VPIImageFormat fmt)
 Returns the raw color pattern of the image format. More...
 
VPIImageFormat vpiImageFormatSetRawPattern (VPIImageFormat fmt, VPIRawPattern rawPattern)
 Sets the raw color pattern of the image format. More...
 
int vpiImageFormatHasSameDataLayout (VPIImageFormat a, VPIImageFormat b)
 Returns whether the image formats have the same data layout. More...
 

Detailed Description

Defines types and functions to handle image formats.

Definition in file ImageFormat.h.

Macro Definition Documentation

◆ VPI_MAKE_COLOR_IMAGE_FORMAT

#define VPI_MAKE_COLOR_IMAGE_FORMAT (   colorModel,
  colorSpec,
  memLayout,
  dataType,
  swizzle,
  numPlanes,
  packing0,
  packing1,
  ... 
)

Creates a user-defined color image format constant.

Example to create a RGB planar ITU-R BT.709 full-range with SMPTE240M encoding, block-linear format.

2, VPI_PACKING_X8, VPI_PACKING_X8, VPI_PACKING_Y8);
#define VPI_MAKE_COLOR_IMAGE_FORMAT(colorModel, colorSpec, memLayout, dataType, swizzle, numPlanes, packing0, packing1,...)
Creates a user-defined color image format constant.
Definition: ImageFormat.h:327
#define VPI_MAKE_COLOR_SPEC_ABBREV(cspace, encoding, xferFunc, range, locHoriz, locVert)
Creates a user-defined color spec constant using abbreviated parameters.
Definition: ColorSpec.h:254
@ VPI_COLOR_MODEL_RGB
red, green, blue components.
Definition: ColorSpec.h:80
@ VPI_SWIZZLE_XYZ0
Definition: DataLayout.h:296
@ VPI_PACKING_X8
One 8-bit channel.
Definition: DataLayout.h:137
@ VPI_MEM_LAYOUT_BL
Definition: DataLayout.h:256
@ VPI_DATA_TYPE_UNSIGNED
Channels are unsigned integer values.
Definition: DataLayout.h:212
VPIImageFormat
Pre-defined image formats.
Definition: ImageFormat.h:99

If the color model is VPI_COLOR_MODEL_YCbCr, it's assumed that the chroma subsampling is 4:4:4, i.e, VPI_CSS_444.

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]colorModelVPIColorModel to be used.
[in]colorSpecVPIColorSpec to be used.
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType to be used.
[in]swizzleVPISwizzle operation to be performed on the channels.
[in]numPlanesNumber of planes this format has.
[in]packing0,packing1,...Format packing of each plane.
Returns
The user-defined image format.

Definition at line 327 of file ImageFormat.h.

◆ VPI_MAKE_COLOR_IMAGE_FORMAT_ABBREV

#define VPI_MAKE_COLOR_IMAGE_FORMAT_ABBREV (   colorModel,
  colorSpec,
  memLayout,
  dataType,
  swizzle,
  numPlanes,
  packing0,
  packing1,
  ... 
)

Creates a user-defined color image format constant using abbreviated parameters.

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

VPIImageFormat fmt = VPI_MAKE_COLOR_IMAGE_FORMAT_ABBREV(RGB, BT709, BL, UNSIGNED, XYZ0, 3, X8, X8, Y8);
#define VPI_MAKE_COLOR_IMAGE_FORMAT_ABBREV(colorModel, colorSpec, memLayout, dataType, swizzle, numPlanes, packing0, packing1,...)
Creates a user-defined color image format constant using abbreviated parameters.
Definition: ImageFormat.h:296

If the color model is VPI_COLOR_MODEL_YCbCr, it's assumed that the chroma subsampling is 4:4:4, i.e, VPI_CSS_444.

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]colorModelVPIColorModel to be used, without the VPI_COLOR_MODEL_ prefix.
[in]colorSpecVPIColorSpec to be used, without the VPI_COLOR_SPEC_ prefix.
[in]memLayoutVPIMemLayout to be used, without the VPI_MEM_LAYOUT_ prefix.
[in]dataTypeVPIDataType to be used, without the VPI_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_PACKING_ prefix.
Returns
The user-defined image format.

Definition at line 296 of file ImageFormat.h.

◆ VPI_MAKE_NONCOLOR_IMAGE_FORMAT

#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT (   memLayout,
  dataType,
  numPlanes,
  packing0,
  packing1,
  ... 
)

Creates a user-defined non-color image format constant.

Example to create 3-plane float block-linear image, 1st: 8-bit, 2nd: 16-bit, 3rd: 32-bit

#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT(memLayout, dataType, numPlanes, packing0, packing1,...)
Creates a user-defined non-color image format constant.
Definition: ImageFormat.h:374
@ VPI_PACKING_X32
One 32-bit channel.
Definition: DataLayout.h:171
@ VPI_PACKING_X16
One 16-bit channel.
Definition: DataLayout.h:143

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType to be used.
[in]numPlanesNumber of planes this format has.
[in]packing0,packing1,...Format packing of each plane.
Returns
The user-defined image format.

Definition at line 374 of file ImageFormat.h.

◆ VPI_MAKE_NONCOLOR_IMAGE_FORMAT_ABBREV

#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT_ABBREV (   memLayout,
  dataType,
  numPlanes,
  packing0,
  packing1,
  ... 
)

Creates a user-defined non-color image format constant using abbreviated parameters.

This macro allows passing abbreviated format parameters (without the parameter type prefix). Example to create 3-plane float block-linear image, 1st: 8-bit, 2nd: 16-bit, 3rd: 32-bit

VPIImageFormat fmt = VPI_MAKE_NONCOLOR_IMAGE_FORMAT_ABBREV(BL, UNSIGNED, 3, X8, X16, X32);
#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT_ABBREV(memLayout, dataType, numPlanes, packing0, packing1,...)
Creates a user-defined non-color image format constant using abbreviated parameters.
Definition: ImageFormat.h:351

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]memLayoutVPIMemLayout to be used, without the VPI_MEM_LAYOUT_ prefix.
[in]dataTypeVPIDataType to be used, without the VPI_DATA_TYPE_ prefix.
[in]numPlanesNumber of planes this format has.
[in]packing0,packing1,...Format packing of each plane, without the VPI_PACKING_ prefix.
Returns
The user-defined image format.

Definition at line 351 of file ImageFormat.h.

◆ VPI_MAKE_RAW_IMAGE_FORMAT

#define VPI_MAKE_RAW_IMAGE_FORMAT (   rawPattern,
  memLayout,
  dataType,
  numPlanes,
  swizzle,
  packing 
)

Creates a user-defined raw (Bayer pattern) image format constant.

Example to create a RGGB Bayer pattern format:

#define VPI_MAKE_RAW_IMAGE_FORMAT(rawPattern, memLayout, dataType, numPlanes, swizzle, packing)
Creates a user-defined raw (Bayer pattern) image format constant.
Definition: ImageFormat.h:423
@ VPI_RAW_BAYER_RGGB
Bayer format with X channel mapped to samples as follows:
Definition: ColorSpec.h:308
@ VPI_SWIZZLE_X000
Definition: DataLayout.h:303

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]rawPatternVPIRawPattern to be used.
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType to be used.
[in]swizzleVPISwizzle operation to be performed on the channels.
[in]numPlanesNumber of planes this format has.
[in]packingFormat packing of image plane.
Returns
The user-defined image format.

Definition at line 423 of file ImageFormat.h.

◆ VPI_MAKE_RAW_IMAGE_FORMAT_ABBREV

#define VPI_MAKE_RAW_IMAGE_FORMAT_ABBREV (   rawPattern,
  memLayout,
  dataType,
  numPlanes,
  swizzle,
  packing 
)

Creates a user-defined raw (Bayer pattern) image format constant using abbreviated parameters.

This macro allows passing abbreviated format parameters (without the parameter type prefix). Example to create a RGGB Bayer pattern format:

VPIImageFormat fmt = VPI_MAKE_RAW_IMAGE_FORMAT_ABBREV(BAYER_RGGB, BL, UNSIGNED, X000, 1, X8);
#define VPI_MAKE_RAW_IMAGE_FORMAT_ABBREV(rawPattern, memLayout, dataType, numPlanes, swizzle, packing)
Creates a user-defined raw (Bayer pattern) image format constant using abbreviated parameters.
Definition: ImageFormat.h:399

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]rawPatternVPIRawPattern to be used, without the VPI_RAW_ prefix.
[in]memLayoutVPIMemLayout to be used, without the VPI_MEM_LAYOUT_ prefix.
[in]dataTypeVPIDataType to be used, without the VPI_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]packingFormat packing of image plane plane, without the VPI_PACKING_ prefix.
Returns
The user-defined image format.

Definition at line 399 of file ImageFormat.h.

◆ VPI_MAKE_YCbCr_IMAGE_FORMAT

#define VPI_MAKE_YCbCr_IMAGE_FORMAT (   colorModel,
  colorSpec,
  chromaSubsamp,
  memLayout,
  dataType,
  swizzle,
  numPlanes,
  packing0,
  packing1,
  ... 
)

Creates a user-defined YCbCr color image format constant.

Example to create a YUV422R ITU-R BT.709 full-range with SMPTE240M transfer function, block-linear format.

#define VPI_MAKE_YCbCr_IMAGE_FORMAT(colorModel, colorSpec, chromaSubsamp, memLayout, dataType, swizzle, numPlanes, packing0, packing1,...)
Creates a user-defined YCbCr color image format constant.
Definition: ImageFormat.h:266
@ VPI_CSS_422R
4:2:2R BT.601 sub-sampling.
Definition: ColorSpec.h:411
@ VPI_PACKING_X8_Y8
Two 8-bit channels in two 8-bit words.
Definition: DataLayout.h:150

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]colorModelVPIColorModel to be used.
[in]colorSpecVPIColorSpec to be used.
[in]chromaSubsampVPIChromaSubsampling to be used.
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType to be used.
[in]swizzleVPISwizzle operation to be performed on the channels.
[in]numPlanesNumber of planes this format has.
[in]packing0,packing1,...Format packing of each plane.
Returns
The user-defined image format.

Definition at line 266 of file ImageFormat.h.

◆ VPI_MAKE_YCbCr_IMAGE_FORMAT_ABBREV

#define VPI_MAKE_YCbCr_IMAGE_FORMAT_ABBREV (   colorSpec,
  chromaSubsamp,
  memLayout,
  dataType,
  swizzle,
  numPlanes,
  packing0,
  packing1,
  ... 
)

Creates a user-defined YCbCr color 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 studio-range block-linear format.

VPIImageFormat fmt = VPI_MAKE_YCbCr_IMAGE_FORMAT_ABBREV(BT709, 422, BL, UNSIGNED, XYZ0, 2, X8, X8_Y8);
#define VPI_MAKE_YCbCr_IMAGE_FORMAT_ABBREV(colorSpec, chromaSubsamp, memLayout, dataType, swizzle, numPlanes, packing0, packing1,...)
Creates a user-defined YCbCr color image format constant using abbreviated parameters.
Definition: ImageFormat.h:237

Fourth plane, packing3, must have at most 64bpp.

Parameters
[in]colorSpecVPIColorSpec to be used, without the VPI_COLOR_SPEC_ prefix.
[in]chromaSubsampVPIChromaSubsampling to be used, without the VPI_CSS_ prefix.
[in]memLayoutVPIMemLayout to be used, without the VPI_MEM_LAYOUT_ prefix.
[in]dataTypeVPIDataType to be used, without the VPI_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_PACKING_ prefix.
Returns
The user-defined image format.

Definition at line 237 of file ImageFormat.h.

Function Documentation

◆ vpiImageFormatGetBitsPerChannel()

void vpiImageFormatGetBitsPerChannel ( VPIImageFormat  fmt,
int32_t *  bits 
)

Get the image format's bit size for each channel.

Parameters
[in]fmtImage format to be queried.
[out]bitsPointer to an int32_t array with 4 elements where output will be stored. If it's NULL, the function is a no-op.

◆ vpiImageFormatGetChannelCount()

int vpiImageFormatGetChannelCount ( VPIImageFormat  fmt)

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)

Get the image format's chroma subsampling type.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's chroma subsampling type. It returns VPI_CSS_NONE if format's color model isn't VPI_COLOR_MODEL_YCbCr

◆ vpiImageFormatGetColorModel()

VPIColorModel vpiImageFormatGetColorModel ( VPIImageFormat  fmt)

Get the image format's color model.

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

◆ vpiImageFormatGetColorSpec()

VPIColorSpec vpiImageFormatGetColorSpec ( VPIImageFormat  fmt)

Get the image format's color standard.

Parameters
[in]fmtImage format to be queried.
Returns
The image format's color standard, or VPI_COLOR_SPEC_UNDEFINED if it's not applicable, i.e., format model isn't RGB, YCbCr, HSV or HSL.

◆ vpiImageFormatGetDataType()

VPIDataType vpiImageFormatGetDataType ( VPIImageFormat  fmt)

Get the image format's data type.

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

◆ vpiImageFormatGetFourCC()

uint32_t vpiImageFormatGetFourCC ( VPIImageFormat  fmt)

Returns the FourCC code corresponding to an image format.

Parameters
[in]fmtImage format to be queried.
Returns
The FourCC code corresponding to the image format.

◆ vpiImageFormatGetMemLayout()

VPIMemLayout vpiImageFormatGetMemLayout ( VPIImageFormat  fmt)

Get the image format's memory layout.

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

◆ vpiImageFormatGetName()

const char* vpiImageFormatGetName ( VPIImageFormat  fmt)

Returns a string representation of the image format.

Parameters
[in]fmtImage format to be returned.
Returns
The string representation of the image format. Returned string is valid until next call of this function from the same calling thread.

◆ vpiImageFormatGetPlaneBitsPerPixel()

int vpiImageFormatGetPlaneBitsPerPixel ( VPIImageFormat  fmt,
int  plane 
)

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 
)

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)

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 
)

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()

VPIPacking vpiImageFormatGetPlanePacking ( VPIImageFormat  fmt,
int  plane 
)

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_PACKING_0 if the format doesn't have the given plane.

◆ vpiImageFormatGetPlanePixelType()

VPIPixelType vpiImageFormatGetPlanePixelType ( VPIImageFormat  fmt,
int  plane 
)

Get the pixel type 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 type of the given plane.

◆ vpiImageFormatGetPlaneSwizzle()

VPISwizzle vpiImageFormatGetPlaneSwizzle ( VPIImageFormat  fmt,
int  plane 
)

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.

◆ vpiImageFormatGetRawPattern()

VPIRawPattern vpiImageFormatGetRawPattern ( VPIImageFormat  fmt)

Returns the raw color pattern of the image format.

Parameters
[in]fmtImage format to be queried.
Returns
If image format's color model is VPI_COLOR_MODEL_RAW, the corresponding raw pattern will be returned, or else VPI_RAW_INVALID.

◆ vpiImageFormatGetSwizzle()

VPISwizzle vpiImageFormatGetSwizzle ( VPIImageFormat  fmt)

Get the image format's channel swizzle operation.

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

◆ vpiImageFormatHasSameDataLayout()

int vpiImageFormatHasSameDataLayout ( VPIImageFormat  a,
VPIImageFormat  b 
)

Returns whether the image formats have the same data layout.

Data layout referts to how pixels are laid out in memory. It doesn't take into account the format's color information.

The following characteristics are taken into account:

  • memory layout (block linear, pitch linear, ...)
  • data type (signed, unsigned, float, ...)
  • Swizzle (except for 1/0 in 4th channel)
  • number of planes
  • packings (X8_Y8, X16, ...)
  • chroma subsampling (4:4:4, 4:2:0, ...)
Parameters
[in]a,bImage formats to be compared.
Return values
1If both image formats compares equal with respect to how pixels are laid out in memory.
0If both image formats compares differently.

◆ vpiImageFormatSetChromaSubsampling()

VPIImageFormat vpiImageFormatSetChromaSubsampling ( VPIImageFormat  fmt,
VPIChromaSubsampling  css 
)

Set the image format's chroma subsampling type.

It's only applicable with YCbCr color model.

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. Returns VPI_CSS_NONE if model isn't VPI_COLOR_MODEL_YCbCr.

◆ vpiImageFormatSetColorSpec()

VPIImageFormat vpiImageFormatSetColorSpec ( VPIImageFormat  fmt,
VPIColorSpec  colorSpec 
)

Set the image format's color standard.

Only valid for color models that represent image coding systems, such as RGB, Y'CrCb, HSV, etc. For other color models, it'll return VPI_IMAGE_FORMAT_INVALID.

Parameters
[in]fmtImage format have its color spec replaced.
[in]colorSpecThe new color standard.
Returns
The new image format based on input's, but with the user-provided color spec, or VPI_IMAGE_FORMAT_INVALID if color standard isn't applicable to format's color model.

◆ vpiImageFormatSetDataType()

VPIImageFormat vpiImageFormatSetDataType ( VPIImageFormat  fmt,
VPIDataType  dataType 
)

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 
)

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.

◆ vpiImageFormatSetRawPattern()

VPIImageFormat vpiImageFormatSetRawPattern ( VPIImageFormat  fmt,
VPIRawPattern  rawPattern 
)

Sets the raw color pattern of the image format.

Parameters
[in]fmtImage format to be updated.
[in]rawPatternThe new raw pattern.
Returns
If image format's color model is VPI_COLOR_MODEL_RAW, the new image format with the updated raw pattern will be returned, or else VPI_IMAGE_FORMAT_INVALID.

◆ vpiImageFormatSetSwizzleAndPacking()

VPIImageFormat vpiImageFormatSetSwizzleAndPacking ( VPIImageFormat  fmt,
VPISwizzle  swizzle,
VPIPacking  packing0,
VPIPacking  packing1,
VPIPacking  packing2,
VPIPacking  packing3 
)

Replaces the swizzle and packing of an existing image format.

If replacing the fourth (plane==3) packing, the packing's bits per pixel must be at most 64.

The number of channels represented by the swizzle must be equal to the sum of the number of channels represented by the packings. For instance, XYZ1,X8,X8Y8 is a valid combination with 3 channels. XYZW,X8,X8Y8 isn't as swizzle has 4 channels, and X8,X8Y8 represents in total 3 channels.

Parameters
[in]fmtImage format to have its packing replaced.
[in]swizzleThe new swizzle. Pass VPI_SWIZZLE_INVALID if swizzle must not be updated.
[in]packing0,packing1,packing2,packing3New packing. Pass VPI_PACKING_INVALID if the packing for a particular plane must not be updated.
Returns
Updated image format, or VPI_IMAGE_FORMAT_INVALID if operation is invalid.

◆ vpiMakeColorImageFormat()

VPIImageFormat vpiMakeColorImageFormat ( VPIColorModel  colorModel,
VPIColorSpec  colorSpec,
VPIMemLayout  memLayout,
VPIDataType  dataType,
VPISwizzle  swizzle,
VPIPacking  packing0,
VPIPacking  packing1,
VPIPacking  packing2,
VPIPacking  packing3 
)

Creates a user-defined color 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.

If the color model is VPI_COLOR_MODEL_YCbCr, it's assumed that the chroma subsampling is 4:4:4, i.e, VPI_CSS_444.

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]colorModelVPIColorModel to be used.
[in]colorSpecVPIColorSpec to be used.
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType 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_PACKING_0 for them.
Returns
The user-defined image format.

◆ vpiMakeImageFormatFromFourCC()

VPIImageFormat vpiMakeImageFormatFromFourCC ( uint32_t  fourcc,
VPIColorSpec  colorSpec,
VPIMemLayout  memLayout 
)

Creates a image format from a FourCC code.

See https://www.fourcc.org for more information about FourCC.

Parameters
[in]fourccFourCC code.
[in]colorSpecVPIColorSpec to be used.
[in]memLayoutVPIMemLayout to be used.
Returns
The image format corresponding to the FourCC code.

◆ vpiMakeImageFormatFromPlanes()

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

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.

◆ vpiMakeNonColorImageFormat()

VPIImageFormat vpiMakeNonColorImageFormat ( VPIMemLayout  memLayout,
VPIDataType  dataType,
VPISwizzle  swizzle,
VPIPacking  packing0,
VPIPacking  packing1,
VPIPacking  packing2,
VPIPacking  packing3 
)

Creates a user-defined non-color image format.

When the pre-defined non-color image formats aren't enough, it is possible to define new ones.

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.

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType 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_PACKING_0 for them.
Returns
The user-defined image format.

◆ vpiMakeRawImageFormat()

VPIImageFormat vpiMakeRawImageFormat ( VPIRawPattern  rawPattern,
VPIMemLayout  memLayout,
VPIDataType  dataType,
VPISwizzle  swizzle,
VPIPacking  packing0,
VPIPacking  packing1,
VPIPacking  packing2,
VPIPacking  packing3 
)

Creates a user-defined raw image format.

When the pre-defined raw image formats aren't enough, it is possible to define new ones.

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.

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]rawPatternVPIRawPattern to be used.
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType 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_PACKING_0 for them.
Returns
The user-defined image format.

◆ vpiMakeYCbCrImageFormat()

VPIImageFormat vpiMakeYCbCrImageFormat ( VPIColorSpec  colorSpec,
VPIChromaSubsampling  chromaSub,
VPIMemLayout  memLayout,
VPIDataType  dataType,
VPISwizzle  swizzle,
VPIPacking  packing0,
VPIPacking  packing1,
VPIPacking  packing2,
VPIPacking  packing3 
)

Creates a user-defined YCbCr color 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.

Fourth plane (packing3) must have at most 64bpp.

Parameters
[in]colorSpecVPIColorSpec to be used.
[in]chromaSubVPIChromaSubsampling to be used.
[in]memLayoutVPIMemLayout to be used.
[in]dataTypeVPIDataType 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_PACKING_0 for them.
Returns
The user-defined image format.