From c47b6d821b45afbc93f27ff314704982aeb02f83 Mon Sep 17 00:00:00 2001 From: Maxime Gervais Date: Sat, 13 Dec 2025 01:53:07 +0100 Subject: [PATCH] Check for HW accelerated encoding and decoding Signed-off-by: Maxime Gervais --- .github/workflows/RAWcoocked_Checks.yml | 14 ++-- Project/GNU/CLI/Makefile.am | 2 +- Project/GNU/CLI/test/vulkan.sh | 85 +++++++++++++++++++++++++ Project/GNU/CLI/test/vulkan.txt | 30 +++++++++ 4 files changed, 123 insertions(+), 8 deletions(-) create mode 100755 Project/GNU/CLI/test/vulkan.sh create mode 100644 Project/GNU/CLI/test/vulkan.txt diff --git a/.github/workflows/RAWcoocked_Checks.yml b/.github/workflows/RAWcoocked_Checks.yml index 610f53cc..29a6c762 100644 --- a/.github/workflows/RAWcoocked_Checks.yml +++ b/.github/workflows/RAWcoocked_Checks.yml @@ -16,19 +16,19 @@ jobs: with: fetch-depth: 1 - name: OS packets - run: | + run: | if [ "$RUNNER_OS" == "Linux" ]; then echo "deb https://mediaarea.net/repo/deb/ubuntu $(lsb_release --codename --short)-snapshots main" | sudo tee /etc/apt/sources.list.d/mediaarea-snapshots.list sudo curl https://repo.mediaarea.net/deb/ubuntu/keyring.gpg -o /etc/apt/trusted.gpg.d/mediaarea-snapshots.gpg sudo apt-get update - sudo apt-get install -y valgrind ffmpeg-ma + sudo apt-get install -y nasm valgrind ffmpeg-ma mesa-vulkan-drivers libvulkan1 vulkan-tools vulkan-validationlayers fi if [ "$RUNNER_OS" == "macOS" ]; then brew update brew install coreutils automake fi - name: FFmpeg - run: | + run: | cd Project/GNU/CLI if [ "$RUNNER_OS" == "Linux" ]; then cp /usr/bin/ffmpeg-ma ffmpeg @@ -38,19 +38,19 @@ jobs: 7za e FFmpeg_Bin_Latest_Mac_Static_x64.zip bin/ffmpeg fi - name: Configure - run: | + run: | cd Project/GNU/CLI sh autogen.sh ./configure - name: Compile - run: | + run: | cd Project/GNU/CLI make - name: Check files - run: | + run: | cd Project/GNU/CLI make clone_testing_files - name: Check - run: | + run: | cd Project/GNU/CLI make check diff --git a/Project/GNU/CLI/Makefile.am b/Project/GNU/CLI/Makefile.am index 7b8a36f7..cad1f033 100644 --- a/Project/GNU/CLI/Makefile.am +++ b/Project/GNU/CLI/Makefile.am @@ -76,7 +76,7 @@ man1_MANS = ../../../Source/CLI/rawcooked.1 AM_TESTS_FD_REDIRECT = 9>&2 -TESTS = test/test1.sh test/test1b.sh test/test2.sh test/test3.sh test/avi.sh test/pcm.sh test/reversibilityfile.sh test/paddingbits.sh test/check.sh test/legacy.sh test/multiple.sh test/valgrind.sh test/overwrite.sh test/increasingdigitcount.sh test/gaps.sh test/slices.sh test/framerate.sh test/hash.sh test/notfound.sh test/version.sh +TESTS = test/test1.sh test/test1b.sh test/test2.sh test/test3.sh test/vulkan.sh test/avi.sh test/pcm.sh test/reversibilityfile.sh test/paddingbits.sh test/check.sh test/legacy.sh test/multiple.sh test/valgrind.sh test/overwrite.sh test/increasingdigitcount.sh test/gaps.sh test/slices.sh test/framerate.sh test/hash.sh test/notfound.sh test/version.sh TESTING_DIR = test/TestingFiles diff --git a/Project/GNU/CLI/test/vulkan.sh b/Project/GNU/CLI/test/vulkan.sh new file mode 100755 index 00000000..bd546885 --- /dev/null +++ b/Project/GNU/CLI/test/vulkan.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +script_path="${PWD}/test" +. ${script_path}/helpers.sh + +# test disabled on macOS and Windows +if [[ "${OSTYPE}" == "darwin"* ]] || [ -n "${WSL}" ] ; then + exit 77 +fi + +while read line ; do + file="$(basename "$(echo "${line}" | cut -d' ' -f1)")" + path="$(dirname "$(echo "${line}" | cut -d' ' -f1)")" + want="$(echo "${line}" | cut -d' ' -f2)" + test=$(basename "${path}") + + if [ ! -e "${files_path}/${path}/${file}" ] ; then + echo "NOK: ${test}/${file}, file not found" >&${fd} + status=1 + continue + fi + + pushd "${files_path}/${path}" >/dev/null 2>&1 + if [[ ${file} == *".exr" ]]; then + encode_extra="--check" + fi + run_rawcooked -y --conch --encode --file ${encode_extra} -d "${file}" + + # check expected result + if [ "${want}" == "fail" ] ; then + if check_failure "file rejected at input" "file accepted at input" ; then + echo "OK: ${test}/${file}, file rejected at input" >&${fd} + fi + continue + else + check_success "file rejected at input" "file accepted at input" || continue + fi + + if [ ! -e "${file}.rawcooked_reversibility_data" ] ; then + echo "NOK: ${test}/${file}, reversibility_data is missing" >&${fd} + status=1 + clean + continue + fi + source_warnings=$(echo "${cmd_stderr}" | grep "Warning: ") + + # check result file generation + for variant in swdpx hwdpx ; do + test="$(basename "${path}") (${variant})" + + cmd_stdout="${cmd_stdout/-xerror/-xerror -init_hw_device vulkan=vk:0,debug=0}" + if [ "${variant}" == "hwdpx" ] ; then + cmd_stdout="${cmd_stdout/-xerror/-xerror -hwaccel vulkan -hwaccel_output_format vulkan}" + fi + cmd_stdout="${cmd_stdout/-c:v ffv1/-vf hwupload -c:v ffv1_vulkan}" + cmd_stdout="${cmd_stdout/-context 1/}" + run_ffmpeg "${cmd_stdout}" + + if [ ! -e "${file}.mkv" ] ; then + echo "NOK: ${test}/${file}, mkv not generated" >&${fd} + status=1 + continue + fi + + # check decoding + run_rawcooked -y --conch --decode "${file}.mkv" + if ! check_success "mkv decoding failed" "mkv decoded" ; then + rm -f "${file}.mkv" + continue + fi + + decoded_warnings=$(echo "${cmd_stderr}" | grep "Warning: ") + if [ "${source_warnings}" != "${decoded_warnings}" ] ; then + echo "NOK: ${test}/${file}, warnings differs between the source and the decoded files" >&${fd} + status=1 + rm -fr "${file}.mkv" "${file}.mkv.RAWcooked" + continue + fi + check_files "${file}" "${file}.mkv.RAWcooked/${file}" + done + clean + popd >/dev/null 2>&1 +done < "${script_path}/vulkan.txt" + +exit ${status} diff --git a/Project/GNU/CLI/test/vulkan.txt b/Project/GNU/CLI/test/vulkan.txt new file mode 100644 index 00000000..8179b229 --- /dev/null +++ b/Project/GNU/CLI/test/vulkan.txt @@ -0,0 +1,30 @@ +Formats/DPX/Flavors/RGBA_10_FilledA_BE/10bit_a.dpx pass +Formats/DPX/Flavors/RGBA_10_FilledA_BE/checkerboard_1080p_nuke_bigendian_10bit_alpha.dpx pass +Formats/DPX/Flavors/RGBA_10_FilledA_BE/converted_image_gets_skewed.dpx fail +Formats/DPX/Flavors/RGBA_10_FilledA_LE/checkerboard_1080p_nuke_littleendian_10bit_alpha.dpx pass +Formats/DPX/Flavors/RGBA_12_FilledA_BE/checkerboard_1080p_nuke_bigendian_12bit_alpha.dpx pass +Formats/DPX/Flavors/RGBA_12_FilledA_LE/checkerboard_1080p_nuke_littleendian_12bit_alpha.dpx pass +Formats/DPX/Flavors/RGBA_12_Packed_BE/12bit_a.dpx pass +Formats/DPX/Flavors/RGBA_16_FilledA_BE/checkerboard_1080p_nuke_bigendian_16bit_alpha.dpx pass +Formats/DPX/Flavors/RGBA_16_FilledA_BE/uncropped_DPX_4K_16bit_Overscan15pros.CutFrom3640to128Height.dpx pass +Formats/DPX/Flavors/RGBA_16_FilledA_LE/checkerboard_1080p_nuke_littleendian_16bit_alpha.dpx pass +Formats/DPX/Flavors/RGBA_16_Packed_BE/16bit_a.dpx pass +Formats/DPX/Flavors/RGB_10_FilledA_BE/10bit.dpx pass +Formats/DPX/Flavors/RGB_10_FilledA_BE/checkerboard_1080p_nuke_bigendian_10bit_noalpha.dpx pass +Formats/DPX/Flavors/RGB_10_FilledA_LE/checkerboard_1080p_nuke_littleendian_10bit_noalpha.dpx pass +Formats/DPX/Flavors/RGB_10_FilledA_LE/image090003.dpx pass +Formats/DPX/Flavors/RGB_12_FilledA_BE/checkerboard_1080p_nuke_bigendian_12bit_noalpha.dpx pass +Formats/DPX/Flavors/RGB_12_FilledA_LE/checkerboard_1080p_nuke_littleendian_12bit_noalpha.dpx pass +Formats/DPX/Flavors/RGB_12_Packed_BE/12bit.dpx pass +Formats/DPX/Flavors/RGB_12_Packed_BE/af093_ifa2006350_10000086400.dpx pass +Formats/DPX/Flavors/RGB_12_Packed_BE/RGB_12_bit.dpx pass +Formats/DPX/Flavors/RGB_12_Packed_BE/086449_modified_4300x64_orientation0.dpx pass +Formats/DPX/Flavors/RGB_12_Packed_BE/Width_2488.dpx pass +Formats/DPX/Flavors/RGB_16_FilledA_BE/checkerboard_1080p_nuke_bigendian_16bit_noalpha.dpx pass +Formats/DPX/Flavors/RGB_16_FilledA_LE/checkerboard_1080p_nuke_littleendian_16bit_noalpha.dpx pass +Formats/DPX/Flavors/RGB_16_Packed_BE/16bit.dpx pass +Formats/DPX/Flavors/RGB_16_Packed_BE/058142ce-aeb9-4f5c-b3c7-7590f09c757d_00090000.dpx pass +Formats/DPX/Flavors/RGB_16_Packed_BE/RGB_16_bit.dpx pass +Formats/DPX/Flavors/RGB_16_Packed_LE/Dufay_000001.dpx pass +Formats/DPX/Flavors/Y_16_FilledA_BE/0000001.dpx pass +Formats/DPX/Flavors/Y_16_Packed_BE/pack3.dpx pass