NVIDIA DRIVE OS Linux SDK API Reference

6.0.3 Release

Detailed Description

Blit functions define valid parameters for a blit.

Data Structures

struct  NvMedia2DBlitParameters
 Stores configuration for the NvMedia2DBlitEx() operation. More...
 
struct  NvMedia2DBlitParametersOut
 Stores information returned from NvMedia2DBlitEx(). More...
 

Typedefs

typedef struct NvMedia2D NvMedia2D
 NvMedia2D Context. More...
 

Enumerations

enum  NvMedia2DBlitParamField {
  NVMEDIA_2D_BLIT_PARAMS_FILTER = (1u << 0),
  NVMEDIA_2D_BLIT_PARAMS_FLAGS = (1u << 1),
  NVMEDIA_2D_BLIT_PARAMS_DST_TRANSFORM = (1u << 2),
  NVMEDIA_2D_BLIT_PARAMS_COLOR_STD = (1u << 3)
}
 Parameter flags for NvMedia2DBlitEx(). More...
 

Functions

NvMedia2DNvMedia2DCreate (NvMediaDevice *device)
 Creates a new NvMedia2D context. More...
 
void NvMedia2DDestroy (NvMedia2D *i2d)
 Destroys the NvMedia2D context. More...
 
NvMediaStatus NvMedia2DDestroyEx (NvMedia2D *i2d)
 Destroys the NvMedia2D context. More...
 
NvMediaStatus NvMedia2DBlitEx (const NvMedia2D *i2d, const NvMediaImage *dstSurface, const NvMediaRect *dstRect, const NvMediaImage *srcSurface, const NvMediaRect *srcRect, const NvMedia2DBlitParameters *params, NvMedia2DBlitParametersOut *paramsOut)
 Performs a 2D blit operation. More...
 
NvMediaStatus NvMedia2DCopyPlaneNew (const NvMedia2D *i2d, NvMediaImage *dstSurface, uint32_t dstPlane, NvMediaImage *srcSurface, uint32_t srcPlane)
 Copies a plane of a YUV image to another YUV image. More...
 

Typedef Documentation

◆ NvMedia2D

typedef struct NvMedia2D NvMedia2D

NvMedia2D Context.

This type represents a context for the NvMedia2D library. This context is an opaque data type that encapsulates the state needed to service the NvMedia2D API calls.

See also
NvMedia2DCreate()

Definition at line 311 of file multimedia/tvmr/include/nvmedia_2d.h.

Enumeration Type Documentation

◆ NvMedia2DBlitParamField

Parameter flags for NvMedia2DBlitEx().

This enum defines the valid parameters that can be passed to the NvMedia2DBlitEx() function. These flags form a bitset of boolean values that are allowed to be passed in the validFields field of the NvMedia2DBlitParameters struct.

See also
NvMedia2DBlitParameters::validFields
NvMedia2DBlitEx()
Enumerator
NVMEDIA_2D_BLIT_PARAMS_FILTER 

Enable NvMedia2DBlitParameters.filter field.

NVMEDIA_2D_BLIT_PARAMS_FLAGS 

Enable NvMedia2DBlitParameters.flags field.

NVMEDIA_2D_BLIT_PARAMS_DST_TRANSFORM 

Enable NvMedia2DBlitParameters.dstTransform field.

NVMEDIA_2D_BLIT_PARAMS_COLOR_STD 

Enable NvMedia2DBlitParameters.colorStandard field.

Definition at line 196 of file multimedia/tvmr/include/nvmedia_2d.h.

Function Documentation

◆ NvMedia2DBlitEx()

NvMediaStatus NvMedia2DBlitEx ( const NvMedia2D i2d,
const NvMediaImage dstSurface,
const NvMediaRect dstRect,
const NvMediaImage srcSurface,
const NvMediaRect srcRect,
const NvMedia2DBlitParameters params,
NvMedia2DBlitParametersOut paramsOut 
)

Performs a 2D blit operation.

A blit transfers pixels from a source surface to a destination surface, applying a variety of transformations to the pixel values on the way.

Note
For a YUV surface type with 16-bit depth, only scale and crop are supported. Format conversion is not supported.

The interface is designed to simplify the typical uses of normal pixel copy by not requiring advanced blit parameters to be set unless they are actually required.

Set params to NULL to invoke a standard pixel copy blit without additional transformations. If the dimensions of the source rectangle do not match the dimensions of the destination rectangle, the blit scales the pixels to fit the destination rectangle. The filtering mode for scale defaults to NVMEDIA_2D_STRETCH_FILTER_LOW. You can use additional filtering modes by setting the corresponding parameter in NvMedia2DBlitParameters.

Set srcRect or dstRect to NULL to default to a source or destination rectangle the size of the full source or destination surface.

This example performs a straight pixel copy between surfaces of the same dimensions (but not necessarily the same bit depth or color format):

NvMedia2DBlitEx(i2d, dst, NULL, src, NULL, NULL, NULL);

Default values (when not specified by caller):

  • srcRect: a rectangle set to the dimensions of the source surface.
  • dstRect: a rectangle set to the dimensions of the destination surface.
  • filter: NVMEDIA_2D_STRETCH_FILTER_LOW
  • dstTransform: NVMEDIA_TRANSFORM_NONE
  • colorStandard: NVMEDIA_COLOR_STANDARD_ITUR_BT_601

Restrictions on dimensions for input and output surfaces:

  • For 16-bit YUV/YUVX/Y formats:
    • Width must be within the range: [64, 8192]
    • Height must be within the range: [64, 8192]
  • For any other supported format:
    • Width must be within the range: [64, 16384]
    • Height must be within the range: [64, 16384]

Additional restrictions for chroma sub-sampled YUV formats:

  • 444:
    • Width: no restriction
    • Height: no restriction
  • 422:
    • Width: must be a multiple of 2
    • Height: no restriction
  • 422R:
    • Width: no restriction
    • Height: must be a multiple of 2
  • 420:
    • Width: must be a multiple of 2
    • Height: must be a multiple of 2

Restrictions on the source rectangle:

  • Must be within the bounds of the source surface.
  • Width and height must be greater than zero.

Restrictions on the destination rectangle:

  • Must be within the bounds of the destination surface.
  • Width and height must be greater than zero.
  • For 16-bit formats, top-left corner must be zero.
  • For any YUV format with chroma subsampling different than 444, all corners must be aligned to a a multiple of 2.
Parameters
[in]i2dPointer to the NvMedia2D context.
[in]dstSurfacePointer to an NvMediaImage object to be used as the destination surface.
[in]dstRectPointer to an NvMediaRect that contains the destination rectangle, or NULL for default rectangle.
[in]srcSurfacePointer to an NvMediaImage object to be used as the source surface.
[in]srcRectPointer to an NvMediaRect that contains the source rectangle, or NULL for default rectangle.
[in]paramsPointer to NvMedia2DBlitParameters struct, or NULL for default blit parameters.
[out]paramsOutPointer to NvMedia2DBlitParametersOut struct. This parameter is for internal use only, and can be set to NULL.
Returns
An NvMediaStatus return code.
Return values
NVMEDIA_STATUS_OKOperation submitted successfully.
NVMEDIA_STATUS_BAD_PARAMETEROne of the parameters has an invalid value. This could be:
  • i2d is NULL
  • dstSurface is NULL
  • dstRect is invalid
  • srcSurface is NULL
  • srcRect is invalid
  • params has an invalid value for some field.
NVMEDIA_STATUS_NOT_SUPPORTEDRequested operation is not supported by current platform.
NVMEDIA_STATUS_TIMED_OUTNo space available in the command buffer for this operation, because previous operations are still pending. The caller should wait for the least recently submitted operation to complete and then try again.
NVMEDIA_STATUS_UNDEFINED_STATEThere was en error when trying to submit the operation to hardware. This error indicates the system is potentially in an unrecoverable state.
NVMEDIA_STATUS_ERRORThe operation cannot be handled due to either:
  • there is no conversion possible between source and destination surface types
  • there are too many pre-fences associated with the source and destination surfaces.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No
See also
NvMedia2DBlitParameters

◆ NvMedia2DCopyPlaneNew()

NvMediaStatus NvMedia2DCopyPlaneNew ( const NvMedia2D i2d,
NvMediaImage dstSurface,
uint32_t  dstPlane,
NvMediaImage srcSurface,
uint32_t  srcPlane 
)

Copies a plane of a YUV image to another YUV image.

The source and the destination must have the same format.

Parameters
[in]i2dPointer to the NvMedia2D context.
[in]dstSurfacePointer to an NvMediaImage object to be used as the destination surface.
[in]dstPlaneIndex of the YUV plane in destination surface.
[in]srcSurfacePointer to an NvMediaImage object to be used as the source surface.
[in]srcPlaneIndex of the YUV plane in source surface.
Returns
An NvMediaStatus return code.
Return values
NVMEDIA_STATUS_OKOperation submitted successfully.
NVMEDIA_STATUS_BAD_PARAMETEROne of the parameters has an invalid value. This could be:
  • i2d is NULL
  • dstSurface is NULL
  • dstPlane index is invalid
  • srcSurface is NULL
  • srcPlane index is invalid
NVMEDIA_STATUS_NOT_SUPPORTEDRequested operation is not supported by current platform.
NVMEDIA_STATUS_TIMED_OUTNo space available in the command buffer for this operation, because previous operations are still pending. The caller should wait for the least recently submitted operation to complete and then try again.
NVMEDIA_STATUS_UNDEFINED_STATEThere was en error when trying to submit the operation to hardware. This error indicates the system is potentially in an unrecoverable state.

◆ NvMedia2DCreate()

NvMedia2D* NvMedia2DCreate ( NvMediaDevice device)

Creates a new NvMedia2D context.

This function creates a new instance of an NvMedia2D context, and returns a pointer to that context. Ownership of this context is passed to the caller. When no longer in use, the caller must destroy the context using the NvMedia2DDestroyEx() function.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: No
Parameters
[in]devicePointer to an NvMediaDevice object. This parameter is no longer used and can be set to NULL.
Returns
Pointer to a NvMedia2D context. If there is a failure when creating the context, this pointer will be NULL.
See also
NvMedia2D
NvMedia2DDestroyEx()

◆ NvMedia2DDestroy()

void NvMedia2DDestroy ( NvMedia2D i2d)

Destroys the NvMedia2D context.

Deprecated:
since Version 3.9, use NvMedia2DDestroyEx() instead.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: No
    • De-Init: Yes
Parameters
[in]i2dPointer to the NvMedia2D context. May be NULL.
See also
NvMedia2D
NvMedia2DCreate()
NvMedia2DDestroyEx()

◆ NvMedia2DDestroyEx()

NvMediaStatus NvMedia2DDestroyEx ( NvMedia2D i2d)

Destroys the NvMedia2D context.

This function destroys the specified NvMedia2D context.

Before calling this function, the caller must ensure:

  • There are no NvSciSync objects still registered against the NvMedia 2D context.
  • There are no NvMediaImage objects still registered against the NvMedia 2D context.
  • All previous 2D operations submitted using NvMedia2DBlitEx() have
    Usage considerations
  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: No
    • De-Init: Yes
Parameters
[in]i2dPointer to the NvMedia2D context.
Returns
An NvMediaStatus return code.
Return values
NVMEDIA_STATUS_OKContext destroyed successfully.
NVMEDIA_STATUS_BAD_PARAMETERi2d is NULL.
NVMEDIA_STATUS_ERRORThere are still some NvSciSync objects registered against the NvMedia 2D context.
See also
NvMedia2D
NvMedia2DCreate()
NvMedia2DBlitEx
NvMediaStatus NvMedia2DBlitEx(const NvMedia2D *i2d, const NvMediaImage *dstSurface, const NvMediaRect *dstRect, const NvMediaImage *srcSurface, const NvMediaRect *srcRect, const NvMedia2DBlitParameters *params, NvMedia2DBlitParametersOut *paramsOut)
Performs a 2D blit operation.