rocDecode: Added decode buffer pool implementation for AVC and HEVC. (#355)
* * rocDecode: Initial check in for decode buffer pool.
* * rocDecode: All 135 streams pass.
* * rocDecode: Fixed a build error in debug mode.
* * rocDecode/HEVC: Removed two workaround in HEVC DPB management, after decode buffer pool implementa
tion.
- WR 1: Conditional bumping (when max_num_reorder_pics > 0) to avoid synchronous job submission in
C.5.2.3.
- WR 2: Add two more buffers in DPB to avoid buffer over-writing.
* * rocDecode/HEVC: Added display delay feature.
* * rocDecode/HEVC: Fixed the -z option issue within the context of the new decode buffer pool implementation.
* * rocDecode/HEVC: Removed redundent code.
* * rocDecode/AVC: Added decode buffer pool implementation for AVC.
* * rocDecode: Added a few changes.
- Added display delay feature to AVC.
- Removed a workaround for AVC: AVC_MAX_DPB_FRAMES was increased to 18. Now it is back to 16.
- Removed a workaround for AVC: increased DPB buffer size by 2. Now it is back to normal.
- Code format changes for HEVC.
* * rocDecode/AVC: Fixed the -z option issue within the context of the new decode buffer pool implementation.
* * rocDecode: Merged OutputDecodedPictures() method to upper class RocVideoParser.
* * rocDecode: Code cleanup. No functional changes.
* * rocDecode: Made decode buffer pool size adaptive.
- Removed the hard coded decode buffer pool size set in the decoder.
- Exposed the display delay parameter from RocVideoDecoder class to the user.
- Now the decoder buffer pool size is determined from the DPB buffer size and display delay parameter.
* * rocDecode: Several changes based on code review.
- Merged decode and display use status into one parameter.
- Removed the surface index from DecodeFrameBuffer, which is now implicitly referred by the array index.
- Changed a function name for better clarity.
* * rocDecode: Added a comment.
[ROCm/rocdecode commit: 61c8661b9c]
Αυτή η υποβολή περιλαμβάνεται σε:
@@ -57,16 +57,65 @@ rocDecStatus RocVideoParser::Initialize(RocdecParserParams *pParams) {
|
||||
return ROCDEC_NOT_INITIALIZED;
|
||||
}
|
||||
// Initialize callback function pointers
|
||||
pfn_sequece_cb_ = pParams->pfn_sequence_callback; /**< Called before decoding frames and/or whenever there is a fmt change */
|
||||
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 */
|
||||
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;
|
||||
|
||||
dec_buf_pool_size_ = parser_params_.max_num_decode_surfaces;
|
||||
decode_buffer_pool_.resize(dec_buf_pool_size_, {0});
|
||||
output_pic_list_.resize(dec_buf_pool_size_, 0xFF);
|
||||
InitDecBufPool();
|
||||
|
||||
return ROCDEC_SUCCESS;
|
||||
}
|
||||
|
||||
void RocVideoParser::InitDecBufPool() {
|
||||
for (int i = 0; i < dec_buf_pool_size_; i++) {
|
||||
decode_buffer_pool_[i].use_status = kNotUsed;
|
||||
decode_buffer_pool_[i].pic_order_cnt = 0;
|
||||
output_pic_list_[i] = 0xFF;
|
||||
}
|
||||
num_output_pics_ = 0;
|
||||
}
|
||||
|
||||
void RocVideoParser::CheckAndAdjustDecBufPoolSize(int dpb_size) {
|
||||
int min_dec_buf_pool_size = dpb_size + (parser_params_.max_display_delay > DECODE_BUF_POOL_EXTENSION ? parser_params_.max_display_delay : DECODE_BUF_POOL_EXTENSION);
|
||||
if ( dec_buf_pool_size_ < min_dec_buf_pool_size) {
|
||||
dec_buf_pool_size_ = min_dec_buf_pool_size;
|
||||
decode_buffer_pool_.resize(dec_buf_pool_size_, {0});
|
||||
output_pic_list_.resize(dec_buf_pool_size_, 0xFF);
|
||||
InitDecBufPool();
|
||||
}
|
||||
}
|
||||
|
||||
ParserResult RocVideoParser::OutputDecodedPictures(bool no_delay) {
|
||||
RocdecParserDispInfo disp_info = {0};
|
||||
disp_info.progressive_frame = 1; // not used
|
||||
disp_info.top_field_first = 1; // not used
|
||||
|
||||
int disp_delay = no_delay ? 0 : parser_params_.max_display_delay;
|
||||
if (num_output_pics_ > disp_delay) {
|
||||
int num_disp = num_output_pics_ - disp_delay;
|
||||
for (int i = 0; i < num_disp; i++) {
|
||||
disp_info.picture_index = output_pic_list_[i];
|
||||
pfn_display_picture_cb_(parser_params_.user_data, &disp_info);
|
||||
decode_buffer_pool_[output_pic_list_[i]].use_status &= ~kFrameUsedForDisplay;
|
||||
}
|
||||
|
||||
num_output_pics_ = disp_delay;
|
||||
// Shift the remaining frames to the top
|
||||
if (num_output_pics_) {
|
||||
for (int i = 0; i < num_output_pics_; i++) {
|
||||
output_pic_list_[i] = output_pic_list_[i + num_disp];
|
||||
}
|
||||
}
|
||||
}
|
||||
return PARSER_OK;
|
||||
}
|
||||
|
||||
ParserResult RocVideoParser::GetNalUnit() {
|
||||
bool start_code_found = false;
|
||||
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user