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:
@@ -23,9 +23,9 @@ THE SOFTWARE.
|
||||
#include "roc_video_dec.h"
|
||||
|
||||
RocVideoDecoder::RocVideoDecoder(int device_id, OutputSurfaceMemoryType out_mem_type, rocDecVideoCodec codec, bool force_zero_latency,
|
||||
const Rect *p_crop_rect, bool extract_user_sei_Message, int max_width, int max_height, uint32_t clk_rate) :
|
||||
const Rect *p_crop_rect, bool extract_user_sei_Message, uint32_t disp_delay, int max_width, int max_height, uint32_t clk_rate) :
|
||||
device_id_{device_id}, out_mem_type_(out_mem_type), codec_id_(codec), b_force_zero_latency_(force_zero_latency),
|
||||
b_extract_sei_message_(extract_user_sei_Message), max_width_ (max_width), max_height_(max_height) {
|
||||
b_extract_sei_message_(extract_user_sei_Message), disp_delay_(disp_delay), max_width_ (max_width), max_height_(max_height) {
|
||||
|
||||
if (!InitHIP(device_id_)) {
|
||||
THROW("Failed to initilize the HIP");
|
||||
@@ -39,9 +39,9 @@ RocVideoDecoder::RocVideoDecoder(int device_id, OutputSurfaceMemoryType out_mem_
|
||||
// create rocdec videoparser
|
||||
RocdecParserParams parser_params = {};
|
||||
parser_params.codec_type = codec_id_;
|
||||
parser_params.max_num_decode_surfaces = 1;
|
||||
parser_params.max_num_decode_surfaces = 1; // let the parser to determine the decode buffer pool size
|
||||
parser_params.clock_rate = clk_rate;
|
||||
parser_params.max_display_delay = 0;
|
||||
parser_params.max_display_delay = disp_delay_;
|
||||
parser_params.user_data = this;
|
||||
parser_params.pfn_sequence_callback = HandleVideoSequenceProc;
|
||||
parser_params.pfn_decode_picture = HandlePictureDecodeProc;
|
||||
|
||||
@@ -50,7 +50,8 @@ extern "C" {
|
||||
* \brief AMD The rocDecode video decoder for AMD’s GPUs.
|
||||
*/
|
||||
|
||||
#define MAX_FRAME_NUM 16
|
||||
#define MAX_FRAME_NUM 16
|
||||
|
||||
typedef int (ROCDECAPI *PFNRECONFIGUEFLUSHCALLBACK)(void *, uint32_t, void *);
|
||||
|
||||
typedef enum SeiAvcHevcPayloadType_enum {
|
||||
@@ -177,7 +178,7 @@ class RocVideoDecoder {
|
||||
* @param force_zero_latency
|
||||
*/
|
||||
RocVideoDecoder(int device_id, OutputSurfaceMemoryType out_mem_type, rocDecVideoCodec codec, bool force_zero_latency = false,
|
||||
const Rect *p_crop_rect = nullptr, bool extract_user_SEI_Message = false, int max_width = 0, int max_height = 0,
|
||||
const Rect *p_crop_rect = nullptr, bool extract_user_SEI_Message = false, uint32_t disp_delay = 0, int max_width = 0, int max_height = 0,
|
||||
uint32_t clk_rate = 1000);
|
||||
~RocVideoDecoder();
|
||||
|
||||
@@ -426,6 +427,7 @@ class RocVideoDecoder {
|
||||
OutputSurfaceMemoryType out_mem_type_ = OUT_SURFACE_MEM_DEV_INTERNAL;
|
||||
bool b_extract_sei_message_ = false;
|
||||
bool b_force_zero_latency_ = false;
|
||||
uint32_t disp_delay_;
|
||||
ReconfigParams *p_reconfig_params_ = nullptr;
|
||||
int32_t num_frames_flushed_during_reconfig_ = 0;
|
||||
hipDeviceProp_t hip_dev_prop_;
|
||||
|
||||
Reference in New Issue
Block a user