* * rocDecode: Core test updates.
 - Added VP9 test.
 - Added tests for video decode raw sample.
 - Changed test video streams to raw elementary or IVF formats.

* * rocDecode/CTest: Added back mp4 files.

* * rocDecode/CTest: Minor changes based on review comments.

* * rocDecode/CTest: Added stream file installation.

* * rocDecode/CTest: Changed the file back to mp4.

* Add support for VP9 handling in the videoDecodeBatch sample

* add linking with threads for videodecode app

---------

Co-authored-by: Aryan Salmanpour <aryan.salmanpour@amd.com>
Этот коммит содержится в:
jeffqjiangNew
2024-12-06 14:46:30 -05:00
коммит произвёл GitHub
родитель 91ab3b1577
Коммит 597b29a7c9
11 изменённых файлов: 147 добавлений и 55 удалений
+1
Просмотреть файл
@@ -8,6 +8,7 @@ Full documentation for rocDecode is available at [https://rocm.docs.amd.com/proj
* The new bitstream reader feature. The bitstream reader contains a few built-in stream file parsers, including elementary stream file parser and IVF container file parser. Currently the reader can parse AVC, HEVC and AV1 elementary stream files and AV1 IVF container files. More format support will be added in the future.
* A new sample app, called videodecoderaw which uses the bitstream reader instead of FFMPEG demuxer to get picture data.
* More CTests: VP9 test and tests on video decode raw sample.
### Changed
+2 -1
Просмотреть файл
@@ -173,6 +173,7 @@ if(HIP_FOUND AND Libva_FOUND)
install(DIRECTORY utils/rocvideodecode DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
install(DIRECTORY utils/ffmpegvideodecode DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
install(FILES samples/videoDecode/CMakeLists.txt samples/videoDecode/README.md samples/videoDecode/videodecode.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecode COMPONENT dev)
install(FILES samples/videoDecodeRaw/CMakeLists.txt samples/videoDecodeRaw/README.md samples/videoDecodeRaw/videodecoderaw.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/samples/videoDecodeRaw COMPONENT dev)
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)
@@ -185,7 +186,7 @@ if(HIP_FOUND AND Libva_FOUND)
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 utils/video_post_process.h DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/utils COMPONENT dev)
install(FILES data/videos/AMD_driving_virtual_20-H265.mp4 data/videos/AMD_driving_virtual_20-H264.mp4 data/videos/AMD_driving_virtual_20-AV1.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-H265.265 data/videos/AMD_driving_virtual_20-H264.mp4 data/videos/AMD_driving_virtual_20-H264.264 data/videos/AMD_driving_virtual_20-AV1.mp4 data/videos/AMD_driving_virtual_20-AV1.ivf data/videos/AMD_driving_virtual_20-VP9.ivf 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)
+1
Просмотреть файл
@@ -13,6 +13,7 @@ access the video decoding features available on your GPU.
* H.265 (HEVC) - 8 bit, and 10 bit
* H.264 (AVC) - 8 bit
* AV1 - 8 bit, and 10 bit
* VP9 - 8 bit, and 10 bit
## Prerequisites
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
+1
Просмотреть файл
@@ -11,6 +11,7 @@ rocDecode supports the following codecs:
* H.265 (HEVC): 8 bit and 10 bit
* H.264 (AVC): 8 bit
* AV1: 8 bit and 10 bit
* VP9: 8 bit and 10 bit
The following table shows the codec support and capabilities of the VCN for each supported GPU
architecture:
+8 -1
Просмотреть файл
@@ -63,8 +63,9 @@ endif()
find_package(HIP QUIET)
find_package(FFmpeg QUIET)
find_package(rocDecode QUIET)
find_package(Threads REQUIRED)
if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND)
if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND Threads_FOUND)
# HIP
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::host)
# FFMPEG
@@ -74,6 +75,9 @@ if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND)
# rocDecode and utils
include_directories (${ROCDECODE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../../utils ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/rocvideodecode ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/ffmpegvideodecode)
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${ROCDECODE_LIBRARY})
# threads
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} Threads::Threads)
# sample app exe
list(APPEND SOURCES ${PROJECT_SOURCE_DIR} videodecode.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/rocvideodecode/roc_video_dec.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/ffmpegvideodecode/ffmpeg_video_dec.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
@@ -96,4 +100,7 @@ else()
if (NOT ROCDECODE_FOUND)
message(FATAL_ERROR "-- ERROR!: rocDecode Not Found! - please install rocDecode!")
endif()
if (NOT Threads_FOUND)
message(FATAL_ERROR "-- ERROR!: Threads Not Found! - please insatll Threads!")
endif()
endif()
+31 -3
Просмотреть файл
@@ -307,7 +307,7 @@ int main(int argc, char **argv) {
std::cout << "info: Number of threads: " << n_thread << std::endl;
std::vector<std::unique_ptr<VideoDemuxer>> v_demuxer(num_files);
std::unique_ptr<RocVideoDecoder> dec_8bit_avc(nullptr), dec_8bit_hevc(nullptr), dec_10bit_hevc(nullptr), dec_8bit_av1(nullptr), dec_10bit_av1(nullptr);
std::unique_ptr<RocVideoDecoder> dec_8bit_avc(nullptr), dec_8bit_hevc(nullptr), dec_10bit_hevc(nullptr), dec_8bit_av1(nullptr), dec_10bit_av1(nullptr), dec_8bit_vp9(nullptr), dec_10bit_vp9(nullptr);
std::vector<std::unique_ptr<DecoderInfo>> v_dec_info;
ThreadPool thread_pool(n_thread);
@@ -359,6 +359,12 @@ int main(int argc, char **argv) {
} else if (v_dec_info[i]->rocdec_codec_id == rocDecVideoCodec_AV1) {
std::unique_ptr<RocVideoDecoder> dec_8bit_av1(new RocVideoDecoder(v_dec_info[i]->dec_device_id, mem_type, v_dec_info[i]->rocdec_codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[i]->viddec = std::move(dec_8bit_av1);
} else if (v_dec_info[i]->rocdec_codec_id == rocDecVideoCodec_VP9) {
std::unique_ptr<RocVideoDecoder> dec_8bit_vp9(new RocVideoDecoder(v_dec_info[i]->dec_device_id, mem_type, v_dec_info[i]->rocdec_codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[i]->viddec = std::move(dec_8bit_vp9);
} else {
ERR("ERROR: codec type is not supported!");
return -1;
}
} else { //bit depth = 10bit
if (v_dec_info[i]->rocdec_codec_id == rocDecVideoCodec_HEVC) {
@@ -367,6 +373,12 @@ int main(int argc, char **argv) {
} else if (v_dec_info[i]->rocdec_codec_id == rocDecVideoCodec_AV1) {
std::unique_ptr<RocVideoDecoder> dec_10bit_av1(new RocVideoDecoder(v_dec_info[i]->dec_device_id, mem_type, v_dec_info[i]->rocdec_codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[i]->viddec = std::move(dec_10bit_av1);
} else if (v_dec_info[i]->rocdec_codec_id == rocDecVideoCodec_VP9) {
std::unique_ptr<RocVideoDecoder> dec_10bit_vp9(new RocVideoDecoder(v_dec_info[i]->dec_device_id, mem_type, v_dec_info[i]->rocdec_codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[i]->viddec = std::move(dec_10bit_vp9);
} else {
ERR("ERROR: codec type is not supported!");
return -1;
}
}
@@ -399,13 +411,21 @@ int main(int argc, char **argv) {
} else if (dec_8bit_av1 == nullptr && codec_id == rocDecVideoCodec_AV1) {
std::unique_ptr<RocVideoDecoder> dec_8bit_av1(new RocVideoDecoder(v_dec_info[thread_idx]->dec_device_id, mem_type, codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[thread_idx]->viddec = std::move(dec_8bit_av1);
} else if (dec_8bit_av1 == nullptr && codec_id == rocDecVideoCodec_VP9) {
std::unique_ptr<RocVideoDecoder> dec_8bit_vp9(new RocVideoDecoder(v_dec_info[thread_idx]->dec_device_id, mem_type, codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[thread_idx]->viddec = std::move(dec_8bit_vp9);
} else {
if (codec_id == rocDecVideoCodec_AVC) {
v_dec_info[thread_idx]->viddec.swap(dec_8bit_avc);
} else if (codec_id == rocDecVideoCodec_HEVC) {
v_dec_info[thread_idx]->viddec.swap(dec_8bit_hevc);
} else {
} else if (codec_id == rocDecVideoCodec_AV1) {
v_dec_info[thread_idx]->viddec.swap(dec_8bit_av1);
} else if (codec_id == rocDecVideoCodec_VP9) {
v_dec_info[thread_idx]->viddec.swap(dec_8bit_vp9);
} else {
ERR("ERROR: codec type is not supported!");
return -1;
}
}
v_dec_info[thread_idx]->bit_depth = bit_depth;
@@ -417,11 +437,19 @@ int main(int argc, char **argv) {
} else if (dec_10bit_av1 == nullptr && codec_id == rocDecVideoCodec_AV1) {
std::unique_ptr<RocVideoDecoder> dec_10bit_av1(new RocVideoDecoder(v_dec_info[thread_idx]->dec_device_id, mem_type, codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[thread_idx]->viddec = std::move(dec_10bit_av1);
} else if (dec_10bit_vp9 == nullptr && codec_id == rocDecVideoCodec_VP9) {
std::unique_ptr<RocVideoDecoder> dec_10bit_vp9(new RocVideoDecoder(v_dec_info[thread_idx]->dec_device_id, mem_type, codec_id, b_force_zero_latency, p_crop_rect, b_extract_sei_messages, disp_delay));
v_dec_info[thread_idx]->viddec = std::move(dec_10bit_vp9);
} else {
if (codec_id == rocDecVideoCodec_HEVC) {
v_dec_info[thread_idx]->viddec.swap(dec_10bit_hevc);
} else {
} else if (codec_id == rocDecVideoCodec_AV1) {
v_dec_info[thread_idx]->viddec.swap(dec_10bit_av1);
} else if (codec_id == rocDecVideoCodec_VP9) {
v_dec_info[thread_idx]->viddec.swap(dec_10bit_vp9);
} else {
ERR("ERROR: codec type is not supported!");
return -1;
}
}
v_dec_info[thread_idx]->bit_depth = bit_depth;
+103 -50
Просмотреть файл
@@ -56,10 +56,10 @@ if(NOT ROCDECODE_FOUND)
message("-- ${Yellow}${PROJECT_NAME} requires rocDecode. Install rocDecode before running CTests")
endif()
# 1 - videoDecode
# 1 - videoDecode HEVC
add_test(
NAME
video_decode-H265
video_decode-HEVC
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecode"
@@ -69,49 +69,10 @@ add_test(
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4
)
# 2 - videoDecodeMem
# 2 - videoDecode AVC
add_test(
NAME
video_decodeMem-H265
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeMem"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodeMem"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecodemem"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4
)
# 3 - videoDecodePerf
add_test(
NAME
video_decodePerf-H265
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodePerf"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodePerf"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecodeperf"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4
)
# 4 - videoDecodeRGB
add_test(
NAME
video_decodeRGB-H265
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeRGB"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodeRGB"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecodergb"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4 -of rgb
)
# 5 - videoDecode H264
add_test(
NAME
video_decode-H264
video_decode-AVC
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecode"
@@ -121,6 +82,45 @@ add_test(
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H264.mp4
)
# 3 - videoDecode AV1
add_test(
NAME
video_decode-AV1
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-AV1.mp4
)
# 4 - videoDecode VP9
add_test(
NAME
video_decode-VP9
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-VP9.ivf
)
# 5 - videoDecodePerf
add_test(
NAME
video_decodePerf-HEVC
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodePerf"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodePerf"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecodeperf"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4
)
# 6 - videoDecodeBatch
add_test(
NAME
@@ -134,15 +134,68 @@ add_test(
-i ${ROCM_PATH}/share/rocdecode/video/ -t 2
)
# 7 - videoDecode AV1
# 7 - videoDecodeRGB
add_test(
NAME
video_decode-AV1
video_decodeRGB-HEVC
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecode"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecode"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeRGB"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodeRGB"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecode"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-AV1.mp4
)
--test-command "videodecodergb"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4 -of rgb
)
# 8 - videoDecodeMem
add_test(
NAME
video_decodeMem-HEVC
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeMem"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodeMem"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecodemem"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4
)
# 9 - videoDecodeRaw HEVC
add_test(
NAME
video_decodeRaw-HEVC
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeRaw"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodeRaw"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecoderaw"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.265
)
# 10 - videoDecodeRaw AVC
add_test(
NAME
video_decodeRaw-AVC
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeRaw"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodeRaw"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecoderaw"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H264.264
)
# 3 - videoDecodeRaw AV1
add_test(
NAME
video_decodeRaw-AV1
COMMAND
"${CMAKE_CTEST_COMMAND}"
--build-and-test "${ROCM_PATH}/share/rocdecode/samples/videoDecodeRaw"
"${CMAKE_CURRENT_BINARY_DIR}/videoDecodeRaw"
--build-generator "${CMAKE_GENERATOR}"
--test-command "videodecoderaw"
-i ${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-AV1.ivf
)