NVIDIA DRIVE OS Linux SDK API Reference Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. All
3  * information contained herein is proprietary and confidential to NVIDIA
4  * Corporation. Any use, reproduction, or disclosure without the written
5  * permission of NVIDIA Corporation is prohibited.
6  */
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
16 #include "nvmedia_common_decode.h"
17 #include "nvmedia_core.h"
18 #include "nvmedia_drm.h"
35 // RVCT compiler doesn't allow anonymous structures or unions by default.
36 #if defined(__CC_ARM)
37 #pragma anon_unions
38 #endif
41 typedef enum {
61 typedef enum {
69 typedef enum {
93 typedef enum {
119 typedef enum {
161 typedef enum
162 {
170 typedef enum
171 {
185 typedef enum
186 {
213  /* Security group */
222  /* Other: Generate slice offsets with CompletePicture mode. */
236 typedef struct
237 {
239  const uint8_t *pByteStream;
241  uint32_t uDataLength;
243  int64_t llPts;
261 typedef struct
262 {
264  uint8_t uPresentFlag;
266  uint8_t uIDRFrame;
268  uint8_t uLTRefFrame;
272  uint8_t uPredicted;
276  uint32_t uFrameNum;
278  uint32_t uLTRFrameIdx;
282 typedef struct
283 {
285  uint8_t uRefFrame;
287  uint8_t uIDRFrame;
289  uint8_t uLTRefFrame;
291  uint8_t uReserve0;
295  uint32_t uFrameNum;
297  uint32_t uLTRFrameIdx;
301 typedef struct
302 {
304  uint32_t poc_fn_bits;
313  NvMediaDecRefFrame RPSList[16];
321 #define MAX_SEQ_HDR_LEN 512U
328 typedef struct
329 {
330  /* Codec information */
335  /* Frame information */
338  double fFrameRate;
340  uint32_t uDecodeBuffers;
342  uint8_t bProgSeq;
344  uint32_t uBitrate;
346  /* Sequence information */
353  uint8_t SequenceHeaderData[MAX_SEQ_HDR_LEN];
355  /* Frame size information */
358  uint16_t uCodedWidth;
360  uint16_t uCodedHeight;
362  uint16_t uDisplayWidth;
364  uint16_t uDisplayHeight;
366  uint16_t uActualWidth;
368  uint16_t uActualHeight;
374  /* Aspect ratio information */
377  uint16_t uDARWidth;
379  uint16_t uDARHeight;
381  uint16_t uSARWidth;
383  uint16_t uSARHeight;
385  /* Color information */
421 typedef struct
422 {
424  uint16_t uDARWidth;
426  uint16_t uDARHeight;
434  uint16_t uDisplayWidth;
436  uint16_t uDisplayHeight;
439  int64_t llFrameTime;
441  int64_t llTimeBase;
447  int32_t field_pic_flag;
451  int32_t second_field;
459  int32_t ref_pic_flag;
461  int32_t intra_pic_flag;
463  int32_t chroma_format;
471  uint8_t *pBitstreamData;
473  uint32_t uNumSlices;
475  uint32_t *pSliceDataOffsets;
477  uint32_t nal_ref_idc;
482  union {
497  } CodecSpecificInfo;
512 typedef int32_t (*pfnCbNvMediaBeginSequence)(void *, const NvMediaParserSeqInfo *);
515 typedef void (*pfnCbNvMediaUnhandledNALU)(void *, const uint8_t *, int32_t);
516 typedef NvMediaStatus (*pfnCbNvMediaAllocPictureBuffer)(void *, NvMediaRefSurface **);
517 typedef void (*pfnCbNvMediaRelease)(void *, NvMediaRefSurface *);
518 typedef void (*pfnCbNvMediaAddRef)(void *, NvMediaRefSurface *);
519 typedef NvMediaStatus (*pfnCbNvMediaCreateDecrypter)(void *, uint16_t width, uint16_t height);
524 typedef void (*pfnCbNvMediaGetDpbInfoForMetadata)(void *, NvMediaRefSurface *, NvMediaDPBInfo *);
527 typedef struct
528 {
584 typedef struct
585 {
589  void *pClientCtx;
593  uint16_t uErrorThreshold;
603 typedef void NvMediaParser;
616 NvMediaParser *
618  const NvMediaParserParams *pParserParams
619 );
624 void
626  NvMediaParser *pParser
627 );
666  const NvMediaParser *pParser,
667  const NvMediaBitStreamPkt *pStreamPacket
668 );
696  const NvMediaParser *pParser,
697  const NvMediaBitStreamPkt *pStreamPacket
698 );
715  const NvMediaParser *pParser,
716  const NvMediaAESParams *pAesParams
717 );
732 void
734  const NvMediaParser *pParser
735 );
753  NvMediaParser *pParser,
754  NvMediaParserAttr eAttributeType,
755  uint32_t uAttributeSize,
756  void *pAttribute
757 );
775  const NvMediaParser *pParser,
776  NvMediaParserAttr eAttributeType,
777  uint32_t uAttributeSize,
778  void *pAttribute
779 );
783 #ifdef __cplusplus
784 }; /* extern "C" */
785 #endif
787 #endif /* NVMEDIA_PARSER_H */
uint32_t nal_ref_idc
Required only for encrypted h264 bitstreams.
NvMediaStatus NvMediaParserSetAttribute(NvMediaParser *pParser, NvMediaParserAttr eAttributeType, uint32_t uAttributeSize, void *pAttribute)
Sets attributes for the decode parser object.
transfer characteristics: BT470M
int32_t repeat_first_field
For 3:2 pulldown (number of additional fields, 2=frame doubling, 4=frame tripling) ...
Defines the maximum size of the sequence header.
pfnCbNvMediaRelease Release
Callback to tell client to decrement the buffer reference count by 1.
uint32_t uLTRFrameIdx
LongTermFrameIdx of a picture.
Mastering display data for an H.265 picture.
NvMediaStatus(* pfnCbNvMediaSliceDecode)(void *, NvMediaSliceDecodeData *)
NvMediaContentLightLevelInfo ContentLightLevelInfo
Color info: Specifies Only: Content Light Level data if present.
pfnCbNvMediaGetDpbInfoForMetadata GetDpbInfoForMetadata
callback to pass internal DPB information to the client.
pfnCbNvMediaCreateDecrypter CreateDecrypter
Callback to create NvMediaVideoDecrypter component to handle encrypted contents.
Holds picture parameter information for a VP9 picture.
NvMediaColorRangeType eVideoFullRangeFlag
Color info: Specifies the Video Range (0-255) vs (16-235)
int uint32_t width
uint32_t uSequenceHeaderSize
Sequence info: Specifies the number of bytes in SequenceHeaderData.
int32_t chroma_format
Chroma Format (should match sequence info)
NvMediaVideoCodec eCodec
Codec type.
uint32_t uFrameNum
frame number
NvMediaBool bPTSValid
NVMEDIA_TRUE if llPTS is valid (also used to detect frame boundaries for VC1 SP/MP) ...
NvMediaEncryptParams encryptParams
contains encrypted metadata for pass1
uint16_t uDisplayTopOffset
Top offset for display.
Frame timing: Set frame rate for PTS calculation (float type)
transfer characteristics: BT2020_1
transfer characteristics: Log100
uint32_t NvMediaBool
A boolean value, holding NVMEDIA_TRUE or NVMEDIA_FALSE.
Definition: nvmedia_core.h:80
transfer characteristics: HLG
NvMediaBool bContentLightLevelInfoPresent
Color info: Specifies Only: Content Light Level data if present.
Holds decoded reference frame information.
NvMediaPictureInfoVC1 vc1
picture parameter information for vc1 NvMediaPictureInfoVC1
Holds encrypted metadata information that the parser passes to the video decoder component.
Definition: nvmedia_drm.h:74
transfer characteristics: IEC61966_2_4
int32_t intra_pic_flag
Frame is entirely intra coded (no temporal dependencies)
transfer characteristics: BT709
video format: PAL
NvMediaPictureInfoVP8 vp8
picture parameter information for VP8 NvMediaPictureInfoVP8
uint8_t * pBitstreamData
Pointer to the bitstream data for this picture (slice-layer)
NvMediaStatus NvMediaParserScan(const NvMediaParser *pParser, const NvMediaBitStreamPkt *pStreamPacket)
Performs the first pass handling for encrypted content data.
pfnCbNvMediaGetBackwardUpdates GetBackwardUpdates
callback to get backward prabability data for VP9 codec.
int64_t llFrameTime
Frame time in time_base units if NvMParseAttr_UseFrameTimingInfo is enabled.
NvMediaStatus(* pfnCbNvMediaGetBackwardUpdates)(void *, NvMediaVP9BackwardUpdates *)
uint32_t uLTRFrameIdx
LongTermFrameIdx of the frame.
Content Light Level info for an H.265 picture.
uint8_t bProgSeq
Frame info: Specifies whether the bitstream is progressive or not.
NvMediaPictureInfoH264 h264
picture parameter information for h264 NvMediaPictureInfoH264
uint16_t uCodedWidth
Frame size info: Specifies the coded Picture Width.
Holds re-encrypted data information that the video decoder returns to the parser. ...
Definition: nvmedia_drm.h:109
Security: Enable m_pSlhData allocation for encrypted streams in parser.
uint32_t uReferenceClockRate
Ticks per second of PTS clock (0=default=10000000=10Mhz)
uint16_t uDisplayWidth
Display Width.
uint16_t uDisplayWidth
Frame size info: Specifies the displayed Horizontal Size.
uint16_t uDARWidth
Display Aspect Ratio = uDARWidth.
uint8_t uPredicted
value 0 or 1 : whether the frame is motion predicted for the current frame as specified in slice head...
uint32_t uPictureOrderCnt
picture order counter
uint32_t uBitrate
Frame info: Specifies the Video bitrate (bps)
Frame management: DPB size is set to max number of reference frames.
video format: NTSC
int32_t top_field_first
Frame pictures only.
matrix coefficients: SMPTE170M
Defines color_primaries types.
Frame management: Disable DPB logic for low latency H264 playback.
uint32_t poc_fn_bits
Specify the max number of bits used to derive frame number.
Holds picture parameter information for an MPEG-4 Part 2 picture.
color range: full
NvMediaStatus(* pfnCbNvMediaCreateDecrypter)(void *, uint16_t width, uint16_t height)
pfnCbNvMediaAllocPictureBuffer AllocPictureBuffer
callback to get one free frame-buffer to do current frame decoding.
matrix coefficients: FCC
NvMediaBool bEOS
NVMEDIA_TRUE if this is an End-Of-Stream packet (flush everything)
color primaries: BT2020
NvMediaVideoCodec eCodec
Codec info: Specifies the compression standard.
transfer characteristics: ST418_1
NvMediaPictureInfoH265 hevc
picture parameter information for h265 NvMediaPictureInfoH265
Holds decoded Picture Buffer information.
NvMediaBool bDiscontinuity
NVMEDIA_TRUE if DecMFT is signalling a discontinuity.
Holds decoded current frame information.
normal decode mode
NvMediaStatus NvMediaParserGetAttribute(const NvMediaParser *pParser, NvMediaParserAttr eAttributeType, uint32_t uAttributeSize, void *pAttribute)
Gets attributes for the decode parser object.
matrix coefficients: BT709
uint8_t uLTRefFrame
value 0 or 1 : whether the frame is long term ref
matrix coefficients: YCgCo
Holds picture parameter information for an H.265 picture.
Frame timing: Set default frame rate for PTS calculation (float type)
uint16_t uSARWidth
Aspect ratio info: Specifies the sample Aspect Ratio = uSARWidth.
NVIDIA Media Interface: Video Decryptor (DRM) API
uint16_t uSARHeight
Aspect ratio info: Specifies the sample Aspect Ratio = uSARHeight.
NvMediaStatus(* pfnCbNvMediaDecryptHdr)(void *, NvMediaParserPictureData *)
matrix coefficients: SMPTE240
int64_t llPts
Presentation Time Stamp for this packet (clock rate specified at initialization)
Other: Enable VC-1 advanced profile interlaced.
uint32_t uPictureOrderCnt
Picture order counter.
uint8_t uReserve0
reserved for 4-byte alignment
NvMediaBool bCompletePicture
NVMEDIA_TRUE if this packet contains complete picture.
pfnCbNvMediaSliceDecode SliceDecode
Callback to pass slice level data for the slice level decoding use case.
matrix coefficients: Forbidden
transfer characteristics: Unspecified
uint32_t uMaxBitstreamSize
Sequence info: Specifies the maximum size of bitstream buffer.
uint8_t uIDRFrame
value 0 or 1 : whether the frame is an IDR
int32_t(* pfnCbNvMediaBeginSequence)(void *, const NvMediaParserSeqInfo *)
int32_t progressive_frame
Frame is progressive or not.
transfer characteristics: Log316
NvMediaBool bMasteringDispDataPresent
Color info: Specifies that mastering display data is present.
void(* pfnCbNvMediaRelease)(void *, NvMediaRefSurface *)
int32_t second_field
Second field of a complementary field pair.
uint8_t uIDRFrame
value 0 or 1 : indicating current frame IDR or not
transfer characteristics: BT2020_2
video format: MAC
transfer characteristics: Linear
transfer characteristics: IEC61966_2_1
NVIDIA Media Interface: Core
NvMediaAESMetaData AesMetaData
Encrypted content decoding specific parameters.
NvMediaStatus(* pfnCbNvMediaDisplayPicture)(void *, NvMediaRefSurface *, int64_t)
chroma format YUV422
Defines all possible error codes.
Definition: nvmedia_core.h:169
uint16_t uDisplayTopOffset
Frame size info: Specifies the top offset for display.
uint8_t uBitDepthLumaMinus8
Color info: Specifies the Luma bit depth (0=8bit)
Holds picture information for the current frame decode operation.
NvMediaDecCurrFrame currentFrame
Specify the property of current decoded frame.
Other: Get bitstream error for current input buffer.
NvMediaPictureInfoMPEG4Part2 mpeg4
picture parameter information for mpeg4 NvMediaPictureInfoMPEG4Part2
uint16_t uDARHeight
Aspect ratio info: Displays Aspect Ratio = uDARHeight.
uint16_t uDisplayLeftOffset
Left offset for display.
matrix coefficients: Reserved
Holds initialization parameters for the decoder class.
uint32_t uActiveRefFrames
number of valid entries in RPS
color primaries: Forbidden
pfnCbNvMediaBeginSequence BeginSequence
callback to provide sequence level information to client Client will use this to create NvMediaVideoD...
NvMediaBool bDecodeNextSlice
NVMEDIA_TRUE if this packet belongs to the same frame currently being decoded.
Frame management: Decode IDR Frames only.
transfer characteristics: BT470BG
NvMediaBool bCompleteSlice
NVMEDIA_TRUE if this packet contains complete Slice.
transfer characteristics: BT1361
Defines the parser decode modes.
Frame management: 0: Normal decode, 1: KeyFrameDecode.
int uint32_t uint32_t height
uint32_t uNumSlices
Number of slices in this picture.
uint16_t uDisplayLeftOffset
Frame size info: Specifies the left offset for display.
pfnCbNvMediaDecodePicture DecodePicture
callback to provide one frame/field worth of data required to achieve decoding using NvMediaVideoDeco...
uint32_t uDataLength
Data length for this packet.
uint32_t uDecodeBuffers
Frame info: Specifies the number of decode buffers required.
void NvMediaParserFlush(const NvMediaParser *pParser)
Flushes the parser decode session.
chroma format YUV420
uint32_t uBitstreamDataLen
Bitstream data.
pfnCbNvMediaGetClearHdr GetClearHdr
callback to get clear header data from NvMediaVideoDecrypter.
slice level data used with slice level decoding
Defines video format types.
uint16_t uDARHeight
Display Aspect Ratio = uDARHeight.
NvMediaStatus NvMediaParserSetEncryption(const NvMediaParser *pParser, const NvMediaAESParams *pAesParams)
Provides the parser object with encryption metadata for the current buffer.
Frame timing: Use frame timing info for PTS calculation.
uint8_t uRefFrame
value 0 or 1 : indicating current frame is referenced or not
Defines parser attributes, which sets/gets decoder properties to parse as per the client/app requirem...
NvMediaMasteringDisplayData MasteringDispData
Color info: Specifies Only: Mastering display data if present.
NvMediaStatus(* pfnCbNvMediaGetClearHdr)(void *, NvMediaParserPictureData *)
NvMediaSliceDecodeData SliceData
Pass slice level data if slice level decoding enabled.
uint32_t uRTP_NALUSizeFieldWidthInBytes
if it is 0 then it is non-RTP
NvMediaBool bSliceDecode
Flag to indicate that slice level decoding is enabled.
pfnCbNvMediaDecryptHdr DecryptHdr
Callback to pass encrypted data for decryption of frame-headers.
Frame management: Drop MPEG2 B-Frames.
Other: Enable slice-level decode for the current session.
const uint8_t * pByteStream
Pointer to byte stream data.
int32_t bottom_field_flag
0=top field, 1=bottom field (ignored if field_pic_flag=0)
uint8_t uBitDepthChromaMinus8
Color info: Specifies the Chroma bit depth (0=8bit)
matrix coefficients: BT2020 non-constant luminance system
Defines Color Range types.
NvMediaMatrixCoeffsType eMatrixCoefficients
Color info: Specifies the Matrix Coefficients.
color primaries: BT470M
NvMediaParser * NvMediaParserCreate(const NvMediaParserParams *pParserParams)
Creates a video decoder parser object.
NvMediaStatus(* pfnCbNvMediaAllocPictureBuffer)(void *, NvMediaRefSurface **)
Picture parameter information for an H.264 picture.
Defines matrix_coefficients types.
Holds picture parameter information for an MPEG 1 or MPEG 2 picture.
Other: Enable error status reporting.
color primaries: GenericFilm
NVIDIA Media Interface: Common Types for Video/Image Decode
NvMediaPictureInfoMPEG1Or2 mpeg2
picture parameter information for mpeg1/2 NvMediaPictureInfoMPEG1Or2
video format: Reserved
NvMediaColorPrimariesType eColorPrimaries
Color info: Specifies the Color Primaries.
uint16_t uDisplayHeight
Frame size info: Specifies the displayed Vertical Size.
uint16_t uDARWidth
Aspect ratio info: Displays Aspect Ratio = uDARWidth.
void NvMediaRefSurface
A generic "reference surface" pointer type.
int32_t ref_pic_flag
Frame is a reference frame.
Holds picture parameter information for a VC1 picture.
matrix coefficients: BT2020 constant luminance system
NvMediaParserSeqInfo * pExternalSeqInfo
Optional external sequence header data.
matrix coefficients: Unspecified
NvMediaStatus(* pfnCbNvMediaDecodePicture)(void *, NvMediaParserPictureData *)
Frame timing: Output timestamp in increasing order after filtering.
Defines the chroma formats of video content.
pfnCbNvMediaDisplayPicture DisplayPicture
Callback to pass frame-buffer with its timestamp in display order for display.
NvMediaTransferCharacteristicsType eTransferCharacteristics
Color info: Specifies the Transfer Characteristics.
transfer characteristics: Forbidden
uint16_t uCodedHeight
Frame size info: Specifies the coded Picture Height.
video format: Unspecified
NvMediaParserChromaFormat eChromaFormat
Color info: Specifies the chroma format (0=4:0:0, 1=4:2:0, 2=4:2:2, 3=4:4:4)
transfer characteristics: SMPTE170M
pfnCbNvMediaUnhandledNALU UnhandledNALU
Callback to report unhandled NALU.
Other: Indicate whether the previous frame was lost.
Holds encrypted metadata information that the client sends to the parser.
Definition: nvmedia_drm.h:130
chroma format YUV400 (Only Y component)
uint8_t uPresentFlag
value 0 or 1 : whether the frame is present in DPB
uint16_t uActualHeight
Frame size info: Specifies the actual Height.
uint16_t uErrorThreshold
Threshold for deciding to bypass of picture (0=do not decode, 100=always decode)
uint32_t * pSliceDataOffsets
nNumSlices entries, contains offset of each slice within the bitstream data buffer ...
matrix coefficients: BT470BG
NvMediaRefSurface * pCurrPic
Current picture (output)
color primaries: SMPTE170M
video format: SECAM
int64_t llTimeBase
Base time units per second if NvMParseAttr_UseFrameTimingInfo is enabled.
NvMediaStatus NvMediaParserParse(const NvMediaParser *pParser, const NvMediaBitStreamPkt *pStreamPacket)
Parses or decodes bitstream data.
Holds video sequence information.
color primaries: Reserved
Picture parameter information for a VP8 picture.
Holds VP9 counters for adaptive entropy contexts.
Frame management: Disable DPB logic for low latency H265 playback.
Frame management: Abort decoding when unsupported features or erroneous bitstream.
color primaries: BT470BG
color range: limited
int32_t picture_order_count
picture order count (if known)
uint8_t uLTRefFrame
value 0 or 1 : indicating long term reference
chroma format YUV444
void NvMediaParserDestroy(NvMediaParser *pParser)
Destroys a video decoder parser object.
video format: Component
void * pClientCtx
Client context.
void(* pfnCbNvMediaUnhandledNALU)(void *, const uint8_t *, int32_t)
NvMediaPictureInfoVP9 vp9
picture parameter information for vp9 NvMediaPictureInfoVP9
color primaries: BT_709
int32_t field_pic_flag
0=frame picture, 1=field picture
NvMediaVideoFormatType eVideoFormat
Color info: Specifies the Video Format.
pfnCbNvMediaAddRef AddRef
Callback to increase ref counting of buffer by 1 when surface is used as reference.
uint16_t uDisplayHeight
Display Height.
uint32_t uFrameNum
Frame Num.
NvMediaParserClientCb * pClient
Should always be present if using parsing functionality.
Holds the bitstream packet input for parsing.
Other: For setting max resolution for creating decoder.
void(* pfnCbNvMediaAddRef)(void *, NvMediaRefSurface *)
transfer characteristics: SMPTE240M
Frame management: Set default H.264 max_dec_frame_buffering.
color primaries: Unspecified
uint16_t uActualWidth
Frame size info: Specifies the actual Width.
transfer characteristics: Reserved
transfer characteristics: SMPTE2084
color primaries: SMPTE240M
video format: Reserved
void(* pfnCbNvMediaGetDpbInfoForMetadata)(void *, NvMediaRefSurface *, NvMediaDPBInfo *)
Defines transfer characteristics types.
void NvMediaParser
An opaque handle representing an NvMediaParser object.
double fFrameRate
Frame info: Specifies the frame rate of the bitstream.
Video codec type.