137 lines
2.1 KiB
Bash
Executable File
137 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 /media/. ] && {
|
|
cat << EOF
|
|
Error: '/media/' not found.
|
|
|
|
Was the volume /media mounted when launching the container?
|
|
|
|
docker ... --volume \$(pwd)/media:/media ...
|
|
|
|
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 "/media/AUD_MW_E.264" ] && {
|
|
cat << EOF
|
|
|
|
Error: Test file h264 (AVC) not found. Is /media mounted?
|
|
|
|
You can download a test stream via:
|
|
|
|
mkdir -p \$(pwd)/media
|
|
wget -O \$(pwd)/media/AUD_MW_E.264 \\
|
|
'https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264'
|
|
|
|
Once downloaded, re-run this test. When you launch the Docker
|
|
container, make sure you mount the '\$(pwd)/media' path as
|
|
the /media volume via:
|
|
|
|
docker ... --volume \$(pwd)/media:/media ...
|
|
|
|
EOF
|
|
|
|
exit 3
|
|
}
|
|
|
|
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)
|
|
/assets/commands/${test[*]} || {
|
|
echo "Error: Test failed: ${test[*]}"
|
|
exit 5
|
|
}
|
|
done
|
|
|