Add support for the rocDecUnMapVideoFrame API (#58)

Este commit está contenido en:
Aryan Salmanpour
2023-11-13 12:54:32 -05:00
cometido por GitHub
padre ddded3a6d2
commit eb5614d250
Se han modificado 5 ficheros con 18 adiciones y 15 borrados
+3 -3
Ver fichero
@@ -878,10 +878,10 @@ extern rocDecStatus ROCDECAPI rocDecMapVideoFrame(rocDecDecoderHandle hDecoder,
RocdecProcParams *pVidPostprocParams);
/*****************************************************************************************************/
//! \fn rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, void *pMappedDevPtr)
//! Unmap a previously mapped video frame with the associated mapped raw pointer (pMappedDevPtr)
//! \fn rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, int nPicIdx)
//! Unmap a previously mapped video frame with the associated nPicIdx
/*****************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, void *pMappedDevPtr);
extern rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, int nPicIdx);
#ifdef __cplusplus
}
+8 -4
Ver fichero
@@ -123,10 +123,14 @@ rocDecStatus RocDecoder::mapVideoFrame(int pic_idx, void *dev_mem_ptr[3],
return rocdec_status;
}
rocDecStatus RocDecoder::unMapVideoFrame(void *pMappedDevPtr) {
// todo:: return appropriate decStatus
// Unmap a previously mapped video frame with the associated mapped raw pointer (pMappedDevPtr)
return ROCDEC_NOT_IMPLEMENTED;
rocDecStatus RocDecoder::unMapVideoFrame(int pic_idx) {
if (pic_idx >= hip_ext_mem_.size()) {
return ROCDEC_INVALID_PARAMETER;
}
CHECK_HIP(hipDestroyExternalMemory(hip_ext_mem_[pic_idx]));
return ROCDEC_SUCCESS;
}
+1 -1
Ver fichero
@@ -51,7 +51,7 @@ public:
rocDecStatus getDecodeStatus(int nPicIdx, RocdecDecodeStatus* pDecodeStatus);
rocDecStatus reconfigureDecoder(RocdecReconfigureDecoderInfo *pDecReconfigParams);
rocDecStatus mapVideoFrame(int pic_idx, void *dev_mem_ptr[3], unsigned int horizontal_pitch[3], RocdecProcParams *vid_postproc_params);
rocDecStatus unMapVideoFrame(void *pMappedDevPtr);
rocDecStatus unMapVideoFrame(int pic_idx);
private:
rocDecStatus InitHIP(int device_id);
+4 -4
Ver fichero
@@ -180,15 +180,15 @@ rocDecMapVideoFrame(rocDecDecoderHandle hDecoder, int nPicIdx,
}
/*****************************************************************************************************/
//! \fn rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, void *pMappedDevPtr)
//! Unmap a previously mapped video frame with the associated mapped raw pointer (pMappedDevPtr)
//! \fn rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, int nPicIdx)
//! Unmap a previously mapped video frame with the associated nPicIdx
/*****************************************************************************************************/
rocDecStatus ROCDECAPI
rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, void *pMappedDevPtr) {
rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, int pic_idx) {
auto handle = static_cast<DecHandle *> (hDecoder);
rocDecStatus ret;
try {
ret = handle->roc_decoder->unMapVideoFrame(pMappedDevPtr);
ret = handle->roc_decoder->unMapVideoFrame(pic_idx);
}
catch(const std::exception& e) {
handle->capture_error(e.what());
+2 -3
Ver fichero
@@ -471,7 +471,6 @@ int RocVideoDecoder::HandlePictureDisplay(RocdecParserDispInfo *pDispInfo) {
void * src_dev_ptr[3] = { 0 };
uint32_t src_pitch[3] = { 0 };
ROCDEC_API_CALL(rocDecMapVideoFrame(roc_decoder_, pDispInfo->picture_index, src_dev_ptr, src_pitch, &video_proc_params));
RocdecDecodeStatus dec_status;
memset(&dec_status, 0, sizeof(dec_status));
rocDecStatus result = rocDecGetDecodeStatus(roc_decoder_, pDispInfo->picture_index, &dec_status);
@@ -552,7 +551,7 @@ int RocVideoDecoder::HandlePictureDisplay(RocdecParserDispInfo *pDispInfo) {
}
HIP_API_CALL(hipStreamSynchronize(hip_stream_));
ROCDEC_API_CALL(rocDecUnMapVideoFrame(roc_decoder_, src_dev_ptr[0]));
ROCDEC_API_CALL(rocDecUnMapVideoFrame(roc_decoder_, pDispInfo->picture_index));
}
return 1;
@@ -647,7 +646,7 @@ bool RocVideoDecoder::ReleaseFrame(int64_t pTimestamp) {
std::cerr << "Decoded Frame is released out of order" << std::endl;
return false;
}
ROCDEC_API_CALL(rocDecUnMapVideoFrame(roc_decoder_, mapped_frame_ptr));
ROCDEC_API_CALL(rocDecUnMapVideoFrame(roc_decoder_, fb->picture_index));
// pop decoded frame
vp_frames_q_.pop();
}