blob: 242b03768a054f3ad0269f39fabd0f91eb96cd43 [file] [log] [blame]
maryla-uca120c6f2023-09-08 09:43:57 +02001#!/bin/bash
2# Copyright 2023 Google LLC
3# SPDX-License-Identifier: BSD-2-Clause
4#
5# Test that compares the structure (boxes) of AVIF files metadata, dumped as xml,
6# with golden files stored in tests/data/goldens/.
7# Depends on the command line tool MP4Box.
8#
9# Usage:
10# test_cmd_enc_boxes_golden.sh <avifenc_dir> <mp4box_dir> <testdata_dir>
11# <test_output_dir>
12# But most of the time you will be running this test with 'make test' or
13# 'ctest -V -R test_cmd_enc_boxes_golden'
14
maryla-uca120c6f2023-09-08 09:43:57 +020015# ===================================
16# ========== Encode files ===========
17# ===================================
18# To add new test case, just add new encode commands to this function.
19# All .avif files created here will become test cases.
20encode_test_files() {
maryla-uc0d07abb2023-09-12 11:25:16 +020021 AVIFENC="$1"
22 TESTDATA_DIR="$2"
maryla-uca120c6f2023-09-08 09:43:57 +020023
24 # Still images.
25 for f in "kodim03_yuv420_8bpc.y4m" "circle-trns-after-plte.png" "paris_icc_exif_xmp.png"; do
26 "${AVIFENC}" -s 9 "${TESTDATA_DIR}/$f" -o "$f.avif"
27 done
28
29 # Grid.
30 "${AVIFENC}" -s 9 --grid 2x2 "${TESTDATA_DIR}/dog_exif_extended_xmp_icc.jpg" \
31 -o "dog_exif_extended_xmp_icc.jpg.avif"
32
33 # Animation.
34 "${AVIFENC}" -s 9 "${TESTDATA_DIR}/kodim03_yuv420_8bpc.y4m" \
35 "${TESTDATA_DIR}/kodim23_yuv420_8bpc.y4m" -o "kodim03_23_animation.avif"
Yannis Guyon6130ff52023-10-05 10:44:30 +020036
37 # Animation with only keyframes.
38 "${AVIFENC}" -s 9 --keyframe 1 "${TESTDATA_DIR}/kodim03_yuv420_8bpc.y4m" \
39 "${TESTDATA_DIR}/kodim23_yuv420_8bpc.y4m" -o "kodim03_23_animation_keyframes.avif"
maryla-uca120c6f2023-09-08 09:43:57 +020040}
41
maryla-uc0d07abb2023-09-12 11:25:16 +020042export -f encode_test_files
43source $(dirname "$0")/golden_test_common.sh