diff --git a/projects/rocdecode/api/rocdecode.h b/projects/rocdecode/api/rocdecode.h index 6e16b17988..4db0036c4e 100644 --- a/projects/rocdecode/api/rocdecode.h +++ b/projects/rocdecode/api/rocdecode.h @@ -22,7 +22,7 @@ THE SOFTWARE. #ifndef ROCDECAPI #if defined(_WIN32) -#define ROCDECAPI __stdcall // for future: only linux is supported in this version +#define ROCDECAPI __stdcall // for future: only linux is supported in this version #else #define ROCDECAPI #endif @@ -39,7 +39,6 @@ THE SOFTWARE. * \brief AMD The rocDecode is a toolkit to decode videos and images using a hardware-accelerated video decoder on AMD’s GPUs. */ - #if defined(__cplusplus) extern "C" { #endif // __cplusplus @@ -57,17 +56,17 @@ typedef void *rocDecDecoderHandle; //! 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, -}rocDecStatus; +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, +} rocDecStatus; /*********************************************************************************/ //! \enum rocDecodeVideoCodec @@ -76,22 +75,22 @@ typedef enum rocDecStatus_enum{ //! These enums are used in ROCDECODECREATEINFO and ROCDECODEVIDDECODECAPS structures /*********************************************************************************/ typedef enum rocDecVideoCodec_enum { - rocDecVideoCodec_MPEG1 = 0, /**< MPEG1 */ - rocDecVideoCodec_MPEG2, /**< MPEG2 */ - rocDecVideoCodec_MPEG4, /**< MPEG4 */ - rocDecVideoCodec_AVC, /**< AVC/H264 */ - rocDecVideoCodec_HEVC, /**< HEVC */ - rocDecVideoCodec_AV1, /**< AV1 */ - rocDecVideoCodec_VP8, /**< VP8 */ - rocDecVideoCodec_VP9, /**< VP9 */ - rocDecVideoCodec_JPEG, /**< JPEG */ - rocDecVideoCodec_NumCodecs, /**< Max codecs */ + rocDecVideoCodec_MPEG1 = 0, /**< MPEG1 */ + rocDecVideoCodec_MPEG2, /**< MPEG2 */ + rocDecVideoCodec_MPEG4, /**< MPEG4 */ + rocDecVideoCodec_AVC, /**< AVC/H264 */ + rocDecVideoCodec_HEVC, /**< HEVC */ + rocDecVideoCodec_AV1, /**< AV1 */ + rocDecVideoCodec_VP8, /**< VP8 */ + rocDecVideoCodec_VP9, /**< VP9 */ + rocDecVideoCodec_JPEG, /**< JPEG */ + rocDecVideoCodec_NumCodecs, /**< Max codecs */ // Uncompressed YUV - rocDecVideoCodec_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), /**< Y,U,V (4:2:0) */ - rocDecVideoCodec_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,V,U (4:2:0) */ - rocDecVideoCodec_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2')), /**< Y,UV (4:2:0) */ - rocDecVideoCodec_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')), /**< YUYV/YUY2 (4:2:2) */ - rocDecVideoCodec_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y')) /**< UYVY (4:2:2) */ + rocDecVideoCodec_YUV420 = (('I' << 24) | ('Y' << 16) | ('U' << 8) | ('V')), /**< Y,U,V (4:2:0) */ + rocDecVideoCodec_YV12 = (('Y' << 24) | ('V' << 16) | ('1' << 8) | ('2')), /**< Y,V,U (4:2:0) */ + rocDecVideoCodec_NV12 = (('N' << 24) | ('V' << 16) | ('1' << 8) | ('2')), /**< Y,UV (4:2:0) */ + rocDecVideoCodec_YUYV = (('Y' << 24) | ('U' << 16) | ('Y' << 8) | ('V')), /**< YUYV/YUY2 (4:2:2) */ + rocDecVideoCodec_UYVY = (('U' << 24) | ('Y' << 16) | ('V' << 8) | ('Y')) /**< UYVY (4:2:2) */ } rocDecVideoCodec; /*********************************************************************************/ @@ -101,12 +100,12 @@ 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]. - 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]. - Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */ + 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]. + Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */ } rocDecVideoSurfaceFormat; /**************************************************************************************************************/ @@ -116,13 +115,12 @@ typedef enum rocDecVideoSurfaceFormat_enum { //! These enums are used in ROCDCODECREATEINFO and RocdecDecodeCaps structures /**************************************************************************************************************/ typedef enum rocDecVideoChromaFormat_enum { - rocDecVideoChromaFormat_Monochrome = 0, /**< MonoChrome */ - rocDecVideoChromaFormat_420, /**< YUV 4:2:0 */ - rocDecVideoChromaFormat_422, /**< YUV 4:2:2 */ - rocDecVideoChromaFormat_444 /**< YUV 4:4:4 */ + rocDecVideoChromaFormat_Monochrome = 0, /**< MonoChrome */ + rocDecVideoChromaFormat_420, /**< YUV 4:2:0 */ + rocDecVideoChromaFormat_422, /**< YUV 4:2:2 */ + rocDecVideoChromaFormat_444 /**< YUV 4:4:4 */ } rocDecVideoChromaFormat; - /*************************************************************************/ //! \enum rocDecDecodeStatus //! \ingroup group_amd_rocdecode @@ -130,13 +128,13 @@ typedef enum rocDecVideoChromaFormat_enum { //! These enums are used in RocdecGetDecodeStatus structure /*************************************************************************/ typedef enum rocDecodeStatus_enum { - rocDecodeStatus_Invalid = 0, // Decode status is not valid - rocDecodeStatus_InProgress = 1, // Decode is in progress - rocDecodeStatus_Success = 2, // Decode is completed without any errors + rocDecodeStatus_Invalid = 0, // Decode status is not valid + rocDecodeStatus_InProgress = 1, // Decode is in progress + rocDecodeStatus_Success = 2, // Decode is completed without any errors // 3 to 7 enums are reserved for future use - rocDecodeStatus_Error = 8, // Decode is completed with an error (error is not concealed) - rocDecodeStatus_Error_Concealed = 9, // Decode is completed with an error and error is concealed - rocDecodeStatus_Displaying = 10, // Decode is completed, displaying in progress + rocDecodeStatus_Error = 8, // Decode is completed with an error (error is not concealed) + rocDecodeStatus_Error_Concealed = 9, // Decode is completed with an error and error is concealed + rocDecodeStatus_Displaying = 10, // Decode is completed, displaying in progress } rocDecDecodeStatus; /**************************************************************************************************************/ @@ -145,19 +143,19 @@ typedef enum rocDecodeStatus_enum { //! This structure is used in rocDecGetDecoderCaps API /**************************************************************************************************************/ typedef struct _RocdecDecodeCaps { - 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 */ + 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; /**************************************************************************************************************/ @@ -166,39 +164,39 @@ typedef struct _RocdecDecodeCaps { //! This structure is used in rocDecCreateDecoder API /**************************************************************************************************************/ typedef struct _RocDecoderCreateInfo { - 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 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 - 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 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 */ + 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 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 - 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 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 */ struct { int16_t left; int16_t top; int16_t right; int16_t bottom; - } display_rect; /**< IN: area of the frame that should be displayed */ - 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 */ + } display_rect; /**< IN: area of the frame that should be displayed */ + 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 */ struct { int16_t left; int16_t top; int16_t right; int16_t bottom; - } target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio conversion) - if a null rectangle is specified, {0,0,target_width,target_height} will be used*/ - uint32_t reserved_2[4]; /**< Reserved for future use - set to zero */ + } target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio conversion) + if a null rectangle is specified, {0,0,target_width,target_height} will be used*/ + uint32_t reserved_2[4]; /**< Reserved for future use - set to zero */ } RocDecoderCreateInfo; /*********************************************************************************************************/ @@ -208,9 +206,9 @@ typedef struct _RocDecoderCreateInfo { //! This structure is used in RocdecGetDecodeStatus API. /*********************************************************************************************************/ typedef struct _RocdecDecodeStatus { - rocDecDecodeStatus decode_status; - uint32_t reserved[31]; - void *p_reserved[8]; + rocDecDecodeStatus decode_status; + uint32_t reserved[31]; + void *p_reserved[8]; } RocdecDecodeStatus; /****************************************************/ @@ -220,27 +218,27 @@ typedef struct _RocdecDecodeStatus { //! This structure is used in rocDecReconfigureDecoder() API /****************************************************/ typedef struct _RocdecReconfigureDecoderInfo { - 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 */ + 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 */ struct { int16_t left; int16_t top; int16_t right; int16_t bottom; - } display_rect; /**< IN: area of the frame that should be displayed */ + } display_rect; /**< IN: area of the frame that should be displayed */ struct { int16_t left; int16_t top; int16_t right; int16_t bottom; - } target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio conversion) - if a null rectangle is specified, {0,0,target_width,target_height} will be used */ + } target_rect; /**< IN: (for future use) target rectangle in the output frame (for aspect ratio conversion) + if a null rectangle is specified, {0,0,target_width,target_height} will be used */ uint32_t reserved_2[11]; /**< Reserved for future use. Set to Zero */ -} RocdecReconfigureDecoderInfo; +} RocdecReconfigureDecoderInfo; /*********************************************************/ //! \struct RocdecAvcPicture @@ -249,21 +247,21 @@ typedef struct _RocdecReconfigureDecoderInfo { //! This structure is used in RocdecAvcPicParams structure /*********************************************************/ typedef struct _RocdecAvcPicture { - 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]; + 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 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 +#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 @@ -272,30 +270,30 @@ typedef struct _RocdecAvcPicture { //! This structure is used in RocdecHevcPicParams structure /*********************************************************/ typedef struct _RocdecHevcPicture { - int pic_idx; /**< reconstructed picture surface ID */ + 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. - */ + * 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 */ + 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 +#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 @@ -310,17 +308,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 @@ -358,8 +356,8 @@ typedef struct _RocdecMpeg2QMatrix { typedef struct _RocdecMpeg2PicParams { uint16_t horizontal_size; uint16_t vertical_size; - uint32_t forward_reference_pic; // surface_id for forward reference - uint32_t backward_reference_picture; // surface_id for backward reference + uint32_t forward_reference_pic; // surface_id for forward reference + uint32_t backward_reference_picture; // surface_id for backward reference /* meanings of the following fields are the same as in the standard */ int32_t picture_coding_type; int32_t f_code; /* pack all four fcode into this */ @@ -375,13 +373,13 @@ typedef struct _RocdecMpeg2PicParams { uint32_t alternate_scan : 1; uint32_t repeat_first_field : 1; uint32_t progressive_frame : 1; - uint32_t is_first_field : 1; // indicate whether the current field is the first field for field picture + uint32_t is_first_field : 1; // indicate whether the current field is the first field for field picture } bits; uint32_t value; } picture_coding_extension; RocdecMpeg2QMatrix q_matrix; - uint32_t reserved[4]; + uint32_t reserved[4]; } RocdecMpeg2PicParams; /***********************************************************/ @@ -403,7 +401,7 @@ typedef struct _RocdecVc1PicParams { /***********************************************************/ typedef struct _RocdecAvcPicParams { RocdecAvcPicture curr_pic; - RocdecAvcPicture ref_frames[16]; /* in DPB */ + RocdecAvcPicture ref_frames[16]; /* in DPB */ uint16_t picture_width_in_mbs_minus1; uint16_t picture_height_in_mbs_minus1; uint8_t bit_depth_luma_minus8; @@ -451,7 +449,7 @@ typedef struct _RocdecAvcPicParams { } pic_fields; uint16_t frame_num; - uint32_t reserved[8]; + uint32_t reserved[8]; } RocdecAvcPicParams; /***********************************************************/ @@ -461,9 +459,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(). * @@ -474,36 +472,34 @@ typedef struct _RocdecAvcSliceParams { * the original bitstream, thus including any emulation prevention * bytes. */ - 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]; - - uint32_t reserved[4]; + 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]; + uint32_t reserved[4]; } RocdecAvcSliceParams; /***********************************************************/ @@ -514,12 +510,11 @@ 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 reserved[4]; + uint32_t reserved[4]; } RocdecAvcIQMatrix; /***********************************************************/ @@ -529,104 +524,104 @@ 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 */ - uint32_t chroma_format_idc : 2; - uint32_t separate_colour_plane_flag : 1; - uint32_t pcm_enabled_flag : 1; - uint32_t scaling_list_enabled_flag : 1; - uint32_t transform_skip_enabled_flag : 1; - uint32_t amp_enabled_flag : 1; - uint32_t strong_intra_smoothing_enabled_flag : 1; - uint32_t sign_data_hiding_enabled_flag : 1; - uint32_t constrained_intra_pred_flag : 1; - uint32_t cu_qp_delta_enabled_flag : 1; - uint32_t weighted_pred_flag : 1; - uint32_t weighted_bipred_flag : 1; - uint32_t transquant_bypass_enabled_flag : 1; - uint32_t tiles_enabled_flag : 1; - uint32_t entropy_coding_sync_enabled_flag : 1; - uint32_t pps_loop_filter_across_slices_enabled_flag : 1; - uint32_t loop_filter_across_tiles_enabled_flag : 1; - uint32_t pcm_loop_filter_disabled_flag : 1; + uint32_t chroma_format_idc : 2; + uint32_t separate_colour_plane_flag : 1; + uint32_t pcm_enabled_flag : 1; + uint32_t scaling_list_enabled_flag : 1; + uint32_t transform_skip_enabled_flag : 1; + uint32_t amp_enabled_flag : 1; + uint32_t strong_intra_smoothing_enabled_flag : 1; + uint32_t sign_data_hiding_enabled_flag : 1; + uint32_t constrained_intra_pred_flag : 1; + uint32_t cu_qp_delta_enabled_flag : 1; + uint32_t weighted_pred_flag : 1; + uint32_t weighted_bipred_flag : 1; + uint32_t transquant_bypass_enabled_flag : 1; + uint32_t tiles_enabled_flag : 1; + uint32_t entropy_coding_sync_enabled_flag : 1; + uint32_t pps_loop_filter_across_slices_enabled_flag : 1; + 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 no_pic_reordering_flag : 1; + uint32_t no_pic_reordering_flag : 1; /** picture has no B slices */ - uint32_t no_bi_pred_flag : 1; - uint32_t reserved_bits : 11; + uint32_t no_bi_pred_flag : 1; + uint32_t reserved_bits : 11; } bits; - uint32_t value; + uint32_t value; } pic_fields; /** SPS fields: the following parameters have same syntax with those in HEVC spec */ - uint8_t sps_max_dec_pic_buffering_minus1; /**< IN: DPB size for current temporal layer */ - uint8_t bit_depth_luma_minus8; - uint8_t bit_depth_chroma_minus8; - uint8_t pcm_sample_bit_depth_luma_minus1; - uint8_t pcm_sample_bit_depth_chroma_minus1; - uint8_t log2_min_luma_coding_block_size_minus3; - uint8_t log2_diff_max_min_luma_coding_block_size; - uint8_t log2_min_transform_block_size_minus2; - uint8_t log2_diff_max_min_transform_block_size; - uint8_t log2_min_pcm_luma_coding_block_size_minus3; - uint8_t log2_diff_max_min_pcm_luma_coding_block_size; - uint8_t max_transform_hierarchy_depth_intra; - uint8_t max_transform_hierarchy_depth_inter; - int8_t init_qp_minus26; - uint8_t diff_cu_qp_delta_depth; - int8_t pps_cb_qp_offset; - int8_t pps_cr_qp_offset; - uint8_t log2_parallel_merge_level_minus2; - uint8_t num_tile_columns_minus1; - uint8_t num_tile_rows_minus1; + uint8_t sps_max_dec_pic_buffering_minus1; /**< IN: DPB size for current temporal layer */ + uint8_t bit_depth_luma_minus8; + uint8_t bit_depth_chroma_minus8; + uint8_t pcm_sample_bit_depth_luma_minus1; + uint8_t pcm_sample_bit_depth_chroma_minus1; + uint8_t log2_min_luma_coding_block_size_minus3; + uint8_t log2_diff_max_min_luma_coding_block_size; + uint8_t log2_min_transform_block_size_minus2; + uint8_t log2_diff_max_min_transform_block_size; + uint8_t log2_min_pcm_luma_coding_block_size_minus3; + uint8_t log2_diff_max_min_pcm_luma_coding_block_size; + uint8_t max_transform_hierarchy_depth_intra; + uint8_t max_transform_hierarchy_depth_inter; + int8_t init_qp_minus26; + uint8_t diff_cu_qp_delta_depth; + int8_t pps_cb_qp_offset; + int8_t pps_cr_qp_offset; + uint8_t log2_parallel_merge_level_minus2; + uint8_t num_tile_columns_minus1; + uint8_t num_tile_rows_minus1; /** * when uniform_spacing_flag equals 1, application should populate * column_width_minus[], and row_height_minus1[] with approperiate values. */ - uint16_t column_width_minus1[19]; - uint16_t row_height_minus1[21]; + uint16_t column_width_minus1[19]; + uint16_t row_height_minus1[21]; union { struct { /** following parameters have same syntax with those in HEVC spec */ - uint32_t lists_modification_present_flag : 1; - uint32_t long_term_ref_pics_present_flag : 1; - uint32_t sps_temporal_mvp_enabled_flag : 1; - uint32_t cabac_init_present_flag : 1; - uint32_t output_flag_present_flag : 1; - uint32_t dependent_slice_segments_enabled_flag : 1; - uint32_t pps_slice_chroma_qp_offsets_present_flag : 1; - uint32_t sample_adaptive_offset_enabled_flag : 1; - uint32_t deblocking_filter_override_enabled_flag : 1; - uint32_t pps_disable_deblocking_filter_flag : 1; - uint32_t slice_segment_header_extension_present_flag : 1; + uint32_t lists_modification_present_flag : 1; + uint32_t long_term_ref_pics_present_flag : 1; + uint32_t sps_temporal_mvp_enabled_flag : 1; + uint32_t cabac_init_present_flag : 1; + uint32_t output_flag_present_flag : 1; + uint32_t dependent_slice_segments_enabled_flag : 1; + uint32_t pps_slice_chroma_qp_offsets_present_flag : 1; + uint32_t sample_adaptive_offset_enabled_flag : 1; + uint32_t deblocking_filter_override_enabled_flag : 1; + uint32_t pps_disable_deblocking_filter_flag : 1; + uint32_t slice_segment_header_extension_present_flag : 1; /** current picture with NUT between 16 and 21 inclusive */ - uint32_t rap_pic_flag : 1; + uint32_t rap_pic_flag : 1; /** current picture with NUT between 19 and 20 inclusive */ - uint32_t idr_pic_flag : 1; + uint32_t idr_pic_flag : 1; /** current picture has only intra slices */ - uint32_t intra_pic_flag : 1; + uint32_t intra_pic_flag : 1; - uint32_t reserved_bits : 18; + uint32_t reserved_bits : 18; } bits; - uint32_t value; + uint32_t value; } slice_parsing_fields; /** following parameters have same syntax with those in HEVC spec */ - uint8_t log2_max_pic_order_cnt_lsb_minus4; - uint8_t num_short_term_ref_pic_sets; - uint8_t num_long_term_ref_pic_sps; - uint8_t num_ref_idx_l0_default_active_minus1; - uint8_t num_ref_idx_l1_default_active_minus1; - int8_t pps_beta_offset_div2; - int8_t pps_tc_offset_div2; - uint8_t num_extra_slice_header_bits; + uint8_t log2_max_pic_order_cnt_lsb_minus4; + uint8_t num_short_term_ref_pic_sets; + uint8_t num_long_term_ref_pic_sps; + uint8_t num_ref_idx_l0_default_active_minus1; + uint8_t num_ref_idx_l1_default_active_minus1; + int8_t pps_beta_offset_div2; + int8_t pps_tc_offset_div2; + uint8_t num_extra_slice_header_bits; /** * \brief number of bits that structure * short_term_ref_pic_set( num_short_term_ref_pic_sets ) takes in slice @@ -637,9 +632,8 @@ typedef struct _RocdecHevcPicParams { * This variable is used for accelorater to skip parsing the * short_term_ref_pic_set( num_short_term_ref_pic_sets ) structure. */ - uint32_t st_rps_bits; - - uint32_t reserved[8]; + uint32_t st_rps_bits; + uint32_t reserved[8]; } RocdecHevcPicParams; /***********************************************************/ @@ -652,11 +646,11 @@ typedef struct _RocdecHevcSliceParams { /** \brief Number of bytes in the slice data buffer for this slice * counting from and including NAL unit header. */ - uint32_t slice_data_size; + uint32_t slice_data_size; /** \brief The offset to the NAL unit header for this slice */ - uint32_t slice_data_offset; + uint32_t slice_data_offset; /** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */ - uint32_t slice_data_flag; + uint32_t slice_data_flag; /** * \brief Byte offset from NAL unit header to the begining of slice_data(). * @@ -667,66 +661,66 @@ typedef struct _RocdecHevcSliceParams { * the original bitstream, thus including any emulation prevention * bytes. */ - uint32_t slice_data_byte_offset; + uint32_t slice_data_byte_offset; /** HEVC syntax element. */ - uint32_t slice_segment_address; + uint32_t slice_segment_address; /** \brief index into ReferenceFrames[] * 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 ref_pic_list[2][15]; + uint8_t ref_pic_list[2][15]; union { - uint32_t value; + uint32_t value; struct { /** current slice is last slice of picture. */ - uint32_t last_slice_of_pic : 1; + uint32_t last_slice_of_pic : 1; /** HEVC syntax element. */ - uint32_t dependent_slice_segment_flag : 1; - uint32_t slice_type : 2; - uint32_t color_plane_id : 2; - uint32_t slice_sao_luma_flag : 1; - uint32_t slice_sao_chroma_flag : 1; - uint32_t mvd_l1_zero_flag : 1; - uint32_t cabac_init_flag : 1; - uint32_t slice_temporal_mvp_enabled_flag : 1; - uint32_t slice_deblocking_filter_disabled_flag : 1; - uint32_t collocated_from_l0_flag : 1; - uint32_t slice_loop_filter_across_slices_enabled_flag : 1; - uint32_t reserved : 18; + uint32_t dependent_slice_segment_flag : 1; + uint32_t slice_type : 2; + uint32_t color_plane_id : 2; + uint32_t slice_sao_luma_flag : 1; + uint32_t slice_sao_chroma_flag : 1; + uint32_t mvd_l1_zero_flag : 1; + uint32_t cabac_init_flag : 1; + uint32_t slice_temporal_mvp_enabled_flag : 1; + uint32_t slice_deblocking_filter_disabled_flag : 1; + uint32_t collocated_from_l0_flag : 1; + uint32_t slice_loop_filter_across_slices_enabled_flag : 1; + uint32_t reserved : 18; } fields; } long_slice_flags; /** HEVC syntax element. */ - uint8_t collocated_ref_idx; - uint8_t num_ref_idx_l0_active_minus1; - uint8_t num_ref_idx_l1_active_minus1; - int8_t slice_qp_delta; - int8_t slice_cb_qp_offset; - int8_t slice_cr_qp_offset; - int8_t slice_beta_offset_div2; - int8_t slice_tc_offset_div2; - uint8_t luma_log2_weight_denom; - int8_t delta_chroma_log2_weight_denom; - int8_t delta_luma_weight_l0[15]; - int8_t luma_offset_l0[15]; - int8_t delta_chroma_weight_l0[15][2]; + uint8_t collocated_ref_idx; + uint8_t num_ref_idx_l0_active_minus1; + uint8_t num_ref_idx_l1_active_minus1; + int8_t slice_qp_delta; + int8_t slice_cb_qp_offset; + int8_t slice_cr_qp_offset; + int8_t slice_beta_offset_div2; + int8_t slice_tc_offset_div2; + uint8_t luma_log2_weight_denom; + int8_t delta_chroma_log2_weight_denom; + int8_t delta_luma_weight_l0[15]; + 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 chroma_offset_l0[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]; + 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 chroma_offset_l1[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; + uint8_t five_minus_max_num_merge_cand; + 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; + uint16_t slice_data_num_emu_prevn_bytes; - uint32_t reserved[2]; + uint32_t reserved[2]; } RocdecHevcSliceParams; /***********************************************************/ @@ -745,45 +739,44 @@ 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 scaling_list_4x4[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 scaling_list_8x8[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 scaling_list_16x16[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 scaling_list_32x32[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 scaling_list_dc_16x16[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 scaling_list_dc_32x32[2]; - - uint32_t reserved[4]; + uint8_t scaling_list_dc_32x32[2]; + uint32_t reserved[4]; } RocdecHevcIQMatrix; /** \brief Segmentation Information for AV1 - */ + */ typedef struct _RocdecAv1SegmentationStruct { union { struct { @@ -835,12 +828,12 @@ typedef struct _RocdecAv1SegmentationStruct { SEG_LVL_GLOBALMV, SEG_LVL_MAX } SEG_LVL_FEATURES; - * feature_data[][] is equivalent to variable FeatureData[][] in spec, - * which is after clip3() operation. - * Clip3(x, y, z) = (z < x)? x : ((z > y)? y : z); - * The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = { - * 255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0, 0 } - */ + * feature_data[][] is equivalent to variable FeatureData[][] in spec, + * which is after clip3() operation. + * Clip3(x, y, z) = (z < x)? x : ((z > y)? y : z); + * The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = { + * 255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0, 0 } + */ int16_t feature_data[8][8]; /** \brief indicates if a feature is enabled or not. @@ -1089,10 +1082,10 @@ typedef struct _RocdecAV1PicParams { uint8_t tile_rows; /* The width/height of a tile minus 1 in units of superblocks. Though the - * maximum number of tiles is 64, since ones of the last tile are computed - * from ones of the other tiles and frame_width/height, they are not - * necessarily specified. - */ + * maximum number of tiles is 64, since ones of the last tile are computed + * from ones of the other tiles and frame_width/height, they are not + * necessarily specified. + */ uint16_t width_in_sbs_minus_1[63]; uint16_t height_in_sbs_minus_1[63]; @@ -1379,45 +1372,45 @@ typedef struct _RocdecAv1SliceParams { //! IN for rocDecDecodePicture /******************************************************************************************/ typedef struct _RocdecPicParams { - 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 */ + 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 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 */ + 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 */ - 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; - RocdecAv1PicParams av1; - uint32_t codec_reserved[256]; + RocdecMpeg2PicParams mpeg2; /**< Also used for MPEG-1 */ + RocdecAvcPicParams avc; + RocdecHevcPicParams hevc; + RocdecVc1PicParams vc1; + RocdecJPEGPicParams jpeg; + RocdecAv1PicParams av1; + uint32_t codec_reserved[256]; } pic_params; /*! \brief Variable size array. The user should allocate one slice param struct for each slice. - */ + */ union { // Todo: Add slice params defines for other codecs. - RocdecAvcSliceParams *avc; - RocdecHevcSliceParams *hevc; - RocdecAv1SliceParams *av1; + RocdecAvcSliceParams *avc; + RocdecHevcSliceParams *hevc; + RocdecAv1SliceParams *av1; } slice_params; union { // Todo: Added IQ matrix defines for other codecs. - RocdecAvcIQMatrix avc; - RocdecHevcIQMatrix hevc; + RocdecAvcIQMatrix avc; + RocdecHevcIQMatrix hevc; } iq_matrix; } RocdecPicParams; @@ -1427,20 +1420,19 @@ typedef struct _RocdecPicParams { //! Picture parameters for postprocessing //! This structure is used in rocDecGetVideoFrame API /******************************************************/ -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) */ +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) */ // 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) */ - uint32_t reserved[16]; /**< Reserved for future use (set to zero) */ + 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) */ + uint32_t reserved[16]; /**< Reserved for future use (set to zero) */ } RocdecProcParams; /*****************************************************************************************************/ @@ -1471,7 +1463,7 @@ extern rocDecStatus ROCDECAPI rocDecGetDecoderCaps(RocdecDecodeCaps *decode_caps //! \fn rocDecStatus ROCDECAPI rocDecDecodeFrame(rocDecDecoderHandle decoder_handle, RocdecPicParams *pic_params) //! \ingroup group_amd_rocdecode //! Decodes a single picture -//! Submits the frame for HW decoding +//! Submits the frame for HW decoding /*****************************************************************************************************/ extern rocDecStatus ROCDECAPI rocDecDecodeFrame(rocDecDecoderHandle decoder_handle, RocdecPicParams *pic_params); @@ -1482,13 +1474,13 @@ extern rocDecStatus ROCDECAPI rocDecDecodeFrame(rocDecDecoderHandle decoder_hand //! 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); +extern rocDecStatus ROCDECAPI rocDecGetDecodeStatus(rocDecDecoderHandle decoder_handle, int pic_idx, RocdecDecodeStatus *decode_status); /*********************************************************************************************************/ //! \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::pfn_sequence_callback +//! 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::pfn_sequence_callback /*********************************************************************************************************/ extern rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params); @@ -1501,15 +1493,15 @@ extern rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle decod //! pitch(horizontal stride) of the video frame. Returns device memory pointers and pitch for each plane (Y, U and V) seperately /************************************************************************************************************************/ extern rocDecStatus ROCDECAPI rocDecGetVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx, - void *dev_mem_ptr[3], uint32_t (&horizontal_pitch)[3], - RocdecProcParams *vid_postproc_params); + void *dev_mem_ptr[3], uint32_t (&horizontal_pitch)[3], + RocdecProcParams *vid_postproc_params); /*****************************************************************************************************/ //! \fn const char* ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status) //! \ingroup group_amd_rocdecode //! Return name of the specified error code in text form. /*****************************************************************************************************/ -extern const char* ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status); +extern const char *ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status); #ifdef __cplusplus } diff --git a/projects/rocdecode/api/rocparser.h b/projects/rocdecode/api/rocparser.h index e14402d9a9..8f666376d5 100644 --- a/projects/rocdecode/api/rocparser.h +++ b/projects/rocdecode/api/rocparser.h @@ -32,7 +32,7 @@ THE SOFTWARE. * \brief AMD The rocDecode video parser for AMD’s GPUs. * \defgroup group_rocdec_struct rocDecode Parser Structs: AMD ROCm Video Parser Structs * \brief AMD The rocDecode video parser struct -*/ + */ #if defined(__cplusplus) extern "C" { @@ -52,66 +52,66 @@ typedef uint64_t RocdecTimeStamp; * Used in Parser callback API */ typedef struct { - rocDecVideoCodec codec; /**< OUT: Compression format */ - /** - * OUT: frame rate = numerator / denominator (for example: 30000/1001) - */ + rocDecVideoCodec codec; /**< OUT: Compression format */ + /** + * OUT: frame rate = numerator / denominator (for example: 30000/1001) + */ struct { /**< OUT: frame rate numerator (0 = unspecified or variable frame rate) */ uint32_t numerator; /**< OUT: frame rate denominator (0 = unspecified or variable frame rate) */ uint32_t denominator; } frame_rate; - uint8_t progressive_sequence; /**< OUT: 0=interlaced, 1=progressive */ - 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 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 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 */ - /** - * area of the frame that should be displayed - * typical example: - * coded_width = 1920, coded_height = 1088 - * display_area = { 0,0,1920,1080 } - */ + uint8_t progressive_sequence; /**< OUT: 0=interlaced, 1=progressive */ + 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 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 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 */ + /** + * area of the frame that should be displayed + * typical example: + * coded_width = 1920, coded_height = 1088 + * 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) */ - /** - * OUT: Display Aspect Ratio = x:y (4:3, 16:9, etc) - */ + + 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) + */ struct { int x; int y; } display_aspect_ratio; /** - * Video Signal Description - * Refer section E.2.1 (VUI parameters semantics) of H264 spec file - */ + * Video Signal Description + * Refer section E.2.1 (VUI parameters semantics) of H264 spec file + */ struct { - uint8_t video_format : 3; /**< OUT: 0-Component, 1-PAL, 2-NTSC, 3-SECAM, 4-MAC, 5-Unspecified */ + uint8_t video_format : 3; /**< OUT: 0-Component, 1-PAL, 2-NTSC, 3-SECAM, 4-MAC, 5-Unspecified */ uint8_t video_full_range_flag : 1; /**< OUT: indicates the black level and luma and chroma range */ - uint8_t reserved_zero_bits : 4; /**< Reserved bits */ + uint8_t reserved_zero_bits : 4; /**< Reserved bits */ uint8_t color_primaries; /**< OUT: chromaticity coordinates of source primaries */ 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; /****************************************************************/ @@ -121,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; /***************************************************************/ @@ -133,13 +133,13 @@ typedef struct { //! Used in RocdecSourceDataPacket structure /***************************************************************/ typedef enum { - ROCDEC_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */ - ROCDEC_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */ - ROCDEC_PKT_DISCONTINUITY = 0x04, /**< Set when a discontinuity has to be signalled */ - ROCDEC_PKT_ENDOFPICTURE = 0x08, /**< Set when the packet contains exactly one frame or one field */ - ROCDEC_PKT_NOTIFY_EOS = 0x10, /**< If this flag is set along with ROCDEC_PKT_ENDOFSTREAM, an additional (dummy) - display callback will be invoked with null value of ROCDECPARSERDISPINFO which - should be interpreted as end of the stream. */ + ROCDEC_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */ + ROCDEC_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */ + ROCDEC_PKT_DISCONTINUITY = 0x04, /**< Set when a discontinuity has to be signalled */ + ROCDEC_PKT_ENDOFPICTURE = 0x08, /**< Set when the packet contains exactly one frame or one field */ + ROCDEC_PKT_NOTIFY_EOS = 0x10, /**< If this flag is set along with ROCDEC_PKT_ENDOFSTREAM, an additional (dummy) + display callback will be invoked with null value of ROCDECPARSERDISPINFO which + should be interpreted as end of the stream. */ } RocdecVideoPacketFlags; /*****************************************************************************/ @@ -150,25 +150,25 @@ typedef enum { //! IN for rocDecParseVideoData /*****************************************************************************/ typedef struct _RocdecSourceDataPacket { - 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 */ + 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 */ } RocdecSourceDataPacket; /**********************************************************************************/ /*! \brief Timing Info struct - * \ingroup group_rocdec_struct - * \struct RocdecParserDispInfo - * \Used in rocdecParseVideoData API with PFNVIDDISPLAYCALLBACK pfn_display_picture - */ + * \ingroup group_rocdec_struct + * \struct RocdecParserDispInfo + * \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 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 */ } RocdecParserDispInfo; /** @@ -179,9 +179,10 @@ typedef struct _RocdecParserDispInfo { typedef struct _RocdecOperatingPointInfo { rocDecVideoCodec codec; union { - struct { - uint8_t operating_points_cnt; - uint8_t reserved24_bits[3]; + struct + { + uint8_t operating_points_cnt; + uint8_t reserved24_bits[3]; uint16_t operating_points_idc[32]; } av1; uint8_t codec_reserved[1024]; @@ -194,9 +195,9 @@ typedef struct _RocdecOperatingPointInfo { //! 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 */ + uint32_t sei_message_size; /**< OUT: SEI Message Size */ } RocdecSeiMessage; /**********************************************************************************/ @@ -205,19 +206,19 @@ typedef struct _RocdecSeiMessage { //! Used in rocDecParseVideoData API with PFNVIDSEIMSGCALLBACK pfn_get_sei_msg /**********************************************************************************/ typedef struct _RocdecSeiMessageInfo { - 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 */ + 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; /** * @brief Parser callbacks * \ The parser will call these synchronously from within rocDecParseVideoData(), whenever there is sequence change or a picture - * \ is ready to be decoded and/or displayed. + * \ is ready to be decoded and/or displayed. * \ Return values from these callbacks are interpreted as below. If the callbacks return failure, it will be propagated by * \ 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 + * \ 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::max_num_decode_surfaces * \ while creating parser) @@ -225,34 +226,34 @@ typedef struct _RocdecSeiMessageInfo { * \ PFNVIDDISPLAYCALLBACK : 0: fail, >=1: succeeded * \ PFNVIDOPPOINTCALLBACK : <0: fail, >=0: succeeded (bit 0-9: OperatingPoint, bit 10-10: outputAllLayers, bit 11-30: reserved) * \ PFNVIDSEIMSGCALLBACK : 0: fail, >=1: succeeded -*/ -typedef int (ROCDECAPI *PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *); -typedef int (ROCDECAPI *PFNVIDDECODECALLBACK)(void *, RocdecPicParams *); -typedef int (ROCDECAPI *PFNVIDDISPLAYCALLBACK)(void *, RocdecParserDispInfo *); -//typedef int (ROCDECAPI *PFNVIDOPPOINTCALLBACK)(void *, RocdecOperatingPointInfo*); // reserved for future (AV1 specific) -typedef int (ROCDECAPI *PFNVIDSEIMSGCALLBACK) (void *, RocdecSeiMessageInfo *); + */ +typedef int(ROCDECAPI *PFNVIDSEQUENCECALLBACK)(void *, RocdecVideoFormat *); +typedef int(ROCDECAPI *PFNVIDDECODECALLBACK)(void *, RocdecPicParams *); +typedef int(ROCDECAPI *PFNVIDDISPLAYCALLBACK)(void *, RocdecParserDispInfo *); +// typedef int (ROCDECAPI *PFNVIDOPPOINTCALLBACK)(void *, RocdecOperatingPointInfo*); // reserved for future (AV1 specific) +typedef int(ROCDECAPI *PFNVIDSEIMSGCALLBACK)(void *, RocdecSeiMessageInfo *); /** * \brief The AMD rocDecode library. * \ingroup group_rocdec_struct * \Used in rocDecCreateVideoParser API -*/ + */ typedef struct _RocdecParserParams { - 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 */ + 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; /************************************************************************************************/ @@ -265,8 +266,8 @@ extern rocDecStatus ROCDECAPI rocDecCreateVideoParser(RocdecVideoParser *parser_ /************************************************************************************************/ //! \ingroup group_rocparser //! \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 +//! Parse the video data from source data packet in pPacket +//! Extracts parameter sets like SPS, PPS, bitstream etc. from pPacket and //! 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