mirror of
https://github.com/levogevo/ffmpeg-av1-builder.git
synced 2026-01-15 16:56:18 +00:00
choose opt level
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
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 "\th: display this help output"
|
||||||
echo -e "\tp: build svt-av1-psy with dovi library"
|
echo -e "\tp: build svt-av1-psy with dovi library"
|
||||||
echo -e "\to: build other encoders x264/5 and vpx"
|
echo -e "\to: build other encoders x264/5 and vpx"
|
||||||
echo -e "\tr: build rockchip media libraries"
|
echo -e "\tr: build rockchip media libraries"
|
||||||
|
echo -e "\tO n: build at optimization n (1, 2, 3)"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_git() {
|
update_git() {
|
||||||
@@ -15,8 +16,8 @@ update_git() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GREP_FILTER="av1"
|
GREP_FILTER="av1"
|
||||||
OPTS='hpor'
|
OPTS='hporO:'
|
||||||
NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l)
|
NUM_OPTS=$(echo -n $OPTS | wc -m)
|
||||||
MIN_OPT=0
|
MIN_OPT=0
|
||||||
# using all
|
# using all
|
||||||
MAX_OPT=$(( NUM_OPTS ))
|
MAX_OPT=$(( NUM_OPTS ))
|
||||||
@@ -42,12 +43,37 @@ while getopts "$OPTS" flag; do
|
|||||||
GREP_FILTER+="|rkmpp"
|
GREP_FILTER+="|rkmpp"
|
||||||
echo "building rockchip media platform"
|
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
|
esac
|
||||||
done
|
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)
|
BASE_DIR=$(pwd)
|
||||||
SVT_DIR="$BASE_DIR/svt"
|
SVT_DIR="$BASE_DIR/svt"
|
||||||
RAV1E_DIR="$BASE_DIR/rav1e"
|
RAV1E_DIR="$BASE_DIR/rav1e"
|
||||||
@@ -87,9 +113,6 @@ then
|
|||||||
fi
|
fi
|
||||||
echo "COMP_FLAGS: $COMP_FLAGS"
|
echo "COMP_FLAGS: $COMP_FLAGS"
|
||||||
|
|
||||||
# set optimization level
|
|
||||||
OPT_LVL="3"
|
|
||||||
|
|
||||||
# for ccache
|
# for ccache
|
||||||
export PATH="/usr/lib/ccache/:$PATH"
|
export PATH="/usr/lib/ccache/:$PATH"
|
||||||
|
|
||||||
|
|||||||
@@ -66,13 +66,13 @@ get_bitrate_audio() {
|
|||||||
|
|
||||||
|
|
||||||
OPTS='i:p:g:'
|
OPTS='i:p:g:'
|
||||||
NUM_OPTS=$(echo $OPTS | tr ':' '\n' | wc -l)
|
NUM_OPTS=$(echo $OPTS | wc -m)
|
||||||
PRINT_OUT="false"
|
PRINT_OUT="false"
|
||||||
GRAIN=""
|
GRAIN=""
|
||||||
# only using -i
|
# only using -i
|
||||||
MIN_OPT=2
|
MIN_OPT=2
|
||||||
# using all + output name
|
# 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 "$#" -lt $MIN_OPT && echo "not enough arguments" && usage && exit 1
|
||||||
test "$#" -gt $MAX_OPT && echo "too many arguments" && usage && exit 1
|
test "$#" -gt $MAX_OPT && echo "too many arguments" && usage && exit 1
|
||||||
while getopts "$OPTS" flag; do
|
while getopts "$OPTS" flag; do
|
||||||
|
|||||||
Reference in New Issue
Block a user