1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#!/bin/bash
#
# HEIF codec.
# Copyright (c) 2025 Dirk Farin <dirk.farin@gmail.com>
#
# This file is part of libheif.
#
# libheif is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# libheif is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with libheif. If not, see <http://www.gnu.org/licenses/>.
#
if [ "$#" -ne 1 ]; then
echo "Usage: pass name of first (PNG) image (with alpha) as only argument"
exit 5
fi
input_images=$1
for enc in "--hevc -e x265" \
"--hevc -e kvazaar" \
"--avc -e x264" \
"--vvc -e vvenc" \
"--vvc -e uvg266" \
"--avif -e aom" \
"--avif -e svt" \
"--avif -e rav1e" \
"--jpeg -e jpeg" \
"--jpeg2000 -e openjpeg" \
"--htj2k -e openjph" \
"--uncompressed -e uncompressed" ;
do
format=${enc#--} # remove leading --
format="${format%% *}" # stop at whitespace
codec="${enc##* }" # extract last word
if [[ $format == "avif" ]] ; then
suffix="avif"
elif [[ $format == "hevc" ]] ; then
suffix="heics"
else
suffix="heif"
fi
for alpha in "alpha" "noalpha" ; do
if [[ $alpha == "alpha" ]] ; then
alpha_arg=""
else
alpha_arg="--no-alpha"
fi
for loop in "loop" "once" ; do
if [[ $loop == "once" ]] ; then
loop_arg=""
else
loop_arg="--repetitions infinite"
fi
echo "----- format: ${format}, encoder: ${codec}, ${alpha}, ${loop} -----"
if [[ $format == "hevc" || $format == "avc" || $format == "vvc" || $format == "avif" ]] ; then
for pred in "i" "p" "b" ; do
./examples/heif-enc -S $input_images -o ${alpha}-${format}-${pred}-${codec}-${loop}.$suffix $enc $alpha_arg $loop_arg --gop-structure $pred
done
else
./examples/heif-enc -S $input_images -o ${alpha}-${format}-${codec}-${loop}.$suffix $enc $alpha_arg $loop_arg
fi
done
done
done
|