* rocDecode/Perf: Improved the accuracy of decode performance measurement for the performance sample. We need to wait for the decode completion of the last picture before sampling the end time. (#425)

Этот коммит содержится в:
jeffqjiangNew
2024-09-25 21:27:49 -04:00
коммит произвёл GitHub
родитель 0ba9992247
Коммит 7ef4e29262
3 изменённых файлов: 21 добавлений и 3 удалений
+9
Просмотреть файл
@@ -643,6 +643,7 @@ int RocVideoDecoder::HandlePictureDecode(RocdecPicParams *pPicParams) {
}
pic_num_in_dec_order_[pPicParams->curr_pic_idx] = decode_poc_++;
ROCDEC_API_CALL(rocDecDecodeFrame(roc_decoder_, pPicParams));
last_decode_surf_idx_ = pPicParams->curr_pic_idx;
decoded_pic_cnt_++;
if (b_force_zero_latency_ && ((!pPicParams->field_pic_flag) || (pPicParams->second_field))) {
RocdecParserDispInfo disp_info;
@@ -1189,3 +1190,11 @@ bool RocVideoDecoder::CodecSupported(int device_id, rocDecVideoCodec codec_id, u
}
return true;
}
void RocVideoDecoder::WaitForDecodeCompletion() {
RocdecDecodeStatus dec_status;
memset(&dec_status, 0, sizeof(dec_status));
do {
rocDecStatus result = rocDecGetDecodeStatus(roc_decoder_, last_decode_surf_idx_, &dec_status);
} while (dec_status.decode_status == rocDecodeStatus_InProgress);
}
+6 -1
Просмотреть файл
@@ -336,7 +336,7 @@ class RocVideoDecoder {
/**
* @brief Helper funtion to close a existing file and dump to new file in case of multiple files using same decoder
*/
void ResetSaveFrameToFile();
void ResetSaveFrameToFile();
/**
* @brief Helper function to start MD5 calculation
@@ -366,6 +366,10 @@ class RocVideoDecoder {
*/
int32_t GetNumOfFlushedFrames() { return num_frames_flushed_during_reconfig_;}
/*! \brief Function to wait for the decode completion of the last submitted picture
*/
void WaitForDecodeCompletion();
// Session overhead refers to decoder initialization and deinitialization time
void AddDecoderSessionOverHead(std::thread::id session_id, double duration) { session_overhead_[session_id] += duration; }
double GetDecoderSessionOverHead(std::thread::id session_id) {
@@ -480,6 +484,7 @@ class RocVideoDecoder {
int decoded_pic_cnt_ = 0;
int decode_poc_ = 0, pic_num_in_dec_order_[MAX_FRAME_NUM];
int num_alloced_frames_ = 0;
int last_decode_surf_idx_ = 0;
std::ostringstream input_video_info_str_;
int bitdepth_minus_8_ = 0;
uint32_t byte_per_pixel_ = 1;