From 2d877cd35798a06b7d2b40e00cfc00199cc1644e Mon Sep 17 00:00:00 2001 From: Aryan Salmanpour Date: Thu, 4 Apr 2024 19:47:35 -0400 Subject: [PATCH] Enable decoding AVC (H.264) codec by default and enable CTest for it (#309) --- CMakeLists.txt | 3 ++- src/parser/rocparser_api.cpp | 5 ++--- test/CMakeLists.txt | 28 +++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc7b9f80a9..98fca738cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,13 +137,14 @@ if(HIP_FOUND AND Libva_FOUND) install(FILES samples/videoDecodeMem/CMakeLists.txt samples/videoDecodeMem/README.md samples/videoDecodeMem/videodecodemem.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeMem COMPONENT dev) install(FILES samples/videoDecodePerf/CMakeLists.txt samples/videoDecodePerf/README.md samples/videoDecodePerf/videodecodeperf.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodePerf COMPONENT dev) install(FILES samples/videoDecodeRGB/CMakeLists.txt samples/videoDecodeRGB/README.md samples/videoDecodeRGB/videodecrgb.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeRGB COMPONENT dev) + install(FILES samples/videoDecodeBatch/CMakeLists.txt samples/videoDecodeBatch/README.md samples/videoDecodeBatch/videodecodebatch.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeBatch COMPONENT dev) install(FILES samples/common.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples COMPONENT dev) install(FILES utils/video_demuxer.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev) install(FILES utils/colorspace_kernels.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev) install(FILES utils/colorspace_kernels.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev) install(FILES utils/resize_kernels.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev) install(FILES utils/resize_kernels.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev) - install(FILES data/videos/AMD_driving_virtual_20-H265.mp4 DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/video COMPONENT dev) + install(FILES data/videos/AMD_driving_virtual_20-H265.mp4 data/videos/AMD_driving_virtual_20-H264.mp4 DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/video COMPONENT dev) # install license information - {ROCM_PATH}/share/doc/rocdecode set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT runtime) diff --git a/src/parser/rocparser_api.cpp b/src/parser/rocparser_api.cpp index 010b30c4fa..825f9bf11c 100644 --- a/src/parser/rocparser_api.cpp +++ b/src/parser/rocparser_api.cpp @@ -34,12 +34,11 @@ rocDecCreateVideoParser(RocdecVideoParser *parser_handle, RocdecParserParams *pa return ROCDEC_INVALID_PARAMETER; } - const char *is_avc_enabled = std::getenv("ROCDECODE_ENABLE_AVC"); const char *is_av1_enabled = std::getenv("ROCDECODE_ENABLE_AV1"); if (parser_params->codec_type != rocDecVideoCodec_HEVC && - (parser_params->codec_type == rocDecVideoCodec_AVC && (is_avc_enabled == nullptr || std::string(is_avc_enabled) != "1")) && + parser_params->codec_type != rocDecVideoCodec_AVC && (parser_params->codec_type == rocDecVideoCodec_AV1 && (is_av1_enabled == nullptr || std::string(is_av1_enabled) != "1"))) { - ERR("The current version of rocDecode officially supports only the H.265 (HEVC) codec."); + ERR("The current version of rocDecode officially supports only the H.265 (HEVC) and H.264 (AVC) codec."); return ROCDEC_NOT_IMPLEMENTED; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a4e801f651..7dd3de8ad5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -100,4 +100,30 @@ add_test( --build-generator "${CMAKE_GENERATOR}" --test-command "videodecodergb" -i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4 -of rgb -) \ No newline at end of file +) + +# videoDecode H264 +add_test( + NAME + video_decode-H264 + COMMAND + "${CMAKE_CTEST_COMMAND}" + --build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecode" + "${CMAKE_CURRENT_BINARY_DIR}/videoDecode" + --build-generator "${CMAKE_GENERATOR}" + --test-command "videodecode" + -i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H264.mp4 +) + +# videoDecodeBatch +add_test( + NAME + video_decodeBatch + COMMAND + "${CMAKE_CTEST_COMMAND}" + --build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeBatch" + "${CMAKE_CURRENT_BINARY_DIR}/videoDecodeBatch" + --build-generator "${CMAKE_GENERATOR}" + --test-command "videodecodebatch" + -i ${ROCM_PATH}/share/rocdecode/video/ -t 2 +)