HEVC: Added bit depth change support in decoder reconfiguration. (#527)
* * rocDecode/HEVC: Added bit depth change support in decoder reconfiguration. * * rocDecode/HEVC: Removed a comment line. * * rocDecode/HEVC: Updated change log. * * rocDecode/HEVC: Used the reserved space in RocdecReconfigureDecoderInfo structure for bit_depth_minus_8 field to be backward compatible. Added bit depth to the new sequence file name when we dump output in decoder reconfiguration case. * * rocDecode/HEVC: Added bit depth change support in decoder reconfiguration. * * rocDecode/HEVC: Removed a comment line. * * rocDecode/HEVC: Updated change log. * * rocDecode/HEVC: Used the reserved space in RocdecReconfigureDecoderInfo structure for bit_depth_minus_8 field to be backward compatible. Added bit depth to the new sequence file name when we dump output in decoder reconfiguration case. * * rocDecode/HEVC: Changes based on review comments. * * rocDecode: Fixed a bug related to 422 surface format assignment. * * rocDecode: Fixed build warnings with some sample apps.
This commit is contained in:
@@ -1566,7 +1566,7 @@ ParserResult HevcVideoParser::ParseSliceHeader(uint8_t *nalu, size_t size, HevcS
|
||||
}
|
||||
|
||||
// Check video dimension change
|
||||
if ( pic_width_ != sps_ptr->pic_width_in_luma_samples || pic_height_ != sps_ptr->pic_height_in_luma_samples) {
|
||||
if (pic_width_ != sps_ptr->pic_width_in_luma_samples || pic_height_ != sps_ptr->pic_height_in_luma_samples) {
|
||||
pic_width_ = sps_ptr->pic_width_in_luma_samples;
|
||||
pic_height_ = sps_ptr->pic_height_in_luma_samples;
|
||||
// Take care of the case where a new SPS replaces the old SPS with the same id but with different dimensions
|
||||
@@ -1579,6 +1579,12 @@ ParserResult HevcVideoParser::ParseSliceHeader(uint8_t *nalu, size_t size, HevcS
|
||||
dpb_buffer_.dpb_size = dpb_buffer_.dpb_size > HEVC_MAX_DPB_FRAMES ? HEVC_MAX_DPB_FRAMES : dpb_buffer_.dpb_size;
|
||||
CheckAndAdjustDecBufPoolSize(dpb_buffer_.dpb_size);
|
||||
}
|
||||
// Check bit depth change
|
||||
if (bit_depth_luma_minus8_ != sps_ptr->bit_depth_luma_minus8 || bit_depth_chroma_minus8_ != sps_ptr->bit_depth_chroma_minus8) {
|
||||
bit_depth_luma_minus8_ = sps_ptr->bit_depth_luma_minus8;
|
||||
bit_depth_chroma_minus8_ = sps_ptr->bit_depth_chroma_minus8;
|
||||
new_seq_activated_ = true;
|
||||
}
|
||||
|
||||
// Set frame rate if available
|
||||
if (new_seq_activated_) {
|
||||
|
||||
@@ -26,6 +26,8 @@ RocVideoParser::RocVideoParser() {
|
||||
pic_count_ = 0;
|
||||
pic_width_ = 0;
|
||||
pic_height_ = 0;
|
||||
bit_depth_luma_minus8_ = 0;
|
||||
bit_depth_chroma_minus8_ = 0;
|
||||
new_seq_activated_ = false;
|
||||
frame_rate_.numerator = 0;
|
||||
frame_rate_.denominator = 0;
|
||||
|
||||
@@ -138,6 +138,8 @@ protected:
|
||||
uint32_t pic_count_; // decoded picture count for the current bitstream
|
||||
uint32_t pic_width_;
|
||||
uint32_t pic_height_;
|
||||
uint32_t bit_depth_luma_minus8_;
|
||||
uint32_t bit_depth_chroma_minus8_;
|
||||
bool new_seq_activated_;
|
||||
|
||||
// Decoded buffer pool
|
||||
|
||||
@@ -340,6 +340,11 @@ rocDecStatus VaapiVideoDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo
|
||||
}
|
||||
CHECK_VAAPI(vaDestroySurfaces(va_display_, va_surface_ids_.data(), va_surface_ids_.size()));
|
||||
CHECK_VAAPI(vaDestroyContext(va_display_, va_context_id_));
|
||||
// Need to re-create VA config if bit deepth changes
|
||||
bool create_va_config = decoder_create_info_.bit_depth_minus_8 != reconfig_params->bit_depth_minus_8 ? true : false;
|
||||
if (create_va_config) {
|
||||
CHECK_VAAPI(vaDestroyConfig(va_display_, va_config_id_));
|
||||
}
|
||||
|
||||
va_surface_ids_.clear();
|
||||
decoder_create_info_.width = reconfig_params->width;
|
||||
@@ -347,8 +352,17 @@ rocDecStatus VaapiVideoDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo
|
||||
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;
|
||||
decoder_create_info_.bit_depth_minus_8 = reconfig_params->bit_depth_minus_8;
|
||||
|
||||
rocDecStatus rocdec_status = CreateSurfaces();
|
||||
rocDecStatus rocdec_status;
|
||||
if (create_va_config) {
|
||||
rocdec_status = CreateDecoderConfig();
|
||||
if (rocdec_status != ROCDEC_SUCCESS) {
|
||||
ERR("Failed to create a VAAPI decoder configuration.");
|
||||
return rocdec_status;
|
||||
}
|
||||
}
|
||||
rocdec_status = CreateSurfaces();
|
||||
if (rocdec_status != ROCDEC_SUCCESS) {
|
||||
ERR("Failed to create VAAPI surfaces during the decoder reconfiguration.");
|
||||
return rocdec_status;
|
||||
|
||||
Reference in New Issue
Block a user