diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3b89851 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +*.md +./Jenkinsfile* +./license* +./test* +*Dockerfile* diff --git a/.gitignore b/.gitignore index e8d2fcd..b37e845 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ build *.*proj *.*advi* config/ +raisr/ diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..8226afb --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +external-sources=true diff --git a/CMakeLists.txt b/CMakeLists.txt index 8812857..3245e9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,8 +45,8 @@ SET(CMAKE_REQUIRED_FLAGS "-march=native") check_cxx_source_runs(" #include int main(int argc, char** argv) { - _Float16 data[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; - _Float16 output[16]; + _Float16 data[32] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; + _Float16 output[32]; __m512h a = _mm512_loadu_ph(data); // avx512fp16 __m512h b = _mm512_loadu_ph(data); __mmask32 mask = _mm512_cmp_ph_mask(a, b, _CMP_EQ_OQ); // avx512fp16 diff --git a/How to build.md b/How to build.md index d74c20e..f67c32b 100644 --- a/How to build.md +++ b/How to build.md @@ -3,24 +3,24 @@ To build this project you will need: - Linux based OS - For CPU tested and validated on Ubuntu 18.04 LTS, Ubuntu 22.04 and CentOS 7.9 - For GPU tested and validated on Intel® Data Center GPU Flex 170 with Ubuntu 22.04 LTS(5.15 LTS kernel) -- [Docker](https://www.docker.com/) +- [Docker](https://www.docker.com/) - Intel Xeon hardware which supports Intel AVX512 (Skylake generation or later) - Compiler (clang++, g++, icc), and enabling AVX512-FP16 on Sapphire Rapiads needs: - clang++ version 14.0.0 or later - g++ version 12.1.0 with binutils 2.38 or later - icc version 2021.2 or later -- Cmake version 3.14 or later +- Cmake version 3.14 or later - Intel® Integrated Performance Primitives (Intel® IPP) (Stand-Alone Version is the minimum requirement) - zlib1g-dev, pkg-config (The pkg-config is used to find x264.pc/x265.pc in specific pkgconfig path.) We provide 3 ways to build the Intel VSR with FFmpeg environment: -- build docker images with dockerfiles(only for CPU). -- build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/master/scripts)(only for CPU). +- build docker images with dockerfiles(both CPU and GPU). +- build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/main/scripts)(only for CPU). - build manually(both CPU and GPU). # Build Docker Images. -We provide 3 Dockerfile for Intel Xeon platforms: Ubuntu18.04, Ubuntu22.04 and CentOS7.9. You can refer to below steps to build docker images. +We provide 3 Dockerfile for Intel Xeon platforms: Ubuntu18.04, Ubuntu22.04 and CentOS7.9, and 1 Dockerfile with Ubuntu22.04 for Intel Flex GPU. You can refer to below steps to build docker images. ## Setup docker proxy as follows if you are behind a firewall: ``` sudo mkdir -p /etc/systemd/system/docker.service.d @@ -32,23 +32,25 @@ sudo systemctl restart docker ## build docker image via docker_build.sh The usage of the script is as follows ``` -./docker_build.sh +./docker_build.sh -./docker_build.sh ubuntu 22.04 #for building Ubuntu22.04 -./docker_build.sh ubuntu 18.04 #for building Ubuntu18.04 -./docker_build.sh centos 7.9 #for building CentOS7.9 +./docker_build.sh xeon ubuntu 22.04 #for building Xeon platform with Ubuntu22.04 +./docker_build.sh xeon ubuntu 18.04 #for building Xeon platform with Ubuntu18.04 +./docker_build.sh xeon centos 7.9 #for building Xeon platform with CentOS7.9 +./docker_build.sh flex ubuntu 22.04 #for building Flex platform with Ubuntu22.04 ``` -If the image is built successfully, you can find a docker image named `raisr:ubuntu22.04` or `raisr:ubuntu18.04` or `raisr:centos7.9` with command `docker images` +If the image is built successfully, you can find a docker image named `raisr-xeon:ubuntu22.04` or `raisr-xeon:ubuntu18.04` or `raisr-xeon:centos7.9` or `raisr-flex:ubuntu22.04` with command `docker images` +Please note it needs to add `--privileged --device /dev/dri` option to access GPU hardware in docker container during run raisr-flex docker container. -# Build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/master/scripts) +# Build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/main/scripts) If the user would prefer not to use Docker, you can follow the steps below to setup enviroment: \ `cd Video-Super-Resolution-Library/scripts` \ `./01_pull_resources.sh` \ `./02_install_prerequisites.sh /xxx/raisr.tar.gz` \ `./03_build_raisr_ffmpeg.sh /xxx/raisr/Video-Super-Resolution-Library` -- [01_pull_resources.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/master/scripts/01_pull_resources.sh): Download the resources used for build Intel Library for VSR and FFmpeg(cmake 3.14, nasm, x264, x265, ipp, Intel Library for VSR and FFmpeg) and package these resource to raisr.tar.gz. -- [02_install_prerequisites.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/master/scripts/02_install_prerequisites.sh): Extract the tarball raisr.tar.gz of resources and build and install the libraries required by building Intel Library for VSR and FFmpeg. -- [03_build_raisr_ffmpeg.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/master/scripts/03_build_raisr_ffmpeg.sh): Build Intel Library for VSR and FFmpeg. +- [01_pull_resources.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/scripts/01_pull_resources.sh): Download the resources used for build Intel Library for VSR and FFmpeg(cmake 3.14, nasm, x264, x265, ipp, Intel Library for VSR and FFmpeg) and package these resource to raisr.tar.gz. +- [02_install_prerequisites.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/scripts/02_install_prerequisites.sh): Extract the tarball raisr.tar.gz of resources and build and install the libraries required by building Intel Library for VSR and FFmpeg. +- [03_build_raisr_ffmpeg.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/scripts/03_build_raisr_ffmpeg.sh): Build Intel Library for VSR and FFmpeg. # Build manually following the steps below ## Install Intel IPP @@ -66,7 +68,7 @@ The x264/x265 libraries can be installed via apt on Ubuntu OS or built and insta ### Build and install x264/x265 from source code(Option-2) -#### Build and install x264 +#### Build and install x264 `git clone https://github.com/mirror/x264 -b stable --depth 1` \ `cd x264` \ diff --git a/Library/Raisr.cpp b/Library/Raisr.cpp index d327305..e0b81be 100644 --- a/Library/Raisr.cpp +++ b/Library/Raisr.cpp @@ -73,7 +73,7 @@ static bool machine_supports_feature(MachineVendorType vendor, ASMType type) bool ret = false; unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0; - if (vendor == INTEL ) { + if (vendor == INTEL || vendor == AMD ) { __get_cpuid_count(0x7, 0x0, &eax, &ebx, &ecx, &edx); if (type == AVX512_FP16) { @@ -98,20 +98,6 @@ static bool machine_supports_feature(MachineVendorType vendor, ASMType type) } } } - else if (vendor == AMD) - { - __get_cpuid_count(0x7, 0x0, &eax, &ebx, &ecx, &edx); - if (type == AVX512_FP16) { - ret = false; - } else if (type == AVX512) { - ret = false; - } else if (type == AVX2) { - if ( (ebx >> 5) & 0x1) - { - ret = true; - } - } - } return ret; } @@ -898,7 +884,7 @@ __m256i inline modulo_imm( __m256i a, int b) { void inline write_pixeltype(int c, __m256i gPatchMargin_epi32, __m256i partone, int* out) { __m256i b = _mm256_sub_epi32( _mm256_add_epi32(_mm256_set1_epi32(c), _mm256_setr_epi32(0,1,2,3,4,5,6,7)), gPatchMargin_epi32); __m256i pixelType_epi32 = _mm256_add_epi32( partone, modulo_imm(b, gRatio) ); - _mm256_storeu_epi32(out, pixelType_epi32); + _mm256_storeu_si256((__m256i *)(out), pixelType_epi32); } RNLERRORTYPE processSegment(VideoDataType *srcY, VideoDataType *final_outY, BlendingMode blendingMode, int threadIdx) diff --git a/README.md b/README.md index 04145af..9afdaf0 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Enhanced RAISR is provided as an FFmpeg plugin inside of a Docker container(Dock - Feb 2024 : AWS and Intel announced collaboration to release Intel Library for VSR on AWS Cloud at the Mile High Video 2024 conference, technical details available at https://dl.acm.org/doi/10.1145/3638036.3640290 +We have enhanced the public RAISR algorithm to achieve better visual quality and beyond real-time performance for 2x and 1.5x upscaling on Intel® Xeon® platforms and Intel® GPUs. The Intel Library for VSR is provided as an FFmpeg plugin inside of a Docker container to help ease testing and deployment burdens. This project is developed using C++ and takes advantage of Intel® Advanced Vector Extension 512 (Intel® AVX-512) where available and newly added Intel® AVX-512FP16 support on Intel® Xeon® 4th Generation (Sapphire Rapids) and added OpenCL support on Intel® GPUs. ## How to build Please see "How to build.md" to build via scripts or manually. @@ -73,6 +74,15 @@ ffmpeg -init_hw_device vaapi=va -init_hw_device qsv=qs@va -init_hw_device opencl ffmpeg -init_hw_device vaapi=va -init_hw_device opencl=ocl@va -hwaccel vaapi -hwaccel_output_format vaapi -i input.264 -vf "hwmap=derive_device=opencl,format=opencl,raisr_opencl,hwmap=derive_device=vaapi:reverse=1:extra_hw_frames=16" -c:v hevc_vaapi output.mp4 ``` +**Even output** + +There are certain codecs that support only even resolution, the `evenoutput` parameter will support users to choose whether to make the output an even number + +Set `evenoutput=1` to make output size as even number, the following command will get 632x632 output. +``` +ffmpeg -i input.mp4 -an -vf scale=422x422,raisr=ratio=1.5:filterfolder=filters_1.5x/filters_highres:threadcount=1:evenoutput=1 output.mp4 +``` +It will keep the output resolution as the input resolution multiply by the upscaling ratio if set `evenoutput=0` or not set the parameter, will get 633x633 output with 422x422 input. ## To see help on the RAISR filter `./ffmpeg -h filter=raisr` @@ -89,6 +99,7 @@ ffmpeg -init_hw_device vaapi=va -init_hw_device opencl=ocl@va -hwaccel vaapi -hw asm ..FV....... x86 asm type: (avx512fp16, avx512, avx2 or opencl) (default "avx512fp16") platform ..FV....... select the platform (from 0 to INT_MAX) (default 0) device ..FV....... select the device (from 0 to INT_MAX) (default 0) + evenoutput ..FV....... make output size as even number (0: ignore, 1: subtract 1px if needed) (from 0 to 1) (default 0) # How to Contribute diff --git a/build.sh b/build.sh index 1f6f053..17de1f7 100755 --- a/build.sh +++ b/build.sh @@ -1,11 +1,21 @@ -#!/bin/sh +#!/bin/bash + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + +# Fails the script if any of the commands error (Other than if and some others) +set -ex -o pipefail + +SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" +. "${SCRIPT_DIR}/scripts/common.sh" +nproc="${nproc:-$(nproc)}" + # Helpful when copying and pasting functions and debuging. if printf '%s' "$0" | grep -q '\.sh'; then IN_SCRIPT=true fi -# Fails the script if any of the commands error (Other than if and some others) -set -e + cd_safe() { if (cd "$1"); then @@ -20,7 +30,7 @@ cd_safe() { # Usage: build [test] build() ( build_type=Release - echo "Create folder: build, build type: $build_type" + log_info "Create folder: build, build type: $build_type" mkdir -p build > /dev/null 2>&1 cd_safe build @@ -32,8 +42,8 @@ build() ( #cmake .. -DCMAKE_BUILD_TYPE="RelWithDebInfo" $CMAKE_EXTRA_FLAGS "$@" if [ -f Makefile ]; then - # make -j - make install -j + make -j "${nproc}" + make install -j "${nproc}" fi cd .. @@ -74,4 +84,4 @@ else fi export CXX -build $@ +build "$@" diff --git a/docker/Dockerfile.centos7.9 b/docker/Dockerfile.centos7.9 deleted file mode 100644 index af79f6e..0000000 --- a/docker/Dockerfile.centos7.9 +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) 2023 Intel Corporation. -# SPDX-License-Identifier: BSD-3-Clause - -FROM centos:centos7.9.2009 as build - -WORKDIR /opt/build -ARG PREFIX=/opt/build -ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" - -# repos for oneapi -RUN echo $'[oneAPI]\n\ -name=Intel® oneAPI repository\n\ -baseurl=https://yum.repos.intel.com/oneapi\n\ -enabled=1\n\ -gpgcheck=1\n\ -repo_gpgcheck=1\n\ -gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB\n'\ ->> /tmp/oneAPI.repo - -RUN mv /tmp/oneAPI.repo /etc/yum.repos.d - -# download and install dependencies, the ipp link is not available https://registrationcenter-download.intel.com/akdlm/irc_nas/19007/l_ipp_oneapi_p_2021.6.2.16995_offline.sh, install ipp from oneapi repo -RUN yum install -y intel-oneapi-ipp-devel git wget gcc-c++ make bzip2 zlib-devel texinfo - -# update binutils to 2.38 to support avx512fp16 instructions. -RUN wget https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.gz --no-check-certificate && \ - tar -xf binutils-2.38.tar.gz && \ - cd binutils-2.38 && \ - CC=gcc ./configure --prefix=${PREFIX} && \ - make -j$(nproc) && \ - make install - -RUN wget https://ftp.gnu.org/gnu/gcc/gcc-12.3.0/gcc-12.3.0.tar.gz --no-check-certificate && \ - tar -xvf ./gcc-12.3.0.tar.gz && \ - cd ./gcc-12.3.0 && \ - ./contrib/download_prerequisites && \ - ./configure --prefix=/usr --enable-multilib --enable-languages=c,c++ -disable-multilib && \ - make -j$(nproc) && \ - make install - -ARG CMAKE=https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz -RUN wget ${CMAKE} && \ - tar zxf ./cmake-3.14.0.tar.gz && \ - cd cmake-3.14.0 && \ - ./bootstrap --prefix=${PREFIX} && \ - make -j $(nproc) && \ - make install - -ARG NASM=https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2 -RUN wget ${NASM} --no-check-certificate && \ - tar xjf ./nasm-2.15.05.tar.bz2 && \ - cd nasm-2.15.05 && \ - ./autogen.sh && \ - ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib && \ - make -j $(nproc) && \ - make install - -ENV PATH=/opt/build/bin:$PATH -RUN git clone https://github.com/mirror/x264 -b stable --depth 1 && \ - cd x264 && \ - ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib \ - --enable-shared && \ - make -j $(nproc) && \ - make install - -ARG LIBX265=https://github.com/videolan/x265/archive/3.4.tar.gz -RUN wget ${LIBX265} && \ - tar xzf ./3.4.tar.gz && \ - cd x265-3.4/build/linux && \ - cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} -DHIGH_BIT_DEPTH=ON ../../source && \ - make -j$(nproc) && \ - make install - -# download raisr and ffmpeg -COPY . /opt/build/Video-Super-Resolution-Library -RUN git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg && \ - cd ffmpeg && \ - git checkout -b n6.0 n6.0 && \ - git config --global user.email "you@example.com" && \ - git am ../Video-Super-Resolution-Library/ffmpeg/*.patch - -RUN rm 3.4.tar.gz && \ - rm cmake-3.14.0.tar.gz && \ - rm nasm-2.15.05.tar.bz2 && \ - rm gcc-12.3.0.tar.gz && \ - rm -rf ./x264 && \ - rm -rf ./x265-3.4 && \ - rm -rf ./cmake-3.14.0 && \ - rm -rf ./nasm-2.15.05 && \ - rm -rf ./gcc-12.3.0 - -# Build raisr and ffmpeg -ENV PKG_CONFIG_PATH "/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig" - -ENV CPATH "/opt/intel/oneapi/ipp/latest/include" -ENV IPPROOT "/opt/intel/oneapi/ipp/latest" -ENV IPP_TARGET_ARCH "intel64" -ENV LD_LIBRARY_PATH "/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:/opt/intel/oneapi/ipp/latest/lib/intel64" -ENV LIBRARY_PATH "/opt/intel/oneapi/ipp/latest/lib/intel64" - -WORKDIR /opt/build/Video-Super-Resolution-Library -RUN ./build.sh - -WORKDIR /opt/build/ffmpeg -RUN cp ../Video-Super-Resolution-Library/ffmpeg/vf_raisr*.c libavfilter/ && \ - ./configure \ - --enable-libipp \ - --extra-cflags="-fopenmp" \ - --extra-ldflags=-fopenmp\ - --enable-gpl \ - --enable-libx264 \ - --enable-libx265 \ - --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ - --enable-cross-compile \ - --prefix="${PREFIX}" && \ - make clean && \ - make -j $(nproc) && \ - make install - -# cleanup -WORKDIR /opt/build - -RUN \ -ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippik0.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippin0.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippil9.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippie9.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippiy8.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippin8.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippim7.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsk0.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn0.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsl9.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippse9.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsy8.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn8.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsm7.so.10.8 /usr/local/lib && \ - cp -r ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -# Copy the raisr filters from the raisr library -RUN mkdir /raisrfolder -RUN cp -r /opt/build/Video-Super-Resolution-Library/filters* /raisrfolder - -FROM centos:centos7.9.2009 AS base - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -RUN mkdir /raisrfolder -COPY --from=build /usr/local /usr/local/ -COPY --from=build /raisrfolder /raisrfolder - -RUN ln -s /usr/local/bin/ffmpeg /raisrfolder/ffmpeg - -WORKDIR /raisrfolder -# Run ffmpeg and verify that the raisr filter is supported -RUN ffmpeg -h filter=raisr - - diff --git a/docker/Dockerfile.ubuntu18.04 b/docker/Dockerfile.ubuntu18.04 deleted file mode 100644 index f25f3d0..0000000 --- a/docker/Dockerfile.ubuntu18.04 +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright (c) 2020-2021 Intel Corporation. -# SPDX-License-Identifier: BSD-3-Clause - -# use Ubuntu 18.04 with Intel IPP -FROM intel/oneapi-basekit:devel-ubuntu18.04 as build - -RUN mkdir /opt/build -ARG PREFIX=/opt/build -ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64" - -# Use bash shell -RUN rm /bin/sh && ln -s /bin/bash /bin/sh - -# Update apt and install dependances -RUN apt-get update && apt-get install -y \ -libx265-dev \ -libx264-dev \ -zlib1g-dev \ -nasm - -# Install and configure gcc 9 -RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test -RUN apt-get -y install gcc-9 g++-9 -RUN update-alternatives \ ---install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \ ---slave /usr/bin/g++ g++ /usr/bin/g++-9 \ ---slave /usr/bin/gcov gcov /usr/bin/gcov-9 - -COPY . ${PREFIX}/Video-Super-Resolution-Library -RUN cd ${PREFIX}/Video-Super-Resolution-Library && \ - ./build.sh - -WORKDIR /opt/build -RUN git config --global user.email "you@example.com" -RUN git clone https://github.com/FFmpeg/FFmpeg ffmpeg - -WORKDIR /opt/build/ffmpeg -RUN git checkout -b n6.0 n6.0 && \ - cp /opt/build/Video-Super-Resolution-Library/ffmpeg/*.patch . && \ - cp /opt/build/Video-Super-Resolution-Library/ffmpeg/vf_raisr*.c ./libavfilter && \ - git am *.patch - -# Configure and build ffmpeg -RUN ./configure \ ---enable-libipp \ ---extra-cflags=-fopenmp \ ---extra-ldflags=-fopenmp \ ---enable-gpl \ ---enable-libx264 \ ---enable-libx265 \ ---extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ ---enable-cross-compile \ ---prefix="${PREFIX}" && \ -make clean && make -j $(nproc) && \ -make install - -# cleanup -WORKDIR /opt/build -RUN \ -ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsk0.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn0.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsl9.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippse9.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsy8.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn8.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsm7.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippik0.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippin0.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippil9.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippie9.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippiy8.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippin8.so.10.5 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippim7.so.10.5 /usr/local/lib && \ - cp -r ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -# Copy the raisr filters from the raisr library -RUN mkdir /raisrfolder -RUN cp -r /opt/build/Video-Super-Resolution-Library/filters* /raisrfolder - -FROM ubuntu:18.04 AS base - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -RUN mkdir /raisrfolder -COPY --from=build /usr/local /usr/local/ -COPY --from=build /raisrfolder /raisrfolder - -RUN ln -s /usr/local/bin/ffmpeg /raisrfolder/ffmpeg - -WORKDIR /raisrfolder -# Run ffmpeg and verify that the raisr filter is supported -RUN ffmpeg -h filter=raisr - diff --git a/docker/Dockerfile.ubuntu22.04 b/docker/Dockerfile.ubuntu22.04 deleted file mode 100644 index e01de40..0000000 --- a/docker/Dockerfile.ubuntu22.04 +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (c) 2020-2021 Intel Corporation. -# SPDX-License-Identifier: BSD-3-Clause - -# use Ubuntu 22.04 with Intel IPP -FROM intel/oneapi-basekit:2023.2-devel-ubuntu22.04 as build - -RUN mkdir /opt/build -ARG PREFIX=/opt/build -ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64" - -RUN rm /bin/sh && ln -s /bin/bash /bin/sh - -# Update apt and install dependances -RUN rm /etc/apt/sources.list.d/oneAPI.list && \ -apt-get update && apt-get install -y \ -libx265-dev \ -libx264-dev \ -zlib1g-dev \ -nasm \ -cmake - -COPY . ${PREFIX}/Video-Super-Resolution-Library -RUN cd ${PREFIX}/Video-Super-Resolution-Library && \ - ./build.sh - -WORKDIR /opt/build -RUN git config --global user.email "you@example.com" -RUN git clone https://github.com/FFmpeg/FFmpeg ffmpeg -WORKDIR /opt/build/ffmpeg -RUN git checkout -b n6.0 n6.0 && \ - cp /opt/build/Video-Super-Resolution-Library/ffmpeg/*.patch . && \ - cp /opt/build/Video-Super-Resolution-Library/ffmpeg/vf_raisr*.c ./libavfilter && \ - git am *.patch - -# Configure and build ffmpeg -RUN ./configure \ ---enable-libipp \ ---extra-cflags=-fopenmp \ ---extra-ldflags=-fopenmp \ ---enable-gpl \ ---enable-libx264 \ ---enable-libx265 \ ---extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ ---enable-cross-compile \ ---prefix="${PREFIX}" && \ -make clean && make -j $(nproc) && \ -make install - -# cleanup -WORKDIR /opt/build -RUN \ -ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippik0.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsk0.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn0.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsl9.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippse9.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsy8.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn8.so.10.8 /usr/local/lib && \ - cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsm7.so.10.8 /usr/local/lib && \ - cp -r ${PREFIX}/bin/* /usr/local/bin/ && \ - cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ - LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ - cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ - mkdir -p /usr/local/lib/pkgconfig && \ - for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ - sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ - done - -# Copy the raisr filters from the raisr library -RUN mkdir /raisrfolder -RUN cp -r /opt/build/Video-Super-Resolution-Library/filters* /raisrfolder - -FROM ubuntu:22.04 AS base - -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 - -RUN mkdir /raisrfolder -COPY --from=build /usr/local /usr/local/ -COPY --from=build /raisrfolder /raisrfolder - -RUN ln -s /usr/local/bin/ffmpeg /raisrfolder/ffmpeg - -WORKDIR /raisrfolder -# Run ffmpeg and verify that the raisr filter is supported -RUN ffmpeg -h filter=raisr - diff --git a/docker/Flex/Dockerfile.ubuntu22.04 b/docker/Flex/Dockerfile.ubuntu22.04 new file mode 100644 index 0000000..c21aeb8 --- /dev/null +++ b/docker/Flex/Dockerfile.ubuntu22.04 @@ -0,0 +1,217 @@ +# syntax=docker/dockerfile:1 + +# Copyright (c) 2020-2021 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause + +# use Ubuntu 22.04 with Intel IPP +FROM intel/oneapi-basekit:2023.2-devel-ubuntu22.04 AS build + +ARG SVT_AV1_VER=v2.1.2 +ARG SVT_VP9_VER=v0.3.0 +ARG LIBVPX_VER=03265cd42b3783532de72f2ded5436652e6f5ce3 +ARG GMMLIB_VER=22.4.1 +ARG LIBVA2_VER=2.22.0 +ARG LIBVA_UTILS_VER=2.22.0 +ARG MEDIA_DRIVER_VER=24.2.5 +ARG FFMPEG_VER="n6.1.1" + +ARG SVT_AV1_REPO=https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/${SVT_AV1_VER}/SVT-AV1-${SVT_AV1_VER}.tar.gz +ARG SVT_VP9_REPO=https://github.com/OpenVisualCloud/SVT-VP9/archive/refs/tags/${SVT_VP9_VER}.tar.gz +ARG LIBVPX_REPO=https://chromium.googlesource.com/webm/libvpx.git/+archive/${LIBVPX_VER}.tar.gz +ARG GMMLIB_REPO=https://github.com/intel/gmmlib/archive/refs/tags/intel-gmmlib-${GMMLIB_VER}.tar.gz +ARG LIBVA2_REPO=https://github.com/intel/libva/archive/${LIBVA2_VER}.tar.gz +ARG LIBVA_UTILS_REPO=https://github.com/intel/libva-utils/archive/${LIBVA_UTILS_VER}.tar.gz +ARG MEDIA_DRIVER_REPO=https://github.com/intel/media-driver/archive/intel-media-${MEDIA_DRIVER_VER}.tar.gz +ARG FFMPEG_REPO=https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_VER}.tar.gz + +ARG PREFIX=/opt/build +ARG DL_PREFIX=/opt + +ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:$LD_LIBRARY_PATH" +ENV PKG_CONFIG_PATH="/opt/build/lib/pkgconfig:$PKG_CONFIG_PATH" +ENV DEBIAN_FRONTEND="noninteractive" +ENV TZ="Europe/Warsaw" + +# Update apt and install dependances +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR ${PREFIX} +RUN rm /etc/apt/sources.list.d/oneAPI.list && \ + apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + ca-certificates \ + automake libdrm-dev libtool libx11-dev libxext-dev libxfixes-dev libwayland-dev \ + cmake \ + curl \ + libx265-dev \ + libx264-dev \ + zlib1g-dev \ + nasm \ + opencl-headers \ + ocl-icd-opencl-dev \ + libpciaccess-dev \ + yasm && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# build svt av1 +WORKDIR ${DL_PREFIX}/SVT-AV1/Build/linux +RUN curl -Lf ${SVT_AV1_REPO} | tar zx --strip-components=1 -C "${DL_PREFIX}/SVT-AV1" && \ + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib -DCMAKE_ASM_NASM_COMPILER=yasm ../.. && \ + make -j "$(nproc)" && \ + make install + +# build svt vp9 +WORKDIR ${DL_PREFIX}/SVT-VP9/Build/linux +RUN curl -Lf ${SVT_VP9_REPO} | tar zx --strip-components=1 -C "${DL_PREFIX}/SVT-VP9" && \ + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib -DCMAKE_ASM_NASM_COMPILER=yasm ../.. && \ + make -j "$(nproc)" && \ + make install + +# build libvpx +WORKDIR ${DL_PREFIX}/libvpx +RUN curl -Lf ${LIBVPX_REPO} | tar zx --strip-components=0 -C "${DL_PREFIX}/libvpx" && \ + ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib --enable-shared --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=nasm && \ + make -j"$(nproc)" && \ + make install + +# build gmmlib +WORKDIR ${DL_PREFIX}/gmmlib/build +RUN curl -Lf ${GMMLIB_REPO} | tar xz --strip-components=1 -C "${DL_PREFIX}/gmmlib" && \ + cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib .. && \ + make -j"$(nproc)" && \ + make install + +# build libva2 +WORKDIR ${DL_PREFIX}/libva +RUN curl -Lf ${LIBVA2_REPO} | tar xz --strip-components=1 -C "${DL_PREFIX}/libva" && \ + ./autogen.sh --prefix=${PREFIX} --libdir=${PREFIX}/lib && \ + make -j"$(nproc)" && \ + make install + +# build libva-utils +WORKDIR ${DL_PREFIX}/libva-utils +RUN curl -Lf ${LIBVA_UTILS_REPO} | tar xz --strip-components=1 -C "${DL_PREFIX}/libva-utils" && \ + ./autogen.sh --prefix=${PREFIX} --libdir=${PREFIX}/lib && \ + make -j"$(nproc)" && \ + make install + +# build media driver +WORKDIR ${DL_PREFIX}/media-driver-intel-media/build +RUN curl -Lf ${MEDIA_DRIVER_REPO} | tar xz --strip-components=1 -C "${DL_PREFIX}/media-driver-intel-media" && \ + cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib -DENABLE_PRODUCTION_KMD=ON .. && \ + make -j"$(nproc)" && \ + make install + +WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library +COPY . ${DL_PREFIX}/Video-Super-Resolution-Library +RUN ./build.sh -DENABLE_RAISR_OPENCL=ON + +WORKDIR ${DL_PREFIX}/ffmpeg +RUN curl -Lf "${FFMPEG_REPO}" | \ + tar -zx --strip-components=1 -C ${DL_PREFIX}/ffmpeg && \ + git -C "${DL_PREFIX}/ffmpeg" apply --whitespace=fix ${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/*.patch && \ + cp ${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr*.c ${DL_PREFIX}/ffmpeg/libavfilter + +# Configure and build ffmpeg +WORKDIR ${DL_PREFIX}/ffmpeg +RUN ./configure \ + --enable-libipp \ + --extra-cflags=-fopenmp \ + --extra-ldflags=-fopenmp \ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ + --enable-cross-compile \ + --enable-opencl \ + --enable-vaapi \ + --enable-libsvtav1 \ + --enable-libvpx \ + --prefix="${PREFIX}" && \ + make clean && \ + make -j $(nproc) && \ + make install + +# cleanup +WORKDIR ${PREFIX} +RUN mkdir -p ${PREFIX}/usr/lib && \ + ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} ${PREFIX}/usr/lib/ && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippik0.so.10.8 ${PREFIX}/usr/lib && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsk0.so.10.8 ${PREFIX}/usr/lib && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn0.so.10.8 ${PREFIX}/usr/lib && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsl9.so.10.8 ${PREFIX}/usr/lib && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippse9.so.10.8 ${PREFIX}/usr/lib && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsy8.so.10.8 ${PREFIX}/usr/lib && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn8.so.10.8 ${PREFIX}/usr/lib && \ + cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsm7.so.10.8 ${PREFIX}/usr/lib && \ + LD_LIBRARY_PATH=${PREFIX}/usr/lib:/usr/local/lib64 /opt/build/bin/ffmpeg -buildconf && \ + mv ${PREFIX}/bin ${PREFIX}/usr/bin && \ + mv ${PREFIX}/lib ${PREFIX}/usr/local/ + +FROM ubuntu:22.04 AS base + +LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" +LABEL org.opencontainers.image.title="Intel® Library with OpenCL for Video Super Resolution" +LABEL org.opencontainers.image.description="Intel® Library with OpenCL for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Ubuntu 22.04 Docker image." +LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel® Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 +ENV LIBVA_DRIVERS_PATH=/usr/local/lib/dri + +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] + +WORKDIR /opt/raisrfolder +COPY --from=build /opt/build / +COPY ./filters_1.5x/ /opt/raisrfolder/filters_1.5x/ +COPY ./filters_2x/ /opt/raisrfolder/filters_2x/ + +RUN apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + sudo \ + curl \ + ca-certificates \ + gpg \ + libx264-1* \ + libx265-1* \ + unzip \ + libpcre3 \ + libpcre3-dev \ + libssl-dev \ + gcc \ + zlib1g-dev \ + make && \ + curl -fsSL https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor | tee /usr/share/keyrings/intel-graphics-archive-keyring.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/intel-graphics-archive-keyring.gpg arch=amd64] https://repositories.intel.com/graphics/ubuntu jammy flex" > /etc/apt/sources.list.d/intel-graphics.list && \ + apt-get update --fix-missing && \ + apt-get install --no-install-recommends -y \ + intel-opencl-icd \ + intel-level-zero-gpu && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + ln -s /usr/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ + mkdir -p /opt/nginx /opt/nginx-rtmp-module && \ + curl -Lf https://github.com/arut/nginx-rtmp-module/archive/refs/heads/master.tar.gz | tar xz --strip-components=1 -C "/opt/nginx-rtmp-module" && \ + curl -Lf http://nginx.org/download/nginx-1.24.0.tar.gz | tar xz --strip-components=1 -C "/opt/nginx" + +# Run ffmpeg and verify that the raisr filter is supported +RUN ffmpeg -h filter=raisr + +# install ngnix +WORKDIR /opt/nginx +RUN ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module && \ + make -j $(nproc) && \ + make install && \ + rm -rf nginx-rtmp-module nginx + +# copy nignx.conf file +COPY docker/Flex/nginx.conf /usr/local/nginx/conf/ +WORKDIR /opt/raisrfolder +SHELL ["/bin/bash", "-c"] +CMD ["-h", "filter=raisr"] +ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] diff --git a/docker/Flex/nginx.conf b/docker/Flex/nginx.conf new file mode 100644 index 0000000..5f6f9be --- /dev/null +++ b/docker/Flex/nginx.conf @@ -0,0 +1,53 @@ +worker_processes auto; +pid /run/nginx.pid; + +events { + worker_connections 1024; +} + +rtmp { + server { + listen 1935; + application live { + live on; + hls on; + hls_path /usr/local/nginx/html/hls; + hls_fragment 10s; + dash on; + dash_path /usr/local/nginx/html/dash; + } + } +} + +http { + server { + listen 80; + location / { + root /usr/local/nginx/html; + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length'; + } + + location /hls { + alias /usr/local/nginx/html/hls; + add_header Cache-Control no-cache; + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length'; + types { + application/vnd.apple.mpegurl m3u8; + video/mp2t ts; + } + } + + location /dash { + alias /usr/local/nginx/html/dash; + add_header Cache-Control no-cache; + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length'; + types { + application/dash+xml mpd; + } + } + } +} + diff --git a/docker/Xeon/Dockerfile.centos9 b/docker/Xeon/Dockerfile.centos9 new file mode 100644 index 0000000..bfb4aa1 --- /dev/null +++ b/docker/Xeon/Dockerfile.centos9 @@ -0,0 +1,144 @@ +# syntax=docker/dockerfile:1 + +# +# Copyright (c) 2020-2021 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause +# + +FROM quay.io/centos/centos:stream9 AS build + +ARG DL_PREFIX=/opt +ARG PREFIX=/opt/build +ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" +ARG FFMPEG_COMMIT_ID="n6.1.1" +ENV TZ="Europe/Warsaw" + +ARG ONEAPI_LINK="https://registrationcenter-download.intel.com/akdlm/IRC_NAS/046b1402-c5b8-4753-9500-33ffb665123f/l_ipp_oneapi_p_2021.10.1.16_offline.sh" +ARG NASM_RPM_LINK="https://rpmfind.net/linux/centos-stream/9-stream/CRB/x86_64/os/Packages/nasm-2.15.03-7.el9.x86_64.rpm" + +COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d + +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR "${PREFIX}" +RUN yum install -y \ + bash \ + git \ + make \ + cmake \ + glibc \ + bzip2 \ + zlib-devel \ + texinfo \ + intel-oneapi-ipp-devel \ + gcc-toolset-12-gcc-c++ \ + gcc-toolset-12-gcc \ + gcc-toolset-12-binutils && \ + curl -Lf "${NASM_RPM_LINK}" -o "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + yum localinstall -y "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + rm -f "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + yum group list && \ + yum group install "Development Tools" -y && \ + yum clean all && \ + rm -rf /var/cache/yum + +WORKDIR ${DL_PREFIX}/libx264 +RUN git clone https://github.com/mirror/x264 -b stable --depth 1 . && \ + ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib --enable-shared && \ + make -j $(nproc) && \ + make install + +WORKDIR ${DL_PREFIX}/libx265/build/linux +RUN curl -Lf https://github.com/videolan/x265/archive/3.4.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/libx265/" && \ + cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} -DHIGH_BIT_DEPTH=ON ../../source && \ + make -j$(nproc) && \ + make install + +ENV IPPROOT="/opt/intel/oneapi/ipp/latest" +ENV IP_PPREFIX="/opt/intel/oneapi/ipp/latest" +ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig" +ENV CPATH="${IPPROOT}/include:${IPPROOT}/include/ipp" +ENV IPP_TARGET_ARCH="intel64" +ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:${IPPROOT}/lib/intel64" +ENV LIBRARY_PATH="${IPPROOT}/lib/intel64" + +WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library +COPY . ${DL_PREFIX}/Video-Super-Resolution-Library +RUN mkdir -p "${DL_PREFIX}/ffmpeg" && \ + curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" && \ + git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ + cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ + ./build.sh + +WORKDIR ${DL_PREFIX}/ffmpeg +RUN ./configure \ + --enable-libipp \ + --extra-cflags="-fopenmp" \ + --extra-ldflags=-fopenmp\ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ + --enable-cross-compile \ + --prefix="${PREFIX}" && \ + make clean && \ + make -j $(nproc) && \ + make install && \ + rm -rf ${DL_PREFIX}/libx265 ${DL_PREFIX}/libx264 + +ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64/" +WORKDIR ${PREFIX}/usr/local/lib +RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ + mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ + rm -rf ${PREFIX}/share ${PREFIX}/include ${PREFIX}/lib && \ + LD_LIBRARY_PATH="${PREFIX}/usr/local/lib:${LIBIPP}" ${PREFIX}/usr/local/bin/ffmpeg -buildconf + +FROM quay.io/centos/centos:stream9 AS base + +LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com" +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" +LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" +LABEL org.opencontainers.image.description="Intel® Library for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Centos::stream9 image." +LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel® Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ARG PREFIX=/opt/build +ENV TZ=Europe/Warsaw + +ENV IPP_TARGET_ARCH="intel64" +ENV IPPROOT="/opt/intel/oneapi/redist" +ENV LIBIPP="${IPPROOT}/lib" +ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64:${LIBIPP}" + +COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR /opt/raisrfolder +RUN yum install -y \ + sudo \ + bash \ + make \ + intel-oneapi-runtime-ipp && \ + yum clean all && \ + rm -rf /var/cache/yum && \ + groupadd -g 2110 vfio && \ + useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ + usermod -aG wheel raisr + +COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x +COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x +COPY --chown=raisr:raisr --from=build ${PREFIX} / + +RUN ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ + ldconfig && \ + /usr/local/bin/ffmpeg -buildconf && \ + ffmpeg -h filter=raisr + +# USER "raisr" +HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 + +SHELL ["/bin/bash", "-c"] +CMD ["-h", "filter=raisr"] +ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] diff --git a/docker/Xeon/Dockerfile.rockylinux9 b/docker/Xeon/Dockerfile.rockylinux9 new file mode 100644 index 0000000..8b7a812 --- /dev/null +++ b/docker/Xeon/Dockerfile.rockylinux9 @@ -0,0 +1,138 @@ +# syntax=docker/dockerfile:1 + +# +# Copyright (c) 2020-2021 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause +# + +# BROKEN BUILD DUE TU UPDATED VERSION OF BASEKIT +# INSTEAD THE MINI VERSION IS BEING BUILD USING +# OFFLINE INSTALLER + +ARG IMAGE_CACHE_REGISTRY=docker.io +ARG IMAGE_NAME=intel/oneapi-basekit:2024.0.0-devel-rockylinux9 +FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build +RUN echo "ERROR!" && exit 1 + +ARG DL_PREFIX=/opt +ARG PREFIX=/opt/build +ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" +ARG FFMPEG_COMMIT_ID="n6.1.1" +ENV TZ="Europe/Warsaw" + +ARG NASM_RPM_LINK="https://rpmfind.net/linux/centos-stream/9-stream/CRB/x86_64/os/Packages/nasm-2.15.03-7.el9.x86_64.rpm" + +WORKDIR "${PREFIX}" +COPY . ${DL_PREFIX}/Video-Super-Resolution-Library + +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR "${DL_PREFIX}/ffmpeg" +RUN yum install -y \ + bash \ + git \ + make \ + cmake \ + glibc \ + bzip2 \ + zlib-devel && \ + curl -Lf "${NASM_RPM_LINK}" -o "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + yum localinstall -y "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + rm -f "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + yum group list && \ + yum group install "Development Tools" -y && \ + yum clean all && \ + rm -rf /var/cache/yum + +WORKDIR ${DL_PREFIX}/libx264 +RUN git clone https://github.com/mirror/x264 -b stable --depth 1 . && \ + ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib --enable-shared && \ + make -j $(nproc) && \ + make install + +WORKDIR ${DL_PREFIX}/libx265/build/linux +RUN curl -Lf https://github.com/videolan/x265/archive/3.4.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/libx265/" && \ + cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} -DHIGH_BIT_DEPTH=ON ../../source && \ + make -j$(nproc) && \ + make install + +ENV IPPROOT="/opt/intel/oneapi/ipp/latest" +ENV IP_PPREFIX="/opt/intel/oneapi/ipp/latest" +ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig" +ENV CPATH="${IPPROOT}/include:${IPPROOT}/include/ipp" +ENV IPP_TARGET_ARCH="intel64" +ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:${IPPROOT}/lib/intel64" +ENV LIBRARY_PATH="${IPPROOT}/lib/intel64" + +WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library +RUN curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" && \ + git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ + cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ + ./build.sh + +WORKDIR ${DL_PREFIX}/ffmpeg +RUN ./configure \ + --enable-libipp \ + --extra-cflags="-fopenmp" \ + --extra-ldflags=-fopenmp\ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ + --enable-cross-compile \ + --prefix="${PREFIX}" && \ + make clean && \ + make -j $(nproc) && \ + make install && \ + rm -rf ${DL_PREFIX}/libx265 ${DL_PREFIX}/libx264 + +WORKDIR ${PREFIX}/usr/local/lib +RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ + mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ + rm -rf ${PREFIX}/share ${PREFIX}/include ${PREFIX}/lib + +ARG IMAGE_CACHE_REGISTRY +FROM ${IMAGE_CACHE_REGISTRY}/library/rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 AS base + +LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com" +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" +LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" +LABEL org.opencontainers.image.description="Intel® Library for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Centos::stream9 image." +LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel® Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ARG PREFIX=/opt/build +ENV TZ=Europe/Warsaw +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/opt/intel/oneapi/redist/lib +WORKDIR /opt/raisrfolder + +COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d +RUN yum install -y \ + sudo \ + vim \ + bash \ + intel-oneapi-runtime-ipp && \ + yum clean all && \ + rm -rf /var/cache/yum && \ + groupadd -g 2110 vfio && \ + useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ + usermod -aG wheel raisr + +COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x +COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x +COPY --chown=raisr:raisr --from=build ${PREFIX} / + +RUN ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ + ldconfig && \ + ffmpeg -h filter=raisr + +# x264-libs # x265-libs +# USER "raisr" +HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 + +SHELL ["/bin/bash", "-c"] +CMD ["-h", "filter=raisr"] +ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] diff --git a/docker/Xeon/Dockerfile.rockylinux9-mini b/docker/Xeon/Dockerfile.rockylinux9-mini new file mode 100644 index 0000000..b71efc3 --- /dev/null +++ b/docker/Xeon/Dockerfile.rockylinux9-mini @@ -0,0 +1,138 @@ +# syntax=docker/dockerfile:1 + +# +# Copyright (c) 2020-2021 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause +# + +ARG IMAGE_CACHE_REGISTRY=docker.io +ARG IMAGE_NAME=library/rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 +FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build + +ARG DL_PREFIX=/opt +ARG PREFIX=/opt/build +ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" +ARG FFMPEG_COMMIT_ID="n6.1.1" +ENV TZ="Europe/Warsaw" + +ARG NASM_RPM_LINK="https://rpmfind.net/linux/centos-stream/9-stream/CRB/x86_64/os/Packages/nasm-2.15.03-7.el9.x86_64.rpm" + +WORKDIR "${PREFIX}" +COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d +COPY . ${DL_PREFIX}/Video-Super-Resolution-Library + +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR "${DL_PREFIX}/ffmpeg" +RUN yum install -y \ + bash \ + git \ + make \ + cmake \ + glibc \ + bzip2 \ + zlib-devel \ + intel-oneapi-ipp-devel \ + gcc-toolset-12-gcc-c++ \ + gcc-toolset-12-gcc \ + gcc-toolset-12-binutils && \ + curl -Lf "${NASM_RPM_LINK}" -o "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + yum localinstall -y "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + rm -f "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ + yum group list && \ + yum group install "Development Tools" -y && \ + yum clean all && \ + rm -rf /var/cache/yum + +WORKDIR ${DL_PREFIX}/libx264 +RUN git clone https://github.com/mirror/x264 -b stable --depth 1 . && \ + ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib --enable-shared && \ + make -j $(nproc) && \ + make install + +WORKDIR ${DL_PREFIX}/libx265/build/linux +RUN curl -Lf https://github.com/videolan/x265/archive/3.4.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/libx265/" && \ + cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} -DHIGH_BIT_DEPTH=ON ../../source && \ + make -j$(nproc) && \ + make install + +ENV IPPROOT="/opt/intel/oneapi/ipp/latest" +ENV IP_PPREFIX="/opt/intel/oneapi/ipp/latest" +ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig" +ENV CPATH="${IPPROOT}/include:${IPPROOT}/include/ipp" +ENV IPP_TARGET_ARCH="intel64" +ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:${IPPROOT}/lib/intel64" +ENV LIBRARY_PATH="${IPPROOT}/lib/intel64" + +WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library +RUN curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" && \ + git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ + cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ + ./build.sh + +WORKDIR ${DL_PREFIX}/ffmpeg +RUN ./configure \ + --enable-libipp \ + --extra-cflags="-fopenmp" \ + --extra-ldflags=-fopenmp\ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ + --enable-cross-compile \ + --prefix="${PREFIX}" && \ + make clean && \ + make -j $(nproc) && \ + make install && \ + rm -rf ${DL_PREFIX}/libx265 ${DL_PREFIX}/libx264 + +WORKDIR ${PREFIX}/usr/local/lib +RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ + mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ + rm -rf ${PREFIX}/share ${PREFIX}/include ${PREFIX}/lib + +ARG IMAGE_CACHE_REGISTRY +FROM ${IMAGE_CACHE_REGISTRY}/library/rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 AS base + +LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com" +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" +LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" +LABEL org.opencontainers.image.description="Intel® Library for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Centos::stream9 image." +LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel® Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ARG PREFIX=/opt/build +ENV TZ=Europe/Warsaw +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/opt/intel/oneapi/redist/lib +WORKDIR /opt/raisrfolder + +COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d +RUN yum install -y \ + sudo \ + vim \ + bash \ + intel-oneapi-runtime-ipp && \ + yum clean all && \ + rm -rf /var/cache/yum && \ + groupadd -g 2110 vfio && \ + useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ + usermod -aG wheel raisr + +COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x +COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x +COPY --chown=raisr:raisr --from=build ${PREFIX} / + +RUN ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ + ldconfig && \ + ffmpeg -h filter=raisr + +# x264-libs # x265-libs +# USER "raisr" +HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 + +SHELL ["/bin/bash", "-c"] +CMD ["-h", "filter=raisr"] +ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] diff --git a/docker/Xeon/Dockerfile.ubuntu18.04 b/docker/Xeon/Dockerfile.ubuntu18.04 new file mode 100644 index 0000000..64810ac --- /dev/null +++ b/docker/Xeon/Dockerfile.ubuntu18.04 @@ -0,0 +1,125 @@ +# syntax=docker/dockerfile:1 + +# Copyright (c) 2020-2021 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause + +# use Ubuntu 18.04 with Intel IPP +ARG IMAGE_CACHE_REGISTRY=docker.io +ARG IMAGE_NAME=intel/oneapi-basekit:devel-ubuntu18.04 +FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build + +ARG PREFIX=/opt/build +ARG DL_PREFIX=/opt + +ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" +ENV DEBIAN_FRONTEND="noninteractive" +ENV TZ="Europe/Warsaw" +ARG FFMPEG_COMMIT_ID="n6.1.1" + +WORKDIR ${DL_PREFIX}/ffmpeg +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +RUN rm /etc/apt/sources.list.d/oneAPI.list && \ + add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ + apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + git tar ca-certificates \ + libx265-dev \ + libx264-dev \ + zlib1g-dev \ + nasm \ + gcc-9 \ + g++-9 && \ + update-alternatives \ + --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-9 \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-9 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" + + +COPY . ${DL_PREFIX}/Video-Super-Resolution-Library + +WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library +RUN git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ + cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ + ./build.sh + +WORKDIR ${DL_PREFIX}/ffmpeg +RUN ./configure \ + --enable-libipp \ + --extra-cflags=-fopenmp \ + --extra-ldflags=-fopenmp \ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ + --enable-cross-compile \ + --prefix="${PREFIX}" && \ + make clean && make -j $(nproc) && \ + make install + +ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64" +WORKDIR ${PREFIX}/usr/local/lib +RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ + cp ${LIBIPP}/libippsk0.so.10.5 . && \ + cp ${LIBIPP}/libippsn0.so.10.5 . && \ + cp ${LIBIPP}/libippsl9.so.10.5 . && \ + cp ${LIBIPP}/libippse9.so.10.5 . && \ + cp ${LIBIPP}/libippsy8.so.10.5 . && \ + cp ${LIBIPP}/libippsn8.so.10.5 . && \ + cp ${LIBIPP}/libippsm7.so.10.5 . && \ + cp ${LIBIPP}/libippik0.so.10.5 . && \ + cp ${LIBIPP}/libippil9.so.10.5 . && \ + mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ + LD_LIBRARY_PATH=${PREFIX}/usr/local/lib ${PREFIX}/usr/local/bin/ffmpeg -buildconf && \ + rm -rf ${PREFIX}/include/ ${PREFIX}/share/ ${PREFIX}/lib/ + +ARG IMAGE_CACHE_REGISTRY +FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:18.04@sha256:152dc042452c496007f07ca9127571cb9c29697f42acbfad72324b2bb2e43c98 AS base + +LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" +LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" +LABEL org.opencontainers.image.description="Intel® Library for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Ubuntu 18.04 Docker image." +LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel® Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ARG PREFIX=/opt/build +ENV TZ=Europe/Warsaw +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR /opt/raisrfolder +RUN apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + sudo \ + ca-certificates \ + libx264-1* \ + libx265-1* && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + groupadd -g 2110 vfio && \ + useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ + usermod -aG sudo raisr + +COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x +COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x +COPY --chown=raisr:raisr --from=build ${PREFIX} / + +# Run ffmpeg and verify that the raisr filter is supported +RUN ldconfig && \ + ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ + /opt/raisrfolder/ffmpeg -h filter=raisr + +USER "raisr" +HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 + +SHELL ["/bin/bash", "-c"] +CMD ["-h", "filter=raisr"] +ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] diff --git a/docker/Xeon/Dockerfile.ubuntu20.04 b/docker/Xeon/Dockerfile.ubuntu20.04 new file mode 100644 index 0000000..400680a --- /dev/null +++ b/docker/Xeon/Dockerfile.ubuntu20.04 @@ -0,0 +1,117 @@ +# syntax=docker/dockerfile:1 + +# Copyright (c) 2020-2021 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause + +# use Ubuntu 20.04 with Intel IPP +ARG IMAGE_CACHE_REGISTRY=docker.io +ARG IMAGE_NAME=intel/oneapi-basekit:2023.2.1-devel-ubuntu20.04 +FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build + +ARG PREFIX=/opt/build +ARG DL_PREFIX=/opt + +ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" +ENV DEBIAN_FRONTEND="noninteractive" +ENV TZ="Europe/Warsaw" +ARG FFMPEG_COMMIT_ID="n6.1.1" + +WORKDIR ${DL_PREFIX}/ffmpeg +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +RUN rm /etc/apt/sources.list.d/oneAPI.list && \ + apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + libx265-dev \ + libx264-dev \ + zlib1g-dev \ + nasm \ + cmake && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" + +COPY . ${DL_PREFIX}/Video-Super-Resolution-Library + +WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library +RUN git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ + cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ + ./build.sh + + # Configure and build ffmpeg +WORKDIR ${DL_PREFIX}/ffmpeg +RUN ./configure \ + --enable-libipp \ + --extra-cflags=-fopenmp \ + --extra-ldflags=-fopenmp \ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ + --enable-cross-compile \ + --prefix="${PREFIX}" && \ + make clean && make -j $(nproc) && \ + make install + +ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64" +WORKDIR ${PREFIX}/usr/local/lib +RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ + cp ${LIBIPP}/libippsk0.so.10.8 . && \ + cp ${LIBIPP}/libippsn0.so.10.8 . && \ + cp ${LIBIPP}/libippsl9.so.10.8 . && \ + cp ${LIBIPP}/libippse9.so.10.8 . && \ + cp ${LIBIPP}/libippsy8.so.10.8 . && \ + cp ${LIBIPP}/libippsn8.so.10.8 . && \ + cp ${LIBIPP}/libippsm7.so.10.8 . && \ + cp ${LIBIPP}/libippik0.so.10.8 . && \ + cp ${LIBIPP}/libippil9.so.10.8 . && \ + mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ + LD_LIBRARY_PATH=${PREFIX}/usr/local/lib ${PREFIX}/usr/local/bin/ffmpeg -buildconf && \ + rm -rf ${PREFIX}/include/ ${PREFIX}/share/ ${PREFIX}/lib/ + +ARG IMAGE_CACHE_REGISTRY +FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:20.04@sha256:fa17826afb526a9fc7250e0fbcbfd18d03fe7a54849472f86879d8bf562c629e AS base + +LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" +LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" +LABEL org.opencontainers.image.description="Intel® Library for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Ubuntu 22.04 Docker image." +LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel® Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ARG PREFIX=/opt/build +ENV TZ=Europe/Warsaw +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR /opt/raisrfolder +RUN apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + sudo \ + ca-certificates \ + libx264-1* \ + libx265-1* && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + groupadd -g 2110 vfio && \ + useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ + usermod -aG sudo raisr + +COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x +COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x +COPY --chown=raisr:raisr --from=build ${PREFIX} / + +RUN ldconfig && \ + ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ + /opt/raisrfolder/ffmpeg -h filter=raisr + +USER "raisr" +HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 + +SHELL ["/bin/bash", "-c"] +CMD ["-h", "filter=raisr"] +ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] diff --git a/docker/Xeon/Dockerfile.ubuntu22.04 b/docker/Xeon/Dockerfile.ubuntu22.04 new file mode 100644 index 0000000..9e7cf9c --- /dev/null +++ b/docker/Xeon/Dockerfile.ubuntu22.04 @@ -0,0 +1,117 @@ +# syntax=docker/dockerfile:1 + +# Copyright (c) 2020-2021 Intel Corporation. +# SPDX-License-Identifier: BSD-3-Clause + +# use Ubuntu 22.04 with Intel IPP +ARG IMAGE_CACHE_REGISTRY=docker.io +ARG IMAGE_NAME=intel/oneapi-basekit:2023.2.1-devel-ubuntu22.04 +FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build + +ARG PREFIX=/opt/build +ARG DL_PREFIX=/opt + +ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" +ENV DEBIAN_FRONTEND="noninteractive" +ENV TZ="Europe/Warsaw" +ARG FFMPEG_COMMIT_ID="n6.1.1" + +WORKDIR ${DL_PREFIX}/ffmpeg +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +RUN rm /etc/apt/sources.list.d/oneAPI.list && \ + apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + libx265-dev \ + libx264-dev \ + zlib1g-dev \ + nasm \ + cmake && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ + tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" + +COPY . ${DL_PREFIX}/Video-Super-Resolution-Library + +WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library +RUN git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ + cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ + ./build.sh + +# Configure and build ffmpeg +WORKDIR ${DL_PREFIX}/ffmpeg +RUN ./configure \ + --enable-libipp \ + --extra-cflags=-fopenmp \ + --extra-ldflags=-fopenmp \ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ + --enable-cross-compile \ + --prefix="${PREFIX}" && \ + make clean && make -j $(nproc) && \ + make install + +ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64" +WORKDIR ${PREFIX}/usr/local/lib +RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ + cp ${LIBIPP}/libippsk0.so.10.8 . && \ + cp ${LIBIPP}/libippsn0.so.10.8 . && \ + cp ${LIBIPP}/libippsl9.so.10.8 . && \ + cp ${LIBIPP}/libippse9.so.10.8 . && \ + cp ${LIBIPP}/libippsy8.so.10.8 . && \ + cp ${LIBIPP}/libippsn8.so.10.8 . && \ + cp ${LIBIPP}/libippsm7.so.10.8 . && \ + cp ${LIBIPP}/libippik0.so.10.8 . && \ + cp ${LIBIPP}/libippil9.so.10.8 . && \ + mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ + LD_LIBRARY_PATH=${PREFIX}/usr/local/lib ${PREFIX}/usr/local/bin/ffmpeg -buildconf && \ + rm -rf ${PREFIX}/include/ ${PREFIX}/share/ ${PREFIX}/lib/ + +ARG IMAGE_CACHE_REGISTRY +FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04@sha256:adbb90115a21969d2fe6fa7f9af4253e16d45f8d4c1e930182610c4731962658 AS base + +LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" +LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" +LABEL org.opencontainers.image.description="Intel® Library for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Ubuntu 22.04 Docker image." +LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.vendor="Intel® Corporation" +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" + +ARG PREFIX=/opt/build +ENV TZ=Europe/Warsaw +ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 + +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] +WORKDIR /opt/raisrfolder +RUN apt-get update --fix-missing && \ + apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y \ + sudo \ + ca-certificates \ + libx264-1* \ + libx265-1* && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + groupadd -g 2110 vfio && \ + useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ + usermod -aG sudo raisr + +COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x +COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x +COPY --chown=raisr:raisr --from=build ${PREFIX} / + +RUN ldconfig && \ + ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ + /opt/raisrfolder/ffmpeg -h filter=raisr + +USER "raisr" +HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 + +SHELL ["/bin/bash", "-c"] +CMD ["-h", "filter=raisr"] +ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] diff --git a/docker/Xeon/yum/oneAPI.repo b/docker/Xeon/yum/oneAPI.repo new file mode 100644 index 0000000..5c82f49 --- /dev/null +++ b/docker/Xeon/yum/oneAPI.repo @@ -0,0 +1,13 @@ +[oneAPI] +name=Intel® oneAPI repository +baseurl=https://yum.repos.intel.com/oneapi +enabled=1 +gpgcheck=1 +repo_gpgcheck=1 +gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + +[nasm] +name=The Netwide Assembler +baseurl=http://www.nasm.us/pub/nasm/stable/linux/ +enabled=0 +gpgcheck=0 diff --git a/docker_build.sh b/docker_build.sh index 0809dc9..f2b08cf 100755 --- a/docker_build.sh +++ b/docker_build.sh @@ -1,36 +1,108 @@ -#!/bin/sh +#!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + +set -eo pipefail # This script is used to build the docker image of Intel Video Super Resolution. +# Usage: docker_build +# Example: docker_build xeon ubuntu 22.04 or docker_build flex ubuntu 22.04 + +# Uncomment if it is intended to not unset no_proxy and NO_PROXY and pass it to the context +# force_no_env_unset=1 +# Uncoment or set exact same variable to force not to print logo animation of intel +# force_no_intel_logo=1 -# Usage: docker_build -# for example: docker_build ubuntu 22.04 +SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" +. "${SCRIPT_DIR}/scripts/common.sh" -OS="ubuntu" -VERSION="22.04" +[ -z "${force_no_intel_logo}" ] && print_logo + +log_info Starting script execution "${BASH_SOURCE[0]}" +OS="${OS:-ubuntu}" +VERSION="${VERSION:-22.04}" +PLATFORM="${PLATFORM:-xeon}" if [ -n "$1" ]; then case "$(printf %s "$1" | tr '[:upper:]' '[:lower:]')" in - ubuntu) OS="ubuntu" ;; - centos) OS="centos" VERSION="7.9" ;; - *) echo "This version of dockerfile does not exist will build defualt image with ubuntu22.04." + xeon) PLATFORM="xeon" ;; + flex) PLATFORM="flex"; OS="ubuntu"; VERSION="22.04" ;; + *) log_error "Platform $1 is not yet supported. Use: [xeon, flex]"; exit 1 esac + shift fi -if [ -n "$2" ]; then - if [ $OS = "ubuntu" ]; then - case "$2" in - 18.04) VERSION="18.04" ;; - 22.04) VERSION="22.04" ;; - *) echo "This version of dockerfile does not exist will build defualt image with ubuntu22.04." - esac - fi - if [ $OS = "centos" ]; then - case "$2" in - 7.9) VERSION="7.9" ;; - *) echo "This version of dockerfile does not exist will build defualt image with centos7.9." - esac +if [ -n "$1" ]; then + case "$(printf %s "$1" | tr '[:upper:]' '[:lower:]')" in + ubuntu) OS="ubuntu" ;; + centos) OS="centos"; VERSION="9" ;; + rocky|rockylinux) OS="rockylinux"; VERSION="9-mini" ;; + *) log_error "Linux distributtion $1 is not yet supported. Use: [ubuntu, centos, rocky]"; exit 1 + esac + shift +fi + +if [ -n "$1" ]; then + if [ $OS = "ubuntu" ]; then + case "$1" in + 18.04|20.04|22.04) VERSION="$1" ;; + *) log_error "Ubuntu release $1 is not yet supported. Use: [18.04, 20.04, 22.04]"; exit 1 + esac + DEFAULT_CACHE_REGISTRY="${DEFAULT_CACHE_REGISTRY:-docker.io}" + fi + if [ $OS = "centos" ]; then + VERSION="9" + case "$1" in + 9|stream9) VERSION="9" ;; + *) log_error "CentOS release $1 is not yet supported, Use: [stream9]"; exit 1 + esac + DEFAULT_CACHE_REGISTRY="${DEFAULT_CACHE_REGISTRY:-quay.io}" + fi + if [ $OS = "rockylinux" ]; then + case "$1" in + 9|9-mini) VERSION="9-mini" ;; + *) log_error "RockyLinux release $1 is not yet supported, Use: [9, 9-mini]"; exit 1 + esac + DEFAULT_CACHE_REGISTRY="${DEFAULT_CACHE_REGISTRY:-docker.io}" + fi + shift +fi + +DOCKER_PATH="Xeon" +if [ $PLATFORM = "flex" ]; then + OS="ubuntu" + VERSION="22.04" + DOCKER_PATH="Flex" +fi + +if [[ ! $(grep -q "\.intel.com" <<< "${no_proxy}${NO_PROXY}") ]]; then + if [ -z "${force_no_env_unset}" ]; then + log_info "Unsetting no_proxy and NO_PROXY env values for docker buildx build." + log_info "Disable this behavior by setting force_no_env_unset env variable" + log_info "to any non-empty value." + log_info "\tExample: force_no_env_unset=1" + unset no_proxy + unset NO_PROXY + else + log_info Non-empty force_no_env_unset flag is set. + log_info Forcing no-unset behavior. fi fi -docker build -f ./docker/Dockerfile.${OS}${VERSION} --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} -t raisr:${OS}${VERSION} . +# Read proxy variables from env to pass them to the builder +set -x +BUILD_ARGUMENTS=$(compgen -e | sed -nE '/_(proxy|PROXY)$/{s/^/--build-arg /;p}') + +IMAGE_TAG="${IMAGE_TAG:-${OS}-${VERSION}}" +IMAGE_REGISTRY="${IMAGE_REGISTRY:-docker.io}" +IMAGE_CACHE_REGISTRY="${IMAGE_CACHE_REGISTRY:-${DEFAULT_CACHE_REGISTRY}}" +docker buildx build \ + ${BUILD_ARGUMENTS} \ + -f "${SCRIPT_DIR}/docker/${DOCKER_PATH}/Dockerfile.${OS}${VERSION}" \ + -t "${IMAGE_REGISTRY}/raisr/raisr-${PLATFORM}:${IMAGE_TAG}" \ + --build-arg IMAGE_REGISTRY="${IMAGE_REGISTRY}" \ + --build-arg IMAGE_CACHE_REGISTRY="${IMAGE_CACHE_REGISTRY}" \ + "$@" "${SCRIPT_DIR}" +set +x +log_info Finished script execution "${BASH_SOURCE[0]}" diff --git a/ffmpeg/0001-ffmpeg-raisr-filter.patch b/ffmpeg/0001-ffmpeg-raisr-filter.patch index 9c36431..0ba63ef 100644 --- a/ffmpeg/0001-ffmpeg-raisr-filter.patch +++ b/ffmpeg/0001-ffmpeg-raisr-filter.patch @@ -73,4 +73,3 @@ index d7db46c2af..0dc81faaed 100644 extern const AVFilter ff_vf_readvitc; -- 2.34.1 - diff --git a/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch b/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch index ed83c47..70caa8a 100644 --- a/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch +++ b/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch @@ -15,7 +15,7 @@ index f87716611b..a3c22079a8 100755 --- a/configure +++ b/configure @@ -3754,6 +3754,7 @@ transpose_opencl_filter_deps="opencl" - transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" + transpose_vt_filter_deps="videotoolbox VTPixelRotationSessionCreate" transpose_vulkan_filter_deps="vulkan spirv_compiler" unsharp_opencl_filter_deps="opencl" +raisr_opencl_filter_deps="opencl" @@ -31,9 +31,9 @@ index 13126f7f48..c138e2565b 100644 OBJS-$(CONFIG_XFADE_FILTER) += vf_xfade.o OBJS-$(CONFIG_XFADE_OPENCL_FILTER) += vf_xfade_opencl.o opencl.o opencl/xfade.o +OBJS-$(CONFIG_RAISR_OPENCL_FILTER) += vf_raisr_opencl.o opencl.o + OBJS-$(CONFIG_XFADE_VULKAN_FILTER) += vf_xfade_vulkan.o vulkan.o vulkan_filter.o OBJS-$(CONFIG_XMEDIAN_FILTER) += vf_xmedian.o framesync.o OBJS-$(CONFIG_XSTACK_FILTER) += vf_stack.o framesync.o - OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o yadif_common.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 0dc81faaed..ef5ce4df9c 100644 --- a/libavfilter/allfilters.c @@ -48,4 +48,3 @@ index 0dc81faaed..ef5ce4df9c 100644 extern const AVFilter ff_vf_realtime; -- 2.34.1 - diff --git a/ffmpeg/vf_raisr.c b/ffmpeg/vf_raisr.c index 49781ef..6fffd37 100644 --- a/ffmpeg/vf_raisr.c +++ b/ffmpeg/vf_raisr.c @@ -73,6 +73,7 @@ typedef struct RaisrContext struct plane_info inplanes[3]; int nb_planes; int framecount; + int evenoutput; } RaisrContext; #define OFFSET(x) offsetof(RaisrContext, x) @@ -89,6 +90,7 @@ static const AVOption raisr_options[] = { {"asm", "x86 asm type: (avx512fp16, avx512, avx2 or opencl)", OFFSET(asmStr), AV_OPT_TYPE_STRING, {.str = "avx512fp16"}, 0, 0, FLAGS}, {"platform", "select the platform", OFFSET(platform), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS}, {"device", "select the device", OFFSET(device), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS}, + {"evenoutput", "make output size as even number (0: ignore, 1: subtract 1px if needed)", OFFSET(evenoutput), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS}, {NULL}}; AVFILTER_DEFINE_CLASS(raisr); @@ -212,6 +214,12 @@ static int config_props_output(AVFilterLink *outlink) outlink->w = inlink0->w * raisr->ratio; outlink->h = inlink0->h * raisr->ratio; + // resolution of output needs to be even due to some encoders support only even resolution + if (raisr->evenoutput == 1) { + outlink->w -= outlink->w % 2; + outlink->h -= outlink->h % 2; + } + return 0; } @@ -224,6 +232,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) RNLERRORTYPE ret; VideoDataType vdt_in[3] = { 0 }; VideoDataType vdt_out[3] = { 0 }; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); av_log(ctx, AV_LOG_VERBOSE, "Frame\n"); @@ -263,10 +272,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) vdt_in[p].height = plane->height; vdt_in[p].step = in->linesize[p]; + // Get horziontal and vertical power of 2 factors + int vsub = p ? desc->log2_chroma_h : 0; + int hsub = p ? desc->log2_chroma_w : 0; + // fill in the output video data type structure vdt_out[p].pData = out->data[p]; - vdt_out[p].width = plane->width * raisr->ratio; - vdt_out[p].height = plane->height * raisr->ratio; + // Determine the width and height of this plane/channel + vdt_out[p].width = AV_CEIL_RSHIFT(out->width, hsub); + vdt_out[p].height = AV_CEIL_RSHIFT(out->height, vsub); vdt_out[p].step = out->linesize[p]; } if (raisr->framecount == 0) diff --git a/ffmpeg/vf_raisr_opencl.c b/ffmpeg/vf_raisr_opencl.c index c0015f6..06557cb 100644 --- a/ffmpeg/vf_raisr_opencl.c +++ b/ffmpeg/vf_raisr_opencl.c @@ -25,6 +25,7 @@ #include "internal.h" #include "opencl.h" #include "libavutil/pixdesc.h" +#include "video.h" #define MIN_RATIO 1 #define MAX_RATIO 2 @@ -42,6 +43,7 @@ typedef struct RaisrOpenCLContext { int mode; RangeType range; enum AVPixelFormat sw_format; + int evenoutput; } RaisrOpenCLContext; @@ -109,8 +111,8 @@ static int raisr_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input) vdt_in[p].bitShift = desc->comp[p].shift; // fill in the output video data type structure vdt_out[p].pData = output->data[p]; - vdt_out[p].width = input->width * ctx->ratio / wsub; - vdt_out[p].height = input->height * ctx->ratio / hsub; + vdt_out[p].width = output->width / wsub; + vdt_out[p].height = output->height / hsub; vdt_out[p].step = output->linesize[p]; vdt_out[p].bitShift = desc->comp[p].shift; } @@ -195,6 +197,10 @@ static int raisr_opencl_config_output(AVFilterLink *outlink) ctx->ocf.output_width = inlink->w * ctx->ratio; ctx->ocf.output_height = inlink->h * ctx->ratio; + if (ctx->evenoutput == 1) { + ctx->ocf.output_width -= ctx->ocf.output_width % 2; + ctx->ocf.output_height -= ctx->ocf.output_height % 2; + } err = ff_opencl_filter_config_output(outlink); if (err < 0) @@ -225,6 +231,7 @@ static const AVOption raisr_opencl_options[] = { { "CountOfBitsChanged", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CountOfBitsChanged }, INT_MIN, INT_MAX, FLAGS, "blending" }, {"passes", "passes to run (1: one pass, 2: two pass)", OFFSET(passes), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, FLAGS}, {"mode", "mode for two pass (1: upscale in 1st pass, 2: upscale in 2nd pass)", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, FLAGS}, + {"evenoutput", "make output size as even number (0: ignore, 1: subtract 1px if needed)", OFFSET(evenoutput), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS}, {NULL} }; diff --git a/scripts/01_pull_resources.sh b/scripts/01_pull_resources.sh index 05b034d..35edcb7 100755 --- a/scripts/01_pull_resources.sh +++ b/scripts/01_pull_resources.sh @@ -1,8 +1,24 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + # This script is used to pull all resources(Cmake 3.14, nasm, x264, x265, IPP, Raisr and ffmpeg) used for build RAISR and ffmpeg. And by default, the script will generate a tarball raisr.tar.gz of these resources and you can use "no_package" option to disable generate the tarball. +set -eo pipefail + +SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" +REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../")" +. "${SCRIPT_DIR}/common.sh" + +log_info Starting script execution "${BASH_SOURCE[0]}" +raisr_folder="${raisr_folder:-raisr}" + +mkdir -p "${raisr_folder}" "/tmp/Video-Super-Resolution-Library" +cp -r ${REPOSITORY_DIR}/* /tmp/Video-Super-Resolution-Library +pushd "${raisr_folder}" package_flag=true +ipp_offline_uri='https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7e07b203-af56-4b52-b69d-97680826a8df/l_ipp_oneapi_p_2021.12.1.16_offline.sh' # Usage: 01_pull_resource while [ -n "$*" ]; do @@ -12,73 +28,75 @@ while [ -n "$*" ]; do esac done -raisr_folder=raisr -mkdir $raisr_folder -cd $raisr_folder +# pull raisr code +# git clone https://github.com/OpenVisualCloud/Video-Super-Resolution-Library.git +mv /tmp/Video-Super-Resolution-Library . +if [ ! -d "Video-Super-Resolution-Library" ];then + log_error "Failed to pull source code of Video-Super-Resolution-Library!" + exit 1 +fi # pull cmake 3.14 -wget https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz +wget --tries=5 --progress=dot:giga https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz if [ ! -f "cmake-3.14.0.tar.gz" ];then - echo "Failed to download Cmake 3.14!" + log_error "Failed to download Cmake 3.14!" exit 1 fi -# pull raisr code -git clone https://github.com/OpenVisualCloud/Video-Super-Resolution-Library.git -if [ ! -d "Video-Super-Resolution-Library" ];then - echo "Failed to pull source code of Video-Super-Resolution-Library!" - exit 1 -fi # pull ffmpeg git clone https://github.com/FFmpeg/FFmpeg ffmpeg if [ ! -d "ffmpeg" ];then - echo "Failed to pull source code of ffmpeg!" + log_error "Failed to pull source code of ffmpeg!" exit 1 fi -cd ffmpeg +pushd ffmpeg git checkout -b n6.0 n6.0 git am ../Video-Super-Resolution-Library/ffmpeg/0001-ffmpeg-raisr-filter.patch -cd - +popd # pull nasm used for build x264 -wget https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2 +wget --tries=5 --progress=dot:giga https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2 if [ ! -f "nasm-2.15.05.tar.bz2" ];then - echo "Failed to download nasm!" + log_log_error "Failed to download nasm!" exit 1 fi -# pull x264 and x265 +# pull x264 git clone https://github.com/mirror/x264 -b stable --depth 1 if [ ! -d "x264" ];then - echo "Failed to pull source code of x264!" + log_error "Failed to pull source code of x264!" exit 1 fi -wget https://github.com/videolan/x265/archive/3.4.tar.gz +# pull x265 +wget --tries=5 --progress=dot:giga https://github.com/videolan/x265/archive/3.4.tar.gz if [ ! -f "3.4.tar.gz" ];then - echo "Failed to download source code of x265!" + log_error "Failed to download source code of x265!" exit 1 fi # pull IPP -wget https://registrationcenter-download.intel.com/akdlm/irc_nas/19007/l_ipp_oneapi_p_2021.6.2.16995_offline.sh -if [ ! -f "l_ipp_oneapi_p_2021.6.2.16995_offline.sh" ];then - echo "Failed to download IPP package!" +wget --tries=5 --progress=dot:giga "${ipp_offline_uri}" +if [ ! -f "${ipp_offline_uri##*/}" ];then + log_error "Failed to download IPP package!" exit 1 fi -echo "Successfully downloaded all these resources!" +log_info "Successfully downloaded all these resources!" if [ "$package_flag" == "true" ]; then cd .. tar -zcvf ./$raisr_folder.tar.gz ./$raisr_folder if [ ! -f "$raisr_folder.tar.gz" ];then - echo "Failed to package these resources to $raisr_folder.tar.gz!" + log_error "Failed to package these resources to $raisr_folder.tar.gz!" exit 1 else echo "Successfully packaged these resources to $raisr_folder.tar.gz!" rm -rf ./$raisr_folder fi fi + +popd +log_info Finished script execution "${BASH_SOURCE[0]}" diff --git a/scripts/02_install_prerequisites.sh b/scripts/02_install_prerequisites.sh index 4ac44d6..6019147 100755 --- a/scripts/02_install_prerequisites.sh +++ b/scripts/02_install_prerequisites.sh @@ -1,13 +1,24 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + # This scrpit is used to extract the tarball raisr.tar.gz of resources and build and install the libraries required by building raisr and ffmpeg # It requires Linux based OS(Tested and validated on Ubuntu 18.04 LTS), gcc/g++ 7.5 or later, make and pkg-config to run this script. # Usage: 02_install_prerequisites.sh /xxx/raisr.tar.gz +set -eo pipefail + +SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" +REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../")" +. "${SCRIPT_DIR}/common.sh" + +log_info Starting script execution "${BASH_SOURCE[0]}" package_path=$1 if [ -z "$package_path" ];then - echo "Usage: 02_install_prerequisites.sh /xxx/raisr.tar.gz" + log_error "Usage:" + log_error "\t02_install_prerequisites.sh /xxx/raisr.tar.gz" exit 1 fi @@ -15,15 +26,15 @@ tar -zxf $package_path ./ cd raisr # install IPP -chmod +x ./l_ipp_oneapi_p_2021.6.2.16995_offline.sh -sudo ./l_ipp_oneapi_p_2021.6.2.16995_offline.sh -a -s --eula accept +chmod +x ./l_ipp_oneapi_p_2021.12.1.16_offline.sh +sudo ./l_ipp_oneapi_p_2021.12.1.16_offline.sh -a -s --eula accept echo "source /opt/intel/oneapi/ipp/latest/env/vars.sh" | tee -a ~/.bash_profile # build and install CMake 3.14 tar zxf ./cmake-3.14.0.tar.gz cd cmake-3.14.0 && \ ./bootstrap --prefix=/usr/local && \ - make -j $(nproc) && \ + make -j "$(nproc)" && \ sudo make install cd - @@ -32,7 +43,7 @@ tar xjf ./nasm-2.15.05.tar.bz2 && \ cd nasm-2.15.05 && \ ./autogen.sh && \ ./configure --prefix=/usr/local --libdir=/usr/local/lib && \ - make -j $(nproc) && \ + make -j "$(nproc)" && \ sudo make install cd - @@ -40,7 +51,7 @@ cd - cd x264 && \ ./configure --prefix=/usr/local --libdir=/usr/local/lib \ --enable-shared && \ - make -j $(nproc) && \ + make -j "$(nproc)" && \ sudo make install cd - @@ -48,12 +59,12 @@ cd - tar xzf ./3.4.tar.gz cd x265-3.4/build/linux && \ cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DHIGH_BIT_DEPTH=ON ../../source && \ - make -j $(nproc) && \ + make -j "$(nproc)" && \ sudo make install cd - # remove the resources except Raisr and ffmpeg -rm l_ipp_oneapi_p_2021.6.2.16995_offline.sh +rm l_ipp_oneapi_p_2021.12.1.16_offline.sh rm 3.4.tar.gz rm cmake-3.14.0.tar.gz rm nasm-2.15.05.tar.bz2 @@ -61,3 +72,4 @@ rm -rf ./x264 rm -rf ./x265-3.4 rm -rf ./cmake-3.14.0 rm -rf ./nasm-2.15.05 +log_info Finished script execution "${BASH_SOURCE[0]}" diff --git a/scripts/03_build_raisr_ffmpeg.sh b/scripts/03_build_raisr_ffmpeg.sh index 69ab2ab..82ed88d 100755 --- a/scripts/03_build_raisr_ffmpeg.sh +++ b/scripts/03_build_raisr_ffmpeg.sh @@ -1,9 +1,19 @@ #!/bin/bash -# This scrpit is used to build raisr and ffmpeg +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + +# This script is used to build raisr and ffmpeg # Usage: 03_build_raisr_ffmpeg.sh /xxx/raisr/Video-Super-Resolution-Library +set -eo pipefail + +SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" +REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../")" +. "${SCRIPT_DIR}/common.sh" + +log_info Starting script execution "${BASH_SOURCE[0]}" raisr_path=$1 if [ -z "$raisr_path" ];then @@ -12,33 +22,42 @@ if [ -z "$raisr_path" ];then fi # set IPP, x264 and x265 env +. /opt/intel/oneapi/ipp/latest/env/vars.sh export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" -source /opt/intel/oneapi/ipp/latest/env/vars.sh +export C_INCLUDE_PATH="/opt/intel/oneapi/ipp/latest/include/ipp" # build raisr -cd $raisr_path -sudo -E ./build.sh +pushd "$raisr_path" +sudo -E ./build.sh +popd # build ffmpeg -cd ../ffmpeg -cp ../Video-Super-Resolution-Library/ffmpeg/vf_raisr.c libavfilter/ +pushd "${raisr_path}/../ffmpeg" +cp "${raisr_path}/ffmpeg/vf_raisr.c" libavfilter/ ./configure \ - --enable-libipp \ - --extra-cflags="-fopenmp" \ - --extra-ldflags=-fopenmp \ - --enable-gpl \ - --enable-libx264 \ - --enable-libx265 \ - --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ - --enable-cross-compile + --enable-libipp \ + --extra-cflags="-fopenmp -I/opt/intel/oneapi/ipp/latest/include/ipp" \ + --extra-ldflags=-fopenmp \ + --enable-gpl \ + --enable-libx264 \ + --enable-libx265 \ + --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ + --enable-cross-compile make clean -make -j $(nproc) - -cp -r ../Video-Super-Resolution-Library/filters* . - -echo -e "To run the library you can do the following: \n - cd raisr/ffmpeg \n - ./ffmpeg -y -i /input_files/input.mp4 -vf raisr=threadcount=20 -pix_fmt yuv420p /output_files/out.yuv \n -And you can see more use cases in README file of Video-Super-Resolution-Library." - +make -j "$(nproc)" +make install +popd + +cp -r "${raisr_path}/filters"* . + +log_info "\tTo run the library you can do the following:" +log_info +log_info "\t\tcd raisr/ffmpeg" +log_info "\t\t./ffmpeg -y -i /input_files/input.mp4 -vf raisr=threadcount=20 -pix_fmt yuv420p /output_files/out.yuv" +log_info +log_info And you can see more use cases in README file of Video-Super-Resolution-Library. +log_info "\tNotice: If you get \"ffmpeg: error while loading shared libraries\", try first doing:" +log_info "\t\texport LD_LIBRARY_PATH=\"/opt/intel/oneapi/ipp/latest/lib/intel64:/usr/local/lib:${LD_LIBRARY_PATH}\"" + +log_info "Finished script execution \"${BASH_SOURCE[0]}\"" \ No newline at end of file diff --git a/scripts/common.sh b/scripts/common.sh new file mode 100755 index 0000000..0489df9 --- /dev/null +++ b/scripts/common.sh @@ -0,0 +1,519 @@ +#!/bin/bash + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + +export REPO_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")/..")" +export BUILD_DIR="${BUILD_DIR:-${REPO_DIR}/_build}" +export DRIVERS_DIR="${DRIVERS_DIR:-/opt/intel/drivers}" +export PREFIX_DIR="${PREFIX_DIR:-${REPO_DIR}/_install}" + +VERSIONS_FILE_PATH="$(readlink -f "${VERSIONS_FILE:-${REPO_DIR}/versions.env}")" +export VERSIONS_FILE_PATH + +# shellcheck source="versions.env" +. "${VERSIONS_FILE_PATH}" + +export MTL_DIR="${BUILD_DIR}/mtl" +export DPDK_DIR="${BUILD_DIR}/dpdk" +export XDP_DIR="${BUILD_DIR}/xdp" +export BPF_DIR="${XDP_DIR}/lib/libbpf" +export GRPC_DIR="${BUILD_DIR}/grpc" +export JPEGXS_DIR="${BUILD_DIR}/jpegxs" +export LIBFABRIC_DIR="${BUILD_DIR}/libfabric" +export LIBFDT_DIR="${BUILD_DIR}/libfdt" +export JSONC_DIR="${BUILD_DIR}/json-c" +export NASM_DIR="${BUILD_DIR}/nasm" + +export ICE_DIR="${DRIVERS_DIR}/ice/${ICE_VER}" +export IAVF_DIR="${DRIVERS_DIR}/iavf/${IAVF_VER}" +export IRDMA_DIR="${DRIVERS_DIR}/irdma/${IRDMA_VER}" + +PM="${PM:-apt-get}" +KERNEL_VERSION="${KERNEL_VERSION:-$(uname -r)}" +export TZ="${TZ:-Europe/Warsaw}" +export NPROC="${NPROC:-$(nproc)}" + +if ! grep "/root/.local/bin" <<< "${PATH}" > /dev/null 2>&1; then + export PATH="/root/.local/bin:/root/bin:/root/usr/bin:${PATH}" + export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" +fi + +BOLD="${BOLD:-\e[1;}" +REGULAR="${REGULAR:-\e[0;}" +RED="${RED:-31m}" +GREEN="${GREEN:-32m}" +YELLOW="${YELLOW:-33m}" +BLUE="${BLUE:-34m}" +EndCl='\e[m' + +function log_message() { + local type="${1}" + shift + local HEADER="${type}: " + local FOOTER="" + # case $(echo $type | tr '[:upper:]' '[:lower:]') in + if [ -z "${DISABLE_COLOR_PRINT}" ]; then + FOOTER='\e[0m' + case "${type}" in + ERROR) HEADER="${REGULAR}${RED}${type}: ${BOLD}${RED}" ;; + WARN|WARNING) HEADER="${REGULAR}${BLUE}${type}: ${BOLD}${YELLOW}" ;; + SUCC|SUCCESS) HEADER="${REGULAR}${BLUE}${type}: ${BOLD}${GREEN}" ;; + INFO|*) HEADER="${REGULAR}${BLUE}${type}: ${BOLD}${BLUE}" ;; + esac + fi + echo -e "${HEADER}$*${FOOTER}" >&2 +} + +function log_info() { log_message "INFO" "$*"; } +function log_success() { log_message "SUCCESS" "$*"; } +function log_warning() { log_message "WARNING" "$*"; } +function log_error() { log_message "ERROR" "$*"; } + +function get_user_input_confirm() { + local confirm + local confirm_string + local confirm_default="${1:-0}" + confirm_string=( "(N)o" "(Y)es" ) + + echo -en "${REGULAR}${BLUE}CHOOSE:${BOLD}${BLUE} (Y)es/(N)o [default: ${confirm_string[$confirm_default]}]: ${EndCl}" >&2 + read -r confirm + if [[ -z "$confirm" ]]; then + confirm="$confirm_default" + else + { [[ $confirm == [yY] ]] || [[ $confirm == [yY][eE][sS] ]]; } && confirm="1" || confirm="0" + fi + echo "${confirm}" +} + +function get_user_input_def_yes() { + get_user_input_confirm 1 +} + +function get_user_input_def_no() { + get_user_input_confirm 0 +} + +function get_filename() { + local path="$1" + echo "${path##*/}" +} + +function get_dirname() { + local path="$1" + echo "${path%/*}/" +} + +function get_extension() { + local filename + filename="$(get_filename "${1}")" + echo "${filename#*.}" +} + +function check_extension() { + local filename="$1" + local extension="$2" + if [ "${filename}" == "${filename%"${extension}"}" ]; then + echo "0" + else + echo "1" + fi +} + +function get_basename() { + local filename + filename="$(get_filename "${1}")" + echo "${filename%%.*}" +} + +# Extracts namespace and repository part from valid GitHub URL passed as argument. +# input: valid GitHub repository URL +# output: two element string array, space separated +function get_github_elements() { + local path_part + local path_elements + path_part="${1#*://github.com/}" + mapfile -t -d'/' path_elements <<< "${path_part}" + if [[ "${#path_elements[@]}" -lt "2" ]]; then + log_error "Invalid link passed to get_github_elements method." + return 1 + fi + echo "${path_elements[0]} ${path_elements[1]}" +} + +function get_github_namespace() { + cut -d' ' -f1 <<< "$(get_github_elements "$1")" +} + +function get_github_repo() { + cut -d' ' -f2 <<< "$(get_github_elements "$1")" +} + +# Adds sufix to base of filename from full path. +# input[1]: string sufix to be added +# input[2]: path string to be modified +# output: [path]/[file_base][id].[extension] +function get_filepath_add_sufix() { + local dir_path + local file_base + local file_ext + local file_sufix="${1}" + local file_path="${2}" + dir_path="$(get_dirname "${file_path}")" + file_base="$(get_basename "${file_path}")" + file_ext="$(get_extension "${file_path}")" + echo "${dir_path}${file_base}${file_sufix}.${file_ext}" +} + +function command_exists { + command -v "$@" > /dev/null 2>&1 +} + +function as_root() +{ + CMD_TO_EVALUATE="$*" + CURRENT_USER_ID="$(id -u)" + EFECTIVE_USER_ID="${EUID:-$CURRENT_USER_ID}" + AS_ROOT="/bin/bash -c" + + if [ "${EFECTIVE_USER_ID}" -ne 0 ]; then + if command_exists sudo; then + AS_ROOT="sudo -E /bin/bash -c" + elif command_exists su; then + AS_ROOT="su -c" + else + log_error "This command must be run as root [EUID=0] ${CMD_TO_EVALUATE[*]}." + log_error "- current [EUID=${EFECTIVE_USER_ID}]." + log_error "- 'sudo' nor 'su' commands were found in PATH." + log_error "Re-run the script as sudo or install sudo pkg." + exit 1 + fi + fi + $AS_ROOT "${CMD_TO_EVALUATE[*]}" +} + +function github_api_call() { + url=$1 + shift + GITHUB_API_URL=https://api.github.com + INPUT_OWNER=$(echo "${url#"${GITHUB_API_URL}/repos/"}" | cut -f1 -d'/') + INPUT_REPO=$(echo "${url#"${GITHUB_API_URL}/repos/"}" | cut -f2 -d'/') + API_SUBPATH="${url#"${GITHUB_API_URL}/repos/${INPUT_OWNER}/${INPUT_REPO}/"}" + if [ -z "${INPUT_GITHUB_TOKEN}" ]; then + echo >&2 "Set the INPUT_GITHUB_TOKEN env variable first." + return + fi + + echo >&2 "GITHUB_API_URL=$GITHUB_API_URL" + echo >&2 "INPUT_OWNER=$INPUT_OWNER" + echo >&2 "INPUT_REPO=$INPUT_REPO" + echo >&2 "API_SUBPATH=$API_SUBPATH" + echo >&2 "curl --fail-with-body -sSL \"${GITHUB_API_URL}/repos/${INPUT_OWNER}/${INPUT_REPO}/${API_SUBPATH}\" -H \"Authorization: Bearer ${INPUT_GITHUB_TOKEN}\" -H 'Accept: application/vnd.github.v3+json' -H 'Content-Type: application/json' $*" + + if API_RESPONSE=$(curl --fail-with-body -sSL \ + "${GITHUB_API_URL}/repos/${INPUT_OWNER}/${INPUT_REPO}/${API_SUBPATH}" \ + -H "Authorization: Bearer ${INPUT_GITHUB_TOKEN}" \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'Content-Type: application/json' \ + "$@") + then + echo "${API_RESPONSE}" + else + echo >&2 "GitHub API call failed." + echo >&2 "${API_RESPONSE}" + return + fi +} + +function print_logo() +{ + if [[ -z "$blue_code" ]] + then + local blue_code=( 26 27 20 19 20 20 21 04 27 26 32 12 33 06 39 38 44 45 ) + fi + local IFS + local logo_string + local colorized_logo_string + IFS=$'\n\t' + logo_string="$(cat <<- EOF + .-----------------------------------------------------------. + | * . .. . * | + | . . . . . . | + | . . *:. . . | + | . . . .. . . | + | . . . . ... . . | + | . . . . . . . . . | + | . . . ... .. . . | + | . . . *. . . | + | :. . . | + | . . . . | + | . . . . ^ | + | . .. :. . | . . | + |. ... . | | + | :. . . *. We are here. . | + | . . *. | + .©-Intel-Corporation--------------------ascii-author-unknown. + = = + = 88 88 = + = "" ,d 88 = + = 88 88 88 = + = 88 8b,dPPYba, MM88MMM ,adPPYba, 88 = + = 88 88P' '"8a 88 a8P_____88 88 = + = 88 88 88 88 8PP""""""" 88 = + = 88 88 88 88, "8b, ,aa 88 = + = 88 88 88 "Y888 '"Ybbd8"' 88 = + = = + ============================================================= + EOF + )" + + colorized_logo_string="" + for (( i=0; i<${#logo_string}; i++ )) + do + colorized_logo_string+="\e[38;05;${blue_code[$(( (i-(i/64)*64)/4 ))]}m" + colorized_logo_string+="${logo_string:$i:1}" + done; + colorized_logo_string+='\e[m\n' + + echo -e "$colorized_logo_string" >&2 +} + +function print_logo_sequence() +{ + set +x + local wait_between_frames="${1:-0}" + local wait_cmd="" + if [ ! "${wait_between_frames}" = "0" ]; then + wait_cmd="sleep ${wait_between_frames}" + fi + + blue_code_fixed=( 26 27 20 19 20 20 21 04 27 26 32 12 33 06 39 38 44 45 ) + size=${#blue_code_fixed[@]} + for (( move=0; move' + "${_last_command}" + ) + else + _output_array+=("last_command: ${_last_command}") + fi + + _output_array+=('---') + log_error "${_output_array[*]}" +} + +# Calling this function executes ERR and SIGINT signals trapping. Triggered trap calls catch_error_print_debug and exit 1 +function trap_error_print_debug() { + log_info "Setting trap for errors handling" + trap 'catch_error_print_debug "LINENO" "BASH_LINENO" "${BASH_COMMAND}" "${?}"; exit 1' SIGINT ERR + log_info "Trap set successfuly." +} + +# GITHUB_CREDENTIALS="username:password" +# URL construction: https://${GITHUB_CREDENTIALS}@github.com/${name}/archive/${version}.tar.gz +# $1 - name +# $2 - version +# $3 - dest_dir +function git_download_strip_unpack() +{ + # Version can be commit sha or tag, examples: + # version=d2515b90cc0ef651f6d0a6661d5a644490bfc3f3 + # version=refs/tags/v${JPEG_XS_VER} + name="${1}" + version="${2}" + dest_dir="${3}" + filename="$(get_filename "${version}")" + [ -n "${GITHUB_CREDENTIALS}" ] && creds="${GITHUB_CREDENTIALS}@" || creds="" + + mkdir -p "${dest_dir}" + curl -Lf "https://${creds}github.com/${name}/archive/${version}.tar.gz" -o "${dest_dir}/${filename}.tar.gz" + tar -zx --strip-components=1 -C "${dest_dir}" -f "${dest_dir}/${filename}.tar.gz" + rm -f "${dest_dir}/${filename}.tar.gz" +} + +# Downloads and strip unpack a file from URL ($1) to a target directory ($2) +# $1 - URL to download +# $2 - destination directory to strip unpack the tar.gz +function wget_download_strip_unpack() +{ + local filename + local source_url="${1}" + local dest_dir="${2}" + filename="$(get_filename "${source_url}")" + [ -n "${GITHUB_CREDENTIALS}" ] && creds="${GITHUB_CREDENTIALS}@" || creds="" + + mkdir -p "${dest_dir}" + curl -Lf "${source_url}" -o "${dest_dir}/${filename}.tar.gz" + tar -zx --strip-components=1 -C "${dest_dir}" -f "${dest_dir}/${filename}.tar.gz" + rm -f "${dest_dir}/${filename}.tar.gz" +} + +# Example usage: +# PM="$(setup_package_manager)" && \ +# $PM install python3 +function setup_package_manager() +{ + TIBER_USE_PM="${PM:-$1}" + if [[ -x "$(command -v "$TIBER_USE_PM")" ]]; then + export PM="${TIBER_USE_PM}" + elif [[ -x "$(command -v yum)" ]]; then + export PM='yum' + elif [[ -x "$(command -v dnf)" ]]; then + export PM='dnf' + elif [[ -x "$(command -v apt-get)" ]]; then + export PM='apt-get' + elif [[ -x "$(command -v apt)" ]]; then + export PM='apt' + else + log_error "No known pkg manager found. Try to re-run with variable, example:" + log_error "export PM=\"apt\"" + return 1 + fi + log_info "Setting pkg manager to ${PM}." + echo "${PM}" + return 0 +} + +# Setup build dir and ffmpeg version/directory. +# FFMPEG_VER taken from environment or forced by 1st parameter +# Exports FFMPEG_DIR and FFMPEG_VER +function lib_setup_ffmpeg_dir_and_version() +{ + FFMPEG_VER="${1:-$FFMPEG_VER}" + FFMPEG_7_0_DIR="${FFMPEG_7_0_DIR:-ffmpeg-7-0}" + FFMPEG_6_1_DIR="${FFMPEG_6_1_DIR:-ffmpeg-6-1}" + + if [[ "${FFMPEG_VER}" == "7.0" ]]; then + FFMPEG_SUB_DIR="${FFMPEG_7_0_DIR}" + elif [[ "${FFMPEG_VER}" == "6.1" ]]; then + FFMPEG_SUB_DIR="${FFMPEG_6_1_DIR}" + else + log_error "Unsupported version of FFmpeg == '${FFMPEG_VER}'." + log_error "Try again, choose one of '7.0', '6.1'." + exit 2 + fi + export FFMPEG_VER + export FFMPEG_SUB_DIR +} + +function exec_command() +{ + # One of: yes|no|accept-new + SSH_STRICT_HOST_KEY_CHECKING="accept-new" + SSH_CMD="ssh -oStrictHostKeyChecking=${SSH_STRICT_HOST_KEY_CHECKING} -t -o" + + local values_returned="" + local user_at_address="" + [[ "$#" -eq "2" ]] && user_at_address="${2}" + [[ "$#" -eq "3" ]] && user_at_address="${3}@${2}" + + if [ "$#" -eq "1" ]; then + values_returned="$(eval "${1}")" + elif [[ "$#" -eq "2" ]] || [[ "$#" -eq "3" ]]; then + values_returned="$($SSH_CMD "RemoteCommand=eval \"${1}\"" "${user_at_address}" 2>/dev/null)" + else + log_error "Wrong arguments for exec_command(). Valid number is one of [1 2 3], got $#" + return 1 + fi + + if [ -z "$values_returned" ]; then + log_error "Unable to collect results or results are empty." + return 1 + else + echo "${values_returned}" + return 0 + fi +} + +function get_hostname() { + exec_command 'hostname' "$@" +} + +function get_intel_nic_device() { + exec_command "lspci | grep 'Intel Corporation.*\(810\|X722\)'" "$@" +} + +function get_default_route_nic() { + exec_command "ip -json r show default | jq '.[0].dev' -r" "$@" +} + +function get_cpu_arch() { + local arch="" + + if ! arch="$(exec_command 'cat /sys/devices/cpu/caps/pmu_name' "$@")"; then echo "Got: $arch" && return 1; fi + + case $arch in + icelake) + log_info "Xeon IceLake CPU (icx)" 1>&2 + echo "icx" + ;; + sapphire_rapids) + log_info "Xeon Sapphire Rapids CPU (spr)" 1>&2 + echo "spr" + ;; + skylake) + log_info "Xeon SkyLake" + echo "skl" + ;; + *) + log_error "Unsupported architecture: ${arch}. Please edit the script or setup the architecture manually." + return 1 + ;; + esac + return 0 +} diff --git a/test/validation_suite/create_wrong_files.sh b/test/validation_suite/create_wrong_files.sh new file mode 100755 index 0000000..649df45 --- /dev/null +++ b/test/validation_suite/create_wrong_files.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + +SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" +REPO_DIR="$(readlink -f "${SCRIPT_DIR}/../..")" + +ffmpeg_path="${ffmpeg_path:-${REPO_DIR}/raisr/ffmpeg}" +out_filters=(filters_badNums filters_wrongConfig filters_noPathes) +bad_configs=(12_3_3_11 24_3_3 24_3_3_6 24_3_3_9) +bad_nums=(bad_cohpath_nums bad_hashtable_nums bad_strpath_nums) +no_pathes=(noCohPath noConfig noHashTable noStrPath) + +for outfilter in ${out_filters[@]}; do + echo $outfilter + if [ -e $outfilter ] + then + rm -rf $outfilter + fi + mkdir -p "$ffmpeg_path/$outfilter" + case "$outfilter" in + "filters_badNums") + for bad_num in ${bad_nums[@]}; do + mild_path=filters1_$bad_num + cp -r ${REPO_DIR}/filters_2x/filters_highres "$ffmpeg_path/$outfilter/$mild_path" + cd "$ffmpeg_path/$outfilter/$mild_path" + case "$mild_path" in + "filters1_bad_cohpath_nums") + mv Qfactor_cohbin_2_8 Qfactor_cohbin_6_8 + mv Qfactor_cohbin_2_8_2 Qfactor_cohbin_6_8_2 + mv Qfactor_cohbin_2_10 Qfactor_cohbin_6_10 + ;; + "filters1_bad_hashtable_nums") + mv filterbin_2_8 filterbin_6_8 + mv filterbin_2_8_2 filterbin_6_8_2 + mv filterbin_2_10 filterbin_6_10 + ;; + "filters1_bad_strpath_nums") + mv Qfactor_strbin_2_8 Qfactor_strbin_6_8 + mv Qfactor_strbin_2_8_2 Qfactor_strbin_6_8_2 + mv Qfactor_strbin_2_10 Qfactor_strbin_6_10 + ;; + esac + cd "$OLDPWD" + done + ;; + "filters_wrongConfig") + for bad_conf in ${bad_configs[@]}; do + mild_path=filters1_$bad_conf + cp -r ${REPO_DIR}/filters_2x/filters_highres "$ffmpeg_path/$outfilter/$mild_path" + cd "$ffmpeg_path/$outfilter/$mild_path" + confignum=${bad_conf//_/ } + sed -i "1c$confignum" config + cd "$OLDPWD" + done + ;; + "filters_noPathes") + for bad_path in ${no_pathes[@]}; do + mild_path=filters1_$bad_path + cp -r ${REPO_DIR}/filters_2x/filters_highres "$ffmpeg_path/$outfilter/$mild_path" + cd "$ffmpeg_path/$outfilter/$mild_path" + echo $mild_path + type_Coh=$(echo $mild_path | grep "Coh") + type_Conf=$(echo $mild_path | grep "Conf") + type_Hash=$(echo $mild_path | grep "Hash") + type_Str=$(echo $mild_path | grep "Str") + if [[ "$type_Coh" != "" ]] + then + rm -rf Qfactor_cohbin_* + elif [[ "$type_Conf" != "" ]] + then + rm -rf config + elif [[ "$type_Hash" != "" ]] + then + rm -rf filterbin* + else + rm -rf Qfactor_strbin_* + fi + cd "$OLDPWD" + done + ;; + esac +done diff --git a/test/validation_suite/run_tests_avxout.sh b/test/validation_suite/run_tests_avxout.sh new file mode 100755 index 0000000..9c94997 --- /dev/null +++ b/test/validation_suite/run_tests_avxout.sh @@ -0,0 +1,179 @@ +#!/bin/bash + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2024-2025 Intel Corporation + +set -x + +SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" +REPO_DIR="$(readlink -f "${SCRIPT_DIR}/../..")" +LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}" + +ffmpeg_path="${ffmpeg_path:-${REPO_DIR}/raisr/ffmpeg}" +test_video_path="${test_video_path:-${ffmpeg_path}/test_videos}" + +avx_array=("avx2") +if lscpu | grep "avx512f " | grep "avx512vl "; +then avx_array+=("avx512"); +else echo "No avx512 found"; +fi +if lscpu | grep "avx512_fp16 "; +then avx_array+=("avx512fp16"); +else echo "No avx512fp16 found"; +fi + +thread_array=(1 10 20 30 40 50 60 90 120 88) +pass_array=(1 2) +blending_array=(1 2) +mode_array=(1 2) +fixed_thread=120 + +#bad inputs +wrong_bit=9 +wrong_blending=0 +wrong_ratio=0 +wrong_mode=-1 +wrong_thread=121 +wrong_pass=3 +negtive_pass=-1 +negtive_thread=-1 +bad_configs=(12_3_3_11 24_3_3 24_3_3_6 24_3_3_9) +bad_nums=(bad_cohpath_nums bad_hashtable_nums bad_strpath_nums) +no_pathes=(noCohPath noConfig noHashTable noStrPath) +#log path +common_log_path="${ffmpeg_path}/test_logs" +wrong_input_log_path="${ffmpeg_path}/test_bad_input_logs" +opath="${ffmpeg_path}/outputs/" +mkdir -p "${common_log_path}" "${wrong_input_log_path}" "${opath}" + +cd $ffmpeg_path +for filename in $test_video_path/*; do + fname=$(basename $filename) + ext="${fname##*.}" + fname1="${fname%.*}" + ofname="$fname1"_out."$ext" + for avx in ${avx_array[@]}; do + #test diff thread &diff avx + for thread in ${thread_array[@]};do + printf -v digi '%02d' ${thread##+(0)} + ofname="$fname1"_out_th"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$thread:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + done + + #test diff pass &diff avx, thread is fixed to 120 + for pass in ${pass_array[@]};do + printf -v digip '%02d' ${pass##+(0)} + ofname="$fname1"_out_pass"$digip"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:passes=$pass:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + done + + #test diff blending &diff avx, thread is fixed to 120 + for blending in ${blending_array[@]};do + printf -v digib '%02d' ${blending##+(0)} + ofname="$fname1"_out_bld"$digib"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:blending=$blending:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + done + + #test diff mode &diff avx, thread is fixed to 120 + for mode in ${mode_array[@]};do + printf -v digim '%02d' ${mode##+(0)} + ofname="$fname1"_out_mode"$digim"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:mode=$mode:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + done + + #test diff filter_1 &diff avx, thread is fixed to 120 + for f in filters_1*/*;do + digif="${f/"/"/"_"}" + ofname="$fname1"_out_ft"$digif"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:filterfolder=$f:ratio=1.5:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + done + + #test diff filter_2 &diff avx, thread is fixed to 120 + for f in filters_2*/*;do + digif="${f/"/"/"_"}" + ofname="$fname1"_out_ft"$digif"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:filterfolder=$f:ratio=2.0:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + done + + #test diff bit &diff avx, thread is fixed to 120 + result=$(echo $fname1 | grep "10bit") + if [[ "$result" != "" ]] + then + ofname="$fname1"_out_bit"10"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:bits=10:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + else + ofname="$fname1"_out_bit"08"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:bits=8:asm=$avx $opath$ofname >$common_log_path/test_log_$ofname.log 2>&1 + fi + + #test wrong inputs + #bad bits: + printf -v digi '%02d' ${wrong_bit##+(0)} + ofname="$fname1"_out_wbit"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:bits=$wrong_bit:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #bad blending: + printf -v digi '%02d' ${wrong_blending##+(0)} + ofname="$fname1"_out_wbld"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:blending=$wrong_blending:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #bad raito + printf -v digi '%02d' ${wrong_raito##+(0)} + ofname="$fname1"_out_wrat"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:radio=$wrong_raito:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #bad mode + printf -v digi '%02d' ${wrong_mode##+(0)} + ofname="$fname1"_out_wmod"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:mode=$wrong_mode:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #bad thread count + printf -v digi '%02d' ${wrong_thread##+(0)} + ofname="$fname1"_out_wth"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$wrong_thread:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #bad pass + printf -v digi '%02d' ${wrong_pass##+(0)} + ofname="$fname1"_out_wps"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:passes=$wrong_pass:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #not matching pass&mode#[RAISR WARNING] 1 pass with upscale in 2d pass, mode = 2 ignored ! + ofname="$fname1"_no_match_pm_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:passes=1:mode=2:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #negtive pass + printf -v digi '%02d' ${negtive_pass##+(0)} + ofname="$fname1"_out_nps"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:passes=$negtive_pass:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #negtive thread + printf -v digi '%02d' ${negtive_thread##+(0)} + ofname="$fname1"_out_nth"$digi"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$negtive_thread:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #directory_input + ofname="$fname1"_directory_input_"$avx".mp4 + ./ffmpeg -y -i $test_video_path -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #no_input #Did you mean file:-profile:v? + ofname="$fname1"_no_input_"$avx".mp4 + ./ffmpeg -y -i -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:asm=$avx $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + #bad config 12 3 3 11|24 3 3|24 3 3 6|24 3 3 9 + for config in ${bad_configs[@]}; do + ofname="$fname1"_config_"$config"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:asm=$avx:filterfolder=filters_wrongConfig/filters1_$config $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + done + #bad nums + for badpath in ${bad_nums[@]}; do + ofname="$fname1"_"$badpath"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:asm=$avx:filterfolder=filters_badNums/filters1_$badpath $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + done + #no pathes + for confpath in ${no_pathes[@]}; do + ofname="$fname1"_"$confpath"_"$avx".mp4 + ./ffmpeg -y -i $filename -profile:v high -b:v 6M -maxrate 12M -bufsize 24M -crf 28 -vf raisr=threadcount=$fixed_thread:asm=$avx:filterfolder=filters_noPathes/filters1_$confpath $opath$ofname >$wrong_input_log_path/test_log_$ofname.log 2>&1 + done + done +done + +echo "========== Start of summary" +echo "Finished tests:" +echo "Test logs: ${ffmpeg_path}/test_logs" +echo "Test bad input logs: ${ffmpeg_path}/test_bad_input_logs" +echo "Test outputs: ${ffmpeg_path}/outputs/" +echo "Results:" +echo "Should find 0 match per file:" +grep -c failed ${ffmpeg_path}/test_logs/* +echo "Should find 1 match per file:" +grep -Ec "failed|not found|RAISR WARNING|Is a directory" ${ffmpeg_path}/test_bad_input_logs/* +echo "========== End of summary" diff --git a/versions.env b/versions.env new file mode 100644 index 0000000..e69de29