Changed rocDecode API header variable naming to Google C++ style. (#196)
* * rocDecode: Changed rocDecode API header variable naming to Google C++ style. * * rocDecode: Unified AVC/H264 naming to AVC. Minor naming changes on HEVC related names. * * rocDecode: Minor comment fix based on code review.
This commit is contained in:
+186
-192
@@ -51,24 +51,22 @@ extern "C" {
|
||||
|
||||
typedef void *rocDecDecoderHandle;
|
||||
|
||||
|
||||
/*********************************************************************************/
|
||||
//! \enum rocDecStatus
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! rocDecoder return status enums
|
||||
//! These enums are used in all API calls to rocDecoder
|
||||
/*********************************************************************************/
|
||||
|
||||
typedef enum rocDecStatus_enum{
|
||||
ROCDEC_DEVICE_INVALID = -1,
|
||||
ROCDEC_CONTEXT_INVALID = -2,
|
||||
ROCDEC_RUNTIME_ERROR = -3,
|
||||
ROCDEC_OUTOF_MEMORY = -4,
|
||||
ROCDEC_INVALID_PARAMETER = -5,
|
||||
ROCDEC_NOT_IMPLEMENTED = -6,
|
||||
ROCDEC_NOT_INITIALIZED = -7,
|
||||
ROCDEC_NOT_SUPPORTED = -8,
|
||||
ROCDEC_SUCCESS = 0,
|
||||
ROCDEC_DEVICE_INVALID = -1,
|
||||
ROCDEC_CONTEXT_INVALID = -2,
|
||||
ROCDEC_RUNTIME_ERROR = -3,
|
||||
ROCDEC_OUTOF_MEMORY = -4,
|
||||
ROCDEC_INVALID_PARAMETER = -5,
|
||||
ROCDEC_NOT_IMPLEMENTED = -6,
|
||||
ROCDEC_NOT_INITIALIZED = -7,
|
||||
ROCDEC_NOT_SUPPORTED = -8,
|
||||
ROCDEC_SUCCESS = 0,
|
||||
}rocDecStatus;
|
||||
|
||||
/*********************************************************************************/
|
||||
@@ -78,10 +76,10 @@ typedef enum rocDecStatus_enum{
|
||||
//! These enums are used in ROCDECODECREATEINFO and ROCDECODEVIDDECODECAPS structures
|
||||
/*********************************************************************************/
|
||||
typedef enum rocDecVideoCodec_enum {
|
||||
rocDecVideoCodec_MPEG1=0, /**< MPEG1 */
|
||||
rocDecVideoCodec_MPEG1 = 0, /**< MPEG1 */
|
||||
rocDecVideoCodec_MPEG2, /**< MPEG2 */
|
||||
rocDecVideoCodec_MPEG4, /**< MPEG4 */
|
||||
rocDecVideoCodec_H264, /**< H264 */
|
||||
rocDecVideoCodec_AVC, /**< AVC/H264 */
|
||||
rocDecVideoCodec_HEVC, /**< HEVC */
|
||||
rocDecVideoCodec_AV1, /**< AV1 */
|
||||
rocDecVideoCodec_VP8, /**< VP8 */
|
||||
@@ -103,11 +101,11 @@ typedef enum rocDecVideoCodec_enum {
|
||||
//! These enums are used in RocDecoderCreateInfo structure
|
||||
/*********************************************************************************/
|
||||
typedef enum rocDecVideoSurfaceFormat_enum {
|
||||
rocDecVideoSurfaceFormat_NV12=0, /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
|
||||
rocDecVideoSurfaceFormat_P016=1, /**< 16 bit Semi-Planar YUV [Y plane followed by interleaved UV plane].
|
||||
rocDecVideoSurfaceFormat_NV12 = 0, /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
|
||||
rocDecVideoSurfaceFormat_P016 = 1, /**< 16 bit Semi-Planar YUV [Y plane followed by interleaved UV plane].
|
||||
Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
|
||||
rocDecVideoSurfaceFormat_YUV444=2, /**< Planar YUV [Y plane followed by U and V planes] */
|
||||
rocDecVideoSurfaceFormat_YUV444_16Bit=3, /**< 16 bit Planar YUV [Y plane followed by U and V planes].
|
||||
rocDecVideoSurfaceFormat_YUV444 = 2, /**< Planar YUV [Y plane followed by U and V planes] */
|
||||
rocDecVideoSurfaceFormat_YUV444_16Bit = 3, /**< 16 bit Planar YUV [Y plane followed by U and V planes].
|
||||
Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
|
||||
} rocDecVideoSurfaceFormat;
|
||||
|
||||
@@ -147,21 +145,19 @@ typedef enum rocDecodeStatus_enum {
|
||||
//! This structure is used in rocDecGetDecoderCaps API
|
||||
/**************************************************************************************************************/
|
||||
typedef struct _RocdecDecodeCaps {
|
||||
uint8_t deviceid; /**< IN: the device id for which query the decode capability
|
||||
0 for the first device, 1 for the second device on the system, etc.*/
|
||||
rocDecVideoCodec eCodecType; /**< IN: rocDecVideoCodec_XXX */
|
||||
rocDecVideoChromaFormat eChromaFormat; /**< IN: rocDecVideoChromaFormat_XXX */
|
||||
uint32_t nBitDepthMinus8; /**< IN: The Value "BitDepth minus 8" */
|
||||
uint32_t reserved1[3]; /**< Reserved for future use - set to zero */
|
||||
|
||||
uint8_t bIsSupported; /**< OUT: 1 if codec supported, 0 if not supported */
|
||||
uint8_t nNumDecoders; /**< OUT: Number of Decoders that can support IN params */
|
||||
uint16_t nOutputFormatMask; /**< OUT: each bit represents corresponding rocDecVideoSurfaceFormat enum */
|
||||
uint32_t nMaxWidth; /**< OUT: Max supported coded width in pixels */
|
||||
uint32_t nMaxHeight; /**< OUT: Max supported coded height in pixels */
|
||||
uint16_t nMinWidth; /**< OUT: Min supported coded width in pixels */
|
||||
uint16_t nMinHeight; /**< OUT: Min supported coded height in pixels */
|
||||
uint32_t reserved2[6]; /**< Reserved for future use - set to zero */
|
||||
uint8_t device_id; /**< IN: the device id for which query the decode capability 0 for the first device, 1 for the second device on the system, etc.*/
|
||||
rocDecVideoCodec codec_type; /**< IN: rocDecVideoCodec_XXX */
|
||||
rocDecVideoChromaFormat chroma_format; /**< IN: rocDecVideoChromaFormat_XXX */
|
||||
uint32_t bit_depth_minus_8; /**< IN: The Value "BitDepth minus 8" */
|
||||
uint32_t reserved_1[3]; /**< Reserved for future use - set to zero */
|
||||
uint8_t is_supported; /**< OUT: 1 if codec supported, 0 if not supported */
|
||||
uint8_t num_decoders; /**< OUT: Number of Decoders that can support IN params */
|
||||
uint16_t output_format_mask; /**< OUT: each bit represents corresponding rocDecVideoSurfaceFormat enum */
|
||||
uint32_t max_width; /**< OUT: Max supported coded width in pixels */
|
||||
uint32_t max_height; /**< OUT: Max supported coded height in pixels */
|
||||
uint16_t min_width; /**< OUT: Min supported coded width in pixels */
|
||||
uint16_t min_height; /**< OUT: Min supported coded height in pixels */
|
||||
uint32_t reserved_2[6]; /**< Reserved for future use - set to zero */
|
||||
} RocdecDecodeCaps;
|
||||
|
||||
/**************************************************************************************************************/
|
||||
@@ -170,21 +166,21 @@ typedef struct _RocdecDecodeCaps {
|
||||
//! This structure is used in rocDecCreateDecoder API
|
||||
/**************************************************************************************************************/
|
||||
typedef struct _RocDecoderCreateInfo {
|
||||
uint8_t deviceid; /**< IN: the device id for which a decoder should be created
|
||||
uint8_t device_id; /**< IN: the device id for which a decoder should be created
|
||||
0 for the first device, 1 for the second device on the system, etc.*/
|
||||
uint32_t ulWidth; /**< IN: Coded sequence width in pixels */
|
||||
uint32_t ulHeight; /**< IN: Coded sequence height in pixels */
|
||||
uint32_t ulNumDecodeSurfaces; /**< IN: Maximum number of internal decode surfaces */
|
||||
rocDecVideoCodec CodecType; /**< IN: rocDecVideoCodec_XXX */
|
||||
rocDecVideoChromaFormat ChromaFormat; /**< IN: rocDecVideoChromaFormat_XXX */
|
||||
uint32_t bitDepthMinus8; /**< IN: The value "BitDepth minus 8" */
|
||||
uint32_t ulIntraDecodeOnly; /**< IN: Set 1 only if video has all intra frames (default value is 0). This will
|
||||
uint32_t width; /**< IN: Coded sequence width in pixels */
|
||||
uint32_t height; /**< IN: Coded sequence height in pixels */
|
||||
uint32_t num_decode_surfaces; /**< IN: Maximum number of internal decode surfaces */
|
||||
rocDecVideoCodec codec_type; /**< IN: rocDecVideoCodec_XXX */
|
||||
rocDecVideoChromaFormat chroma_format; /**< IN: rocDecVideoChromaFormat_XXX */
|
||||
uint32_t bit_depth_minus_8; /**< IN: The value "BitDepth minus 8" */
|
||||
uint32_t intra_decode_only; /**< IN: Set 1 only if video has all intra frames (default value is 0). This will
|
||||
optimize video memory for Intra frames only decoding. The support is limited
|
||||
to specific codecs - H264, HEVC, VP9, the flag will be ignored for codecs which
|
||||
to specific codecs - AVC/H264, HEVC, VP9, the flag will be ignored for codecs which
|
||||
are not supported. However decoding might fail if the flag is enabled in case
|
||||
of supported codecs for regular bit streams having P and/or B frames. */
|
||||
uint32_t ulMaxWidth; /**< IN: Coded sequence max width in pixels used with reconfigure Decoder */
|
||||
uint32_t ulMaxHeight; /**< IN: Coded sequence max height in pixels used with reconfigure Decoder */
|
||||
uint32_t max_width; /**< IN: Coded sequence max width in pixels used with reconfigure Decoder */
|
||||
uint32_t max_height; /**< IN: Coded sequence max height in pixels used with reconfigure Decoder */
|
||||
/**
|
||||
* IN: area of the frame that should be displayed
|
||||
*/
|
||||
@@ -195,14 +191,14 @@ typedef struct _RocDecoderCreateInfo {
|
||||
int16_t bottom;
|
||||
} display_area;
|
||||
|
||||
rocDecVideoSurfaceFormat OutputFormat; /**< IN: rocDecVideoSurfaceFormat_XXX */
|
||||
uint32_t ulTargetWidth; /**< IN: Post-processed output width (Should be aligned to 2) */
|
||||
uint32_t ulTargetHeight; /**< IN: Post-processed output height (Should be aligned to 2) */
|
||||
uint32_t ulNumOutputSurfaces; /**< IN: Maximum number of output surfaces simultaneously mapped */
|
||||
rocDecVideoSurfaceFormat output_format; /**< IN: rocDecVideoSurfaceFormat_XXX */
|
||||
uint32_t target_width; /**< IN: Post-processed output width (Should be aligned to 2) */
|
||||
uint32_t target_height; /**< IN: Post-processed output height (Should be aligned to 2) */
|
||||
uint32_t num_output_surfaces; /**< IN: Maximum number of output surfaces simultaneously mapped */
|
||||
|
||||
/**
|
||||
* IN: target rectangle in the output frame (for aspect ratio conversion)
|
||||
* if a null rectangle is specified, {0,0,ulTargetWidth,ulTargetHeight} will be used
|
||||
* if a null rectangle is specified, {0,0,target_width,target_height} will be used
|
||||
*/
|
||||
struct {
|
||||
int16_t left;
|
||||
@@ -211,7 +207,7 @@ typedef struct _RocDecoderCreateInfo {
|
||||
int16_t bottom;
|
||||
} target_rect;
|
||||
|
||||
uint32_t Reserved2[4]; /**< Reserved for future use - set to zero */
|
||||
uint32_t reserved_2[4]; /**< Reserved for future use - set to zero */
|
||||
} RocDecoderCreateInfo;
|
||||
|
||||
/*********************************************************************************************************/
|
||||
@@ -221,9 +217,9 @@ typedef struct _RocDecoderCreateInfo {
|
||||
//! This structure is used in RocdecGetDecodeStatus API.
|
||||
/*********************************************************************************************************/
|
||||
typedef struct _RocdecDecodeStatus {
|
||||
rocDecDecodeStatus decodeStatus;
|
||||
uint32_t reserved[31];
|
||||
void *pReserved[8];
|
||||
rocDecDecodeStatus decode_status;
|
||||
uint32_t reserved[31];
|
||||
void *p_reserved[8];
|
||||
} RocdecDecodeStatus;
|
||||
|
||||
/****************************************************/
|
||||
@@ -233,12 +229,12 @@ typedef struct _RocdecDecodeStatus {
|
||||
//! This structure is used in rocDecReconfigureDecoder() API
|
||||
/****************************************************/
|
||||
typedef struct _RocdecReconfigureDecoderInfo {
|
||||
uint32_t ulWidth; /**< IN: Coded sequence width in pixels, MUST be < = ulMaxWidth defined at RocDecoderCreateInfo */
|
||||
uint32_t ulHeight; /**< IN: Coded sequence height in pixels, MUST be < = ulMaxHeight defined at RocDecoderCreateInfo */
|
||||
uint32_t ulTargetWidth; /**< IN: Post processed output width */
|
||||
uint32_t ulTargetHeight; /**< IN: Post Processed output height */
|
||||
uint32_t ulNumDecodeSurfaces; /**< IN: Maximum number of internal decode surfaces */
|
||||
uint32_t reserved1[12]; /**< Reserved for future use. Set to Zero */
|
||||
uint32_t width; /**< IN: Coded sequence width in pixels, MUST be < = max_width defined at RocDecoderCreateInfo */
|
||||
uint32_t height; /**< IN: Coded sequence height in pixels, MUST be < = max_height defined at RocDecoderCreateInfo */
|
||||
uint32_t target_width; /**< IN: Post processed output width */
|
||||
uint32_t target_height; /**< IN: Post Processed output height */
|
||||
uint32_t num_decode_surfaces; /**< IN: Maximum number of internal decode surfaces */
|
||||
uint32_t reserved_1[12]; /**< Reserved for future use. Set to Zero */
|
||||
/**
|
||||
* IN: Area of frame to be displayed. Use-case : Source Cropping
|
||||
*/
|
||||
@@ -257,7 +253,7 @@ typedef struct _RocdecReconfigureDecoderInfo {
|
||||
int16_t right;
|
||||
int16_t bottom;
|
||||
} target_rect;
|
||||
uint32_t reserved2[11]; /**< Reserved for future use. Set to Zero */
|
||||
uint32_t reserved_2[11]; /**< Reserved for future use. Set to Zero */
|
||||
} RocdecReconfigureDecoderInfo;
|
||||
|
||||
/*********************************************************/
|
||||
@@ -267,56 +263,56 @@ typedef struct _RocdecReconfigureDecoderInfo {
|
||||
//! This structure is used in RocdecAvcPicParams structure
|
||||
/*********************************************************/
|
||||
typedef struct _RocdecAvcPicture {
|
||||
int PicIdx; /**< picture index of reference frame */
|
||||
uint32_t FrameIdx; /**< frame_num(int16_t-term) or LongTermFrameIdx(long-term) */
|
||||
uint32_t Flags; /**< See below for definitions */
|
||||
int32_t TopFieldOrderCnt; /**< field order count of top field */
|
||||
int32_t BottomFieldOrderCnt; /**< field order count of bottom field */
|
||||
uint32_t reserved[4];
|
||||
int pic_idx; /**< picture index of reference frame */
|
||||
uint32_t frame_idx; /**< frame_num(int16_t-term) or LongTermFrameIdx(long-term) */
|
||||
uint32_t flags; /**< See below for definitions */
|
||||
int32_t top_field_order_cnt; /**< field order count of top field */
|
||||
int32_t bottom_field_order_cnt; /**< field order count of bottom field */
|
||||
uint32_t reserved[4];
|
||||
} RocdecAvcPicture;
|
||||
|
||||
/* flags in RocdecAvcPicture could be OR of the following */
|
||||
#define RocdecH264Picture_FLAGS_INVALID 0x00000001
|
||||
#define RocdecH264Picture_FLAGS_TOP_FIELD 0x00000002
|
||||
#define RocdecH264Picture_FLAGS_BOTTOM_FIELD 0x00000004
|
||||
#define RocdecH264Picture_FLAGS_SHORT_TERM_REFERENCE 0x00000008
|
||||
#define RocdecH264Picture_FLAGS_LONG_TERM_REFERENCE 0x00000010
|
||||
#define RocdecH264Picture_FLAGS_NON_EXISTING 0x00000020
|
||||
#define RocdecAvcPicture_FLAGS_INVALID 0x00000001
|
||||
#define RocdecAvcPicture_FLAGS_TOP_FIELD 0x00000002
|
||||
#define RocdecAvcPicture_FLAGS_BOTTOM_FIELD 0x00000004
|
||||
#define RocdecAvcPicture_FLAGS_SHORT_TERM_REFERENCE 0x00000008
|
||||
#define RocdecAvcPicture_FLAGS_LONG_TERM_REFERENCE 0x00000010
|
||||
#define RocdecAvcPicture_FLAGS_NON_EXISTING 0x00000020
|
||||
|
||||
/*********************************************************/
|
||||
//! \struct RocdecHEVCPicture
|
||||
//! \struct RocdecHevcPicture
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! HEVC Picture Entry
|
||||
//! This structure is used in RocdecHevcPicParams structure
|
||||
/*********************************************************/
|
||||
typedef struct _RocdecHEVCPicture {
|
||||
int PicIdx; /**< reconstructed picture surface ID */
|
||||
typedef struct _RocdecHevcPicture {
|
||||
int pic_idx; /**< reconstructed picture surface ID */
|
||||
/** \brief picture order count.
|
||||
//! \ingroup group_amd_rocdecode
|
||||
* in HEVC, POCs for top and bottom fields of same picture should
|
||||
* take different values.
|
||||
*/
|
||||
int POC;
|
||||
uint32_t Flags; /**< See below for definitions */
|
||||
uint32_t Reserved[4]; /**< reserved for future; must be zero */
|
||||
} RocdecHEVCPicture;
|
||||
int poc;
|
||||
uint32_t flags; /**< See below for definitions */
|
||||
uint32_t reserved[4]; /**< reserved for future; must be zero */
|
||||
} RocdecHevcPicture;
|
||||
|
||||
/* flags in RocdecHEVCPicture could be OR of the following */
|
||||
#define RocdecHEVCPicture_INVALID 0x00000001
|
||||
/* flags in RocdecHevcPicture could be OR of the following */
|
||||
#define RocdecHevcPicture_INVALID 0x00000001
|
||||
/** \brief indication of interlace scan picture.
|
||||
* should take same value for all the pictures in sequence.
|
||||
*/
|
||||
#define RocdecHEVCPicture_FIELD_PIC 0x00000002
|
||||
#define RocdecHevcPicture_FIELD_PIC 0x00000002
|
||||
/** \brief polarity of the field picture.
|
||||
* top field takes even lines of buffer surface.
|
||||
* bottom field takes odd lines of buffer surface.
|
||||
*/
|
||||
#define RocdecHEVCPicture_BOTTOM_FIELD 0x00000004
|
||||
#define RocdecHevcPicture_BOTTOM_FIELD 0x00000004
|
||||
/** \brief Long term reference picture */
|
||||
#define RocdecHEVCPicture_LONG_TERM_REFERENCE 0x00000008
|
||||
#define RocdecHevcPicture_LONG_TERM_REFERENCE 0x00000008
|
||||
/**
|
||||
* RocdecHEVCPicture_ST_CURR_BEFORE, RocdecHEVCPicture_RPS_ST_CURR_AFTER
|
||||
* and RocdecHEVCPicture_RPS_LT_CURR of any picture in ReferenceFrames[] should
|
||||
* RocdecHevcPicture_ST_CURR_BEFORE, RocdecHevcPicture_RPS_ST_CURR_AFTER
|
||||
* and RocdecHevcPicture_RPS_LT_CURR of any picture in ReferenceFrames[] should
|
||||
* be exclusive. No more than one of them can be set for any picture.
|
||||
* Sum of NumPocStCurrBefore, NumPocStCurrAfter and NumPocLtCurr
|
||||
* equals NumPocTotalCurr, which should be equal to or smaller than 8.
|
||||
@@ -328,17 +324,17 @@ typedef struct _RocdecHEVCPicture {
|
||||
* Number of ReferenceFrames[] entries with this bit set equals
|
||||
* NumPocStCurrBefore.
|
||||
*/
|
||||
#define RocdecHEVCPicture_RPS_ST_CURR_BEFORE 0x00000010
|
||||
#define RocdecHevcPicture_RPS_ST_CURR_BEFORE 0x00000010
|
||||
/** \brief RefPicSetStCurrAfter of HEVC spec variable
|
||||
* Number of ReferenceFrames[] entries with this bit set equals
|
||||
* NumPocStCurrAfter.
|
||||
*/
|
||||
#define RocdecHEVCPicture_RPS_ST_CURR_AFTER 0x00000020
|
||||
#define RocdecHevcPicture_RPS_ST_CURR_AFTER 0x00000020
|
||||
/** \brief RefPicSetLtCurr of HEVC spec variable
|
||||
* Number of ReferenceFrames[] entries with this bit set equals
|
||||
* NumPocLtCurr.
|
||||
*/
|
||||
#define RocdecHEVCPicture_RPS_LT_CURR 0x00000040
|
||||
#define RocdecHevcPicture_RPS_LT_CURR 0x00000040
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecJPEGPicParams placeholder
|
||||
@@ -347,7 +343,7 @@ typedef struct _RocdecHEVCPicture {
|
||||
//! This structure is used in RocdecPicParams structure
|
||||
/***********************************************************/
|
||||
typedef struct _RocdecJPEGPicParams {
|
||||
int Reserved;
|
||||
int reserved;
|
||||
} RocdecJPEGPicParams;
|
||||
|
||||
/***********************************************************/
|
||||
@@ -367,7 +363,6 @@ typedef struct _RocdecMpeg2QMatrix {
|
||||
uint8_t chroma_non_intra_quantiser_matrix[64];
|
||||
} RocdecMpeg2QMatrix;
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecMpeg2PicParams
|
||||
//! \ingroup group_amd_rocdecode
|
||||
@@ -400,7 +395,7 @@ typedef struct _RocdecMpeg2PicParams {
|
||||
} picture_coding_extension;
|
||||
|
||||
RocdecMpeg2QMatrix q_matrix;
|
||||
uint32_t Reserved[4];
|
||||
uint32_t reserved[4];
|
||||
} RocdecMpeg2PicParams;
|
||||
|
||||
/***********************************************************/
|
||||
@@ -410,7 +405,7 @@ typedef struct _RocdecMpeg2PicParams {
|
||||
//! This structure is used in RocdecVc1PicParams structure
|
||||
/***********************************************************/
|
||||
typedef struct _RocdecVc1PicParams {
|
||||
int Reserved;
|
||||
int reserved;
|
||||
} RocdecVc1PicParams;
|
||||
|
||||
/***********************************************************/
|
||||
@@ -470,7 +465,7 @@ typedef struct _RocdecAvcPicParams {
|
||||
} pic_fields;
|
||||
uint16_t frame_num;
|
||||
|
||||
uint32_t Reserved[8];
|
||||
uint32_t reserved[8];
|
||||
} RocdecAvcPicParams;
|
||||
|
||||
/***********************************************************/
|
||||
@@ -480,9 +475,9 @@ typedef struct _RocdecAvcPicParams {
|
||||
//! This structure is configured to be the same as VA-API VASliceParameterBufferH264 structure
|
||||
/***********************************************************/
|
||||
typedef struct _RocdecAvcSliceParams {
|
||||
uint32_t slice_data_size; // slice size in bytes
|
||||
uint32_t slice_data_offset; // byte offset of the current slice in the slice data buffer
|
||||
uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
|
||||
uint32_t slice_data_size; // slice size in bytes
|
||||
uint32_t slice_data_offset; // byte offset of the current slice in the slice data buffer
|
||||
uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
|
||||
/**
|
||||
* \brief Bit offset from NAL Header Unit to the begining of slice_data().
|
||||
*
|
||||
@@ -493,36 +488,36 @@ typedef struct _RocdecAvcSliceParams {
|
||||
* the original bitstream, thus including any emulation prevention
|
||||
* bytes.
|
||||
*/
|
||||
uint16_t slice_data_bit_offset;
|
||||
uint16_t slice_data_bit_offset;
|
||||
|
||||
uint16_t first_mb_in_slice;
|
||||
uint8_t slice_type;
|
||||
uint8_t direct_spatial_mv_pred_flag;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
uint8_t cabac_init_idc;
|
||||
int8_t slice_qp_delta;
|
||||
uint8_t disable_deblocking_filter_idc;
|
||||
int8_t slice_alpha_c0_offset_div2;
|
||||
int8_t slice_beta_offset_div2;
|
||||
RocdecAvcPicture ref_pic_list_0[32]; // 8.2.4.2
|
||||
RocdecAvcPicture ref_pic_list_1[32]; // 8.2.4.2
|
||||
uint8_t luma_log2_weight_denom;
|
||||
uint8_t chroma_log2_weight_denom;
|
||||
uint8_t luma_weight_l0_flag;
|
||||
int16_t luma_weight_l0[32];
|
||||
int16_t luma_offset_l0[32];
|
||||
uint8_t chroma_weight_l0_flag;
|
||||
int16_t chroma_weight_l0[32][2];
|
||||
int16_t chroma_offset_l0[32][2];
|
||||
uint8_t luma_weight_l1_flag;
|
||||
int16_t luma_weight_l1[32];
|
||||
int16_t luma_offset_l1[32];
|
||||
uint8_t chroma_weight_l1_flag;
|
||||
int16_t chroma_weight_l1[32][2];
|
||||
int16_t chroma_offset_l1[32][2];
|
||||
uint16_t first_mb_in_slice;
|
||||
uint8_t slice_type;
|
||||
uint8_t direct_spatial_mv_pred_flag;
|
||||
uint8_t num_ref_idx_l0_active_minus1;
|
||||
uint8_t num_ref_idx_l1_active_minus1;
|
||||
uint8_t cabac_init_idc;
|
||||
int8_t slice_qp_delta;
|
||||
uint8_t disable_deblocking_filter_idc;
|
||||
int8_t slice_alpha_c0_offset_div2;
|
||||
int8_t slice_beta_offset_div2;
|
||||
RocdecAvcPicture ref_pic_list_0[32]; // 8.2.4.2
|
||||
RocdecAvcPicture ref_pic_list_1[32]; // 8.2.4.2
|
||||
uint8_t luma_log2_weight_denom;
|
||||
uint8_t chroma_log2_weight_denom;
|
||||
uint8_t luma_weight_l0_flag;
|
||||
int16_t luma_weight_l0[32];
|
||||
int16_t luma_offset_l0[32];
|
||||
uint8_t chroma_weight_l0_flag;
|
||||
int16_t chroma_weight_l0[32][2];
|
||||
int16_t chroma_offset_l0[32][2];
|
||||
uint8_t luma_weight_l1_flag;
|
||||
int16_t luma_weight_l1[32];
|
||||
int16_t luma_offset_l1[32];
|
||||
uint8_t chroma_weight_l1_flag;
|
||||
int16_t chroma_weight_l1[32][2];
|
||||
int16_t chroma_offset_l1[32][2];
|
||||
|
||||
uint32_t va_reserved[4];
|
||||
uint32_t reserved[4];
|
||||
} RocdecAvcSliceParams;
|
||||
|
||||
/***********************************************************/
|
||||
@@ -533,12 +528,12 @@ typedef struct _RocdecAvcSliceParams {
|
||||
/***********************************************************/
|
||||
typedef struct _RocdecAvcIQMatrix {
|
||||
/** \brief 4x4 scaling list, in raster scan order. */
|
||||
uint8_t scaling_list_4x4[6][16];
|
||||
uint8_t scaling_list_4x4[6][16];
|
||||
/** \brief 8x8 scaling list, in raster scan order. */
|
||||
uint8_t scaling_list_8x8[2][64];
|
||||
uint8_t scaling_list_8x8[2][64];
|
||||
|
||||
/** \brief Reserved bytes for future use, must be zero */
|
||||
uint32_t va_reserved[4];
|
||||
uint32_t reserved[4];
|
||||
} RocdecAvcIQMatrix;
|
||||
|
||||
/***********************************************************/
|
||||
@@ -548,10 +543,10 @@ typedef struct _RocdecAvcIQMatrix {
|
||||
//! This structure is used in RocdecHevcPicParams structure
|
||||
/***********************************************************/
|
||||
typedef struct _RocdecHevcPicParams {
|
||||
RocdecHEVCPicture curr_pic;
|
||||
RocdecHEVCPicture ref_frames[15]; /* reference frame list in DPB */
|
||||
uint16_t picture_width_in_luma_samples;
|
||||
uint16_t picture_height_in_luma_samples;
|
||||
RocdecHevcPicture curr_pic;
|
||||
RocdecHevcPicture ref_frames[15]; /* reference frame list in DPB */
|
||||
uint16_t picture_width_in_luma_samples;
|
||||
uint16_t picture_height_in_luma_samples;
|
||||
union {
|
||||
struct {
|
||||
/** following flags have same syntax and semantic as those in HEVC spec */
|
||||
@@ -574,11 +569,10 @@ typedef struct _RocdecHevcPicParams {
|
||||
uint32_t loop_filter_across_tiles_enabled_flag : 1;
|
||||
uint32_t pcm_loop_filter_disabled_flag : 1;
|
||||
/** set based on sps_max_num_reorder_pics of current temporal layer. */
|
||||
uint32_t NoPicReorderingFlag : 1;
|
||||
uint32_t no_pic_reordering_flag : 1;
|
||||
/** picture has no B slices */
|
||||
uint32_t NoBiPredFlag : 1;
|
||||
|
||||
uint32_t ReservedBits : 11;
|
||||
uint32_t no_bi_pred_flag : 1;
|
||||
uint32_t reserved_bits : 11;
|
||||
} bits;
|
||||
uint32_t value;
|
||||
} pic_fields;
|
||||
@@ -627,13 +621,13 @@ typedef struct _RocdecHevcPicParams {
|
||||
uint32_t slice_segment_header_extension_present_flag : 1;
|
||||
|
||||
/** current picture with NUT between 16 and 21 inclusive */
|
||||
uint32_t RapPicFlag : 1;
|
||||
uint32_t rap_pic_flag : 1;
|
||||
/** current picture with NUT between 19 and 20 inclusive */
|
||||
uint32_t IdrPicFlag : 1;
|
||||
uint32_t idr_pic_flag : 1;
|
||||
/** current picture has only intra slices */
|
||||
uint32_t IntraPicFlag : 1;
|
||||
uint32_t intra_pic_flag : 1;
|
||||
|
||||
uint32_t ReservedBits : 18;
|
||||
uint32_t reserved_bits : 18;
|
||||
} bits;
|
||||
uint32_t value;
|
||||
} slice_parsing_fields;
|
||||
@@ -691,16 +685,16 @@ typedef struct _RocdecHevcSliceParams {
|
||||
/** HEVC syntax element. */
|
||||
uint32_t slice_segment_address;
|
||||
/** \brief index into ReferenceFrames[]
|
||||
* RefPicList[0][] corresponds to RefPicList0[] of HEVC variable.
|
||||
* RefPicList[1][] corresponds to RefPicList1[] of HEVC variable.
|
||||
* ref_pic_list[0][] corresponds to RefPicList0[] of HEVC variable.
|
||||
* ref_pic_list[1][] corresponds to RefPicList1[] of HEVC variable.
|
||||
* value range [0..14, 0xFF], where 0xFF indicates invalid entry.
|
||||
*/
|
||||
uint8_t RefPicList[2][15];
|
||||
uint8_t ref_pic_list[2][15];
|
||||
union {
|
||||
uint32_t value;
|
||||
struct {
|
||||
/** current slice is last slice of picture. */
|
||||
uint32_t LastSliceOfPic : 1;
|
||||
uint32_t last_slice_of_pic : 1;
|
||||
/** HEVC syntax element. */
|
||||
uint32_t dependent_slice_segment_flag : 1;
|
||||
uint32_t slice_type : 2;
|
||||
@@ -715,7 +709,7 @@ typedef struct _RocdecHevcSliceParams {
|
||||
uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
|
||||
uint32_t reserved : 18;
|
||||
} fields;
|
||||
} LongSliceFlags;
|
||||
} long_slice_flags;
|
||||
|
||||
/** HEVC syntax element. */
|
||||
uint8_t collocated_ref_idx;
|
||||
@@ -732,17 +726,17 @@ typedef struct _RocdecHevcSliceParams {
|
||||
int8_t luma_offset_l0[15];
|
||||
int8_t delta_chroma_weight_l0[15][2];
|
||||
/** corresponds to HEVC spec variable of the same name. */
|
||||
int8_t ChromaOffsetL0[15][2];
|
||||
int8_t chroma_offset_l0[15][2];
|
||||
/** HEVC syntax element. */
|
||||
int8_t delta_luma_weight_l1[15];
|
||||
int8_t luma_offset_l1[15];
|
||||
int8_t delta_chroma_weight_l1[15][2];
|
||||
/** corresponds to HEVC spec variable of the same name. */
|
||||
int8_t ChromaOffsetL1[15][2];
|
||||
int8_t chroma_offset_l1[15][2];
|
||||
/** HEVC syntax element. */
|
||||
uint8_t five_minus_max_num_merge_cand;
|
||||
uint16_t num_entry_point_offsets;
|
||||
uint16_t entry_offset_to_subset_array;
|
||||
uint16_t num_entry_point_offsets;
|
||||
uint16_t entry_offset_to_subset_array;
|
||||
/** \brief Number of emulation prevention bytes in slice header. */
|
||||
uint16_t slice_data_num_emu_prevn_bytes;
|
||||
|
||||
@@ -765,39 +759,39 @@ typedef struct _RocdecHevcIQMatrix {
|
||||
* correspongs i = 0, MatrixID is in the range of 0 to 5,
|
||||
* inclusive. And j is in the range of 0 to 15, inclusive.
|
||||
*/
|
||||
uint8_t ScalingList4x4[6][16];
|
||||
uint8_t scaling_list_4x4[6][16];
|
||||
/**
|
||||
* \brief 8x8 scaling,
|
||||
* correspongs i = 1, MatrixID is in the range of 0 to 5,
|
||||
* inclusive. And j is in the range of 0 to 63, inclusive.
|
||||
*/
|
||||
uint8_t ScalingList8x8[6][64];
|
||||
uint8_t scaling_list_8x8[6][64];
|
||||
/**
|
||||
* \brief 16x16 scaling,
|
||||
* correspongs i = 2, MatrixID is in the range of 0 to 5,
|
||||
* inclusive. And j is in the range of 0 to 63, inclusive.
|
||||
*/
|
||||
uint8_t ScalingList16x16[6][64];
|
||||
uint8_t scaling_list_16x16[6][64];
|
||||
/**
|
||||
* \brief 32x32 scaling,
|
||||
* correspongs i = 3, MatrixID is in the range of 0 to 1,
|
||||
* inclusive. And j is in the range of 0 to 63, inclusive.
|
||||
*/
|
||||
uint8_t ScalingList32x32[2][64];
|
||||
uint8_t scaling_list_32x32[2][64];
|
||||
/**
|
||||
* \brief DC values of the 16x16 scaling lists,
|
||||
* corresponds to HEVC spec syntax
|
||||
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
|
||||
* with sizeID = 2 and matrixID in the range of 0 to 5, inclusive.
|
||||
*/
|
||||
uint8_t ScalingListDC16x16[6];
|
||||
uint8_t scaling_list_dc_16x16[6];
|
||||
/**
|
||||
* \brief DC values of the 32x32 scaling lists,
|
||||
* corresponds to HEVC spec syntax
|
||||
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
|
||||
* with sizeID = 3 and matrixID in the range of 0 to 1, inclusive.
|
||||
*/
|
||||
uint8_t ScalingListDC32x32[2];
|
||||
uint8_t scaling_list_dc_32x32[2];
|
||||
|
||||
uint32_t reserved[4];
|
||||
} RocdecHevcIQMatrix;
|
||||
@@ -810,42 +804,42 @@ typedef struct _RocdecHevcIQMatrix {
|
||||
//! IN for rocDecDecodePicture
|
||||
/******************************************************************************************/
|
||||
typedef struct _RocdecPicParams {
|
||||
int PicWidth; /**< IN: Coded frame width */
|
||||
int PicHeight; /**< IN: Coded frame height */
|
||||
int CurrPicIdx; /**< IN: Output index of the current picture */
|
||||
int field_pic_flag; /**< IN: 0=frame picture, 1=field picture */
|
||||
int bottom_field_flag; /**< IN: 0=top field, 1=bottom field (ignored if field_pic_flag=0) */
|
||||
int second_field; /**< IN: Second field of a complementary field pair */
|
||||
int pic_width; /**< IN: Coded frame width */
|
||||
int pic_height; /**< IN: Coded frame height */
|
||||
int curr_pic_idx; /**< IN: Output index of the current picture */
|
||||
int field_pic_flag; /**< IN: 0=frame picture, 1=field picture */
|
||||
int bottom_field_flag; /**< IN: 0=top field, 1=bottom field (ignored if field_pic_flag=0) */
|
||||
int second_field; /**< IN: Second field of a complementary field pair */
|
||||
// Bitstream data
|
||||
uint32_t nBitstreamDataLen; /**< IN: Number of bytes in bitstream data buffer */
|
||||
const uint8_t *pBitstreamData; /**< IN: Ptr to bitstream data for this picture (slice-layer) */
|
||||
uint32_t nNumSlices; /**< IN: Number of slices in this picture */
|
||||
const uint32_t *pSliceDataOffsets; /**< IN: nNumSlices entries, contains offset of each slice within
|
||||
uint32_t bitstream_data_len; /**< IN: Number of bytes in bitstream data buffer */
|
||||
const uint8_t *bitstream_data; /**< IN: Ptr to bitstream data for this picture (slice-layer) */
|
||||
uint32_t num_slices; /**< IN: Number of slices in this picture */
|
||||
const uint32_t *slice_data_offsets; /**< IN: num_slices entries, contains offset of each slice within
|
||||
the bitstream data buffer */
|
||||
int ref_pic_flag; /**< IN: This picture is a reference picture */
|
||||
int intra_pic_flag; /**< IN: This picture is entirely intra coded */
|
||||
uint32_t Reserved[30]; /**< Reserved for future use */
|
||||
int ref_pic_flag; /**< IN: This picture is a reference picture */
|
||||
int intra_pic_flag; /**< IN: This picture is entirely intra coded */
|
||||
uint32_t reserved[30]; /**< Reserved for future use */
|
||||
|
||||
// IN: Codec-specific data
|
||||
union {
|
||||
RocdecMpeg2PicParams mpeg2; /**< Also used for MPEG-1 */
|
||||
RocdecAvcPicParams avc;
|
||||
RocdecHevcPicParams hevc;
|
||||
RocdecVc1PicParams vc1;
|
||||
RocdecJPEGPicParams jpeg;
|
||||
uint32_t CodecReserved[256];
|
||||
RocdecMpeg2PicParams mpeg2; /**< Also used for MPEG-1 */
|
||||
RocdecAvcPicParams avc;
|
||||
RocdecHevcPicParams hevc;
|
||||
RocdecVc1PicParams vc1;
|
||||
RocdecJPEGPicParams jpeg;
|
||||
uint32_t codec_reserved[256];
|
||||
} pic_params;
|
||||
|
||||
union {
|
||||
// Todo: Add slice params defines for other codecs.
|
||||
RocdecAvcSliceParams avc;
|
||||
RocdecHevcSliceParams hevc;
|
||||
RocdecAvcSliceParams avc;
|
||||
RocdecHevcSliceParams hevc;
|
||||
} slice_params;
|
||||
|
||||
union {
|
||||
// Todo: Added IQ matrix defines for other codecs.
|
||||
RocdecAvcIQMatrix avc;
|
||||
RocdecHevcIQMatrix hevc;
|
||||
RocdecAvcIQMatrix avc;
|
||||
RocdecHevcIQMatrix hevc;
|
||||
} iq_matrix;
|
||||
} RocdecPicParams;
|
||||
|
||||
@@ -857,19 +851,19 @@ typedef struct _RocdecPicParams {
|
||||
/******************************************************/
|
||||
typedef struct _RocdecProcParams
|
||||
{
|
||||
int progressive_frame; /**< IN: Input is progressive (deinterlace_mode will be ignored) */
|
||||
int top_field_first; /**< IN: Input frame is top field first (1st field is top, 2nd field is bottom) */
|
||||
uint32_t reserved_flags[2]; /**< Reserved for future use (set to zero) */
|
||||
int progressive_frame; /**< IN: Input is progressive (deinterlace_mode will be ignored) */
|
||||
int top_field_first; /**< IN: Input frame is top field first (1st field is top, 2nd field is bottom) */
|
||||
uint32_t reserved_flags[2]; /**< Reserved for future use (set to zero) */
|
||||
|
||||
// The fields below are used for raw YUV input
|
||||
uint64_t raw_input_dptr; /**< IN: Input HIP device ptr for raw YUV extensions */
|
||||
uint32_t raw_input_pitch; /**< IN: pitch in bytes of raw YUV input (should be aligned appropriately) */
|
||||
uint32_t raw_input_format; /**< IN: Input YUV format (rocDecVideoCodec_enum) */
|
||||
uint64_t raw_output_dptr; /**< IN: Output HIP device mem ptr for raw YUV extensions */
|
||||
uint32_t raw_output_pitch; /**< IN: pitch in bytes of raw YUV output (should be aligned appropriately) */
|
||||
uint32_t raw_output_format; /**< IN: Output YUV format (rocDecVideoCodec_enum) */
|
||||
uint64_t raw_input_dptr; /**< IN: Input HIP device ptr for raw YUV extensions */
|
||||
uint32_t raw_input_pitch; /**< IN: pitch in bytes of raw YUV input (should be aligned appropriately) */
|
||||
uint32_t raw_input_format; /**< IN: Input YUV format (rocDecVideoCodec_enum) */
|
||||
uint64_t raw_output_dptr; /**< IN: Output HIP device mem ptr for raw YUV extensions */
|
||||
uint32_t raw_output_pitch; /**< IN: pitch in bytes of raw YUV output (should be aligned appropriately) */
|
||||
uint32_t raw_output_format; /**< IN: Output YUV format (rocDecVideoCodec_enum) */
|
||||
hipStream_t output_hipstream; /**< IN: stream object used by rocDecMapVideoFrame */
|
||||
uint32_t Reserved[16]; /**< Reserved for future use (set to zero) */
|
||||
uint32_t reserved[16]; /**< Reserved for future use (set to zero) */
|
||||
} RocdecProcParams;
|
||||
|
||||
|
||||
@@ -893,7 +887,7 @@ typedef struct _RocdecProcParams
|
||||
//! - rocdecDestroyDecoder(...)
|
||||
//!
|
||||
//! NOTE:
|
||||
//! - There is a limit to how many pictures can be mapped simultaneously (ulNumOutputSurfaces)
|
||||
//! - There is a limit to how many pictures can be mapped simultaneously (num_output_surfaces)
|
||||
//! - rocdecDecodePicture may block the calling thread if there are too many pictures pending
|
||||
//! in the decode queue
|
||||
/***********************************************************************************************************/
|
||||
@@ -915,8 +909,8 @@ extern rocDecStatus ROCDECAPI rocDecDestroyDecoder(rocDecDecoderHandle decoder_h
|
||||
/**********************************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocdecGetDecoderCaps(RocdecDecodeCaps *decode_caps)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Queries decode capabilities of AMD's VCN decoder based on CodecType, ChromaFormat and BitDepthMinus8 parameters.
|
||||
//! 1. Application fills IN parameters CodecType, ChromaFormat and BitDepthMinus8 of RocdecDecodeCaps structure
|
||||
//! Queries decode capabilities of AMD's VCN decoder based on codec type, chroma_format and BitDepthMinus8 parameters.
|
||||
//! 1. Application fills IN parameters codec_type, chroma_format and BitDepthMinus8 of RocdecDecodeCaps structure
|
||||
//! 2. On calling rocdecGetDecoderCaps, driver fills OUT parameters (for GPU device) if the IN parameters are supported
|
||||
//! If IN parameters passed to the driver are not supported by AMD-VCN-HW, then all OUT params are set to 0.
|
||||
/**********************************************************************************************************************/
|
||||
@@ -934,7 +928,7 @@ extern rocDecStatus ROCDECAPI rocDecDecodeFrame(rocDecDecoderHandle decoder_hand
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecGetDecodeStatus(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDecodeStatus* decode_status);
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Get the decode status for frame corresponding to nPicIdx
|
||||
//! API is currently supported for HEVC, H264 and JPEG codecs.
|
||||
//! API is currently supported for HEVC, AVC/H264 and JPEG codecs.
|
||||
//! API returns ROCDEC_NOT_SUPPORTED error code for unsupported GPU or codec.
|
||||
/************************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecGetDecodeStatus(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDecodeStatus* decode_status);
|
||||
@@ -943,7 +937,7 @@ extern rocDecStatus ROCDECAPI rocDecGetDecodeStatus(rocDecDecoderHandle decoder_
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Used to reuse single decoder for multiple clips. Currently supports resolution change, resize params
|
||||
//! params, target area params change for same codec. Must be called during RocdecParserParams::pfnSequenceCallback
|
||||
//! params, target area params change for same codec. Must be called during RocdecParserParams::pfn_sequence_callback
|
||||
/*********************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params);
|
||||
|
||||
|
||||
+43
-51
@@ -44,7 +44,6 @@ extern "C" {
|
||||
/*********************************************************************************/
|
||||
|
||||
typedef void *RocdecVideoParser;
|
||||
|
||||
typedef uint64_t RocdecTimeStamp;
|
||||
|
||||
/**
|
||||
@@ -67,14 +66,14 @@ typedef struct {
|
||||
uint8_t bit_depth_luma_minus8; /**< OUT: high bit depth luma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */
|
||||
uint8_t bit_depth_chroma_minus8; /**< OUT: high bit depth chroma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */
|
||||
uint8_t min_num_decode_surfaces; /**< OUT: Minimum number of decode surfaces to be allocated for correct
|
||||
decoding. The client can send this value in ulNumDecodeSurfaces.
|
||||
decoding. The client can send this value in num_decode_surfaces.
|
||||
This guarantees correct functionality and optimal video memory
|
||||
usage but not necessarily the best performance, which depends on
|
||||
the design of the overall application. The optimal number of
|
||||
decode surfaces (in terms of performance and memory utilization)
|
||||
should be decided by experimentation for each application, but it
|
||||
cannot go below min_num_decode_surfaces.
|
||||
If this value is used for ulNumDecodeSurfaces then it must be
|
||||
If this value is used for num_decode_surfaces then it must be
|
||||
returned to parser during sequence callback. */
|
||||
uint32_t coded_width; /**< OUT: coded frame width in pixels */
|
||||
uint32_t coded_height; /**< OUT: coded frame height in pixels */
|
||||
@@ -85,14 +84,14 @@ typedef struct {
|
||||
* display_area = { 0,0,1920,1080 }
|
||||
*/
|
||||
struct {
|
||||
int left; /**< OUT: left position of display rect */
|
||||
int top; /**< OUT: top position of display rect */
|
||||
int right; /**< OUT: right position of display rect */
|
||||
int bottom; /**< OUT: bottom position of display rect */
|
||||
int left; /**< OUT: left position of display rect */
|
||||
int top; /**< OUT: top position of display rect */
|
||||
int right; /**< OUT: right position of display rect */
|
||||
int bottom; /**< OUT: bottom position of display rect */
|
||||
} display_area;
|
||||
|
||||
rocDecVideoChromaFormat chroma_format; /**< OUT: Chroma format */
|
||||
uint32_t bitrate; /**< OUT: video bitrate (bps, 0=unknown) */
|
||||
rocDecVideoChromaFormat chroma_format; /**< OUT: Chroma format */
|
||||
uint32_t bitrate; /**< OUT: video bitrate (bps, 0=unknown) */
|
||||
/**
|
||||
* OUT: Display Aspect Ratio = x:y (4:3, 16:9, etc)
|
||||
*/
|
||||
@@ -112,7 +111,7 @@ typedef struct {
|
||||
uint8_t transfer_characteristics; /**< OUT: opto-electronic transfer characteristic of the source picture */
|
||||
uint8_t matrix_coefficients; /**< OUT: used in deriving luma and chroma signals from RGB primaries */
|
||||
} video_signal_description;
|
||||
uint32_t seqhdr_data_length; /**< OUT: Additional bytes following (RocdecVideoFormatEx) */
|
||||
uint32_t seqhdr_data_length; /**< OUT: Additional bytes following (RocdecVideoFormatEx) */
|
||||
} RocdecVideoFormat;
|
||||
|
||||
/****************************************************************/
|
||||
@@ -122,10 +121,10 @@ typedef struct {
|
||||
//! Used in rocDecCreateVideoParser API
|
||||
/****************************************************************/
|
||||
typedef struct {
|
||||
RocdecVideoFormat format; /**< OUT: RocdecVideoFormat structure */
|
||||
RocdecVideoFormat format; /**< OUT: RocdecVideoFormat structure */
|
||||
uint32_t max_width;
|
||||
uint32_t max_height;
|
||||
uint8_t raw_seqhdr_data[1024]; /**< OUT: Sequence header data */
|
||||
uint8_t raw_seqhdr_data[1024]; /**< OUT: Sequence header data */
|
||||
} RocdecVideoFormatEx;
|
||||
|
||||
/***************************************************************/
|
||||
@@ -151,28 +150,25 @@ typedef enum {
|
||||
//! IN for rocDecParseVideoData
|
||||
/*****************************************************************************/
|
||||
typedef struct _RocdecSourceDataPacket {
|
||||
uint32_t flags; /**< IN: Combination of ROCDEC_PKT_XXX flags */
|
||||
uint32_t flags; /**< IN: Combination of ROCDEC_PKT_XXX flags */
|
||||
uint32_t payload_size; /**< IN: number of bytes in the payload (may be zero if EOS flag is set) */
|
||||
const uint8_t *payload; /**< IN: Pointer to packet payload data (may be NULL if EOS flag is set) */
|
||||
RocdecTimeStamp pts; /**< IN: Presentation time stamp (10MHz clock), only valid if
|
||||
ROCDEC_PKT_TIMESTAMP flag is set */
|
||||
const uint8_t *payload; /**< IN: Pointer to packet payload data (may be NULL if EOS flag is set) */
|
||||
RocdecTimeStamp pts; /**< IN: Presentation time stamp (10MHz clock), only valid if ROCDEC_PKT_TIMESTAMP flag is set */
|
||||
} RocdecSourceDataPacket;
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
/*! \brief Timing Info struct
|
||||
* \ingroup group_rocdec_struct
|
||||
* \struct RocdecParserDispInfo
|
||||
* \Used in rocdecParseVideoData API with PFNVIDDISPLAYCALLBACK pfnDisplayPicture
|
||||
* \Used in rocdecParseVideoData API with PFNVIDDISPLAYCALLBACK pfn_display_picture
|
||||
*/
|
||||
/**********************************************************************************/
|
||||
typedef struct _RocdecParserDispInfo {
|
||||
int picture_index; /**< OUT: Index of the current picture */
|
||||
int progressive_frame; /**< OUT: 1 if progressive frame; 0 otherwise */
|
||||
int top_field_first; /**< OUT: 1 if top field is displayed first; 0 otherwise */
|
||||
int repeat_first_field; /**< OUT: Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling,
|
||||
-1=unpaired field) */
|
||||
RocdecTimeStamp pts; /**< OUT: Presentation time stamp */
|
||||
int repeat_first_field; /**< OUT: Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling, -1=unpaired field) */
|
||||
RocdecTimeStamp pts; /**< OUT: Presentation time stamp */
|
||||
} RocdecParserDispInfo;
|
||||
|
||||
/**
|
||||
@@ -188,33 +184,31 @@ typedef struct _RocdecOperatingPointInfo {
|
||||
uint8_t reserved24_bits[3];
|
||||
uint16_t operating_points_idc[32];
|
||||
} av1;
|
||||
uint8_t CodecReserved[1024];
|
||||
uint8_t codec_reserved[1024];
|
||||
};
|
||||
} RocdecOperatingPointInfo;
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
//! \ingroup group_rocdec_struct
|
||||
//! \struct RocdecSeiMessage;
|
||||
//! Used in RocdecSeiMessageInfo structure
|
||||
/**********************************************************************************/
|
||||
typedef struct _RocdecSeiMessage {
|
||||
uint8_t sei_message_type; /**< OUT: SEI Message Type */
|
||||
uint8_t sei_message_type; /**< OUT: SEI Message Type */
|
||||
uint8_t reserved[3];
|
||||
uint32_t sei_message_size; /**< OUT: SEI Message Size */
|
||||
} RocdecSeiMessage;
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
//! \ingroup group_rocdec_struct
|
||||
//! \struct RocdecSeiMessageInfo
|
||||
//! Used in rocDecParseVideoData API with PFNVIDSEIMSGCALLBACK pfnGetSEIMsg
|
||||
//! Used in rocDecParseVideoData API with PFNVIDSEIMSGCALLBACK pfn_get_sei_msg
|
||||
/**********************************************************************************/
|
||||
typedef struct _RocdecSeiMessageInfo {
|
||||
void *pSEIData; /**< OUT: SEI Message Data */
|
||||
RocdecSeiMessage *pSEIMessage; /**< OUT: SEI Message Info */
|
||||
uint32_t sei_message_count; /**< OUT: SEI Message Count */
|
||||
uint32_t picIdx; /**< OUT: SEI Message Pic Index */
|
||||
void *sei_data; /**< OUT: SEI Message Data */
|
||||
RocdecSeiMessage *sei_message; /**< OUT: SEI Message Info */
|
||||
uint32_t sei_message_count; /**< OUT: SEI Message Count */
|
||||
uint32_t picIdx; /**< OUT: SEI Message Pic Index */
|
||||
} RocdecSeiMessageInfo;
|
||||
|
||||
/**
|
||||
@@ -225,7 +219,7 @@ typedef struct _RocdecSeiMessageInfo {
|
||||
* \ rocDecParseVideoData() to the application.
|
||||
* \ Parser picks default operating point as 0 and outputAllLayers flag as 0 if PFNVIDOPPOINTCALLBACK is not set or return value is
|
||||
* \ -1 or invalid operating point.
|
||||
* \ PFNVIDSEQUENCECALLBACK : 0: fail, 1: succeeded, > 1: override dpb size of parser (set by RocdecParserParams::ulMaxNumDecodeSurfaces
|
||||
* \ PFNVIDSEQUENCECALLBACK : 0: fail, 1: succeeded, > 1: override dpb size of parser (set by RocdecParserParams::max_num_decode_surfaces
|
||||
* \ while creating parser)
|
||||
* \ PFNVIDDECODECALLBACK : 0: fail, >=1: succeeded
|
||||
* \ PFNVIDDISPLAYCALLBACK : 0: fail, >=1: succeeded
|
||||
@@ -244,23 +238,21 @@ typedef int (ROCDECAPI *PFNVIDSEIMSGCALLBACK) (void *, RocdecSeiMessageInfo *);
|
||||
* \Used in rocDecCreateVideoParser API
|
||||
*/
|
||||
typedef struct _RocdecParserParams {
|
||||
rocDecVideoCodec CodecType; /**< IN: rocDecVideoCodec_XXX */
|
||||
uint32_t ulMaxNumDecodeSurfaces; /**< IN: Max # of decode surfaces (parser will cycle through these) */
|
||||
uint32_t ulClockRate; /**< IN: Timestamp units in Hz (0=default=10000000Hz) */
|
||||
uint32_t ulErrorThreshold; /**< IN: % Error threshold (0-100) for calling pfnDecodePicture (100=always
|
||||
IN: call pfnDecodePicture even if picture bitstream is fully corrupted) */
|
||||
uint32_t ulMaxDisplayDelay; /**< IN: Max display queue delay (improves pipelining of decode with display)
|
||||
0=no delay (recommended values: 2..4) */
|
||||
uint32_t bAnnexb : 1; /**< IN: AV1 annexB stream */
|
||||
uint32_t uReserved : 31; /**< Reserved for future use - set to zero */
|
||||
uint32_t uReserved1[4]; /**< IN: Reserved for future use - set to 0 */
|
||||
void *pUserData; /**< IN: User data for callbacks */
|
||||
PFNVIDSEQUENCECALLBACK pfnSequenceCallback; /**< IN: Called before decoding frames and/or whenever there is a fmt change */
|
||||
PFNVIDDECODECALLBACK pfnDecodePicture; /**< IN: Called when a picture is ready to be decoded (decode order) */
|
||||
PFNVIDDISPLAYCALLBACK pfnDisplayPicture; /**< IN: Called whenever a picture is ready to be displayed (display order) */
|
||||
PFNVIDSEIMSGCALLBACK pfnGetSEIMsg; /**< IN: Called when all SEI messages are parsed for particular frame */
|
||||
void *pvReserved2[5]; /**< Reserved for future use - set to NULL */
|
||||
RocdecVideoFormatEx *pExtVideoInfo; /**< IN: [Optional] sequence header data from system layer */
|
||||
rocDecVideoCodec codec_type; /**< IN: rocDecVideoCodec_XXX */
|
||||
uint32_t max_num_decode_surfaces; /**< IN: Max # of decode surfaces (parser will cycle through these) */
|
||||
uint32_t clock_rate; /**< IN: Timestamp units in Hz (0=default=10000000Hz) */
|
||||
uint32_t error_threshold; /**< IN: % Error threshold (0-100) for calling pfn_decode_picture (100=always IN: call pfn_decode_picture even if picture bitstream is fully corrupted) */
|
||||
uint32_t max_display_delay; /**< IN: Max display queue delay (improves pipelining of decode with display) 0 = no delay (recommended values: 2..4) */
|
||||
uint32_t annex_b : 1; /**< IN: AV1 annexB stream */
|
||||
uint32_t reserved : 31; /**< Reserved for future use - set to zero */
|
||||
uint32_t reserved_1[4]; /**< IN: Reserved for future use - set to 0 */
|
||||
void *user_data; /**< IN: User data for callbacks */
|
||||
PFNVIDSEQUENCECALLBACK pfn_sequence_callback; /**< IN: Called before decoding frames and/or whenever there is a fmt change */
|
||||
PFNVIDDECODECALLBACK pfn_decode_picture; /**< IN: Called when a picture is ready to be decoded (decode order) */
|
||||
PFNVIDDISPLAYCALLBACK pfn_display_picture; /**< IN: Called whenever a picture is ready to be displayed (display order) */
|
||||
PFNVIDSEIMSGCALLBACK pfn_get_sei_msg; /**< IN: Called when all SEI messages are parsed for particular frame */
|
||||
void *reserved_2[5]; /**< Reserved for future use - set to NULL */
|
||||
RocdecVideoFormatEx *ext_video_info; /**< IN: [Optional] sequence header data from system layer */
|
||||
} RocdecParserParams;
|
||||
|
||||
/************************************************************************************************/
|
||||
@@ -275,10 +267,10 @@ extern rocDecStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_
|
||||
//! \fn rocDecodeStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet)
|
||||
//! Parse the video data from source data packet in pPacket
|
||||
//! Extracts parameter sets like SPS, PPS, bitstream etc. from pPacket and
|
||||
//! calls back pfnDecodePicture with RocdecPicParams data for kicking of HW decoding
|
||||
//! calls back pfnSequenceCallback with RocdecVideoFormat data for initial sequence header or when
|
||||
//! calls back pfn_decode_picture with RocdecPicParams data for kicking of HW decoding
|
||||
//! calls back pfn_sequence_callback with RocdecVideoFormat data for initial sequence header or when
|
||||
//! the decoder encounters a video format change
|
||||
//! calls back pfnDisplayPicture with RocdecParserDispInfo data to display a video frame
|
||||
//! calls back pfn_display_picture with RocdecParserDispInfo data to display a video frame
|
||||
/************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet);
|
||||
|
||||
|
||||
+15
-15
@@ -79,11 +79,11 @@ The samples use the `RocVideoDecoder` user class provided in `roc_video_dec.h` u
|
||||
Video Parser is needed to required to extract and decode headers from the bitstream to organize the data into a structured format required for the hardware decoder. Parser plays an important role in the video decoding as it controls the decoding and display of the individual frames/fields of a bitstream.
|
||||
The parser object in rocparser.h has 3 main apis as described below
|
||||
#### 4.1.1 Creating Parser Object using rocDecCreateVideoParser()
|
||||
This API creates a video parser object for the Codec specified by the user. The api takes "ulMaxNumDecodeSurfaces" which determines the DPB (Decoded Picture Buffer) size for decoding. When creating a parser object, application must register certain callback functions with the driver which will be called from the parser during the decode.
|
||||
- pfnSequenceCallback will be called when the parser encounters a new sequence header. The parser informs the user with the minimum number of surfaces needed by parser's DPB for successful decoding of the bitstream. In addition, the caller can set additional parameters like "ulMaxDisplayDelay" to control the decoding and displaying of the frames.
|
||||
- "pfnDecodePicture" callback function will be triggered when a picture is ready to be decoded.
|
||||
- "pfnDisplayPicture" callback function will be triggered when a frame in display order is ready to be consumed by the caller.
|
||||
- "pfnGetSEIMsg" callback function will be triggered when a user SEI message is parsed by the parser and send back to the caller.
|
||||
This API creates a video parser object for the Codec specified by the user. The api takes "max_num_decode_surfaces" which determines the DPB (Decoded Picture Buffer) size for decoding. When creating a parser object, application must register certain callback functions with the driver which will be called from the parser during the decode.
|
||||
- pfn_sequence_callback will be called when the parser encounters a new sequence header. The parser informs the user with the minimum number of surfaces needed by parser's DPB for successful decoding of the bitstream. In addition, the caller can set additional parameters like "max_display_delay" to control the decoding and displaying of the frames.
|
||||
- "pfn_decode_picture" callback function will be triggered when a picture is ready to be decoded.
|
||||
- "pfn_display_picture" callback function will be triggered when a frame in display order is ready to be consumed by the caller.
|
||||
- "pfn_get_sei_msg" callback function will be triggered when a user SEI message is parsed by the parser and send back to the caller.
|
||||
#### 4.1.2 Parsing video data using rocDecParseVideoData()
|
||||
Elementary stream video packets extracted from the demultiplexer are fed into the parser using the "rocDecParseVideoData()" API. During this call, the parser triggers the above callbacks as it encounters a new sequence header, got a compressed frame/field data ready to be decoded, or when it is ready to display a frame. If any of the callbacks returns failure, it will be propagated back to the application so the decoding can be termiated gracefully.
|
||||
#### 4.1.3 Destroying the parser using rocDecDestroyVideoParser()
|
||||
@@ -96,24 +96,24 @@ The following pseudo-code illustrates the use of this API. If any of the decoder
|
||||
|
||||
RocdecDecodeCaps decode_caps;
|
||||
memset(&decode_caps, 0, sizeof(decode_caps));
|
||||
decode_caps.eCodecType = p_video_format->codec;
|
||||
decode_caps.eChromaFormat = p_video_format->chroma_format;
|
||||
decode_caps.nBitDepthMinus8 = p_video_format->bit_depth_luma_minus8;
|
||||
decode_caps.codec_type = p_video_format->codec;
|
||||
decode_caps.chroma_format = p_video_format->chroma_format;
|
||||
decode_caps.bit_depth_minus_8 = p_video_format->bit_depth_luma_minus8;
|
||||
|
||||
ROCDEC_API_CALL(rocDecGetDecoderCaps(&decode_caps));
|
||||
|
||||
if(!decode_caps.bIsSupported) {
|
||||
if(!decode_caps.is_supported) {
|
||||
ROCDEC_THROW("Rocdec:: Codec not supported on this GPU: ", ROCDEC_NOT_SUPPORTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p_video_format->coded_width > decode_caps.nMaxWidth) ||
|
||||
(p_video_format->coded_height > decode_caps.nMaxHeight)) {
|
||||
if ((p_video_format->coded_width > decode_caps.max_width) ||
|
||||
(p_video_format->coded_height > decode_caps.max_height)) {
|
||||
|
||||
std::ostringstream errorString;
|
||||
errorString << std::endl
|
||||
<< "Resolution : " << p_video_format->coded_width << "x" << p_video_format->coded_height << std::endl
|
||||
<< "Max Supported (wxh) : " << decode_caps.nMaxWidth << "x" << decode_caps.nMaxHeight << std::endl
|
||||
<< "Max Supported (wxh) : " << decode_caps.max_width << "x" << decode_caps.max_height << std::endl
|
||||
<< "Resolution not supported on this GPU ";
|
||||
|
||||
const std::string cErr = errorString.str();
|
||||
@@ -122,7 +122,7 @@ The following pseudo-code illustrates the use of this API. If any of the decoder
|
||||
}
|
||||
|
||||
### 4.3 Creating a Decoder using rocDecCreateDecoder() [api](../../api)
|
||||
Creates an instance of the hardware video decoder object and gives a handle to the user on successful creation. Refer to RocDecoderCreateInfo [structure](../../api/rocdecode.h) for information about parameters which are passed for creating the decoder. For e.g. RocDecoderCreateInfo::CodecType represents the codec type of the video. The decoder handle returned by the rocDecCreateDecoder() must be retained for the entire session of the decode because the handle is passed along with the other decoding apis. In addition, user can inform display or crop dimensions along with this API.
|
||||
Creates an instance of the hardware video decoder object and gives a handle to the user on successful creation. Refer to RocDecoderCreateInfo [structure](../../api/rocdecode.h) for information about parameters which are passed for creating the decoder. For e.g. RocDecoderCreateInfo::codec_type represents the codec type of the video. The decoder handle returned by the rocDecCreateDecoder() must be retained for the entire session of the decode because the handle is passed along with the other decoding apis. In addition, user can inform display or crop dimensions along with this API.
|
||||
|
||||
### 4.4 Decoding the frame using rocDecDecodeFrame() [api](../../api)
|
||||
After de-muxing and parsing, the next step is to decode bitstream data contaiing a frame/field using hardware. rocDecDecodeFrame()API is to submit a new frame for hardware decoding. Underneath the driver VA-API is used to submit compressed picture data to the driver. The parser extracts all the necessary information from the bitstream and fill "RocdecPicParams" struct which is appropriate for the codec used. The high level [RocVideoDecoder](../utils/rocvideodecode/) class connects the parser and decoder which is used for all the sample applications.
|
||||
@@ -162,9 +162,9 @@ The `rocDecReconfigureDecoder()` can be called to reuse a single decoder for mul
|
||||
|
||||
The inputs to the API are:
|
||||
* decoder_handle: A rocdec decoder handler `rocDecDecoderHandle`.
|
||||
* reconfig_params: The user needs to specify the parameters for the changes in `RocdecReconfigureDecoderInfo`. The ulWidth and ulHeight used for reconfiguration cannot exceed the values set for ulMaxWidth and ulMaxHeight defined at RocDecoderCreateInfo. If these values need to be changed, the session needs to be destroyed and recreated.
|
||||
* reconfig_params: The user needs to specify the parameters for the changes in `RocdecReconfigureDecoderInfo`. The width and height used for reconfiguration cannot exceed the values set for max_width and max_height defined at RocDecoderCreateInfo. If these values need to be changed, the session needs to be destroyed and recreated.
|
||||
|
||||
The call to the `rocDecReconfigureDecoder()` must be called during `RocdecParserParams::pfnSequenceCallback`.
|
||||
The call to the `rocDecReconfigureDecoder()` must be called during `RocdecParserParams::pfn_sequence_callback`.
|
||||
|
||||
### 4.8 Destroying the decoder
|
||||
The user needs to call the `rocDecDestroyDecoder()` to destroy the session and free up resources.
|
||||
|
||||
+37
-37
@@ -171,7 +171,7 @@ ParserResult AvcVideoParser::ParsePictureData(const uint8_t *p_stream, uint32_t
|
||||
}
|
||||
|
||||
ParserResult AvcVideoParser::NotifyNewSps(AvcSeqParameterSet *p_sps) {
|
||||
video_format_params_.codec = rocDecVideoCodec_H264;
|
||||
video_format_params_.codec = rocDecVideoCodec_AVC;
|
||||
video_format_params_.frame_rate.numerator = frame_rate_.numerator;
|
||||
video_format_params_.frame_rate.denominator = frame_rate_.denominator;
|
||||
video_format_params_.bit_depth_luma_minus8 = p_sps->bit_depth_luma_minus8;
|
||||
@@ -274,7 +274,7 @@ ParserResult AvcVideoParser::NotifyNewSps(AvcSeqParameterSet *p_sps) {
|
||||
video_format_params_.seqhdr_data_length = 0;
|
||||
|
||||
// callback function with RocdecVideoFormat params filled out
|
||||
if (pfn_sequece_cb_(parser_params_.pUserData, &video_format_params_) == 0) {
|
||||
if (pfn_sequece_cb_(parser_params_.user_data, &video_format_params_) == 0) {
|
||||
ERR("Sequence callback function failed.");
|
||||
return PARSER_FAIL;
|
||||
} else {
|
||||
@@ -289,9 +289,9 @@ ParserResult AvcVideoParser::SendPicForDecode() {
|
||||
AvcSliceHeader *p_slice_header = &slice_header_0_;
|
||||
dec_pic_params_ = {0};
|
||||
|
||||
dec_pic_params_.PicWidth = pic_width_;
|
||||
dec_pic_params_.PicHeight = pic_height_;
|
||||
dec_pic_params_.CurrPicIdx = curr_pic_.pic_idx;
|
||||
dec_pic_params_.pic_width = pic_width_;
|
||||
dec_pic_params_.pic_height = pic_height_;
|
||||
dec_pic_params_.curr_pic_idx = curr_pic_.pic_idx;
|
||||
dec_pic_params_.field_pic_flag = p_slice_header->field_pic_flag;
|
||||
dec_pic_params_.bottom_field_flag = p_slice_header->bottom_field_flag;
|
||||
if (p_slice_header->field_pic_flag) {
|
||||
@@ -300,10 +300,10 @@ ParserResult AvcVideoParser::SendPicForDecode() {
|
||||
dec_pic_params_.second_field = 1;
|
||||
}
|
||||
|
||||
dec_pic_params_.nBitstreamDataLen = pic_stream_data_size_;
|
||||
dec_pic_params_.pBitstreamData = pic_stream_data_ptr_;
|
||||
dec_pic_params_.nNumSlices = slice_num_;
|
||||
dec_pic_params_.pSliceDataOffsets = nullptr;
|
||||
dec_pic_params_.bitstream_data_len = pic_stream_data_size_;
|
||||
dec_pic_params_.bitstream_data = pic_stream_data_ptr_;
|
||||
dec_pic_params_.num_slices = slice_num_;
|
||||
dec_pic_params_.slice_data_offsets = nullptr;
|
||||
|
||||
dec_pic_params_.ref_pic_flag = slice_nal_unit_header_.nal_ref_idc;
|
||||
dec_pic_params_.intra_pic_flag = p_slice_header->slice_type == kAvcSliceTypeI || p_slice_header->slice_type == kAvcSliceTypeI_7 || p_slice_header->slice_type == kAvcSliceTypeSI || p_slice_header->slice_type == kAvcSliceTypeSI_9;
|
||||
@@ -312,44 +312,44 @@ ParserResult AvcVideoParser::SendPicForDecode() {
|
||||
RocdecAvcPicParams *p_pic_param = &dec_pic_params_.pic_params.avc;
|
||||
|
||||
// Current picture
|
||||
p_pic_param->curr_pic.PicIdx = curr_pic_.pic_idx;
|
||||
p_pic_param->curr_pic.pic_idx = curr_pic_.pic_idx;
|
||||
if (curr_pic_.is_reference == kUsedForLongTerm) {
|
||||
p_pic_param->curr_pic.FrameIdx = curr_pic_.long_term_pic_num;
|
||||
p_pic_param->curr_pic.frame_idx = curr_pic_.long_term_pic_num;
|
||||
} else {
|
||||
p_pic_param->curr_pic.FrameIdx = curr_pic_.frame_num;
|
||||
p_pic_param->curr_pic.frame_idx = curr_pic_.frame_num;
|
||||
}
|
||||
p_pic_param->curr_pic.Flags = 0;
|
||||
p_pic_param->curr_pic.flags = 0;
|
||||
if (curr_pic_.pic_structure != kFrame) {
|
||||
p_pic_param->curr_pic.Flags |= curr_pic_.pic_structure == kBottomField ? RocdecH264Picture_FLAGS_BOTTOM_FIELD : RocdecH264Picture_FLAGS_TOP_FIELD;
|
||||
p_pic_param->curr_pic.flags |= curr_pic_.pic_structure == kBottomField ? RocdecAvcPicture_FLAGS_BOTTOM_FIELD : RocdecAvcPicture_FLAGS_TOP_FIELD;
|
||||
}
|
||||
if (curr_pic_.is_reference != kUnusedForReference) {
|
||||
p_pic_param->curr_pic.Flags |= curr_pic_.is_reference == kUsedForShortTerm ? RocdecH264Picture_FLAGS_SHORT_TERM_REFERENCE : RocdecH264Picture_FLAGS_LONG_TERM_REFERENCE;
|
||||
p_pic_param->curr_pic.flags |= curr_pic_.is_reference == kUsedForShortTerm ? RocdecAvcPicture_FLAGS_SHORT_TERM_REFERENCE : RocdecAvcPicture_FLAGS_LONG_TERM_REFERENCE;
|
||||
}
|
||||
p_pic_param->curr_pic.TopFieldOrderCnt = curr_pic_.top_field_order_cnt;
|
||||
p_pic_param->curr_pic.BottomFieldOrderCnt = curr_pic_.bottom_field_order_cnt;
|
||||
p_pic_param->curr_pic.top_field_order_cnt = curr_pic_.top_field_order_cnt;
|
||||
p_pic_param->curr_pic.bottom_field_order_cnt = curr_pic_.bottom_field_order_cnt;
|
||||
|
||||
// Reference pictures
|
||||
int buf_index = 0;
|
||||
for (i = 0; i < AVC_MAX_DPB_FRAMES; i++) {
|
||||
AvcPicture *p_ref_pic = &dpb_buffer_.frame_buffer_list[i];
|
||||
if (p_ref_pic->is_reference != kUnusedForReference) {
|
||||
p_pic_param->ref_frames[buf_index].PicIdx = p_ref_pic->pic_idx;
|
||||
p_pic_param->ref_frames[buf_index].pic_idx = p_ref_pic->pic_idx;
|
||||
if ( p_ref_pic->is_reference == kUsedForLongTerm) {
|
||||
p_pic_param->ref_frames[buf_index].FrameIdx = p_ref_pic->long_term_pic_num;
|
||||
p_pic_param->ref_frames[buf_index].frame_idx = p_ref_pic->long_term_pic_num;
|
||||
} else {
|
||||
p_pic_param->ref_frames[buf_index].FrameIdx = p_ref_pic->frame_num;
|
||||
p_pic_param->ref_frames[buf_index].frame_idx = p_ref_pic->frame_num;
|
||||
}
|
||||
p_pic_param->ref_frames[buf_index].Flags = 0;
|
||||
p_pic_param->ref_frames[buf_index].flags = 0;
|
||||
if (p_ref_pic->pic_structure != kFrame) {
|
||||
p_pic_param->ref_frames[buf_index].Flags |= p_ref_pic->pic_structure == kBottomField ? RocdecH264Picture_FLAGS_BOTTOM_FIELD : RocdecH264Picture_FLAGS_TOP_FIELD;
|
||||
p_pic_param->ref_frames[buf_index].flags |= p_ref_pic->pic_structure == kBottomField ? RocdecAvcPicture_FLAGS_BOTTOM_FIELD : RocdecAvcPicture_FLAGS_TOP_FIELD;
|
||||
}
|
||||
p_pic_param->ref_frames[buf_index].Flags |= p_ref_pic->is_reference == kUsedForShortTerm ? RocdecH264Picture_FLAGS_SHORT_TERM_REFERENCE : RocdecH264Picture_FLAGS_LONG_TERM_REFERENCE;
|
||||
p_pic_param->ref_frames[buf_index].flags |= p_ref_pic->is_reference == kUsedForShortTerm ? RocdecAvcPicture_FLAGS_SHORT_TERM_REFERENCE : RocdecAvcPicture_FLAGS_LONG_TERM_REFERENCE;
|
||||
buf_index++;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = buf_index; i < AVC_MAX_DPB_FRAMES; i++) {
|
||||
p_pic_param->ref_frames[i].PicIdx = 0xFF;
|
||||
p_pic_param->ref_frames[i].pic_idx = 0xFF;
|
||||
}
|
||||
|
||||
p_pic_param->picture_width_in_mbs_minus1 = p_sps->pic_width_in_mbs_minus1;
|
||||
@@ -412,34 +412,34 @@ ParserResult AvcVideoParser::SendPicForDecode() {
|
||||
for (i = 0; i < dpb_buffer_.num_short_term + dpb_buffer_.num_long_term; i++) {
|
||||
AvcPicture *p_ref_pic = &ref_list_0_[i];
|
||||
if (p_ref_pic->is_reference != kUnusedForReference) {
|
||||
p_slice_param->ref_pic_list_0[i].PicIdx = p_ref_pic->pic_idx;
|
||||
p_slice_param->ref_pic_list_0[i].pic_idx = p_ref_pic->pic_idx;
|
||||
if ( p_ref_pic->is_reference == kUsedForLongTerm) {
|
||||
p_slice_param->ref_pic_list_0[i].FrameIdx = p_ref_pic->long_term_pic_num;
|
||||
p_slice_param->ref_pic_list_0[i].frame_idx = p_ref_pic->long_term_pic_num;
|
||||
} else {
|
||||
p_slice_param->ref_pic_list_0[i].FrameIdx = p_ref_pic->frame_num;
|
||||
p_slice_param->ref_pic_list_0[i].frame_idx = p_ref_pic->frame_num;
|
||||
}
|
||||
p_slice_param->ref_pic_list_0[i].Flags = 0;
|
||||
p_slice_param->ref_pic_list_0[i].flags = 0;
|
||||
if (p_ref_pic->pic_structure != kFrame) {
|
||||
p_slice_param->ref_pic_list_0[i].Flags |= p_ref_pic->pic_structure == kBottomField ? RocdecH264Picture_FLAGS_BOTTOM_FIELD : RocdecH264Picture_FLAGS_TOP_FIELD;
|
||||
p_slice_param->ref_pic_list_0[i].flags |= p_ref_pic->pic_structure == kBottomField ? RocdecAvcPicture_FLAGS_BOTTOM_FIELD : RocdecAvcPicture_FLAGS_TOP_FIELD;
|
||||
}
|
||||
p_slice_param->ref_pic_list_0[i].Flags |= p_ref_pic->is_reference == kUsedForShortTerm ? RocdecH264Picture_FLAGS_SHORT_TERM_REFERENCE : RocdecH264Picture_FLAGS_LONG_TERM_REFERENCE;
|
||||
p_slice_param->ref_pic_list_0[i].flags |= p_ref_pic->is_reference == kUsedForShortTerm ? RocdecAvcPicture_FLAGS_SHORT_TERM_REFERENCE : RocdecAvcPicture_FLAGS_LONG_TERM_REFERENCE;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_slice_header->slice_type == kAvcSliceTypeB || p_slice_header->slice_type == kAvcSliceTypeB_6 ) {
|
||||
AvcPicture *p_ref_pic = &ref_list_1_[i];
|
||||
if (p_ref_pic->is_reference != kUnusedForReference) {
|
||||
p_slice_param->ref_pic_list_1[i].PicIdx = p_ref_pic->pic_idx;
|
||||
p_slice_param->ref_pic_list_1[i].pic_idx = p_ref_pic->pic_idx;
|
||||
if ( p_ref_pic->is_reference == kUsedForLongTerm) {
|
||||
p_slice_param->ref_pic_list_1[i].FrameIdx = p_ref_pic->long_term_pic_num;
|
||||
p_slice_param->ref_pic_list_1[i].frame_idx = p_ref_pic->long_term_pic_num;
|
||||
} else {
|
||||
p_slice_param->ref_pic_list_1[i].FrameIdx = p_ref_pic->frame_num;
|
||||
p_slice_param->ref_pic_list_1[i].frame_idx = p_ref_pic->frame_num;
|
||||
}
|
||||
p_slice_param->ref_pic_list_1[i].Flags = 0;
|
||||
p_slice_param->ref_pic_list_1[i].flags = 0;
|
||||
if (p_ref_pic->pic_structure != kFrame) {
|
||||
p_slice_param->ref_pic_list_1[i].Flags |= p_ref_pic->pic_structure == kBottomField ? RocdecH264Picture_FLAGS_BOTTOM_FIELD : RocdecH264Picture_FLAGS_TOP_FIELD;
|
||||
p_slice_param->ref_pic_list_1[i].flags |= p_ref_pic->pic_structure == kBottomField ? RocdecAvcPicture_FLAGS_BOTTOM_FIELD : RocdecAvcPicture_FLAGS_TOP_FIELD;
|
||||
}
|
||||
p_slice_param->ref_pic_list_1[i].Flags |= p_ref_pic->is_reference == kUsedForShortTerm ? RocdecH264Picture_FLAGS_SHORT_TERM_REFERENCE : RocdecH264Picture_FLAGS_LONG_TERM_REFERENCE;
|
||||
p_slice_param->ref_pic_list_1[i].flags |= p_ref_pic->is_reference == kUsedForShortTerm ? RocdecAvcPicture_FLAGS_SHORT_TERM_REFERENCE : RocdecAvcPicture_FLAGS_LONG_TERM_REFERENCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ ParserResult AvcVideoParser::SendPicForDecode() {
|
||||
}
|
||||
}
|
||||
|
||||
if (pfn_decode_picture_cb_(parser_params_.pUserData, &dec_pic_params_) == 0) {
|
||||
if (pfn_decode_picture_cb_(parser_params_.user_data, &dec_pic_params_) == 0) {
|
||||
ERR("Decode error occurred.");
|
||||
return PARSER_FAIL;
|
||||
} else {
|
||||
|
||||
+66
-66
@@ -241,7 +241,7 @@ int HevcVideoParser::FillSeqCallbackFn(HevcSeqParamSet* sps_data) {
|
||||
video_format_params_.seqhdr_data_length = 0;
|
||||
|
||||
// callback function with RocdecVideoFormat params filled out
|
||||
if (pfn_sequece_cb_(parser_params_.pUserData, &video_format_params_) == 0) {
|
||||
if (pfn_sequece_cb_(parser_params_.user_data, &video_format_params_) == 0) {
|
||||
ERR("Sequence callback function failed.");
|
||||
return PARSER_FAIL;
|
||||
} else {
|
||||
@@ -251,12 +251,12 @@ int HevcVideoParser::FillSeqCallbackFn(HevcSeqParamSet* sps_data) {
|
||||
|
||||
void HevcVideoParser::FillSeiMessageCallbackFn() {
|
||||
sei_message_info_params_.sei_message_count = sei_message_count_;
|
||||
sei_message_info_params_.pSEIMessage = sei_message_list_.data();
|
||||
sei_message_info_params_.pSEIData = (void*)sei_payload_buf_;
|
||||
sei_message_info_params_.sei_message = sei_message_list_.data();
|
||||
sei_message_info_params_.sei_data = (void*)sei_payload_buf_;
|
||||
sei_message_info_params_.picIdx = curr_pic_info_.pic_idx;
|
||||
|
||||
// callback function with RocdecSeiMessageInfo params filled out
|
||||
if (pfn_get_sei_message_cb_) pfn_get_sei_message_cb_(parser_params_.pUserData, &sei_message_info_params_);
|
||||
if (pfn_get_sei_message_cb_) pfn_get_sei_message_cb_(parser_params_.user_data, &sei_message_info_params_);
|
||||
}
|
||||
|
||||
int HevcVideoParser::SendPicForDecode() {
|
||||
@@ -265,17 +265,17 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
HevcPicParamSet *pps_ptr = &m_pps_[m_active_pps_id_];
|
||||
dec_pic_params_ = {0};
|
||||
|
||||
dec_pic_params_.PicWidth = sps_ptr->pic_width_in_luma_samples;
|
||||
dec_pic_params_.PicHeight = sps_ptr->pic_height_in_luma_samples;
|
||||
dec_pic_params_.CurrPicIdx = curr_pic_info_.pic_idx;
|
||||
dec_pic_params_.pic_width = sps_ptr->pic_width_in_luma_samples;
|
||||
dec_pic_params_.pic_height = sps_ptr->pic_height_in_luma_samples;
|
||||
dec_pic_params_.curr_pic_idx = curr_pic_info_.pic_idx;
|
||||
dec_pic_params_.field_pic_flag = sps_ptr->profile_tier_level.general_interlaced_source_flag;
|
||||
dec_pic_params_.bottom_field_flag = 0; // For now. Need to parse VUI/SEI pic_timing()
|
||||
dec_pic_params_.second_field = 0; // For now. Need to parse VUI/SEI pic_timing()
|
||||
|
||||
dec_pic_params_.nBitstreamDataLen = pic_stream_data_size_;
|
||||
dec_pic_params_.pBitstreamData = pic_stream_data_ptr_;
|
||||
dec_pic_params_.nNumSlices = slice_num_;
|
||||
dec_pic_params_.pSliceDataOffsets = nullptr; // Todo: do we need this? Remove if not.
|
||||
dec_pic_params_.bitstream_data_len = pic_stream_data_size_;
|
||||
dec_pic_params_.bitstream_data = pic_stream_data_ptr_;
|
||||
dec_pic_params_.num_slices = slice_num_;
|
||||
dec_pic_params_.slice_data_offsets = nullptr; // Todo: do we need this? Remove if not.
|
||||
|
||||
dec_pic_params_.ref_pic_flag = 1; // HEVC decoded picture is always marked as short term at first.
|
||||
dec_pic_params_.intra_pic_flag = m_sh_->slice_type == HEVC_SLICE_TYPE_I ? 1 : 0;
|
||||
@@ -287,56 +287,56 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
RocdecHevcPicParams *pic_param_ptr = &dec_pic_params_.pic_params.hevc;
|
||||
|
||||
// Current picture
|
||||
pic_param_ptr->curr_pic.PicIdx = curr_pic_info_.pic_idx;
|
||||
pic_param_ptr->curr_pic.POC = curr_pic_info_.pic_order_cnt;
|
||||
pic_param_ptr->curr_pic.pic_idx = curr_pic_info_.pic_idx;
|
||||
pic_param_ptr->curr_pic.poc = curr_pic_info_.pic_order_cnt;
|
||||
|
||||
// Reference pictures
|
||||
ref_idx = 0;
|
||||
for (i = 0; i < num_poc_st_curr_before_; i++) {
|
||||
buf_idx = ref_pic_set_st_curr_before_[i]; // buffer index in DPB
|
||||
pic_param_ptr->ref_frames[ref_idx].PicIdx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].POC = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags |= RocdecHEVCPicture_RPS_ST_CURR_BEFORE;
|
||||
pic_param_ptr->ref_frames[ref_idx].pic_idx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].poc = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].flags |= RocdecHevcPicture_RPS_ST_CURR_BEFORE;
|
||||
ref_idx++;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_poc_st_curr_after_; i++) {
|
||||
buf_idx = ref_pic_set_st_curr_after_[i]; // buffer index in DPB
|
||||
pic_param_ptr->ref_frames[ref_idx].PicIdx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].POC = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags |= RocdecHEVCPicture_RPS_ST_CURR_AFTER;
|
||||
pic_param_ptr->ref_frames[ref_idx].pic_idx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].poc = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].flags |= RocdecHevcPicture_RPS_ST_CURR_AFTER;
|
||||
ref_idx++;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_poc_lt_curr_; i++) {
|
||||
buf_idx = ref_pic_set_lt_curr_[i]; // buffer index in DPB
|
||||
pic_param_ptr->ref_frames[ref_idx].PicIdx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].POC = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags |= RocdecHEVCPicture_LONG_TERM_REFERENCE | RocdecHEVCPicture_RPS_LT_CURR;
|
||||
pic_param_ptr->ref_frames[ref_idx].pic_idx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].poc = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].flags |= RocdecHevcPicture_LONG_TERM_REFERENCE | RocdecHevcPicture_RPS_LT_CURR;
|
||||
ref_idx++;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_poc_st_foll_; i++) {
|
||||
buf_idx = ref_pic_set_st_foll_[i]; // buffer index in DPB
|
||||
pic_param_ptr->ref_frames[ref_idx].PicIdx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].POC = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].pic_idx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].poc = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].flags = 0; // assume frame picture for now
|
||||
ref_idx++;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_poc_lt_foll_; i++) {
|
||||
buf_idx = ref_pic_set_lt_foll_[i]; // buffer index in DPB
|
||||
pic_param_ptr->ref_frames[ref_idx].PicIdx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].POC = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].Flags = 0; // assume frame picture for now
|
||||
pic_param_ptr->ref_frames[ref_idx].pic_idx = dpb_buffer_.frame_buffer_list[buf_idx].pic_idx;
|
||||
pic_param_ptr->ref_frames[ref_idx].poc = dpb_buffer_.frame_buffer_list[buf_idx].pic_order_cnt;
|
||||
pic_param_ptr->ref_frames[ref_idx].flags = 0; // assume frame picture for now
|
||||
ref_idx++;
|
||||
}
|
||||
|
||||
for (i = ref_idx; i < 15; i++) {
|
||||
pic_param_ptr->ref_frames[i].PicIdx = 0xFF;
|
||||
pic_param_ptr->ref_frames[i].pic_idx = 0xFF;
|
||||
}
|
||||
|
||||
pic_param_ptr->picture_width_in_luma_samples = sps_ptr->pic_width_in_luma_samples;
|
||||
@@ -360,8 +360,8 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
pic_param_ptr->pic_fields.bits.pps_loop_filter_across_slices_enabled_flag = pps_ptr->pps_loop_filter_across_slices_enabled_flag;
|
||||
pic_param_ptr->pic_fields.bits.loop_filter_across_tiles_enabled_flag = pps_ptr->loop_filter_across_tiles_enabled_flag;
|
||||
pic_param_ptr->pic_fields.bits.pcm_loop_filter_disabled_flag = sps_ptr->pcm_loop_filter_disabled_flag;
|
||||
pic_param_ptr->pic_fields.bits.NoPicReorderingFlag = sps_ptr->sps_max_num_reorder_pics[0] ? 0 : 1;
|
||||
pic_param_ptr->pic_fields.bits.NoBiPredFlag = m_sh_->slice_type == HEVC_SLICE_TYPE_B ? 0 : 1;
|
||||
pic_param_ptr->pic_fields.bits.no_pic_reordering_flag = sps_ptr->sps_max_num_reorder_pics[0] ? 0 : 1;
|
||||
pic_param_ptr->pic_fields.bits.no_bi_pred_flag = m_sh_->slice_type == HEVC_SLICE_TYPE_B ? 0 : 1;
|
||||
|
||||
pic_param_ptr->sps_max_dec_pic_buffering_minus1 = sps_ptr->sps_max_dec_pic_buffering_minus1[sps_ptr->sps_max_sub_layers_minus1]; // HighestTid
|
||||
pic_param_ptr->bit_depth_luma_minus8 = sps_ptr->bit_depth_luma_minus8;
|
||||
@@ -404,9 +404,9 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
pic_param_ptr->slice_parsing_fields.bits.deblocking_filter_override_enabled_flag = pps_ptr->deblocking_filter_override_enabled_flag;
|
||||
pic_param_ptr->slice_parsing_fields.bits.pps_disable_deblocking_filter_flag = pps_ptr->pps_deblocking_filter_disabled_flag;
|
||||
pic_param_ptr->slice_parsing_fields.bits.slice_segment_header_extension_present_flag = pps_ptr->slice_segment_header_extension_present_flag;
|
||||
pic_param_ptr->slice_parsing_fields.bits.RapPicFlag = IsIrapPic(&slice_nal_unit_header_) ? 1 : 0;
|
||||
pic_param_ptr->slice_parsing_fields.bits.IdrPicFlag = IsIdrPic(&slice_nal_unit_header_) ? 1 : 0;
|
||||
pic_param_ptr->slice_parsing_fields.bits.IntraPicFlag = m_sh_->slice_type == HEVC_SLICE_TYPE_I ? 1 : 0;
|
||||
pic_param_ptr->slice_parsing_fields.bits.rap_pic_flag = IsIrapPic(&slice_nal_unit_header_) ? 1 : 0;
|
||||
pic_param_ptr->slice_parsing_fields.bits.idr_pic_flag = IsIdrPic(&slice_nal_unit_header_) ? 1 : 0;
|
||||
pic_param_ptr->slice_parsing_fields.bits.intra_pic_flag = m_sh_->slice_type == HEVC_SLICE_TYPE_I ? 1 : 0;
|
||||
|
||||
pic_param_ptr->log2_max_pic_order_cnt_lsb_minus4 = sps_ptr->log2_max_pic_order_cnt_lsb_minus4;
|
||||
pic_param_ptr->num_short_term_ref_pic_sets = sps_ptr->num_short_term_ref_pic_sets;
|
||||
@@ -430,12 +430,12 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
slice_params_ptr->slice_segment_address = m_sh_->slice_segment_address;
|
||||
|
||||
// Ref lists
|
||||
memset(slice_params_ptr->RefPicList, 0xFF, sizeof(slice_params_ptr->RefPicList));
|
||||
memset(slice_params_ptr->ref_pic_list, 0xFF, sizeof(slice_params_ptr->ref_pic_list));
|
||||
if (m_sh_->slice_type != HEVC_SLICE_TYPE_I) {
|
||||
for (i = 0; i <= m_sh_->num_ref_idx_l0_active_minus1; i++) {
|
||||
int idx = ref_pic_list_0_[i]; // pic_idx of the ref pic
|
||||
for (j = 0; j < 15; j++) {
|
||||
if (pic_param_ptr->ref_frames[j].PicIdx == idx) {
|
||||
if (pic_param_ptr->ref_frames[j].pic_idx == idx) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -443,7 +443,7 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
ERR("Could not find matching pic in ref_frames list. The slice type is P/B, and the idx from the ref_pic_list_0_ is: " + TOSTR(idx));
|
||||
return PARSER_FAIL;
|
||||
} else {
|
||||
slice_params_ptr->RefPicList[0][i] = j;
|
||||
slice_params_ptr->ref_pic_list[0][i] = j;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
for (i = 0; i <= m_sh_->num_ref_idx_l1_active_minus1; i++) {
|
||||
int idx = ref_pic_list_1_[i]; // pic_idx of the ref pic
|
||||
for (j = 0; j < 15; j++) {
|
||||
if (pic_param_ptr->ref_frames[j].PicIdx == idx) {
|
||||
if (pic_param_ptr->ref_frames[j].pic_idx == idx) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -459,24 +459,24 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
ERR("Could not find matching pic in ref_frames list. The slice type is B, and the idx from the ref_pic_list_1_ is: " + TOSTR(idx));
|
||||
return PARSER_FAIL;
|
||||
} else {
|
||||
slice_params_ptr->RefPicList[1][i] = j;
|
||||
slice_params_ptr->ref_pic_list[1][i] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
slice_params_ptr->LongSliceFlags.fields.LastSliceOfPic = 1;
|
||||
slice_params_ptr->LongSliceFlags.fields.dependent_slice_segment_flag = m_sh_->dependent_slice_segment_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.slice_type = m_sh_->slice_type;
|
||||
slice_params_ptr->LongSliceFlags.fields.color_plane_id = m_sh_->colour_plane_id;
|
||||
slice_params_ptr->LongSliceFlags.fields.slice_sao_luma_flag = m_sh_->slice_sao_luma_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.slice_sao_chroma_flag = m_sh_->slice_sao_chroma_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.mvd_l1_zero_flag = m_sh_->mvd_l1_zero_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.cabac_init_flag = m_sh_->cabac_init_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.slice_temporal_mvp_enabled_flag = m_sh_->slice_temporal_mvp_enabled_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.slice_deblocking_filter_disabled_flag = m_sh_->slice_deblocking_filter_disabled_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.collocated_from_l0_flag = m_sh_->collocated_from_l0_flag;
|
||||
slice_params_ptr->LongSliceFlags.fields.slice_loop_filter_across_slices_enabled_flag = m_sh_->slice_loop_filter_across_slices_enabled_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.last_slice_of_pic = 1;
|
||||
slice_params_ptr->long_slice_flags.fields.dependent_slice_segment_flag = m_sh_->dependent_slice_segment_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.slice_type = m_sh_->slice_type;
|
||||
slice_params_ptr->long_slice_flags.fields.color_plane_id = m_sh_->colour_plane_id;
|
||||
slice_params_ptr->long_slice_flags.fields.slice_sao_luma_flag = m_sh_->slice_sao_luma_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.slice_sao_chroma_flag = m_sh_->slice_sao_chroma_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.mvd_l1_zero_flag = m_sh_->mvd_l1_zero_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.cabac_init_flag = m_sh_->cabac_init_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.slice_temporal_mvp_enabled_flag = m_sh_->slice_temporal_mvp_enabled_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.slice_deblocking_filter_disabled_flag = m_sh_->slice_deblocking_filter_disabled_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.collocated_from_l0_flag = m_sh_->collocated_from_l0_flag;
|
||||
slice_params_ptr->long_slice_flags.fields.slice_loop_filter_across_slices_enabled_flag = m_sh_->slice_loop_filter_across_slices_enabled_flag;
|
||||
|
||||
slice_params_ptr->collocated_ref_idx = m_sh_->collocated_ref_idx;
|
||||
slice_params_ptr->num_ref_idx_l0_active_minus1 = m_sh_->num_ref_idx_l0_active_minus1;
|
||||
@@ -495,8 +495,8 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
slice_params_ptr->luma_offset_l0[i] = m_sh_->pred_weight_table.luma_offset_l0[i];
|
||||
slice_params_ptr->delta_chroma_weight_l0[i][0] = m_sh_->pred_weight_table.delta_chroma_weight_l0[i][0];
|
||||
slice_params_ptr->delta_chroma_weight_l0[i][1] = m_sh_->pred_weight_table.delta_chroma_weight_l0[i][1];
|
||||
slice_params_ptr->ChromaOffsetL0[i][0] = m_sh_->pred_weight_table.chroma_offset_l0[i][0];
|
||||
slice_params_ptr->ChromaOffsetL0[i][1] = m_sh_->pred_weight_table.chroma_offset_l0[i][1];
|
||||
slice_params_ptr->chroma_offset_l0[i][0] = m_sh_->pred_weight_table.chroma_offset_l0[i][0];
|
||||
slice_params_ptr->chroma_offset_l0[i][1] = m_sh_->pred_weight_table.chroma_offset_l0[i][1];
|
||||
}
|
||||
|
||||
if (m_sh_->slice_type == HEVC_SLICE_TYPE_B) {
|
||||
@@ -505,8 +505,8 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
slice_params_ptr->luma_offset_l1[i] = m_sh_->pred_weight_table.luma_offset_l1[i];
|
||||
slice_params_ptr->delta_chroma_weight_l1[i][0] = m_sh_->pred_weight_table.delta_chroma_weight_l1[i][0];
|
||||
slice_params_ptr->delta_chroma_weight_l1[i][1] = m_sh_->pred_weight_table.delta_chroma_weight_l1[i][1];
|
||||
slice_params_ptr->ChromaOffsetL1[i][0] = m_sh_->pred_weight_table.chroma_offset_l1[i][0];
|
||||
slice_params_ptr->ChromaOffsetL1[i][1] = m_sh_->pred_weight_table.chroma_offset_l1[i][1];
|
||||
slice_params_ptr->chroma_offset_l1[i][0] = m_sh_->pred_weight_table.chroma_offset_l1[i][0];
|
||||
slice_params_ptr->chroma_offset_l1[i][1] = m_sh_->pred_weight_table.chroma_offset_l1[i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -522,25 +522,25 @@ int HevcVideoParser::SendPicForDecode() {
|
||||
HevcScalingListData *scaling_list_data_ptr = &pps_ptr->scaling_list_data;
|
||||
for (i = 0; i < 6; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
iq_matrix_ptr->ScalingList4x4[i][j] = scaling_list_data_ptr->scaling_list[0][i][j];
|
||||
iq_matrix_ptr->scaling_list_4x4[i][j] = scaling_list_data_ptr->scaling_list[0][i][j];
|
||||
}
|
||||
|
||||
for (j = 0; j < 64; j++) {
|
||||
iq_matrix_ptr->ScalingList8x8[i][j] = scaling_list_data_ptr->scaling_list[1][i][j];
|
||||
iq_matrix_ptr->ScalingList16x16[i][j] = scaling_list_data_ptr->scaling_list[2][i][j];
|
||||
iq_matrix_ptr->scaling_list_8x8[i][j] = scaling_list_data_ptr->scaling_list[1][i][j];
|
||||
iq_matrix_ptr->scaling_list_16x16[i][j] = scaling_list_data_ptr->scaling_list[2][i][j];
|
||||
if (i < 2) {
|
||||
iq_matrix_ptr->ScalingList32x32[i][j] = scaling_list_data_ptr->scaling_list[3][i * 3][j];
|
||||
iq_matrix_ptr->scaling_list_32x32[i][j] = scaling_list_data_ptr->scaling_list[3][i * 3][j];
|
||||
}
|
||||
}
|
||||
|
||||
iq_matrix_ptr->ScalingListDC16x16[i] = scaling_list_data_ptr->scaling_list_dc_coef[0][i];
|
||||
iq_matrix_ptr->scaling_list_dc_16x16[i] = scaling_list_data_ptr->scaling_list_dc_coef[0][i];
|
||||
if (i < 2) {
|
||||
iq_matrix_ptr->ScalingListDC32x32[i] = scaling_list_data_ptr->scaling_list_dc_coef[1][i * 3];
|
||||
iq_matrix_ptr->scaling_list_dc_32x32[i] = scaling_list_data_ptr->scaling_list_dc_coef[1][i * 3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pfn_decode_picture_cb_(parser_params_.pUserData, &dec_pic_params_) == 0) {
|
||||
if (pfn_decode_picture_cb_(parser_params_.user_data, &dec_pic_params_) == 0) {
|
||||
ERR("Decode error occurred.");
|
||||
return PARSER_FAIL;
|
||||
} else {
|
||||
@@ -555,7 +555,7 @@ int HevcVideoParser::OutputDecodedPictures() {
|
||||
|
||||
for (int i = 0; i < dpb_buffer_.num_output_pics; i++) {
|
||||
disp_info.picture_index = dpb_buffer_.frame_buffer_list[dpb_buffer_.output_pic_list[i]].pic_idx;
|
||||
pfn_display_picture_cb_(parser_params_.pUserData, &disp_info);
|
||||
pfn_display_picture_cb_(parser_params_.user_data, &disp_info);
|
||||
}
|
||||
|
||||
dpb_buffer_.num_output_pics = 0;
|
||||
|
||||
@@ -42,15 +42,15 @@ private:
|
||||
std::shared_ptr<RocVideoParser> roc_parser_ = nullptr;
|
||||
void ClearErrors() { error_ = ""; }
|
||||
void CreateParser(RocdecParserParams *params) {
|
||||
switch(params->CodecType) {
|
||||
case rocDecVideoCodec_H264:
|
||||
switch(params->codec_type) {
|
||||
case rocDecVideoCodec_AVC:
|
||||
roc_parser_ = std::make_shared<AvcVideoParser>();
|
||||
break;
|
||||
case rocDecVideoCodec_HEVC:
|
||||
roc_parser_ = std::make_shared<HevcVideoParser>();
|
||||
break;
|
||||
default:
|
||||
THROW("Unsupported parser type "+ TOSTR(params->CodecType));
|
||||
THROW("Unsupported parser type "+ TOSTR(params->codec_type));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ rocDecStatus RocVideoParser::Initialize(RocdecParserParams *pParams) {
|
||||
return ROCDEC_NOT_INITIALIZED;
|
||||
}
|
||||
// Initialize callback function pointers
|
||||
pfn_sequece_cb_ = pParams->pfnSequenceCallback; /**< Called before decoding frames and/or whenever there is a fmt change */
|
||||
pfn_decode_picture_cb_ = pParams->pfnDecodePicture; /**< Called when a picture is ready to be decoded (decode order) */
|
||||
pfn_display_picture_cb_ = pParams->pfnDisplayPicture; /**< Called whenever a picture is ready to be displayed (display order) */
|
||||
pfn_get_sei_message_cb_ = pParams->pfnGetSEIMsg; /**< Called when all SEI messages are parsed for particular frame */
|
||||
pfn_sequece_cb_ = pParams->pfn_sequence_callback; /**< Called before decoding frames and/or whenever there is a fmt change */
|
||||
pfn_decode_picture_cb_ = pParams->pfn_decode_picture; /**< Called when a picture is ready to be decoded (decode order) */
|
||||
pfn_display_picture_cb_ = pParams->pfn_display_picture; /**< Called whenever a picture is ready to be displayed (display order) */
|
||||
pfn_get_sei_message_cb_ = pParams->pfn_get_sei_msg; /**< Called when all SEI messages are parsed for particular frame */
|
||||
|
||||
parser_params_ = *pParams;
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *pa
|
||||
//! \fn rocParserStatus ROCDECAPI rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet)
|
||||
//! Parse the video data from source data packet in packet
|
||||
//! Extracts parameter sets like SPS, PPS, bitstream etc. from packet and
|
||||
//! calls back pfnDecodePicture with RocdecPicParams data for kicking of HW decoding
|
||||
//! calls back pfnSequenceCallback with RocdecVideoFormat data for initial sequence header or when
|
||||
//! calls back pfn_decode_picture with RocdecPicParams data for kicking of HW decoding
|
||||
//! calls back pfn_sequence_callback with RocdecVideoFormat data for initial sequence header or when
|
||||
//! the decoder encounters a video format change
|
||||
//! calls back pfnDisplayPicture with ROCDECPARSERDISPINFO data to display a video frame
|
||||
//! calls back pfn_display_picture with ROCDECPARSERDISPINFO data to display a video frame
|
||||
/************************************************************************************************/
|
||||
rocDecStatus ROCDECAPI
|
||||
rocDecParseVideoData(RocdecVideoParser parser_handle, RocdecSourceDataPacket *packet) {
|
||||
|
||||
@@ -29,16 +29,16 @@ RocDecoder::RocDecoder(RocDecoderCreateInfo& decoder_create_info): va_video_deco
|
||||
|
||||
rocDecStatus RocDecoder::InitializeDecoder() {
|
||||
rocDecStatus rocdec_status = ROCDEC_SUCCESS;
|
||||
rocdec_status = InitHIP(decoder_create_info_.deviceid);
|
||||
rocdec_status = InitHIP(decoder_create_info_.device_id);
|
||||
if (rocdec_status != ROCDEC_SUCCESS) {
|
||||
ERR("ERROR: Failed to initilize the HIP! with rocDecStatus# " + TOSTR(rocdec_status));
|
||||
return rocdec_status;
|
||||
}
|
||||
if (decoder_create_info_.ulNumDecodeSurfaces < 1) {
|
||||
if (decoder_create_info_.num_decode_surfaces < 1) {
|
||||
ERR("ERROR: invalid number of decode surfaces ");
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
hip_ext_mem_.resize(decoder_create_info_.ulNumDecodeSurfaces);
|
||||
hip_ext_mem_.resize(decoder_create_info_.num_decode_surfaces);
|
||||
|
||||
rocdec_status = va_video_decoder_.InitializeDecoder(hip_dev_prop_.gcnArchName);
|
||||
if (rocdec_status != ROCDEC_SUCCESS) {
|
||||
|
||||
@@ -61,19 +61,19 @@ public:
|
||||
auto it = vcn_spec_table.find(gcn_arch_name_base);
|
||||
if (it != vcn_spec_table.end()) {
|
||||
const VcnCodecsSpec& vcn_spec = it->second;
|
||||
auto it1 = vcn_spec.codecs_spec.find(pdc->eCodecType);
|
||||
auto it1 = vcn_spec.codecs_spec.find(pdc->codec_type);
|
||||
if (it1 != vcn_spec.codecs_spec.end()) {
|
||||
const CodecSpec& codec_spec = it1->second;
|
||||
auto it_chroma_format = std::find(codec_spec.chroma_format.begin(), codec_spec.chroma_format.end(), pdc->eChromaFormat);
|
||||
auto it_bitdepth_minus8 = std::find(codec_spec.bitdepth_minus8.begin(), codec_spec.bitdepth_minus8.end(), pdc->nBitDepthMinus8);
|
||||
auto it_chroma_format = std::find(codec_spec.chroma_format.begin(), codec_spec.chroma_format.end(), pdc->chroma_format);
|
||||
auto it_bitdepth_minus8 = std::find(codec_spec.bitdepth_minus8.begin(), codec_spec.bitdepth_minus8.end(), pdc->bit_depth_minus_8);
|
||||
if (it_chroma_format != codec_spec.chroma_format.end() && it_bitdepth_minus8 != codec_spec.bitdepth_minus8.end()) {
|
||||
pdc->bIsSupported = 1;
|
||||
pdc->nNumDecoders = vcn_spec.num_decoders;
|
||||
pdc->nOutputFormatMask = codec_spec.output_format_mask;
|
||||
pdc->nMaxWidth = codec_spec.max_width;
|
||||
pdc->nMaxHeight = codec_spec.max_height;
|
||||
pdc->nMinWidth = codec_spec.min_width;
|
||||
pdc->nMinHeight = codec_spec.min_height;
|
||||
pdc->is_supported = 1;
|
||||
pdc->num_decoders = vcn_spec.num_decoders;
|
||||
pdc->output_format_mask = codec_spec.output_format_mask;
|
||||
pdc->max_width = codec_spec.max_width;
|
||||
pdc->max_height = codec_spec.max_height;
|
||||
pdc->min_width = codec_spec.min_width;
|
||||
pdc->min_height = codec_spec.min_height;
|
||||
return ROCDEC_SUCCESS;
|
||||
} else {
|
||||
return ROCDEC_NOT_SUPPORTED;
|
||||
@@ -119,17 +119,17 @@ private:
|
||||
// {codec2, {{chroma_format1_for_codec2, chroma_format2_for_codec2, ...}, {bit_depth1_minus8_for_codec2, bit_depth2_minus8_for_codec2, ...}, output_format_mask_for_codec2, max_width_for_codec2, max_height_for_codec2, min_width_for_codec2, min_height_for_codec2}}}
|
||||
// , vcn_instances_for_gcn_arch_name1}},
|
||||
vcn_spec_table = {
|
||||
{"gfx908",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 4096, 2176, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2160, 64, 64}}}, 2}},
|
||||
{"gfx90a",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 4096, 2176, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2160, 64, 64}}}, 2}},
|
||||
{"gfx940",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 3}},
|
||||
{"gfx941",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 4}},
|
||||
{"gfx942",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 3}},
|
||||
{"gfx1030",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1031",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1032",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1100",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1101",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 1}},
|
||||
{"gfx1102",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_H264, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},};
|
||||
{"gfx908",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 4096, 2176, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2160, 64, 64}}}, 2}},
|
||||
{"gfx90a",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 4096, 2176, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2160, 64, 64}}}, 2}},
|
||||
{"gfx940",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 3}},
|
||||
{"gfx941",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 4}},
|
||||
{"gfx942",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 3}},
|
||||
{"gfx1030",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1031",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1032",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1100",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},
|
||||
{"gfx1101",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 1}},
|
||||
{"gfx1102",{{{rocDecVideoCodec_HEVC, {{rocDecVideoChromaFormat_420}, {0, 2}, 3, 7680, 4320, 64, 64}}, {rocDecVideoCodec_AVC, {{rocDecVideoChromaFormat_420}, {0}, 1, 4096, 2176, 64, 64}}}, 2}},};
|
||||
}
|
||||
RocDecVcnCodecSpec(const RocDecVcnCodecSpec&) = delete;
|
||||
RocDecVcnCodecSpec& operator = (const RocDecVcnCodecSpec) = delete;
|
||||
|
||||
@@ -62,8 +62,8 @@ rocDecDestroyDecoder(rocDecDecoderHandle decoder_handle) {
|
||||
|
||||
/**********************************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocdecGetDecoderCaps(rocDecDecoderHandle decoder_handle, RocdecDecodeCaps *pdc)
|
||||
//! Queries decode capabilities of AMD's VCN decoder based on CodecType, ChromaFormat and BitDepthMinus8 parameters.
|
||||
//! 1. Application fills IN parameters CodecType, ChromaFormat and BitDepthMinus8 of RocdecDecodeCaps structure
|
||||
//! Queries decode capabilities of AMD's VCN decoder based on codec type, chroma_format and BitDepthMinus8 parameters.
|
||||
//! 1. Application fills IN parameters codec_type, chroma_format and BitDepthMinus8 of RocdecDecodeCaps structure
|
||||
//! 2. On calling rocdecGetDecoderCaps, driver fills OUT parameters if the IN parameters are supported
|
||||
//! If IN parameters passed to the driver are not supported by AMD-VCN-HW, then all OUT params are set to 0.
|
||||
/**********************************************************************************************************************/
|
||||
@@ -84,13 +84,13 @@ rocDecGetDecoderCaps(RocdecDecodeCaps *pdc) {
|
||||
ERR("ERROR: didn't find any GPU!");
|
||||
return ROCDEC_DEVICE_INVALID;
|
||||
}
|
||||
if (pdc->deviceid >= num_devices) {
|
||||
if (pdc->device_id >= num_devices) {
|
||||
ERR("ERROR: the requested device_id is not found! ");
|
||||
return ROCDEC_DEVICE_INVALID;
|
||||
}
|
||||
hip_status = hipGetDeviceProperties(&hip_dev_prop, pdc->deviceid);
|
||||
hip_status = hipGetDeviceProperties(&hip_dev_prop, pdc->device_id);
|
||||
if (hip_status != hipSuccess) {
|
||||
ERR("ERROR: hipGetDeviceProperties for device (" +TOSTR(pdc->deviceid) + " ) failed! (" + TOSTR(hip_status) + ")" );
|
||||
ERR("ERROR: hipGetDeviceProperties for device (" +TOSTR(pdc->device_id) + " ) failed! (" + TOSTR(hip_status) + ")" );
|
||||
return ROCDEC_DEVICE_INVALID;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ rocDecGetDecodeStatus(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDec
|
||||
/*********************************************************************************************************/
|
||||
//! \fn rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params)
|
||||
//! Used to reuse single decoder for multiple clips. Currently supports resolution change, resize params
|
||||
//! params, target area params change for same codec. Must be called during RocdecParserParams::pfnSequenceCallback
|
||||
//! params, target area params change for same codec. Must be called during RocdecParserParams::pfn_sequence_callback
|
||||
/*********************************************************************************************************/
|
||||
rocDecStatus ROCDECAPI
|
||||
rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params) {
|
||||
|
||||
@@ -63,8 +63,8 @@ rocDecStatus VaapiVideoDecoder::InitializeDecoder(std::string gcn_arch_name) {
|
||||
|
||||
//Before initializing the VAAPI, first check to see if the requested codec config is supported
|
||||
RocDecVcnCodecSpec& vcn_codec_spec = RocDecVcnCodecSpec::GetInstance();
|
||||
if (!vcn_codec_spec.IsCodecConfigSupported(gcn_arch_name, decoder_create_info_.CodecType, decoder_create_info_.ChromaFormat,
|
||||
decoder_create_info_.bitDepthMinus8, decoder_create_info_.OutputFormat)) {
|
||||
if (!vcn_codec_spec.IsCodecConfigSupported(gcn_arch_name, decoder_create_info_.codec_type, decoder_create_info_.chroma_format,
|
||||
decoder_create_info_.bit_depth_minus_8, decoder_create_info_.output_format)) {
|
||||
ERR("ERROR: the codec config combination is not supported!");
|
||||
return ROCDEC_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ rocDecStatus VaapiVideoDecoder::InitializeDecoder(std::string gcn_arch_name) {
|
||||
int num_render_cards_per_device = ((gcn_arch_name_base.compare("gfx940") == 0) ||
|
||||
(gcn_arch_name_base.compare("gfx941") == 0) ||
|
||||
(gcn_arch_name_base.compare("gfx942") == 0)) ? 8 : 1;
|
||||
std::string drm_node = "/dev/dri/renderD" + std::to_string(128 + decoder_create_info_.deviceid * num_render_cards_per_device);
|
||||
std::string drm_node = "/dev/dri/renderD" + std::to_string(128 + decoder_create_info_.device_id * num_render_cards_per_device);
|
||||
rocdec_status = InitVAAPI(drm_node);
|
||||
if (rocdec_status != ROCDEC_SUCCESS) {
|
||||
ERR("ERROR: Failed to initilize the VAAPI!" + TOSTR(rocdec_status));
|
||||
@@ -118,15 +118,15 @@ rocDecStatus VaapiVideoDecoder::InitVAAPI(std::string drm_node) {
|
||||
}
|
||||
|
||||
rocDecStatus VaapiVideoDecoder::CreateDecoderConfig() {
|
||||
switch (decoder_create_info_.CodecType) {
|
||||
switch (decoder_create_info_.codec_type) {
|
||||
case rocDecVideoCodec_HEVC:
|
||||
if (decoder_create_info_.bitDepthMinus8 == 0) {
|
||||
if (decoder_create_info_.bit_depth_minus_8 == 0) {
|
||||
va_profile_ = VAProfileHEVCMain;
|
||||
} else if (decoder_create_info_.bitDepthMinus8 == 2) {
|
||||
} else if (decoder_create_info_.bit_depth_minus_8 == 2) {
|
||||
va_profile_ = VAProfileHEVCMain10;
|
||||
}
|
||||
break;
|
||||
case rocDecVideoCodec_H264:
|
||||
case rocDecVideoCodec_AVC:
|
||||
va_profile_ = VAProfileH264Main;
|
||||
break;
|
||||
default:
|
||||
@@ -140,13 +140,13 @@ rocDecStatus VaapiVideoDecoder::CreateDecoderConfig() {
|
||||
}
|
||||
|
||||
rocDecStatus VaapiVideoDecoder::CreateSurfaces() {
|
||||
if (decoder_create_info_.ulNumDecodeSurfaces < 1) {
|
||||
if (decoder_create_info_.num_decode_surfaces < 1) {
|
||||
ERR("ERROR: invalid number of decode surfaces ");
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
va_surface_ids_.resize(decoder_create_info_.ulNumDecodeSurfaces);
|
||||
va_surface_ids_.resize(decoder_create_info_.num_decode_surfaces);
|
||||
uint8_t surface_format;
|
||||
switch (decoder_create_info_.ChromaFormat) {
|
||||
switch (decoder_create_info_.chroma_format) {
|
||||
case rocDecVideoChromaFormat_Monochrome:
|
||||
surface_format = VA_RT_FORMAT_YUV400;
|
||||
break;
|
||||
@@ -164,14 +164,14 @@ rocDecStatus VaapiVideoDecoder::CreateSurfaces() {
|
||||
return ROCDEC_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
CHECK_VAAPI(vaCreateSurfaces(va_display_, surface_format, decoder_create_info_.ulWidth,
|
||||
decoder_create_info_.ulHeight, va_surface_ids_.data(), va_surface_ids_.size(), nullptr, 0));
|
||||
CHECK_VAAPI(vaCreateSurfaces(va_display_, surface_format, decoder_create_info_.width,
|
||||
decoder_create_info_.height, va_surface_ids_.data(), va_surface_ids_.size(), nullptr, 0));
|
||||
|
||||
return ROCDEC_SUCCESS;
|
||||
}
|
||||
|
||||
rocDecStatus VaapiVideoDecoder::CreateContext() {
|
||||
CHECK_VAAPI(vaCreateContext(va_display_, va_config_id_, decoder_create_info_.ulWidth, decoder_create_info_.ulHeight,
|
||||
CHECK_VAAPI(vaCreateContext(va_display_, va_config_id_, decoder_create_info_.width, decoder_create_info_.height,
|
||||
VA_PROGRESSIVE, va_surface_ids_.data(), va_surface_ids_.size(), &va_context_id_));
|
||||
return ROCDEC_SUCCESS;
|
||||
}
|
||||
@@ -203,23 +203,23 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) {
|
||||
VASurfaceID curr_surface_id;
|
||||
|
||||
// Get the surface id for the current picture, assuming 1:1 mapping between DPB and VAAPI decoded surfaces.
|
||||
if (pPicParams->CurrPicIdx >= va_surface_ids_.size() || pPicParams->CurrPicIdx < 0) {
|
||||
ERR("CurrPicIdx exceeded the VAAPI surface pool limit.");
|
||||
if (pPicParams->curr_pic_idx >= va_surface_ids_.size() || pPicParams->curr_pic_idx < 0) {
|
||||
ERR("curr_pic_idx exceeded the VAAPI surface pool limit.");
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
curr_surface_id = va_surface_ids_[pPicParams->CurrPicIdx];
|
||||
curr_surface_id = va_surface_ids_[pPicParams->curr_pic_idx];
|
||||
|
||||
// Upload data buffers
|
||||
switch (decoder_create_info_.CodecType) {
|
||||
switch (decoder_create_info_.codec_type) {
|
||||
case rocDecVideoCodec_HEVC: {
|
||||
pPicParams->pic_params.hevc.curr_pic.PicIdx = curr_surface_id;
|
||||
pPicParams->pic_params.hevc.curr_pic.pic_idx = curr_surface_id;
|
||||
for (int i = 0; i < 15; i++) {
|
||||
if (pPicParams->pic_params.hevc.ref_frames[i].PicIdx != 0xFF) {
|
||||
if (pPicParams->pic_params.hevc.ref_frames[i].PicIdx >= va_surface_ids_.size() || pPicParams->pic_params.hevc.ref_frames[i].PicIdx < 0) {
|
||||
if (pPicParams->pic_params.hevc.ref_frames[i].pic_idx != 0xFF) {
|
||||
if (pPicParams->pic_params.hevc.ref_frames[i].pic_idx >= va_surface_ids_.size() || pPicParams->pic_params.hevc.ref_frames[i].pic_idx < 0) {
|
||||
ERR("Reference frame index exceeded the VAAPI surface pool limit.");
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
pPicParams->pic_params.hevc.ref_frames[i].PicIdx = va_surface_ids_[pPicParams->pic_params.hevc.ref_frames[i].PicIdx];
|
||||
pPicParams->pic_params.hevc.ref_frames[i].pic_idx = va_surface_ids_[pPicParams->pic_params.hevc.ref_frames[i].pic_idx];
|
||||
}
|
||||
}
|
||||
pic_params_ptr = (void*)&pPicParams->pic_params.hevc;
|
||||
@@ -242,15 +242,15 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) {
|
||||
break;
|
||||
}
|
||||
|
||||
case rocDecVideoCodec_H264: {
|
||||
pPicParams->pic_params.avc.curr_pic.PicIdx = curr_surface_id;
|
||||
case rocDecVideoCodec_AVC: {
|
||||
pPicParams->pic_params.avc.curr_pic.pic_idx = curr_surface_id;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (pPicParams->pic_params.avc.ref_frames[i].PicIdx != 0xFF) {
|
||||
if (pPicParams->pic_params.avc.ref_frames[i].PicIdx >= va_surface_ids_.size() || pPicParams->pic_params.avc.ref_frames[i].PicIdx < 0) {
|
||||
if (pPicParams->pic_params.avc.ref_frames[i].pic_idx != 0xFF) {
|
||||
if (pPicParams->pic_params.avc.ref_frames[i].pic_idx >= va_surface_ids_.size() || pPicParams->pic_params.avc.ref_frames[i].pic_idx < 0) {
|
||||
ERR("Reference frame index exceeded the VAAPI surface pool limit.");
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
pPicParams->pic_params.avc.ref_frames[i].PicIdx = va_surface_ids_[pPicParams->pic_params.avc.ref_frames[i].PicIdx];
|
||||
pPicParams->pic_params.avc.ref_frames[i].pic_idx = va_surface_ids_[pPicParams->pic_params.avc.ref_frames[i].pic_idx];
|
||||
}
|
||||
}
|
||||
pic_params_ptr = (void*)&pPicParams->pic_params.avc;
|
||||
@@ -286,7 +286,7 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) {
|
||||
CHECK_VAAPI(vaCreateBuffer(va_display_, va_context_id_, VAIQMatrixBufferType, iq_matrix_size, 1, iq_matrix_ptr, &iq_matrix_buf_id_));
|
||||
}
|
||||
CHECK_VAAPI(vaCreateBuffer(va_display_, va_context_id_, VASliceParameterBufferType, slice_params_size, 1, slice_params_ptr, &slice_params_buf_id_));
|
||||
CHECK_VAAPI(vaCreateBuffer(va_display_, va_context_id_, VASliceDataBufferType, pPicParams->nBitstreamDataLen, 1, (void*)pPicParams->pBitstreamData, &slice_data_buf_id_));
|
||||
CHECK_VAAPI(vaCreateBuffer(va_display_, va_context_id_, VASliceDataBufferType, pPicParams->bitstream_data_len, 1, (void*)pPicParams->bitstream_data, &slice_data_buf_id_));
|
||||
|
||||
// Sumbmit buffers to VAAPI driver
|
||||
CHECK_VAAPI(vaBeginPicture(va_display_, va_context_id_, curr_surface_id));
|
||||
@@ -309,16 +309,16 @@ rocDecStatus VaapiVideoDecoder::GetDecodeStatus(int pic_idx, RocdecDecodeStatus
|
||||
CHECK_VAAPI(vaQuerySurfaceStatus(va_display_, va_surface_ids_[pic_idx], &va_surface_status));
|
||||
switch (va_surface_status) {
|
||||
case VASurfaceRendering:
|
||||
decode_status->decodeStatus = rocDecodeStatus_InProgress;
|
||||
decode_status->decode_status = rocDecodeStatus_InProgress;
|
||||
break;
|
||||
case VASurfaceReady:
|
||||
decode_status->decodeStatus = rocDecodeStatus_Success;
|
||||
decode_status->decode_status = rocDecodeStatus_Success;
|
||||
break;
|
||||
case VASurfaceDisplaying:
|
||||
decode_status->decodeStatus = rocDecodeStatus_Displaying;
|
||||
decode_status->decode_status = rocDecodeStatus_Displaying;
|
||||
break;
|
||||
default:
|
||||
decode_status->decodeStatus = rocDecodeStatus_Invalid;
|
||||
decode_status->decode_status = rocDecodeStatus_Invalid;
|
||||
}
|
||||
return ROCDEC_SUCCESS;
|
||||
}
|
||||
@@ -348,11 +348,11 @@ rocDecStatus VaapiVideoDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo
|
||||
CHECK_VAAPI(vaDestroyContext(va_display_, va_context_id_));
|
||||
|
||||
va_surface_ids_.clear();
|
||||
decoder_create_info_.ulWidth = reconfig_params->ulWidth;
|
||||
decoder_create_info_.ulHeight = reconfig_params->ulHeight;
|
||||
decoder_create_info_.ulNumDecodeSurfaces = reconfig_params->ulNumDecodeSurfaces;
|
||||
decoder_create_info_.ulTargetHeight = reconfig_params->ulTargetHeight;
|
||||
decoder_create_info_.ulTargetWidth = reconfig_params->ulTargetWidth;
|
||||
decoder_create_info_.width = reconfig_params->width;
|
||||
decoder_create_info_.height = reconfig_params->height;
|
||||
decoder_create_info_.num_decode_surfaces = reconfig_params->num_decode_surfaces;
|
||||
decoder_create_info_.target_height = reconfig_params->target_height;
|
||||
decoder_create_info_.target_width = reconfig_params->target_width;
|
||||
|
||||
rocDecStatus rocdec_status = CreateSurfaces();
|
||||
if (rocdec_status != ROCDEC_SUCCESS) {
|
||||
|
||||
@@ -38,15 +38,15 @@ RocVideoDecoder::RocVideoDecoder(int device_id, OutputSurfaceMemoryType out_mem_
|
||||
}
|
||||
// create rocdec videoparser
|
||||
RocdecParserParams parser_params = {};
|
||||
parser_params.CodecType = codec_id_;
|
||||
parser_params.ulMaxNumDecodeSurfaces = 1;
|
||||
parser_params.ulClockRate = clk_rate;
|
||||
parser_params.ulMaxDisplayDelay = 0;
|
||||
parser_params.pUserData = this;
|
||||
parser_params.pfnSequenceCallback = HandleVideoSequenceProc;
|
||||
parser_params.pfnDecodePicture = HandlePictureDecodeProc;
|
||||
parser_params.pfnDisplayPicture = b_force_zero_latency_ ? NULL : HandlePictureDisplayProc;
|
||||
parser_params.pfnGetSEIMsg = b_extract_sei_message_ ? HandleSEIMessagesProc : NULL;
|
||||
parser_params.codec_type = codec_id_;
|
||||
parser_params.max_num_decode_surfaces = 1;
|
||||
parser_params.clock_rate = clk_rate;
|
||||
parser_params.max_display_delay = 0;
|
||||
parser_params.user_data = this;
|
||||
parser_params.pfn_sequence_callback = HandleVideoSequenceProc;
|
||||
parser_params.pfn_decode_picture = HandlePictureDecodeProc;
|
||||
parser_params.pfn_display_picture = b_force_zero_latency_ ? NULL : HandlePictureDisplayProc;
|
||||
parser_params.pfn_get_sei_msg = b_extract_sei_message_ ? HandleSEIMessagesProc : NULL;
|
||||
ROCDEC_API_CALL(rocDecCreateVideoParser(&rocdec_parser_, &parser_params));
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ static const char * GetVideoCodecString(rocDecVideoCodec e_codec) {
|
||||
{ rocDecVideoCodec_MPEG1, "MPEG-1" },
|
||||
{ rocDecVideoCodec_MPEG2, "MPEG-2" },
|
||||
{ rocDecVideoCodec_MPEG4, "MPEG-4 (ASP)" },
|
||||
{ rocDecVideoCodec_H264, "AVC/H.264" },
|
||||
{ rocDecVideoCodec_AVC, "AVC/H.264" },
|
||||
{ rocDecVideoCodec_HEVC, "H.265/HEVC" },
|
||||
{ rocDecVideoCodec_AV1, "AV1" },
|
||||
{ rocDecVideoCodec_VP8, "VP8" },
|
||||
@@ -244,7 +244,7 @@ static void GetSurfaceStrideInternal(rocDecVideoSurfaceFormat surface_format, ui
|
||||
}
|
||||
|
||||
/* Return value from HandleVideoSequence() are interpreted as :
|
||||
* 0: fail, 1: succeeded, > 1: override dpb size of parser (set by CUVIDPARSERPARAMS::ulMaxNumDecodeSurfaces while creating parser)
|
||||
* 0: fail, 1: succeeded, > 1: override dpb size of parser (set by CUVIDPARSERPARAMS::max_num_decode_surfaces while creating parser)
|
||||
*/
|
||||
int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
//START_TIMER
|
||||
@@ -264,28 +264,28 @@ int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
;
|
||||
input_video_info_str_ << std::endl;
|
||||
|
||||
int nDecodeSurface = p_video_format->min_num_decode_surfaces;
|
||||
int num_decode_surfaces = p_video_format->min_num_decode_surfaces;
|
||||
|
||||
RocdecDecodeCaps decode_caps;
|
||||
memset(&decode_caps, 0, sizeof(decode_caps));
|
||||
decode_caps.eCodecType = p_video_format->codec;
|
||||
decode_caps.eChromaFormat = p_video_format->chroma_format;
|
||||
decode_caps.nBitDepthMinus8 = p_video_format->bit_depth_luma_minus8;
|
||||
decode_caps.codec_type = p_video_format->codec;
|
||||
decode_caps.chroma_format = p_video_format->chroma_format;
|
||||
decode_caps.bit_depth_minus_8 = p_video_format->bit_depth_luma_minus8;
|
||||
|
||||
ROCDEC_API_CALL(rocDecGetDecoderCaps(&decode_caps));
|
||||
|
||||
if(!decode_caps.bIsSupported) {
|
||||
if(!decode_caps.is_supported) {
|
||||
ROCDEC_THROW("Rocdec:: Codec not supported on this GPU: ", ROCDEC_NOT_SUPPORTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p_video_format->coded_width > decode_caps.nMaxWidth) ||
|
||||
(p_video_format->coded_height > decode_caps.nMaxHeight)) {
|
||||
if ((p_video_format->coded_width > decode_caps.max_width) ||
|
||||
(p_video_format->coded_height > decode_caps.max_height)) {
|
||||
|
||||
std::ostringstream errorString;
|
||||
errorString << std::endl
|
||||
<< "Resolution : " << p_video_format->coded_width << "x" << p_video_format->coded_height << std::endl
|
||||
<< "Max Supported (wxh) : " << decode_caps.nMaxWidth << "x" << decode_caps.nMaxHeight << std::endl
|
||||
<< "Max Supported (wxh) : " << decode_caps.max_width << "x" << decode_caps.max_height << std::endl
|
||||
<< "Resolution not supported on this GPU ";
|
||||
|
||||
const std::string cErr = errorString.str();
|
||||
@@ -313,14 +313,14 @@ int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
video_surface_format_ = rocDecVideoSurfaceFormat_NV12;
|
||||
|
||||
// Check if output format supported. If not, check falback options
|
||||
if (!(decode_caps.nOutputFormatMask & (1 << video_surface_format_))){
|
||||
if (decode_caps.nOutputFormatMask & (1 << rocDecVideoSurfaceFormat_NV12))
|
||||
if (!(decode_caps.output_format_mask & (1 << video_surface_format_))){
|
||||
if (decode_caps.output_format_mask & (1 << rocDecVideoSurfaceFormat_NV12))
|
||||
video_surface_format_ = rocDecVideoSurfaceFormat_NV12;
|
||||
else if (decode_caps.nOutputFormatMask & (1 << rocDecVideoSurfaceFormat_P016))
|
||||
else if (decode_caps.output_format_mask & (1 << rocDecVideoSurfaceFormat_P016))
|
||||
video_surface_format_ = rocDecVideoSurfaceFormat_P016;
|
||||
else if (decode_caps.nOutputFormatMask & (1 << rocDecVideoSurfaceFormat_YUV444))
|
||||
else if (decode_caps.output_format_mask & (1 << rocDecVideoSurfaceFormat_YUV444))
|
||||
video_surface_format_ = rocDecVideoSurfaceFormat_YUV444;
|
||||
else if (decode_caps.nOutputFormatMask & (1 << rocDecVideoSurfaceFormat_YUV444_16Bit))
|
||||
else if (decode_caps.output_format_mask & (1 << rocDecVideoSurfaceFormat_YUV444_16Bit))
|
||||
video_surface_format_ = rocDecVideoSurfaceFormat_YUV444_16Bit;
|
||||
else
|
||||
ROCDEC_THROW("No supported output format found", ROCDEC_NOT_SUPPORTED);
|
||||
@@ -328,15 +328,15 @@ int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
video_format_ = *p_video_format;
|
||||
|
||||
RocDecoderCreateInfo videoDecodeCreateInfo = { 0 };
|
||||
videoDecodeCreateInfo.deviceid = device_id_;
|
||||
videoDecodeCreateInfo.CodecType = p_video_format->codec;
|
||||
videoDecodeCreateInfo.ChromaFormat = p_video_format->chroma_format;
|
||||
videoDecodeCreateInfo.OutputFormat = video_surface_format_;
|
||||
videoDecodeCreateInfo.bitDepthMinus8 = p_video_format->bit_depth_luma_minus8;
|
||||
videoDecodeCreateInfo.ulNumOutputSurfaces = 2;
|
||||
videoDecodeCreateInfo.ulNumDecodeSurfaces = nDecodeSurface;
|
||||
videoDecodeCreateInfo.ulWidth = p_video_format->coded_width;
|
||||
videoDecodeCreateInfo.ulHeight = p_video_format->coded_height;
|
||||
videoDecodeCreateInfo.device_id = device_id_;
|
||||
videoDecodeCreateInfo.codec_type = p_video_format->codec;
|
||||
videoDecodeCreateInfo.chroma_format = p_video_format->chroma_format;
|
||||
videoDecodeCreateInfo.output_format = video_surface_format_;
|
||||
videoDecodeCreateInfo.bit_depth_minus_8 = p_video_format->bit_depth_luma_minus8;
|
||||
videoDecodeCreateInfo.num_output_surfaces = 2;
|
||||
videoDecodeCreateInfo.num_decode_surfaces = num_decode_surfaces;
|
||||
videoDecodeCreateInfo.width = p_video_format->coded_width;
|
||||
videoDecodeCreateInfo.height = p_video_format->coded_height;
|
||||
// AV1 has max width/height of sequence in sequence header
|
||||
if (p_video_format->codec == rocDecVideoCodec_AV1 && p_video_format->seqhdr_data_length > 0) {
|
||||
// dont overwrite if it is already set from cmdline or reconfig.txt
|
||||
@@ -351,16 +351,16 @@ int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
if (max_height_ < (int)p_video_format->coded_height)
|
||||
max_height_ = p_video_format->coded_height;
|
||||
|
||||
videoDecodeCreateInfo.ulMaxWidth = max_width_;
|
||||
videoDecodeCreateInfo.ulMaxHeight = max_height_;
|
||||
videoDecodeCreateInfo.max_width = max_width_;
|
||||
videoDecodeCreateInfo.max_height = max_height_;
|
||||
|
||||
coded_width_ = p_video_format->coded_width;
|
||||
coded_height_ = p_video_format->coded_height;
|
||||
if (!(crop_rect_.r && crop_rect_.b)) {
|
||||
disp_width_ = p_video_format->display_area.right - p_video_format->display_area.left;
|
||||
disp_height_ = p_video_format->display_area.bottom - p_video_format->display_area.top;
|
||||
videoDecodeCreateInfo.ulTargetWidth = disp_width_;
|
||||
videoDecodeCreateInfo.ulTargetHeight = disp_height_;
|
||||
videoDecodeCreateInfo.target_width = disp_width_;
|
||||
videoDecodeCreateInfo.target_height = disp_height_;
|
||||
} else {
|
||||
videoDecodeCreateInfo.display_area.left = crop_rect_.l;
|
||||
videoDecodeCreateInfo.display_area.top = crop_rect_.t;
|
||||
@@ -368,8 +368,8 @@ int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
videoDecodeCreateInfo.display_area.bottom = crop_rect_.b;
|
||||
disp_width_ = crop_rect_.r - crop_rect_.l;
|
||||
disp_height_ = crop_rect_.b - crop_rect_.t;
|
||||
videoDecodeCreateInfo.ulTargetWidth = (disp_width_ + 1) & ~1;
|
||||
videoDecodeCreateInfo.ulTargetHeight = (disp_height_ + 1) & ~1;
|
||||
videoDecodeCreateInfo.target_width = (disp_width_ + 1) & ~1;
|
||||
videoDecodeCreateInfo.target_height = (disp_height_ + 1) & ~1;
|
||||
}
|
||||
|
||||
chroma_height_ = (int)(ceil(disp_height_ * GetChromaHeightFactor(video_surface_format_)));
|
||||
@@ -378,14 +378,14 @@ int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
if (out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL || out_mem_type_ == OUT_SURFACE_MEM_NOT_MAPPED)
|
||||
GetSurfaceStrideInternal(video_surface_format_, p_video_format->coded_width, p_video_format->coded_height, &surface_stride_, &surface_vstride_);
|
||||
else {
|
||||
surface_stride_ = videoDecodeCreateInfo.ulTargetWidth * byte_per_pixel_; // todo:: check if we need pitched memory for faster copy
|
||||
surface_stride_ = videoDecodeCreateInfo.target_width * byte_per_pixel_; // todo:: check if we need pitched memory for faster copy
|
||||
}
|
||||
chroma_vstride_ = (int)(ceil(surface_vstride_ * GetChromaHeightFactor(video_surface_format_)));
|
||||
// fill output_surface_info_
|
||||
output_surface_info_.output_width = disp_width_;
|
||||
output_surface_info_.output_height = disp_height_;
|
||||
output_surface_info_.output_pitch = surface_stride_;
|
||||
output_surface_info_.output_vstride = (out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL) ? surface_vstride_ : videoDecodeCreateInfo.ulTargetHeight;
|
||||
output_surface_info_.output_vstride = (out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL) ? surface_vstride_ : videoDecodeCreateInfo.target_height;
|
||||
output_surface_info_.bit_depth = bitdepth_minus_8_ + 8;
|
||||
output_surface_info_.bytes_per_pixel = byte_per_pixel_;
|
||||
output_surface_info_.surface_format = video_surface_format_;
|
||||
@@ -410,16 +410,16 @@ int RocVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
|
||||
disp_rect_.r = videoDecodeCreateInfo.display_area.right;
|
||||
|
||||
input_video_info_str_ << "Video Decoding Params:" << std::endl
|
||||
<< "\tNum Surfaces : " << videoDecodeCreateInfo.ulNumDecodeSurfaces << std::endl
|
||||
<< "\tNum Surfaces : " << videoDecodeCreateInfo.num_decode_surfaces << std::endl
|
||||
<< "\tCrop : [" << videoDecodeCreateInfo.display_area.left << ", " << videoDecodeCreateInfo.display_area.top << ", "
|
||||
<< videoDecodeCreateInfo.display_area.right << ", " << videoDecodeCreateInfo.display_area.bottom << "]" << std::endl
|
||||
<< "\tResize : " << videoDecodeCreateInfo.ulTargetWidth << "x" << videoDecodeCreateInfo.ulTargetHeight << std::endl
|
||||
<< "\tResize : " << videoDecodeCreateInfo.target_width << "x" << videoDecodeCreateInfo.target_height << std::endl
|
||||
;
|
||||
input_video_info_str_ << std::endl;
|
||||
std::cout << input_video_info_str_.str();
|
||||
|
||||
ROCDEC_API_CALL(rocDecCreateDecoder(&roc_decoder_, &videoDecodeCreateInfo));
|
||||
return nDecodeSurface;
|
||||
return num_decode_surfaces;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,11 +509,11 @@ int RocVideoDecoder::ReconfigureDecoder(RocdecVideoFormat *p_video_format) {
|
||||
disp_height_ = p_video_format->display_area.bottom - p_video_format->display_area.top;
|
||||
|
||||
RocdecReconfigureDecoderInfo reconfig_params = {0};
|
||||
reconfig_params.ulWidth = coded_width_;
|
||||
reconfig_params.ulHeight = coded_height_;
|
||||
reconfig_params.ulTargetWidth = (disp_width_ + 1) & ~1;
|
||||
reconfig_params.ulTargetHeight = (disp_height_ + 1) & ~1;
|
||||
reconfig_params.ulNumDecodeSurfaces = p_video_format->min_num_decode_surfaces;
|
||||
reconfig_params.width = coded_width_;
|
||||
reconfig_params.height = coded_height_;
|
||||
reconfig_params.target_width = (disp_width_ + 1) & ~1;
|
||||
reconfig_params.target_height = (disp_height_ + 1) & ~1;
|
||||
reconfig_params.num_decode_surfaces = p_video_format->min_num_decode_surfaces;
|
||||
reconfig_params.roi_area.left = crop_rect_.l;
|
||||
reconfig_params.roi_area.top = crop_rect_.t;
|
||||
reconfig_params.roi_area.right = crop_rect_.r;
|
||||
@@ -526,7 +526,7 @@ int RocVideoDecoder::ReconfigureDecoder(RocdecVideoFormat *p_video_format) {
|
||||
if (out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL || out_mem_type_ == OUT_SURFACE_MEM_NOT_MAPPED) {
|
||||
GetSurfaceStrideInternal(video_surface_format_, p_video_format->coded_width, p_video_format->coded_height, &surface_stride_, &surface_vstride_);
|
||||
} else {
|
||||
surface_stride_ = reconfig_params.ulTargetWidth * byte_per_pixel_;
|
||||
surface_stride_ = reconfig_params.target_width * byte_per_pixel_;
|
||||
}
|
||||
chroma_height_ = static_cast<int>(ceil(disp_height_ * GetChromaHeightFactor(video_surface_format_)));
|
||||
num_chroma_planes_ = GetChromaPlaneCount(video_surface_format_);
|
||||
@@ -536,7 +536,7 @@ int RocVideoDecoder::ReconfigureDecoder(RocdecVideoFormat *p_video_format) {
|
||||
output_surface_info_.output_width = disp_width_;
|
||||
output_surface_info_.output_height = disp_height_;
|
||||
output_surface_info_.output_pitch = surface_stride_;
|
||||
output_surface_info_.output_vstride = (out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL) ? surface_vstride_ : reconfig_params.ulTargetHeight;
|
||||
output_surface_info_.output_vstride = (out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL) ? surface_vstride_ : reconfig_params.target_height;
|
||||
output_surface_info_.bit_depth = bitdepth_minus_8_ + 8;
|
||||
output_surface_info_.bytes_per_pixel = byte_per_pixel_;
|
||||
output_surface_info_.surface_format = video_surface_format_;
|
||||
@@ -570,8 +570,8 @@ int RocVideoDecoder::ReconfigureDecoder(RocdecVideoFormat *p_video_format) {
|
||||
<< p_video_format->display_area.right << ", " << p_video_format->display_area.bottom << "]" << std::endl;
|
||||
input_video_info_str_ << std::endl;
|
||||
input_video_info_str_ << "Video Decoding Params:" << std::endl
|
||||
<< "\tNum Surfaces : " << reconfig_params.ulNumDecodeSurfaces << std::endl
|
||||
<< "\tResize : " << reconfig_params.ulTargetWidth << "x" << reconfig_params.ulTargetHeight << std::endl
|
||||
<< "\tNum Surfaces : " << reconfig_params.num_decode_surfaces << std::endl
|
||||
<< "\tResize : " << reconfig_params.target_width << "x" << reconfig_params.target_height << std::endl
|
||||
;
|
||||
input_video_info_str_ << std::endl;
|
||||
std::cout << input_video_info_str_.str();
|
||||
@@ -591,12 +591,12 @@ int RocVideoDecoder::HandlePictureDecode(RocdecPicParams *pPicParams) {
|
||||
if (!roc_decoder_) {
|
||||
THROW("RocDecoder not initialized: failed with ErrCode: " + TOSTR(ROCDEC_NOT_INITIALIZED));
|
||||
}
|
||||
pic_num_in_dec_order_[pPicParams->CurrPicIdx] = decode_poc_++;
|
||||
pic_num_in_dec_order_[pPicParams->curr_pic_idx] = decode_poc_++;
|
||||
ROCDEC_API_CALL(rocDecDecodeFrame(roc_decoder_, pPicParams));
|
||||
if (b_force_zero_latency_ && ((!pPicParams->field_pic_flag) || (pPicParams->second_field))) {
|
||||
RocdecParserDispInfo disp_info;
|
||||
memset(&disp_info, 0, sizeof(disp_info));
|
||||
disp_info.picture_index = pPicParams->CurrPicIdx;
|
||||
disp_info.picture_index = pPicParams->curr_pic_idx;
|
||||
disp_info.progressive_frame = !pPicParams->field_pic_flag;
|
||||
disp_info.top_field_first = pPicParams->bottom_field_flag ^ 1;
|
||||
HandlePictureDisplay(&disp_info);
|
||||
@@ -617,14 +617,14 @@ int RocVideoDecoder::HandlePictureDisplay(RocdecParserDispInfo *pDispInfo) {
|
||||
video_proc_params.output_hipstream = hip_stream_;
|
||||
|
||||
if (b_extract_sei_message_) {
|
||||
if (sei_message_display_q_[pDispInfo->picture_index].pSEIData) {
|
||||
if (sei_message_display_q_[pDispInfo->picture_index].sei_data) {
|
||||
// Write SEI Message
|
||||
uint8_t *sei_buffer = (uint8_t *)(sei_message_display_q_[pDispInfo->picture_index].pSEIData);
|
||||
uint8_t *sei_buffer = (uint8_t *)(sei_message_display_q_[pDispInfo->picture_index].sei_data);
|
||||
uint32_t sei_num_messages = sei_message_display_q_[pDispInfo->picture_index].sei_message_count;
|
||||
RocdecSeiMessage *sei_message = sei_message_display_q_[pDispInfo->picture_index].pSEIMessage;
|
||||
RocdecSeiMessage *sei_message = sei_message_display_q_[pDispInfo->picture_index].sei_message;
|
||||
if (fp_sei_) {
|
||||
for (uint32_t i = 0; i < sei_num_messages; i++) {
|
||||
if (codec_id_ == rocDecVideoCodec_H264 || rocDecVideoCodec_HEVC) {
|
||||
if (codec_id_ == rocDecVideoCodec_AVC || rocDecVideoCodec_HEVC) {
|
||||
switch (sei_message[i].sei_message_type) {
|
||||
case SEI_TYPE_TIME_CODE: {
|
||||
//todo:: check if we need to write timecode
|
||||
@@ -642,10 +642,10 @@ int RocVideoDecoder::HandlePictureDisplay(RocdecParserDispInfo *pDispInfo) {
|
||||
sei_buffer += sei_message[i].sei_message_size;
|
||||
}
|
||||
}
|
||||
free(sei_message_display_q_[pDispInfo->picture_index].pSEIData);
|
||||
sei_message_display_q_[pDispInfo->picture_index].pSEIData = NULL; // to avoid double free
|
||||
free(sei_message_display_q_[pDispInfo->picture_index].pSEIMessage);
|
||||
sei_message_display_q_[pDispInfo->picture_index].pSEIMessage = NULL; // to avoid double free
|
||||
free(sei_message_display_q_[pDispInfo->picture_index].sei_data);
|
||||
sei_message_display_q_[pDispInfo->picture_index].sei_data = NULL; // to avoid double free
|
||||
free(sei_message_display_q_[pDispInfo->picture_index].sei_message);
|
||||
sei_message_display_q_[pDispInfo->picture_index].sei_message = NULL; // to avoid double free
|
||||
}
|
||||
}
|
||||
if (out_mem_type_ != OUT_SURFACE_MEM_NOT_MAPPED) {
|
||||
@@ -655,7 +655,7 @@ int RocVideoDecoder::HandlePictureDisplay(RocdecParserDispInfo *pDispInfo) {
|
||||
RocdecDecodeStatus dec_status;
|
||||
memset(&dec_status, 0, sizeof(dec_status));
|
||||
rocDecStatus result = rocDecGetDecodeStatus(roc_decoder_, pDispInfo->picture_index, &dec_status);
|
||||
if (result == ROCDEC_SUCCESS && (dec_status.decodeStatus == rocDecodeStatus_Error || dec_status.decodeStatus == rocDecodeStatus_Error_Concealed)) {
|
||||
if (result == ROCDEC_SUCCESS && (dec_status.decode_status == rocDecodeStatus_Error || dec_status.decode_status == rocDecodeStatus_Error_Concealed)) {
|
||||
std::cerr << "Decode Error occurred for picture: " << pic_num_in_dec_order_[pDispInfo->picture_index] << std::endl;
|
||||
}
|
||||
if (out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL) {
|
||||
@@ -738,7 +738,7 @@ int RocVideoDecoder::HandlePictureDisplay(RocdecParserDispInfo *pDispInfo) {
|
||||
RocdecDecodeStatus dec_status;
|
||||
memset(&dec_status, 0, sizeof(dec_status));
|
||||
rocDecStatus result = rocDecGetDecodeStatus(roc_decoder_, pDispInfo->picture_index, &dec_status);
|
||||
if (result == ROCDEC_SUCCESS && (dec_status.decodeStatus == rocDecodeStatus_Error || dec_status.decodeStatus == rocDecodeStatus_Error_Concealed)) {
|
||||
if (result == ROCDEC_SUCCESS && (dec_status.decode_status == rocDecodeStatus_Error || dec_status.decode_status == rocDecodeStatus_Error_Concealed)) {
|
||||
std::cerr << "Decode Error occurred for picture: " << pic_num_in_dec_order_[pDispInfo->picture_index] << std::endl;
|
||||
}
|
||||
decoded_frame_cnt_++;
|
||||
@@ -750,7 +750,7 @@ int RocVideoDecoder::HandlePictureDisplay(RocdecParserDispInfo *pDispInfo) {
|
||||
int RocVideoDecoder::GetSEIMessage(RocdecSeiMessageInfo *pSEIMessageInfo) {
|
||||
uint32_t sei_num_mesages = pSEIMessageInfo->sei_message_count;
|
||||
if (sei_num_mesages) {
|
||||
RocdecSeiMessage *p_sei_msg_info = pSEIMessageInfo->pSEIMessage;
|
||||
RocdecSeiMessage *p_sei_msg_info = pSEIMessageInfo->sei_message;
|
||||
size_t total_SEI_buff_size = 0;
|
||||
if ((pSEIMessageInfo->picIdx < 0) || (pSEIMessageInfo->picIdx >= MAX_FRAME_NUM)) {
|
||||
ERR("Invalid picture index for SEI message: " + TOSTR(pSEIMessageInfo->picIdx));
|
||||
@@ -763,19 +763,19 @@ int RocVideoDecoder::GetSEIMessage(RocdecSeiMessageInfo *pSEIMessageInfo) {
|
||||
ERR("Out of Memory, Allocation failed for m_pCurrSEIMessage");
|
||||
return 0;
|
||||
}
|
||||
curr_sei_message_ptr_->pSEIData = malloc(total_SEI_buff_size);
|
||||
if (!curr_sei_message_ptr_->pSEIData) {
|
||||
curr_sei_message_ptr_->sei_data = malloc(total_SEI_buff_size);
|
||||
if (!curr_sei_message_ptr_->sei_data) {
|
||||
ERR("Out of Memory, Allocation failed for SEI Buffer");
|
||||
return 0;
|
||||
}
|
||||
memcpy(curr_sei_message_ptr_->pSEIData, pSEIMessageInfo->pSEIData, total_SEI_buff_size);
|
||||
curr_sei_message_ptr_->pSEIMessage = (RocdecSeiMessage *)malloc(sizeof(RocdecSeiMessage) * sei_num_mesages);
|
||||
if (!curr_sei_message_ptr_->pSEIMessage) {
|
||||
free(curr_sei_message_ptr_->pSEIData);
|
||||
curr_sei_message_ptr_->pSEIData = NULL;
|
||||
memcpy(curr_sei_message_ptr_->sei_data, pSEIMessageInfo->sei_data, total_SEI_buff_size);
|
||||
curr_sei_message_ptr_->sei_message = (RocdecSeiMessage *)malloc(sizeof(RocdecSeiMessage) * sei_num_mesages);
|
||||
if (!curr_sei_message_ptr_->sei_message) {
|
||||
free(curr_sei_message_ptr_->sei_data);
|
||||
curr_sei_message_ptr_->sei_data = NULL;
|
||||
return 0;
|
||||
}
|
||||
memcpy(curr_sei_message_ptr_->pSEIMessage, pSEIMessageInfo->pSEIMessage, sizeof(RocdecSeiMessage) * sei_num_mesages);
|
||||
memcpy(curr_sei_message_ptr_->sei_message, pSEIMessageInfo->sei_message, sizeof(RocdecSeiMessage) * sei_num_mesages);
|
||||
curr_sei_message_ptr_->sei_message_count = pSEIMessageInfo->sei_message_count;
|
||||
sei_message_display_q_[pSEIMessageInfo->picIdx] = *curr_sei_message_ptr_;
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ extern "C" {
|
||||
#define MAX_FRAME_NUM 16
|
||||
typedef int (ROCDECAPI *PFNRECONFIGUEFLUSHCALLBACK)(void *, uint32_t, void *);
|
||||
|
||||
typedef enum SeiH264HevcPayloadType_enum {
|
||||
typedef enum SeiAvcHevcPayloadType_enum {
|
||||
SEI_TYPE_TIME_CODE = 136,
|
||||
SEI_TYPE_USER_DATA_UNREGISTERED = 5
|
||||
} SeiH264HevcPayloadType;
|
||||
} SeiAvcHevcPayloadType;
|
||||
|
||||
typedef enum OutputSurfaceMemoryType_enum {
|
||||
OUT_SURFACE_MEM_DEV_INTERNAL = 0, /**< Internal interopped decoded surface memory(original mapped decoded surface) */
|
||||
|
||||
@@ -273,7 +273,7 @@ static inline rocDecVideoCodec AVCodec2RocDecVideoCodec(AVCodecID av_codec) {
|
||||
case AV_CODEC_ID_MPEG1VIDEO : return rocDecVideoCodec_MPEG1;
|
||||
case AV_CODEC_ID_MPEG2VIDEO : return rocDecVideoCodec_MPEG2;
|
||||
case AV_CODEC_ID_MPEG4 : return rocDecVideoCodec_MPEG4;
|
||||
case AV_CODEC_ID_H264 : return rocDecVideoCodec_H264;
|
||||
case AV_CODEC_ID_H264 : return rocDecVideoCodec_AVC;
|
||||
case AV_CODEC_ID_HEVC : return rocDecVideoCodec_HEVC;
|
||||
case AV_CODEC_ID_VP8 : return rocDecVideoCodec_VP8;
|
||||
case AV_CODEC_ID_VP9 : return rocDecVideoCodec_VP9;
|
||||
|
||||
Reference in New Issue
Block a user