Enumerations#

This section provides information about the enumerations in the NvCVImage APIs.

NvCVImage_ComponentType#

This enumeration defines the data type that represents one component of a pixel.

NVCV_TYPE_UNKNOWN (0)

Unknown component data type.

NVCV_U8 (1)

Unsigned 8-bit integer.

NVCV_U16 (2)

Unsigned 16-bit integer.

NVCV_S16 (3)

Signed 16-bit integer.

NVCV_F16 (4)

16-bit floating-point number.

NVCV_U32 (5)

Unsigned 32-bit integer.

NVCV_S32 (6)

Signed 32-bit integer.

NVCV_F32 (7)

32-bit floating-point number (float).

NVCV_U64 (8)

Unsigned 64-bit integer.

NVCV_S64 (9)

Signed 64-bit integer.

NVCV_F64 (10)

64-bit floating-point (double).

NvCVImage_PixelFormat#

This enumeration defines the order of the components in a pixel.

NVCV_FORMAT_UNKNOWN

Unknown pixel format.

NVCV_Y

Luminance (gray).

NVCV_A

Alpha (opaque).

NVCV_YA

Luminance, alpha.

NVCV_RGB

Red, green, blue.

NVCV_BGR

Blue, green, red.

NVCV_RGBA

Red, green, blue, alpha.

NVCV_BGRA

Blue, green, red, alpha.

NVCV_YUV420

Luminance and subsampled chrominance (Y, Cb, Cr).

NVCV_YUV444

Luminance and full-bandwidth chrominance (Y, Cb, Cr).

NVCV_YUV422

Luminance and subsampled chrominance (Y, Cb, Cr).

Pixel Organizations#

The components of the pixels in an image can be organized in the following ways:

  • Interleaved pixels (also known as chunky pixels) are compact and are arranged so that the components of each pixel in the image are contiguous.

  • Planar pixels are arranged so that the individual components (such as the red components) of all pixels in the image are grouped together.

  • Semi-planar pixels are a mix between interleaved and planar components. These pixels are found in the video world, where the [Y] component sits in one plane and the [UV] components are interleaved in another plane.

Typically, pixels are interleaved. However, many neural networks perform better with planar pixels.

In the descriptions of the pixel organizations, square brackets ([ ]) are used to indicate how groups of pixel components are arranged. For example:

  • [VYUY] indicates that groups of V, Y, U, and Y components are interleaved.

  • [Y][U][V] indicates that the Y, U, and V components of all pixels are grouped.

  • [Y][UV] indicates that groups of Y components and groups of U and V components are interleaved.

For more information about YUV pixel formats, see YUV pixel formats.

The AR and Video Effects APIs define the following types to specify the pixel organization:

Type

Value

Description

NVCV_INTERLEAVED

NVCV_CHUNKY

0

Each of these types specifies interleaved, or chunky, pixels in which the components of each NVCV_CHUNKY pixel in the image are adjacent.

NVCV_PLANAR

1

This type specifies planar pixels in which the individual components of all pixels in the image are grouped.

NVCV_UYVY

2

This type specifies UYVY pixels, which are in the interleaved YUV 4:2:2 format (default for 4:2:2 and default for non-YUV).

Pixels are arranged in [UYVY] groups.

NVCV_VYUY

4

This type specifies VYUY pixels, which are in the interleaved YUV 4:2:2 format.

NVCV_YUYV

NVCV_YUY2

6

Each of these types specifies YUYV pixels, which are in the interleaved YUV 4:2:2 format.

Pixels are arranged in [YUYV] groups.

NVCV_YVYU

8

This type specifies YVYU pixels, which are in the interleaved YUV 4:2:2 format.

Pixels are arranged in [YVYU] groups.

NVCV_CYUV

10

This type specifies the interleaved (chunky) YUV 4:4:4 pixels.

Pixels are arranged in [YUV] groups.

NVCV_CYVU

12

This type specifies interleaved (chunky) YVU 4:4:4 pixels.

Pixels are arranged in [YVU] groups.

NVCV_YUV

NVCV_I420 (used with NVCV_YUV420)

NVCV_IYUV (used with NVCV_YUV420)

NVCV_I444 (used with NVCV_YUV444)

NVCV_YM24 (used with NVCV_YUV444)

3

Each of these types specifies one of the following planar YUV arrangements:

  • YUV 4:2:2

  • YUV 4:2:0

  • YUV 4:4:4

Pixels are arranged in [Y], [U], and [V] groups.

NVCV_YVU

NVCV_YV12 (used with NVCV_YUV420)

NVCV_YM42 (used with NVCV_YUV444)

5

Each of these types specifies YV12 pixels, which are in the planar YUV 4:2:0, YUV 4:2:2, or YUV 4:4:4 formats.

Pixels are arranged in [Y], [V], and [U] groups.

NVCV_YCUV

NVCV_NV12 (used with NVCV_YUV420)

NVCV_NV24 (used with NVCV_YUV444)

7

Each of these types specifies NV12 pixels, which are in the semiplanar YUV 4:2:2 format, the semiplanar YUV 4:2:0 format (default for 4:2:0), or the semiplanar YUV 4:4:4 format.

Pixels are arranged in [Y] and [UV] groups.

NVCV_YCVU

NVCV_NV21 (used with NVCV_YUV420)

NVCV_NV42 (used with NVCV_YUV444)

9

Each of these types specifies NV21 pixels, which are in the semiplanar YUV 4:2:2 format, the semiplanar YUV 4:2:0 format, or the semiplanar YUV 4:4:4 format.

Pixels are arranged in [Y] and [VU] groups.

Note

FlipY is supported only with the planar 4:2:2 formats (UYVY, VYUY, YUYV, and YVYU) and not with other planar or semiplanar formats.

YUV Color Spaces#

The AR and Video Effects APIs define the following types to specify the YUV color spaces:

Type

Value

Description

NVCV_601

0

This type specifies the Rec.601 YUV color space, which is typically used for standard definition (SD) video.

NVCV_709

1

This type specifies the Rec.709 YUV colorspace, which is typically used for high definition (HD) video.

NVCV_VIDEO_RANGE

0

This type specifies the video range [16, 235].

NVCV_FULL_RANGE

4

This type specifies the video range [0, 255].

NVCV_CHROMA_COSITED

NVCV_CHROMA_MPEG2

0

Each of these types specifies a color space in which the chroma is sampled horizontally in the same location as the luma samples. Most video formats use this sampling scheme.

NVCV_CHROMA_INTSTITIAL

NVCV_CHROMA_MPEG1

8

Each of these types specifies a color space in which the chroma is sampled horizontally midway between luma samples. This sampling scheme is used for JPEG.

Example: Creating an HD NV12 CUDA buffer

NvCVImage *imp = new NvCVImage(1920, 1080, NVCV_YUV420, NVCV_U8, NVCV_NV12, NVCV_CUDA, 0);
imp->colorSpace = NVCV_709 | NVCV_VIDEO_RANGE | NVCV_CHROMA_COSITED;

Example: Wrapping an NvCVImage descriptor around an existing HD NV12 CUDA buffer

NvCVImage img;
NvCVImage_Init(&img, 1920, 1080, 1920, existingBuffer, NVCV_YUV420, NVCV_U8, NVCV_NV12, NVCV_CUDA);
img.colorSpace = NVCV_709 | NVCV_VIDEO_RANGE | NVCV_CHROMA_COSITED;

These are particularly useful and performant for interfacing to the NVDEC video decoder.

Memory Types#

Image data buffers can be stored in different types of memory, which have different address spaces.

Type

Description

NVCV_CPU

The buffer is stored in normal CPU memory.

NVCV_CPU_PINNED

The buffer is stored in pinned CPU memory; this can yield higher transfer rates (115%–200%) between the CPU and GPU but should be used sparingly.

NVCV_GPU

NVCV_CUDA

The buffer is stored in CUDA memory.