NVIDIA DRIVE OS Linux SDK API Reference

5.2.3 Release
For Test and Development only

Detailed Description

Defines and manages objects that decode video.

The NvMediaImageDecoder object decodes compressed video data, writing the results to a NvMediaImage.

A specific NvMedia implementation may support decoding multiple types of compressed video data. However, NvMediaImageDecoder objects are able to decode a specific type of compressed video data. This type must be specified during creation.

Data Structures

struct  NvMediaImageDecoder
 A handle representing a IMAGE decoder object. More...
 

Modules

 Decoder Creation Flag
 Defines decoder flag bit masks for constructing the decoder.
 

Macros

#define NVMEDIA_IMAGEDEC_VERSION_MAJOR   2
 Major Version number. More...
 
#define NVMEDIA_IMAGEDEC_VERSION_MINOR   9
 Minor Version number. More...
 

Enumerations

enum  NvMediaImageCodec {
  NVMEDIA_IMAGE_CODEC_H264 = 0,
  NVMEDIA_IMAGE_CODEC_HEVC = 8,
  NVMEDIA_IMAGE_CODEC_VP9 = 9
}
 Image codec type. More...
 

Functions

NvMediaStatus NvMediaImageDecoderGetVersion (NvMediaVersion *version)
 Checks the version compatibility for the NvMedia Image decoder library. More...
 
NvMediaImageDecoderNvMediaImageDecoderCreate (const NvMediaDevice *device, NvMediaImageCodec codec, uint16_t width, uint16_t height, uint16_t maxReferences, uint64_t maxBitstreamSize, uint8_t inputBuffering, uint32_t flags, NvMediaDecoderInstanceId instanceId)
 Creates a image decoder object. More...
 
NvMediaImageDecoderNvMediaImageDecoderCreateCtx (void)
 Create an NvMediaImageDecoder object instance. More...
 
NvMediaStatus NvMediaImageDecoderInit (NvMediaImageDecoder *decoder, const NvMediaDevice *device, NvMediaImageCodec codec, uint16_t width, uint16_t height, uint16_t maxReferences, uint64_t maxBitstreamSize, uint8_t inputBuffering, uint32_t flags, NvMediaDecoderInstanceId instanceId)
 Initialize an NvMediaImageDecoder object instance. More...
 
void NvMediaImageDecoderUnRegisterPinnedSurfaces (const NvMediaImageDecoder *decoder)
 Unpin all the Pinned decode Surfaces used by decoder. More...
 
void NvMediaImageDecoderDestroy (const NvMediaImageDecoder *decoder)
 Destroys a image decoder object. More...
 
NvMediaStatus NvMediaImageDecoderRender (const NvMediaImageDecoder *decoder, NvMediaImage *target, const NvMediaPictureInfo *pictureInfo, uint32_t numBitstreamBuffers, const NvMediaBitstreamBuffer *bitstreams, NvMediaDecoderInstanceId instanceId)
 Decodes a compressed field/frame and render the result into a NvMediaImage. More...
 
NvMediaStatus NvMediaImageDecoderGetBackwardUpdates (const NvMediaImageDecoder *decoder, void *backupdates)
 NvMediaImageDecoder get backward updates counters for VP9 adaptive entropy contexts. More...
 

Macro Definition Documentation

◆ NVMEDIA_IMAGEDEC_VERSION_MAJOR

#define NVMEDIA_IMAGEDEC_VERSION_MAJOR   2

Major Version number.

Definition at line 44 of file nvmedia_imgdec.h.

◆ NVMEDIA_IMAGEDEC_VERSION_MINOR

#define NVMEDIA_IMAGEDEC_VERSION_MINOR   9

Minor Version number.

Definition at line 46 of file nvmedia_imgdec.h.

Enumeration Type Documentation

◆ NvMediaImageCodec

Image codec type.

Enumerator
NVMEDIA_IMAGE_CODEC_H264 

H.264 codec.

NVMEDIA_IMAGE_CODEC_HEVC 

H265 codec.

NVMEDIA_IMAGE_CODEC_VP9 

VP9 codec.

Definition at line 51 of file nvmedia_imgdec.h.

Function Documentation

◆ NvMediaImageDecoderCreate()

NvMediaImageDecoder* NvMediaImageDecoderCreate ( const NvMediaDevice device,
NvMediaImageCodec  codec,
uint16_t  width,
uint16_t  height,
uint16_t  maxReferences,
uint64_t  maxBitstreamSize,
uint8_t  inputBuffering,
uint32_t  flags,
NvMediaDecoderInstanceId  instanceId 
)

Creates a image decoder object.

Creates a NvMediaImageDecoder object for the specified codec. Each decoder object may be accessed by a separate thread. The object must be destroyed with NvMediaImageDecoderDestroy(). All surfaces used with the NvMediaImageDecoder must be obtained by /ref NvMediaSurfaceFormatGetType with:

Parameters
[in]deviceA pointer to the device this video decoder will use.
[in]codecCodec type. The following types are supported:
[in]widthDecoder width in luminance pixels.
[in]heightDecoder height in luminance pixels.
[in]maxReferencesThe maximum number of reference frames used. This limits internal allocations.
[in]maxBitstreamSizeThe maximum size for bitstream. This limits internal allocations.
[in]inputBufferingHow many frames can be in flight at any given time. If this value is 1, NvMediaImageDecoderRender() blocks until the previous frame has finished decoding. If this is 2, NvMediaImageDecoderRender blocks if two frames are pending but does not block if one is pending. This value is clamped internally to between 1 and 8.
[in]flagsSet the flags of the decoder. The following flags are supported:
NVMEDIA_IMAGE_DECODER_ATTRIBUTE_PROGRESSIVE_SEQUENCE
[in]instanceIdThe ID of the engine instance. The following instances are supported:
NVMEDIA_DECODER_INSTANCE_0
NVMEDIA_DECODER_INSTANCE_1
NVMEDIA_DECODER_INSTANCE_AUTO
Returns
NvMediaVideoDecoder The new video decoder's handle or NULL if unsuccessful.

◆ NvMediaImageDecoderCreateCtx()

NvMediaImageDecoder* NvMediaImageDecoderCreateCtx ( void  )

Create an NvMediaImageDecoder object instance.

Precondition
NvMediaImageDecoderGetVersion()
NvMediaImageDecoderNvSciSyncGetVersion() [for use with IMGDEC-NvSciSync APIs]
Postcondition
NvMediaImageDecoder object is created
Returns
NvMediaImageDecoder The new image decoder's handle or NULL if unsuccessful.

◆ NvMediaImageDecoderDestroy()

void NvMediaImageDecoderDestroy ( const NvMediaImageDecoder decoder)

Destroys a image decoder object.

Parameters
[in]decoderThe decoder to be destroyed.
Returns
void

◆ NvMediaImageDecoderGetBackwardUpdates()

NvMediaStatus NvMediaImageDecoderGetBackwardUpdates ( const NvMediaImageDecoder decoder,
void *  backupdates 
)

NvMediaImageDecoder get backward updates counters for VP9 adaptive entropy contexts.

Parameters
[in]decoderA pointer to the decoder object that performs the decoding operation.
[in]backupdatesA pointer to a structure that holds the backward update counters.

◆ NvMediaImageDecoderGetVersion()

NvMediaStatus NvMediaImageDecoderGetVersion ( NvMediaVersion version)

Checks the version compatibility for the NvMedia Image decoder library.

Parameters
[in]versionA pointer to a NvMediaVersion structure of the client.
Returns
NvMediaStatus The status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_BAD_PARAMETER if the pointer is invalid.

◆ NvMediaImageDecoderInit()

NvMediaStatus NvMediaImageDecoderInit ( NvMediaImageDecoder decoder,
const NvMediaDevice device,
NvMediaImageCodec  codec,
uint16_t  width,
uint16_t  height,
uint16_t  maxReferences,
uint64_t  maxBitstreamSize,
uint8_t  inputBuffering,
uint32_t  flags,
NvMediaDecoderInstanceId  instanceId 
)

Initialize an NvMediaImageDecoder object instance.

Precondition
NvMediaImageDecoderCreateCtx()
Postcondition
NvMediaImageDecoder object is initialized.

Initializes a decoder object for the specified codec. Each decoder object may be accessed by a separate thread. The object must be destroyed with NvMediaImageDecoderDestroy(). All surfaces used with the NvMediaImageDecoder must be obtained by /ref NvMediaSurfaceFormatGetType with:

Parameters
[in]decoderThe decoder to use.
[in]deviceA pointer to the device this video decoder will use.
[in]codecCodec type. The following types are supported:
[in]widthDecoder width in luminance pixels.
[in]heightDecoder height in luminance pixels.
[in]maxReferencesThe maximum number of reference frames used. This limits internal allocations.
[in]maxBitstreamSizeThe maximum size for bitstream. This limits internal allocations.
[in]inputBufferingHow many frames can be in flight at any given time. If this value is 1, NvMediaImageDecoderRender() blocks until the previous frame has finished decoding. If this is 2, NvMediaImageDecoderRender blocks if two frames are pending but does not block if one is pending. This value is clamped internally to between 1 and 8.
[in]flagsSet the flags of the decoder. The following flags are supported:
NVMEDIA_IMAGE_DECODER_ATTRIBUTE_PROGRESSIVE_SEQUENCE
[in]instanceIdThe ID of the engine instance. The following instances are supported:
NVMEDIA_DECODER_INSTANCE_0
NVMEDIA_DECODER_INSTANCE_1
NVMEDIA_DECODER_INSTANCE_AUTO
Returns
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_BAD_PARAMETER if any of the input parameters are invalid.
NVMEDIA_STATUS_ERROR if it is called after initialization of decoder.

◆ NvMediaImageDecoderRender()

NvMediaStatus NvMediaImageDecoderRender ( const NvMediaImageDecoder decoder,
NvMediaImage target,
const NvMediaPictureInfo pictureInfo,
uint32_t  numBitstreamBuffers,
const NvMediaBitstreamBuffer bitstreams,
NvMediaDecoderInstanceId  instanceId 
)

Decodes a compressed field/frame and render the result into a NvMediaImage.

Parameters
[in]decoderThe decoder object that will perform the decode operation.
[in]targetThe image surface to render to.
[in]pictureInfoA (pointer to a) structure containing information about the picture to be decoded. Note that the appropriate type of NvMediaPictureInfo* structure must be provided to match to profile that the decoder was created for.
[in]numBitstreamBuffersThe number of bitstream buffers containing compressed data for this picture.
[in]bitstreamsAn array of bitstream buffers.
[in]instanceIdThe ID of the engine instance. The following instances are supported if NVMEDIA_DECODER_INSTANCE_AUTO was used in NvMediaImageDecoderCreate API, else this parameter is ignored:
NVMEDIA_DECODER_INSTANCE_0
NVMEDIA_DECODER_INSTANCE_1
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_BAD_PARAMETER

◆ NvMediaImageDecoderUnRegisterPinnedSurfaces()

void NvMediaImageDecoderUnRegisterPinnedSurfaces ( const NvMediaImageDecoder decoder)

Unpin all the Pinned decode Surfaces used by decoder.

It is Mandatory for NvMedia Applications to call this API before Freeing Allocated Output Surfaces.

Parameters
[in]decoderThe decoder object that will perform the decode operation.