VPI - Vision Programming Interface

3.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_IMAGE_FORMAT_INVALID   ((VPIImageFormat)0)
 Denotes an invalid image format.
 
#define VPI_IMAGE_FORMAT_U8   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, UNSIGNED, X000, X8)
 Single plane with one 8-bit unsigned integer channel.
 
#define VPI_IMAGE_FORMAT_U8_BL   VPI_DETAIL_MAKE_NONCOLOR_FMT1(BL, UNSIGNED, X000, X8)
 Single plane with one block-linear 8-bit unsigned integer channel.
 
#define VPI_IMAGE_FORMAT_S8   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, SIGNED, X000, X8)
 Single plane with one 8-bit signed integer channel.
 
#define VPI_IMAGE_FORMAT_U16   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, UNSIGNED, X000, X16)
 Single plane with one 16-bit unsigned integer channel.
 
#define VPI_IMAGE_FORMAT_U32   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, UNSIGNED, X000, X32)
 Single plane with one 32-bit unsigned integer channel.
 
#define VPI_IMAGE_FORMAT_S32   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, SIGNED, X000, X32)
 Single plane with one 32-bit signed integer channel.
 
#define VPI_IMAGE_FORMAT_S16   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, SIGNED, X000, X16)
 Single plane with one 16-bit signed integer channel.
 
#define VPI_IMAGE_FORMAT_S16_BL   VPI_DETAIL_MAKE_NONCOLOR_FMT1(BL, SIGNED, X000, X16)
 Single plane with one block-linear 16-bit signed integer channel.
 
#define VPI_IMAGE_FORMAT_2S16   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, SIGNED, XY00, X16_Y16)
 Single plane with two interleaved 16-bit signed integer channel.
 
#define VPI_IMAGE_FORMAT_2S16_BL   VPI_DETAIL_MAKE_NONCOLOR_FMT1(BL, SIGNED, XY00, X16_Y16)
 Single plane with two interleaved block-linear 16-bit signed integer channel.
 
#define VPI_IMAGE_FORMAT_F32   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, FLOAT, X000, X32)
 Single plane with one 32-bit floating point channel.
 
#define VPI_IMAGE_FORMAT_F64   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, FLOAT, X000, X64)
 Single plane with one 64-bit floating point channel.
 
#define VPI_IMAGE_FORMAT_2F32   VPI_DETAIL_MAKE_NONCOLOR_FMT1(PL, FLOAT, XY00, X32_Y32)
 Single plane with two interleaved 32-bit floating point channels.
 
#define VPI_IMAGE_FORMAT_Y8   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, PL, UNSIGNED, X000, X8)
 Single plane with one pitch-linear 8-bit unsigned integer channel with limited-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_Y8_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, BL, UNSIGNED, X000, X8)
 Single plane with one block-linear 8-bit unsigned integer channel with limited-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_Y8_ER   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, PL, UNSIGNED, X000, X8)
 Single plane with one pitch-linear 8-bit unsigned integer channel with full-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_Y8_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, BL, UNSIGNED, X000, X8)
 Single plane with one block-linear 8-bit unsigned integer channel with full-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_Y16   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, PL, UNSIGNED, X000, X16)
 Single plane with one pitch-linear 16-bit unsigned integer channel with limited-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_Y16_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, BL, UNSIGNED, X000, X16)
 Single plane with one block-linear 16-bit unsigned integer channel with limited-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_Y16_ER   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, PL, UNSIGNED, X000, X16)
 Single plane with one pitch-linear 16-bit unsigned integer channel with full-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_Y16_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, BL, UNSIGNED, X000, X16)
 Single plane with one block-linear 16-bit unsigned integer channel with full-range luma (grayscale) information. More...
 
#define VPI_IMAGE_FORMAT_NV12   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 420, PL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV420sp 8-bit pitch-linear format with limited range. More...
 
#define VPI_IMAGE_FORMAT_NV12_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 420, BL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV420sp 8-bit block-linear format with limited range. More...
 
#define VPI_IMAGE_FORMAT_NV12_ER   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 420, PL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV420sp 8-bit pitch-linear format with full range. More...
 
#define VPI_IMAGE_FORMAT_NV12_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 420, BL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV420sp 8-bit block-linear format with full range. More...
 
#define VPI_IMAGE_FORMAT_NV24   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 444, PL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV444sp 8-bit pitch-linear format with limited range. More...
 
#define VPI_IMAGE_FORMAT_NV24_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 444, BL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV444sp 8-bit block-linear format with limited range. More...
 
#define VPI_IMAGE_FORMAT_NV24_ER   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 444, PL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV444sp 8-bit pitch-linear format with full range. More...
 
#define VPI_IMAGE_FORMAT_NV24_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 444, BL, UNSIGNED, XYZ0, X8, X8_Y8)
 YUV444sp 8-bit block-linear format with full range. More...
 
#define VPI_IMAGE_FORMAT_UYVY   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, 422, PL, UNSIGNED, XYZ1, Y8_X8__Z8_X8)
 YUV422 8-bit pitch-linear format in one plane with UYVY ordering and limited range.
 
#define VPI_IMAGE_FORMAT_UYVY_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, 422, BL, UNSIGNED, XYZ1, Y8_X8__Z8_X8)
 YUV422 8-bit block-linear format in one plane with UYVY ordering and limited range.
 
#define VPI_IMAGE_FORMAT_UYVY_ER   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, 422, PL, UNSIGNED, XYZ1, Y8_X8__Z8_X8)
 YUV422 8-bit pitch-linear format in one plane with UYVY ordering and full range.
 
#define VPI_IMAGE_FORMAT_UYVY_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, 422, BL, UNSIGNED, XYZ1, Y8_X8__Z8_X8)
 YUV422 8-bit block-linear format in one plane with UYVY ordering and full range.
 
#define VPI_IMAGE_FORMAT_YUYV   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, 422, PL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)
 YUV422 8-bit pitch-linear format in one plane with YUYV ordering and limited range. More...
 
#define VPI_IMAGE_FORMAT_YUYV_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, 422, BL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)
 YUV422 8-bit block-linear format in one plane with YUYV ordering and limited range. More...
 
#define VPI_IMAGE_FORMAT_YUYV_ER   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, 422, PL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)
 YUV422 8-bit pitch-linear format in one plane with YUYV ordering and full range. More...
 
#define VPI_IMAGE_FORMAT_YUYV_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, 422, BL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)
 YUV422 8-bit block-linear format in one plane with YUYV ordering and full range. More...
 
#define VPI_IMAGE_FORMAT_RGB8   VPI_DETAIL_MAKE_COLOR_FMT1(RGB, UNDEFINED, PL, UNSIGNED, XYZ1, X8_Y8_Z8)
 Single plane with interleaved RGB 8-bit channel.
 
#define VPI_IMAGE_FORMAT_BGR8   VPI_DETAIL_MAKE_COLOR_FMT1(RGB, UNDEFINED, PL, UNSIGNED, ZYX1, X8_Y8_Z8)
 Single plane with interleaved BGR 8-bit channel.
 
#define VPI_IMAGE_FORMAT_RGBA8   VPI_DETAIL_MAKE_COLOR_FMT1(RGB, UNDEFINED, PL, UNSIGNED, XYZW, X8_Y8_Z8_W8)
 Single plane with interleaved RGBA 8-bit channel.
 
#define VPI_IMAGE_FORMAT_BGRA8   VPI_DETAIL_MAKE_COLOR_FMT1(RGB, UNDEFINED, PL, UNSIGNED, ZYXW, X8_Y8_Z8_W8)
 Single plane with interleaved BGRA 8-bit channel.
 
#define VPI_IMAGE_FORMAT_RGB8p   VPI_DETAIL_MAKE_COLOR_FMT3(RGB, UNDEFINED, PL, UNSIGNED, XYZ1, X8, X8, X8)
 Planar RGB with unsigned 8-bit channels.
 
#define VPI_IMAGE_FORMAT_BGR8p   VPI_DETAIL_MAKE_COLOR_FMT3(RGB, UNDEFINED, PL, UNSIGNED, ZYX1, X8, X8, X8)
 Planar BGR with unsigned 8-bit channels.
 
#define VPI_IMAGE_FORMAT_RGBA8p   VPI_DETAIL_MAKE_COLOR_FMT4(RGB, UNDEFINED, PL, UNSIGNED, XYZW, X8, X8, X8, X8)
 Planar RGBA with unsigned 8-bit channels.
 
#define VPI_IMAGE_FORMAT_BGRA8p   VPI_DETAIL_MAKE_COLOR_FMT4(RGB, UNDEFINED, PL, UNSIGNED, ZYXW, X8, X8, X8, X8)
 Planar BGRA with unsigned 8-bit channels.
 
#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, swizzle, numPlanes, packing0, packing1, ...)
 Creates a user-defined non-color image format constant using abbreviated parameters. More...
 
#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT(memLayout, dataType, swizzle, 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...
 
typedef uint64_t 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...
 
int32_t vpiImageFormatGetPlaneWidth (VPIImageFormat fmt, int32_t imgWidth, int plane)
 Get the plane width of an image with the given image format and width. More...
 
int32_t vpiImageFormatGetPlaneHeight (VPIImageFormat fmt, int32_t imgHeight, int plane)
 Get the plane height of an image with the given image format and height. 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_IMAGE_FORMAT_Y8

#define VPI_IMAGE_FORMAT_Y8   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, PL, UNSIGNED, X000, X8)

Single plane with one pitch-linear 8-bit unsigned integer channel with limited-range luma (grayscale) information.

Values range from 16 to 235. Below this range is considered black, above is considered white.

Definition at line 141 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_Y8_BL

#define VPI_IMAGE_FORMAT_Y8_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, BL, UNSIGNED, X000, X8)

Single plane with one block-linear 8-bit unsigned integer channel with limited-range luma (grayscale) information.

Values range from 16 to 235. Below this range is considered black, above is considered white.

Definition at line 146 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_Y8_ER

#define VPI_IMAGE_FORMAT_Y8_ER   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, PL, UNSIGNED, X000, X8)

Single plane with one pitch-linear 8-bit unsigned integer channel with full-range luma (grayscale) information.

Values range from 0 to 255.

Definition at line 151 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_Y8_ER_BL

#define VPI_IMAGE_FORMAT_Y8_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, BL, UNSIGNED, X000, X8)

Single plane with one block-linear 8-bit unsigned integer channel with full-range luma (grayscale) information.

Values range from 0 to 255.

Definition at line 156 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_Y16

#define VPI_IMAGE_FORMAT_Y16   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, PL, UNSIGNED, X000, X16)

Single plane with one pitch-linear 16-bit unsigned integer channel with limited-range luma (grayscale) information.

Values range from 4096 to 60160. Below this range is considered black, above is considered white.

Definition at line 161 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_Y16_BL

#define VPI_IMAGE_FORMAT_Y16_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, NONE, BL, UNSIGNED, X000, X16)

Single plane with one block-linear 16-bit unsigned integer channel with limited-range luma (grayscale) information.

Values range from 4096 to 60160. Below this range is considered black, above is considered white.

Definition at line 166 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_Y16_ER

#define VPI_IMAGE_FORMAT_Y16_ER   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, PL, UNSIGNED, X000, X16)

Single plane with one pitch-linear 16-bit unsigned integer channel with full-range luma (grayscale) information.

Values range from 0 to 65535.

Definition at line 171 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_Y16_ER_BL

#define VPI_IMAGE_FORMAT_Y16_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, NONE, BL, UNSIGNED, X000, X16)

Single plane with one block-linear 16-bit unsigned integer channel with full-range luma (grayscale) information.

Values range from 0 to 65535.

Definition at line 176 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV12

#define VPI_IMAGE_FORMAT_NV12   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 420, PL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV420sp 8-bit pitch-linear format with limited range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 16 to 235.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 16 to 240. Resolution is half of luma plane, both horizontally and vertically. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 186 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV12_BL

#define VPI_IMAGE_FORMAT_NV12_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 420, BL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV420sp 8-bit block-linear format with limited range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 16 to 235.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 0 to 255. Resolution is half of luma plane, both horizontally and vertically. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 196 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV12_ER

#define VPI_IMAGE_FORMAT_NV12_ER   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 420, PL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV420sp 8-bit pitch-linear format with full range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 0 to 255.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 0 to 255. Resolution is half of luma plane, both horizontally and vertically. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 206 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV12_ER_BL

#define VPI_IMAGE_FORMAT_NV12_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 420, BL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV420sp 8-bit block-linear format with full range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 0 to 255.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 0 to 255. Resolution is half of luma plane, both horizontally and vertically. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 216 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV24

#define VPI_IMAGE_FORMAT_NV24   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 444, PL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV444sp 8-bit pitch-linear format with limited range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 16 to 235.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 16 to 240. It has the same resolution as luma plane. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 225 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV24_BL

#define VPI_IMAGE_FORMAT_NV24_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601, 444, BL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV444sp 8-bit block-linear format with limited range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 16 to 235.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 0 to 255. It has the same resolution as luma plane. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 234 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV24_ER

#define VPI_IMAGE_FORMAT_NV24_ER   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 444, PL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV444sp 8-bit pitch-linear format with full range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 0 to 255.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 0 to 255. It has the same resolution as luma plane. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 243 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_NV24_ER_BL

#define VPI_IMAGE_FORMAT_NV24_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT2(BT601_ER, 444, BL, UNSIGNED, XYZ0, X8, X8_Y8)

YUV444sp 8-bit block-linear format with full range.

Format is composed of two planes:

  1. One 8-bit channel with luma (Y'). Values range from 0 to 255.
  2. Two interleaved 8-bit channels with chroma (Cb,Cr). Values range from 0 to 255. It has the same resolution as luma plane. For a given pixel, Cb channel has lower memory address than Cr.

Definition at line 252 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_YUYV

#define VPI_IMAGE_FORMAT_YUYV   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, 422, PL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)

YUV422 8-bit pitch-linear format in one plane with YUYV ordering and limited range.

Also known as YUY2 format.

Definition at line 269 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_YUYV_BL

#define VPI_IMAGE_FORMAT_YUYV_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601, 422, BL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)

YUV422 8-bit block-linear format in one plane with YUYV ordering and limited range.

Also known as YUY2 format.

Definition at line 274 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_YUYV_ER

#define VPI_IMAGE_FORMAT_YUYV_ER   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, 422, PL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)

YUV422 8-bit pitch-linear format in one plane with YUYV ordering and full range.

Also known as YUY2 format.

Definition at line 279 of file ImageFormat.h.

◆ VPI_IMAGE_FORMAT_YUYV_ER_BL

#define VPI_IMAGE_FORMAT_YUYV_ER_BL   VPI_DETAIL_MAKE_YCbCr_FMT1(BT601_ER, 422, BL, UNSIGNED, XYZ1, X8_Y8__X8_Z8)

YUV422 8-bit block-linear format in one plane with YUYV ordering and full range.

Also known as YUY2 format.

Definition at line 284 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:331
uint64_t VPIImageFormat
Pre-defined image formats.
Definition: ImageFormat.h:94

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 331 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:360
#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:256
@ VPI_CSS_422R
4:2:2R BT.601 sub-sampling.
Definition: ColorSpec.h:413
@ VPI_SWIZZLE_XYZ0
Definition: DataLayout.h:356
@ VPI_PACKING_X8
One 8-bit channel.
Definition: DataLayout.h:144
@ VPI_PACKING_X8_Y8
Two 8-bit channels in two 8-bit words.
Definition: DataLayout.h:164
@ VPI_DATA_TYPE_UNSIGNED
Channels are unsigned integer values.
Definition: DataLayout.h:270

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 360 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:389

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.

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.
  • Fourth plane (packing3) must have at most 64bpp.
Returns
The user-defined image format.

Definition at line 389 of file ImageFormat.h.

◆ 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:419
@ VPI_COLOR_MODEL_RGB
red, green, blue components.
Definition: ColorSpec.h:80
@ VPI_MEM_LAYOUT_BL
Definition: DataLayout.h:315

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.

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.
  • Fourth plane (packing3) must have at most 64bpp.
Returns
The user-defined image format.

Definition at line 419 of file ImageFormat.h.

◆ VPI_MAKE_NONCOLOR_IMAGE_FORMAT_ABBREV

#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT_ABBREV (   memLayout,
  dataType,
  swizzle,
  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, swizzle, numPlanes, packing0, packing1,...)
Creates a user-defined non-color image format constant using abbreviated parameters.
Definition: ImageFormat.h:444
Parameters
[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.
[in]numPlanesNumber of planes this format has.
[in]packing0,packing1,...Format packing of each plane, without the VPI_PACKING_ prefix.
  • Fourth plane (packing3) must have at most 64bpp.
Returns
The user-defined image format.

Definition at line 444 of file ImageFormat.h.

◆ VPI_MAKE_NONCOLOR_IMAGE_FORMAT

#define VPI_MAKE_NONCOLOR_IMAGE_FORMAT (   memLayout,
  dataType,
  swizzle,
  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, swizzle, numPlanes, packing0, packing1,...)
Creates a user-defined non-color image format constant.
Definition: ImageFormat.h:467
@ VPI_PACKING_X32
One 32-bit channel.
Definition: DataLayout.h:202
@ VPI_PACKING_X16
One 16-bit channel.
Definition: DataLayout.h:151
Parameters
[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.
  • Fourth plane (packing3) must have at most 64bpp.
Returns
The user-defined image format.

Definition at line 467 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:491
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 491 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:515
@ VPI_RAW_BAYER_RGGB
Bayer format with X channel mapped to samples as follows:
Definition: ColorSpec.h:310
@ VPI_SWIZZLE_X000
Definition: DataLayout.h:363
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 515 of file ImageFormat.h.

Function Documentation

◆ 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.
Return values
VPI_IMAGE_FORMAT_INVALIDSwizzle packing is invalid.
VPI_IMAGE_FORMAT_INVALIDcolorSpec and chromaSub are undefined.

◆ 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.

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.
  • Fourth plane (packing3) must have at most 64bpp.
Returns
The user-defined image format.
Return values
VPI_IMAGE_FORMAT_INVALIDcolorModel is VPI_COLOR_MODEL_UNDEFINED .
VPI_IMAGE_FORMAT_INVALIDcolorModel is VPI_COLOR_MODEL_RAW .
VPI_IMAGE_FORMAT_INVALIDcolorSpec is VPI_COLOR_SPEC_UNDEFINED .
VPI_IMAGE_FORMAT_INVALIDSwizzle packing is invalid.
VPI_IMAGE_FORMAT_INVALIDcolorModel, colorSpec and chromaSub are undefined.
VPI_IMAGE_FORMAT_INVALIDImage format invalid; 4th plane cannot have a 128 bit channel.

◆ 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.
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.
  • Fourth plane (packing3) must have at most 64bpp.
Returns
The user-defined image format.
Return values
VPI_IMAGE_FORMAT_INVALIDImage format to be queried is invalid.
VPI_IMAGE_FORMAT_INVALIDSwizzle packing is invalid.

◆ 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.
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.
  • Fourth plane (packing3) must have at most 64bpp.
Returns
The user-defined image format.
Return values
VPI_IMAGE_FORMAT_INVALIDImage format to be queried is invalid.
VPI_IMAGE_FORMAT_INVALIDrawPattern is invalid.
VPI_IMAGE_FORMAT_INVALIDSwizzle packing is invalid.

◆ 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.
Return values
VPI_IMAGE_FORMAT_INVALIDInvalid fourcc.

◆ 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.
Return values
0No FourCC associated with fmt, e.g. VPI_IMAGE_FORMAT_2F32.

◆ 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.
Return values
VPI_PACKING_0fmt to be queried is invalid.
VPI_PACKING_0plane outside valid range.

◆ vpiImageFormatGetPlaneWidth()

int32_t vpiImageFormatGetPlaneWidth ( VPIImageFormat  fmt,
int32_t  imgWidth,
int  plane 
)

Get the plane width of an image with the given image format and width.

Parameters
[in]fmtImage format to be queried.
[in]imgWidthWidth of the image.
  • Must be >= 1.
[in]planeImage plane to be queried.
  • Must be >= 0 and < the number of planes in the image format.
Returns
The image plane's width.
Return values
0fmt is invalid.
0imgWidth is outside valid range.
0plane is outside valid range.

◆ vpiImageFormatGetPlaneHeight()

int32_t vpiImageFormatGetPlaneHeight ( VPIImageFormat  fmt,
int32_t  imgHeight,
int  plane 
)

Get the plane height of an image with the given image format and height.

Parameters
[in]fmtImage format to be queried.
[in]imgHeightHeight of the image.
  • Must be >= 1.
[in]planeImage plane to be queried.
  • Must be >= 0 and < the number of planes in the image format.
Returns
The image plane's height.
Return values
0fmt is invalid.
0imgHeight is outside valid range.
0plane is outside valid range.

◆ 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.

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.
[in]packing0,packing1,packing2,packing3New packing.
  • Pass VPI_PACKING_INVALID if the packing for a particular plane must not be updated.
  • If replacing the fourth packing (packing3), the packing's bits per pixel must be at most 64.
Returns
Updated image format.
Return values
VPI_IMAGE_FORMAT_INVALIDfmt to be queried is invalid.

◆ 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.
Return values
0fmt is invalid.
0plane outside valid range.

◆ 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.
Return values
VPI_IMAGE_FORMAT_INVALIDfmt to be queried is invalid.
VPI_IMAGE_FORMAT_INVALIDdataType is invalid.

◆ 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.
Return values
VPI_DATA_TYPE_INVALIDfmt to be queried is 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.
Return values
VPI_SWIZZLE_0000fmt to be queried is invalid.

◆ 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.
  • Image format should have less packing channels and swizzle channels.
[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.
Return values
VPI_SWIZZLE_0000fmt to be queried is invalid.
VPI_SWIZZLE_INVALIDMore packing channels than Swizzle channels.

◆ 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.
Return values
VPI_IMAGE_FORMAT_INVALIDfmt to be queried is invalid.
VPI_IMAGE_FORMAT_INVALIDmemLayout is invalid.

◆ 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.
Return values
VPI_MEM_LAYOUT_INVALIDfmt to be queried is invalid.

◆ 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.
Return values
VPI_IMAGE_FORMAT_INVALIDfmt to be queried is invalid.
VPI_IMAGE_FORMAT_INVALIDcolorSpec is invalid.
VPI_IMAGE_FORMAT_INVALIDColor standard isn't applicable to 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.
Return values
VPI_COLOR_SPEC_INVALIDfmt to be queried is invalid.
VPI_COLOR_SPEC_UNDEFINEDIt's not applicable, i.e., format model isn't RGB, YCbCr, HSV or HSL.

◆ 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.
Return values
VPI_COLOR_MODEL_UNDEFINEDfmt to be queried is invalid.

◆ vpiImageFormatSetChromaSubsampling()

VPIImageFormat vpiImageFormatSetChromaSubsampling ( VPIImageFormat  fmt,
VPIChromaSubsampling  css 
)

Set the image format's chroma subsampling type.

Parameters
[in]fmtImage format have its chroma subsampling type replaced.
  • It's only applicable if format has YCbCr color model.
[in]cssThe new chroma subsampling type.
Returns
The new image format based on input's, but with the user-provided chroma subsampling type.
Return values
VPI_IMAGE_FORMAT_INVALIDfmt to be queried is invalid.
VPI_IMAGE_FORMAT_INVALIDcss is invalid.
VPI_CSS_NONEFormat's color model is NOT VPI_COLOR_MODEL_YCbCr.

◆ 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.
Return values
VPI_CSS_INVALIDfmt is not supported.
VPI_CSS_NONEfmt color model is NOT VPI_COLOR_MODEL_YCbCr.

◆ 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.

◆ 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.

◆ 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.

◆ 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.
Return values
VPI_PIXEL_TYPE_INVALIDfmt to be queried is invalid.
VPI_PIXEL_TYPE_INVALIDplane is outside range.

◆ 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.
Return values
VPI_IMAGE_FORMAT_INVALIDfmt packing is invalid.
VPI_IMAGE_FORMAT_INVALIDplane is outside range.

◆ 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.
  • All plane types must have only 1 plane.
  • First plane must have a valid packing.
  • Total number of channels must be at most 4.
  • Color spec, mem layout and data type of all planes must be the same.
  • Only one kind of chroma subsampling is allowed.
  • At least one channel is allowed.
  • All planes after the first invalid one must be invalid.
Returns
The image format whose planes has the given formats.
Return values
VPI_IMAGE_FORMAT_INVALIDImage format to be queried is invalid.
VPI_IMAGE_FORMAT_INVALIDAll plane types must have only 1 plane.
VPI_IMAGE_FORMAT_INVALIDFirst plane must have a valid packing.
VPI_IMAGE_FORMAT_INVALIDTotal number of channels must be atmost 4.
VPI_IMAGE_FORMAT_INVALIDColor spec, mem layout and data type of all planes must be the same.
VPI_IMAGE_FORMAT_INVALIDOnly one kind of chroma subsampling is allowed.
VPI_IMAGE_FORMAT_INVALIDAt least one channel is allowed.
VPI_IMAGE_FORMAT_INVALIDAll planes after the first invalid one must be invalid.

◆ vpiImageFormatGetName()

const char* vpiImageFormatGetName ( VPIImageFormat  fmt)

Returns a string representation of the image format.

Parameters
[in]fmtImage format whose name is 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. Returned pointer must not be freed.

◆ vpiImageFormatGetRawPattern()

VPIRawPattern vpiImageFormatGetRawPattern ( VPIImageFormat  fmt)

Returns the raw color pattern of the image format.

Parameters
[in]fmtImage format to be queried.
Returns
The raw pattern of given raw image format.
Return values
VPI_RAW_INVALIDColor model of fmt is not VPI_COLOR_MODEL_RAW.

◆ 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
The new image format with the updated raw pattern will be returned.
Return values
VPI_IMAGE_FORMAT_INVALIDfmt to be queried is invalid or its color model isn't VPI_COLOR_MODEL_RAW.
VPI_IMAGE_FORMAT_INVALIDrawPattern is invalid.

◆ 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
1Both image formats compares equal with respect to how pixels are laid out in memory.
0Both image formats compares differently.