diff --git a/build.sh b/build.sh index d52e2ba..729a590 100755 --- a/build.sh +++ b/build.sh @@ -25,7 +25,7 @@ prepare_dependencies() { build-essential \ apt-utils cmake cython3 flex bison gcc g++ git make patch pkg-config wget \ libdrm-dev libtool libusb-1.0-0-dev xz-utils ocl-icd-opencl-dev opencl-headers \ - apt-utils gpg-agent software-properties-common wget python3-dev libpython3-dev python3-pip + apt-utils gpg-agent software-properties-common wget python3-dev libpython3-dev python3-pip nasm yasm } config_git_users() { @@ -103,11 +103,27 @@ build_install_ivsr_sdk() { echo "Build ivsr sdk finished." } +build_install_svt_av1() { + echo "Building and installing SVT-AV1 library..." + svtav1_repo=https://gitlab.com/AOMediaCodec/SVT-AV1.git + svtav1_branch=v4.0.1 + ivsr_svtav1_dir=${base_dir}/ivsr_svtav1/SVT-AV1 + if [ ! -d "${ivsr_svtav1_dir}" ]; then + git clone --depth 1 --branch ${svtav1_branch} ${svtav1_repo} ${ivsr_svtav1_dir} + git config --global --add safe.directory ${ivsr_svtav1_dir} + fi + cd ${ivsr_svtav1_dir}/Build + cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release + make -j$(nproc) + sudo make install + echo "Build svt-av1 finished." +} + build_ffmpeg() { echo "Building FFMPEG with specific libraries support..." sudo -E apt-get update && \ DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends \ - ca-certificates tar g++ wget pkg-config nasm yasm libglib2.0-dev flex bison gobject-introspection libgirepository1.0-dev \ + ca-certificates tar g++ wget pkg-config libglib2.0-dev flex bison gobject-introspection libgirepository1.0-dev \ python3-dev libx11-dev libxv-dev libxt-dev libasound2-dev libpango1.0-dev libtheora-dev libvisual-0.4-dev libgl1-mesa-dev \ libcurl4-gnutls-dev librtmp-dev libx264-dev libx265-dev libde265-dev libva-dev libtbb-dev @@ -124,6 +140,10 @@ build_ffmpeg() { cd ${ffmpeg_dir} && cp -rf $base_dir/ivsr_ffmpeg_plugin/patches/*.patch . git am --whitespace=fix *.patch + # patches for SVT-AV1 + git am --whitespace=fix ${base_dir}/ivsr_svtav1/SVT-AV1/.gitlab/workflows/linux/0001-avcodec-libsvtav1-unbreak-build-with-latest-svtav1.patch + git am --whitespace=fix ${base_dir}/ivsr_svtav1/SVT-AV1/.gitlab/workflows/linux/0001-avcodec-libsvtav1-rename-aq_mode-for-v4.0.0.patch + ./configure \ --enable-gpl \ --enable-nonfree \ @@ -133,7 +153,8 @@ build_ffmpeg() { --enable-version3 \ --enable-libivsr \ --enable-libx264 \ - --enable-libx265 + --enable-libx265 \ + --enable-libsvtav1 make -j$(nproc) sudo make install @@ -173,6 +194,7 @@ main() { install_openvino_from_apt "$ov_version" fi build_install_ivsr_sdk + build_install_svt_av1 build_ffmpeg } diff --git a/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/Dockerfile b/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/Dockerfile index ee1298b..684f4b9 100644 --- a/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/Dockerfile +++ b/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/Dockerfile @@ -188,8 +188,20 @@ RUN wget ${LIBX265} && \ make -j16 && \ make install +# Build SVT-AV1 +ARG SVTAV1_VER="v4.0.1" +ARG SVTAV1_REPO="https://gitlab.com/AOMediaCodec/SVT-AV1.git" +ARG SVTAV1_DIR=${WORKSPACE}/ivsr/svt-av1 +WORKDIR ${SVTAV1_DIR} +RUN git clone ${SVTAV1_REPO} . && \ + git checkout ${SVTAV1_VER} && \ + cd Build && \ + cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) && \ + make install + ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -ENV LD_LIBRARY_PATH=${IVSR_SDK_DIR}/lib:/usr/local/lib:$LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=${IVSR_SDK_DIR}/lib:/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH ARG FFMPEG_IVSR_SDK_PLUGIN_DIR=${IVSR_DIR}/ivsr_ffmpeg_plugin ARG FFMPEG_DIR=${FFMPEG_IVSR_SDK_PLUGIN_DIR}/ffmpeg @@ -206,6 +218,10 @@ RUN { set -e; \ git am --whitespace=fix ${patch_file}; \ done; } +# patches for SVT-AV1 +RUN git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-unbreak-build-with-latest-svtav1.patch &&\ + git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-rename-aq_mode-for-v4.0.0.patch + RUN ./configure \ --extra-cflags=-fopenmp \ --extra-ldflags=-fopenmp \ @@ -216,6 +232,7 @@ RUN ./configure \ --enable-gpl \ --enable-libx264 \ --enable-libx265 \ +--enable-libsvtav1 \ --enable-version3 && \ make -j16 && \ make install diff --git a/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/ov2024.5s.dockerfile b/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/ov2024.5s.dockerfile index ca73eab..1e248ef 100644 --- a/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/ov2024.5s.dockerfile +++ b/ivsr_ffmpeg_plugin/dockerfiles/rockylinux9/ov2024.5s.dockerfile @@ -101,8 +101,20 @@ RUN wget ${LIBX265} && \ make -j16 && \ make install +# Build SVT-AV1 +ARG SVTAV1_VER="v4.0.1" +ARG SVTAV1_REPO="https://gitlab.com/AOMediaCodec/SVT-AV1.git" +ARG SVTAV1_DIR=${WORKSPACE}/ivsr/svt-av1 +WORKDIR ${SVTAV1_DIR} +RUN git clone ${SVTAV1_REPO} . && \ + git checkout ${SVTAV1_VER} && \ + cd Build && \ + cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) && \ + make install + ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -ENV LD_LIBRARY_PATH=${IVSR_SDK_DIR}/lib:/usr/local/lib:$LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=${IVSR_SDK_DIR}/lib:/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH ARG FFMPEG_IVSR_SDK_PLUGIN_DIR=${IVSR_DIR}/ivsr_ffmpeg_plugin ARG FFMPEG_DIR=${FFMPEG_IVSR_SDK_PLUGIN_DIR}/ffmpeg @@ -119,6 +131,10 @@ RUN { set -e; \ git am --whitespace=fix ${patch_file}; \ done; } +# patches for SVT-AV1 +RUN git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-unbreak-build-with-latest-svtav1.patch &&\ + git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-rename-aq_mode-for-v4.0.0.patch + RUN ./configure \ --extra-cflags=-fopenmp \ --extra-ldflags=-fopenmp \ @@ -129,6 +145,7 @@ RUN ./configure \ --enable-gpl \ --enable-libx264 \ --enable-libx265 \ +--enable-libsvtav1 \ --enable-version3 && \ make -j16 && \ make install diff --git a/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/Dockerfile b/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/Dockerfile index fe0f98c..25ccd9e 100644 --- a/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/Dockerfile +++ b/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/Dockerfile @@ -159,7 +159,7 @@ RUN apt-get update && \ pkg-config \ xz-utils \ ocl-icd-opencl-dev \ - opencl-headers && \ + opencl-headers nasm yasm && \ rm -rf /var/lib/apt/lists/* ARG PYTHON @@ -249,10 +249,22 @@ RUN cmake .. \ make install && \ echo "Building vsr sdk finished." +# Build SVT-AV1 +ARG SVTAV1_VER="v4.0.1" +ARG SVTAV1_REPO="https://gitlab.com/AOMediaCodec/SVT-AV1.git" +ARG SVTAV1_DIR=${WORKSPACE}/ivsr/svt-av1 +WORKDIR ${SVTAV1_DIR} +RUN git clone ${SVTAV1_REPO} . && \ + git checkout ${SVTAV1_VER} && \ + cd Build && \ + cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) && \ + make install + #build ffmpeg with iVSR SDK backend RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - ca-certificates tar g++ wget pkg-config nasm yasm libglib2.0-dev flex bison gobject-introspection libgirepository1.0-dev python3-dev \ + ca-certificates tar g++ wget pkg-config libglib2.0-dev flex bison gobject-introspection libgirepository1.0-dev python3-dev \ libx11-dev \ libxv-dev \ libxt-dev \ @@ -286,6 +298,10 @@ RUN { set -e; \ git am --whitespace=fix ${patch_file}; \ done; } +# patches for SVT-AV1 +RUN git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-unbreak-build-with-latest-svtav1.patch &&\ + git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-rename-aq_mode-for-v4.0.0.patch + RUN if [ -f "${CUSTOM_OV_INSTALL_DIR}/setvars.sh" ]; then \ . ${CUSTOM_OV_INSTALL_DIR}/setvars.sh ; \ fi && \ @@ -301,6 +317,7 @@ RUN if [ -f "${CUSTOM_OV_INSTALL_DIR}/setvars.sh" ]; then \ --enable-gpl \ --enable-libx264 \ --enable-libx265 \ + --enable-libsvtav1 \ --enable-version3 && \ make -j16 && \ make install diff --git a/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5.dockerfile b/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5.dockerfile index 980f3b0..2608e4d 100644 --- a/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5.dockerfile +++ b/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5.dockerfile @@ -60,7 +60,7 @@ ARG PYTHON RUN apt-get update && \ apt-get install -y --no-install-recommends --fix-missing \ apt-utils cmake cython3 flex bison gcc g++ git make patch pkg-config wget \ - libdrm-dev libudev-dev libtool libusb-1.0-0-dev xz-utils ocl-icd-opencl-dev opencl-headers \ + libdrm-dev libudev-dev libtool libusb-1.0-0-dev xz-utils ocl-icd-opencl-dev opencl-headers nasm yasm \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Install Python and pip @@ -142,10 +142,22 @@ RUN mkdir -p build && cd build && \ make install && \ echo "Building iVSR SDK finished." +# Build SVT-AV1 +ARG SVTAV1_VER="v4.0.1" +ARG SVTAV1_REPO="https://gitlab.com/AOMediaCodec/SVT-AV1.git" +ARG SVTAV1_DIR=${WORKSPACE}/ivsr/svt-av1 +WORKDIR ${SVTAV1_DIR} +RUN git clone ${SVTAV1_REPO} . && \ + git checkout ${SVTAV1_VER} && \ + cd Build && \ + cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) && \ + make install + # Install FFmpeg dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ - ca-certificates tar g++ wget pkg-config nasm yasm libglib2.0-dev flex bison gobject-introspection libgirepository1.0-dev \ + ca-certificates tar g++ wget pkg-config libglib2.0-dev flex bison gobject-introspection libgirepository1.0-dev \ python3-dev libx11-dev libxv-dev libxt-dev libasound2-dev libpango1.0-dev libtheora-dev libvisual-0.4-dev libgl1-mesa-dev \ libcurl4-gnutls-dev librtmp-dev libx264-dev libx265-dev libde265-dev libva-dev && \ rm -rf /var/lib/apt/lists/* @@ -163,6 +175,10 @@ RUN for patch_file in $(find -iname "*.patch" | sort -n); do \ git am --whitespace=fix ${patch_file}; \ done +# patches for SVT-AV1 +RUN git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-unbreak-build-with-latest-svtav1.patch &&\ + git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-rename-aq_mode-for-v4.0.0.patch + RUN sed -i 's|-L${prefix}/runtime/3rdparty/tbb|-L${prefix}/runtime/3rdparty/tbb/lib|' \ ${CUSTOM_IE_DIR}/lib/intel64/pkgconfig/openvino.pc @@ -171,7 +187,7 @@ RUN source ${CUSTOM_IE_DIR}/../setupvars.sh && \ export LD_LIBRARY_PATH=${WORKSPACE}/ivsr/ivsr_sdk/lib:"$LD_LIBRARY_PATH" && \ ./configure --extra-cflags=-fopenmp --extra-ldflags=-fopenmp \ --enable-libivsr --disable-static --disable-doc --enable-shared \ - --enable-vaapi --enable-gpl --enable-libx264 --enable-libx265 --enable-version3 && \ + --enable-vaapi --enable-gpl --enable-libx264 --enable-libx265 --enable-libsvtav1 --enable-version3 && \ make -j16 && \ make install diff --git a/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5s.dockerfile b/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5s.dockerfile index cad8416..0a6383e 100644 --- a/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5s.dockerfile +++ b/ivsr_ffmpeg_plugin/dockerfiles/ubuntu22/ov2024.5s.dockerfile @@ -91,6 +91,18 @@ RUN mkdir -p build && cd build && \ make install && \ echo "Building iVSR SDK finished." +# Build SVT-AV1 +ARG SVTAV1_VER="v4.0.1" +ARG SVTAV1_REPO="https://gitlab.com/AOMediaCodec/SVT-AV1.git" +ARG SVTAV1_DIR=${WORKSPACE}/ivsr/svt-av1 +WORKDIR ${SVTAV1_DIR} +RUN git clone ${SVTAV1_REPO} . && \ + git checkout ${SVTAV1_VER} && \ + cd Build && \ + cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) && \ + make install + # Build and install FFmpeg with libopenvino support # FFmpeg setup and build ARG FFMPEG_REPO=https://github.com/FFmpeg/FFmpeg.git @@ -108,6 +120,10 @@ RUN for patch_file in $(find -iname "*.patch" | sort -n); do \ git am --whitespace=fix ${patch_file}; \ done +# patches for SVT-AV1 +RUN git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-unbreak-build-with-latest-svtav1.patch &&\ + git am --whitespace=fix ${SVTAV1_DIR}/.gitlab/workflows/linux/0001-avcodec-libsvtav1-rename-aq_mode-for-v4.0.0.patch + RUN ./configure \ --enable-gpl \ --enable-nonfree \ @@ -117,7 +133,8 @@ RUN ./configure \ --enable-version3 \ --enable-libivsr \ --enable-libx264 \ - --enable-libx265 && \ + --enable-libx265 \ + --enable-libsvtav1 && \ make -j16 && \ make install