From 8898af78a6a0d2bb6070e5d2f6f4a2397ff645a1 Mon Sep 17 00:00:00 2001 From: Aryan Salmanpour Date: Mon, 27 Nov 2023 12:33:28 -0500 Subject: [PATCH] D not fuse - zwhen runnnin gthesmake test. Don't force b_force_latency ofr Perf/Fork sample (#85) --- samples/CMakeLists.txt | 2 +- samples/videoDecodeFork/videodecodefork.cpp | 20 ++++++++++++++------ samples/videoDecodePerf/videodecodeperf.cpp | 13 +++++++++++-- utils/rocvideodecode/roc_video_dec.h | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index c524ac736b..f899ebd3c5 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -33,5 +33,5 @@ add_test( "${CMAKE_CURRENT_BINARY_DIR}/videoDecode" --build-generator "${CMAKE_GENERATOR}" --test-command "videodecode" - -i ${CMAKE_SOURCE_DIR}/data/videos/AMD_driving_virtual_20-H265.mp4 -z + -i ${CMAKE_SOURCE_DIR}/data/videos/AMD_driving_virtual_20-H265.mp4 ) \ No newline at end of file diff --git a/samples/videoDecodeFork/videodecodefork.cpp b/samples/videoDecodeFork/videodecodefork.cpp index 52f6ab0de5..2ba8e971e5 100644 --- a/samples/videoDecodeFork/videodecodefork.cpp +++ b/samples/videoDecodeFork/videodecodefork.cpp @@ -56,8 +56,9 @@ void DecProc(RocVideoDecoder *p_dec, VideoDemuxer *demuxer, int *pn_frame) { void ShowHelpAndExit(const char *option = NULL) { std::cout << "Options:" << std::endl << "-i Input File Path - required" << std::endl - << "-t Number of threads (>= 1) - optional; default: 4" << std::endl - << "-d Device ID (>= 0) - optional; default: 0" << std::endl; + << "-f Number of forks (>= 1) - optional; default: 4" << std::endl + << "-d Device ID (>= 0) - optional; default: 0" << std::endl + << "-z force_zero_latency (force_zero_latency, Decoded frames will be flushed out for display immediately); optional;" << std::endl; exit(0); } @@ -68,7 +69,7 @@ int main(int argc, char **argv) { int device_id = 0; Rect *p_crop_rect = nullptr; OutputSurfaceMemoryType mem_type = OUT_SURFACE_MEM_DEV_INTERNAL; // set to internal - + bool b_force_zero_latency = false; // Parse command-line arguments if(argc < 1) { ShowHelpAndExit(); @@ -84,9 +85,9 @@ int main(int argc, char **argv) { input_file_path = argv[i]; continue; } - if (!strcmp(argv[i], "-t")) { + if (!strcmp(argv[i], "-f")) { if (++i == argc) { - ShowHelpAndExit("-t"); + ShowHelpAndExit("-f"); } n_fork = atoi(argv[i]); if (n_fork <= 0) { @@ -104,6 +105,13 @@ int main(int argc, char **argv) { } continue; } + if (!strcmp(argv[i], "-z")) { + if (i == argc) { + ShowHelpAndExit("-z"); + } + b_force_zero_latency = true; + continue; + } ShowHelpAndExit(argv[i]); } @@ -151,7 +159,7 @@ int main(int argc, char **argv) { std::unique_ptr demuxer(new VideoDemuxer(input_file_path.c_str())); rocDecVideoCodec rocdec_codec_id = AVCodec2RocDecVideoCodec(demuxer->GetCodecID()); v_device_id[i] = (i % 2 == 0) ? 0 : sd; - std::unique_ptr dec(new RocVideoDecoder(v_device_id[i], mem_type, rocdec_codec_id, false, true, p_crop_rect)); + std::unique_ptr dec(new RocVideoDecoder(v_device_id[i], mem_type, rocdec_codec_id, false, b_force_zero_latency, p_crop_rect)); v_demuxer.push_back(std::move(demuxer)); v_viddec.push_back(std::move(dec)); } diff --git a/samples/videoDecodePerf/videodecodeperf.cpp b/samples/videoDecodePerf/videodecodeperf.cpp index 8a980dd6ac..551dc58fc5 100644 --- a/samples/videoDecodePerf/videodecodeperf.cpp +++ b/samples/videoDecodePerf/videodecodeperf.cpp @@ -64,7 +64,8 @@ void ShowHelpAndExit(const char *option = NULL) { std::cout << "Options:" << std::endl << "-i Input File Path - required" << std::endl << "-t Number of threads (>= 1) - optional; default: 4" << std::endl - << "-d Device ID (>= 0) - optional; default: 0" << std::endl; + << "-d Device ID (>= 0) - optional; default: 0" << std::endl + << "-z force_zero_latency (force_zero_latency, Decoded frames will be flushed out for display immediately); optional;" << std::endl; exit(0); } @@ -75,6 +76,7 @@ int main(int argc, char **argv) { int n_thread = 4; Rect *p_crop_rect = nullptr; OutputSurfaceMemoryType mem_type = OUT_SURFACE_MEM_DEV_INTERNAL; // set to internal + bool b_force_zero_latency = false; // Parse command-line arguments if(argc < 1) { ShowHelpAndExit(); @@ -110,6 +112,13 @@ int main(int argc, char **argv) { } continue; } + if (!strcmp(argv[i], "-z")) { + if (i == argc) { + ShowHelpAndExit("-z"); + } + b_force_zero_latency = true; + continue; + } ShowHelpAndExit(argv[i]); } @@ -157,7 +166,7 @@ int main(int argc, char **argv) { std::unique_ptr demuxer(new VideoDemuxer(input_file_path.c_str())); rocDecVideoCodec rocdec_codec_id = AVCodec2RocDecVideoCodec(demuxer->GetCodecID()); v_device_id[i] = (i % 2 == 0) ? 0 : sd; - std::unique_ptr dec(new RocVideoDecoder(v_device_id[i], mem_type, rocdec_codec_id, false, true, p_crop_rect)); + std::unique_ptr dec(new RocVideoDecoder(v_device_id[i], mem_type, rocdec_codec_id, false, b_force_zero_latency, p_crop_rect)); v_demuxer.push_back(std::move(demuxer)); v_viddec.push_back(std::move(dec)); } diff --git a/utils/rocvideodecode/roc_video_dec.h b/utils/rocvideodecode/roc_video_dec.h index 37f8dd4fda..2b6b643458 100644 --- a/utils/rocvideodecode/roc_video_dec.h +++ b/utils/rocvideodecode/roc_video_dec.h @@ -342,7 +342,7 @@ class RocVideoDecoder { OutputSurfaceMemoryType out_mem_type_ = OUT_SURFACE_MEM_DEV_INTERNAL; bool b_extract_sei_message_ = false; bool b_low_latency_ = true; - bool b_force_zero_latency_ = true; + bool b_force_zero_latency_ = false; //bool b_device_frame_pitched_ = true; hipDeviceProp_t hip_dev_prop_; hipStream_t hip_stream_;