rename roDecMapVideoFrame to rocDecoGetVideoFrame and some other minor code cleanups (#222)

[ROCm/rocdecode commit: 38f50a1a10]
This commit is contained in:
Aryan Salmanpour
2024-02-06 11:38:54 -05:00
committed by GitHub
parent 18f165e424
commit c7f7a7c0e8
6 changed files with 134 additions and 200 deletions
@@ -93,7 +93,7 @@ rocDecStatus RocDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo *reconf
}
rocDecStatus rocdec_status;
for (int pic_idx = 0; pic_idx < hip_interop_.size(); pic_idx++) {
rocdec_status = UnMapVideoFrame(pic_idx);
rocdec_status = ReleaseVideoFrame(pic_idx);
if (rocdec_status != ROCDEC_SUCCESS) {
ERR("ERROR: Unmapping the video frame for picture idx " + TOSTR(pic_idx) + " failed during reconfiguration!");
return rocdec_status;
@@ -107,7 +107,7 @@ rocDecStatus RocDecoder::ReconfigureDecoder(RocdecReconfigureDecoderInfo *reconf
return rocdec_status;
}
rocDecStatus RocDecoder::MapVideoFrame(int pic_idx, void *dev_mem_ptr[3], uint32_t horizontal_pitch[3], RocdecProcParams *vid_postproc_params) {
rocDecStatus RocDecoder::GetVideoFrame(int pic_idx, void *dev_mem_ptr[3], uint32_t horizontal_pitch[3], RocdecProcParams *vid_postproc_params) {
if (pic_idx >= hip_interop_.size() || &dev_mem_ptr[0] == nullptr || vid_postproc_params == nullptr) {
return ROCDEC_INVALID_PARAMETER;
}
@@ -172,7 +172,7 @@ rocDecStatus RocDecoder::MapVideoFrame(int pic_idx, void *dev_mem_ptr[3], uint32
return rocdec_status;
}
rocDecStatus RocDecoder::UnMapVideoFrame(int pic_idx) {
rocDecStatus RocDecoder::ReleaseVideoFrame(int pic_idx) {
if (pic_idx >= hip_interop_.size()) {
return ROCDEC_INVALID_PARAMETER;
}
@@ -60,11 +60,11 @@ public:
rocDecStatus DecodeFrame(RocdecPicParams *pic_params);
rocDecStatus GetDecodeStatus(int pic_idx, RocdecDecodeStatus* decode_status);
rocDecStatus ReconfigureDecoder(RocdecReconfigureDecoderInfo *reconfig_params);
rocDecStatus MapVideoFrame(int pic_idx, void *dev_mem_ptr[3], uint32_t horizontal_pitch[3], RocdecProcParams *vid_postproc_params);
rocDecStatus UnMapVideoFrame(int pic_idx);
rocDecStatus GetVideoFrame(int pic_idx, void *dev_mem_ptr[3], uint32_t horizontal_pitch[3], RocdecProcParams *vid_postproc_params);
private:
rocDecStatus InitHIP(int device_id);
rocDecStatus ReleaseVideoFrame(int pic_idx);
int num_devices_;
RocDecoderCreateInfo decoder_create_info_;
VaapiVideoDecoder va_video_decoder_;
@@ -169,13 +169,13 @@ rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDe
}
/************************************************************************************************************************/
//! \fn rocDecStatus ROCDECAPI rocDecMapVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx, unsigned int *dev_mem_ptr,
//! \fn rocDecStatus ROCDECAPI rocDecGetVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx, unsigned int *dev_mem_ptr,
//! unsigned int *horizontal_pitch, RocdecProcParams *vid_postproc_params);
//! Post-process and map video frame corresponding to pic_idx for use in HIP. Returns HIP device pointer and associated
//! pitch(horizontal stride) of the video frame. Returns device memory pointers for each plane (Y, U and V) seperately
/************************************************************************************************************************/
rocDecStatus ROCDECAPI
rocDecMapVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx,
rocDecGetVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx,
void *dev_mem_ptr[3], uint32_t (&horizontal_pitch)[3], RocdecProcParams *vid_postproc_params) {
if (decoder_handle == nullptr || dev_mem_ptr == nullptr || horizontal_pitch == nullptr || vid_postproc_params == nullptr) {
return ROCDEC_INVALID_PARAMETER;
@@ -183,29 +183,7 @@ rocDecMapVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx,
auto handle = static_cast<DecHandle *>(decoder_handle);
rocDecStatus ret;
try {
ret = handle->roc_decoder_->MapVideoFrame(pic_idx, dev_mem_ptr, horizontal_pitch, vid_postproc_params);
}
catch(const std::exception& e) {
handle->CaptureError(e.what());
ERR(e.what())
return ROCDEC_RUNTIME_ERROR;
}
return ret;
}
/*****************************************************************************************************/
//! \fn rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx)
//! Unmap a previously mapped video frame with the associated pic_idx
/*****************************************************************************************************/
rocDecStatus ROCDECAPI
rocDecUnMapVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx) {
if (decoder_handle == nullptr) {
return ROCDEC_INVALID_PARAMETER;
}
auto handle = static_cast<DecHandle *>(decoder_handle);
rocDecStatus ret;
try {
ret = handle->roc_decoder_->UnMapVideoFrame(pic_idx);
ret = handle->roc_decoder_->GetVideoFrame(pic_idx, dev_mem_ptr, horizontal_pitch, vid_postproc_params);
}
catch(const std::exception& e) {
handle->CaptureError(e.what());