mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-18 03:04:06 +00:00
adf0bfea07
$ mktemp --tmpdir tmp.XXXXXXXXXX.yuv mktemp: illegal option -- - usage: mktemp [-d] [-q] [-t prefix] [-u] template ... mktemp [-d] [-q] [-u] -t prefix $ gmktemp --tmpdir tmp.XXXXXXXXXX.yuv /tmp/tmp.ddQTBn4XmE.yuv $ mktemp -t tmp.XXXXXXXXXX.yuv /tmp/tmp.XXXXXXXXXX.yuv.SYYNp8Ki $ gmktemp -t tmp.XXXXXXXXXX.yuv /tmp/tmp.2ena2nKgv5.yuv $ mktemp -t yuv /tmp/yuv.rX2UAbax $ gmktemp -t yuv gmktemp: too few X's in template ‘yuv’
66 lines
1.2 KiB
Bash
66 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# Helper functions for test scripts.
|
|
|
|
set -eu${BASH+o pipefail}
|
|
|
|
# Temporary files for encoder input and output.
|
|
yuvfile="$(mktemp)"
|
|
hevcfile="$(mktemp)"
|
|
|
|
cleanup() {
|
|
rm -rf "${yuvfile}" "${hevcfile}"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
print_and_run() {
|
|
printf '\n\n$ %s\n' "$*"
|
|
"$@"
|
|
}
|
|
|
|
prepare() {
|
|
cleanup
|
|
print_and_run \
|
|
ffmpeg -f lavfi -i "mandelbrot=size=${1}" \
|
|
-vframes "${2}" -pix_fmt yuv420p -f yuv4mpegpipe \
|
|
"${yuvfile}"
|
|
}
|
|
|
|
valgrind_test() {
|
|
dimensions="$1"
|
|
shift
|
|
frames="$1"
|
|
shift
|
|
|
|
prepare "${dimensions}" "${frames}"
|
|
|
|
print_and_run \
|
|
libtool execute \
|
|
valgrind --leak-check=full --error-exitcode=1 -- \
|
|
../src/kvazaar -i "${yuvfile}" "--input-res=${dimensions}" -o "${hevcfile}" "$@"
|
|
|
|
print_and_run \
|
|
TAppDecoderStatic -b "${hevcfile}"
|
|
|
|
cleanup
|
|
}
|
|
|
|
encode_test() {
|
|
dimensions="$1"
|
|
shift
|
|
frames="$1"
|
|
shift
|
|
expected_status="$1"
|
|
shift
|
|
|
|
prepare "${dimensions}" "${frames}"
|
|
|
|
set +e
|
|
print_and_run \
|
|
libtool execute \
|
|
../src/kvazaar -i "${yuvfile}" "--input-res=${dimensions}" -o "${hevcfile}" "$@"
|
|
actual_status="$?"
|
|
set -e
|
|
[ ${actual_status} -eq ${expected_status} ]
|
|
}
|