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]
Este commit está contenido en:
jeffqjiangNew
2024-05-31 13:14:02 -04:00
cometido por GitHub
padre 4a6e9d709b
commit 3230cca447
Se han modificado 11 ficheros con 418 adiciones y 179 borrados
+11 -11
Ver fichero
@@ -98,6 +98,7 @@ protected:
*/
typedef struct {
int pic_idx; // picture index or id
int dec_buf_idx; // frame index in decode buffer pool
// POC info
int32_t pic_order_cnt; // PicOrderCnt
int32_t prev_poc_lsb; // prevPicOrderCntLsb
@@ -107,7 +108,7 @@ protected:
uint32_t pic_output_flag; // PicOutputFlag
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
} HevcPicInfo;
/*! \brief Decoded picture buffer
@@ -118,9 +119,6 @@ protected:
uint32_t num_pics_needed_for_output; // number of pictures in DPB that need to be output
uint32_t dpb_fullness; // number of pictures in DPB
HevcPicInfo frame_buffer_list[HEVC_MAX_DPB_FRAMES];
uint32_t num_output_pics; // number of pictures that are output after the decode call
uint32_t output_pic_list[HEVC_MAX_DPB_FRAMES]; // sorted output picuture index to frame_buffer_list[]
} DecodedPictureBuffer;
// Data members of HEVC class
@@ -308,11 +306,16 @@ protected:
*/
int MarkOutputPictures();
/*! \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 and mark it. Additional picture
* bumping is done if needed. C.5.2.3.
* \return Code in ParserResult form.
* \return <tt>ParserResult</tt>
*/
int FindFreeBufAndMark();
ParserResult FindFreeInDpbAndMark();
/*! \brief Function to bump one picture out of DPB. C.5.2.4.
* \return Code in ParserResult form.
@@ -333,6 +336,8 @@ protected:
void PrintSliceSegHeader(HevcSliceSegHeader *slice_header_ptr);
void PrintStRps(HevcShortTermRps *rps_ptr);
void PrintLtRefInfo(HevcLongTermRps *lt_info_ptr);
void PrintDpb();
void PrintVappiBufInfo();
#endif // DBGINFO
private:
@@ -349,11 +354,6 @@ private:
*/
int SendPicForDecode();
/*! \brief Callback function to output decoded pictures from DPB for post-processing.
* \return Return code in ParserResult form
*/
int OutputDecodedPictures();
bool IsIdrPic(HevcNalUnitHeader *nal_header_ptr);
bool IsCraPic(HevcNalUnitHeader *nal_header_ptr);
bool IsBlaPic(HevcNalUnitHeader *nal_header_ptr);