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]
This commit is contained in:
jeffqjiangNew
2024-05-31 13:14:02 -04:00
committed by GitHub
parent 4a6e9d709b
commit 3230cca447
11 changed files with 418 additions and 179 deletions
+8 -6
View File
@@ -60,6 +60,7 @@ public:
typedef struct {
int pic_idx; // picture index or id
int dec_buf_idx; // frame index in decode buffer pool
PictureStructure pic_structure;
int32_t pic_order_cnt;
int32_t top_field_order_cnt;
@@ -70,7 +71,7 @@ public:
int32_t long_term_pic_num; // LongTermPicNum
uint32_t long_term_frame_idx; // LongTermFrameIdx: long term reference frame/field identifier
uint32_t is_reference;
uint32_t use_status; // 0 = empty; 1 = top used; 2 = bottom used; 3 = both fields or frame used
uint32_t use_status; // refer to FrameBufUseStatus
uint32_t pic_output_flag; // OutputFlag
} AvcPicture;
@@ -134,6 +135,7 @@ protected:
uint32_t field_pic_count_;
int second_field_;
int first_field_pic_idx_;
int first_field_dec_buf_idx_;
// DPB
AvcPicture curr_pic_;
@@ -150,11 +152,6 @@ protected:
*/
ParserResult SendPicForDecode();
/*! \brief Function to output decoded pictures from DPB for post-processing.
* \return Return code in ParserResult form
*/
ParserResult OutputDecodedPictures();
/*! \brief Callback function to send parsed SEI playload to decoder.
*/
void SendSeiMsgPayload();
@@ -263,6 +260,11 @@ protected:
*/
ParserResult CheckDpbAndOutput();
/*! \brief Function to find a free buffer in the decode buffer pool
* \return <tt>ParserResult</tt>
*/
ParserResult FindFreeInDecBufPool();
/*! \brief Function to find a free buffer in DPB for the current picture
* \return <tt>ParserResult</tt>
*/