NVIDIA DRIVE OS Linux API Reference

5.1.3.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvmedia_parser.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2018, 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  */
7 
8 
9 #ifndef NVMEDIA_PARSER_H
10 #define NVMEDIA_PARSER_H
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include "nvmedia_common.h"
17 #include "nvmedia_drm.h"
18 
34 // RVCT compiler doesn't allow anonymous structures or unions by default.
35 #if defined(__CC_ARM)
36 #pragma anon_unions
37 #endif
38 
40 typedef enum {
58 
60 typedef enum {
66 
68 typedef enum {
90 
92 typedef enum {
116 
118 typedef enum {
158 
160 typedef enum
161 {
167 
169 typedef enum
170 {
180 
184 typedef enum
185 {
202 
211 
212  /* Security group */
213 
216 
221  /* Other: Generate slice offsets with CompletePicture mode. */
233 
235 typedef struct
236 {
238  const uint8_t *pByteStream;
240  uint32_t uDataLength;
242  int64_t llPts;
258 
260 typedef struct
261 {
263  uint8_t uPresentFlag;
265  uint8_t uIDRFrame;
267  uint8_t uLTRefFrame;
271  uint8_t uPredicted;
275  uint32_t uFrameNum;
277  uint32_t uLTRFrameIdx;
279 
281 typedef struct
282 {
284  uint8_t uRefFrame;
286  uint8_t uIDRFrame;
288  uint8_t uLTRefFrame;
290  uint8_t uReserve0;
294  uint32_t uFrameNum;
296  uint32_t uLTRFrameIdx;
298 
300 typedef struct
301 {
303  uint32_t poc_fn_bits;
312  NvMediaDecRefFrame RPSList[16];
314 
320 #define MAX_SEQ_HDR_LEN 512U
321 
327 typedef struct
328 {
329  /* Codec information */
330 
333 
334  /* Frame information */
335 
337  double fFrameRate;
339  uint32_t uDecodeBuffers;
341  uint8_t bProgSeq;
343  uint32_t uBitrate;
344 
345  /* Sequence information */
346 
352  uint8_t SequenceHeaderData[MAX_SEQ_HDR_LEN];
353 
354  /* Frame size information */
355 
357  uint16_t uCodedWidth;
359  uint16_t uCodedHeight;
361  uint16_t uDisplayWidth;
363  uint16_t uDisplayHeight;
365  uint16_t uActualWidth;
367  uint16_t uActualHeight;
372 
373  /* Aspect ratio information */
374 
376  uint16_t uDARWidth;
378  uint16_t uDARHeight;
380  uint16_t uSARWidth;
382  uint16_t uSARHeight;
383 
384  /* Color information */
385 
407 
408 
416 typedef struct
417 {
419  uint16_t uDARWidth;
421  uint16_t uDARHeight;
422 
427 
429  uint16_t uDisplayWidth;
431  uint16_t uDisplayHeight;
432 
434  int64_t llFrameTime;
436  int64_t llTimeBase;
437 
440 
442  int32_t field_pic_flag;
446  int32_t second_field;
454  int32_t ref_pic_flag;
456  int32_t intra_pic_flag;
458  int32_t chroma_format;
461 
466  uint8_t *pBitstreamData;
468  uint32_t uNumSlices;
470  uint32_t *pSliceDataOffsets;
472  uint32_t nal_ref_idc;
475 
477  union {
492  } CodecSpecificInfo;
493 
496 
503 
507 typedef int32_t (*pfnCbNvMediaBeginSequence)(void *, const NvMediaParserSeqInfo *);
510 typedef void (*pfnCbNvMediaUnhandledNALU)(void *, const uint8_t *, int32_t);
511 typedef NvMediaStatus (*pfnCbNvMediaAllocPictureBuffer)(void *, NvMediaRefSurface **);
512 typedef void (*pfnCbNvMediaRelease)(void *, NvMediaRefSurface *);
513 typedef void (*pfnCbNvMediaAddRef)(void *, NvMediaRefSurface *);
514 typedef NvMediaStatus (*pfnCbNvMediaCreateDecrypter)(void *, uint16_t width, uint16_t height);
519 typedef void (*pfnCbNvMediaGetDpbInfoForMetadata)(void *, NvMediaRefSurface *, NvMediaDPBInfo *);
522 typedef struct
523 {
577 
579 typedef struct
580 {
584  void *pClientCtx;
588  uint16_t uErrorThreshold;
594 
598 typedef void NvMediaParser;
599 
611 NvMediaParser *
613  NvMediaParserParams *pParserParams
614 );
615 
619 void
621  NvMediaParser *pParser
622 );
623 
661  NvMediaParser *pParser,
662  NvMediaBitStreamPkt *pStreamPacket
663 );
664 
691  NvMediaParser *pParser,
692  NvMediaBitStreamPkt *pStreamPacket
693 );
694 
710  NvMediaParser *pParser,
711  NvMediaAESParams *pAesParams
712 );
713 
727 void
729  NvMediaParser *pParser
730 );
731 
748  NvMediaParser *pParser,
749  NvMediaParserAttr eAttributeType,
750  uint32_t uAttributeSize,
751  void *pAttribute
752 );
753 
770  NvMediaParser *pParser,
771  NvMediaParserAttr eAttributeType,
772  uint32_t uAttributeSize,
773  void *pAttribute
774 );
775 
778 #ifdef __cplusplus
779 }; /* extern "C" */
780 #endif
781 
782 #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) ...
#define MAX_SEQ_HDR_LEN
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 *)
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:79
transfer characteristics: HLG
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:71
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)
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.
uint8_t bProgSeq
Frame info: Specifies whether the bitstream is progressive or not.
NvMediaStatus NvMediaParserSetEncryption(NvMediaParser *pParser, NvMediaAESParams *pAesParams)
Provides the parser object with encryption metadata for the current buffer.
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:106
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.
NvMediaParser * NvMediaParserCreate(NvMediaParserParams *pParserParams)
Creates a video decoder parser object.
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
NvMediaColorPrimariesType
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
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: Common Types for Video/Image Encode/Decode
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
NvMediaAESMetaData AesMetaData
Encrypted content decoding specific parameters.
NvMediaStatus(* pfnCbNvMediaDisplayPicture)(void *, NvMediaRefSurface *, int64_t)
chroma format YUV422
NvMediaStatus
The set of all possible error codes.
Definition: nvmedia_core.h:199
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
NvMediaParserDecodeMode
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.
chroma format YUV420
void NvMediaParserFlush(NvMediaParser *pParser)
Flushes the parser decode session.
uint32_t uBitstreamDataLen
Bitstream data.
pfnCbNvMediaGetClearHdr GetClearHdr
callback to get clear header data from NvMediaVideoDecrypter.
slice level data used with slice level decoding
NvMediaVideoFormatType
Defines video format types.
uint16_t uDARHeight
Display Aspect Ratio = uDARHeight.
Frame timing: Use frame timing info for PTS calculation.
uint8_t uRefFrame
value 0 or 1 : indicating current frame is referenced or not
NvMediaParserAttr
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
NvMediaColorRangeType
Defines Color Range types.
NvMediaMatrixCoeffsType eMatrixCoefficients
Color info: Specifies the Matrix Coefficients.
color primaries: BT470M
NvMediaStatus(* pfnCbNvMediaAllocPictureBuffer)(void *, NvMediaRefSurface **)
Picture parameter information for an H.264 picture.
NvMediaMatrixCoeffsType
Defines matrix_coefficients types.
Holds picture parameter information for an MPEG 1 or MPEG 2 picture.
Other: Enable error status reporting.
color primaries: GenericFilm
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
NvMediaStatus NvMediaParserParse(NvMediaParser *pParser, NvMediaBitStreamPkt *pStreamPacket)
Parses or decodes bitstream data.
NvMediaParserSeqInfo * pExternalSeqInfo
Optional external sequence header data.
matrix coefficients: Unspecified
NvMediaStatus(* pfnCbNvMediaDecodePicture)(void *, NvMediaParserPictureData *)
NvMediaStatus NvMediaParserGetAttribute(NvMediaParser *pParser, NvMediaParserAttr eAttributeType, uint32_t uAttributeSize, void *pAttribute)
Gets attributes for the decode parser object.
NvMediaVideoCodec
Video codec type.
Frame timing: Output timestamp in increasing order after filtering.
NvMediaParserChromaFormat
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:127
chroma format YUV400 (Only Y component)
uint8_t uPresentFlag
value 0 or 1 : whether the frame is present in DPB
NvMediaStatus NvMediaParserScan(NvMediaParser *pParser, NvMediaBitStreamPkt *pStreamPacket)
Performs the first pass handling for encrypted content data.
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.
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 *)
NvMediaTransferCharacteristicsType
Defines transfer characteristics types.
void NvMediaParser
An opaque handle representing an NvMediaParser object.
double fFrameRate
Frame info: Specifies the frame rate of the bitstream.