NVIDIA DRIVE OS Linux SDK API Reference

5.1.9.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Image Read and Write by Client

Detailed Description

Provides image surface read and write by the client application for diagnostic purposes.

Warning
These functions are for diagnostics purposes only. They are not for use in production code.

Functions

NvMediaStatus NvMediaImagePutBits (NvMediaImage *image, const NvMediaRect *dstRect, void **srcPntrs, const uint32_t *srcPitches)
 Reads a client memory buffer and writes the content into an NvMedia image surface. More...
 
NvMediaStatus NvMediaImageGetBits (const NvMediaImage *image, const NvMediaRect *srcRect, void **dstPntrs, const uint32_t *dstPitches)
 Reads an NvMedia image and writes the content into a client memory buffer. More...
 

Function Documentation

NvMediaStatus NvMediaImageGetBits ( const NvMediaImage image,
const NvMediaRect srcRect,
void **  dstPntrs,
const uint32_t *  dstPitches 
)

Reads an NvMedia image and writes the content into a client memory buffer.

To use NvMediaImageGetBits() while creating an NvMedia image, NvMediaSurfAllocAttrType must be set to NVM_SURF_ATTR_CPU_ACCESS_UNCACHED or NVM_SURF_ATTR_CPU_ACCESS_CACHED in NvMediaSurfAllocAttr.

Parameters
[in]imageA pointer to the source NvMediaImage type surface. You must lock the surface with NvMediaImageLock() before calling this function.
[in]srcRect

A pointer to a structure containing coordinates of the rectangle in the source surface from which the client surface is to be copied.

Set srcRect to NULL to specify a rectangle of full surface size. srcRect is supported only for an NvMediaImage whose NvMediaSurfaceType was derived with the NVM_SURF_ATTR_SURF_TYPE attribute set to NVM_SURF_ATTR_SURF_TYPE_RGBA or NVM_SURF_ATTR_SURF_TYPE_RAW. For all other surface types, it is ignored.

[out]dstPntrs

A pointer to an array of pointers to the destination surface planes.

For an NvMediaImage whose NvMediaSurfaceType was derived with NVM_SURF_ATTR_SURF_TYPE set to NVM_SURF_ATTR_SURF_TYPE_RGBA or NVM_SURF_ATTR_SURF_TYPE_RAW, NvMediaImageGetBits() expects only one dstPntrs and one dstPitches.

For an NvMediaImage whose NvMediaSurfaceType was derived with the NVM_SURF_ATTR_SURF_TYPE attribute set to NVM_SURF_ATTR_SURF_TYPE_YUV and:

  1. The NVM_SURF_ATTR_COMPONENT_ORDER attribute set to NVM_SURF_ATTR_COMPONENT_ORDER_LUMA, NVM_SURF_ATTR_COMPONENT_ORDER_XUYV, NVM_SURF_ATTR_COMPONENT_ORDER_XYUV, or NVM_SURF_ATTR_COMPONENT_ORDER_VUYX, this API expects only one dstPntrs and one dstPitches.
  2. For all other YUV surface types, NvMediaImageGetBits() expects three dstPntrs and three dstPitches.

    Example: For the NvMediaSurfaceType derived with the attribute set using NVM_SURF_FMT_SET_ATTR_YUV(attr, YUV, 420, SEMI_PLANAR, UINT, 8, PL), NvMediaImageGetBits() expects three dstPntrs and three dstPitches, corresponding respectively to the Y, U and V planes.

[in]dstPitchesA pointer to an array of pitch values for the destination surface planes. There number of pitch values must be the same as the number of surface planes.
Return values
NVMEDIA_STATUS_OKindicates that the call was successful.
NVMEDIA_STATUS_BAD_PARAMETERindicates that one or more input parameters are invalid.
NVMEDIA_STATUS_ERRORindicates that the image is not locked.
NvMediaStatus NvMediaImagePutBits ( NvMediaImage image,
const NvMediaRect dstRect,
void **  srcPntrs,
const uint32_t *  srcPitches 
)

Reads a client memory buffer and writes the content into an NvMedia image surface.

To use NvMediaImagePutBits() while creating an NvMedia image, you must set NvMediaSurfAllocAttrType in NvMediaSurfAllocAttr to NVM_SURF_ATTR_CPU_ACCESS_UNCACHED or NVM_SURF_ATTR_CPU_ACCESS_CACHED.

Parameters
[in]imageA pointer to the destination NvMediaImage type surface. You must lock the image with NvMediaImageLock() before calling this function.
[in]dstRect

A pointer to a structure containing co-ordinates of the rectangle in the destination surface to which the client surface is to be copied.

Set dstRect to NULL to specify a rectangle of full surface size. dstRect is supported only for an NvMediaImage whose NvMediaSurfaceType was derived with the NVM_SURF_ATTR_SURF_TYPE attribute set to NVM_SURF_ATTR_SURF_TYPE_RGBA or NVM_SURF_ATTR_SURF_TYPE_RAW. For all other surface types, it is ignored.

[in]srcPntrs

A pointer to an array of pointers to the client surface planes.

For an NvMediaImage whose NvMediaSurfaceType was derived with the NVM_SURF_ATTR_SURF_TYPE attribute set to NVM_SURF_ATTR_SURF_TYPE_RGBA or NVM_SURF_ATTR_SURF_TYPE_RAW, NvMediaImagePutBits() expects only one srcPntrs and one srcPitches.

For NvMediaImages whose NvMediaSurfaceType was derived with the NVM_SURF_ATTR_SURF_TYPE attribute set to NVM_SURF_ATTR_SURF_TYPE_YUV and:

  1. The NVM_SURF_ATTR_COMPONENT_ORDER attribute set to NVM_SURF_ATTR_COMPONENT_ORDER_LUMA, NVM_SURF_ATTR_COMPONENT_ORDER_XUYV, NVM_SURF_ATTR_COMPONENT_ORDER_XYUV, or NVM_SURF_ATTR_COMPONENT_ORDER_VUYX, NvMediaImagePutBits() expects only one srcPntrs and one srcPitches.
  2. For all other YUV surface types, NvMediaImagePutBits() expects three srcPntrs and three srcPitches.

    Example: For the NvMediaSurfaceType derived with attribute set using NVM_SURF_FMT_SET_ATTR_YUV(attr, YUV, 420, SEMI_PLANAR, UINT, 8, PL), NvMediaImagePutBits() expects three srcPntrs and three srcPitches corresponding respectively to the Y, U and V planes.

[in]srcPitchesA pointer to an array of pitch values for the client surface planes. The number of pitch values must be the same as the number of surface planes on srcPntrs.
Return values
NVMEDIA_STATUS_OKindicates that the call was successful.
NVMEDIA_STATUS_BAD_PARAMETERindicates that one or more input parameters are invalid.
NVMEDIA_STATUS_ERRORindicates that the image is not locked.