maryla-uc | a120c6f | 2023-09-08 09:43:57 +0200 | [diff] [blame] | 1 | #!/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-uc | a120c6f | 2023-09-08 09:43:57 +0200 | [diff] [blame] | 15 | # =================================== |
| 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. |
| 20 | encode_test_files() { |
maryla-uc | 0d07abb | 2023-09-12 11:25:16 +0200 | [diff] [blame] | 21 | AVIFENC="$1" |
| 22 | TESTDATA_DIR="$2" |
maryla-uc | a120c6f | 2023-09-08 09:43:57 +0200 | [diff] [blame] | 23 | |
| 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 Guyon | 6130ff5 | 2023-10-05 10:44:30 +0200 | [diff] [blame] | 36 | |
| 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-uc | a120c6f | 2023-09-08 09:43:57 +0200 | [diff] [blame] | 40 | } |
| 41 | |
maryla-uc | 0d07abb | 2023-09-12 11:25:16 +0200 | [diff] [blame] | 42 | export -f encode_test_files |
| 43 | source $(dirname "$0")/golden_test_common.sh |