Added initial code for VP9 support. (#442)
* * rocDecode/VP9: Initial code for VP9. - Added structures for VA-API. - Added defines for uncompressed header and parsing functions. * * rocDecode/VP9: Added decode frame call to VA-API. * * rocDecode/VP9: Added new sequence notification function. * * rocDecode/VP9: Intra decode started to work. * * rocDecode/VP9: Minor changes based on review comments. --------- Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com>
Dieser Commit ist enthalten in:
+242
-4
@@ -394,7 +394,7 @@ typedef struct _RocdecVc1PicParams {
|
||||
} RocdecVc1PicParams;
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecAvcPicParams placeholder
|
||||
//! \struct RocdecAvcPicParams
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! AVC picture parameters
|
||||
//! This structure is used in RocdecAvcPicParams structure
|
||||
@@ -454,7 +454,7 @@ typedef struct _RocdecAvcPicParams {
|
||||
} RocdecAvcPicParams;
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecAvcSliceParams placeholder
|
||||
//! \struct RocdecAvcSliceParams
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! AVC slice parameter buffer
|
||||
//! This structure is configured to be the same as VA-API VASliceParameterBufferH264 structure
|
||||
@@ -504,7 +504,7 @@ typedef struct _RocdecAvcSliceParams {
|
||||
} RocdecAvcSliceParams;
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecAvcIQMatrix placeholder
|
||||
//! \struct RocdecAvcIQMatrix
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! AVC Inverse Quantization Matrix
|
||||
//! This structure is configured to be the same as VA-API VAIQMatrixBufferH264 structure
|
||||
@@ -776,6 +776,242 @@ typedef struct _RocdecHevcIQMatrix {
|
||||
uint32_t reserved[4];
|
||||
} RocdecHevcIQMatrix;
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecVp9PicParams
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! VP9 picture parameters
|
||||
//! This structure is configured to be the same as VA-API VADecPictureParameterBufferVP9 structure.
|
||||
/***********************************************************/
|
||||
typedef struct _RocdecVp9PicParams {
|
||||
/** \brief picture width
|
||||
* Picture original resolution. The value may not be multiple of 8.
|
||||
*/
|
||||
uint16_t frame_width;
|
||||
/** \brief picture height
|
||||
* Picture original resolution. The value may not be multiple of 8.
|
||||
*/
|
||||
uint16_t frame_height;
|
||||
|
||||
/** \brief Surface indices of reference frames in DPB.
|
||||
*
|
||||
* Each entry of the list specifies the surface index of the picture
|
||||
* that is referred by current picture or will be referred by any future
|
||||
* picture.
|
||||
* Application who calls this API should update this list based on the
|
||||
* refreshing information from VP9 bitstream.
|
||||
*/
|
||||
uint32_t reference_frames[8];
|
||||
|
||||
union {
|
||||
struct {
|
||||
/** \brief flags for current picture
|
||||
* same syntax and semantic as those in VP9 code
|
||||
*/
|
||||
uint32_t subsampling_x : 1;
|
||||
uint32_t subsampling_y : 1;
|
||||
uint32_t frame_type : 1;
|
||||
uint32_t show_frame : 1;
|
||||
uint32_t error_resilient_mode : 1;
|
||||
uint32_t intra_only : 1;
|
||||
uint32_t allow_high_precision_mv : 1;
|
||||
uint32_t mcomp_filter_type : 3;
|
||||
uint32_t frame_parallel_decoding_mode : 1;
|
||||
uint32_t reset_frame_context : 2;
|
||||
uint32_t refresh_frame_context : 1;
|
||||
uint32_t frame_context_idx : 2;
|
||||
uint32_t segmentation_enabled : 1;
|
||||
|
||||
/** \brief corresponds to variable temporal_update in VP9 code.
|
||||
*/
|
||||
uint32_t segmentation_temporal_update : 1;
|
||||
/** \brief corresponds to variable update_mb_segmentation_map
|
||||
* in VP9 code.
|
||||
*/
|
||||
uint32_t segmentation_update_map : 1;
|
||||
|
||||
/** \brief Index of reference_frames[] and points to the
|
||||
* LAST reference frame.
|
||||
* It corresponds to active_ref_idx[0] in VP9 code.
|
||||
*/
|
||||
uint32_t last_ref_frame : 3;
|
||||
/** \brief Sign Bias of the LAST reference frame.
|
||||
* It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
|
||||
*/
|
||||
uint32_t last_ref_frame_sign_bias : 1;
|
||||
/** \brief Index of reference_frames[] and points to the
|
||||
* GOLDERN reference frame.
|
||||
* It corresponds to active_ref_idx[1] in VP9 code.
|
||||
*/
|
||||
uint32_t golden_ref_frame : 3;
|
||||
/** \brief Sign Bias of the GOLDERN reference frame.
|
||||
* Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
|
||||
*/
|
||||
uint32_t golden_ref_frame_sign_bias : 1;
|
||||
/** \brief Index of reference_frames[] and points to the
|
||||
* ALTERNATE reference frame.
|
||||
* Corresponds to active_ref_idx[2] in VP9 code.
|
||||
*/
|
||||
uint32_t alt_ref_frame : 3;
|
||||
/** \brief Sign Bias of the ALTERNATE reference frame.
|
||||
* Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
|
||||
*/
|
||||
uint32_t alt_ref_frame_sign_bias : 1;
|
||||
/** \brief Lossless Mode
|
||||
* LosslessFlag = base_qindex == 0 &&
|
||||
* y_dc_delta_q == 0 &&
|
||||
* uv_dc_delta_q == 0 &&
|
||||
* uv_ac_delta_q == 0;
|
||||
* Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
|
||||
* are all variables in VP9 code.
|
||||
*/
|
||||
uint32_t lossless_flag : 1;
|
||||
} bits;
|
||||
uint32_t value;
|
||||
} pic_fields;
|
||||
|
||||
/* following parameters have same syntax with those in VP9 code */
|
||||
uint8_t filter_level;
|
||||
uint8_t sharpness_level;
|
||||
|
||||
/** \brief number of tile rows specified by (1 << log2_tile_rows).
|
||||
* It corresponds the variable with same name in VP9 code.
|
||||
*/
|
||||
uint8_t log2_tile_rows;
|
||||
/** \brief number of tile columns specified by (1 << log2_tile_columns).
|
||||
* It corresponds the variable with same name in VP9 code.
|
||||
*/
|
||||
uint8_t log2_tile_columns;
|
||||
/** \brief Number of bytes taken up by the uncompressed frame header,
|
||||
* which corresponds to byte length of function
|
||||
* read_uncompressed_header() in VP9 code.
|
||||
* Specifically, it is the byte count from bit stream buffer start to
|
||||
* the last byte of uncompressed frame header.
|
||||
* If there are other meta data in the buffer before uncompressed header,
|
||||
* its size should be also included here.
|
||||
*/
|
||||
uint8_t frame_header_length_in_bytes;
|
||||
|
||||
/** \brief The byte count of compressed header the bitstream buffer,
|
||||
* which corresponds to syntax first_partition_size in code.
|
||||
*/
|
||||
uint16_t first_partition_size;
|
||||
|
||||
/** These values are segment probabilities with same names in VP9
|
||||
* function setup_segmentation(). They should be parsed directly from
|
||||
* bitstream by application.
|
||||
*/
|
||||
uint8_t mb_segment_tree_probs[7];
|
||||
uint8_t segment_pred_probs[3];
|
||||
|
||||
/** \brief VP9 Profile definition
|
||||
* value range [0..3].
|
||||
*/
|
||||
uint8_t profile;
|
||||
|
||||
/** \brief VP9 bit depth per sample
|
||||
* same for both luma and chroma samples.
|
||||
*/
|
||||
uint8_t bit_depth;
|
||||
|
||||
/** \brief Reserved bytes for future use, must be zero */
|
||||
uint32_t va_reserved[8];
|
||||
|
||||
} RocdecVp9PicParams;
|
||||
|
||||
/**
|
||||
* \brief VP9 Segmentation Parameter Data Structure
|
||||
* This structure is configured to be the same as VA-API VASegmentParameterVP9 structure.
|
||||
*/
|
||||
typedef struct _RocdecVp9SegmentParameter {
|
||||
union {
|
||||
struct {
|
||||
/** \brief Indicates if per segment reference frame indicator
|
||||
* is enabled.
|
||||
* Corresponding to variable feature_enabled when
|
||||
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
|
||||
*/
|
||||
uint16_t segment_reference_enabled : 1;
|
||||
/** \brief Specifies per segment reference indication.
|
||||
* 0: reserved
|
||||
* 1: Last ref
|
||||
* 2: golden
|
||||
* 3: altref
|
||||
* Value can be derived from variable data when
|
||||
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
|
||||
*/
|
||||
uint16_t segment_reference : 2;
|
||||
/** \brief Indicates if per segment skip feature is enabled.
|
||||
* Corresponding to variable feature_enabled when
|
||||
* j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
|
||||
*/
|
||||
uint16_t segment_reference_skipped : 1;
|
||||
} fields;
|
||||
uint16_t value;
|
||||
} segment_flags;
|
||||
|
||||
/** \brief Specifies the filter level information per segment.
|
||||
* The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
|
||||
* where m is [ref], and n is [mode] in FilterLevel[m][n].
|
||||
*/
|
||||
uint8_t filter_level[4][2];
|
||||
/** \brief Specifies per segment Luma AC quantization scale.
|
||||
* Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
|
||||
* function of VP9 code.
|
||||
*/
|
||||
int16_t luma_ac_quant_scale;
|
||||
/** \brief Specifies per segment Luma DC quantization scale.
|
||||
* Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
|
||||
* function of VP9 code.
|
||||
*/
|
||||
int16_t luma_dc_quant_scale;
|
||||
/** \brief Specifies per segment Chroma AC quantization scale.
|
||||
* Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
|
||||
* function of VP9 code.
|
||||
*/
|
||||
int16_t chroma_ac_quant_scale;
|
||||
/** \brief Specifies per segment Chroma DC quantization scale.
|
||||
* Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
|
||||
* function of VP9 code.
|
||||
*/
|
||||
int16_t chroma_dc_quant_scale;
|
||||
|
||||
/** \brief Reserved bytes for future use, must be zero */
|
||||
uint32_t va_reserved[4];
|
||||
|
||||
} RocdecVp9SegmentParameter;
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecVp9SliceParams
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! VP9 slice parameter buffer
|
||||
//! This structure is configured to be the same as VA-API VASliceParameterBufferVP9 structure.
|
||||
/***********************************************************/
|
||||
typedef struct _RocdecVp9SliceParams {
|
||||
/** \brief The byte count of current frame in the bitstream buffer,
|
||||
* starting from first byte of the buffer.
|
||||
* It uses the name slice_data_size to be consitent with other codec,
|
||||
* but actually means frame_data_size.
|
||||
*/
|
||||
uint32_t slice_data_size;
|
||||
/**
|
||||
* offset to the first byte of partition data (control partition)
|
||||
*/
|
||||
uint32_t slice_data_offset;
|
||||
/**
|
||||
* see VA_SLICE_DATA_FLAG_XXX definitions
|
||||
*/
|
||||
uint32_t slice_data_flag;
|
||||
|
||||
/**
|
||||
* \brief per segment information
|
||||
*/
|
||||
RocdecVp9SegmentParameter seg_param[8];
|
||||
|
||||
/** \brief Reserved bytes for future use, must be zero */
|
||||
uint32_t va_reserved[4];
|
||||
|
||||
} RocdecVp9SliceParams;
|
||||
|
||||
/** \brief Segmentation Information for AV1
|
||||
*/
|
||||
typedef struct _RocdecAv1SegmentationStruct {
|
||||
@@ -1320,7 +1556,7 @@ typedef struct _RocdecAV1PicParams {
|
||||
} RocdecAv1PicParams;
|
||||
|
||||
/***********************************************************/
|
||||
//! \struct RocdecAv1SliceParams placeholder
|
||||
//! \struct RocdecAv1SliceParams
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! AV1 slice parameter buffer
|
||||
//! This structure is configured to be the same as VA-API VASliceParameterBufferAV1 structure.
|
||||
@@ -1397,6 +1633,7 @@ typedef struct _RocdecPicParams {
|
||||
RocdecHevcPicParams hevc;
|
||||
RocdecVc1PicParams vc1;
|
||||
RocdecJPEGPicParams jpeg;
|
||||
RocdecVp9PicParams vp9;
|
||||
RocdecAv1PicParams av1;
|
||||
uint32_t codec_reserved[256];
|
||||
} pic_params;
|
||||
@@ -1407,6 +1644,7 @@ typedef struct _RocdecPicParams {
|
||||
// Todo: Add slice params defines for other codecs.
|
||||
RocdecAvcSliceParams *avc;
|
||||
RocdecHevcSliceParams *hevc;
|
||||
RocdecVp9SliceParams *vp9;
|
||||
RocdecAv1SliceParams *av1;
|
||||
} slice_params;
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren