138 lines
2.1 KiB
Bash
Executable File
138 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
PARAM=$0
|
|
# Strip path from command name
|
|
PARAM=${PARAM##*/}
|
|
|
|
short() {
|
|
echo "Execute GPU offload of decode, encode, and transcode."
|
|
}
|
|
|
|
help() {
|
|
cat << EOF
|
|
$(short)
|
|
|
|
$(info)
|
|
EOF
|
|
}
|
|
|
|
details() {
|
|
cat << EOF
|
|
$(short)
|
|
|
|
This script provides a quick test of decode, encode, and transcode using
|
|
GPU offload. It is equivelant to manually running the following test
|
|
cases:
|
|
|
|
decode AUD_MW_E.264 AUD_MW.yuv
|
|
encode AUD_MW.yuv AUD_MW_E.h264
|
|
transcode AUD_MW_E.264 AUD_MW_E.hevc
|
|
1N_transcode AUD_MW_E.264 AUD_1N
|
|
|
|
EOF
|
|
}
|
|
|
|
arguments=()
|
|
|
|
for arg in $*; do
|
|
[[ $arg =~ ^-- ]] && {
|
|
command=${arg/--}
|
|
case $command in
|
|
short) short
|
|
exit 0
|
|
;;
|
|
help) help
|
|
exit 0
|
|
;;
|
|
details) details
|
|
exit 0
|
|
;;
|
|
*) echo "Unrecognized command."
|
|
exit 1
|
|
;;
|
|
esac
|
|
} || {
|
|
arguments+=("$arg")
|
|
}
|
|
done
|
|
|
|
info() {
|
|
cat << EOF
|
|
usage: $PARAM
|
|
EOF
|
|
}
|
|
|
|
QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128}
|
|
|
|
[ ${#arguments[*]} != 0 ] && {
|
|
info
|
|
exit 1
|
|
}
|
|
|
|
[ ! -d /data/. ] && {
|
|
cat << EOF
|
|
Error: '/data/' not found.
|
|
|
|
Was the volume /data mounted when launching the container?
|
|
|
|
docker ... --volume \$(pwd)/data:/data ...
|
|
|
|
or similar?
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
}
|
|
|
|
[ ! -e ${QSV_DEVICE} ] && {
|
|
cat << EOF
|
|
|
|
Error: '${QSV_DEVICE}' not found.
|
|
|
|
Did you pass /dev/dri to Docker?
|
|
|
|
docker ... --device=/dev/dri ...
|
|
|
|
or similar?
|
|
|
|
EOF
|
|
exit 2
|
|
}
|
|
|
|
[ ! -e "/data/AUD_MW_E.264" ] && {
|
|
cat << EOF
|
|
|
|
Test file h264 (AVC) not found. Attempting to download to /data
|
|
|
|
EOF
|
|
|
|
curl -so /data/AUD_MW_E.264 \
|
|
'https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264' || {
|
|
2>&1 cat << EOF
|
|
|
|
Error: Unable to download AUD_WM_E.264
|
|
|
|
EOF
|
|
exit 2
|
|
}
|
|
|
|
echo "Download succeeded:"
|
|
ls -l /data
|
|
}
|
|
|
|
tests=(
|
|
"decode AUD_MW_E.264 AUD_MW.yuv"
|
|
"encode AUD_MW.yuv AUD_MW_E.h264"
|
|
"transcode AUD_MW_E.264 AUD_MW_E.hevc"
|
|
"1N_transcode AUD_MW_E.264 AUD_1N"
|
|
)
|
|
for test in "${tests[@]}"; do
|
|
test=($test)
|
|
echo "Executing test: ${test}"
|
|
echo "----------------------------------------------------"
|
|
/assets/commands/${test[*]} || {
|
|
echo "Error: Test failed: ${test[*]}"
|
|
exit 5
|
|
}
|
|
done
|
|
|