#!/bin/bash
# Fetches the LCEVC streams the corpus checks without holding them (format-probes ยง13.3),
# into
, and checks each file's SHA-256. They are the unit-test streams of an open LCEVC
# decoder (BSD-3-Clause-Clear), written by an LCEVC encoder from a short test sequence; their
# licence notice names their owner, so the corpus names them by digest and holds no copy.
#
# bash fetch.sh
set -euo pipefail
dir=${1:?usage: fetch.sh }
mkdir -p "$dir"
base=https://raw.githubusercontent.com/v-novaltd/LCEVCdec/741fb7c869cf61012f7dcebfcd9e56981198c78b/src/enhancement/test/assets # allow-name: repository URL
while read -r sum name; do
curl -fsS --retry 3 -o "$dir/$name" "$base/$name"
got=$( (sha256sum "$dir/$name" 2>/dev/null || shasum -a 256 "$dir/$name") | cut -d' ' -f1)
[ "$got" = "$sum" ] || { echo "$name: SHA-256 $got, expected $sum" >&2; exit 1; }
done <<'EOF'
0ad059dd167093ef773aa9be932afdf0cd2108656daaed18bfc7ee8041c4ee05 parse_std.bin
20b7d666216b20419b6e4d80b2d9b68b8c9b4a66f9ba01849895e00d7c9d2583 parse_gops.bin
1492419eb19f34dd1e4dd3f50b3525a32f2bb34ad48fdeea8e4e9fc1ab54c149 parse_hdr.bin
156568e8c5cbb0307e5c1b6dde25a8932315abfffe063140dfa6366edea4c9e4 decode_temp_on.bin
a486c0a40abdfdde11d95b51491a3b78a273a48b75548e7a86e32de361df781c decode_temp_off.bin
EOF
echo "fetched 5 files into $dir"