From 01c406e23b3b86d9c75b0c393ebc00f299f07855 Mon Sep 17 00:00:00 2001 From: BtbN Date: Thu, 15 Apr 2021 19:58:12 +0200 Subject: [PATCH 1/4] Use built in vmaf model --- scripts.d/45-vmaf.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts.d/45-vmaf.sh b/scripts.d/45-vmaf.sh index b298921..3004415 100755 --- a/scripts.d/45-vmaf.sh +++ b/scripts.d/45-vmaf.sh @@ -17,9 +17,11 @@ ffbuild_dockerbuild() { --prefix="$FFBUILD_PREFIX" --buildtype=release --default-library=static + -Dbuilt_in_models=true -Denable_tests=false -Denable_docs=false -Denable_avx512=true + -Denable_float=true ) if [[ $TARGET == win* ]]; then From a3cf605fa91546592fc301f45d9743cb23d29cf0 Mon Sep 17 00:00:00 2001 From: BtbN Date: Thu, 15 Apr 2021 20:13:40 +0200 Subject: [PATCH 2/4] Attempt to fix suboptimal cache behaviour --- .github/workflows/build.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e678eb1..d18ff6f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,6 +75,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Install buildx + uses: docker/setup-buildx-action@v1 + with: + install: true - name: Generate Dockerfile run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }} - name: Login to Docker @@ -86,12 +90,11 @@ jobs: - name: Image Name id: imagename run: | - IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}:latest" - echo "::set-output name=name::${IMG/ /-}" + IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}" + echo "::set-output name=name::${IMG/ /-}:latest" + echo "::set-output name=cache_name::${IMG/ /-}:cache" - name: Build variant image - run: docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} . - - name: Push variant image - run: docker push ${{ steps.imagename.outputs.name }} + run: docker build --pull --cache-to=type=registry,mode=max,ref=${{ steps.imagename.outputs.cache_name }} --cache-from=type=registry,ref=${{ steps.imagename.outputs.cache_name }} --output=type=registry --tag ${{ steps.imagename.outputs.name }} . build_ffmpeg: name: Build ffmpeg needs: build_targets From 08b987be81ff6c3a8053f60303a33dccdf135d08 Mon Sep 17 00:00:00 2001 From: BtbN Date: Thu, 15 Apr 2021 21:43:35 +0200 Subject: [PATCH 3/4] Patch aom to support built-in vmaf models --- ...-built-in-vmaf-model-on-load-failure.patch | 24 +++++++++++++++++++ scripts.d/50-aom.sh | 9 +++++++ 2 files changed, 33 insertions(+) create mode 100644 patches/aom/0001-Fall-back-to-built-in-vmaf-model-on-load-failure.patch diff --git a/patches/aom/0001-Fall-back-to-built-in-vmaf-model-on-load-failure.patch b/patches/aom/0001-Fall-back-to-built-in-vmaf-model-on-load-failure.patch new file mode 100644 index 0000000..fa42e62 --- /dev/null +++ b/patches/aom/0001-Fall-back-to-built-in-vmaf-model-on-load-failure.patch @@ -0,0 +1,24 @@ +From cc9db1c519dc00966ba8d8cdb4328698dfff9f80 Mon Sep 17 00:00:00 2001 +From: BtbN +Date: Thu, 15 Apr 2021 21:38:32 +0200 +Subject: [PATCH] Fall back to built-in vmaf model on load failure + +--- + aom_dsp/vmaf.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/aom_dsp/vmaf.c b/aom_dsp/vmaf.c +index 219e27830..6625f05c1 100644 +--- a/aom_dsp/vmaf.c ++++ b/aom_dsp/vmaf.c +@@ -37,6 +37,7 @@ void aom_init_vmaf_model(VmafModel **vmaf_model, const char *model_path) { + model_cfg.name = "vmaf"; + + if (vmaf_model_load_from_path(vmaf_model, &model_cfg, model_path)) { ++ if (vmaf_model_load(vmaf_model, &model_cfg, "vmaf_v0.6.1")) + vmaf_fatal_error("Failed to load VMAF model."); + } + } +-- +2.25.1 + diff --git a/scripts.d/50-aom.sh b/scripts.d/50-aom.sh index a15bb49..fa18771 100755 --- a/scripts.d/50-aom.sh +++ b/scripts.d/50-aom.sh @@ -7,10 +7,19 @@ ffbuild_enabled() { return 0 } +ffbuild_dockerstage() { + to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/aom,dst=/patches run_stage /stage.sh" +} + ffbuild_dockerbuild() { git-mini-clone "$AOM_REPO" "$AOM_COMMIT" aom cd aom + for patch in /patches/*.patch; do + echo "Applying $patch" + git am < "$patch" + done + mkdir cmbuild && cd cmbuild # Workaround broken build system From 133f0117f7a9d4d38983b18bc2bdaca0054b9024 Mon Sep 17 00:00:00 2001 From: BtbN Date: Thu, 15 Apr 2021 22:39:40 +0200 Subject: [PATCH 4/4] Revert "Attempt to fix suboptimal cache behaviour" This reverts commit a3cf605fa91546592fc301f45d9743cb23d29cf0. --- .github/workflows/build.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d18ff6f..e678eb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,10 +75,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Install buildx - uses: docker/setup-buildx-action@v1 - with: - install: true - name: Generate Dockerfile run: ./generate.sh ${{ matrix.target }} ${{ matrix.variant }} - name: Login to Docker @@ -90,11 +86,12 @@ jobs: - name: Image Name id: imagename run: | - IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}" - echo "::set-output name=name::${IMG/ /-}:latest" - echo "::set-output name=cache_name::${IMG/ /-}:cache" + IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}:latest" + echo "::set-output name=name::${IMG/ /-}" - name: Build variant image - run: docker build --pull --cache-to=type=registry,mode=max,ref=${{ steps.imagename.outputs.cache_name }} --cache-from=type=registry,ref=${{ steps.imagename.outputs.cache_name }} --output=type=registry --tag ${{ steps.imagename.outputs.name }} . + run: docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} . + - name: Push variant image + run: docker push ${{ steps.imagename.outputs.name }} build_ffmpeg: name: Build ffmpeg needs: build_targets