progressive_sizes.sh (739B)
1 #!/bin/bash 2 # Copyright (c) the JPEG XL Project Authors. All rights reserved. 3 # 4 # Use of this source code is governed by a BSD-style 5 # license that can be found in the LICENSE file. 6 7 8 set -eu 9 10 TMPDIR=$(mktemp -d) 11 12 cleanup() { 13 rm -rf ${TMPDIR} 14 } 15 16 trap cleanup EXIT 17 18 19 CJXL=$(realpath $(dirname "$0"))/../../build/tools/cjxl 20 DJXL=$(realpath $(dirname "$0"))/../../build/tools/djxl 21 22 ${CJXL} "$@" ${TMPDIR}/x.jxl &>/dev/null 23 S1=$(${DJXL} ${TMPDIR}/x.jxl --print_read_bytes -s 1 2>&1 | grep 'Decoded' | grep -o '[0-9]*') 24 S2=$(${DJXL} ${TMPDIR}/x.jxl --print_read_bytes -s 2 2>&1 | grep 'Decoded' | grep -o '[0-9]*') 25 S8=$(${DJXL} ${TMPDIR}/x.jxl --print_read_bytes -s 8 2>&1 | grep 'Decoded' | grep -o '[0-9]*') 26 27 echo "8x: $S8 2x: $S2 1x: $S1"