Updated videoDecodePerf Sample with host backend (#635)
* set min: number of decoded surfaces to non-zero value for ffmpeg based decoding * added host decoding option to videodecode perf app * fix GetOutputSurfaceInfo() for FFMpeg * updated chagelog * added host decoding option to videodecode perf app * fix GetOutputSurfaceInfo() for FFMpeg * updated chagelog * removed GPU device info printing for HOST backend * fix for review comment
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
154f4cd465
Коммит
eeecc3e8c8
@@ -45,11 +45,16 @@ static inline float GetChromaWidthFactor(rocDecVideoSurfaceFormat surface_format
|
||||
|
||||
FFMpegVideoDecoder::FFMpegVideoDecoder(int device_id, OutputSurfaceMemoryType out_mem_type, rocDecVideoCodec codec, bool force_zero_latency,
|
||||
const Rect *p_crop_rect, bool extract_user_sei_Message, uint32_t disp_delay, int max_width, int max_height, uint32_t clk_rate) :
|
||||
RocVideoDecoder(device_id, out_mem_type, codec, force_zero_latency, p_crop_rect, extract_user_sei_Message, disp_delay, max_width, max_height, clk_rate) {
|
||||
RocVideoDecoder(device_id, out_mem_type, codec, force_zero_latency, p_crop_rect, extract_user_sei_Message, disp_delay, max_width, max_height, clk_rate, true) {
|
||||
|
||||
if ((out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL) || (out_mem_type_ == OUT_SURFACE_MEM_NOT_MAPPED)) {
|
||||
ROCDEC_THROW("Unsupported output memory type", ROCDEC_INVALID_PARAMETER);
|
||||
}
|
||||
if (out_mem_type_ == OUT_SURFACE_MEM_DEV_COPIED) {
|
||||
if (!InitHIP(device_id_)) {
|
||||
ROCDEC_THROW("Failed to initilize the HIP", ROCDEC_DEVICE_INVALID);
|
||||
}
|
||||
}
|
||||
// many of the decoder parameters are hardcoded below for just creating the decoder.
|
||||
// In the handlevideosequence callback, the decoder will get reconfigured to the actual parameters in the sequence header
|
||||
RocDecoderHostCreateInfo create_info = {};
|
||||
@@ -74,7 +79,19 @@ FFMpegVideoDecoder::FFMpegVideoDecoder(int device_id, OutputSurfaceMemoryType ou
|
||||
create_info.pfn_display_picture = FFMpegHandlePictureDisplayProc;
|
||||
create_info.pfn_get_sei_msg = nullptr; // tobe supported in future
|
||||
ROCDEC_API_CALL(rocDecCreateDecoderHost(&roc_decoder_, &create_info));
|
||||
|
||||
// set disp_width and height to non_zero values for it doesn't trigger decoding error before actual start of decoding
|
||||
disp_width_ = max_width;
|
||||
disp_height_ = max_height;
|
||||
// fill output_surface_info_
|
||||
output_surface_info_.output_width = max_width;
|
||||
output_surface_info_.output_height = max_height;
|
||||
output_surface_info_.output_pitch = max_width * 2; // bytes_per_pixel 2
|
||||
output_surface_info_.output_vstride = max_height;
|
||||
output_surface_info_.bit_depth = bitdepth_minus_8_ + 8;
|
||||
output_surface_info_.bytes_per_pixel = 2;
|
||||
output_surface_info_.surface_format = rocDecVideoSurfaceFormat_P016;
|
||||
output_surface_info_.num_chroma_planes = 2;
|
||||
output_surface_info_.mem_type = OUT_SURFACE_MEM_HOST_COPIED;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +218,15 @@ int FFMpegVideoDecoder::HandleVideoSequence(RocdecVideoFormatHost *format_host)
|
||||
return num_decode_surfaces;
|
||||
}
|
||||
|
||||
bool FFMpegVideoDecoder::GetOutputSurfaceInfo(OutputSurfaceInfo **surface_info) {
|
||||
if (!disp_width_ || !disp_height_) {
|
||||
std::cerr << "ERROR: FFMpegVideo is not intialized" << std::endl;
|
||||
return false;
|
||||
}
|
||||
*surface_info = &output_surface_info_;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief function to reconfigure decoder if there is a change in sequence params.
|
||||
*
|
||||
|
||||
Ссылка в новой задаче
Block a user