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>
This commit is contained in:
jeffqjiangNew
2024-11-14 10:17:46 -05:00
committed by GitHub
parent b3f8fec41b
commit 3eb6bc2192
8 changed files with 1573 additions and 15 deletions
@@ -150,6 +150,13 @@ rocDecStatus VaapiVideoDecoder::CreateDecoderConfig() {
case rocDecVideoCodec_AVC:
va_profile_ = VAProfileH264Main;
break;
case rocDecVideoCodec_VP9:
if (decoder_create_info_.bit_depth_minus_8 == 0) {
va_profile_ = VAProfileVP9Profile0;
} else if (decoder_create_info_.bit_depth_minus_8 == 2) {
va_profile_ = VAProfileVP9Profile2;
}
break;
case rocDecVideoCodec_AV1:
#if VA_CHECK_VERSION(1,6,0)
va_profile_ = VAProfileAV1Profile0;
@@ -315,6 +322,28 @@ rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) {
}
break;
}
case rocDecVideoCodec_VP9: {
for (int i = 0; i < 8; i++) {
if (pPicParams->pic_params.vp9.reference_frames[i] != 0xFF) {
if (pPicParams->pic_params.vp9.reference_frames[i] >= va_surface_ids_.size()) {
ERR("Reference frame index exceeded the VAAPI surface pool limit.");
return ROCDEC_INVALID_PARAMETER;
}
pPicParams->pic_params.vp9.reference_frames[i] = va_surface_ids_[pPicParams->pic_params.vp9.reference_frames[i]];
}
}
pic_params_ptr = (void*)&pPicParams->pic_params.vp9;
pic_params_size = sizeof(RocdecVp9PicParams);
slice_params_ptr = (void*)pPicParams->slice_params.vp9;
slice_params_size = sizeof(RocdecVp9SliceParams);
if ((pic_params_size != sizeof(VADecPictureParameterBufferVP9)) || (slice_params_size != sizeof(VASliceParameterBufferVP9))) {
ERR("VP9 data_buffer parameter_size not matching vaapi parameter buffer size.");
return ROCDEC_RUNTIME_ERROR;
}
break;
}
case rocDecVideoCodec_AV1: {
pPicParams->pic_params.av1.current_frame = curr_surface_id;