1537 lines
76 KiB
C
Executable File
1537 lines
76 KiB
C
Executable File
/* Copyright (c) 2006 NVIDIA Corporation. All rights reserved.
|
|
*
|
|
* NVIDIA Corporation and its licensors retain all intellectual property
|
|
* and proprietary rights in and to this software, related documentation
|
|
* and any modifications thereto. Any use, reproduction, disclosure or
|
|
* distribution of this software and related documentation without an
|
|
* express license agreement from NVIDIA Corporation is strictly prohibited.
|
|
*/
|
|
|
|
/** @file GFMxDecH264.h
|
|
GFSDK H264 Decode API header file.
|
|
*/
|
|
|
|
#ifndef _GF_MPEG_DEC_H264__
|
|
#define _GF_MPEG_DEC_H264__
|
|
|
|
#include "nvtypes.h"
|
|
#include "GFVx.h"
|
|
#include "GFDef.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** @addtogroup groupMxDecH264 MxDecH264API H264 Decode API
|
|
|
|
The H.264/AVC decoder API handles H.264/AVC baseline-compliant bit
|
|
streams for this version, but has been defined to handle all of the three
|
|
profiles for future expansion.
|
|
|
|
The H.264/AVC decoder API has two sets of API—a high level API and a low
|
|
level API.
|
|
|
|
<b>Using the High Level API</b>
|
|
|
|
The high level API has a built-in entropy decoder. It decodes the bit stream
|
|
and performs error concealment if the bit stream has an error. This high level
|
|
API calls the low level API internally. When using the high level API, the
|
|
application can ignore the low level API.
|
|
|
|
The MxDecH264API high level functions include the following:
|
|
- GFMxDecH264DecSequence()
|
|
- GFMxDecH264DecPicture()
|
|
- GFMxDecH264Set()
|
|
- GFMxDecH264DecSEI()
|
|
- GFMxDecH264DecNewFrameNum()
|
|
|
|
<b>Using the Low Level API</b>
|
|
|
|
The low level API is essentially a macroblock decoder engine. It decodes
|
|
macroblock by macroblock. When using the low level API, the application
|
|
needs to handle the entropy decoding and error concealment. The low level
|
|
API assumes that the information passed from caller is correct, and does not
|
|
have any error concealment functionality build in. The application which
|
|
called the low level API must make sure that no macroblocks are missing for
|
|
any picture.
|
|
|
|
The MxDecH264API low level functions include the following:
|
|
- GFMxDecH264SetSequence()
|
|
- GFMxDecH264SetPicture()
|
|
- GFMxDecH264SetSlice()
|
|
- GFMxDecH264SetMBs()
|
|
|
|
<b>Application Notes</b>
|
|
|
|
<ul>
|
|
<li> @ref pageMxDecH264AppNotes
|
|
<ul>
|
|
<li> @ref pageMxDecH264AppNotes1
|
|
<li> @ref pageMxDecH264AppNotes2
|
|
</ul>
|
|
</ul>
|
|
*/
|
|
/*@{*/
|
|
|
|
/** MxDecH264API property flag: Baseline profile supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_BASELINE 0x00000001UL
|
|
|
|
/** MxDecH264API property flag: Main profile supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_MAIN 0x00000002UL
|
|
|
|
/** MxDecH264API property flag: Extended profile supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_EXTENDED 0x00000004UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 1 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL10 0x00000100UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 1.1 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL11 0x00000200UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 1.2 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL12 0x00000400UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 1.3 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL13 0x00000800UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 2 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL20 0x00001000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 2.1 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL21 0x00002000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 2.2 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL22 0x00004000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 3 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL30 0x00008000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 3.1 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL31 0x00010000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 3.2 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL32 0x00020000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 4 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL40 0x00040000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 4.1 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL41 0x00080000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 4.2 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL42 0x00100000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 5 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL50 0x00200000UL
|
|
|
|
/** MxDecH264API property flag: LEVEL 5.1 supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_LEVEL51 0x00400000UL
|
|
|
|
/** MxDecH264API property flag: Post Processing de-blocking supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_DB 0x01000000UL
|
|
|
|
/** MxDecH264API property flag: Post Processing de-ringing supported.
|
|
@see GFMxDecH264GetProperty(), GFPROPERTY::Capability
|
|
*/
|
|
#define GF_MXDEC_H264_CAP_DR 0x02000000UL
|
|
|
|
/** VUI Parameters for GFMXDECH264DECSEQUENCE
|
|
*/
|
|
typedef struct _GFMXDECH264DECVUI
|
|
{
|
|
NvU32 num_units_in_tick;
|
|
NvU32 time_scale;
|
|
NvU32 fixed_frame_rate_flag;
|
|
}GFMXDECH264DECVUI, *PGFMXDECH264DECVUI;
|
|
|
|
/** Parameter structure for MxDecH264DecSequence().
|
|
Both input and output parameters are passed via this structure to MxDecH264DecSequence().
|
|
@see MxDecH264DecSequence()
|
|
*/
|
|
typedef struct _GFMXDECH264DECSEQUENCE
|
|
{
|
|
NvU32 uiSequenceOption; /**< Input flags, see GFMXDECH264_DECSEQUENCEOPTION_* */
|
|
NvU32 SequenceInfo; /**< Output flags, see GF_MXDEC_H264_DEC_SEQUENCE_* */
|
|
NvU16 profile_idc; /**< Output, H264 profile ID */
|
|
NvU16 level_idc; /**< Output, H264 level ID */
|
|
NvU16 seq_parameter_set_id;/**<Output */
|
|
NvU16 num_ref_frames; /**< Output, Maximum number of used reference frames */
|
|
NvU16 pic_width; /**< Output, Video frame width pixels */
|
|
NvU16 pic_height; /**< Output, Video frame height in lines */
|
|
GFRECT CroppingRect; /**< Output, Frame cropping rectangle, valid only if #GF_MXDEC_H264_DEC_SEQUENCE_FRAME_CROPPING_FLAG set */
|
|
NvU16 bVuiPresent; /**< Output, VUI Present flag*/
|
|
NvU16 DPBSize;
|
|
GFMXDECH264DECVUI VUI; /**< Output, VUI parameters*/
|
|
NvU8* pPreFillBuffer; /**< Input, Pointer bitstream for sequence header to decode */
|
|
NvU32 PreFillBufferLength;/**< Input, Length of bitstream in bytes, must cover the entire sequence header */
|
|
NvU32 PreFillBufferBytesConsumed; /**< Output, Amount of bytes consumed by the component */
|
|
|
|
} GFMXDECH264DECSEQUENCE, *PGFMXDECH264DECSEQUENCE;
|
|
|
|
#define MAX_CPB_CNT 32
|
|
#define Max_NumClockTS 3
|
|
typedef struct _GFMXDECH264DECSEIBUFFERINGPERIOD
|
|
{
|
|
NvU32 seq_parameter_set_id; /**< Output, Specifies the sequence parameter set that contains the sequence HRD attributes. */
|
|
NvU32 initial_cpb_removal_delay [MAX_CPB_CNT]; /**< Output, Initial_cpb_removal_delay[i] specifies the delay for the ith CPB (Coded Picture Buffer)between
|
|
the time of arrival in the CPB of the first bit of the coded data associated with the access unit
|
|
and the time of removal from the CPB of the coded data associated with the same access unit.
|
|
*/
|
|
NvU32 initial_cpb_removal_delay_offset [MAX_CPB_CNT]; /**< Output, Initial_cpb_removal_delay_offset[i] is used for the ith CPB in combination with the
|
|
cpb_removal_delay to specify the initial delivery time of coded access units to the CPB.
|
|
*/
|
|
|
|
} GFMXDECH264DECSEIBUFFERINGPERIOD, *PGFMXDECH264DECSEIBUFFERINGPERIOD;
|
|
|
|
typedef struct _GFMXDECH264DECSEIPICTIMING
|
|
{
|
|
NvU32 cpb_removal_delay; /**< Output, Specifies how many clock ticks to wait after removal from the CPB of the access unit */
|
|
NvU32 dpb_output_delay; /**< Output, Used to compute the DPB (Decode Picture Buffer) output time of the picture */
|
|
NvU32 pic_struct; /**< Output, Indicates whether a picture should be displayed as a frame or one or more fields */
|
|
NvU32 NumClockTS; /**< Output, Specifies number of sets of clock timestamp information for a picture
|
|
clockTimestamp = ((hH * 60 + mM) * 60 + sS) * time_scale + nFrames * (num_units_in_tick * (1 + nuit_field_based_flag))+tOffset ;
|
|
*/
|
|
NvU32 clock_timestamp_flag [Max_NumClockTS]; /**< Output, Clock_timestamp_flag[i] equal to 1 indicates that a number of clock timestamp syntax
|
|
elements are present and follow immediately.
|
|
Clock_timestamp_flag[i] equal to 0 indicates that the associated clock timestamp syntax elements
|
|
are not present
|
|
*/
|
|
NvU32 ct_type; /** Output, Indicates the scan type (interlaced or progressive) */
|
|
NvU32 nuit_field_based_flag; /** Output, Used in calculating clockTimestamp */
|
|
NvU32 counting_type; /** Output, Specifies the method of dropping values of the n_frames */
|
|
NvU32 full_timestamp_flag; /** Output, Equal to 1 specifies that the n_frames syntax element is followed by seconds_value,
|
|
minutes_value,and hours_value.
|
|
Equal to 0 specifies that the n_frames syntax element is followed by seconds_flag
|
|
*/
|
|
NvU32 discontinuity_flag; /** Output, Equal to 0 indicates that the difference between the current value of clockTimestamp and
|
|
the value of clockTimestamp computed from the previous clock timestamp in output order can be interpreted
|
|
as the time difference between the times of origin or capture of the associated frames or fields.
|
|
Equal to 1 indicates that the Timestamp difference cannot interpreted as above.
|
|
*/
|
|
NvU32 cnt_dropped_flag; /** Output, Specifies the skipping of one or more values of n_frames using the counting method specified by counting_type*/
|
|
NvU32 n_frames; /** Output, Specifies the value of nFrames used to compute clockTimestamp */
|
|
NvU32 seconds_flag; /** Output, Equal to 1 specifies that seconds_value and minutes_flag are present when full_timestamp_flag is equal to 0.
|
|
Equal to 0 specifies that seconds_value and minutes_flag are not present.
|
|
*/
|
|
NvU32 seconds_value; /** Output, Specifies the value of sS used to compute clockTimestamp */
|
|
NvU32 minutes_flag; /** Output, Equal to 1 specifies that minutes_value and hours_flag are present when full_timestamp_flag is equal to 0.
|
|
Equal to 0 specifies that minutes_value and hours_flag are not present.
|
|
*/
|
|
NvU32 minutes_value; /** Output, Specifies the value of mM used to compute clockTimestamp */
|
|
NvU32 hours_flag; /** Output, equal to 1 specifies that hours_value is present when full_timestamp_flag is equal to 0
|
|
and seconds_flag is equal to 1 and minutes_flag is equal to 1 */
|
|
NvU32 hours_value; /** Output, specifies the value of hH used to compute clockTimestamp */
|
|
NvS32 time_offset; /** Output, specifies the value of tOffset used to compute clockTimestamp */
|
|
} GFMXDECH264DECSEIPICTIMING, *PGFMXDECH264DECSEIPICTIMING;
|
|
|
|
typedef struct _GFMXDECH264DECSEIPANSCAN
|
|
{
|
|
NvU32 pan_scan_rect_id; /**< Output, Identifying number used to identify the purpose of pan-scan rectangle */
|
|
NvU32 pan_scan_rect_cancel_flag; /**< Output, This flag when equal to 1 indicates that the SEI message cancels
|
|
the persistence of any previous pan-scan rectangle SEI message in output order.
|
|
This flag when equal to 0 indicates that pan-scan rectangle information follows.
|
|
*/
|
|
NvU32 pan_scan_cnt_minus1; /**< Output, Specifies the number of pan-scan rectangles present in the SEI meassage */
|
|
NvS32 pan_scan_rect_left_offset[3];
|
|
NvS32 pan_scan_rect_right_offset[3];
|
|
NvS32 pan_scan_rect_top_offset[3];
|
|
NvS32 pan_scan_rect_bottom_offset[3]; /**< Output, left,right,top ,bottom offsets together specifies the location of pan-scan
|
|
rectangle relative to the luma sample grid.
|
|
*/
|
|
NvU32 pan_scan_rect_repetition_period; /**< Output, specifies the persistence of the pan-scan rectangle SEI message
|
|
Equal to 0 specifies that the pan-scan rectangle information applies to the current
|
|
decoded picture only.
|
|
Equal to 1 specifies that the pan-scan rectangle information persists until
|
|
- A new coded video sequence begins
|
|
- A picture in an access unit containing a pan-scan rectangle SEI message with the
|
|
same value of pan_scan_rect_id is output having PicOrderCnt() > PicOrderCnt(CurrPic)
|
|
Greater than 1 specifies that the pan-scan rectangle information persists until
|
|
- A new coded video sequence begins
|
|
- A picture in an access unit containing a pan-scan rectangle SEI message with the
|
|
same value of pan_scan_rect_id is output having
|
|
(PicOrderCnt() > PicOrderCnt(CurrPic)) && (PicOrderCnt()<= PicOrderCnt(CurrPic) + pan_scan_rect_repetition_period )
|
|
*/
|
|
} GFMXDECH264DECSEIPANSCAN, *PGFMXDECH264DECSEIPANSCAN;
|
|
|
|
typedef struct _GFMXDECH264DECSEISUBSEQLAYER
|
|
{
|
|
NvU32 num_sub_seq_layers_minus1; /**< Output, Specifies the number of sub-sequence layers in the sequence */
|
|
NvU32 accurate_statistics_flag; /**< Output, This flag when equal to 1 indicates that the values of average_bit_rate and
|
|
average_frame_rate are rounded from statistically correct values.
|
|
When equal to 0 indicates that the average_bit_rate and the average_frame_rate are estimates
|
|
and may deviate somewhat from the correct values.
|
|
*/
|
|
NvU32 average_bit_rate; /**< Output, Indicates the average bit rate in units of 1000 bits per second. */
|
|
NvU32 average_frame_rate; /**< Output, Indicates the average frame rate in units of frames/(256 seconds). */
|
|
} GFMXDECH264DECSEISUBSEQLAYER, *PGFMXDECH264DECSEISUBSEQLAYER;
|
|
|
|
typedef struct _GFMXDECH264DECSEISUBSEQ
|
|
{
|
|
NvU32 sub_seq_layer_num; /**< Output, Identifies the sub-sequence layer number of the target sub-sequence */
|
|
NvU32 sub_seq_id; /**< Output, Identifies the target sub-sequence. */
|
|
NvU32 duration_flag; /**< Output, Equal to 0 indicates that the duration of the target sub-sequence is not specified. */
|
|
NvU32 sub_seq_duration; /**< Output, Specifies the duration of the target sub-sequence in clock ticks of a 90-kHz clock. */
|
|
NvU32 average_rate_flag; /**< Output, equal to 0 indicates that the average bit rate and the average frame rate of the target
|
|
sub-sequence are unspecified
|
|
*/
|
|
NvU32 accurate_statistics_flag; /**< Output, Same as accurate_statistics_flag in _GFMXDECH264DECSEISUBSEQLAYER*/
|
|
NvU32 average_bit_rate; /**< Output, Indicates the average bit rate in (1000 bits)/second of the target sub-sequence.*/
|
|
NvU32 average_frame_rate; /**< Output, Indicates the average frame rate in units of frames/(256 seconds) of the target sub-sequence.*/
|
|
NvU32 num_referenced_subseqs; /**< Output, Specifies the number of sub-sequences that contain pictures that are used as reference pictures
|
|
for inter prediction in the pictures of the target sub-sequence.
|
|
*/
|
|
NvU32 ref_sub_seq_layer_num;
|
|
NvU32 ref_sub_seq_id;
|
|
NvU32 ref_sub_seq_direction; /**< Output, ref_sub_seq_layer_num, ref_sub_seq_id, and ref_sub_seq_direction identify the sub-sequence
|
|
that contains pictures that are used as reference pictures for inter prediction in the pictures
|
|
of the target sub-sequence.
|
|
*/
|
|
} GFMXDECH264DECSEISUBSEQ, *PGFMXDECH264DECSEISUBSEQ;
|
|
|
|
|
|
|
|
/** ulBitMask, ulBitpayloadType: Application will set the corresponding bit of ulBitMask depending upon its requirement of the
|
|
particular payload type of SEI Message.
|
|
H264 Decoder API will set the corresponding bit of ulBitpayloadType depending upon the availability of the
|
|
particular payload type indicated by ulBitMask flag in the SEI NAL unit.
|
|
|
|
@see ulBitpayloadType, ulBitMask in _GFMXDECH264DECSEI
|
|
*/
|
|
|
|
/** Bit 0: SEI message for buffering period.
|
|
*/
|
|
#define GF_MXDEC_H264_SEI_MESSAGE_BUFFERING_PERIOD 0x00000001UL
|
|
|
|
/** Bit 1: SEI message for picture timing.
|
|
*/
|
|
#define GF_MXDEC_H264_SEI_MESSAGE_PICTURE_TIMING 0x00000002UL
|
|
|
|
/** Bit 2: SEI message for Pan Scan Rect.
|
|
*/
|
|
#define GF_MXDEC_H264_SEI_MESSAGE_PAN_SCAN 0x00000004UL
|
|
|
|
/** Bit 11: SEI message for Sequence Layer Characterization.
|
|
*/
|
|
#define GF_MXDEC_H264_SEI_MESSAGE_SEQ_LAYER_CHARECTERIZATION 0x00000800UL
|
|
|
|
/** Bit 12: SEI message for Sequence Characterization.
|
|
*/
|
|
#define GF_MXDEC_H264_SEI_MESSAGE_SEQ_CHARECTERIZATION 0x00001000UL
|
|
|
|
/** Parameter structure for MxDecH264DecSEI().
|
|
Both input and output parameters are passed via this structure to MxDecH264DecSEI().
|
|
@see MxDecH264DecSEI()
|
|
*/
|
|
typedef struct _GFMXDECH264DECSEI
|
|
{
|
|
NvU32 payloadType; /**< Output, Specifies the type of SEI payload */
|
|
NvU32 payloadSize; /**< Output, Specifies the number of bytes in SEI payload */
|
|
GFMXDECH264DECSEIBUFFERINGPERIOD buffperiod; /**< Output, Complete information after parsing the buffering period message of SEI NAL unit
|
|
GFMXDECH264DECSEIBUFFERINGPERIOD structure
|
|
*/
|
|
GFMXDECH264DECSEIPICTIMING pictiming; /**< Output, Complete information after parsing the pic_timing message of SEI NAL unit
|
|
GFMXDECH264DECSEIPICTIMING structure
|
|
*/
|
|
GFMXDECH264DECSEIPANSCAN panscan; /**< Output, Complete information after parsing the Pan Scan message of SEI NAL unit
|
|
GFMXDECH264DECSEIPANSCAN structure
|
|
*/
|
|
GFMXDECH264DECSEISUBSEQLAYER subseqlayer; /**< Output, Complete information after parsing the sub-Seqlayer message of SEI NAL unit
|
|
GFMXDECH264DECSEISUBSEQLAYER structure
|
|
*/
|
|
GFMXDECH264DECSEISUBSEQ subseq; /**< Output, Complete information after parsing the sub-Seqlayer message of SEI NAL unit
|
|
GFMXDECH264DECSEISUBSEQ structure
|
|
*/
|
|
NvU8 *pPreFillBuffer; /**< Input, Pointer bitstream for sequence header to decode */
|
|
NvU32 PreFillBufferLength;/**< Input, Length of bitstream in bytes, must cover the entire sequence header */
|
|
NvU32 ulBitpayloadType; /**< Output, Each Bit Informs a particular SEI message required by the application
|
|
so that the H264 decoder only parses that message related data stream
|
|
*/
|
|
NvU32 ulBitMask; /**< Input, Each Masking Bit indicated which information is required by the application */
|
|
} GFMXDECH264DECSEI, *PGFMXDECH264DECSEI;
|
|
|
|
/** GFMXDECH264DECSEQUENCE::SequenceInfo ouput flagbit: constraint_set0_flag is on in the bitstream.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_SEQUENCE_CONSTRAINT_SET0_FLAG 0x00000001
|
|
|
|
/** GFMXDECH264DECSEQUENCE::SequenceInfo ouput flagbit: constraint_set1_flag is on in the bitstream.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_SEQUENCE_CONSTRAINT_SET1_FLAG 0x00000002
|
|
|
|
/** GFMXDECH264DECSEQUENCE::SequenceInfo ouput flagbit: constraint_set2_flag is on in the bitstream.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_SEQUENCE_CONSTRAINT_SET2_FLAG 0x00000004
|
|
|
|
/** GFMXDECH264DECSEQUENCE::SequenceInfo output flagbit: Frame cropping.
|
|
If this flag is set GFMXDECH264DECSEQUENCE::CroppingRect contains a valid
|
|
frame cropping rectangle.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_SEQUENCE_FRAME_CROPPING_FLAG 0x00000008
|
|
|
|
/** GFMXDECH264DECSEQUENCE::uiSequenceOption input flagbit: Bitstream is passed with GFMxDecH264DecSequence().
|
|
If this flag is set bitstream data is passed with the call to GFMxDecH264DecSequence()
|
|
instead via the read bitstrem callback. This can be used only with boundary detection
|
|
on application level. The bitstream data is passed via GFMXDECH264DECSEQUENCE::pPreFillBuffer and
|
|
GFMXDECH264DECSEQUENCE::PreFillBufferLength.
|
|
*/
|
|
#define GFMXDECH264_DECSEQUENCEOPTION_PREFILLBUFFER 0x00000001
|
|
|
|
#define GFMXDECH264_MAX_NUM_REF_FRAMES 17
|
|
typedef struct
|
|
{
|
|
NvU32 POC;
|
|
NvU8 isNotDisplayed;
|
|
NvU8 RetainDuringDPBFlush;
|
|
NvU8 status;
|
|
}GFMXDECH264_DPB_DATA;
|
|
|
|
|
|
/** Parameter structure for MxDecH264DecPicture().
|
|
Both input and output parameters are passed via this structure to MxDecH264DecPicture().
|
|
@see MxDecH264DecPicture()
|
|
*/
|
|
typedef struct _GFMXDECH264DECPICTURE
|
|
{
|
|
NvU32 uiPictureOption; /**< Input flagbits, see GF_MXDEC_H264_DEC_PICTURE_SPECIFY_*. */
|
|
PGFRECT pPictureRect; /**< Input, Target rectangle.
|
|
GFMXDECH264DECPICTURE::pPictureRect specifies a rectangle on the
|
|
output surface for GFMxDec to output the decoded image.
|
|
|
|
This field only take effect when MXDEC_H264_DEC_PICTURE_SPECIFY_SURF_RECT
|
|
flag is set.
|
|
|
|
The rectangle must be within the surface. The rectangle's top and
|
|
left position must be aligned by application. Call GFMxDecGetAttribute()
|
|
with #MXDEC_ATTR_H264_DEC_PICTURE_RECT_TOP_ALIGNMENT and
|
|
#MXDEC_ATTR_H264_DEC_PICTURE_RECT_LEFT_ALIGNMENT to read the alignment
|
|
requirements. The rectangle's width and height must match the video frame
|
|
width and height as returned from MxDecH264DecSequence() in
|
|
GFMXDECH264DECSEQUENCE::pic_width and GFMXDECH264DECSEQUENCE::pic_height.
|
|
|
|
Note: Feature not yet implemented.
|
|
*/
|
|
NvU32 uiPictureInfo; /**< Output flags, see GF_MXDEC_H264_DEC_PICTURE_*. */
|
|
PGFRMSURFACE reconstructedSurf; /**< Output, Surface holding the decoded picture.
|
|
If frame is not decoded then reconstructedSurf will not get initialsed i.e. NULL
|
|
So VXBLT is called if the reconstructedSurf is not NULL.
|
|
*/
|
|
NvU32 uiPictureOrderCount; /**< Output */
|
|
NvU32 uiTimeStamp; /**< Output, frame timestamp in miliseconds, valid only if GF_MXDEC_H264_DEC_PICTURE_TIME_STAMP set. */
|
|
NvU8 * pMBInfo; /**< Output, each element tells the particular MB is wrong or not. */
|
|
NvU32 UsedAsReference; /**< Output */
|
|
NvU8* pPreFillBuffer; /**< Input, Pointer bitstream for frame to decode
|
|
The bitstream pointer needs to be 4-bytes aligned.
|
|
*/
|
|
NvU32 PreFillBufferLength; /**< Input, Length of bitstream in bytes, must cover the entire frame */
|
|
NvU32 PreFillBufferBytesConsumed; /**< Output, Amount of bytes consumed by the component */
|
|
NvU16 flushDPB; /**< Output, set to !=0 by the decoder when it encounters a memory_management_control_operation = 5
|
|
indication in the bitstream. The application should display (if the
|
|
NoOutputofPriorPics flag is not set) and flush the entire DPB, i.e remove
|
|
all previously stored frames from DPB.
|
|
Current frame should not be displayed/flushed.
|
|
|
|
See \a NoOutputofPriorPics for more info.
|
|
*/
|
|
NvU16 NoOutputofPriorPics; /**< Output, set by the decoder when it encounters a no_output_of_prior_pics_flag in
|
|
the bitstream. If this set, then flushDPB will also be set. The application
|
|
should flush the entire DPB, i.e remove all previously stored frames from DPB.
|
|
Current frame should not be displayed/flushed.
|
|
|
|
Summary:
|
|
<table>
|
|
<tr><th>NoOutputofPriorPics</th><th>flushDPB</th><th>Applications response</th></tr>
|
|
<tr><td>1 </td><td>1 </td><td> Remove all previously stored frames. No display. </td></tr>
|
|
<tr><td>0 </td><td>1 </td><td> Display all previously stored frames and then remove from DPB. </td></tr>
|
|
<tr><td>0 </td><td>0 </td><td> Normal operation of decoder. </td></tr>
|
|
</table>
|
|
*/
|
|
NvU32 ReconSurfaceNumber; /**< Index of reconstructed surface, this is an index into GFMXDECH264SURFLIST::surfList[].
|
|
valid only if GFMXDECH264DECPICTURE::reconstructedSurf is not NULL.
|
|
Invalid for streams with picture reordering.
|
|
*/
|
|
GFMXDECH264_DPB_DATA dpb_data[GFMXDECH264_MAX_NUM_REF_FRAMES];
|
|
} GFMXDECH264DECPICTURE, *PGFMXDECH264DECPICTURE;
|
|
|
|
//uiPictureOption
|
|
|
|
/** GFMXDECH264DECPICTURE::uiPictureOption input flagbit: Use target rectangle.
|
|
If this flag is set, the GFMXDECH264DECPICTURE::pPictureRect will point to
|
|
a rectangle on the output surface, where the reconstructed frame is placed.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_PICTURE_SPECIFY_SURF_RECT 0x00000001
|
|
|
|
/** GFMXDECH264DECPICTURE::uiPictureOption input flagbit: Bitstream is passed with MxDecH264DecPicture().
|
|
If this flag is set bitstream data is passed with the call to MxDecH264DecPicture()
|
|
instead via the read bitstrem callback. This can be used only with frame boundary detection
|
|
on application level. The bitstream data is passed via GFMXDECH264DECPICTURE::pPreFillBuffer and
|
|
GFMXDECH264DECPICTURE::PreFillBufferLength.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_PICTURE_SPECIFY_PREFILLBUFFER 0x00000002
|
|
|
|
//PictureInfo:
|
|
|
|
/** GFMXDECH264DECSEQUENCE::PictureInfo output flagbit: Current picture is IDR.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_PICTURE_IDR 0x00000001
|
|
|
|
/** GFMXDECH264DECSEQUENCE::PictureInfo output flagbit: GFMXDECH264DECSEQUENCE::uiTimeStamp field is valid.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_PICTURE_TIME_STAMP 0x00000002
|
|
|
|
/** GFMXDECH264DECSEQUENCE::PictureInfo output flagbit: Decoded picture has at least one corrupted macroblock.
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_PICTURE_BAD_MB 0x00000004
|
|
|
|
/** GFMXDECH264DECSEQUENCE::PictureInfo output flagbit:
|
|
Required by the application to decide whether post processing should be applied for a particular frame
|
|
DeblockingFlag is set, when Deblocking Filtering is disabled for all the slices
|
|
DeblockingFlag is reset even if deblocking filtering is enabled for atleast one slice
|
|
*/
|
|
#define GF_MXDEC_H264_DEC_PICTURE_DEBLOCKING_FILTER 0x00000008
|
|
|
|
typedef struct _GFMXDECH264SEQUENCE
|
|
{
|
|
NvU32 SequenceInfo;
|
|
NvU16 pic_width_in_mbs_minus1;
|
|
NvU16 pic_height_in_map_units_minus1;
|
|
} GFMXDECH264SEQUENCE, *PGFMXDECH264SEQUENCE;
|
|
//PictureInfo:
|
|
#define GF_MXDEC_H264_SEQUENCE_FRAME_MB_ONLY_FLAG 0x00000001
|
|
//if frame_mb_only_flag is on, this flag must be on
|
|
#define GF_MXDEC_H264_SEQUENCE_MB_ADAPTIVE_FRAME_FIELD_FLAG 0x00000002
|
|
//if mb_adaptive_frame_filed_flag is on, this flag must be on
|
|
#define GF_MXDEC_H264_SEQUENCE_DIRECT_8X8_INFERENCE_FLAG 0x00000004
|
|
//if direct_8x8_inference_flag is on, this flag must be on
|
|
|
|
|
|
typedef struct _GFMXDECH264PICTURE
|
|
{
|
|
NvU32 PictureInfo;
|
|
PGFRMSURFACE reconstructedSurf; //surface to hold the decoded picture
|
|
PGFRECT pRect;
|
|
NvU8 weighted_bidpred_idc;
|
|
NvS8 chroma_qp_index_offset;
|
|
} GFMXDECH264PICTURE, *PGFMXDECH264PICTURE;
|
|
//PictureInfo:
|
|
#define GF_MXDEC_H264_PICTURE_WEIGHTED_PRED_FLAG 0x00000001
|
|
//if weighted_pred_flag is on, this flag must be on
|
|
#define GF_MXDEC_H264_PICTURE_DEBLOCKING_FILTER_CONTROL_PRESENT_FLAG 0x00000002
|
|
//if deblocing_filter_control_present_flag is on, this flag must be on
|
|
#define GF_MXDEC_H264_PICTURE_CONSTRAINED_INTRA_PRED_FLAG 0x00000004
|
|
//if constrained_intra_pred_flag is on, this flag must be on
|
|
#define GF_MXDEC_H264_PICTURE_IDR 0x00000008
|
|
#define GF_MXDEC_H264_PICTURE_SPECIFY_SURFACE_RECT 0x00000010
|
|
// If this flag is set, pRect must be set. GFMxDec will reference image
|
|
// in pRect area of reference surface and output the decoded image in
|
|
// the pRect area of reconstructedSurf. Otherwise, GFMxDec will use
|
|
// the whole surface area.
|
|
|
|
|
|
typedef struct _GFMXDECH264WEIGHT
|
|
{
|
|
NvS8 luma_weight;
|
|
NvS8 luma_offset;
|
|
NvS8 Cb_weight;
|
|
NvS8 Cb_offset;
|
|
NvS8 Cr_weight;
|
|
NvS8 Cr_offset;
|
|
} GFMXDECH264WEIGHT, *PGFMXDECH264WEIGHT;
|
|
|
|
|
|
|
|
typedef struct _GFMXDECH264SLICE
|
|
{
|
|
NvU32 SliceInfo;
|
|
NvU16 first_mb_in_slice;
|
|
NvU16 reserved;
|
|
NvU8 slice_type;
|
|
NvU8 num_ref_idx_l0_active_minues1;
|
|
NvU8 num_ref_idx_l1_active_minues1;
|
|
NvU8 disable_deblocking_filter_idc ;
|
|
NvU8 slice_alpha_c0_offset_div2;
|
|
NvU8 slice_beta_offset_div2;
|
|
PGFRMSURFACE ref_l0_surfaces[16];
|
|
PGFRMSURFACE ref_l1_surfaces[16];
|
|
GFMXDECH264WEIGHT weighttableL0[16];
|
|
GFMXDECH264WEIGHT weighttableL1[16];
|
|
} GFMXDECH264SLICE, *PGFMXDECH264SLICE;
|
|
//SliceInfo:
|
|
#define GF_MXDEC_H264_SLICE_FILED_PIC_FLAG 0x01
|
|
//when filed_pic_flag is on, this flag must be set
|
|
#define GF_MXDEC_H264_SLICE_BOTTOM_FILED_FLAG 0x02
|
|
//when bottom_field_flag is on, this flag must be set
|
|
#define GF_MXDEC_H264_SLICE_DIRECT_SPATIAL_MV_PRED_FLAG 0x04
|
|
//when DIRECT_SPATIAL_MV_PRED_FLAG is on, this flag must be set
|
|
|
|
|
|
typedef struct _GFMXDECH264I4X4LPREDMODE
|
|
{
|
|
NvU32 uiPredMode0to7; //Luma4X4 Blk 0 to 7's prediction modes.
|
|
NvU32 uiPredMode8to15; //Luma4X4 Blk 8 to 15's prediction modes.
|
|
} GFMXDECH264I4X4LPREDMODE, *PGFMXDECH264I4X4LPREDMODE;
|
|
|
|
typedef struct _GFMXDECH264MV
|
|
{
|
|
NvS16 Horizontal;
|
|
//Horizonal motion vector component.
|
|
NvS16 Vertical;
|
|
//Vertical motion vector component
|
|
} GFMXDECH264MV, *PGFMXDECH264MV;
|
|
|
|
|
|
typedef struct _GFMXDECH264REFIDX
|
|
{
|
|
NvU8 Ref_idx_l0[4]; //PartIdx's reference index
|
|
NvU8 Ref_idx_l1[4]; //PartIdx's reference index
|
|
} GFMXDECH264REFIDX, *PGFMXDECH264REFIDX;
|
|
|
|
|
|
typedef struct _GFMXDECH264SUBMBTYPE
|
|
{
|
|
NvU8 sub_mb_type[4]; //PartIdx's sub_mb_type
|
|
} GFMXDECH264SUBMBTYPE, *PGFMXDECH264SUBMBTYPE;
|
|
|
|
|
|
typedef struct _GFMXDECH264MB
|
|
{
|
|
NvU16 uiTotalSize;
|
|
//Total size in bytes for current macroblock, including this structure
|
|
//itself and necessary following structure behind of this structure.
|
|
//Reference the data following GFMXDECH264MB.
|
|
NvU16 uiTotalCOEFs;// total Coefs for this macroblock
|
|
NvU32 curMBAddress; // current macroblock address
|
|
NvU8 MBInfo;
|
|
// this is the mb_type in bit stream and mb_field_decoding_flag
|
|
NvU8 uiQP; //this is QPy
|
|
NvU8 coded_block_pattern;
|
|
//This field is only valid when current macroblock is not Intra_16x16
|
|
NvU8 Intra_chroma_pred_mode;
|
|
//This field is valid only when current macroblock is Intra
|
|
GFMXDECH264SUBMBTYPE sub_mb_type;
|
|
union
|
|
{
|
|
GFMXDECH264I4X4LPREDMODE I4X4LPredMode; //Intra_4X4 only
|
|
GFMXDECH264REFIDX RefIdx; //Inter only
|
|
} mode; // TODO: Name this better
|
|
NvS32 numCoefsPerSubMB[32];
|
|
NvS16 index;
|
|
} GFMXDECH264MB, *PGFMXDECH264MB;
|
|
|
|
//MBInfo:
|
|
#define GF_MXDEC_H264_MB_FILED_DECODING_ENABLE 0x80
|
|
//when mb_field_decoding_flag is on, this flag must be set
|
|
#define GF_MXDEC_H264_MB_SKIP_MB 0x40
|
|
//skip MB
|
|
|
|
//The data following GFMXDECH264MB:
|
|
//If current macroblock is skipped macroblock, no further data is needed.
|
|
|
|
//If current macroblock is IPCM, there are 384 bytes following GFMXDECH264MB.
|
|
|
|
//If current macroblock is Inter macroblock, and is using picture list 0 only,
|
|
//necessary number of GFMXDECH264MV are following. If current macroblock is
|
|
//using picture list 1 only, necessary number of GFMXDECH264MV are following.
|
|
//If current macroblock is using both picture list 0 and list 1, necessary
|
|
//number of GFMXDECH264MV for list 0, and necessary number of GFMXDECH264MV
|
|
//for list 1 are following GFMXDECH264MB.
|
|
|
|
//For both Intra and Inter macroblock, the last portion of data which follows
|
|
//GFMXDECH264MB is GFMXDECH264MB.uiTotalCOEFs of GFMXDECH264COEF.
|
|
|
|
|
|
|
|
// definition for attribute
|
|
|
|
/** GFMxDecH264 Attribute: Application will determine the decoding boundaries.
|
|
For H.264/AVC, this boundary means sequence and picture boundary. For certain file formats,
|
|
those boundary information are stored in a meta data file. Alternatively the application
|
|
could parse NAL unit boundaries from the H264 stream and determine decoding units.
|
|
If application wants GFMxDecH264 to detect the boundary, it should not enable this
|
|
attribute.
|
|
|
|
If prefill mode (see #GFMXDECH264_DECSEQUENCEOPTION_PREFILLBUFFER) is used,
|
|
this attribute must be enabled. Disabled by default.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 1: APP will determine the decoding boudary
|
|
0: APP will not determine the decoding boundary
|
|
</pre>
|
|
|
|
@see GFMxDecH264GetAttribute(), GFMxDecH264SetAttribute()
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_PRE_DETERMINED_BOUNDARY 0x00000001
|
|
|
|
/** GFMxDecH264 Attribute: Enforce display ordering for sequences containing out of order frames.
|
|
|
|
Disabled by default.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 !=0: Enable reordering
|
|
0: Disable reordering
|
|
</pre>
|
|
|
|
@see GFMxDecH264GetAttribute(), GFMxDecH264SetAttribute()
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_DISPLAY_REORDERING 0x00000002
|
|
|
|
#define GF_MXDEC_H264_ATTR_DSP_STREAM_BUFFERING 0x00000003
|
|
//This Attribute only can be used for GFMxDecH264SetAttribute
|
|
//If the Application wants to set the mode DSP_STREAM_BUFFERING in H264Decoder, enable the #define DSP_STREAM_BUFFERING in App,
|
|
//then APP will enable the attribute by calling the GFMxDecH264SetAttribute.
|
|
//this attribute is used to pass the buffer details, from Application to the host side of GFSDK H264 component.
|
|
|
|
/** GFMxDecH264 Attribute: Enable decode surface locking in MxDecH264DecPicture().
|
|
|
|
MxDecH264DecPicture() returns the decoded surface number in GFMXDECH264DECPICTURE::ReconSurfaceNumber,
|
|
which is an index into the decode surface list GFMXDECH264SURFLIST::surfList[] set via
|
|
#GF_MXDEC_H264_SET_SURFACE_LIST. If surface locking is enabled, MxDecH264DecPicture() will
|
|
automatically 'lock' the returned surface and exclude it from its list of
|
|
surfaces used for further decoding. GFMxDecH264 can still read from a locked surface
|
|
(for reference frames), but it will not overwrite it. The application must not
|
|
write into a locked surface, since it still may be used as reference frame.
|
|
|
|
This locking mechanism is intended for usecases, where the application directly displays
|
|
the decode surface as video overlay. See also @ref pageMxDecH264AppNotes2
|
|
|
|
With surface locking enable, each successfully decoded surface has to be unlocked by the
|
|
application with GFMxDecH264Set / #GF_MXDEC_H264_SET_UNLOCK_SURFACE.
|
|
|
|
Since locked surfaces cannot be used for decoding, the number of decoding surfaces
|
|
set with #GF_MXDEC_H264_SET_SURFACE_LIST must be R+1+N, where R is the maximum number of
|
|
reference frames and N the maximum number of simultaneously locked surfaces.
|
|
Otherwise MxDecH264DecPicture() may fail.
|
|
|
|
Disabled by default.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 !=0: Enable surface locking
|
|
0: Disable surface locking
|
|
</pre>
|
|
|
|
@see GFMxDecH264GetAttribute(), GFMxDecH264SetAttribute(), GF_MXDEC_H264_SET_UNLOCK_SURFACE, @ref pageMxDecH264AppNotes2
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_SURFACE_LOCKING 0x00000004
|
|
|
|
/** GFMxDecH264 Attribute: Get H264 decoder's DSP handle.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 DSP handle
|
|
</pre>
|
|
|
|
GFMxDecH264GetAttribute() returns error GFMXDECH264_ERROR_INVALID_STATE, if DSP side not initialized.
|
|
Can be get only.
|
|
|
|
@internal
|
|
@see GFMxDecH264GetAttribute()
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_GETDSPHANDLE 0x00000005
|
|
|
|
#define GF_MXDEC_H264_ATTR_DEC_PICTURE_RECT_TOP_ALIGNMENT 0x00000007
|
|
//This attribute only can be used for GFMxDecGetAttribute
|
|
//If application wants to set pDestRect in GFMXDECPICTURE or GFMXDECH264DECPICTURE,
|
|
//application must use this attributes to get allignment information and
|
|
//align the rectangle top & left corner accordinately.
|
|
//*pInfo: top fieled alignment in term of lines
|
|
|
|
#define GF_MXDEC_H264_ATTR_DEC_PICTURE_RECT_LEFT_ALIGNMENT 0x00000008
|
|
//This attribute only can be used for GFMxDecGetAttribute
|
|
//If application wants to set pDestRect in GFMXDECH264PICTURE or GFMXDECH264DECPICTURE,
|
|
//application must use those attributes to get allignment information and
|
|
//align the rectangle top & left corner accordinately.
|
|
//*pInfo: left fieled alignment in term of pixels
|
|
|
|
#define GF_MXDEC_H264_ATTR_DEC_ENABLE_RAISE_WAIT 0x00000009
|
|
/*
|
|
* This attribute only can be used for GFMxDecSetAttribute
|
|
* if (*pInfo == 1)
|
|
* {
|
|
* Raisevectors are allocated per Surface.
|
|
* There will be 2 (3 if PostProcessing is ON) sets of raise-wait happening
|
|
* 1) Decoder raises On_Frame_Decoded, and VxBlt waits.
|
|
* 2) (If enabled in APP) PostProcessing API raises On_PP_Frame_Done, and VxBlt waits.
|
|
* 3) VxBlt raises On_Bltted, and Decoder waits.
|
|
* }
|
|
* else // DEFAULT
|
|
* {
|
|
* We do not allocate surface raise vectors but a single raise vector
|
|
* - In Decoder, we poll Frame_done, and return only after its done
|
|
* - In PostProcessing we poll PP_Frame_done, and return only after its done
|
|
* - I observed that Frame_done & PP_Frame_done bits are affected only if raise is done on those. Thats why single raise vector is still needed.
|
|
* This raise vector is not in any suface but in pdec.
|
|
* }
|
|
*/
|
|
|
|
#define GF_MXDEC_H264_ATTR_LEN_OF_NALSIZE 0x0000000a
|
|
/*To support the decoding of .264 stream where NAL size appears instead of StartCode
|
|
This is to get the length of the NAL size value*/
|
|
#define GF_MXDEC_H264_ATTR_NALSIZE_DECODING 0x0000000b
|
|
/* To support runtime decision making between the start code decoding and NAL size decoding*/
|
|
|
|
|
|
/** GFMxDecH264 Attribute: Indicate to the H264 decoder that surfaces have
|
|
already been allocated by the Application before the sps is decoded.
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 (Height << 16)| (Width)
|
|
</pre>
|
|
|
|
Can be set only.
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_SURFACE_ALLOCATED 0x0000000c
|
|
|
|
/** GFMxDecH264 Attribute: Set number of maximum supported reference frames.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 Number of reference frames
|
|
</pre>
|
|
|
|
This can be called before or after GFMxDecH264Set(GF_MXDEC_H264_SET_SURFACE_LIST).
|
|
The number of reference frames must be smaller than the number of surfaces
|
|
set via GFMxDecH264Set(GF_MXDEC_H264_SET_SURFACE_LIST).
|
|
|
|
If this attribute is not set, the number of supported reference frames will be
|
|
equal to one less the number of surfaces set in GFMxDecH264Set(GF_MXDEC_H264_SET_SURFACE_LIST).
|
|
|
|
Can be set only.
|
|
|
|
@see GF_MXDEC_H264_SET_SURFACE_LIST
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_MAXREFFRAMES 0x0000000d
|
|
|
|
/** GFMxDecH264 Attribute: Get Error Map Matrix for MBs in last decoded frame.
|
|
|
|
This attribute only can be used for GFMxDecGetAttribute. If application wants to get MB error map for
|
|
till recently decoded frame. Input parameter is a character array pMBErrMapMatrix of size "number of MBs in a frame". On returning
|
|
this call fills this char array with 1s & 0s. 1: MB correctly decoded & 0: MB corrupted. This is cumulative err map till this call
|
|
is made. In this API call after copying the err map to the char array, internal map is reset to all clean MBs.
|
|
Internal map is reset to all clean MBs also when I or SI slice is found.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU8 * pMBErrMapMatrix
|
|
</pre>
|
|
|
|
@internal
|
|
@see GFMxDecH264GetAttribute()
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_GET_MBERR_MAP_MATRIX 0x0000000e
|
|
|
|
/** GFMxDecH264 Attribute: Set Error Concealment (EC) Mode ON or OFF.
|
|
|
|
EC is Dynamically ON by default.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 !=0: Enable EC
|
|
0: Disable EC
|
|
</pre>
|
|
|
|
@see GFMxDecH264SetAttribute()
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_SWITCH_EC_MODE 0x0000000f
|
|
|
|
/** GFMxDecH264 Attribute: Set Single Slice Per Frame Mode ON or OFF.
|
|
|
|
By default multiple slices per frame is assumed.
|
|
|
|
Interpretation of block referenced by \a pInfo parameter:
|
|
<pre>
|
|
NvU32 !=0: Single slice per frame
|
|
0: Multiple slices per frame
|
|
</pre>
|
|
|
|
@see GFMxDecH264SetAttribute()
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_SINGLE_SLICE_PER_FRAME 0x00000010
|
|
|
|
|
|
|
|
/** GFMxDecH264 Attribute: Put the h264 decoder in the TSPlayer
|
|
mode. This has to be done first, and sets up the h264 decoder to cooperate
|
|
with the TS Demux task on the AVP. Does nothing when decode is on the
|
|
host
|
|
*/
|
|
#define GF_MXDEC_H264_ATTR_SET_TSPLAYER_MODE 0x00000011
|
|
|
|
|
|
/** Parameter structure for MxDecH264PostProcessing().
|
|
Both input and output parameters are passed via this structure to MxDecH264PostProcessing().
|
|
@see MxDecH264PostProcessing()
|
|
*/
|
|
|
|
typedef struct _GFMXDECHH264PP
|
|
{
|
|
PGFRMSURFACE* pDestSurf;/**< input,
|
|
pointer to an array of surfaces that will
|
|
hold the result from Post Processing
|
|
pointer to an array of surfaces to
|
|
accommodate auto post processing
|
|
*/
|
|
PGFRMSURFACE* pSrcSurf; /**< input,
|
|
pointer to an array of surfaces to be //post processed
|
|
pointer to an array of surfaces to
|
|
accommodate auto post processing
|
|
*/
|
|
PGFRECT pRect; /**< input,
|
|
Rectangle area to be processed for both
|
|
src and dest surface
|
|
*/
|
|
|
|
NvU32 numofDestSurf; /**< input,
|
|
If MXDEC_PP_AUTO flag is set, this
|
|
parameter must be filled
|
|
*/
|
|
NvU32 numofSrcSurf; /**< input,
|
|
If MXDEC_PP_AUTO flag is set, this
|
|
parameter must be filled
|
|
*/
|
|
NvU8 * lpQuantiser; /**< input,
|
|
point to array of QPs for Macro Blocks in
|
|
the source VOP. GFMX automatically saved
|
|
the last two decoded VOP's QP tables,
|
|
Decoder application may not need to reload
|
|
the table if it can make sure the source
|
|
VOP is the one within the last decoded
|
|
VOPs. If MXDEC_PP_RELOAD_QUANTIZER is set,
|
|
this field must be filled.
|
|
*/
|
|
NvU32 PPOption; /**<input*/
|
|
|
|
|
|
} GFMXDECH264PP, *PGFMXDECH264PP;
|
|
|
|
// PPOption
|
|
|
|
/** GFMXDECH264PP::PPOption input flagbit: Turn on DeBlocking filter for this frame.
|
|
*/
|
|
#define GF_MXDEC_H264_PP_DB_ON 0x1
|
|
/** GFMXDECH264PP::PPOption input flagbit: Turn on DeRinging filter for this frame.
|
|
*/
|
|
#define GF_MXDEC_H264_PP_DR_ON 0x2
|
|
/** GFMXDECH264PP::PPOption input flagbit: Auto trigger Post Processing by Hardware.
|
|
*/
|
|
#define GF_MXDEC_H264_PP_AUTO 0x4
|
|
/** GFMXDECH264PP::PPOption input flagbit:Reload the source VOP's qunantizers.
|
|
*/
|
|
#define GF_MXDEC_H264_PP_RELOAD_QUANTIZER 0x8
|
|
|
|
|
|
// Hardware Status
|
|
#define GF_DECODER_FRAME_DONE 0x00000010
|
|
//if hardware decoder is done with one frame
|
|
#define GF_DECODER_PP_FRAME_DONE 0x00000020
|
|
//if post processing engine is done with one frame
|
|
|
|
/** GFMxDecH264Set() feature ID: Set up read stream callback function.
|
|
\a pInfo is a pointer to a #GFMXDECH264CALLBACK structure.
|
|
*/
|
|
#define GF_MXDEC_H264_SET_READBITSTREAM 1
|
|
|
|
/** GFMxDecH264Set() feature ID: Set up surface list.
|
|
\a pInfo is a pointer to a #GFMXDECH264SURFLIST structure.
|
|
The surfaces will be used internally to store reference frames
|
|
and the reconstructed output.
|
|
*/
|
|
#define GF_MXDEC_H264_SET_SURFACE_LIST 2
|
|
|
|
/** GFMxDecH264Set() feature ID: Unlock a surface locked by GFMxDecH264DecPicture() in surface locking mode.
|
|
|
|
Interpretation of GFMxDecH264Set parameter \a pInfo:
|
|
<pre>
|
|
NvS32 >0 Surface index which was returned in GFMXDECH264DECPICTURE::ReconSurfaceNumber.
|
|
NvS32 -1 Reset all locked surfaces to unlocked
|
|
NvS32 -2 Reserved for internal use
|
|
</pre>
|
|
|
|
@see GF_MXDEC_H264_ATTR_SURFACE_LOCKING
|
|
*/
|
|
#define GF_MXDEC_H264_SET_UNLOCK_SURFACE 3
|
|
|
|
/** GFMxDecH264Set() feature ID: Sync host side H264 state from DSP side.
|
|
@internal
|
|
*/
|
|
#define GF_MXDEC_H264_SET_SYNC_WITH_DSP 4
|
|
|
|
/** GFMxDecH264Set() feature ID: Set or reset DSP idle callback.
|
|
Can be called on DSP side only.
|
|
\a pInfo is a pointer to a #GFMXDECH264CALLBACK structure.
|
|
@internal
|
|
*/
|
|
#define GF_MXDEC_H264_SET_DSPIDLEHANDLER 5
|
|
|
|
/** GFMxDecH264Set() feature ID: Allow the DSP message poll thread to wake up and terminate.
|
|
Can be called on Host side only.
|
|
\a pInfo is ignored.
|
|
@internal
|
|
*/
|
|
#define GF_MXDEC_H264_SET_EXITDSPMSGTHREAD 6
|
|
|
|
/** Parameter structure for GFMxDecH264Set() feature #GF_MXDEC_H264_SET_DSPIDLEHANDLER.
|
|
@internal
|
|
*/
|
|
typedef struct _GFMXDECH264DSPIDLECALLBACK
|
|
{
|
|
/** Application defined parameter to forward to GFMXDECH264DSPIDLECALLBACK::pCallBack. */
|
|
void *pPara;
|
|
|
|
/** Callback function, which is called from AVP idle loop.
|
|
@param pPara Application defined parameter, forwarded from GFMXDECH264DSPIDLECALLBACK::pPara
|
|
*/
|
|
void (*pCallBack)(void* pPara);
|
|
|
|
} GFMXDECH264DSPIDLECALLBACK;
|
|
|
|
|
|
/** Parameter structure for GFMxDecH264Set() feature #GF_MXDEC_H264_SET_READBITSTREAM. */
|
|
typedef struct _GFMXDECH264CALLBACK
|
|
{
|
|
/** Application defined parameter to forward to GFMXDECH264CALLBACK::pCallBack. */
|
|
void *pPara;
|
|
|
|
/** Callback function, which is called by MxDecH264 to fetch a portion of bitstream data.
|
|
@param pPara Application defined parameter, forwarded from GFMXDECH264CALLBACK::pPara
|
|
@param ppBuffer Callback returns address of the next portion of stream data in \a *ppBuffer
|
|
@param pBufferLength Callback returns number of bytes in \a ppBuffer in \a *pBufferLength
|
|
@param uFlag Specifies scan stream direction
|
|
<table>
|
|
<tr><td>GF_MXDEC_H264_READ_BITSTREAM_FORWARD </td><td>Forward scan</td></tr>
|
|
<tr><td>GF_MXDEC_H264_READ_BITSTREAM_BACKWARD</td><td>Backward scan</td></tr>
|
|
</table>
|
|
|
|
@return If the #MXDEC_ATTR_PRE_DETERMINED_BOUNDARY attribute is set, the callback
|
|
should return #GF_MXDEC_H264_BOUNDARY_REACHED when a frame boundary is
|
|
detected, or 0 if no boundary is detected.
|
|
If the #MXDEC_ATTR_PRE_DETERMINED_BOUNDARY attribute is not set, the callback
|
|
should return 0.
|
|
*/
|
|
NvU32 (*pCallBack)(void* pPara, NvU8** ppBuffer, NvS32* pBufferLength, NvU32 uFlag);
|
|
|
|
}GFMXDECH264CALLBACK, *PGFMXDECH264CALLBACK;
|
|
|
|
|
|
|
|
/** GFMXDECH264CALLBACK::pCallBack return code */
|
|
#define GF_MXDEC_H264_BOUNDARY_REACHED 0x00000001
|
|
/** GFMXDECH264CALLBACK::pCallBack uFlag value: Stream forward scan. */
|
|
#define GF_MXDEC_H264_READ_BITSTREAM_FORWARD 0x00000002
|
|
/** GFMXDECH264CALLBACK::pCallBack uFlag value: Stream backward scan. */
|
|
#define GF_MXDEC_H264_READ_BITSTREAM_BACKWARD 0x00000003
|
|
|
|
/** Maximum number of surface pointers GFMXDECH264SURFLIST::surfList[]. */
|
|
#define MXDEC_H264_NUM_SURFACES 17
|
|
|
|
/** Parameter structure for GFMxDecH264Set() feature #GF_MXDEC_H264_SET_READBITSTREAM. */
|
|
typedef struct _GFMXDECH264SURFLIST
|
|
{
|
|
/** Number of valid surfaces in GFMXDECH264SURFLIST::surfList[].
|
|
The number of valid surfaces includes reference, decode surfaces and optional buffer frames.
|
|
Must be within range 1 and 17.
|
|
*/
|
|
NvU32 numSurfs;
|
|
|
|
/** Surface pointer list.
|
|
|
|
Assuming N is the number of reference frames, the first N+1 surfaces
|
|
in this list will be used as reference and decode surfaces. The currently
|
|
decoded surface can refer to the N remaining surfaces in this set as
|
|
reference frames.
|
|
|
|
If surface locking mode (#GF_MXDEC_H264_ATTR_SURFACE_LOCKING) is enabled,
|
|
The remaining M = numSurfs - (N+1) surfaces are used as extra surfaces,
|
|
to fascilate pre-buffered decoding.
|
|
*/
|
|
PGFRMSURFACE surfList[MXDEC_H264_NUM_SURFACES];
|
|
|
|
}GFMXDECH264SURFLIST, *PGFMXDECH264SURFLIST;
|
|
|
|
|
|
typedef enum
|
|
{
|
|
GFMX_DEC_H264_INTERRUPT_ENABLE,
|
|
GFMX_DEC_H264_INTERRUPT_DISABLE,
|
|
GFMX_DEC_H264_INTERRUPT_CLEAR
|
|
} GFMX_DEC_H264_INTERRUPT_OPERATION_TYPE; // Interrupt operation.
|
|
|
|
typedef enum
|
|
{
|
|
GFMX_DEC_H264_DSP_COMMAND_INTR,
|
|
GFMX_DEC_H264_POST_PROCESSING_DONE_INTR,
|
|
GFMX_DEC_H264_DECODE_DONE_INTR
|
|
} GFMX_DEC_H264_INTERRUPT_TYPE;
|
|
|
|
typedef struct _GFMXDECH264TABLE
|
|
{
|
|
GF_RETTYPE (* MxDecH264GetProperty)(GFMxDecH264Handle hMxDecH264, PGFPROPERTY pMXProp );
|
|
GF_RETTYPE (* MxDecH264GetStatus)(GFMxDecH264Handle hMxDecH264, NvU32 * pStatus);
|
|
GF_RETTYPE (* MxDecH264DecSequence)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264DECSEQUENCE pSequence);
|
|
GF_RETTYPE (* MxDecH264DecPicture)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264DECPICTURE pPicture);
|
|
GF_RETTYPE (* MxDecH264SetSequence)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264SEQUENCE pSequence);
|
|
GF_RETTYPE (* MxDecH264SetPicture)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264PICTURE pPicture);
|
|
GF_RETTYPE (* MxDecH264SetSlice)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264SLICE pSlice);
|
|
GF_RETTYPE (* MxDecH264SetMBs)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264MB pMBs);
|
|
GF_RETTYPE (* MxDecH264PostProcessing)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264PP pP);
|
|
GF_RETTYPE (* MxDecH264SetAttribute)(GFMxDecH264Handle hMxDecH264, NvU32 uiFeature, NvU32* pInfo);
|
|
GF_RETTYPE (* MxDecH264GetAttribute)(GFMxDecH264Handle hMxDecH264, NvU32 uiFeature, NvU32* pInfo);
|
|
GF_RETTYPE (* MxDecH264Set)(GFMxDecH264Handle hMxDecH264, NvU32 uiFeature, void * pInfo);
|
|
GF_RETTYPE (* MxDecH264InterruptControl)(GFMxDecH264Handle hMxDecH264,
|
|
GFMX_DEC_H264_INTERRUPT_TYPE IntType, GFMX_DEC_H264_INTERRUPT_OPERATION_TYPE op,
|
|
void * pData);
|
|
GF_RETTYPE (* MxDecH264InterruptHandler)(GFMxDecH264Handle hMxDecH264,
|
|
GFMX_DEC_H264_INTERRUPT_TYPE IntType, void * pData); // Reserved.
|
|
GF_RETTYPE (* MxDecH264DSPPoll)(GFMxDecH264Handle hMxDecH264, NvU32 timeout);
|
|
GF_RETTYPE (* MxDecH264DecSEI)(GFMxDecH264Handle hMxDecH264, PGFMXDECH264DECSEI pSEI);
|
|
GF_RETTYPE (* MxDecH264DecNewFrameNum)(GFMxDecH264Handle hMxDecH264,NvU8* VideoBuffPtr,NvU32 VideoBufferLength);
|
|
} GFMXDECH264TABLE, *PGFMXDECH264TABLE;
|
|
|
|
/**< Typesafe functions for opening and closing this component.
|
|
This API also checks for hardware resources needed through GFRmHwResourceConstraint().
|
|
Trying to open a second video instance will fail due to existing open context.
|
|
*/
|
|
GF_RETTYPE GFMxDecH264Open(GFRmHandle hRm, GFMxDecH264Handle *phMxDecH264,
|
|
GF_STATE_TYPE state, GFRmChHandle hCh);
|
|
|
|
/**< Close the video instance.
|
|
*/
|
|
void GFMxDecH264Close(GFMxDecH264Handle *phMxDecH264);
|
|
|
|
#if NVCPU_IS_XTENSA
|
|
#define MXDH264OFFSET sizeof(GFMXDECH264TABLE)
|
|
#else
|
|
#define MXDH264OFFSET 0
|
|
#endif
|
|
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecSequence() encountered end of bitstream.
|
|
@see GFMxDecH264DecSequence()
|
|
*/
|
|
#define GFMXDECH264_ERROR_SEQUENCE_END_OF_FILE (GFMXDH264_ERROR | 0x00000001)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecSequence() bitstream format not supported.
|
|
The sequence header specifies a bitstream format, that is not supported. Most likely
|
|
reason for this error is that the H.264 profile is not supported.
|
|
@see GFMxDecH264DecSequence()
|
|
*/
|
|
#define GFMXDECH264_ERROR_SEQUENCE_NOT_SUPPORTED (GFMXDH264_ERROR | 0x00000002)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecSequence() encountered out of GPU memory error.
|
|
The application can try to free GPU memory and call GFMxDecH264DecSequence() again.
|
|
@see GFMxDecH264DecSequence()
|
|
*/
|
|
#define GFMXDECH264_ERROR_SEQUENCE_NOT_ENOUGH_MEM (GFMXDH264_ERROR | 0x00000003)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecPicture() encountered sequence header.
|
|
The application should call GFMxDecH264DecSequence() in response to this return code,
|
|
to decode the sequence header.
|
|
@see GFMxDecH264DecPicture(), GFMxDecH264DecSequence()
|
|
*/
|
|
#define GFMXDECH264_ERROR_PICTURE_DETECTED_SEQUENCE (GFMXDH264_ERROR | 0x00000004)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecPicture() encountered end of bitstream.
|
|
@see GFMxDecH264DecPicture()
|
|
*/
|
|
#define GFMXDECH264_ERROR_PICTURE_END_OF_FILE (GFMXDH264_ERROR | 0x00000005)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecPicture() encountered an unrecoverable bitstream error.
|
|
The application should call GFMxDecH264DecPicture() again, MxDecH264 will then
|
|
scan for the next frame boundary and try to decode this frame.
|
|
@see GFMxDecH264DecPicture()
|
|
*/
|
|
#define GFMXDECH264_ERROR_PICTURE_CORRUPTED_PICTURE (GFMXDH264_ERROR | 0x00000006)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecPicture() encountered out of GPU memory error.
|
|
The application can try to free GPU memory and call GFMxDecH264DecPicture() again.
|
|
@see GFMxDecH264DecPicture()
|
|
*/
|
|
#define GFMXDECH264_ERROR_PICTURE_NOT_ENOUGH_MEM (GFMXDH264_ERROR | 0x00000007)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecPicture() returns status to inform application
|
|
whether picture parameter set is not initialized, which may happen either when picture
|
|
parameter set is absent or corrupted. pic_parameter_set_id is checked for negative value.
|
|
*/
|
|
#define GFMXDECH264_ERROR_PICTURE_PARAMETER_SET_NOT_INITIALIZED (GFMXDH264_ERROR | 0x00000008)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecPicture() returns error status to inform application
|
|
that picture parameter set is corrupted.
|
|
*/
|
|
#define GFMXDECH264_ERROR_PICTURE_PARAMETER_SET_CORRUPTED (GFMXDH264_ERROR | 0x00000009)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264 API was used in invalid state of the decoder.
|
|
*/
|
|
#define GFMXDECH264_ERROR_INVALID_STATE (GFMXDH264_ERROR | 0x0000000A)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecPicture() returns status to inform application that
|
|
all the surfaces where it could decode are locked.
|
|
*/
|
|
#define GFMXDECH264_ERROR_PICTURE_ALL_SURFACES_LOCKED (GFMXDH264_ERROR | 0x0000000B)
|
|
|
|
/*For DecPic timeout on DSP side.*/
|
|
#define GFMXDECH264_ERROR_MXDEC_PIC_TIMEOUT (GFMXDH264_ERROR + 0x0000000C)
|
|
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecSEI() is not supported in bitstream callback mode.
|
|
@see GFMxDecH264DecSEI()
|
|
*/
|
|
#define GFMXDECH264_ERROR_SEI_NOT_SUPPORTED_FOR_BITSTREAM_CALLBACK_MODE (GFMXDH264_ERROR | 0x0000000D)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecSEI() encountered end of bitstream.
|
|
@see GFMxDecH264DecSEI()
|
|
*/
|
|
#define GFMXDECH264_ERROR_SEI_END_OF_FILE (GFMXDH264_ERROR | 0x0000000E)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecSEI() cannot decode this NAL Unit as its not SEI.
|
|
@see GFMxDecH264DecSEI()
|
|
*/
|
|
#define GFMXDECH264_ERROR_SEI_NOT_SEI_RBSP (GFMXDH264_ERROR | 0x0000000F)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecSEI() Timed out on DSP side.
|
|
@see GFMxDecH264DecSEI()
|
|
*/
|
|
#define GFMXDECH264_ERROR_SEI_TIMEOUT (GFMXDH264_ERROR | 0x00000010)
|
|
|
|
/** GFMxDecH264 error code: GFMxDecH264DecNewFrameNum() cannot decode this NAL Unit as
|
|
it does not contain frame number information.
|
|
@see GFMxDecH264DecNewFrameNum()
|
|
*/
|
|
#define GFMXDECH264_ERROR_DECFRAMENUM_NOTSUPPORTED (GFMXDH264_ERROR | 0x00000011)
|
|
|
|
/* #### MxDecH264 Helper macros. Maybe useful for backward compatible API. #### */
|
|
|
|
/** This function returns version and capabilities of API and hardware.
|
|
|
|
@param hMxDecH264 (GFMxDecH264Handle) Handle to MxDecH264 component
|
|
@param pMXProp (PGFPROPERTY) Pointer to property structure to be filled in
|
|
|
|
@retval #GF_SUCCESS \a pJXProp filled in successfully
|
|
@retval #GF_ERROR Some error occured
|
|
|
|
The #GFPROPERTY structure passed with parameter \a pMXProp will be
|
|
filled in on successfull return. The GFPROPERTY::Capability field
|
|
will hold a combination of flagbits indicating capabilities specific
|
|
to the MxDecH264API:
|
|
|
|
<table>
|
|
<tr><td>#GF_MXDEC_H264_CAP_BASELINE</td>
|
|
<td>Baseline profile supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_MAIN</td>
|
|
<td>Main profile supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_EXTENDED</td>
|
|
<td>Extended profile supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL10</td>
|
|
<td>LEVEL 1.0 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL11</td>
|
|
<td>LEVEL 1.1 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL12</td>
|
|
<td>LEVEL 1.2 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL13</td>
|
|
<td>LEVEL 1.3 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL20</td>
|
|
<td>LEVEL 2.0 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL21</td>
|
|
<td>LEVEL 2.1 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL22</td>
|
|
<td>LEVEL 2.2 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL30</td>
|
|
<td>LEVEL 3.0 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL31</td>
|
|
<td>LEVEL 3.1 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL32</td>
|
|
<td>LEVEL 3.2 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL40</td>
|
|
<td>LEVEL 4.0 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL41</td>
|
|
<td>LEVEL 4.1 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL42</td>
|
|
<td>LEVEL 4.2 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL50</td>
|
|
<td>LEVEL 5.0 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_LEVEL51</td>
|
|
<td>LEVEL 5.1 supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_DB</td>
|
|
<td>Post Processing de-blocking supported</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_CAP_DR</td>
|
|
<td>Post Processing de-ringing supported</td></tr>
|
|
</table>
|
|
|
|
It is a good practice to call this function to query for the API version
|
|
and its capabilities before using the rest of the MxDecH264API functions.
|
|
|
|
@see GFPROPERTY
|
|
*/
|
|
#define GFMxDecH264GetProperty(hMxDecH264, pMXProp) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264GetProperty(hMxDecH264, pMXProp)
|
|
|
|
#define GFMxDecH264GetStatus(hMxDecH264, pStatus) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264GetStatus(hMxDecH264, pStatus)
|
|
|
|
/** Decode sequence header.
|
|
|
|
@param hMxDecH264 (GFMxDecH264Handle) Handle to MxDecH264 component
|
|
@param pSequence (PGFMXDECH264DECSEQUENCE) Pointer to #GFMXDECH264DECSEQUENCE parameter structure
|
|
|
|
@retval GF_SUCCESS Sequence header was decoded successfully
|
|
|
|
NAL units with nal_unit_type = 7 should be passed to GFMxDecH264DecSequence(). Such NAL units
|
|
contain Sequence Parameter Set (SPS). The nal_ref_idc should be a non-zero value.
|
|
|
|
This function will be called whenever a sequence header is found in the bitstream, decode
|
|
it and return its characteristics.
|
|
|
|
@see GFMXDECH264DECSEQUENCE
|
|
*/
|
|
#define GFMxDecH264DecSequence(hMxDecH264, pSequence)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264DecSequence(hMxDecH264, pSequence)
|
|
|
|
/** Decode a picture.
|
|
|
|
@param hMxDecH264 (GFMxDecH264Handle) Handle to MxDecH264 component
|
|
@param pPicture (PGFMXDECH264DECPICTURE) Pointer to #GFMXDECH264DECPICTURE parameter structure
|
|
|
|
@retval GF_SUCCESS Frame was decoded successfully
|
|
@retval GFMXDECH264_ERROR_PICTURE_DETECTED_SEQUENCE Sequence header detected
|
|
@retval GFMXDECH264_ERROR_PICTURE_END_OF_FILE End of stream encountered
|
|
@retval GFMXDECH264_ERROR_PICTURE_CORRUPTED_PICTURE Unrecoverable bitstream error during frame decode
|
|
@retval GFMXDECH264_ERROR_PICTURE_NOT_ENOUGH_MEM Out of GPU memory
|
|
|
|
All NAL units with nal_unit_type other than 7, should be passed to GFMxDecH264DecPicture().
|
|
In specific, for nal_unit_type value as 8, the NAL Unit contains a Picture Parameter Set (PPS) and
|
|
for nal_unit_type ranging between 1 and 5, the NAL units contain coded slices.
|
|
|
|
GFMxDecH264DecPicture decodes one picture from the bit stream. If GFMxDecH264DecPicture detects an
|
|
error, it will perform error concealment. If the error is not concealable, GFMxDecH264DecPicture returns
|
|
the error back to the application.
|
|
If the current stream position is not on the start of a frame, the function scans forward until a frame
|
|
start or sequence header is detected.
|
|
|
|
For actions to take on the particular return codes, refer to the return code documentation.
|
|
|
|
@see GFMXDECH264DECPICTURE
|
|
*/
|
|
#define GFMxDecH264DecPicture(hMxDecH264, pPicture)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264DecPicture(hMxDecH264, pPicture)
|
|
|
|
|
|
/** Decode a SEI rbsp.
|
|
|
|
@param hMxDecH264 (GFMxDecH264Handle) Handle to MxDecH264 component
|
|
@param pSEI (PGFMXDECH264DECSEI) Pointer to #GFMXDECH264DECSEI parameter structure
|
|
|
|
@retval GF_SUCCESS SEI rbsp was decoded successfully
|
|
@retval GFMXDECH264_ERROR_SEI_NOT_SUPPORTED_FOR_BITSTREAM_CALLBACK_MODE This API is not supported in bitstream callback mode
|
|
@retval GFMXDECH264_ERROR_PICTURE_END_OF_FILE End of stream encountered
|
|
@retval GFMXDECH264_ERROR_SEI_NOT_SEI_RBSP cannot decode this NAL Unit as its not SEI
|
|
|
|
All NAL units with nal_unit_type 6 can be passed to GFMxDecH264DecSEI() for decoding in prefill mode.
|
|
|
|
GFMxDecH264DecSEI decodes SEI rbsp.
|
|
|
|
For actions to take on the particular return codes, refer to the return code documentation.
|
|
|
|
@see GFMXDECH264DECSEI
|
|
*/
|
|
#define GFMxDecH264DecSEI(hMxDecH264, pSEI)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264DecSEI(hMxDecH264, pSEI)
|
|
|
|
|
|
/** Decode slice header and extract framenumber.
|
|
|
|
@param hMxDecH264 (GFMxDecH264Handle) Handle to MxDecH264 component
|
|
@param VideoBuffPtr Pointer to bitstream
|
|
@param VideoBufferLength Length of bitstream data available in the buffer
|
|
|
|
@retval framenum Framenumber of current nal unit data
|
|
@retval GFMXDECH264_ERROR_DECFRAMENUM_NOTSUPPORTED Nal unit type not supported
|
|
|
|
NAL units with nal_unit_type 1 and 5 can be passed to parse slice header and extract
|
|
framenumber.
|
|
This function can be used in prefill buffer mode to find all nal units which
|
|
belongs to same frame before calling GFMxDecH264DecPicture.
|
|
|
|
*/
|
|
|
|
|
|
#define GFMxDecH264DecNewFrameNum(hMxDecH264,VideoBuffPtr,VideoBufferLength) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264DecNewFrameNum(hMxDecH264,VideoBuffPtr,VideoBufferLength)
|
|
|
|
|
|
#define GFMxDecH264SetSequence(hMxDecH264, pSequence)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264SetSequence(hMxDecH264, pSequence)
|
|
|
|
#define GFMxDecH264SetPicture(hMxDecH264, pPicture)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264SetPicture(hMxDecH264, pPicture)
|
|
|
|
#define GFMxDecH264SetSlice(hMxDecH264, pSlice)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264SetSlice(hMxDecH264, pSlice)
|
|
|
|
#define GFMxDecH264SetMBs(hMxDecH264, pMBs) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264SetMBs(hMxDecH264, pMBs)
|
|
|
|
/** Post Processing on a decoded YUV surface.
|
|
@param hMxDecH264 (GFMxDecH264Handle) Handle to MxDecH264 component
|
|
@param pP (PGFMXDECH264PP) Pointer to #GFMXDECH264PP parameter structure
|
|
|
|
@retval GF_SUCCESS Applied post processing on decoded surface successfully
|
|
|
|
GFMxDecH264PostProcessing() function can perform DeRinging and DeBlocking or DeBlocking only on a decoded YUV surface data.
|
|
|
|
GFMXDECH264DECSEQUENCE::PictureInfo output flagbit (GF_MXDEC_H264_DEC_PICTURE_DEBLOCKING_FILTER)
|
|
is set by the API if H264 bit stream does not have in-the-loop DeBlocking.
|
|
This means app can perform out-of-the-loop DeBlocking by calling GFMxDecH264PostProcessing().
|
|
If H264 bit stream has in-the-loop processing then hardware H264 decoder will perform in-the-loop DeBlokcing
|
|
and API resets this flag to zero to indicate that app should not perform DeBlocking.
|
|
|
|
GFMxDecH264PostProcessing can be called any time. we need decoded YUV surface data and Qp values for each MB.
|
|
If video is decoded by our hardware decoder then Qp values are saved in the internal SRAM for the last frame.
|
|
|
|
|
|
@see GFMXDECH264PP
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define GFMxDecH264PostProcessing(hMxDecH264, pP) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264PostProcessing(hMxDecH264, pP)
|
|
|
|
#define GFMxDecH264SetAttribute(hMxDecH264, uiFeature, pInfo) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264SetAttribute(hMxDecH264, uiFeature, pInfo)
|
|
|
|
#define GFMxDecH264GetAttribute(hMxDecH264, uiFeature, pInfo) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264GetAttribute(hMxDecH264, uiFeature, pInfo)
|
|
|
|
/** Set various runtime parameters.
|
|
|
|
@param hMxDecH264 (GFMxDecH264Handle) Handle to MxDecH264 component
|
|
@param uiFeature (NvU32) ID of feature to set
|
|
@param pInfo (void*) Feature specific data
|
|
|
|
@retval GF_SUCCESS Success
|
|
@retval GF_FAILURE Failure
|
|
|
|
The following features identified by parameter \a uiFeature can be set, see documentation
|
|
for the individual \a uiFeature IDs for interpretation of data in parameter \a pInfo:
|
|
<table>
|
|
<tr><td><i>uiFeature</i></td><td>Meaning</td><td><i>pInfo</i> interpretation</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_SET_READBITSTREAM</td>
|
|
<td>Set up a stream callback function.GFMxDec calls
|
|
that callback function to request a portion of the bit stream from the application.</td>
|
|
<td>#GFMXDECH264CALLBACK *</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_SET_SURFACE_LIST</td>
|
|
<td>Set a list of surfaces for to be used to store reference and decode frames.</td>
|
|
<td>#GFMXDECH264SURFLIST *</td></tr>
|
|
<tr><td>#GF_MXDEC_H264_SET_UNLOCK_SURFACE</td>
|
|
<td>Unlock one or all locked surface.</td>
|
|
<td>NvS32</td></tr>
|
|
</table>
|
|
*/
|
|
#define GFMxDecH264Set(hMxDecH264, uiFeature, pInfo) \
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264Set(hMxDecH264, uiFeature, pInfo)
|
|
|
|
#define GFMxDecH264InterruptControl(hMxDecH264, IntType, op, pData)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264InterruptControl(hMxDecH264, IntType, op, pData)
|
|
|
|
#define GFMxDecH264InterruptHandler(hMxDecH264, IntType, pData)\
|
|
((PGFMXDECH264TABLE)((NvU32)hMxDecH264+MXDH264OFFSET))->MxDecH264InterruptHandler(hMxDecH264, IntType, pData)
|
|
|
|
#define GFMxDecH264DSPPoll(MxHandle, timeout)\
|
|
((PGFMXDECH264TABLE)((NvU32)MxHandle+MXDH264OFFSET))->MxDecH264DSPPoll(MxHandle, timeout)
|
|
|
|
//Use the following flags in the setattribute function for the picture boundary mode.
|
|
//If you wish to send the sequence header separately from the first frame use the first flag(SEPARATE_SEQUENCE_HEADER)
|
|
//else use the second flag.
|
|
#define GFMXDECH264_SEPARATE_SEQUENCE_HEADER 0x1
|
|
#define GFMXDECH264_COMBINED_SEQUENCE_HEADER 0x2
|
|
|
|
|
|
/*@}*/
|
|
|
|
/** @page pageMxDecH264AppNotes MxDecH264API Application Notes
|
|
|
|
@section pageMxDecH264AppNotes1 Programming Sequence
|
|
|
|
Todo
|
|
|
|
@section pageMxDecH264AppNotes2 Decode Surface Locking
|
|
|
|
The H264 decoder can operate in a surface locking mode, which is activated by
|
|
attribute #GF_MXDEC_H264_ATTR_SURFACE_LOCKING. In this mode, GFMxDecH264DecPicture()
|
|
will automatically 'lock' the current surface with the decoded frame, and exclude it
|
|
from its surface pool available for decoding new frames.
|
|
|
|
Surface locking is intended for usecases, were the decode surface is directly used as overlay.
|
|
For the duration it is displayed as overlay, the locked state ensures, that it won't be
|
|
overwritten. With this mechanism H264 decode and screen update can run in independent thread
|
|
contexts.
|
|
|
|
If a surface from the pool is locked, it can still be used as a reference frame.
|
|
However it will never be reused and overwritten during a succeeding call to
|
|
GFMxDecH264DecPicture().
|
|
|
|
The application can re-add the locked surface to the set of writable surfaces by
|
|
calling GFMxDecH264Set / GF_MXDEC_H264_SET_UNLOCK_SURFACE.
|
|
|
|
A locked surface is identified on return from GFMxDecH264DecPicture() via
|
|
GFMXDECH264DECPICTURE::ReconSurfaceNumber. This ID needs to be passed later to
|
|
GF_MXDEC_H264_SET_UNLOCK_SURFACE to perform the unlocking.
|
|
|
|
The application has to ensure that at least <number of reference frames> + 1 surfaces
|
|
in the pool stay unlocked. If GFMxDecH264DecPicture() is called with unsufficient
|
|
free surfaces, error GFMXDECH264_ERROR_PICTURE_ALL_SURFACES_LOCKED will be returned.
|
|
|
|
The number of surfaces set via GFMxDecH264Set / GF_MXDEC_H264_SET_SURFACE_LIST /
|
|
GFMXDECH264SURFLIST::surfList must be at least N+1+M, where N is the number of reference
|
|
frames and M the maximum allowed number of simulteneously locked surfaces.
|
|
|
|
The lock-state of all surfaces can be reset via GFMxDecH264Set / GF_MXDEC_H264_SET_UNLOCK_SURFACE
|
|
passing -1 as surface ID.
|
|
*/
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|