NVIDIA DRIVE OS Linux API Reference

5.1.6.1 Release
For Test and Development only

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

Detailed Description

The NvMedia Array API encompasses all NvMedia functions that create, destroy, access and update arrays used in media processing and computer vision applications.

Data Structures

struct  NvMediaArrayAllocAttr
 Holds array allocation attributes. More...
 

Macros

#define NVMEDIA_ARRAY_VERSION_MAJOR   2
 Major version number. More...
 
#define NVMEDIA_ARRAY_VERSION_MINOR   1
 Minor version number. More...
 
#define NVMEDIA_ARRAY_TIMEOUT_INFINITE
 Infinite time-out for NvMediaArrayGetStatus. More...
 
#define NVM_ARRAY_ATTR_CPU_ACCESS_UNCACHED   0x00000000u
 NVM_SURF_ATTR_CPU_ACCESS flags More...
 
#define NVM_ARRAY_ATTR_CPU_ACCESS_CACHED   0x00000001u
 NVM_SURF_ATTR_CPU_ACCESS flag: Cached (mapped) access type flag. More...
 

Typedefs

typedef struct NvMediaArray NvMediaArray
 Holds a descriptor for an array. More...
 

Enumerations

enum  NvMediaArrayType {
  NVMEDIA_ARRAY_TYPE_UNDEFINED = 0,
  NVMEDIA_ARRAY_TYPE_INT8 = 1,
  NVMEDIA_ARRAY_TYPE_UINT8 = 2,
  NVMEDIA_ARRAY_TYPE_INT16 = 3,
  NVMEDIA_ARRAY_TYPE_UINT16 = 4,
  NVMEDIA_ARRAY_TYPE_FLOAT16 = 5,
  NVMEDIA_ARRAY_TYPE_UINT32 = 6,
  NVMEDIA_ARRAY_TYPE_INT32 = 7,
  NVMEDIA_ARRAY_TYPE_FLOAT32 = 8,
  NVMEDIA_ARRAY_NUM_TYPES = 8
}
 Defines the different types of arrays. More...
 
enum  NvMediaArrayAllocAttrType { NVM_ARRAY_ATTR_CPU_ACCESS }
 Defines NvMedia array allocation attribute types. More...
 

Functions

NvMediaStatus NvMediaArrayGetVersion (NvMediaVersion *version)
 Returns version information for the NvMediaArray library. More...
 
NvMediaArrayNvMediaArrayCreate (NvMediaDevice *device, NvMediaArrayType type, uint32_t stride, uint32_t numElements, const NvMediaArrayAllocAttr *attrs, uint32_t numAttrs)
 Creates an NvMedia Array. More...
 
NvMediaStatus NvMediaArrayDestroy (NvMediaArray *handle)
 Destroys an array created by NvMediaArrayCreate(). More...
 
NvMediaStatus NvMediaArrayGetElemSizeForType (NvMediaArrayType type, uint32_t *elementSize)
 Gets the size of a specified type of array element. More...
 
NvMediaStatus NvMediaArrayGetSize (NvMediaArray *handle, uint32_t *numElementsPtr)
 Gets the size of an array. More...
 
NvMediaStatus NvMediaArraySetSize (NvMediaArray *handle, uint32_t numElements)
 Sets the size of an array (the number of populated elements in the array). More...
 
NvMediaStatus NvMediaArrayGetProperties (NvMediaArray *handle, NvMediaArrayType *elementType, uint32_t *capacity, uint32_t *stride)
 Gets the array properties with which array was created. More...
 
NvMediaStatus NvMediaArrayGetStatus (NvMediaArray *handle, uint32_t millisecondWait, NvMediaTaskStatus *status)
 Gets the status of the current or most recent operation on the array; optionally waits for the operation to complete or time out. More...
 

Macro Definition Documentation

#define NVM_ARRAY_ATTR_CPU_ACCESS_CACHED   0x00000001u

NVM_SURF_ATTR_CPU_ACCESS flag: Cached (mapped) access type flag.

Definition at line 94 of file nvmedia_array.h.

#define NVM_ARRAY_ATTR_CPU_ACCESS_UNCACHED   0x00000000u

NVM_SURF_ATTR_CPU_ACCESS flags

Uncached (mapped) access type flag.

Definition at line 92 of file nvmedia_array.h.

#define NVMEDIA_ARRAY_TIMEOUT_INFINITE

Infinite time-out for NvMediaArrayGetStatus.

Definition at line 46 of file nvmedia_array.h.

#define NVMEDIA_ARRAY_VERSION_MAJOR   2

Major version number.

Definition at line 38 of file nvmedia_array.h.

#define NVMEDIA_ARRAY_VERSION_MINOR   1

Minor version number.

Definition at line 40 of file nvmedia_array.h.

Typedef Documentation

typedef struct NvMediaArray NvMediaArray

Holds a descriptor for an array.

Note: Create and destroy an array with the corresponding NvMediaArrayCreate() and NvMediaArrayDestroy() functions.

Definition at line 79 of file nvmedia_array.h.

Enumeration Type Documentation

Defines NvMedia array allocation attribute types.

Enumerator
NVM_ARRAY_ATTR_CPU_ACCESS 

! CPU access to surface flags (default: uncached).

Definition at line 84 of file nvmedia_array.h.

Defines the different types of arrays.

Enumerator
NVMEDIA_ARRAY_TYPE_UNDEFINED 

Specifies an undefined array type.

NVMEDIA_ARRAY_TYPE_INT8 

Specifies a signed 8-bit array.

NVMEDIA_ARRAY_TYPE_UINT8 

Specifies an unsigned 8-bit array.

NVMEDIA_ARRAY_TYPE_INT16 

Specifies a signed 16-bit array.

NVMEDIA_ARRAY_TYPE_UINT16 

Specifies an unsigned 16-bit array.

NVMEDIA_ARRAY_TYPE_FLOAT16 

Specifies a float 16-bit array.

NVMEDIA_ARRAY_TYPE_UINT32 

Specifies a unsigned 32-bit array.

NVMEDIA_ARRAY_TYPE_INT32 

Specifies a signed 32-bit array.

NVMEDIA_ARRAY_TYPE_FLOAT32 

Specifies a float 32-bit array.

NVMEDIA_ARRAY_NUM_TYPES 

Number of types - If more types are needed, add above this pointer and update this constant.

Definition at line 50 of file nvmedia_array.h.

Function Documentation

NvMediaArray* NvMediaArrayCreate ( NvMediaDevice device,
NvMediaArrayType  type,
uint32_t  stride,
uint32_t  numElements,
const NvMediaArrayAllocAttr attrs,
uint32_t  numAttrs 
)

Creates an NvMedia Array.

Parameters
[in]deviceHandle to the NvMedia device obtained by calling NvMediaDeviceCreate().
[in]typeType of array to be created.
[in]strideStride in bytes of each element.
[in]numElementsNumber of elements in the array.
[in]attrsAn array of NvMediaArrayAllocAttr allocation attributes to be applied to the created array.
[in]numAttrsNumber of allocation attributes in attrs.
Returns
A handle to the array if the call is successful, or NULL otherwise.
NvMediaStatus NvMediaArrayDestroy ( NvMediaArray handle)

Destroys an array created by NvMediaArrayCreate().

Parameters
[in]handleThe handle to the array to be destroyed.
Return values
NVMEDIA_STATUS_OKindicates that the call is successful.
NVMEDIA_STATUS_BAD_PARAMETERindicates that handle is NULL.
NVMEDIA_STATUS_ERRORindicates any other error.
NvMediaStatus NvMediaArrayGetElemSizeForType ( NvMediaArrayType  type,
uint32_t *  elementSize 
)

Gets the size of a specified type of array element.

Parameters
[in]typeType of element.
[out]elementSizeA pointer to the size of an element in bytes.
Return values
NVMEDIA_STATUS_OKindicates that the call is successful.
NVMEDIA_STATUS_BAD_PARAMETERindicates that type is invalid or elementSize is NULL.
NVMEDIA_STATUS_ERRORindicates any other error.
NvMediaStatus NvMediaArrayGetProperties ( NvMediaArray handle,
NvMediaArrayType elementType,
uint32_t *  capacity,
uint32_t *  stride 
)

Gets the array properties with which array was created.

Parameters
[in]handleThe handle to the array.
[out]elementTypeType of elements in the array.
[out]capacityA pointer to the array's capacity (the number of elements).
[out]strideA pointer to the array's stride (the offset in bytes between one elelment and the next).
Return values
NVMEDIA_STATUS_OKindicates that the call is successful.
NVMEDIA_STATUS_BAD_PARAMETERindicates that one or more arguments are NULL.
NVMEDIA_STATUS_ERRORindicates any other error.
NvMediaStatus NvMediaArrayGetSize ( NvMediaArray handle,
uint32_t *  numElementsPtr 
)

Gets the size of an array.

An array's size is the number of populated elements in the array. If the array has not been written to, the function returns a size of 0.

Parameters
[in]handleThe handle to the array.
[out]numElementsPtrA pointer to the number of elements.
Return values
NVMEDIA_STATUS_OKindicates that the call is successful.
NVMEDIA_STATUS_BAD_PARAMETERindicates that handle or numElementsPtr is NULL.
NVMEDIA_STATUS_ERRORindicates that the array is not locked.
NvMediaStatus NvMediaArrayGetStatus ( NvMediaArray handle,
uint32_t  millisecondWait,
NvMediaTaskStatus status 
)

Gets the status of the current or most recent operation on the array; optionally waits for the operation to complete or time out.

Parameters
[in]handleThe handle to the array.
[in]millisecondWaitTime in milliseconds to wait for the current operation to complete. NVMEDIA_ARRAY_TIMEOUT_INFINITE means wait indefinitely.
[out]statusStatus of the operation.
Return values
NVMEDIA_STATUS_OKindicates that the call is successful.
NVMEDIA_STATUS_TIMED_OUTindicates that the operation did not complete within the specified wait time.
NVMEDIA_STATUS_BAD_PARAMETERindicates that a parameter has an invalid value.
NVMEDIA_STATUS_ERRORindicates any other error.
NvMediaStatus NvMediaArrayGetVersion ( NvMediaVersion version)

Returns version information for the NvMediaArray library.

Parameters
[in]versionA pointer to an NvMediaVersion structure filled by the function.
Returns
A status code; NVMEDIA_STATUS_OK if the call is successful, or NVMEDIA_STATUS_BAD_PARAMETER if the pointer is invalid.
NvMediaStatus NvMediaArraySetSize ( NvMediaArray handle,
uint32_t  numElements 
)

Sets the size of an array (the number of populated elements in the array).

Call this function before writing to the array. The specified size must be less than or equal to the number of elements with which the array was created.

See also
NvMediaArrayCreate().
Parameters
[in]handleThe handle to the array.
[in]numElementsSize of the array.
Return values
NVMEDIA_STATUS_OKindicates that the call is successful.
NVMEDIA_STATUS_BAD_PARAMETERindicates that handle is NULL.
NVMEDIA_STATUS_INVALID_SIZEindicates that numElements is greater than the array's initial size.
NVMEDIA_STATUS_ERRORindicates that the array is not locked.