rebuild on option change

This commit is contained in:
2025-02-16 09:20:29 -06:00
parent 4a6b46c5d1
commit 20179c8f53
2 changed files with 18 additions and 9 deletions

View File

@@ -125,6 +125,12 @@ GTEST_DIR="$REPOS_DIR/googletest"
VPX_DIR="$REPOS_DIR/vpx" VPX_DIR="$REPOS_DIR/vpx"
test -d "$REPOS_DIR" || mkdir "$REPOS_DIR" test -d "$REPOS_DIR" || mkdir "$REPOS_DIR"
# test if options are different
# so that rebuild is forced
if [[ "$(sort "$BASE_DIR/.last_opts")" != "$(echo "$@" | sort )" ]]; then
FORCE_REBUILD=1
fi
# save options use # save options use
echo "$@" > "$BASE_DIR/.last_opts" echo "$@" > "$BASE_DIR/.last_opts"
@@ -147,10 +153,11 @@ check_for_rebuild() {
fi fi
git config pull.rebase false git config pull.rebase false
git stash && git stash drop git stash && git stash drop
PRE_COMMIT="$(git rev-parse HEAD)"
git pull || exit 1 git pull || exit 1
POST_COMMIT="$(git rev-parse HEAD)" LATEST_REMOTE="$(git ls-remote "$(git config --get remote.origin.url)" HEAD | awk '{ print $1 }')"
test "$PRE_COMMIT" != "$POST_COMMIT" && return 1 CURRENT_HEAD="$(git rev-parse HEAD)"
test "$FORCE_REBUILD" == '1' && return 1
test "$LATEST_REMOTE" != "$CURRENT_HEAD" && return 1
# check if project built successfully # check if project built successfully
grep -q "$(good_commit_output)" "$GOOD_COMMIT_BUILDS" || return 1 grep -q "$(good_commit_output)" "$GOOD_COMMIT_BUILDS" || return 1
return 0 return 0
@@ -313,7 +320,7 @@ build_hdr10plus() {
} }
build_svt_av1_psy() { build_svt_av1_psy() {
# build svt-avt-psy # build svt-av1-psy
# svt-av1-psy cannot be cleanly updated # svt-av1-psy cannot be cleanly updated
# due to histories error # due to histories error
local GIT_REPO_URL='https://github.com/gianni-rosato/svt-av1-psy' local GIT_REPO_URL='https://github.com/gianni-rosato/svt-av1-psy'
@@ -326,8 +333,8 @@ build_svt_av1_psy() {
git clone --depth "$GIT_DEPTH" "$GIT_REPO_URL" "$SVT_PSY_DIR" git clone --depth "$GIT_DEPTH" "$GIT_REPO_URL" "$SVT_PSY_DIR"
fi fi
cd "$SVT_PSY_DIR" || return 1 cd "$SVT_PSY_DIR" || return 1
# check for rebuild
grep -q "$(good_commit_output)" "$GOOD_COMMIT_BUILDS" && \ check_for_rebuild && \
cd "$CMAKE_BUILD_DIR" && \ cd "$CMAKE_BUILD_DIR" && \
sudo make install && \ sudo make install && \
set_commit_status && \ set_commit_status && \
@@ -336,7 +343,6 @@ build_svt_av1_psy() {
sudo rm -rf "$CMAKE_BUILD_DIR" sudo rm -rf "$CMAKE_BUILD_DIR"
mkdir "$CMAKE_BUILD_DIR" mkdir "$CMAKE_BUILD_DIR"
cd "$CMAKE_BUILD_DIR" || return 1 cd "$CMAKE_BUILD_DIR" || return 1
make clean
cmake \ cmake \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DSVT_AV1_LTO="${LTO_SWITCH}" \ -DSVT_AV1_LTO="${LTO_SWITCH}" \
@@ -350,6 +356,7 @@ build_svt_av1_psy() {
-DCMAKE_C_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \ -DCMAKE_C_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \ -DCMAKE_CXX_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \
"$SVT_PSY_DIR" || return 1 "$SVT_PSY_DIR" || return 1
make clean
ccache make -j"${THREADS}" || return 1 ccache make -j"${THREADS}" || return 1
sudo make install sudo make install
cd "$SVT_PSY_DIR/" || return 1 cd "$SVT_PSY_DIR/" || return 1
@@ -361,15 +368,16 @@ build_svt_av1() {
local CMAKE_BUILD_DIR="$SVT_DIR/build_svt.user" local CMAKE_BUILD_DIR="$SVT_DIR/build_svt.user"
git clone --depth "$GIT_DEPTH" https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR" git clone --depth "$GIT_DEPTH" https://gitlab.com/AOMediaCodec/SVT-AV1.git "$SVT_DIR"
cd "$SVT_DIR" || return 1 cd "$SVT_DIR" || return 1
check_for_rebuild && \ check_for_rebuild && \
cd "$CMAKE_BUILD_DIR" && \ cd "$CMAKE_BUILD_DIR" && \
sudo make install && \ sudo make install && \
set_commit_status && \ set_commit_status && \
return 0 return 0
sudo rm -rf "$CMAKE_BUILD_DIR" sudo rm -rf "$CMAKE_BUILD_DIR"
mkdir "$CMAKE_BUILD_DIR" mkdir "$CMAKE_BUILD_DIR"
cd "$CMAKE_BUILD_DIR" || return 1 cd "$CMAKE_BUILD_DIR" || return 1
make clean
cmake \ cmake \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DSVT_AV1_LTO="${LTO_SWITCH}" \ -DSVT_AV1_LTO="${LTO_SWITCH}" \
@@ -381,6 +389,7 @@ build_svt_av1() {
-DCMAKE_C_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \ -DCMAKE_C_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \
-DCMAKE_CXX_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \ -DCMAKE_CXX_FLAGS="-O${OPT_LVL} ${COMP_FLAGS}" \
"$SVT_DIR/" || return 1 "$SVT_DIR/" || return 1
make clean
ccache make -j"${THREADS}" || return 1 ccache make -j"${THREADS}" || return 1
sudo make install || return 1 sudo make install || return 1
set_commit_status set_commit_status

View File

@@ -32,7 +32,7 @@ get_crop() {
# get cropdetect value for first 1/5 of input # get cropdetect value for first 1/5 of input
local TIME_ENC="$(echo "$TOTAL_SECONDS / 2" | bc)" local TIME_ENC="$(echo "$TOTAL_SECONDS / 2" | bc)"
ffmpeg -hide_banner -ss 0 -discard 'nokey' -i "$INPUT" -t "$TIME_ENC" \ ffmpeg -hide_banner -ss 0 -discard 'nokey' -i "$INPUT" -t "$TIME_ENC" \
-map '0:v:0' -filter:v:0 'cropdetect=limit=64:round=16:skip=2:reset_count=0' \ -map '0:v:0' -filter:v:0 'cropdetect=limit=100:round=16:skip=2:reset_count=0' \
-codec:v 'wrapped_avframe' -f 'null' '/dev/null' -y 2>&1 | grep -o crop=.* \ -codec:v 'wrapped_avframe' -f 'null' '/dev/null' -y 2>&1 | grep -o crop=.* \
| sort -bh | uniq -c | sort -bh | tail -n1 | grep -o "crop=.*" | sort -bh | uniq -c | sort -bh | tail -n1 | grep -o "crop=.*"
} }