choose opt level

This commit is contained in:
2024-05-21 07:33:22 -05:00
parent 94a54724c6
commit d4d8a5b81e
2 changed files with 32 additions and 9 deletions

View File

@@ -1,11 +1,12 @@
#!/bin/bash
usage() {
echo "./scripts/build.sh [-h] [-p] [-o] [-r]"
echo "./scripts/build.sh [-h] [-p] [-o] [-r] [-O n]"
echo -e "\th: display this help output"
echo -e "\tp: build svt-av1-psy with dovi library"
echo -e "\to: build other encoders x264/5 and vpx"
echo -e "\tr: build rockchip media libraries"
echo -e "\tO n: build at optimization n (1, 2, 3)"
}
update_git() {
@@ -15,8 +16,8 @@ update_git() {
}
GREP_FILTER="av1"
OPTS='hpor'
NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l)
OPTS='hporO:'
NUM_OPTS=$(echo -n $OPTS | wc -m)
MIN_OPT=0
# using all
MAX_OPT=$(( NUM_OPTS ))
@@ -42,12 +43,37 @@ while getopts "$OPTS" flag; do
GREP_FILTER+="|rkmpp"
echo "building rockchip media platform"
;;
O)
if [[ ${OPTARG} != ?(-)+([[:digit:]]) || ${OPTARG} -lt 0 ]]; then
echo "${OPTARG} is not a positive integer"
usage
exit 1
fi
if [[ ${OPTARG} -gt 3 ]]; then
echo "${OPTARG} is greater than 3"
usage
exit 1
fi
# set optimization level
export OPT_LVL="$OPTARG"
;;
*)
echo "building default"
echo 'unsupported flag(s)'
usage
exit 1
;;
esac
done
# set default optimization level
if [[ -z $OPT_LVL ]]; then
OPT_LVL=3
fi
echo "building with O${OPT_LVL}"
# wait a sec for outputs to show
sleep 1
BASE_DIR=$(pwd)
SVT_DIR="$BASE_DIR/svt"
RAV1E_DIR="$BASE_DIR/rav1e"
@@ -87,9 +113,6 @@ then
fi
echo "COMP_FLAGS: $COMP_FLAGS"
# set optimization level
OPT_LVL="3"
# for ccache
export PATH="/usr/lib/ccache/:$PATH"

View File

@@ -66,13 +66,13 @@ get_bitrate_audio() {
OPTS='i:p:g:'
NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l)
NUM_OPTS=$(echo $OPTS | wc -m)
PRINT_OUT="false"
GRAIN=""
# only using -i
MIN_OPT=2
# using all + output name
MAX_OPT=$(( NUM_OPTS * 2 - 1 ))
MAX_OPT=$(( NUM_OPTS + 1 ))
test "$#" -lt $MIN_OPT && echo "not enough arguments" && usage && exit 1
test "$#" -gt $MAX_OPT && echo "too many arguments" && usage && exit 1
while getopts "$OPTS" flag; do