├── .dockerignore ├── .github ├── codeql │ └── codeql-config.yml ├── configs │ ├── hadolint.yaml │ └── super-linter │ │ ├── .clang-format │ │ ├── .markdown-lint.yml │ │ └── .yaml-lint.yml ├── dependabot.yml └── workflows │ ├── build-baremetal-coverity.yml │ ├── build-baremetal-ubuntu.yml │ ├── codeql.yml │ ├── dependency-review.yml │ ├── docker-cached-build.yml │ ├── scorecard.yml │ ├── template-docker-cached-build.yml │ └── trivy.yml ├── .gitignore ├── .shellcheckrc ├── CMakeLists.txt ├── How to build.md ├── LICENSE ├── Library ├── CMakeLists.txt ├── Raisr.cpp ├── Raisr.h ├── RaisrDefaults.h ├── RaisrHandler.cpp ├── RaisrHandler.h ├── RaisrVersion.h ├── RaisrVersion.h.in ├── Raisr_AVX256.cpp ├── Raisr_AVX256.h ├── Raisr_AVX512.cpp ├── Raisr_AVX512.h ├── Raisr_AVX512FP16.cpp ├── Raisr_AVX512FP16.h ├── Raisr_OpenCL.cpp ├── Raisr_OpenCL.h ├── Raisr_OpenCL_kernel.h ├── Raisr_globals.h └── ThreadPool.h ├── README.md ├── ReleaseNotes.md ├── SECURITY.md ├── build.sh ├── docker ├── Flex │ ├── Dockerfile.ubuntu22.04 │ └── nginx.conf └── Xeon │ ├── Dockerfile.centos9 │ ├── Dockerfile.rockylinux9 │ ├── Dockerfile.rockylinux9-mini │ ├── Dockerfile.ubuntu18.04 │ ├── Dockerfile.ubuntu20.04 │ ├── Dockerfile.ubuntu22.04 │ └── yum │ └── oneAPI.repo ├── docker_build.sh ├── docs ├── advanced usage ├── images │ ├── Pipeline_flow.png │ ├── Pipeline_performance.png │ ├── Pipeline_performance_AWS.png │ ├── RAISR_AWS.png │ └── RAISR_baremetal.png └── performance.md ├── ffmpeg ├── 0001-ffmpeg-raisr-filter.patch ├── 0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch ├── vf_raisr.c └── vf_raisr_opencl.c ├── filters_1.5x ├── filters_denoise │ ├── Qfactor_cohbin_2_8 │ ├── Qfactor_cohbin_2_8_2 │ ├── Qfactor_strbin_2_8 │ ├── Qfactor_strbin_2_8_2 │ ├── config │ ├── filterbin_2_8 │ ├── filterbin_2_8_2 │ └── filternotes.txt └── filters_highres │ ├── Qfactor_cohbin_2_8 │ ├── Qfactor_strbin_2_8 │ ├── config │ ├── filterbin_2_8 │ └── filternotes.txt ├── filters_2x ├── filters_denoise │ ├── Qfactor_cohbin_2_10 │ ├── Qfactor_cohbin_2_10_2 │ ├── Qfactor_cohbin_2_8 │ ├── Qfactor_cohbin_2_8_2 │ ├── Qfactor_strbin_2_10 │ ├── Qfactor_strbin_2_10_2 │ ├── Qfactor_strbin_2_8 │ ├── Qfactor_strbin_2_8_2 │ ├── config │ ├── filterbin_2_10 │ ├── filterbin_2_10_2 │ ├── filterbin_2_8 │ ├── filterbin_2_8_2 │ └── filternotes.txt ├── filters_highres │ ├── Qfactor_cohbin_2_10 │ ├── Qfactor_cohbin_2_10_2 │ ├── Qfactor_cohbin_2_8 │ ├── Qfactor_cohbin_2_8_2 │ ├── Qfactor_strbin_2_10 │ ├── Qfactor_strbin_2_10_2 │ ├── Qfactor_strbin_2_8 │ ├── Qfactor_strbin_2_8_2 │ ├── config │ ├── filterbin_2_10 │ ├── filterbin_2_10_2 │ ├── filterbin_2_8 │ ├── filterbin_2_8_2 │ └── filternotes.txt └── filters_lowres │ ├── Qfactor_cohbin_2_10 │ ├── Qfactor_cohbin_2_8 │ ├── Qfactor_cohbin_2_8_2 │ ├── Qfactor_strbin_2_10 │ ├── Qfactor_strbin_2_8 │ ├── Qfactor_strbin_2_8_2 │ ├── config │ ├── filterbin_2_10 │ ├── filterbin_2_8 │ ├── filterbin_2_8_2 │ └── filternotes.txt ├── license └── ThreadPool_zLib_license ├── scripts ├── 01_pull_resources.sh ├── 02_install_prerequisites.sh ├── 03_build_raisr_ffmpeg.sh ├── common.sh └── patch │ └── ffmpeg │ └── 0001-avcodec-x86-mathops-clip-constants.patch ├── test └── validation_suite │ ├── create_wrong_files.sh │ └── run_tests_avxout.sh └── versions.env /.dockerignore: -------------------------------------------------------------------------------- 1 | *.md 2 | ./Jenkinsfile* 3 | ./license* 4 | ./test* 5 | *Dockerfile* 6 | .github/** 7 | .vscode** 8 | ./_build/* 9 | ./build/* 10 | ./docs* 11 | ./_install* 12 | -------------------------------------------------------------------------------- /.github/codeql/codeql-config.yml: -------------------------------------------------------------------------------- 1 | name: "RAISR CodeQL Config" 2 | -------------------------------------------------------------------------------- /.github/configs/hadolint.yaml: -------------------------------------------------------------------------------- 1 | ignored: 2 | - DL3002 # DL3002 Last user should not be root. 3 | - DL3006 # DL3006 Always tag the version of an image explicitly 4 | - DL3008 # DL3008⁠ Pin versions in apt-get install. 5 | - DL3013 # DL3013 Pin versions in pip. 6 | - DL3016 # DL3016 Pin versions in npm. 7 | - DL3018 # DL3018 Pin versions in apk add. Instead of apk add use apk add =. 8 | - DL3028 # DL3028 Pin versions in gem install. Instead of gem install use gem install :. 9 | - DL3033 # DL3033 warning: Specify version with `yum install -y -`. 10 | - SC2086 # SC2086 Double quote to prevent globbing and word splitting. 11 | - SC2267 # SC2267 info: GNU xargs -i is deprecated in favor of -I{} 12 | trustedRegistries: 13 | - docker.io 14 | - gcr.io 15 | - ghcr.io 16 | - quay.io 17 | -------------------------------------------------------------------------------- /.github/configs/super-linter/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | -------------------------------------------------------------------------------- /.github/configs/super-linter/.markdown-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########################### 3 | ########################### 4 | ## Markdown Linter rules ## 5 | ########################### 6 | ########################### 7 | 8 | # Linter rules doc: 9 | # - https://github.com/DavidAnson/markdownlint 10 | # 11 | # Note: 12 | # To comment out a single error: 13 | # 14 | # any violations you want 15 | # 16 | # 17 | 18 | ############### 19 | # Rules by id # 20 | ############### 21 | MD004: false # Unordered list style 22 | MD007: 23 | indent: 2 # Unordered list indentation 24 | MD013: 25 | line_length: 400 # Line length 80 is far too short 26 | MD026: 27 | punctuation: ".,;:!。,;:" # List of not allowed 28 | MD029: false # Ordered list item prefix 29 | MD033: false # Allow inline HTML 30 | MD036: false # Emphasis used instead of a heading 31 | 32 | ################# 33 | # Rules by tags # 34 | ################# 35 | blank_lines: false # Error on blank lines 36 | -------------------------------------------------------------------------------- /.github/configs/super-linter/.yaml-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########################################### 3 | # These are the rules used for # 4 | # linting all the yaml files in the stack # 5 | # NOTE: # 6 | # You can disable line with: # 7 | # # yamllint disable-line # 8 | ########################################### 9 | rules: 10 | braces: 11 | level: warning 12 | min-spaces-inside: 0 13 | max-spaces-inside: 0 14 | min-spaces-inside-empty: 1 15 | max-spaces-inside-empty: 5 16 | brackets: 17 | level: warning 18 | min-spaces-inside: 0 19 | max-spaces-inside: 0 20 | min-spaces-inside-empty: 1 21 | max-spaces-inside-empty: 5 22 | colons: 23 | level: warning 24 | max-spaces-before: 0 25 | max-spaces-after: 1 26 | commas: 27 | level: warning 28 | max-spaces-before: 0 29 | min-spaces-after: 1 30 | max-spaces-after: 1 31 | comments: disable 32 | comments-indentation: disable 33 | document-end: disable 34 | document-start: 35 | level: warning 36 | present: true 37 | empty-lines: 38 | level: warning 39 | max: 2 40 | max-start: 0 41 | max-end: 0 42 | hyphens: 43 | level: warning 44 | max-spaces-after: 1 45 | indentation: 46 | level: warning 47 | spaces: consistent 48 | indent-sequences: true 49 | check-multi-line-strings: false 50 | key-duplicates: enable 51 | line-length: 52 | level: warning 53 | max: 80 54 | allow-non-breakable-words: true 55 | allow-non-breakable-inline-mappings: true 56 | new-line-at-end-of-file: disable 57 | new-lines: 58 | type: unix 59 | trailing-spaces: disable 60 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: /.github 5 | schedule: 6 | interval: "weekly" 7 | day: "sunday" 8 | 9 | - package-ecosystem: docker 10 | directory: /docker 11 | schedule: 12 | interval: "weekly" 13 | day: "sunday" 14 | -------------------------------------------------------------------------------- /.github/workflows/build-baremetal-coverity.yml: -------------------------------------------------------------------------------- 1 | name: scan-coverity-baremetal 2 | 3 | on: 4 | schedule: 5 | - cron: '0 18 * * *' 6 | workflow_dispatch: 7 | inputs: 8 | branch: 9 | description: 'Branch to run scans on' 10 | default: 'main' 11 | type: string 12 | 13 | env: 14 | TZ: "Europe/Warsaw" 15 | BUILD_TYPE: "Release" 16 | DEBIAN_FRONTEND: "noninteractive" 17 | FFMPEG_COMMIT_ID: "n6.1.1" 18 | BUILD_DIR: "${{ github.workspace }}/build" 19 | BUILD_FFMPEG_DIR: "${{ github.workspace }}/build-ffmpeg" 20 | PREFIX: "${{ github.workspace }}/_install" 21 | 22 | defaults: 23 | run: 24 | shell: bash 25 | 26 | permissions: 27 | contents: read 28 | 29 | concurrency: 30 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 31 | cancel-in-progress: true 32 | 33 | jobs: 34 | coverity: 35 | runs-on: 'ubuntu-22.04' 36 | timeout-minutes: 90 37 | steps: 38 | - name: 'Harden Runner' 39 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 40 | with: 41 | egress-policy: audit 42 | 43 | - name: 'Checkout repository' 44 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 45 | with: 46 | ref: ${{ inputs.branch }} 47 | 48 | - name: 'Install OS level dependencies' 49 | run: | 50 | set -exo pipefail && \ 51 | mkdir -p "${PREFIX}" "${BUILD_DIR}" "${BUILD_FFMPEG_DIR}" && \ 52 | sudo apt-get update --fix-missing && \ 53 | sudo apt-get full-upgrade -y && \ 54 | sudo apt-get install --no-install-recommends -y \ 55 | build-essential \ 56 | ca-certificates \ 57 | cmake \ 58 | curl \ 59 | diffutils \ 60 | git \ 61 | gpg \ 62 | libx264-dev \ 63 | libx265-dev \ 64 | nasm \ 65 | ocl-icd-opencl-dev \ 66 | opencl-headers \ 67 | tar \ 68 | unzip \ 69 | wget \ 70 | zlib1g-dev 71 | 72 | - name: 'Install Intel OneAPI APT repository' 73 | run: | 74 | set -exo pipefail && \ 75 | curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg && \ 76 | echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneAPI.list && \ 77 | sudo apt-get update --fix-missing && \ 78 | sudo apt-get install --no-install-recommends -y intel-oneapi-ipp-devel-2022.0 79 | 80 | - name: 'Run coverity' 81 | uses: vapier/coverity-scan-action@2068473c7bdf8c2fb984a6a40ae76ee7facd7a85 # v1.8.0 82 | with: 83 | project: 'Video-Super-Resolution-Library' 84 | email: ${{ secrets.COVERITY_SCAN_EMAIL }} 85 | token: ${{ secrets.COVERITY_SCAN_TOKEN }} 86 | build_language: 'cxx' 87 | build_platform: 'linux64' 88 | command: | 89 | "${{ github.workspace }}/build.sh" -DENABLE_RAISR_OPENCL=ON \ 90 | -DCMAKE_LIBRARY_PATH="/opt/intel/oneapi/ipp/latest/lib;${PREFIX}/lib;" \ 91 | -DCMAKE_C_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" \ 92 | -DCMAKE_CXX_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" 93 | 94 | - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 95 | with: 96 | name: coverity-reports 97 | path: '${{ github.workspace }}/cov-int' 98 | -------------------------------------------------------------------------------- /.github/workflows/build-baremetal-ubuntu.yml: -------------------------------------------------------------------------------- 1 | name: build-baremetal-ubuntu 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | workflow_dispatch: 9 | 10 | env: 11 | TZ: "Europe/Warsaw" 12 | BUILD_TYPE: "Release" 13 | DEBIAN_FRONTEND: "noninteractive" 14 | FFMPEG_COMMIT_ID: "n6.1.1" 15 | BUILD_DIR: "${{ github.workspace }}/build" 16 | BUILD_FFMPEG_DIR: "${{ github.workspace }}/build-ffmpeg" 17 | PREFIX: "${{ github.workspace }}/_install" 18 | 19 | defaults: 20 | run: 21 | shell: bash 22 | 23 | permissions: 24 | contents: read 25 | 26 | concurrency: 27 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 28 | cancel-in-progress: true 29 | 30 | jobs: 31 | build-baremetal-ubuntu: 32 | runs-on: 'ubuntu-22.04' 33 | timeout-minutes: 70 34 | env: 35 | LD_LIBRARY_PATH: "/opt/intel/oneapi/ipp/latest/lib:${PREFIX}/usr/lib:${PREFIX}/lib:${PREFIX}/lib64:${LD_LIBRARY_PATH}" 36 | steps: 37 | - name: 'Harden Runner' 38 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 39 | with: 40 | egress-policy: audit 41 | 42 | - name: 'Checkout repository' 43 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 44 | 45 | - name: 'Install OS level dependencies' 46 | run: | 47 | set -exo pipefail && \ 48 | mkdir -p "${PREFIX}" "${BUILD_DIR}" "${BUILD_FFMPEG_DIR}" && \ 49 | sudo apt-get update --fix-missing && \ 50 | sudo apt-get full-upgrade -y && \ 51 | sudo apt-get install --no-install-recommends -y \ 52 | build-essential \ 53 | ca-certificates \ 54 | cmake \ 55 | curl \ 56 | diffutils \ 57 | git \ 58 | gpg \ 59 | libx264-dev \ 60 | libx265-dev \ 61 | nasm \ 62 | ocl-icd-opencl-dev \ 63 | opencl-headers \ 64 | tar \ 65 | unzip \ 66 | wget \ 67 | zlib1g-dev 68 | 69 | - name: 'Install Intel OneAPI APT repository' 70 | run: | 71 | set -exo pipefail && \ 72 | curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg && \ 73 | echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneAPI.list && \ 74 | sudo apt-get update --fix-missing && \ 75 | sudo apt-get install --no-install-recommends -y intel-oneapi-ipp-devel-2022.0 76 | 77 | - name: 'Download and patch ffmpeg repository' 78 | run: | 79 | set -eo pipefail && \ 80 | curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | tar -zx --strip-components=1 -C "${BUILD_FFMPEG_DIR}" 81 | patch -d "${BUILD_FFMPEG_DIR}" -p1 -i <(cat "${{ github.workspace }}/ffmpeg/"*.patch) 82 | cp "${{ github.workspace }}/ffmpeg/vf_raisr"*.c "${BUILD_FFMPEG_DIR}/libavfilter" 83 | 84 | - name: 'Build RAISR from source code' 85 | run: | 86 | ./build.sh -DENABLE_RAISR_OPENCL=ON \ 87 | -DCMAKE_LIBRARY_PATH="/opt/intel/oneapi/ipp/latest/lib;${PREFIX}/lib;" \ 88 | -DCMAKE_C_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" \ 89 | -DCMAKE_CXX_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" 90 | 91 | - name: 'Configure ffmpeg repository' 92 | continue-on-error: true 93 | run: | 94 | cd "${BUILD_FFMPEG_DIR}" 95 | ./configure \ 96 | --disable-shared \ 97 | --disable-debug \ 98 | --disable-doc \ 99 | --enable-static \ 100 | --enable-libipp \ 101 | --enable-gpl \ 102 | --enable-libx264 \ 103 | --enable-libx265 \ 104 | --enable-opencl \ 105 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm' \ 106 | --extra-cflags='-fopenmp -I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp' \ 107 | --extra-ldflags="-fopenmp -L/opt/intel/oneapi/ipp/latest/lib -L${PREFIX}/lib" \ 108 | --enable-cross-compile \ 109 | --prefix="${PREFIX}" || \ 110 | { tail -n 100 "${BUILD_DIR}/ffmpeg/ffbuild/config.log" && exit 1; } 111 | 112 | - name: 'Build, install and check ffmpeg' 113 | continue-on-error: true 114 | run: | 115 | cd "${BUILD_FFMPEG_DIR}" 116 | make clean 117 | make -j"$(nproc)" 118 | sudo -E make install 119 | sudo -E ldconfig 120 | ffmpeg -buildconf 121 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: scan-codeql-workflow 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | schedule: 9 | - cron: '15 0 * * *' 10 | 11 | env: 12 | TZ: "Europe/Warsaw" 13 | BUILD_TYPE: "Release" 14 | DEBIAN_FRONTEND: "noninteractive" 15 | FFMPEG_COMMIT_ID: "n6.1.1" 16 | BUILD_DIR: "${{ github.workspace }}/build" 17 | PREFIX: "${{ github.workspace }}/_install" 18 | 19 | defaults: 20 | run: 21 | shell: bash 22 | 23 | permissions: 24 | contents: read 25 | 26 | concurrency: 27 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 28 | cancel-in-progress: true 29 | 30 | jobs: 31 | analyze: 32 | name: 'scan-codeql-workflow-analyze' 33 | runs-on: ${{ matrix.runner-os }} 34 | timeout-minutes: 90 35 | strategy: 36 | fail-fast: false 37 | matrix: 38 | runner-os: [ 'ubuntu-22.04' ] 39 | permissions: 40 | actions: read 41 | security-events: write 42 | steps: 43 | - name: 'Harden Runner' 44 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 45 | with: 46 | egress-policy: audit 47 | 48 | - name: 'Checkout repository' 49 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 50 | 51 | - name: 'Install OS level dependencies' 52 | run: | 53 | set -exo pipefail && \ 54 | mkdir -p "${PREFIX}" "${BUILD_DIR}/ffmpeg" && \ 55 | sudo apt-get update --fix-missing && \ 56 | sudo apt-get full-upgrade -y && \ 57 | sudo apt-get install --no-install-recommends -y \ 58 | build-essential \ 59 | ca-certificates \ 60 | cmake \ 61 | diffutils \ 62 | gpg \ 63 | libx264-dev \ 64 | libx265-dev \ 65 | llvm \ 66 | m4 \ 67 | meson \ 68 | nasm \ 69 | ocl-icd-opencl-dev \ 70 | opencl-headers \ 71 | zlib1g-dev \ 72 | make curl git sudo tar unzip wget yasm 73 | 74 | - name: 'Install Intel OneAPI APT repository' 75 | run: | 76 | set -exo pipefail && \ 77 | curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg && \ 78 | echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneAPI.list && \ 79 | sudo apt-get update --fix-missing && \ 80 | sudo apt-get install --no-install-recommends -y intel-oneapi-ipp-devel-2022.0 81 | 82 | - name: 'Download and patch ffmpeg repository' 83 | run: | 84 | set -exo pipefail && \ 85 | curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | tar -zx --strip-components=1 -C "${BUILD_DIR}/ffmpeg" 86 | patch -d "${BUILD_DIR}/ffmpeg" -p1 -i <(cat "${{ github.workspace }}/ffmpeg/"*.patch) 87 | cp "${{ github.workspace }}/ffmpeg/vf_raisr"*.c "${BUILD_DIR}/ffmpeg/libavfilter" 88 | 89 | - name: 'Initialize CodeQL action' 90 | uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 91 | with: 92 | languages: "c-cpp" 93 | config-file: "${{ github.workspace }}/.github/codeql/codeql-config.yml" 94 | 95 | - name: 'Build RAISR from source code' 96 | run: | 97 | "${{ github.workspace }}/build.sh" -DENABLE_RAISR_OPENCL=ON \ 98 | -DCMAKE_LIBRARY_PATH="/opt/intel/oneapi/ipp/latest/lib;${PREFIX}/lib;" \ 99 | -DCMAKE_C_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" \ 100 | -DCMAKE_CXX_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" 101 | 102 | - name: 'Perform CodeQL Analysis' 103 | uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 104 | with: 105 | category: "/language:c-cpp" 106 | -------------------------------------------------------------------------------- /.github/workflows/dependency-review.yml: -------------------------------------------------------------------------------- 1 | # Source repository: https://github.com/actions/dependency-review-action 2 | 3 | name: 'scan-dependency-review' 4 | on: [pull_request] 5 | 6 | permissions: 7 | contents: read 8 | env: 9 | LINTER_RULES_PATH: .github/configs/super-linter 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | dependency-review: 17 | name: 'scan-dependency-review: Dependency review steps' 18 | runs-on: 'ubuntu-22.04' 19 | steps: 20 | - name: 'Harden Runner' 21 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 22 | with: 23 | egress-policy: audit 24 | 25 | - name: 'Checkout Repository' 26 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 27 | 28 | - name: 'Dependency Review' 29 | uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3 30 | 31 | super-linter: 32 | name: 'scan-dependency-review: Super-Linter' 33 | runs-on: 'ubuntu-22.04' 34 | permissions: 35 | contents: read 36 | timeout-minutes: 90 37 | env: 38 | SUPER_LINTER_OUTPUT_DIRECTORY_NAME: super-linter-output 39 | SUPER_LINTER_SUMMARY_FILE_NAME: super-linter-summary.md 40 | SAVE_SUPER_LINTER_SUMMARY: true 41 | ENABLE_GITHUB_ACTIONS_STEP_SUMMARY : true 42 | steps: 43 | - name: 'super-linter: Harden Runner' 44 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 45 | with: 46 | egress-policy: audit 47 | 48 | - name: 'super-linter: checkout repository [fetch-depth=0]' 49 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 50 | with: 51 | fetch-depth: 0 52 | ref: ${{ inputs.branch }} 53 | 54 | - name: 'super-linter: perform super-linter scan workflow.' 55 | uses: super-linter/super-linter/slim@e1cb86b6e8d119f789513668b4b30bf17fe1efe4 # v7.2.0 x-release-please-version 56 | env: 57 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 58 | DISABLE_ERRORS: true 59 | VALIDATE_MARKDOWN: true 60 | VALIDATE_MARKDOWN_PRETTIER: true 61 | VALIDATE_JSONC: true 62 | VALIDATE_GITHUB_ACTIONS: true 63 | VALIDATE_CPP: true 64 | VALIDATE_CLANG_FORMAT: true 65 | VALIDATE_BASH: true 66 | VALIDATE_BASH_EXEC: true 67 | 68 | - name: 'super-linter: upload linter results as an artifact.' 69 | uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 70 | if: env.SAVE_SUPER_LINTER_SUMMARY == 'true' || env.ENABLE_GITHUB_ACTIONS_STEP_SUMMARY == 'true' 71 | with: 72 | name: coverity-reports 73 | path: 74 | '${{ github.workspace }}/${{ env.SUPER_LINTER_OUTPUT_DIRECTORY_NAME }}/${{ env.SUPER_LINTER_SUMMARY_FILE_NAME }}' 75 | -------------------------------------------------------------------------------- /.github/workflows/docker-cached-build.yml: -------------------------------------------------------------------------------- 1 | name: build-docker-images 2 | 3 | on: 4 | pull_request: 5 | branches: [ "main", "dev" ] 6 | push: 7 | branches: [ "main", "dev" ] 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | flex-ubuntu-2204-build: 19 | name: "Build Flex Ubuntu 22.04 Docker Image" 20 | uses: ./.github/workflows/template-docker-cached-build.yml 21 | permissions: 22 | security-events: write 23 | contents: read 24 | with: 25 | docker_file_path: "docker/Flex/Dockerfile.ubuntu22.04" 26 | docker_image_name: "raisr-flex-ubuntu-22.04" 27 | 28 | xeon-ubuntu-1804-build: 29 | name: "Build Xeon Ubuntu 18.04 Docker Image" 30 | uses: ./.github/workflows/template-docker-cached-build.yml 31 | permissions: 32 | security-events: write 33 | contents: read 34 | with: 35 | docker_file_path: "docker/Xeon/Dockerfile.ubuntu18.04" 36 | docker_image_name: "raisr-xeon-ubuntu-18.04" 37 | 38 | xeon-ubuntu-2004-build: 39 | name: "Build Xeon Ubuntu 20.04 Docker Image" 40 | uses: ./.github/workflows/template-docker-cached-build.yml 41 | permissions: 42 | security-events: write 43 | contents: read 44 | with: 45 | docker_file_path: "docker/Xeon/Dockerfile.ubuntu20.04" 46 | docker_image_name: "raisr-xeon-ubuntu-20.04" 47 | 48 | xeon-ubuntu-2204-build: 49 | name: "Build Xeon Ubuntu 22.04 Docker Image" 50 | uses: ./.github/workflows/template-docker-cached-build.yml 51 | permissions: 52 | security-events: write 53 | contents: read 54 | with: 55 | docker_file_path: "docker/Xeon/Dockerfile.ubuntu22.04" 56 | docker_image_name: "raisr-xeon-ubuntu-22.04" 57 | 58 | xeon-centos-stream9-build: 59 | name: "Build Xeon Centos Stream9 Docker Image" 60 | uses: ./.github/workflows/template-docker-cached-build.yml 61 | permissions: 62 | security-events: write 63 | contents: read 64 | with: 65 | docker_file_path: "docker/Xeon/Dockerfile.centos9" 66 | docker_image_name: "raisr-xeon-centos-9" 67 | 68 | xeon-rockylinux-9-mini-build: 69 | name: "Build Xeon Rockylinux 9-mini Docker Image" 70 | uses: ./.github/workflows/template-docker-cached-build.yml 71 | permissions: 72 | security-events: write 73 | contents: read 74 | with: 75 | docker_file_path: "docker/Xeon/Dockerfile.rockylinux9-mini" 76 | docker_image_name: "raisr-xeon-rockylinux-9-mini" 77 | -------------------------------------------------------------------------------- /.github/workflows/scorecard.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. They are provided 2 | # by a third-party and are governed by separate terms of service, privacy 3 | # policy, and support documentation. 4 | 5 | name: Scorecard supply-chain security 6 | on: 7 | # For Branch-Protection check. Only the default branch is supported. See 8 | # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection 9 | branch_protection_rule: 10 | # To guarantee Maintained check is occasionally updated. See 11 | # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained 12 | schedule: 13 | - cron: '24 12 * * 5' 14 | push: 15 | branches: [ "master" ] 16 | 17 | # Declare default permissions as read only. 18 | permissions: read-all 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | analysis: 26 | name: Scorecard analysis 27 | runs-on: ubuntu-latest 28 | if: ${{ github.repository == 'OpenVisualCloud/Video-Super-Resolution-Library' }} 29 | permissions: 30 | security-events: write 31 | id-token: write 32 | contents: read 33 | actions: read 34 | steps: 35 | - name: "scorecard: Harden Runner security" 36 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 37 | with: 38 | egress-policy: audit 39 | 40 | - name: "scorecard: Checkout code" 41 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 42 | with: 43 | persist-credentials: false 44 | 45 | - name: "scorecard: Run analysis" 46 | uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 47 | with: 48 | results_file: "scorecard-scan-results-${{ github.event.pull_request.number || github.sha }}.sarif" 49 | results_format: sarif 50 | repo_token: ${{ secrets.GITHUB_TOKEN }} 51 | publish_results: true 52 | 53 | # Upload the results as artifacts (optional). 54 | - name: "scorecard: Upload results artifact" 55 | uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 56 | with: 57 | name: "scorecard-scan-results-${{ github.event.pull_request.number || github.sha }}" 58 | path: "scorecard-scan-results-${{ github.event.pull_request.number || github.sha }}.sarif" 59 | retention-days: 5 60 | 61 | - name: "scorecard: Upload results to code-scanning" 62 | uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 63 | with: 64 | sarif_file: "scorecard-scan-results-${{ github.event.pull_request.number || github.sha }}.sarif" 65 | -------------------------------------------------------------------------------- /.github/workflows/template-docker-cached-build.yml: -------------------------------------------------------------------------------- 1 | name: template-docker-cached-build 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | build_type: 7 | required: false 8 | type: string 9 | default: 'Release' 10 | docker_registry: 11 | required: false 12 | type: string 13 | default: 'ghcr.io' 14 | docker_registry_prefix: 15 | required: false 16 | type: string 17 | default: 'openvisualcloud/video-super-resolution-library' 18 | docker_registry_login: 19 | required: false 20 | type: boolean 21 | default: false 22 | docker_registry_push: 23 | required: false 24 | type: boolean 25 | default: false 26 | docker_build_args: 27 | required: false 28 | type: string 29 | default: '' 30 | docker_build_platforms: 31 | required: false 32 | type: string 33 | default: 'linux/amd64' 34 | docker_image_tag: 35 | required: false 36 | type: string 37 | docker_image_name: 38 | required: true 39 | type: string 40 | docker_file_path: 41 | required: false 42 | type: string 43 | default: './Dockerfile' 44 | secrets: 45 | git_docker_registry_login: 46 | required: false 47 | git_docker_registry_passkey: 48 | required: false 49 | 50 | env: 51 | BUILD_TYPE: "${{ inputs.build_type }}" 52 | CONCURRENCY_GROUP: "${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}" 53 | DOCKER_REGISTRY: "${{ inputs.docker_registry }}" 54 | DOCKER_REGISTRY_LOGIN: "${{ github.repository == inputs.docker_registry_prefix && inputs.docker_registry_login }}" 55 | DOCKER_BUILD_ARGS: "${{ inputs.docker_build_args }}" 56 | DOCKER_PLATFORMS: "${{ inputs.docker_build_platforms }}" 57 | DOCKER_IMAGE_PUSH: "${{ github.repository == inputs.docker_registry_prefix && inputs.docker_registry_push }}" 58 | DOCKER_IMAGE_BASE: "${{ inputs.docker_registry }}/${{ inputs.docker_registry_prefix }}" 59 | DOCKER_IMAGE_TAG: "${{ inputs.docker_image_tag || github.sha }}" 60 | DOCKER_IMAGE_NAME: "${{ inputs.docker_image_name }}" 61 | DOCKER_FILE_PATH: "${{ inputs.docker_file_path }}" 62 | 63 | permissions: 64 | contents: read 65 | 66 | jobs: 67 | hadolint-scan-dockerfile: 68 | name: "${{ inputs.docker_image_name }}: Perform Dockerfile scan." 69 | runs-on: ubuntu-22.04 70 | permissions: 71 | contents: read 72 | security-events: write 73 | timeout-minutes: 15 74 | steps: 75 | - name: "${{ inputs.docker_image_name }} scan: Harden Runner." 76 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 77 | with: 78 | egress-policy: audit 79 | 80 | - name: "${{ inputs.docker_image_name }} scan: Checkout repository" 81 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 82 | 83 | - name: "${{ inputs.docker_image_name }} scan: Scanner Hadolint Dockerfile scan sarif format." 84 | uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 85 | with: 86 | dockerfile: "${{ env.DOCKER_FILE_PATH }}" 87 | config: .github/configs/hadolint.yaml 88 | format: sarif 89 | output-file: "hadolint-${{ env.CONCURRENCY_GROUP }}-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}.sarif" 90 | no-fail: true 91 | failure-threshold: info 92 | 93 | - name: "${{ inputs.docker_image_name }} scan: Scanner Hadolint upload results to Security tab." 94 | uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8 95 | with: 96 | sarif_file: "hadolint-${{ env.CONCURRENCY_GROUP }}-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}.sarif" 97 | 98 | - name: "${{ inputs.docker_image_name }} scan: Scanner Hadolint upload results as an artifact." 99 | uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 100 | with: 101 | name: "hadolint-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}" 102 | path: "hadolint-${{ env.CONCURRENCY_GROUP }}-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}.sarif" 103 | 104 | - name: "${{ inputs.docker_image_name }}: Scanner Hadolint Dockerfile scan tty output" 105 | if: always() 106 | uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 107 | with: 108 | dockerfile: "${{ env.DOCKER_FILE_PATH }}" 109 | config: .github/configs/hadolint.yaml 110 | format: tty 111 | failure-threshold: warning 112 | 113 | build-docker-image: 114 | needs: hadolint-scan-dockerfile 115 | name: "${{ inputs.docker_image_name }}: Perform build of Dockerfile." 116 | runs-on: ubuntu-22.04 117 | permissions: 118 | contents: read 119 | security-events: write 120 | timeout-minutes: 70 121 | env: 122 | BUILDKIT_STEP_LOG_MAX_SIZE: 50000000 123 | BUILDKIT_STEP_LOG_MAX_SPEED: 10000000 124 | DOCKER_TMPDIR: "/mnt/docker/docker-tmp" 125 | steps: 126 | - name: "${{ inputs.docker_image_name }}: Harden Runner" 127 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 128 | with: 129 | egress-policy: audit 130 | 131 | - name: "${{ inputs.docker_image_name }}: Disable OS SWAP, create mnt points, show settings." 132 | shell: bash 133 | run: | 134 | SWAP_FILE="$(sudo swapon --show=NAME | tail -n 1)" 135 | sudo swapoff "${SWAP_FILE}" 136 | sudo rm "${SWAP_FILE}" 137 | sudo mkdir -p "/mnt/docker/docker-d" "/mnt/docker/docker-tmp" 138 | 139 | - name: "${{ inputs.docker_image_name }}: Add data-root and JSON dockerd config. Reload daemons." 140 | shell: bash 141 | run: | 142 | sudo chmod 666 /etc/docker/daemon.json 143 | echo "$(sudo jq '. += {"data-root":"/mnt/docker/docker-d","log-driver":"json-file","log-format":"text","log-level":"info","log-opts":{"cache-disabled":"false","cache-max-file":"5","cache-max-size":"20m","max-file":"5","max-size":"10m"}}' /etc/docker/daemon.json)" > /etc/docker/daemon.json 144 | sudo chmod 644 /etc/docker/daemon.json 145 | sudo systemctl daemon-reload 146 | sudo systemctl restart docker 147 | 148 | - name: "${{ inputs.docker_image_name }}: Show applied configuration." 149 | shell: bash 150 | run: | 151 | sudo free -h 152 | sudo lsblk 153 | sudo df -h 154 | sudo cat "/etc/docker/daemon.json" 155 | 156 | - name: "${{ inputs.docker_image_name }}: Set up Docker Buildx and Toolkit" 157 | uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0 158 | with: 159 | buildkitd-flags: "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host" 160 | platforms: "${{ env.DOCKER_PLATFORMS }}" 161 | driver-opts: "memory=14Gib,memory-swap=25Gib,env.BUILDKIT_STEP_LOG_MAX_SIZE=${{ env.BUILDKIT_STEP_LOG_MAX_SIZE }},env.BUILDKIT_STEP_LOG_MAX_SPEED=${{ env.BUILDKIT_STEP_LOG_MAX_SPEED }}" 162 | 163 | - name: "${{ inputs.docker_image_name }}: Checkout repository" 164 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 165 | 166 | - name: "${{ inputs.docker_image_name }}: Login to Docker Container Registry" 167 | uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 168 | if: ${{ env.DOCKER_REGISTRY_LOGIN == 'true' }} 169 | with: 170 | registry: "${{ env.DOCKER_REGISTRY }}" 171 | username: "${{ secrets.GIT_DOCKER_REGISTRY_LOGIN || env.GITHUB_ACTOR }}" 172 | password: "${{ secrets.GIT_DOCKER_REGISTRY_PASSKEY || secrets.GITHUB_TOKEN }}" 173 | 174 | - name: "${{ inputs.docker_image_name }}: Build and push image" 175 | uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0 176 | with: 177 | load: true 178 | push: "${{ env.DOCKER_IMAGE_PUSH }}" 179 | outputs: type=docker 180 | platforms: "${{ env.DOCKER_PLATFORMS }}" 181 | file: "${{ env.DOCKER_FILE_PATH }}" 182 | tags: "${{ env.DOCKER_IMAGE_BASE }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}" 183 | cache-from: type=gha,scope=${{ env.DOCKER_IMAGE_NAME }} 184 | cache-to: type=gha,mode=max,scope=${{ env.DOCKER_IMAGE_NAME }} 185 | build-args: "${{ env.DOCKER_BUILD_ARGS }}" 186 | 187 | - name: "${{ inputs.docker_image_name }}: Scanner Trivy run vulnerability scanner on image" 188 | uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0 189 | with: 190 | image-ref: "${{ env.DOCKER_IMAGE_BASE }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}" 191 | format: "sarif" 192 | output: "${{ env.CONCURRENCY_GROUP }}-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}.sarif" 193 | 194 | - name: "${{ inputs.docker_image_name }}: Scanner Trivy upload results to Security tab" 195 | uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8 196 | with: 197 | sarif_file: "${{ env.CONCURRENCY_GROUP }}-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}.sarif" 198 | 199 | - name: "${{ inputs.docker_image_name }}: Scanner Trivy upload results as an artifact." 200 | uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 201 | with: 202 | name: "trivy-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}" 203 | path: "${{ env.CONCURRENCY_GROUP }}-${{ env.DOCKER_IMAGE_NAME }}-${{ env.DOCKER_IMAGE_TAG }}.sarif" 204 | -------------------------------------------------------------------------------- /.github/workflows/trivy.yml: -------------------------------------------------------------------------------- 1 | name: Trivy 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | scan-type-config: 12 | runs-on: ubuntu-22.04 13 | permissions: 14 | contents: read # for actions/checkout to fetch code 15 | security-events: write # for github/codeql-action/upload-sarif to upload SARIF results 16 | name: scan-type-config 17 | steps: 18 | - name: Harden Runner 19 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 20 | with: 21 | egress-policy: audit 22 | 23 | - name: Checkout code 24 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 25 | 26 | - name: Run Trivy vulnerability scanner, scan-type=config 27 | uses: aquasecurity/trivy-action@7c2007bcb556501da015201bcba5aa14069b74e2 # v0.23.0 28 | with: 29 | scan-type: 'config' 30 | hide-progress: false 31 | ignore-unfixed: true 32 | format: 'sarif' 33 | output: 'trivy-config-results.sarif' 34 | severity: 'CRITICAL,HIGH,MEDIUM' 35 | 36 | - name: Upload Trivy config scan results to GitHub Security tab 37 | uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 38 | with: 39 | sarif_file: 'trivy-config-results.sarif' 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.jpg 2 | *.JPG 3 | *.BMP 4 | *.o 5 | *.bin 6 | *.log 7 | Debug 8 | Release 9 | x64 10 | 11 | # Visual Studio user-specific files 12 | *.rsuser 13 | *.suo 14 | *.user 15 | *.userosscache 16 | *.sln.docstates 17 | .vscode 18 | 19 | # Visual C++ cache files 20 | *.aps 21 | *.ncb 22 | *.opendb 23 | *.opensdf 24 | *.sdf 25 | *.cachefile 26 | *.VC.db 27 | *.VC.VC.opendb 28 | 29 | # Visual Studio cache/options directory 30 | *.vs 31 | 32 | # Visual Studio project files 33 | #*.filters 34 | #*.vcxproj 35 | #*.sln 36 | 37 | #cmake 38 | CMakeLists.txt.user 39 | CMakeCache.txt 40 | CMakeFiles 41 | CMakeScripts 42 | Testing 43 | Makefile 44 | cmake_install.cmake 45 | install_manifest.txt 46 | compile_commands.json 47 | CTestTestfile.cmake 48 | 49 | RaisrTestApp.dir 50 | test_images* 51 | result_images 52 | build 53 | *.diff 54 | *.perf 55 | *.data 56 | *.old 57 | *.*proj 58 | *.*advi* 59 | config/ 60 | raisr/ 61 | -------------------------------------------------------------------------------- /.shellcheckrc: -------------------------------------------------------------------------------- 1 | external-sources=true 2 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | set(PROJECT_NAME "Raisr") 3 | project(${PROJECT_NAME} CXX) 4 | 5 | if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") 6 | message(WARNING "Building in-source is highly not recommended\n" 7 | "Please use the Build folder or create your own.") 8 | endif() 9 | 10 | 11 | set(CMAKE_BUILD_TYPE Release) 12 | 13 | #COMPILE_AS_CPP 14 | enable_language(CXX) 15 | include(CheckCXXCompilerFlag) 16 | 17 | set(RAISR_VERSION_MAJOR "23") 18 | set(RAISR_VERSION_MINOR "11") 19 | configure_file(${PROJECT_SOURCE_DIR}/Library/RaisrVersion.h.in ${PROJECT_SOURCE_DIR}/Library/RaisrVersion.h @ONLY) 20 | 21 | if( UNIX ) 22 | 23 | set(flags_to_test 24 | -march=native 25 | -O3 26 | -std=c++17 27 | -DNDEBUG 28 | -ffast-math 29 | -Wno-narrowing 30 | -fPIC 31 | ) 32 | 33 | # Raisr can use SVML for atan2 if Intel Compiler can be found, otherwise uses an atanApproximation 34 | get_filename_component(CC_FILENAME ${CMAKE_CXX_COMPILER} NAME) 35 | string(FIND "${CC_FILENAME}" "icp" CC_SUBSTR_INTEL) 36 | if (${CC_SUBSTR_INTEL} LESS 0) 37 | message("Building with Atan Approximation") 38 | list(APPEND flags_to_test "-DUSE_ATAN2_APPROX") 39 | else() 40 | message("Building with Intel Compiler, using SVML") 41 | endif() 42 | 43 | INCLUDE(CheckCXXSourceRuns) 44 | SET(CMAKE_REQUIRED_FLAGS "-march=native") 45 | check_cxx_source_runs(" 46 | #include 47 | int main(int argc, char** argv) { 48 | _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}; 49 | _Float16 output[32]; 50 | __m512h a = _mm512_loadu_ph(data); // avx512fp16 51 | __m512h b = _mm512_loadu_ph(data); 52 | __mmask32 mask = _mm512_cmp_ph_mask(a, b, _CMP_EQ_OQ); // avx512fp16 53 | __m512h c = _mm512_add_ph(a, b); // avx512fp16 54 | _mm512_storeu_ph(output, c); // avx512fp16 55 | return 0; 56 | }" HAVE_AVX512FP16) 57 | check_cxx_source_runs(" 58 | #include 59 | int main(int argc, char** argv) { 60 | float data[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; 61 | float output[16]; 62 | __m512 a = _mm512_loadu_ps(data); // avx512f 63 | __m512 b = _mm512_loadu_ps(data); 64 | __mmask8 mask = _mm512_cmp_ps_mask(a, b, _CMP_EQ_OQ); // avx512vl 65 | __m512 c = _mm512_add_ps(a, b); // avx512f 66 | _mm512_storeu_ps(output, c); // avx512f 67 | return 0; 68 | }" HAVE_AVX512) 69 | 70 | foreach(cflag ${flags_to_test}) 71 | string(REGEX REPLACE "[^A-Za-z0-9]" "_" cflag_var "${cflag}") 72 | set(test_cxx_flag "CXX_FLAG${cflag_var}") 73 | check_cxx_compiler_flag(${cflag} "${test_cxx_flag}") 74 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cflag}") 75 | endforeach() 76 | 77 | endif(UNIX) 78 | 79 | option( ENABLE_RAISR_OPENCL "Build with OpenCL?" OFF ) 80 | if (ENABLE_RAISR_OPENCL) 81 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_RAISR_OPENCL") 82 | endif() 83 | 84 | option( ENABLE_AVX512FP16 "Build AVX512fp16 despite test results" OFF ) 85 | if (ENABLE_AVX512FP16) 86 | set(HAVE_AVX512FP16 ON) 87 | endif() 88 | 89 | option( ENABLE_AVX512 "Build AVX512 despite test results" OFF ) 90 | if (ENABLE_AVX512) 91 | set(HAVE_AVX512 ON) 92 | endif() 93 | # Intel Library for Video Super Resolution 94 | add_subdirectory(Library) 95 | 96 | # Raisr Sample app 97 | include_directories(${PROJECT_SOURCE_DIR}/Library/) 98 | 99 | -------------------------------------------------------------------------------- /How to build.md: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | To build this project you will need: 3 | - Linux based OS 4 | - For CPU tested and validated on Ubuntu 18.04 LTS, Ubuntu 22.04 and CentOS 7.9 5 | - For GPU tested and validated on Intel® Data Center GPU Flex 170 with Ubuntu 22.04 LTS(5.15 LTS kernel) 6 | - [Docker](https://www.docker.com/) 7 | - Intel Xeon hardware which supports Intel AVX512 (Skylake generation or later) 8 | - Compiler (clang++, g++, icc), and enabling AVX512-FP16 on Sapphire Rapiads needs: 9 | - clang++ version 14.0.0 or later 10 | - g++ version 12.1.0 with binutils 2.38 or later 11 | - icc version 2021.2 or later 12 | - Cmake version 3.14 or later 13 | - Intel® Integrated Performance Primitives (Intel® IPP) (Stand-Alone Version is the minimum requirement) 14 | - zlib1g-dev, pkg-config (The pkg-config is used to find x264.pc/x265.pc in specific pkgconfig path.) 15 | 16 | We provide 3 ways to build the Intel VSR with FFmpeg environment: 17 | - build docker images with dockerfiles(both CPU and GPU). 18 | - build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/main/scripts)(only for CPU). 19 | - build manually(both CPU and GPU). 20 | 21 | # Build Docker Images. 22 | 23 | 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. 24 | ## Setup docker proxy as follows if you are behind a firewall: 25 | ``` 26 | sudo mkdir -p /etc/systemd/system/docker.service.d 27 | printf "[Service]\nEnvironment=\"HTTPS_PROXY=$https_proxy\" \"NO_PROXY=$no_proxy\"\n" | sudo tee /etc/systemd/system/docker.service.d/proxy.conf 28 | sudo systemctl daemon-reload 29 | sudo systemctl restart docker 30 | ``` 31 | 32 | ## build docker image via docker_build.sh 33 | The usage of the script is as follows 34 | ``` 35 | ./docker_build.sh 36 | 37 | ./docker_build.sh xeon ubuntu 22.04 #for building Xeon platform with Ubuntu22.04 38 | ./docker_build.sh xeon ubuntu 18.04 #for building Xeon platform with Ubuntu18.04 39 | ./docker_build.sh xeon centos 7.9 #for building Xeon platform with CentOS7.9 40 | ./docker_build.sh flex ubuntu 22.04 #for building Flex platform with Ubuntu22.04 41 | ``` 42 | 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` 43 | Please note it needs to add `--privileged --device /dev/dri` option to access GPU hardware in docker container during run raisr-flex docker container. 44 | 45 | # Build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/main/scripts) 46 | If the user would prefer not to use Docker, you can follow the steps below to setup enviroment: \ 47 | `cd Video-Super-Resolution-Library/scripts` \ 48 | `./01_pull_resources.sh` \ 49 | `./02_install_prerequisites.sh /xxx/raisr.tar.gz` \ 50 | `./03_build_raisr_ffmpeg.sh /xxx/raisr/Video-Super-Resolution-Library` 51 | - [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. 52 | - [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. 53 | - [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. 54 | 55 | # Build manually following the steps below 56 | ## Install Intel IPP 57 | Standalone version of IPP (minimum requirement): https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html#ipp \ 58 | Alternatively, install IPP as part of oneAPI Base Toolkit: https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html \ 59 | Add below line to `~/.bash_profile` which sets IPP env. \ 60 | `source /opt/intel/oneapi/ipp/latest/env/vars.sh` \ 61 | Then `source ~/.bash_profile` 62 | 63 | ## Install dependent libraries x264 and x265 64 | The x264/x265 libraries can be installed via apt on Ubuntu OS or built and installed from source code. 65 | 66 | ### Install x264/x265 via apt on Ubuntu OS(Option-1) 67 | `apt-get update && apt-get install -y libx264-dev libx265-dev nasm` 68 | 69 | ### Build and install x264/x265 from source code(Option-2) 70 | 71 | #### Build and install x264 72 | 73 | `git clone https://github.com/mirror/x264 -b stable --depth 1` \ 74 | `cd x264` \ 75 | `./configure --prefix=/usr/local --libdir=/usr/local/lib --enable-shared` \ 76 | `make -j$(nproc)` \ 77 | `sudo make install` 78 | 79 | #### Build and install x265 80 | 81 | `wget -O - https://github.com/videolan/x265/archive/3.4.tar.gz | tar xz` \ 82 | `cd x265-3.4/build/linux` \ 83 | `cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DLIB_INSTALL_DIR=/usr/local/lib -DHIGH_BIT_DEPTH=ON ../../source` \ 84 | `make -j$(nproc)` \ 85 | `sudo make install` 86 | 87 | #### Set PKG_CONFIG_PATH enviroment variable 88 | The `.pc` files of x264 and x265 libraries are in `/usr/local/lib/pkgconfig`, add the path to the `PKG_CONFIG_PATH` environment variable. \ 89 | `export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH` 90 | 91 | ## Install Opencl 92 | Follow this guide to setup gpu driver [installation](https://dgpu-docs.intel.com/driver/installation.html) \ 93 | Install OpenCL: \ 94 | `sudo apt update` \ 95 | `sudo apt install intel-opencl-icd opencl-headers ocl-icd-opencl-dev` \ 96 | 97 | ### Install Intel latest OpenCL driver 98 | [intel/compute-runtime](https://github.com/intel/compute-runtime/releases) 99 | 100 | ## Use FFmpeg RAISR plugin 101 | 102 | ### Build and install the Intel Library for VSR Manually 103 | 104 | If the user would prefer not to use Docker, these instructions may be utilized to setup the Intel Library for VSR. 105 | 106 | To build the library without building the docker image, run \ 107 | `./build.sh -DCMAKE_INSTALL_PREFIX="$PWD/install"` 108 | 109 | To build the library with OpenCL support, run \ 110 | `. -DCMAKE_INSTALL_PREFIX="$PWD/install" -DENABLE_RAISR_OPENCL=ON` 111 | 112 | #### Clone FFmpeg 113 | `git clone https://github.com/FFmpeg/FFmpeg ffmpeg` \ 114 | `cd ffmpeg` 115 | 116 | #### Checkout FFmpeg version 6.0 tag 117 | `git checkout -b n6.0 n6.0` 118 | 119 | #### Copy vf_raisr.c to ffmpeg libavfilter folder 120 | `cp ../Video-Super-Resolution-Library/ffmpeg/vf_raisr.c libavfilter/` \ 121 | To use raisr_opencl you need to copy vf_raisr_opencl.c as well \ 122 | `cp ../Video-Super-Resolution-Library/ffmpeg/vf_raisr_opencl.c libavfilter/` 123 | 124 | #### Apply patch 125 | `git am ../Video-Super-Resolution-Library/ffmpeg/0001-ffmpeg-raisr-filter.patch` \ 126 | To use raisr_opencl you need to apply patch 0002 as well \ 127 | `git am ../Video-Super-Resolution-Library/ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch` 128 | 129 | #### Configure FFmpeg 130 | When `DCMAKE_INSTALL_PREFIX` isn't used, the ffmpeg configure command is as: \ 131 | `./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` 132 | 133 | When `DCMAKE_INSTALL_PREFIX` is used, please add the below line to the ffmpeg configure command: \ 134 | `--extra-cflags=="-fopenmp -I../Video-Super-Resolution-Library/install/include/" --extra-ldflags="-fopenmp -L../Video-Super-Resolution-Library/install/lib/"` \ 135 | The ffmmpeg confiure command is as: \ 136 | `./configure --enable-libipp --extra-cflags="-fopenmp -I../Video-Super-Resolution-Library/install/include/" --extra-ldflags="-fopenmp -L../Video-Super-Resolution-Library/install/lib/" --enable-gpl --enable-libx264 --enable-libx265 --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' --enable-cross-compile` 137 | 138 | Add option `--enable-opencl` and `-lm` to `--extra-libs` option to enable `raisr_opencl` filter. 139 | 140 | #### Build FFmpeg 141 | `make clean` \ 142 | `make -j $(nproc)` 143 | 144 | #### Copy RAISR filter folder to FFmpeg folder 145 | The folder contains filterbin_2_8/10, Qfactor_cohbin_2_8/10, and Qfactor_strbin_2_8/10 \ 146 | `cp -r ../Video-Super-Resolution-Library/filters* .` 147 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Intel Corporation 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /Library/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES Raisr_AVX256.cpp Raisr.cpp RaisrHandler.cpp) 2 | set(HEADERS Raisr_globals.h Raisr_AVX256.h Raisr.h ThreadPool.h RaisrHandler.h RaisrDefaults.h) 3 | 4 | if( HAVE_AVX512FP16 ) 5 | message("Building AVX512FP16 library") 6 | list(APPEND SOURCES Raisr_AVX512FP16.cpp Raisr_AVX512FP16.h) 7 | endif() 8 | if( HAVE_AVX512 ) 9 | message("Building AVX512 library") 10 | list(APPEND SOURCES Raisr_AVX512.cpp Raisr_AVX512.h) 11 | else() 12 | message("Building AVX2 only") 13 | endif() 14 | 15 | if (ENABLE_RAISR_OPENCL) 16 | find_package (PkgConfig REQUIRED) 17 | pkg_check_modules (OPENCL REQUIRED OpenCL) 18 | include_directories (${OPENCL_INCLUDE_DIRS}) 19 | link_directories (${OPENCL_LIBRARY_DIRS}) 20 | list(APPEND SOURCES Raisr_OpenCL.cpp) 21 | list(APPEND HEADERS Raisr_OpenCL.h Raisr_OpenCL_kernel.h) 22 | endif() 23 | 24 | add_library(raisr STATIC ${SOURCES} ${HEADERS}) 25 | 26 | # Link our library 27 | # for IPP 28 | if( UNIX ) 29 | include_directories($ENV{IPPROOT}/include) 30 | find_library(IPP_CORE libippcore.a PATHS $ENV{IPPROOT}/lib/intel64) 31 | find_library(IPP_VM libippvm.a PATHS $ENV{IPPROOT}/lib/intel64) 32 | find_library(IPP_S libipps.a PATHS $ENV{IPPROOT}/lib/intel64) 33 | find_library(IPP_I libippi.a PATHS $ENV{IPPROOT}/lib/intel64) 34 | find_package(Threads REQUIRED) 35 | else() 36 | include_directories("C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/include") 37 | find_library(IPP_CORE ippcore.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64") 38 | find_library(IPP_VM ippvm.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64") 39 | find_library(IPP_S ipps.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64") 40 | find_library(IPP_I ippi.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64") 41 | endif(UNIX) 42 | target_link_libraries(raisr ${IPP_I} ${IPP_VM} ${IPP_S} ${IPP_CORE} ${CMAKE_THREAD_LIBS_INIT} ${OPENCL_LIBRARIES}) 43 | include(GNUInstallDirs) 44 | install(DIRECTORY "." DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/raisr" FILES_MATCHING PATTERN "*.h") 45 | install(TARGETS "raisr" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") 46 | 47 | -------------------------------------------------------------------------------- /Library/Raisr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #pragma once 9 | #include 10 | #include 11 | #include "RaisrDefaults.h" 12 | #include "RaisrVersion.h" 13 | 14 | RNLERRORTYPE RNLInit(std::string &modelPath, 15 | float ratio, 16 | unsigned int bitDepth = 8, 17 | RangeType rangeType = VideoRange, 18 | unsigned int threadCount = 20, 19 | ASMType asmType = AVX512, 20 | unsigned int passes = 1, 21 | unsigned int twoPassMode = 1); 22 | 23 | RNLERRORTYPE RNLSetRes(VideoDataType *inY, VideoDataType *inCr, VideoDataType *inCb, 24 | VideoDataType *outY, VideoDataType *outCr, VideoDataType *outCb); 25 | 26 | RNLERRORTYPE RNLProcess(VideoDataType *inY, VideoDataType *inCr, VideoDataType *inCb, 27 | VideoDataType *outY, VideoDataType *outCr, VideoDataType *outCb, 28 | BlendingMode blendingMode = CountOfBitsChanged); 29 | 30 | RNLERRORTYPE RNLSetOpenCLContext(void *context, void *device_id, 31 | int platformIndex, int deviceIndex); 32 | 33 | RNLERRORTYPE RNLDeinit(); 34 | -------------------------------------------------------------------------------- /Library/RaisrDefaults.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #pragma once 9 | 10 | #define defaultPatchSize (11) 11 | static const unsigned int defaultPatchAreaSize = defaultPatchSize * defaultPatchSize; 12 | 13 | typedef struct VideoDataType 14 | { 15 | unsigned char *pData; 16 | unsigned int width; 17 | unsigned int height; 18 | unsigned int step; // distance(in bytes) between the starting points of lines in the image buffer 19 | unsigned int bitShift; //Number of least significant bits that must be shifted away to get the value. 20 | } VideoDataType; 21 | 22 | typedef enum RNLERRORTYPE 23 | { 24 | RNLErrorNone = 0, 25 | RNLErrorInsufficientResources = (int)0x80001000, 26 | RNLErrorUndefined = (int)0x80001001, 27 | RNLErrorBadParameter = (int)0x80001002, 28 | RNLErrorMax = (int)0x7FFFFFFF 29 | } RNLERRORTYPE; 30 | 31 | typedef enum BlendingMode 32 | { 33 | Randomness = 1, 34 | CountOfBitsChanged = 2 35 | } BlendingMode; 36 | 37 | typedef enum ASMType 38 | { 39 | AVX2 = 1, 40 | AVX512 = 2, 41 | OpenCL = 3, 42 | OpenCLExternal = 4, 43 | AVX512_FP16 = 5 44 | } ASMType; 45 | 46 | typedef enum MachineVendorType 47 | { 48 | INTEL = 1, 49 | AMD = 2, 50 | VENDOR_UNSUPPORTED = 3 51 | } MachineVendorType; 52 | 53 | typedef enum RangeType 54 | { 55 | VideoRange = 1, 56 | FullRange = 2 57 | } RangeType; 58 | -------------------------------------------------------------------------------- /Library/RaisrHandler.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #include "RaisrHandler.h" 9 | #include "Raisr.h" 10 | 11 | RNLERRORTYPE RNLHandler_Init( 12 | const char *modelPath, 13 | float ratio, 14 | unsigned int bitDepth, 15 | RangeType rangeType, 16 | unsigned int threadCount, 17 | ASMType asmType, 18 | unsigned int passes, 19 | unsigned int twoPassMode) 20 | { 21 | std::string model = modelPath; 22 | return RNLInit(model, ratio, bitDepth, rangeType, threadCount, asmType, passes, twoPassMode); 23 | } 24 | 25 | RNLERRORTYPE RNLHandler_SetRes( 26 | VideoDataType *inY, 27 | VideoDataType *inU, 28 | VideoDataType *inV, 29 | VideoDataType *outY, 30 | VideoDataType *outU, 31 | VideoDataType *outV) 32 | { 33 | return RNLSetRes(inY, inU, inV, outY, outU, outV); 34 | } 35 | 36 | RNLERRORTYPE RNLHandler_Process( 37 | VideoDataType *inY, 38 | VideoDataType *inU, 39 | VideoDataType *inV, 40 | VideoDataType *outY, 41 | VideoDataType *outU, 42 | VideoDataType *outV, 43 | BlendingMode blendingMode) 44 | { 45 | return RNLProcess(inY, inU, inV, outY, outU, outV, blendingMode); 46 | } 47 | 48 | RNLERRORTYPE RNLHandler_SetOpenCLContext( 49 | void *context, 50 | void *device_id, 51 | int platformIndex, 52 | int deviceIndex) 53 | { 54 | return RNLSetOpenCLContext(context, device_id, platformIndex, deviceIndex); 55 | } 56 | 57 | RNLERRORTYPE RNLHandler_Deinit() 58 | { 59 | return RNLDeinit(); 60 | } 61 | -------------------------------------------------------------------------------- /Library/RaisrHandler.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #pragma once 9 | #include "RaisrDefaults.h" 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | extern RNLERRORTYPE RNLHandler_Init( 16 | const char *modelPath, 17 | float ratio, 18 | unsigned int bitDepth, 19 | RangeType rangeType, 20 | unsigned int threadCount, 21 | ASMType asmType, 22 | unsigned int passes, 23 | unsigned int twoPassMode); 24 | 25 | extern RNLERRORTYPE RNLHandler_SetRes( 26 | VideoDataType *inY, 27 | VideoDataType *inCr, 28 | VideoDataType *inCb, 29 | VideoDataType *outY, 30 | VideoDataType *outCr, 31 | VideoDataType *outCb); 32 | 33 | extern RNLERRORTYPE RNLHandler_Process( 34 | VideoDataType *inY, 35 | VideoDataType *inCr, 36 | VideoDataType *inCb, 37 | VideoDataType *outY, 38 | VideoDataType *outCr, 39 | VideoDataType *outCb, 40 | BlendingMode blendingMode); 41 | 42 | extern RNLERRORTYPE RNLHandler_SetOpenCLContext( 43 | void *context, 44 | void *device_id, 45 | int platformIndex, 46 | int deviceIndex); 47 | 48 | extern RNLERRORTYPE RNLHandler_Deinit(); 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /Library/RaisrVersion.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #pragma once 9 | 10 | // API Version 11 | #define RAISR_VERSION_MAJOR (23) 12 | #define RAISR_VERSION_MINOR (11) 13 | 14 | #define RAISR_CHECK_VERSION(major, minor) \ 15 | (RAISR_VERSION_MAJOR > (major) || \ 16 | (RAISR_VERSION_MAJOR == (major) && RAISR_VERSION_MINOR > (minor)) || \ 17 | (RAISR_VERSION_MAJOR == (major) && RAISR_VERSION_MINOR == (minor)) 18 | -------------------------------------------------------------------------------- /Library/RaisrVersion.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #pragma once 9 | 10 | // API Version 11 | #define RAISR_VERSION_MAJOR (@RAISR_VERSION_MAJOR@) 12 | #define RAISR_VERSION_MINOR (@RAISR_VERSION_MINOR@) 13 | 14 | #define RAISR_CHECK_VERSION(major, minor) \ 15 | (RAISR_VERSION_MAJOR > (major) || \ 16 | (RAISR_VERSION_MAJOR == (major) && RAISR_VERSION_MINOR > (minor)) || \ 17 | (RAISR_VERSION_MAJOR == (major) && RAISR_VERSION_MINOR == (minor)) 18 | -------------------------------------------------------------------------------- /Library/Raisr_AVX256.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | #pragma once 8 | #include 9 | 10 | inline void load3x3_ps(float *img, unsigned int width, unsigned int height, unsigned int stride, __m256 *out_8neighbors_ps, __m256 *out_center_ps) 11 | { 12 | __m128i mask_3pixels = _mm_setr_epi32(-1, -1, -1, 0); 13 | int index = (height - 1) * stride + (width - 1); 14 | // load 3x3 grid for lr image, including center pixel plus 8 neighbors 15 | __m128 row1_f = _mm_maskload_ps(img + index, mask_3pixels); 16 | index += stride; 17 | __m128 row2_f = _mm_maskload_ps(img + index, mask_3pixels); 18 | index += stride; 19 | __m128 row3_f = _mm_maskload_ps(img + index, mask_3pixels); 20 | 21 | *out_center_ps = _mm256_broadcastss_ps(_mm_insert_ps(row2_f, row2_f, 0x40)); 22 | // load 8 neighbors (32bit floats) into 256 reg from lr image 23 | __m128 rowlo_f = _mm_insert_ps(row1_f, row2_f, 0x30); 24 | __m128 rowhi_f = _mm_insert_ps(row3_f, row2_f, 0xB0); 25 | *out_8neighbors_ps = _mm256_insertf128_ps(_mm256_castps128_ps256(rowlo_f), rowhi_f, 1); 26 | } 27 | 28 | int inline CTRandomness_AVX256_32f(float *inYUpscaled32f, int cols, int r, int c, int pix); 29 | float inline DotProdPatch_AVX256_32f(const float *buf, const float *filter); 30 | void inline computeGTWG_Segment_AVX256_32f(const float *img, const int nrows, const int ncols, const int r, const int col, float GTWG[3][16], int pix, float *buf1, float *buf2); 31 | void inline GetHashValue_AVX256_32f_8Elements(float GTWG[3][16], int passIdx, int32_t *idx); 32 | static void CTCountOfBitsChangedSegment_AVX256_32f(float *LRImage, float *HRImage, const int rows, const int startRow, const std::pair blendingZone, unsigned char *outImage, const int cols, const int outImageCols); 33 | 34 | -------------------------------------------------------------------------------- /Library/Raisr_AVX512.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | #include "Raisr_globals.h" 8 | #include "Raisr_AVX512.h" 9 | #include "Raisr_AVX256.h" 10 | #include 11 | #include 12 | #include 13 | 14 | inline __mmask8 compare3x3_ps_AVX512(__m256 a, __m256 b) 15 | { 16 | return _mm256_cmp_ps_mask(a, b, _CMP_LT_OS); 17 | } 18 | 19 | int CTRandomness_AVX512_32f(float *inYUpscaled32f, int cols, int r, int c, int pix) 20 | { 21 | int census_count = 0; 22 | 23 | __m128 zero_f = _mm_setzero_ps(); 24 | __m256 row_f, center_f; 25 | 26 | load3x3_ps(inYUpscaled32f, c + pix, r, cols, &row_f, ¢er_f); 27 | 28 | // compare if neighbors < centerpixel, toggle bit in mask if true 29 | __mmask8 cmp_m8 = compare3x3_ps_AVX512(row_f, center_f); 30 | 31 | // count # of bits in mask 32 | census_count += _mm_popcnt_u32(cmp_m8); 33 | 34 | return census_count; 35 | } 36 | 37 | inline float sumitup_ps_512(__m512 acc) 38 | { 39 | const __m256 r8 = _mm256_add_ps(_mm512_castps512_ps256(acc), _mm512_extractf32x8_ps(acc, 1)); 40 | const __m128 r4 = _mm_add_ps(_mm256_castps256_ps128(r8), _mm256_extractf128_ps(r8, 1)); 41 | const __m128 r2 = _mm_add_ps(r4, _mm_movehl_ps(r4, r4)); 42 | const __m128 r1 = _mm_add_ss(r2, _mm_movehdup_ps(r2)); 43 | return _mm_cvtss_f32(r1); 44 | } 45 | inline __m512 shiftL_AVX512(__m512 r) 46 | { 47 | return _mm512_permutexvar_ps(_mm512_set_epi32(0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), r); 48 | } 49 | inline __m512 shiftR_AVX512(__m512 r) 50 | { 51 | return _mm512_permutexvar_ps(_mm512_set_epi32(14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 15), r); 52 | } 53 | 54 | inline __m512 GetGx_AVX512(__m512 r1, __m512 r3) 55 | { 56 | return _mm512_sub_ps(r3, r1); 57 | } 58 | 59 | inline __m512 GetGy_AVX512(__m512 r2) 60 | { 61 | return _mm512_sub_ps(shiftL_AVX512(r2), shiftR_AVX512(r2)); 62 | } 63 | 64 | inline __m512 GetGTWG_AVX512(__m512 acc, __m512 a, __m512 w, __m512 b) 65 | { 66 | return _mm512_fmadd_ps(_mm512_mul_ps(a, w), b, acc); 67 | } 68 | 69 | void computeGTWG_Segment_AVX512_32f(const float *img, const int nrows, const int ncols, const int r, const int col, float GTWG[3][16], int pix, float *buf1, float *buf2) 70 | { 71 | // offset is the starting position(top left) of the block which centered by (r, c) 72 | int gtwgIdx = pix * 2; 73 | int offset = (r - gLoopMargin) * ncols + col - gLoopMargin; 74 | const float *p1 = img + offset; 75 | 76 | __m512 gtwg0A = _mm512_setzero_ps(), gtwg1A = _mm512_setzero_ps(), gtwg3A = _mm512_setzero_ps(); 77 | __m512 gtwg0B = _mm512_setzero_ps(), gtwg1B = _mm512_setzero_ps(), gtwg3B = _mm512_setzero_ps(); 78 | 79 | // load 2 rows 80 | __m512 a = _mm512_loadu_ps(p1); 81 | p1 += ncols; 82 | __m512 b = _mm512_loadu_ps(p1); 83 | #pragma unroll 84 | for (int i = 0; i < gPatchSize; i++) 85 | { 86 | // process patchSize rows 87 | // load next row 88 | p1 += ncols; 89 | __m512 c = _mm512_loadu_ps(p1); 90 | __m512 w; 91 | if (gBitDepth == 8) 92 | { 93 | w = _mm512_loadu_ps(gGaussian2D8bit[i]); 94 | } 95 | else if (gBitDepth == 10) 96 | { 97 | w = _mm512_loadu_ps(gGaussian2D10bit[i]); 98 | } 99 | else 100 | { 101 | w = _mm512_loadu_ps(gGaussian2D16bit[i]); 102 | } 103 | 104 | const __m512 gxi = GetGx_AVX512(a, c); 105 | const __m512 gyi = GetGy_AVX512(b); 106 | 107 | gtwg0A = GetGTWG_AVX512(gtwg0A, gxi, w, gxi); 108 | gtwg1A = GetGTWG_AVX512(gtwg1A, gxi, w, gyi); 109 | gtwg3A = GetGTWG_AVX512(gtwg3A, gyi, w, gyi); 110 | 111 | w = shiftR_AVX512(w); 112 | gtwg0B = GetGTWG_AVX512(gtwg0B, gxi, w, gxi); 113 | gtwg1B = GetGTWG_AVX512(gtwg1B, gxi, w, gyi); 114 | gtwg3B = GetGTWG_AVX512(gtwg3B, gyi, w, gyi); 115 | 116 | _mm512_mask_storeu_ps(buf1 + gPatchSize * i - 1, 0x0ffe, b); 117 | _mm512_mask_storeu_ps(buf2 + gPatchSize * i - 2, 0x1ffc, b); 118 | a = b; 119 | b = c; 120 | } 121 | 122 | GTWG[0][gtwgIdx] = sumitup_ps_512(gtwg0A); 123 | GTWG[1][gtwgIdx] = sumitup_ps_512(gtwg1A); 124 | GTWG[2][gtwgIdx] = sumitup_ps_512(gtwg3A); 125 | 126 | GTWG[0][gtwgIdx+1] = sumitup_ps_512(gtwg0B); 127 | GTWG[1][gtwgIdx+1] = sumitup_ps_512(gtwg1B); 128 | GTWG[2][gtwgIdx+1] = sumitup_ps_512(gtwg3B); 129 | 130 | return; 131 | } 132 | 133 | // AVX512 version: for now, gPatchSize must be <= 16 because we can work with up to 16 float32s in one AVX512 register. 134 | float DotProdPatch_AVX512_32f(const float *buf, const float *filter) 135 | { 136 | __m512 a_ps = _mm512_load_ps(buf); 137 | __m512 b_ps = _mm512_load_ps(filter); 138 | __m512 sum = _mm512_mul_ps(a_ps, b_ps); 139 | #pragma unroll 140 | for (int i = 1; i < 8; i++) 141 | { 142 | a_ps = _mm512_load_ps(buf + i * 16); 143 | b_ps = _mm512_load_ps(filter + i * 16); 144 | // compute dot prod using fmadd 145 | sum = _mm512_fmadd_ps(a_ps, b_ps, sum); 146 | } 147 | // sumitup adds all 16 float values in sum(zmm) and returns a single float value 148 | return sumitup_ps_512(sum); 149 | } 150 | 151 | inline __m512 atan2Approximation_AVX512_32f_16Elements(__m512 y_ps, __m512 x_ps) 152 | { 153 | const float ONEQTR_PI = M_PI / 4.0; 154 | const float THRQTR_PI = 3.0 * M_PI / 4.0; 155 | const __m512 zero_ps = _mm512_set1_ps(0.0); 156 | const __m512 oneqtr_pi_ps = _mm512_set1_ps(ONEQTR_PI); 157 | const __m512 thrqtr_pi_ps = _mm512_set1_ps(THRQTR_PI); 158 | 159 | __m512 abs_y_ps = _mm512_add_ps( _mm512_abs_ps(y_ps), _mm512_set1_ps(1e-10f)); 160 | 161 | __m512 r_cond1_ps = _mm512_div_ps( _mm512_add_ps(x_ps, abs_y_ps), _mm512_sub_ps(abs_y_ps, x_ps)); 162 | __m512 r_cond2_ps = _mm512_div_ps( _mm512_sub_ps(x_ps, abs_y_ps), _mm512_add_ps(x_ps, abs_y_ps)); 163 | __mmask16 r_cmp_m8 = _mm512_cmp_ps_mask(x_ps, zero_ps, _CMP_LT_OQ); 164 | __m512 r_ps = _mm512_mask_blend_ps( r_cmp_m8, r_cond2_ps, r_cond1_ps); 165 | __m512 angle_ps = _mm512_mask_blend_ps( r_cmp_m8, oneqtr_pi_ps, thrqtr_pi_ps); 166 | 167 | angle_ps = _mm512_fmadd_ps(_mm512_fmadd_ps(_mm512_mul_ps(_mm512_set1_ps(0.1963f), r_ps), 168 | r_ps, _mm512_set1_ps(-0.9817f)), 169 | r_ps, angle_ps); 170 | 171 | __m512 neg_angle_ps = _mm512_mul_ps(_mm512_set1_ps(-1), angle_ps); 172 | return _mm512_mask_blend_ps( _mm512_cmp_ps_mask(y_ps, zero_ps, _CMP_LT_OQ), angle_ps, neg_angle_ps ); 173 | } 174 | 175 | void GetHashValue_AVX512_32f_16Elements(float GTWG[3][16], int passIdx, int32_t *idx) { 176 | const float one = 1.0; 177 | const float two = 2.0; 178 | const float four = 4.0; 179 | const float pi = PI; 180 | const float near_zero = 0.00000000000000001; 181 | 182 | const __m512 zero_ps = _mm512_setzero_ps(); 183 | const __m512 one_ps = _mm512_set1_ps(1); 184 | const __m512i zero_epi32 = _mm512_setzero_si512(); 185 | const __m512i one_epi32 = _mm512_set1_epi32(1); 186 | const __m512i two_epi32 = _mm512_set1_epi32(2); 187 | 188 | const int cmp_le = _CMP_LE_OQ; 189 | const int cmp_gt = _CMP_GT_OQ; 190 | 191 | __m512 m_a_ps = _mm512_load_ps( GTWG[0]); 192 | __m512 m_b_ps = _mm512_load_ps( GTWG[1]); 193 | __m512 m_d_ps = _mm512_load_ps( GTWG[2]); 194 | 195 | __m512 T_ps = _mm512_add_ps(m_a_ps, m_d_ps); 196 | __m512 D_ps = _mm512_sub_ps( _mm512_mul_ps( m_a_ps, m_d_ps), 197 | _mm512_mul_ps( m_b_ps, m_b_ps)); 198 | 199 | // 11 bit accuracy: fast sqr root 200 | __m512 sqr_ps = _mm512_rcp14_ps( _mm512_rsqrt14_ps( _mm512_sub_ps( _mm512_div_ps ( _mm512_mul_ps(T_ps, T_ps), 201 | _mm512_set1_ps(four)), D_ps))); 202 | 203 | __m512 half_T_ps = _mm512_div_ps ( T_ps, _mm512_set1_ps(two) ); 204 | __m512 L1_ps = _mm512_add_ps( half_T_ps, sqr_ps); 205 | __m512 L2_ps = _mm512_sub_ps( half_T_ps, sqr_ps); 206 | 207 | __m512 angle_ps = zero_ps; 208 | 209 | __m512 blend_ps = _mm512_mask_blend_ps( _mm512_cmp_ps_mask(m_b_ps, zero_ps, _CMP_NEQ_OQ), 210 | one_ps, _mm512_sub_ps(L1_ps, m_d_ps)); 211 | 212 | #ifdef USE_ATAN2_APPROX 213 | angle_ps = atan2Approximation_AVX512_32f_16Elements( m_b_ps, blend_ps); 214 | #else 215 | angle_ps = _mm512_atan2_ps( m_b_ps, blend_ps); 216 | #endif 217 | 218 | angle_ps = _mm512_add_ps ( angle_ps, _mm512_mask_blend_ps( _mm512_cmp_ps_mask(angle_ps, zero_ps, _CMP_LT_OQ), zero_ps, _mm512_set1_ps(pi))); 219 | 220 | // fast sqrt 221 | __m512 sqrtL1_ps = _mm512_rcp14_ps( _mm512_rsqrt14_ps( L1_ps )); 222 | __m512 sqrtL2_ps = _mm512_rcp14_ps( _mm512_rsqrt14_ps( L2_ps )); 223 | 224 | __m512 coherence_ps = _mm512_div_ps( _mm512_sub_ps( sqrtL1_ps, sqrtL2_ps ), 225 | _mm512_add_ps( _mm512_add_ps(sqrtL1_ps, sqrtL2_ps), _mm512_set1_ps(near_zero) ) ); 226 | __m512 strength_ps = L1_ps; 227 | 228 | __m512i angleIdx_epi32 = _mm512_cvtps_epi32( _mm512_floor_ps(_mm512_mul_ps (angle_ps, _mm512_set1_ps(gQAngle)))); 229 | __m512i quantAngle_lessone_epi32 = _mm512_sub_epi32(_mm512_set1_epi32(gQuantizationAngle), one_epi32); 230 | angleIdx_epi32 = _mm512_min_epi32( _mm512_sub_epi32( _mm512_set1_epi32(gQuantizationAngle), _mm512_set1_epi32(1)), 231 | _mm512_max_epi32(angleIdx_epi32, zero_epi32 ) ); 232 | 233 | // AFAIK, today QStr & QCoh are vectors of size 2. I think searchsorted can return an index of 0,1, or 2 234 | float *gQStr_data, *gQCoh_data; 235 | if (passIdx == 0) gQStr_data = gQStr.data(); else gQStr_data = gQStr2.data(); 236 | if (passIdx == 0) gQCoh_data = gQCoh.data(); else gQCoh_data = gQCoh2.data(); 237 | __m512 gQStr1_ps = _mm512_set1_ps(gQStr_data[0]); 238 | __m512 gQStr2_ps = _mm512_set1_ps(gQStr_data[1]); 239 | __m512 gQCoh1_ps = _mm512_set1_ps(gQCoh_data[0]); 240 | __m512 gQCoh2_ps = _mm512_set1_ps(gQCoh_data[1]); 241 | 242 | __m512i strengthIdx_epi32 = 243 | _mm512_add_epi32( 244 | _mm512_mask_blend_epi32(_mm512_cmp_ps_mask(gQStr1_ps, strength_ps, _MM_CMPINT_LE),zero_epi32, one_epi32), 245 | _mm512_mask_blend_epi32(_mm512_cmp_ps_mask(gQStr2_ps, strength_ps, _MM_CMPINT_LE),zero_epi32, one_epi32)); 246 | __m512i coherenceIdx_epi32 = 247 | _mm512_add_epi32( 248 | _mm512_mask_blend_epi32(_mm512_cmp_ps_mask(gQCoh1_ps, coherence_ps, _MM_CMPINT_LE),zero_epi32, one_epi32), 249 | _mm512_mask_blend_epi32(_mm512_cmp_ps_mask(gQCoh2_ps, coherence_ps, _MM_CMPINT_LE),zero_epi32, one_epi32)); 250 | 251 | const __m512i gQuantizationCoherence_epi32 = _mm512_set1_epi32(gQuantizationCoherence); 252 | __m512i idx_epi32 = _mm512_mullo_epi32(gQuantizationCoherence_epi32, 253 | _mm512_mullo_epi32(angleIdx_epi32, _mm512_set1_epi32(gQuantizationStrength))); 254 | idx_epi32 = _mm512_add_epi32(coherenceIdx_epi32, 255 | _mm512_add_epi32(idx_epi32, _mm512_mullo_epi32(strengthIdx_epi32, gQuantizationCoherence_epi32))); 256 | 257 | _mm512_storeu_si512((__m512i *)idx, idx_epi32); 258 | } 259 | 260 | -------------------------------------------------------------------------------- /Library/Raisr_AVX512.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | #pragma once 8 | #include 9 | 10 | void computeGTWG_Segment_AVX512_32f(const float *img, const int nrows, const int ncols, const int r, const int col, float GTWG[3][16], int pix, float *buf1, float *buf2); 11 | int CTRandomness_AVX512_32f(float *inYUpscaled32f, int cols, int r, int c, int pix); 12 | float DotProdPatch_AVX512_32f(const float *buf, const float *filter); 13 | void GetHashValue_AVX512_32f_16Elements(float GTWG[3][16], int passIdx, int32_t *idx); 14 | -------------------------------------------------------------------------------- /Library/Raisr_AVX512FP16.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2022 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | #pragma once 8 | #include 9 | 10 | void computeGTWG_Segment_AVX512FP16_16f(const _Float16 *img, const int nrows, const int ncols, const int r, const int col, _Float16 GTWG[3][32], int pix, _Float16 *buf1, _Float16 *buf2, _Float16 *buf3, _Float16 *buf4); 11 | int CTRandomness_AVX512FP16_16f(_Float16 *inYUpscaled32f, int cols, int r, int c, int pix); 12 | _Float16 DotProdPatch_AVX512FP16_16f(const _Float16 *buf, const _Float16 *filter); 13 | void CTCountOfBitsChangedSegment_AVX512FP16_16f(_Float16 *LRImage, _Float16 *HRImage, const int rows, const int startRow, const std::pair blendingZone, unsigned char *outImage, const int cols, const int outImageCols); 14 | void GetHashValue_AVX512FP16_16h_8Elements(_Float16 GTWG[3][32], int passIdx, int32_t *idx); 15 | void GetHashValue_AVX512FP16_16h_32Elements(_Float16 GTWG[3][32], int passIdx, int32_t *idx); 16 | 17 | -------------------------------------------------------------------------------- /Library/Raisr_OpenCL.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Intel Library for Video Super Resolution 3 | * 4 | * Copyright (c) 2023 Intel Corporation 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | #pragma once 8 | 9 | #ifndef CL_TARGET_OPENCL_VERSION 10 | #define CL_TARGET_OPENCL_VERSION 300 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "RaisrDefaults.h" 16 | 17 | typedef struct RaisrOpenCLContext { 18 | void *priv; 19 | cl_context context; 20 | cl_device_id deviceID; 21 | int widthMax; 22 | int heightMax; 23 | float gRatio; 24 | ASMType gAsmType; 25 | int platformIndex; 26 | int deviceIndex; 27 | unsigned int gBitDepth; 28 | unsigned int gQuantizationAngle; 29 | unsigned int gQuantizationStrength; 30 | unsigned int gQuantizationCoherence; 31 | unsigned int gPatchSize; 32 | std::vector gQStr; 33 | std::vector gQCoh; 34 | std::vector gQStr2; 35 | std::vector gQCoh2; 36 | float *gFilterBuffer; 37 | float *gFilterBuffer2; 38 | int gPasses; 39 | int gTwoPassMode; 40 | unsigned char gMin8bit; 41 | unsigned char gMax8bit; 42 | unsigned short gMin16bit; 43 | unsigned short gMax16bit; 44 | int gUsePixelType; 45 | } RaisrOpenCLContext; 46 | 47 | RNLERRORTYPE RaisrOpenCLInit(RaisrOpenCLContext *raisrOpenCLContext); 48 | 49 | RNLERRORTYPE RaisrOpenCLSetRes(RaisrOpenCLContext *raisrOpenCLContext, 50 | int widthY, int heightY, int widthUV, int heightUV, 51 | int nvComponent); 52 | 53 | RNLERRORTYPE RaisrOpenCLProcessY(RaisrOpenCLContext *raisrOpenCLContext, 54 | uint8_t *inputY, int width, int height, int linesizeI, 55 | uint8_t *outputY, int linesizeO, int bitShift, BlendingMode blend); 56 | 57 | RNLERRORTYPE RaisrOpenCLProcessUV(RaisrOpenCLContext *raisrOpenCLContext, 58 | uint8_t *inputUV, int width, int height, 59 | int linesizeI, uint8_t *outputUV, int linesizeO, 60 | int bitShift, int nbComponent); 61 | 62 | RNLERRORTYPE RaisrOpenCLProcessImageY(RaisrOpenCLContext* raisrOpenCLContext, 63 | cl_mem inputImageY, int width, int height, 64 | cl_mem outputImageY, int bitShift, BlendingMode blend); 65 | 66 | RNLERRORTYPE RaisrOpenCLProcessImageUV(RaisrOpenCLContext* raisrOpenCLContext, 67 | cl_mem inputImageUV, int width, int height, cl_mem outputImageUV, 68 | int bitShift, int nbComponent); 69 | 70 | void RaisrOpenCLRelease(RaisrOpenCLContext *raisrOpenCLContext); 71 | -------------------------------------------------------------------------------- /Library/ThreadPool.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 Jakob Progsch, Václav Zeman 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * 8 | * Permission is granted to anyone to use this software for any purpose, 9 | * including commercial applications, and to alter it and redistribute it 10 | * freely, subject to the following restrictions: 11 | * 12 | * 1. The origin of this software must not be misrepresented; you must not 13 | * claim that you wrote the original software. If you use this software 14 | * in a product, an acknowledgment in the product documentation would be 15 | * appreciated but is not required. 16 | * 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 20 | * 3. This notice may not be removed or altered from any source 21 | * distribution. 22 | */ 23 | 24 | //https://github.com/progschj/ThreadPool 25 | #pragma once 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | class ThreadPool 38 | { 39 | public: 40 | ThreadPool(size_t); 41 | template 42 | auto enqueue(F &&f, Args &&...args) 43 | -> std::future::type>; 44 | ~ThreadPool(); 45 | 46 | private: 47 | // need to keep track of threads so we can join them 48 | std::vector workers; 49 | // the task queue 50 | std::queue> tasks; 51 | 52 | // synchronization 53 | std::mutex queue_mutex; 54 | std::condition_variable condition; 55 | bool stop; 56 | }; 57 | 58 | // the constructor just launches some amount of workers 59 | inline ThreadPool::ThreadPool(size_t threads) 60 | : stop(false) 61 | { 62 | for (size_t i = 0; i < threads; ++i) 63 | workers.emplace_back( 64 | [this] 65 | { 66 | for (;;) 67 | { 68 | std::function task; 69 | 70 | { 71 | std::unique_lock lock(this->queue_mutex); 72 | this->condition.wait(lock, 73 | [this] 74 | { return this->stop || !this->tasks.empty(); }); 75 | if (this->stop && this->tasks.empty()) 76 | return; 77 | task = std::move(this->tasks.front()); 78 | this->tasks.pop(); 79 | } 80 | 81 | task(); 82 | } 83 | }); 84 | } 85 | 86 | // add new work item to the pool 87 | template 88 | auto ThreadPool::enqueue(F &&f, Args &&...args) 89 | -> std::future::type> 90 | { 91 | using return_type = typename std::result_of::type; 92 | 93 | auto task = std::make_shared>( 94 | std::bind(std::forward(f), std::forward(args)...)); 95 | 96 | std::future res = task->get_future(); 97 | { 98 | std::unique_lock lock(queue_mutex); 99 | 100 | // don't allow enqueueing after stopping the pool 101 | if (stop) 102 | throw std::runtime_error("enqueue on stopped ThreadPool"); 103 | 104 | tasks.emplace([task]() 105 | { (*task)(); }); 106 | } 107 | condition.notify_one(); 108 | return res; 109 | } 110 | 111 | // the destructor joins all threads 112 | inline ThreadPool::~ThreadPool() 113 | { 114 | { 115 | std::unique_lock lock(queue_mutex); 116 | stop = true; 117 | } 118 | condition.notify_all(); 119 | for (std::thread &worker : workers) 120 | worker.join(); 121 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Ubuntu 22.04 Build](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/actions/workflows/build-baremetal-ubuntu.yml/badge.svg)](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/actions/workflows/build-baremetal-ubuntu.yml) 2 | [![Build Docker Images](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/actions/workflows/docker-cached-build.yml/badge.svg)](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/actions/workflows/docker-cached-build.yml) 3 | [![Coverity Build](https://scan.coverity.com/projects/31423/badge.svg)](https://scan.coverity.com/projects/video-super-resolution-library) 4 | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/OpenVisualCloud/Video-Super-Resolution-Library/badge)](https://securityscorecards.dev/viewer/?uri=github.com/OpenVisualCloud/Video-Super-Resolution-Library) 5 | 6 | # Intel® Library for Video Super Resolution (Intel® Library for VSR) README 7 | Video Super Resolution converts video from low resolution to high resolution using traditional image processing or AI-based methods. Intel Library for Video Super Resolution consist of a few different algorithms including machine learning and deep learning implementations to offer a balance between quality and performance. 8 | 9 | We have enhanced the public RAISR (Rapid and Accurate Image Super Resolution), an AI based Super Resolution algorithm https://arxiv.org/pdf/1606.01299.pdf, to achieve better visual quality and beyond real-time performance for 2x and 1.5x upscaling on Intel® Xeon® platforms and Intel® GPUs. Enhanced RAISR provides better quality results than standard (bicubic) algorithms and a good performance vs quality trade-off as compared to compute intensive DL-based algorithms. 10 | 11 | Enhanced RAISR is provided as an FFmpeg plugin inside of a Docker container(Docker container only for CPU) 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) on Intel® Xeon® Scalable Processor family and OpenCL support on Intel® GPUs. 12 | 13 | ![image](https://github.com/user-attachments/assets/e28b52c2-67c7-44a9-a66f-df8b355735f9) 14 | 15 | ## Latest News 16 | - July 2024 : Release performance of the alogorithm and pipeline on Intel® Xeon® Scalable processor as well as EC2 Intel instances deployed on AWS Cloud. See details at [performance.md](./docs/performance.md). 17 | 18 | - April 2024: Intel Library for Video Super Resolution algorithm now available on AWS. See the repository for details on how video super resolution works on the AWS service at https://github.com/aws-samples/video-super-resolution-tool. Technical details including video quality comparisons and performance information are available in a joint Intel / AWS white paper available at https://www.intel.com/content/www/us/en/content-details/820769/aws-compute-video-super-resolution-powered-by-the-intel-library-for-video-super-resolution.html 19 | 20 | - 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 21 | 22 | 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. 23 | 24 | ## How to build 25 | Please see "How to build.md" to build via scripts or manually. 26 | 27 | ## Running the Intel Library for VSR 28 | One should be able to test with video files: 29 | ``` 30 | ./ffmpeg -y -i /input_files/input.mp4 -vf raisr=threadcount=20 -pix_fmt yuv420p /output_files/out.yuv 31 | ``` 32 | Or folders of images: 33 | ``` 34 | ./ffmpeg -y -start_number 000 -i '/input_files/img_%03d.png' -vf scale=out_range=full,raisr=threadcount=20 -start_number 000 '/output_files/img_%03d.png' 35 | ``` 36 | Because saving raw uncompressed (.yuv) video can take up a lot of disk space, one could consider using the lossless (-crf 0) setting in x264/x265 to reduce the output file size by a substantial amount. 37 | 38 | **x264 lossless encoding** 39 | ``` 40 | ./ffmpeg -y -i /input_files/input.mp4 -vf raisr=threadcount=20 -pix_fmt yuv420p -c:v libx264 -crf 0 /output_files/out.mp4 41 | ``` 42 | **x265 lossless encoding** 43 | ``` 44 | ./ffmpeg -y -i /input_files/input.mp4 -vf raisr=threadcount=20 -pix_fmt yuv420p -c:v libx265 -crf 0 /output_files/out_hevc.mp4 45 | ``` 46 | ## Evaluating the Quality of RAISR Super Resolution 47 | Evaluating the quality of the RAISR can be done in different ways. 48 | 1. A source video or image can be upscaled by 2x using different filter configurations. We suggest trying these 3 command lines based upon preference: 49 | 50 | **Sharpest output** 51 | ``` 52 | ./ffmpeg -i /input_files/input.mp4 -vf "raisr=threadcount=20:passes=2:filterfolder=filters_2x/filters_highres" -pix_fmt yuv420p /output_files/out.yuv 53 | ``` 54 | **Fastest Performance ( second pass disabled )** 55 | ``` 56 | ./ffmpeg -i /input_files/input.mp4 -vf "raisr=threadcount=20:filterfolder=filters_2x/filters_lowres" -pix_fmt yuv420p /output_files/out.yuv 57 | ``` 58 | **Denoised output** 59 | ``` 60 | ./ffmpeg -i /input_files/input.mp4 -vf "raisr=threadcount=20:passes=2:mode=2:filterfolder=filters_2x/filters_denoise" -pix_fmt yuv420p /output_files/out.yuv 61 | ``` 62 | 2. A source video or image can be downscaled by 2x, then passed through the RAISR filter which upscales by 2x 63 | ``` 64 | ./ffmpeg -y -i /input_files/input.mp4 -vf scale=iw/2:ih/2,raisr=threadcount=20 -pix_fmt yuv420p /output_files/out.yuv 65 | ``` 66 | At this point the source content is the same resolution as the output and the two can be compared to understand how well the super resolution is working. RAISR can be compared against existing DL super resolution algorithms as well. It is recommended to enable second pass in Intel Library for VSR to produce sharper images. Please see the Advanced Usage section for guidance on enabling second pass as a feature. 67 | 68 | **OpenCL acceleration** 69 | ``` 70 | ./ffmpeg -y -i /input_files/input.mp4 -vf raisr=asm=opencl -pix_fmt yuv420p /output_files/out.yuv 71 | ``` 72 | or user can use filter "raisr_opencl" to build full gpu pipeline. \ 73 | [ffmpeg-qsv](https://trac.ffmpeg.org/wiki/Hardware/QuickSync) \ 74 | [ffmpeg-vaapi](https://trac.ffmpeg.org/wiki/Hardware/VAAPI) 75 | ``` 76 | ffmpeg -init_hw_device vaapi=va -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -hwaccel qsv -c:v h264_qsv -i input.264 -vf "hwmap=derive_device=opencl,format=opencl,raisr_opencl,hwmap=derive_device=qsv:reverse=1:extra_hw_frames=16" -c:v hevc_qsv output.mp4 77 | ``` 78 | ``` 79 | 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 80 | ``` 81 | 82 | **Even output** 83 | 84 | 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 85 | 86 | Set `evenoutput=1` to make output size as even number, the following command will get 632x632 output. 87 | ``` 88 | ffmpeg -i input.mp4 -an -vf scale=422x422,raisr=ratio=1.5:filterfolder=filters_1.5x/filters_highres:threadcount=1:evenoutput=1 output.mp4 89 | ``` 90 | 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. 91 | 92 | ## To see help on the RAISR filter 93 | `./ffmpeg -h filter=raisr` 94 | 95 | raisr AVOptions: 96 | ratio ..FV....... ratio of the upscaling, between 1 and 2 (default 2) 97 | bits ..FV....... bit depth (from 8 to 10) (default 8) 98 | range ..FV....... color range of the input. If you are working with images, you may want to set range to full (video/full) (default video) 99 | threadcount ..FV....... thread count (from 1 to 120) (default 20) 100 | filterfolder ..FV....... absolute filter folder path (default "filters_2x/filters_lowres") 101 | blending ..FV....... CT blending mode (1: Randomness, 2: CountOfBitsChanged) (from 1 to 2) (default 2) 102 | passes ..FV....... passes to run (1: one pass, 2: two pass) (from 1 to 2) (default 1) 103 | mode ..FV....... mode for two pass (1: upscale in 1st pass, 2: upscale in 2nd pass) (from 1 to 2) (default 1) 104 | asm ..FV....... x86 asm type: (avx512fp16, avx512, avx2 or opencl) (default "avx512fp16") 105 | platform ..FV....... select the platform (from 0 to INT_MAX) (default 0) 106 | device ..FV....... select the device (from 0 to INT_MAX) (default 0) 107 | evenoutput ..FV....... make output size as even number (0: ignore, 1: subtract 1px if needed) (from 0 to 1) (default 0) 108 | 109 | 110 | # How to Contribute 111 | We welcome community contributions to the Open Visual Cloud repositories. If you have any idea how to improve the project, please share it with us. 112 | 113 | ## Contribution process 114 | Make sure you can build the project and run tests with your patch. 115 | Submit a pull request at https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/pulls. 116 | The Intel Library for VSR is licensed under the BSD 3-Clause "New" or "Revised" license. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms. 117 | 118 | ## How to Report Bugs and Provide Feedback 119 | Use the Issues tab on Github. 120 | 121 | Intel, the Intel logo and Xeon are trademarks of Intel Corporation or its subsidiaries. 122 | 123 | # License 124 | 125 | Intel Library for VSR is licensed under the BSD 3-clause license. 126 | -------------------------------------------------------------------------------- /ReleaseNotes.md: -------------------------------------------------------------------------------- 1 | # Intel® Library for Video Super Resolution (Intel® Library for VSR) Release Notes 2 | 3 | # New and Changed in Release v23.11.1 4 | 5 | **v23.11.1** 6 | 7 | ## New and Changed in v23.11.1 8 | 9 | - Build and Integration Improvements: Numerous fixes and updates to build scripts, including Coverity build issues and ffmpeg build patches. 10 | - Documentation Enhancements: Updates to README and other documentation files to improve clarity and usability. 11 | - Security and Dependency Management: Introduction of security measures like SECURITY.md and enabling dependabot for automated dependency updates. 12 | - Performance and Feature Additions: Addition of performance charts, advanced usage sections, and new Dockerfiles for enhanced functionality. 13 | 14 | **v23.11** 15 | 16 | ## New and Changed in v23.11 17 | - NEW:Enabled OpenCL acceleration, supported Intel® GPUs platforms. 18 | - NEW:Enabled AVX512-FP16 for faster processing on 4th generation Intel® Xeon Scalable processor. 19 | - NEW:Supported 1.5x upscaling for 8-bit. 20 | - NEW:Added filters with denoising effect. 21 | - NEW:Supported YUV444 format in ffmpeg plugin which can improve quality for input and output in RBG or YUV444 format. 22 | - NEW:Added new dockerfiles with Ubuntu 22.04 and CentOS 7.9. 23 | - Upgraded ffmpeg to n6.0. 24 | - Improved performance for Intel® Xeon platforms. 25 | - Optimized the filter size and enhanced filter file format to binary. 26 | - Removed the filters2, filters3, filters5 and renamed filters1->filters_2x/filters_lowres and filters4->filters_2x/filters_highres, and improved the quality of filters_highres. 27 | 28 | ## Bug Fixes 29 | - Fixed the segmentation fault issue with some specific threadcount. 30 | - Fixed the black block issue with blending=1 cases. 31 | 32 | ## Known Limitations 33 | - Only 2x and 1.5x upscaling supported. 34 | - patchSize passed into RNLInit must be set to 11. Algorithms are currently tuned to work only with a patch size of 11. Values other than 11 will fail. 35 | - For usage of Intel AVX2, system hardware must be run on Intel Haswell Processor or later. For usage of Intel AVX-512, system hardware must be run on Intel Xeon Scalable Processesors (1st Gen or later, Skylake or later ). For usage of Intel AVX512-FP16, system hardware must be run on 4th generation Intel Xeon Scalable Processesors or later. 36 | 37 | # New and Changed in Release v22.12 38 | 39 | **v22.12** 40 | 41 | ## New Features 42 | - Support the use of Intel AVX2 instructions. See README for usage. 43 | - Performance Optimizations: improved performance via using AVX2 instructions to enhance some functions. 44 | - Add scripts that support setup Raisr without internet access. These scripts are in scripts folder. 45 | 46 | ## Bug Fixes 47 | - Fixed ffmpeg compilation issue with low GCC 7.5.0. 48 | - Fixed the issue that some video resolutions were not working correctly. 49 | - Ehanced inspection of inputs. 50 | 51 | ## Known Limitations 52 | - Only 2x upscaling supported. Ratio passed into RNLInit should be set to 2. 53 | - patchSize passed into RNLInit must be set to 11. Algorithms are currently tuned to work only with a patch size of 11. Values other than 11 will fail. 54 | - For usage of Intel AVX2, system hardware must be run on Intel Haswell Processor or later. For usage of Intel AVX-512, system hardware must be run on Intel Xeon Scalable Processesors (1st Gen or later, Skylake or later ) 55 | 56 | # Release Notes in Release v22.9 57 | 58 | **v22.9** 59 | 60 | This release is packaged as a docker container and should contain everything one needs to evaluate the super resolution upscaling of the Intel Library for VSR. This project is under active development, but is well suited for evaluation. Please refer to the included README for guidance surrounding building the plugin and running it. 61 | 62 | 63 | ## Package Contents 64 | - filters1\, filters2\, filters3\, filters4\, filters5\ - 5 folders containing filters. Each filter can produce different results. See README 65 | - license\ - license containing use, terms and limitations 66 | - 0001-ffmpeg-raisr-filter.patch - patch to create raisr plugin for ffmpeg branch n6.0 67 | - Dockerfile – used to create a docker image 68 | - Library\ - contains .cpp source code files and header files outlining project’s development APIs 69 | 70 | ## New Features 71 | - Docker support included 72 | - FFmpeg raisr filter added, allowing upscaling of images and video. See README for usage. 73 | - Second pass added to allow for sharpening of raisr output. 74 | - Multithreaded (threadcount=[1-120]) usage will segment data to multiple threads to increase fps with efficient parallelism 75 | - 5 trained filters included in evaluation, trained with different parameters, producing results with varying sharpness 76 | - Optimized for modern Intel® Xeon® Scalable servers (requires Intel® Advanced Vector Extensions 512 (Intel® AVX-512) instructions, used for performance efficiency) 77 | ## Known Limitations 78 | - Ratio passed into RNLInit should be set to 2. 2x upscaling matches what has been validated (e.g. 1080p->4k). Values other than 2 may produce unexpected results. 79 | - patchSize passed into RNLInit must be set to 11. Algorithms are currently tuned to work only with a patch size of 11. Values other than 11 may produce unexpected results. 80 | - Because of usage of Intel AVX-512, system hardware must be run on Intel Xeon Scalable Processesors (1st Gen or later, Skylake or later ) 81 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation. 3 | 4 | ## Reporting a Vulnerability 5 | Please report any security vulnerabilities in this project [utilizing the guidelines here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). 6 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: BSD-3-Clause 4 | # Copyright 2024-2025 Intel Corporation 5 | 6 | # Fails the script if any of the commands error (Other than if and some others) 7 | set -e -o pipefail 8 | 9 | SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" 10 | REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}")" 11 | 12 | . "${SCRIPT_DIR}/scripts/common.sh" 13 | nproc="${nproc:-$(nproc)}" 14 | 15 | # Env variable BUILD_TYPE can be one off: RelWithDebInfo, Release, Debug 16 | BUILD_TYPE="${BUILD_TYPE:-Release}" 17 | 18 | CMAKE_C_FLAGS=" -I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp ${CMAKE_C_FLAGS}" 19 | CMAKE_CXX_FLAGS=" -I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp ${CMAKE_CXX_FLAGS}" 20 | CMAKE_LIBRARY_PATH="/opt/intel/oneapi/ipp/latest/lib;${PREFIX}/lib;${CMAKE_LIBRARY_PATH}" 21 | LDFLAGS="${LDFLAGS} -L/opt/intel/oneapi/ipp/latest/lib -L${PREFIX}/lib " 22 | 23 | # Helpful when copying and pasting functions and debuging. 24 | if printf '%s' "$0" | grep -q '\.sh'; then 25 | IN_SCRIPT=true 26 | fi 27 | 28 | function cd_safe() { 29 | if (cd "$1"); then 30 | cd "$1" 31 | else 32 | _dir="$1" 33 | shift 34 | die "${@:-Failed cd to $_dir.}" 35 | fi 36 | } 37 | 38 | # Usage: build [test] 39 | function build() 40 | ( 41 | log_info "Create folder: build, build type: ${BUILD_TYPE}" 42 | 43 | if [[ -d "${REPOSITORY_DIR:?}/build" ]]; then 44 | rm -rf "${REPOSITORY_DIR:?}/build/"* 45 | fi 46 | 47 | mkdir -p "${REPOSITORY_DIR}/build" > /dev/null 2>&1 48 | 49 | cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${CMAKE_EXTRA_FLAGS}" -B "${REPOSITORY_DIR}/build" -S "${REPOSITORY_DIR}" "$@" 50 | #cmake .. -DCMAKE_BUILD_TYPE="RelWithDebInfo" $CMAKE_EXTRA_FLAGS "$@" 51 | 52 | if [ -f "${REPOSITORY_DIR}/build/Makefile" ]; then 53 | make -j"${nproc}" -C "${REPOSITORY_DIR}/build" 54 | as_root make install -j"${nproc}" -C "${REPOSITORY_DIR}/build" 55 | fi 56 | ) 57 | 58 | function check_executable() 59 | { 60 | print_exec=(printf '\0') 61 | if [[ "$#" -ge "2" ]]; then 62 | if [[ "${1}" == "-p" ]]; then 63 | print_exec=(printf '%s\n') 64 | fi 65 | shift 66 | fi 67 | 68 | if [[ "$#" -ge "1" ]]; then 69 | command_to_check="${1}" && shift 70 | else 71 | log_error "Wrong number of parameters passed to check_executable()." 72 | return 1 73 | fi 74 | 75 | if [ -e "${command_to_check}" ]; then 76 | "${print_exec[@]}" "${command_to_check}" 77 | return 0 78 | fi 79 | 80 | for pt in "$@" $(echo "${PATH}" | tr ':' ' '); do 81 | if [ -e "${pt}/${command_to_check}" ]; then 82 | "${print_exec[@]}" "${pt}/${command_to_check}" 83 | return 0 84 | fi 85 | done 86 | 87 | return 127 88 | } 89 | 90 | if check_executable icpx; then 91 | CXX=$(check_executable -p icpx) 92 | elif check_executable g++; then 93 | CXX=$(check_executable -p g++) 94 | elif check_executable clang++; then 95 | CXX=$(check_executable -p clang++) 96 | else 97 | log_error "No suitable cpp compiler found in path." 98 | log_error "Please either install one or set it via cxx=*" 99 | die "[Exiting due to error.]" 100 | fi 101 | 102 | export CXX 103 | build "$@" 104 | -------------------------------------------------------------------------------- /docker/Flex/nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes auto; 2 | pid /run/nginx.pid; 3 | 4 | events { 5 | worker_connections 1024; 6 | } 7 | 8 | rtmp { 9 | server { 10 | listen 1935; 11 | application live { 12 | live on; 13 | hls on; 14 | hls_path /usr/local/nginx/html/hls; 15 | hls_fragment 10s; 16 | dash on; 17 | dash_path /usr/local/nginx/html/dash; 18 | } 19 | } 20 | } 21 | 22 | http { 23 | server { 24 | listen 80; 25 | location / { 26 | root /usr/local/nginx/html; 27 | add_header 'Access-Control-Allow-Origin' '*' always; 28 | add_header 'Access-Control-Expose-Headers' 'Content-Length'; 29 | } 30 | 31 | location /hls { 32 | alias /usr/local/nginx/html/hls; 33 | add_header Cache-Control no-cache; 34 | add_header 'Access-Control-Allow-Origin' '*' always; 35 | add_header 'Access-Control-Expose-Headers' 'Content-Length'; 36 | types { 37 | application/vnd.apple.mpegurl m3u8; 38 | video/mp2t ts; 39 | } 40 | } 41 | 42 | location /dash { 43 | alias /usr/local/nginx/html/dash; 44 | add_header Cache-Control no-cache; 45 | add_header 'Access-Control-Allow-Origin' '*' always; 46 | add_header 'Access-Control-Expose-Headers' 'Content-Length'; 47 | types { 48 | application/dash+xml mpd; 49 | } 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /docker/Xeon/Dockerfile.centos9: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # 4 | # Copyright (c) 2020-2021 Intel Corporation. 5 | # SPDX-License-Identifier: BSD-3-Clause 6 | # 7 | 8 | FROM quay.io/centos/centos:stream9 AS build 9 | 10 | ARG DL_PREFIX=/opt 11 | ARG PREFIX=/opt/build 12 | ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" 13 | ARG FFMPEG_COMMIT_ID="n6.1.1" 14 | ENV TZ="Europe/Warsaw" 15 | 16 | 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" 17 | 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" 18 | 19 | COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d 20 | 21 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 22 | WORKDIR "${PREFIX}" 23 | RUN yum install -y \ 24 | bash \ 25 | git \ 26 | make \ 27 | cmake \ 28 | glibc \ 29 | bzip2 \ 30 | zlib-devel \ 31 | texinfo \ 32 | intel-oneapi-ipp-devel \ 33 | gcc-toolset-12-gcc-c++ \ 34 | gcc-toolset-12-gcc \ 35 | gcc-toolset-12-binutils && \ 36 | curl -Lf "${NASM_RPM_LINK}" -o "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 37 | yum localinstall -y "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 38 | rm -f "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 39 | yum group list && \ 40 | yum group install "Development Tools" -y && \ 41 | yum clean all && \ 42 | rm -rf /var/cache/yum 43 | 44 | WORKDIR ${DL_PREFIX}/libx264 45 | RUN git clone https://github.com/mirror/x264 -b stable --depth 1 . && \ 46 | ./configure --prefix="${PREFIX}" --libdir="${PREFIX}/lib" --enable-shared && \ 47 | make -j"$(nproc)" && \ 48 | make install 49 | 50 | WORKDIR ${DL_PREFIX}/libx265/build/linux 51 | RUN curl -Lf https://github.com/videolan/x265/archive/3.4.tar.gz | \ 52 | tar -zx --strip-components=1 -C "${DL_PREFIX}/libx265/" && \ 53 | cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DHIGH_BIT_DEPTH=ON ../../source && \ 54 | make -j"$(nproc)" && \ 55 | make install 56 | 57 | ENV IPPROOT="/opt/intel/oneapi/ipp/latest" 58 | ENV IP_PPREFIX="/opt/intel/oneapi/ipp/latest" 59 | ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig" 60 | ENV CPATH="${IPPROOT}/include:${IPPROOT}/include/ipp" 61 | ENV IPP_TARGET_ARCH="intel64" 62 | ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:${IPPROOT}/lib/intel64" 63 | ENV LIBRARY_PATH="${IPPROOT}/lib/intel64" 64 | 65 | WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library 66 | COPY . ${DL_PREFIX}/Video-Super-Resolution-Library 67 | RUN mkdir -p "${DL_PREFIX}/ffmpeg" && \ 68 | curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ 69 | tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" && \ 70 | git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ 71 | cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ 72 | ./build.sh 73 | 74 | WORKDIR ${DL_PREFIX}/ffmpeg 75 | RUN ./configure \ 76 | --enable-libipp \ 77 | --extra-cflags="-fopenmp" \ 78 | --extra-ldflags=-fopenmp\ 79 | --enable-gpl \ 80 | --enable-libx264 \ 81 | --enable-libx265 \ 82 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ 83 | --enable-cross-compile \ 84 | --prefix="${PREFIX}" && \ 85 | make clean && \ 86 | make -j"$(nproc)" && \ 87 | make install && \ 88 | rm -rf "${DL_PREFIX}/libx265" "${DL_PREFIX}/libx264" 89 | 90 | ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64/" 91 | WORKDIR ${PREFIX}/usr/local/lib 92 | RUN ldd "${PREFIX}/bin/ffmpeg" | cut -d ' ' -f 3 | xargs -i cp {} . && \ 93 | mv "${PREFIX}/bin" "${PREFIX}/usr/local/" && \ 94 | rm -rf "${PREFIX:?}/share" "${PREFIX:?}/include" "${PREFIX:?}/lib" && \ 95 | LD_LIBRARY_PATH="${PREFIX}/usr/local/lib:${LIBIPP}" "${PREFIX}/usr/local/bin/ffmpeg" -buildconf 96 | 97 | FROM quay.io/centos/centos:stream9 AS base 98 | 99 | LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com" 100 | LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" 101 | LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" 102 | 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." 103 | LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" 104 | LABEL org.opencontainers.image.version="1.0.0" 105 | LABEL org.opencontainers.image.vendor="Intel® Corporation" 106 | LABEL org.opencontainers.image.licenses="BSD 3-Clause License" 107 | 108 | ARG PREFIX=/opt/build 109 | ENV TZ=Europe/Warsaw 110 | 111 | ENV IPP_TARGET_ARCH="intel64" 112 | ENV IPPROOT="/opt/intel/oneapi/redist" 113 | ENV LIBIPP="${IPPROOT}/lib" 114 | ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64:${LIBIPP}" 115 | 116 | COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d 117 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 118 | WORKDIR /opt/raisrfolder 119 | RUN yum install -y \ 120 | sudo \ 121 | bash \ 122 | make \ 123 | intel-oneapi-runtime-ipp && \ 124 | yum clean all && \ 125 | rm -rf /var/cache/yum && \ 126 | groupadd -g 2110 vfio && \ 127 | useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ 128 | usermod -aG wheel raisr 129 | 130 | COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x 131 | COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x 132 | COPY --chown=raisr:raisr --from=build ${PREFIX} / 133 | 134 | RUN ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ 135 | ldconfig && \ 136 | /usr/local/bin/ffmpeg -buildconf && \ 137 | ffmpeg -h filter=raisr 138 | 139 | # USER "raisr" 140 | HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 141 | 142 | SHELL ["/bin/bash", "-c"] 143 | CMD ["-h", "filter=raisr"] 144 | ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] 145 | -------------------------------------------------------------------------------- /docker/Xeon/Dockerfile.rockylinux9: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # 4 | # Copyright (c) 2020-2021 Intel Corporation. 5 | # SPDX-License-Identifier: BSD-3-Clause 6 | # 7 | 8 | # BROKEN BUILD DUE TU UPDATED VERSION OF BASEKIT 9 | # INSTEAD THE MINI VERSION IS BEING BUILD USING 10 | # OFFLINE INSTALLER 11 | 12 | ARG IMAGE_CACHE_REGISTRY=docker.io 13 | ARG IMAGE_NAME=intel/oneapi-basekit:2024.0.0-devel-rockylinux9 14 | FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build 15 | RUN echo "ERROR!" && exit 1 16 | 17 | ARG DL_PREFIX=/opt 18 | ARG PREFIX=/opt/build 19 | ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" 20 | ARG FFMPEG_COMMIT_ID="n6.1.1" 21 | ENV TZ="Europe/Warsaw" 22 | 23 | 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" 24 | 25 | WORKDIR "${PREFIX}" 26 | COPY . ${DL_PREFIX}/Video-Super-Resolution-Library 27 | 28 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 29 | WORKDIR "${DL_PREFIX}/ffmpeg" 30 | RUN yum install -y \ 31 | bash \ 32 | git \ 33 | make \ 34 | cmake \ 35 | glibc \ 36 | bzip2 \ 37 | zlib-devel && \ 38 | curl -Lf "${NASM_RPM_LINK}" -o "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 39 | yum localinstall -y "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 40 | rm -f "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 41 | yum group list && \ 42 | yum group install "Development Tools" -y && \ 43 | yum clean all && \ 44 | rm -rf /var/cache/yum 45 | 46 | WORKDIR ${DL_PREFIX}/libx264 47 | RUN git clone https://github.com/mirror/x264 -b stable --depth 1 . && \ 48 | ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib --enable-shared && \ 49 | make -j $(nproc) && \ 50 | make install 51 | 52 | WORKDIR ${DL_PREFIX}/libx265/build/linux 53 | RUN curl -Lf https://github.com/videolan/x265/archive/3.4.tar.gz | \ 54 | tar -zx --strip-components=1 -C "${DL_PREFIX}/libx265/" && \ 55 | cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} -DHIGH_BIT_DEPTH=ON ../../source && \ 56 | make -j$(nproc) && \ 57 | make install 58 | 59 | ENV IPPROOT="/opt/intel/oneapi/ipp/latest" 60 | ENV IP_PPREFIX="/opt/intel/oneapi/ipp/latest" 61 | ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig" 62 | ENV CPATH="${IPPROOT}/include:${IPPROOT}/include/ipp" 63 | ENV IPP_TARGET_ARCH="intel64" 64 | ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:${IPPROOT}/lib/intel64" 65 | ENV LIBRARY_PATH="${IPPROOT}/lib/intel64" 66 | 67 | WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library 68 | RUN curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ 69 | tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" && \ 70 | git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ 71 | cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ 72 | ./build.sh 73 | 74 | WORKDIR ${DL_PREFIX}/ffmpeg 75 | RUN ./configure \ 76 | --enable-libipp \ 77 | --extra-cflags="-fopenmp" \ 78 | --extra-ldflags=-fopenmp\ 79 | --enable-gpl \ 80 | --enable-libx264 \ 81 | --enable-libx265 \ 82 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ 83 | --enable-cross-compile \ 84 | --prefix="${PREFIX}" && \ 85 | make clean && \ 86 | make -j $(nproc) && \ 87 | make install && \ 88 | rm -rf ${DL_PREFIX}/libx265 ${DL_PREFIX}/libx264 89 | 90 | WORKDIR ${PREFIX}/usr/local/lib 91 | RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ 92 | mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ 93 | rm -rf ${PREFIX}/share ${PREFIX}/include ${PREFIX}/lib 94 | 95 | ARG IMAGE_CACHE_REGISTRY 96 | FROM ${IMAGE_CACHE_REGISTRY}/library/rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 AS base 97 | 98 | LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com" 99 | LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" 100 | LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" 101 | 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." 102 | LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" 103 | LABEL org.opencontainers.image.version="1.0.0" 104 | LABEL org.opencontainers.image.vendor="Intel® Corporation" 105 | LABEL org.opencontainers.image.licenses="BSD 3-Clause License" 106 | 107 | ARG PREFIX=/opt/build 108 | ENV TZ=Europe/Warsaw 109 | ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/opt/intel/oneapi/redist/lib 110 | WORKDIR /opt/raisrfolder 111 | 112 | COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d 113 | RUN yum install -y \ 114 | sudo \ 115 | vim \ 116 | bash \ 117 | intel-oneapi-runtime-ipp && \ 118 | yum clean all && \ 119 | rm -rf /var/cache/yum && \ 120 | groupadd -g 2110 vfio && \ 121 | useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ 122 | usermod -aG wheel raisr 123 | 124 | COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x 125 | COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x 126 | COPY --chown=raisr:raisr --from=build ${PREFIX} / 127 | 128 | RUN ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ 129 | ldconfig && \ 130 | ffmpeg -h filter=raisr 131 | 132 | # x264-libs # x265-libs 133 | # USER "raisr" 134 | HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 135 | 136 | SHELL ["/bin/bash", "-c"] 137 | CMD ["-h", "filter=raisr"] 138 | ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] 139 | -------------------------------------------------------------------------------- /docker/Xeon/Dockerfile.rockylinux9-mini: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # 4 | # Copyright (c) 2020-2021 Intel Corporation. 5 | # SPDX-License-Identifier: BSD-3-Clause 6 | # 7 | 8 | ARG IMAGE_CACHE_REGISTRY=docker.io 9 | ARG IMAGE_NAME=library/rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 10 | FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build 11 | 12 | ARG DL_PREFIX=/opt 13 | ARG PREFIX=/opt/build 14 | ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64" 15 | ARG FFMPEG_COMMIT_ID="n6.1.1" 16 | ENV TZ="Europe/Warsaw" 17 | 18 | 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" 19 | 20 | WORKDIR "${PREFIX}" 21 | COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d 22 | COPY . ${DL_PREFIX}/Video-Super-Resolution-Library 23 | 24 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 25 | WORKDIR "${DL_PREFIX}/ffmpeg" 26 | RUN yum install -y \ 27 | bash \ 28 | git \ 29 | make \ 30 | cmake \ 31 | glibc \ 32 | bzip2 \ 33 | zlib-devel \ 34 | intel-oneapi-ipp-devel \ 35 | gcc-toolset-12-gcc-c++ \ 36 | gcc-toolset-12-gcc \ 37 | gcc-toolset-12-binutils && \ 38 | curl -Lf "${NASM_RPM_LINK}" -o "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 39 | yum localinstall -y "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 40 | rm -f "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \ 41 | yum group list && \ 42 | yum group install "Development Tools" -y && \ 43 | yum clean all && \ 44 | rm -rf /var/cache/yum 45 | 46 | WORKDIR ${DL_PREFIX}/libx264 47 | RUN git clone https://github.com/mirror/x264 -b stable --depth 1 . && \ 48 | ./configure --prefix="${PREFIX}" --libdir="${PREFIX}/lib" --enable-shared && \ 49 | make -j"$(nproc)" && \ 50 | make install 51 | 52 | WORKDIR ${DL_PREFIX}/libx265/build/linux 53 | RUN curl -Lf https://github.com/videolan/x265/archive/3.4.tar.gz | \ 54 | tar -zx --strip-components=1 -C "${DL_PREFIX}/libx265/" && \ 55 | cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DHIGH_BIT_DEPTH=ON ../../source && \ 56 | make -j"$(nproc)" && \ 57 | make install 58 | 59 | ENV IPPROOT="/opt/intel/oneapi/ipp/latest" 60 | ENV IP_PPREFIX="/opt/intel/oneapi/ipp/latest" 61 | ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig" 62 | ENV CPATH="${IPPROOT}/include:${IPPROOT}/include/ipp" 63 | ENV IPP_TARGET_ARCH="intel64" 64 | ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:${IPPROOT}/lib/intel64" 65 | ENV LIBRARY_PATH="${IPPROOT}/lib/intel64" 66 | 67 | WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library 68 | RUN curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ 69 | tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" && \ 70 | git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ 71 | cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ 72 | ./build.sh 73 | 74 | WORKDIR ${DL_PREFIX}/ffmpeg 75 | RUN ./configure \ 76 | --enable-libipp \ 77 | --extra-cflags="-fopenmp" \ 78 | --extra-ldflags=-fopenmp\ 79 | --enable-gpl \ 80 | --enable-libx264 \ 81 | --enable-libx265 \ 82 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ 83 | --enable-cross-compile \ 84 | --prefix="${PREFIX}" && \ 85 | make clean && \ 86 | make -j"$(nproc)" && \ 87 | make install && \ 88 | rm -rf "${DL_PREFIX}/libx265" "${DL_PREFIX}/libx264" 89 | 90 | WORKDIR ${PREFIX}/usr/local/lib 91 | RUN ldd "${PREFIX}/bin/ffmpeg" | cut -d ' ' -f 3 | xargs -i cp {} . && \ 92 | mv "${PREFIX}/bin" "${PREFIX}/usr/local/" && \ 93 | rm -rf "${PREFIX:?}/share" "${PREFIX:?}/include" "${PREFIX:?}/lib" 94 | 95 | ARG IMAGE_CACHE_REGISTRY 96 | FROM ${IMAGE_CACHE_REGISTRY}/library/rockylinux:9@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 AS base 97 | 98 | LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com" 99 | LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" 100 | LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" 101 | 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." 102 | LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" 103 | LABEL org.opencontainers.image.version="1.0.0" 104 | LABEL org.opencontainers.image.vendor="Intel® Corporation" 105 | LABEL org.opencontainers.image.licenses="BSD 3-Clause License" 106 | 107 | ARG PREFIX=/opt/build 108 | ENV TZ=Europe/Warsaw 109 | ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/opt/intel/oneapi/redist/lib 110 | WORKDIR /opt/raisrfolder 111 | 112 | COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d 113 | RUN yum install -y \ 114 | sudo \ 115 | vim \ 116 | bash \ 117 | intel-oneapi-runtime-ipp && \ 118 | yum clean all && \ 119 | rm -rf /var/cache/yum && \ 120 | groupadd -g 2110 vfio && \ 121 | useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ 122 | usermod -aG wheel raisr 123 | 124 | COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x 125 | COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x 126 | COPY --chown=raisr:raisr --from=build ${PREFIX} / 127 | 128 | RUN ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ 129 | ldconfig && \ 130 | ffmpeg -h filter=raisr 131 | 132 | # x264-libs # x265-libs 133 | # USER "raisr" 134 | HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 135 | 136 | SHELL ["/bin/bash", "-c"] 137 | CMD ["-h", "filter=raisr"] 138 | ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] 139 | -------------------------------------------------------------------------------- /docker/Xeon/Dockerfile.ubuntu18.04: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # Copyright (c) 2020-2021 Intel Corporation. 4 | # SPDX-License-Identifier: BSD-3-Clause 5 | 6 | # use Ubuntu 18.04 with Intel IPP 7 | ARG IMAGE_CACHE_REGISTRY=docker.io 8 | ARG IMAGE_NAME=intel/oneapi-basekit:devel-ubuntu18.04 9 | FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build 10 | 11 | ARG PREFIX=/opt/build 12 | ARG DL_PREFIX=/opt 13 | 14 | ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" 15 | ENV DEBIAN_FRONTEND="noninteractive" 16 | ENV TZ="Europe/Warsaw" 17 | ARG FFMPEG_COMMIT_ID="n6.1.1" 18 | 19 | WORKDIR ${DL_PREFIX}/ffmpeg 20 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 21 | RUN rm /etc/apt/sources.list.d/oneAPI.list && \ 22 | add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ 23 | apt-get update --fix-missing && \ 24 | apt-get full-upgrade -y && \ 25 | apt-get install --no-install-recommends -y \ 26 | git tar ca-certificates \ 27 | libx265-dev \ 28 | libx264-dev \ 29 | zlib1g-dev \ 30 | nasm \ 31 | gcc-9 \ 32 | g++-9 && \ 33 | update-alternatives \ 34 | --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \ 35 | --slave /usr/bin/g++ g++ /usr/bin/g++-9 \ 36 | --slave /usr/bin/gcov gcov /usr/bin/gcov-9 && \ 37 | apt-get clean && \ 38 | rm -rf /var/lib/apt/lists/* && \ 39 | curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ 40 | tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" 41 | 42 | 43 | COPY . ${DL_PREFIX}/Video-Super-Resolution-Library 44 | 45 | WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library 46 | RUN git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ 47 | cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ 48 | ./build.sh 49 | 50 | WORKDIR ${DL_PREFIX}/ffmpeg 51 | RUN ./configure \ 52 | --enable-libipp \ 53 | --extra-cflags=-fopenmp \ 54 | --extra-ldflags=-fopenmp \ 55 | --enable-gpl \ 56 | --enable-libx264 \ 57 | --enable-libx265 \ 58 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ 59 | --enable-cross-compile \ 60 | --prefix="${PREFIX}" && \ 61 | make clean && make -j"$(nproc)" && \ 62 | make install 63 | 64 | ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64" 65 | WORKDIR ${PREFIX}/usr/local/lib 66 | RUN ldd "${PREFIX}/bin/ffmpeg" | cut -d ' ' -f 3 | xargs -i cp {} . && \ 67 | cp "${LIBIPP}/libippsk0.so.10.5" . && \ 68 | cp "${LIBIPP}/libippsn0.so.10.5" . && \ 69 | cp "${LIBIPP}/libippsl9.so.10.5" . && \ 70 | cp "${LIBIPP}/libippse9.so.10.5" . && \ 71 | cp "${LIBIPP}/libippsy8.so.10.5" . && \ 72 | cp "${LIBIPP}/libippsn8.so.10.5" . && \ 73 | cp "${LIBIPP}/libippsm7.so.10.5" . && \ 74 | cp "${LIBIPP}/libippik0.so.10.5" . && \ 75 | cp "${LIBIPP}/libippil9.so.10.5" . && \ 76 | mv "${PREFIX}/bin" "${PREFIX}/usr/local/" && \ 77 | LD_LIBRARY_PATH="${PREFIX}/usr/local/lib" "${PREFIX}/usr/local/bin/ffmpeg" -buildconf && \ 78 | rm -rf "${PREFIX:?}/include/" "${PREFIX:?}/share/" "${PREFIX:?}/lib/" 79 | 80 | ARG IMAGE_CACHE_REGISTRY 81 | FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:18.04@sha256:152dc042452c496007f07ca9127571cb9c29697f42acbfad72324b2bb2e43c98 AS base 82 | 83 | LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" 84 | LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" 85 | LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" 86 | 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." 87 | LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" 88 | LABEL org.opencontainers.image.version="1.0.0" 89 | LABEL org.opencontainers.image.vendor="Intel® Corporation" 90 | LABEL org.opencontainers.image.licenses="BSD 3-Clause License" 91 | 92 | ARG PREFIX=/opt/build 93 | ENV TZ=Europe/Warsaw 94 | ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 95 | 96 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 97 | WORKDIR /opt/raisrfolder 98 | RUN apt-get update --fix-missing && \ 99 | apt-get full-upgrade -y && \ 100 | apt-get install --no-install-recommends -y \ 101 | sudo \ 102 | ca-certificates \ 103 | libx264-1* \ 104 | libx265-1* && \ 105 | apt-get clean && \ 106 | rm -rf /var/lib/apt/lists/* && \ 107 | groupadd -g 2110 vfio && \ 108 | useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ 109 | usermod -aG sudo raisr 110 | 111 | COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x 112 | COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x 113 | COPY --chown=raisr:raisr --from=build ${PREFIX} / 114 | 115 | # Run ffmpeg and verify that the raisr filter is supported 116 | RUN ldconfig && \ 117 | ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ 118 | /opt/raisrfolder/ffmpeg -h filter=raisr 119 | 120 | USER "raisr" 121 | HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 122 | 123 | SHELL ["/bin/bash", "-c"] 124 | CMD ["-h", "filter=raisr"] 125 | ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] 126 | -------------------------------------------------------------------------------- /docker/Xeon/Dockerfile.ubuntu20.04: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # Copyright (c) 2020-2021 Intel Corporation. 4 | # SPDX-License-Identifier: BSD-3-Clause 5 | 6 | # use Ubuntu 20.04 with Intel IPP 7 | ARG IMAGE_CACHE_REGISTRY=docker.io 8 | ARG IMAGE_NAME=intel/oneapi-basekit:2023.2.1-devel-ubuntu20.04 9 | FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build 10 | 11 | ARG PREFIX=/opt/build 12 | ARG DL_PREFIX=/opt 13 | 14 | ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" 15 | ENV DEBIAN_FRONTEND="noninteractive" 16 | ENV TZ="Europe/Warsaw" 17 | ARG FFMPEG_COMMIT_ID="n6.1.1" 18 | 19 | WORKDIR ${DL_PREFIX}/ffmpeg 20 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 21 | RUN rm /etc/apt/sources.list.d/oneAPI.list && \ 22 | apt-get update --fix-missing && \ 23 | apt-get full-upgrade -y && \ 24 | apt-get install --no-install-recommends -y \ 25 | libx265-dev \ 26 | libx264-dev \ 27 | zlib1g-dev \ 28 | nasm \ 29 | cmake && \ 30 | apt-get clean && \ 31 | rm -rf /var/lib/apt/lists/* && \ 32 | curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ 33 | tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" 34 | 35 | COPY . ${DL_PREFIX}/Video-Super-Resolution-Library 36 | 37 | WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library 38 | RUN git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ 39 | cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ 40 | ./build.sh 41 | 42 | # Configure and build ffmpeg 43 | WORKDIR ${DL_PREFIX}/ffmpeg 44 | RUN ./configure \ 45 | --enable-libipp \ 46 | --extra-cflags=-fopenmp \ 47 | --extra-ldflags=-fopenmp \ 48 | --enable-gpl \ 49 | --enable-libx264 \ 50 | --enable-libx265 \ 51 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ 52 | --enable-cross-compile \ 53 | --prefix="${PREFIX}" && \ 54 | make clean && make -j"$(nproc)" && \ 55 | make install 56 | 57 | ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64" 58 | WORKDIR ${PREFIX}/usr/local/lib 59 | RUN ldd "${PREFIX}/bin/ffmpeg" | cut -d ' ' -f 3 | xargs -i cp {} . && \ 60 | cp "${LIBIPP}/libippsk0.so.10.8" . && \ 61 | cp "${LIBIPP}/libippsn0.so.10.8" . && \ 62 | cp "${LIBIPP}/libippsl9.so.10.8" . && \ 63 | cp "${LIBIPP}/libippse9.so.10.8" . && \ 64 | cp "${LIBIPP}/libippsy8.so.10.8" . && \ 65 | cp "${LIBIPP}/libippsn8.so.10.8" . && \ 66 | cp "${LIBIPP}/libippsm7.so.10.8" . && \ 67 | cp "${LIBIPP}/libippik0.so.10.8" . && \ 68 | cp "${LIBIPP}/libippil9.so.10.8" . && \ 69 | mv "${PREFIX}/bin" "${PREFIX}/usr/local/" && \ 70 | LD_LIBRARY_PATH="${PREFIX}/usr/local/lib" "${PREFIX}/usr/local/bin/ffmpeg" -buildconf && \ 71 | rm -rf "${PREFIX:?}/include/" "${PREFIX:?}/share/" "${PREFIX:?}/lib/" 72 | 73 | ARG IMAGE_CACHE_REGISTRY 74 | FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:20.04@sha256:fa17826afb526a9fc7250e0fbcbfd18d03fe7a54849472f86879d8bf562c629e AS base 75 | 76 | LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" 77 | LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" 78 | LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" 79 | 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." 80 | LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" 81 | LABEL org.opencontainers.image.version="1.0.0" 82 | LABEL org.opencontainers.image.vendor="Intel® Corporation" 83 | LABEL org.opencontainers.image.licenses="BSD 3-Clause License" 84 | 85 | ARG PREFIX=/opt/build 86 | ENV TZ=Europe/Warsaw 87 | ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 88 | 89 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 90 | WORKDIR /opt/raisrfolder 91 | RUN apt-get update --fix-missing && \ 92 | apt-get full-upgrade -y && \ 93 | apt-get install --no-install-recommends -y \ 94 | sudo \ 95 | ca-certificates \ 96 | libx264-1* \ 97 | libx265-1* && \ 98 | apt-get clean && \ 99 | rm -rf /var/lib/apt/lists/* && \ 100 | groupadd -g 2110 vfio && \ 101 | useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ 102 | usermod -aG sudo raisr 103 | 104 | COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x 105 | COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x 106 | COPY --chown=raisr:raisr --from=build ${PREFIX} / 107 | 108 | RUN ldconfig && \ 109 | ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ 110 | /opt/raisrfolder/ffmpeg -h filter=raisr 111 | 112 | USER "raisr" 113 | HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 114 | 115 | SHELL ["/bin/bash", "-c"] 116 | CMD ["-h", "filter=raisr"] 117 | ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] 118 | -------------------------------------------------------------------------------- /docker/Xeon/Dockerfile.ubuntu22.04: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | # Copyright (c) 2020-2021 Intel Corporation. 4 | # SPDX-License-Identifier: BSD-3-Clause 5 | 6 | # Use Ubuntu 22.04 with Intel IPP 7 | ARG IMAGE_CACHE_REGISTRY=docker.io 8 | ARG IMAGE_NAME=intel/oneapi-basekit:2023.2.1-devel-ubuntu22.04 9 | FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build 10 | 11 | ARG PREFIX=/opt/build 12 | ARG DL_PREFIX=/opt 13 | 14 | ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" 15 | ENV DEBIAN_FRONTEND="noninteractive" 16 | ENV TZ="Europe/Warsaw" 17 | ARG FFMPEG_COMMIT_ID="n6.1.1" 18 | 19 | WORKDIR ${DL_PREFIX}/ffmpeg 20 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 21 | RUN rm /etc/apt/sources.list.d/oneAPI.list && \ 22 | apt-get update --fix-missing && \ 23 | apt-get full-upgrade -y && \ 24 | apt-get install --no-install-recommends -y \ 25 | libx265-dev \ 26 | libx264-dev \ 27 | zlib1g-dev \ 28 | nasm \ 29 | cmake && \ 30 | apt-get clean && \ 31 | rm -rf /var/lib/apt/lists/* && \ 32 | curl -Lf "https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz" | \ 33 | tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" 34 | 35 | COPY . ${DL_PREFIX}/Video-Super-Resolution-Library 36 | 37 | WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library 38 | RUN git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ 39 | cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ 40 | ./build.sh 41 | 42 | # Configure and build ffmpeg 43 | WORKDIR ${DL_PREFIX}/ffmpeg 44 | RUN ./configure \ 45 | --enable-libipp \ 46 | --extra-cflags=-fopenmp \ 47 | --extra-ldflags=-fopenmp \ 48 | --enable-gpl \ 49 | --enable-libx264 \ 50 | --enable-libx265 \ 51 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ 52 | --enable-cross-compile \ 53 | --prefix="${PREFIX}" && \ 54 | make clean && make -j"$(nproc)" && \ 55 | make install 56 | 57 | ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64" 58 | WORKDIR ${PREFIX}/usr/local/lib 59 | RUN ldd "${PREFIX}/bin/ffmpeg" | cut -d ' ' -f 3 | xargs -i cp {} . && \ 60 | cp "${LIBIPP}/libippsk0.so.10.8" . && \ 61 | cp "${LIBIPP}/libippsn0.so.10.8" . && \ 62 | cp "${LIBIPP}/libippsl9.so.10.8" . && \ 63 | cp "${LIBIPP}/libippse9.so.10.8" . && \ 64 | cp "${LIBIPP}/libippsy8.so.10.8" . && \ 65 | cp "${LIBIPP}/libippsn8.so.10.8" . && \ 66 | cp "${LIBIPP}/libippsm7.so.10.8" . && \ 67 | cp "${LIBIPP}/libippik0.so.10.8" . && \ 68 | cp "${LIBIPP}/libippil9.so.10.8" . && \ 69 | mv "${PREFIX}/bin" "${PREFIX}/usr/local/" && \ 70 | LD_LIBRARY_PATH="${PREFIX}/usr/local/lib" "${PREFIX}/usr/local/bin/ffmpeg" -buildconf && \ 71 | rm -rf "${PREFIX:?}/include/" "${PREFIX:?}/share/" "${PREFIX:?}/lib/" 72 | 73 | ARG IMAGE_CACHE_REGISTRY 74 | FROM ${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04@sha256:adbb90115a21969d2fe6fa7f9af4253e16d45f8d4c1e930182610c4731962658 AS base 75 | 76 | LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" 77 | LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" 78 | LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" 79 | 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." 80 | LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/README.md" 81 | LABEL org.opencontainers.image.version="1.0.0" 82 | LABEL org.opencontainers.image.vendor="Intel® Corporation" 83 | LABEL org.opencontainers.image.licenses="BSD 3-Clause License" 84 | 85 | ARG PREFIX=/opt/build 86 | ENV TZ=Europe/Warsaw 87 | ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 88 | 89 | SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] 90 | WORKDIR /opt/raisrfolder 91 | RUN apt-get update --fix-missing && \ 92 | apt-get full-upgrade -y && \ 93 | apt-get install --no-install-recommends -y \ 94 | sudo \ 95 | ca-certificates \ 96 | libx264-1* \ 97 | libx265-1* && \ 98 | apt-get clean && \ 99 | rm -rf /var/lib/apt/lists/* && \ 100 | groupadd -g 2110 vfio && \ 101 | useradd -m -s /bin/bash -G vfio -u 2610 raisr && \ 102 | usermod -aG sudo raisr && \ 103 | passwd -d raisr 104 | 105 | COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x 106 | COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x 107 | COPY --chown=raisr:raisr --from=build ${PREFIX} / 108 | 109 | RUN ldconfig && \ 110 | ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ 111 | /opt/raisrfolder/ffmpeg -h filter=raisr 112 | 113 | USER "raisr" 114 | HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 115 | 116 | SHELL ["/bin/bash", "-c"] 117 | CMD ["-buildconf"] 118 | ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] 119 | -------------------------------------------------------------------------------- /docker/Xeon/yum/oneAPI.repo: -------------------------------------------------------------------------------- 1 | [oneAPI] 2 | name=Intel® oneAPI repository 3 | baseurl=https://yum.repos.intel.com/oneapi 4 | enabled=1 5 | gpgcheck=1 6 | repo_gpgcheck=1 7 | gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB 8 | 9 | [nasm] 10 | name=The Netwide Assembler 11 | baseurl=http://www.nasm.us/pub/nasm/stable/linux/ 12 | enabled=0 13 | gpgcheck=0 14 | -------------------------------------------------------------------------------- /docker_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: BSD-3-Clause 4 | # Copyright 2024-2025 Intel Corporation 5 | 6 | set -eo pipefail 7 | # This script is used to build the docker image of Intel Video Super Resolution. 8 | # Usage: docker_build 9 | # Example: docker_build xeon ubuntu 22.04 or docker_build flex ubuntu 22.04 10 | 11 | # Uncomment if it is intended to not unset no_proxy and NO_PROXY and pass it to the context 12 | # force_no_env_unset=1 13 | # Uncoment or set exact same variable to force not to print logo animation of intel 14 | # force_no_intel_logo=1 15 | 16 | SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" 17 | . "${SCRIPT_DIR}/scripts/common.sh" 18 | 19 | [ -z "${force_no_intel_logo}" ] && print_logo 20 | 21 | log_info Starting script execution "${BASH_SOURCE[0]}" 22 | OS="${OS:-ubuntu}" 23 | VERSION="${VERSION:-22.04}" 24 | PLATFORM="${PLATFORM:-xeon}" 25 | 26 | if [ -n "$1" ]; then 27 | case "$(printf %s "$1" | tr '[:upper:]' '[:lower:]')" in 28 | xeon) PLATFORM="xeon" ;; 29 | flex) PLATFORM="flex"; OS="ubuntu"; VERSION="22.04" ;; 30 | *) log_error "Platform $1 is not yet supported. Use: [xeon, flex]"; exit 1 31 | esac 32 | shift 33 | fi 34 | 35 | if [ -n "$1" ]; then 36 | case "$(printf %s "$1" | tr '[:upper:]' '[:lower:]')" in 37 | ubuntu) OS="ubuntu" ;; 38 | centos) OS="centos"; VERSION="9" ;; 39 | rocky|rockylinux) OS="rockylinux"; VERSION="9-mini" ;; 40 | *) log_error "Linux distributtion $1 is not yet supported. Use: [ubuntu, centos, rocky]"; exit 1 41 | esac 42 | shift 43 | fi 44 | 45 | if [ -n "$1" ]; then 46 | if [ $OS = "ubuntu" ]; then 47 | case "$1" in 48 | 18.04|20.04|22.04) VERSION="$1" ;; 49 | *) log_error "Ubuntu release $1 is not yet supported. Use: [18.04, 20.04, 22.04]"; exit 1 50 | esac 51 | DEFAULT_CACHE_REGISTRY="${DEFAULT_CACHE_REGISTRY:-docker.io}" 52 | fi 53 | if [ $OS = "centos" ]; then 54 | VERSION="9" 55 | case "$1" in 56 | 9|stream9) VERSION="9" ;; 57 | *) log_error "CentOS release $1 is not yet supported, Use: [stream9]"; exit 1 58 | esac 59 | DEFAULT_CACHE_REGISTRY="${DEFAULT_CACHE_REGISTRY:-quay.io}" 60 | fi 61 | if [ $OS = "rockylinux" ]; then 62 | case "$1" in 63 | 9|9-mini) VERSION="9-mini" ;; 64 | *) log_error "RockyLinux release $1 is not yet supported, Use: [9, 9-mini]"; exit 1 65 | esac 66 | DEFAULT_CACHE_REGISTRY="${DEFAULT_CACHE_REGISTRY:-docker.io}" 67 | fi 68 | shift 69 | fi 70 | 71 | DOCKER_PATH="Xeon" 72 | if [ $PLATFORM = "flex" ]; then 73 | OS="ubuntu" 74 | VERSION="22.04" 75 | DOCKER_PATH="Flex" 76 | fi 77 | 78 | if [[ ! $(grep -q "\.intel.com" <<< "${no_proxy}${NO_PROXY}") ]]; then 79 | if [ -z "${force_no_env_unset}" ]; then 80 | log_info "Unsetting no_proxy and NO_PROXY env values for docker buildx build." 81 | log_info "Disable this behavior by setting force_no_env_unset env variable" 82 | log_info "to any non-empty value." 83 | log_info "\tExample: force_no_env_unset=1" 84 | unset no_proxy 85 | unset NO_PROXY 86 | else 87 | log_info Non-empty force_no_env_unset flag is set. 88 | log_info Forcing no-unset behavior. 89 | fi 90 | fi 91 | 92 | # Read proxy variables from env to pass them to the builder 93 | set -x 94 | BUILD_ARGUMENTS=$(compgen -e | sed -nE '/_(proxy|PROXY)$/{s/^/--build-arg /;p}') 95 | 96 | IMAGE_TAG="${IMAGE_TAG:-${OS}-${VERSION}}" 97 | IMAGE_REGISTRY="${IMAGE_REGISTRY:-docker.io}" 98 | IMAGE_CACHE_REGISTRY="${IMAGE_CACHE_REGISTRY:-${DEFAULT_CACHE_REGISTRY}}" 99 | 100 | docker buildx build \ 101 | ${BUILD_ARGUMENTS} \ 102 | -f "${SCRIPT_DIR}/docker/${DOCKER_PATH}/Dockerfile.${OS}${VERSION}" \ 103 | -t "${IMAGE_REGISTRY}/raisr/raisr-${PLATFORM}:${IMAGE_TAG}" \ 104 | --build-arg IMAGE_REGISTRY="${IMAGE_REGISTRY}" \ 105 | --build-arg IMAGE_CACHE_REGISTRY="${IMAGE_CACHE_REGISTRY}" \ 106 | "$@" "${SCRIPT_DIR}" 107 | set +x 108 | log_info Finished script execution "${BASH_SOURCE[0]}" 109 | -------------------------------------------------------------------------------- /docs/advanced usage: -------------------------------------------------------------------------------- 1 | ## Advanced Usage ( through Exposed Parameters ) 2 | The FFmpeg plugin for Enhanced RAISR exposes a number of parameters that can be changed for advanced customization 3 | ### threadcount (only for CPU) 4 | Allowable values (1,120), default (20) 5 | 6 | Changes the number of software threads used in the algorithm. Values 1..120 will operate on segments of an image such that efficient threading can greatly increase the performance of the upscale. The value itself is the number of threads allocated. 7 | ### filterfolder 8 | Allowable values: (Any folder path containing the 4 required filter files: Qfactor_cohbin_2_8/10, Qfactor_strbin_2_8/10, filterbin_2_8/10, config), default (“filters_2x/filters_lowres”) 9 | 10 | Changing the way Enhanced RAISR is trained (using different parameters and datasets) can alter the way ML-based algorithms do upscale. For the current release, provides 3 filters for 2x upscaling and 2 filters for 1.5x upscaling, current the 1.5x upscaling only support 8-bit. And for each filter you can find the training informantion in filternotes.txt of each filter folder.The following is a brief introduction to the usage scenarios of each filter. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
UpscalingFiltersResolution (recommendation)UsageEffect
1pass2pass
2x(support 8-bit and 10-bit)filters_lowreslow resolution 28 | 360p->720p,540p->1080pfilterfolder=filters_2x/filters_lowres:passes=1/22x upscaling2x upscaling and sharpening
filters_highreshigh resolution 36 | 1080p->4kfilterfolder=filters_2x/filters_highres:passes=1/22x upscaling and sharpening2x upscaling and more sharpening than 1st pass
filters_denoiseno limitationfilterfolder=filters_2x/filters_denoise:passes=2:mode=2denosing only for input2x upscaling and sharpening
1.5x(only support 8-bit)filters_highreshigh resolution 52 | 720p->1080pfilterfolder=filters_1.5x/filters_highres:passes=1:ratio=1.51.5x upscaling and sharpeningN/A
filters_denoiseno limitationfilterfolder=filters_1.5x/filters_denoise:passes=2:mode=2:ratio=1.5denosing only for input1.5x upscaling and sharpening
66 | 67 | Please see the examples under the "Evaluating the Quality" section above where we suggest 3 command lines based upon preference. 68 | Note that for second pass to work, the filter folder must contain 3 additional files: Qfactor_cohbin_2_8/10_2, Qfactor_strbin_2_8/10_2, filterbin_2_8/10_2 69 | ### bits 70 | Allowable values (8: 8-bit depth, 10: 10-bit depth), default (8) 71 | 72 | The model supports 8 and 10-bit depth input. Use HEVC encoder to encoder yuv420p10le format. 73 | ``` 74 | ./ffmpeg -y -i [10bits video clip] -vf "raisr=threadcount=20:bits=10" -c:v libx265 -preset medium -crf 28 -pix_fmt yuv420p10le output_10bit.mp4 75 | ``` 76 | ### range 77 | Allowable values (video: video range, full: full range), default (video) 78 | 79 | The implementation caps color within video/full range. 80 | ``` 81 | ./ffmpeg -y -i [image/video file] -vf "raisr=threadcount=20:range=full" outputfile 82 | ``` 83 | ### blending 84 | Allowable values (1: Randomness, 2: CountOfBitsChanged), default (2 ). For GPU only support 2:CountOfBitsChanged blending. 85 | 86 | The implementation holds two different functions which blend the initial (cheap) upscaled image with the Enhanced RAISR filtered image. This can be a means of removing any aggressive or outlying artifacts that get introduced by the filtered image. 87 | ### passes 88 | Allowable values (1,2), default(1) 89 | 90 | `passes=2` enables a second pass. Adding a second pass can further enhance the output image quality, but doubles the time to upscale. Note that for second pass to work, the filter folder must contain 3 additional files: Qfactor_cohbin_2_8/10_2, Qfactor_strbin_2_8/10_2, filterbin_2_8/10_2 91 | ### mode 92 | Allowable values (1,2), default(1). Requires flag passes=2” 93 | 94 | Dictates which pass the upscaling should occur in. Some filters have the best results when it is applied on a high resolution image that was upscaled during a first pass by using mode=1. Alternatively, the Enhanced RAISR can apply filters on low resolution images during the first pass THEN upscale the image in the second pass if mode=2, for a different outcome. 95 | ``` 96 | ./ffmpeg -i /input_files/input.mp4 -vf "raisr=threadcount=20:passes=2:mode=2" -pix_fmt yuv420p /output_files/out.yuv 97 | ``` 98 | ### asm 99 | Allowable values ("avx512fp16", "avx512","avx2","opencl"), default("avx512fp16") 100 | 101 | The Enhanced RAISR requires an x86 processor which has the Intel® Advanced Vector Extensions 2 (Intel® AVX2) available. Intel AVX2 was first introduced into the Intel Xeon roadmap with Haswell in 2015. Performance can be further increased if the newer Intel® AVX512 Foundation and Vector Length Extensions are available. Intel AVX512 was introduced into the Xeon Scalable Processors (Skylake gen) in 2017. Performance improves again with the introduction of FP16 for Intel AVX512, which uses _Float16 instead of float(32bit) with minimal precision and visual quality loss. FP16 was introduced into the 4th Gen Intel Xeon Scalable Processors (formerly known as Sapphire Rappids) in 2022. The implementation always check for the highest available Instruction Set Architecture (ISA) first, then fallback according to what is available. However if the use case requires it, this asm parameter allows the default behavior to be changed. User can also choose opencl if the opencl is supported in their system. 102 | -------------------------------------------------------------------------------- /docs/images/Pipeline_flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/docs/images/Pipeline_flow.png -------------------------------------------------------------------------------- /docs/images/Pipeline_performance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/docs/images/Pipeline_performance.png -------------------------------------------------------------------------------- /docs/images/Pipeline_performance_AWS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/docs/images/Pipeline_performance_AWS.png -------------------------------------------------------------------------------- /docs/images/RAISR_AWS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/docs/images/RAISR_AWS.png -------------------------------------------------------------------------------- /docs/images/RAISR_baremetal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/docs/images/RAISR_baremetal.png -------------------------------------------------------------------------------- /docs/performance.md: -------------------------------------------------------------------------------- 1 | ## Performance 2 | 3 | Enhanced RAISR is an optimized video super-resolution model trained to upscale video streams, originally captured or transcoded to lower resolution. The model is seamlessly integrated into the video transcoding workflows through high-level APIs like FFMPEG for multimedia applications for video delivery like Video on Demand (VOD), Broadcast, Streaming, etc. The model's performance is assessed with and without video transcoding using FFMPEG plugins, facilitating various deployment options. For more details, refer to the performance command and measuring methodology. 4 | The model is supported on Intel® Xeon® Scalable Processor and Intel Data Center GPUs. Here, we are focusing on performance on the Xeon Scalable platform supporting real-time and offline usage scenarios without the need to offload to an external accelerator. The model can leverage Instruction Set Architecture (ISA) like Intel® Advanced Vector Extensions 2.0 (Intel® AVX2) and Intel® Advanced Vector Extensions 512 (Intel® AVX-512) to meet different workloads and system environments. Intel AVX2 and AVX512 have been supported since 1st generation Intel Xeon Scalable Processor supporting 32-bit and 64-bit floating-point instructions. Additionally, the 4th generation Intel Xeon Scalable processor introduces support for the new 16-bit half-precision IEEE-754 floating-point ISA for Intel AVX512, providing native hardware support. 5 | With Intel AVX512, model performance (in frames per second compared) can improve by 100% compared to Intel AVX2 ISA, where FP16 native support contributes 25% of the improvement. The model consists of several different filters including high res, low res, and noise for specific needs, as they are of the same complexity, they measure similar frames per second and improvements with ISAs. The two-pass filter doubles the compute requirement; hence the performance is reduced to half of a single-pass filter. 6 | 7 | Baremetal Testing of Enhanced RAISR 8 | The model is measured for the throughput performance on an Intel Xeon Processor in the baremetal environment for offline, batch processing in VOD applications. Performance is measured by executing multiple streams, each pinned to a corresponding pair of logical cores of socket 0, with the total number of streams equivalent to the number of physical cores within socket 0. For example, on the Intel Xeon 8380 processor, 40 streams run in parallel to maximize the cpu utilization for throughput performance. The stream is also looped x number of times to obtain stable results. 9 | 10 | Example command line : 11 | ``` 12 | ffmpeg -stream_loop -i /test_video/Netflix_Boat_1920x1080_60fps_10b.y4m -vf raisr=threadcount=2:bits=10:asm=avx2:passes=1:filterfolder=filters_2x/filters_highres -f NULL - 13 | ``` 14 | 15 | 16 | ![Performance of Enhanced RAISR](images/RAISR_baremetal.png) 17 | 18 | 19 | ## AWS Cloud Performance on EC2 Instance 20 | The cloud testing of Enhanced RAISR involves measuring the performance of the model on EC2 C6i and C7i instances, mapped to Intel Xeon 3rd generation and 4th generation platforms. The public cloud benchmarking focuses on real-time, live-streaming, latency-sensitive applications, where single-stream performance is measured by running the model on a specific number of vCPU to calculate the minimum instance needed to reach the 60 frames per second and the performance per dollar. 21 | 22 | 23 | ![Performance of Enhanced RAISR on AWS EC2 instances](images/RAISR_AWS.png) 24 | 25 | 26 | The results indicate the number of vCPUs necessary to process Enhanced RAISR at 60 frames per second or above on the Intel Xeon processor deployed in AWS EC2 instances. For 2x upscaling to UHD 3840x2160p, the number of vCPUs required is 32 vCPU , corresponding to 8xlarge instance type, or 48vCPUs corresponding to 12x large instance type depending upon processor generation. For upscaling to Full HD 1920x1080p, the algorithm requires as few as 8 VCPUs mapping to 2x large for content originally in HD and SD resolution. 27 | When comparing EC2 C7 instances to the previous generation C6 instances, the overall performance per dollar improves by 50-75% due to the hardware and software optimizations available in the latest generation of Intel Xeon Scalable Processor. 28 | 29 | 30 | 31 | ## Advanced Usage: 32 | While Enhanced RAISR can be processed independently for VOD applications, it is coupled with video encoders for broadcast and live streaming. We have selected various widely used codecs with different encoding parameters to demonstrate performance viability on Intel Xeon Platforms. The pipeline illustrates the integration of functional blocks of decoding the incoming bitstream to YUV format, submitting to enhanced RAISR for an upscaling to higher resolution, and finally, encoding the YUV to compressed bitstream. The pipeline is configured to process enhanced RAISR leveraging Intel AVX2 or Intel AVX512 while consistently leveraging AVX2 instructions for encoding to assess the performance benefits of model improvements in this workflow. 33 | 34 | ![Pipeline: Enhanced RAISR with Encoding Parameters](images/Pipeline_flow.png) 35 | 36 | The workflow is measured for the throughput performance on the Intel Xeon processor in the baremetal environment and AWS cloud for offline processing. Performance is measured by executing multiple video streams simultaneously, let’s say N, where the value of N is determined by the total number of available physical cpu cores divided by 8. Each stream is allocated 8 cores , shared between the upscaling and transcoding. Additionally, the process is also looped a few number of times for stable results. 37 | 38 | Sample command line below: 39 | ``` 40 | ffmpeg -stream_loop -i /test_video/Netflix_Boat_1920x1080_60fps_10bit_420.mp4 -vf raisr=threadcount=:bits=10:asm=avx512fp16:passes=1:filterfolder=filters_2x/filters_highres -c:v libsvt_hevc -preset 5 -profile:v 2 -rc 1 -g 119 -sc_detection 0 -b:v 5M -maxrate 10M -bufsize 20M -y 4k.mp4 41 | ``` 42 | 43 | 44 | ![Pipeline Performance: Enhanced RAISR with Encoding Parameters](images/Pipeline_performance.png) 45 | 46 | 47 | The results above highlight the raw performance of the pipeline on Intel Xeon Processors, which exhibits an improvement ranging from 66% to 200% from Xeon 8380 to Xeon 8580 processors. Across the two generations, there is an approximate 30% increase in power consumption, thereby improving the total efficiency by 25-35% depending upon the codec deployed, parameters used, Instruction sets employed, etc. 48 | Accelerating the pre-processing function on AVX512 while maintaining the ISA for the encoder demonstrates that the acceleration of the machine learning model significantly impacts the overall pipeline performance. While the amount of performance improvement will vary based on the encoder and parameter use. For the conditions under test, the performance increases between 30-50% while the overall operating frequency changes <0.1GHz . 49 | To understand the total cost of ownership(TCO), the same workflow was measured on the AWS C6 and C7 instances to measure the performance/USD on a few different instances i.e. 2x large with 8vCPUs, 8x.large with 32vCPUs and 24x large with 96 vCPUs. Companies most commonly use these instances for media transcoding workloads. To maximize the instance throughput, each stream is pinned to few cores i.e. 8 vCPUs to parallelize at stream level for max cpu utilization. . The results show an increase in fps with increasing core count. 50 | 51 | 52 | ![Pipeline Performance on AWS EC27i instance: Enhanced RAISR with Encoding Parameters](images/Pipeline_performance_AWS.png) 53 | 54 | 55 | While experimenting with the different core count instances, there are a couple of learnings related to selecting right instance size for the workload. 56 | #1 Resource Isolation: For the given workload, lower core count instances yield better fps/core by utilizing cores efficiently. However, they are also challenged with most fluctuations in performance due to the limited nature of resources available when shared across noisy tenants. This can result in high variation of performance and inconsistent SLAs. In scenarios with critical SLA, an instance with a higher core count may offer better fidelity. 57 | #2 Effective CPU utilization: When deploying workloads with substantial computation resources like processing large resolutions like 4K and 8K, high stream density, and throughput for compute-intensive AI operations, it has been observed that CPU utilization may get lower. While running the enhanced RAISR pipeline such observation was made when the number of cores exceeded 32vCPU or logical cores, dropping CPU utilization by ~5-7%. It can be attributed to a couple of reasons, firstly the distribution of tasks across many cores results in each core handling less work, leading to underutilization of the system. To maximize utilization and efficiency, it is recommended to select a balanced number of cores that align with the demand of the workload. 58 | Additionally for density application and consistent performance, implementing core pinning strategies, where specific cores are designated to handle explicit functions (or streams), can enhance performance by ensuring a more effective distribution of computational tasks. 59 | 60 | 61 | ## System Details and Disclaimer : 62 |

Configuration of the platform available as (1) QuantaGrid D54Q-2U, 2 socket Xeon 5th generation 8580 CPU @ 2 Ghz; OS: Ubuntu 22.04.1 LTS, 5.15.0-78-generic, microcode : 0x21000161; BIOS : 3B05.TEL4P1, performance mode with hyper-threading and Turbo ON, DDR configuration 1024GB (16x64GB DDR5 4800 MT/s [4800 MT/s]), storage: 1x 1.7T SAMSUNG MZQL21T9HCJR-00A07, gcc compiler version 9.4.0 (2) Intel Corporation M50CYP2SBSTD 2 socket Xeon 3rd generation Scalable Processor 8380 CPU @ 2.30GHz; OS: Ubuntu 20.04.2 LTS; 5.15.0-94-generic, microcode: 0xd0003b9; BIOS: SE5C620.86B.01.01.0006.2207150335, performance mode with hyper-threading and Turbo ON, DDR configuration: 512GB (16x32GB DDR4 3200 MT/s [3200 MT/s]) storage: 1x 3.5T INTEL SSDPF2KX038TZ, gcc compiler version 9.4.0. SW version v 2023.11 63 | $ used for the AWS TCO is based on the price information published by AWS for the 1year standard US East Coast pricing https://aws.amazon.com/ec2/pricing/reserved-instances/pricing/ as of 05/15/2024.

64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ffmpeg/0001-ffmpeg-raisr-filter.patch: -------------------------------------------------------------------------------- 1 | From 467d3dded4549645b16710807562e84a075739c5 Mon Sep 17 00:00:00 2001 2 | From: Xiaoxia Liang 3 | Date: Mon, 24 Jul 2023 11:49:13 +0800 4 | Subject: [PATCH 1/2] FFmpeg Raisr filter for n6.0. 5 | 6 | Signed-off-by: Xiaoxia Liang 7 | --- 8 | configure | 12 ++++++++++++ 9 | libavfilter/Makefile | 1 + 10 | libavfilter/allfilters.c | 1 + 11 | 3 files changed, 14 insertions(+) 12 | 13 | diff --git a/configure b/configure 14 | index b6616f00b6..f87716611b 100755 15 | --- a/configure 16 | +++ b/configure 17 | @@ -240,6 +240,7 @@ External library support: 18 | --enable-libgsm enable GSM de/encoding via libgsm [no] 19 | --enable-libiec61883 enable iec61883 via libiec61883 [no] 20 | --enable-libilbc enable iLBC de/encoding via libilbc [no] 21 | + --enable-libipp enable Intel IPP libary based scalin 22 | --enable-libjack enable JACK audio sound server [no] 23 | --enable-libjxl enable JPEG XL de/encoding via libjxl [no] 24 | --enable-libklvanc enable Kernel Labs VANC processing [no] 25 | @@ -1823,6 +1824,7 @@ EXTERNAL_LIBRARY_LIST=" 26 | libgsm 27 | libiec61883 28 | libilbc 29 | + libipp 30 | libjack 31 | libjxl 32 | libklvanc 33 | @@ -6667,6 +6669,16 @@ enabled libopus && { 34 | } 35 | } 36 | enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.0" libplacebo/vulkan.h pl_vulkan_create 37 | +if enabled libipp; then 38 | + ipp_header_for_check='ippcore.h' 39 | + case $target_os in 40 | + mingw32*|mingw64*) 41 | + ipp_header_for_check='_mingw.h ippcore.h' 42 | + ;; 43 | + esac 44 | + check_lib libipp "$ipp_header_for_check" ippInit -Wl,--start-group -lippi -lipps -lippcore -lippvm -Wl,--end-group || 45 | + die "ERROR: Intel IPP not found" 46 | +fi 47 | enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new 48 | enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection 49 | enabled librav1e && require_pkg_config librav1e "rav1e >= 0.5.0" rav1e.h rav1e_context_new 50 | diff --git a/libavfilter/Makefile b/libavfilter/Makefile 51 | index b3d3d981dd..13126f7f48 100644 52 | --- a/libavfilter/Makefile 53 | +++ b/libavfilter/Makefile 54 | @@ -425,6 +425,7 @@ OBJS-$(CONFIG_PSEUDOCOLOR_FILTER) += vf_pseudocolor.o 55 | OBJS-$(CONFIG_PSNR_FILTER) += vf_psnr.o framesync.o 56 | OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o 57 | OBJS-$(CONFIG_QP_FILTER) += vf_qp.o 58 | +OBJS-$(CONFIG_RAISR_FILTER) += vf_raisr.o 59 | OBJS-$(CONFIG_RANDOM_FILTER) += vf_random.o 60 | OBJS-$(CONFIG_READEIA608_FILTER) += vf_readeia608.o 61 | OBJS-$(CONFIG_READVITC_FILTER) += vf_readvitc.o 62 | diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c 63 | index d7db46c2af..0dc81faaed 100644 64 | --- a/libavfilter/allfilters.c 65 | +++ b/libavfilter/allfilters.c 66 | @@ -401,6 +401,7 @@ extern const AVFilter ff_vf_pseudocolor; 67 | extern const AVFilter ff_vf_psnr; 68 | extern const AVFilter ff_vf_pullup; 69 | extern const AVFilter ff_vf_qp; 70 | +extern const AVFilter ff_vf_raisr; 71 | extern const AVFilter ff_vf_random; 72 | extern const AVFilter ff_vf_readeia608; 73 | extern const AVFilter ff_vf_readvitc; 74 | -- 75 | 2.34.1 76 | -------------------------------------------------------------------------------- /ffmpeg/0002-libavfilter-raisr_opencl-Add-raisr_opencl-filter.patch: -------------------------------------------------------------------------------- 1 | From 954f1cada458477e977adfb42c354fce289a1576 Mon Sep 17 00:00:00 2001 2 | From: Liang Xiaoxia 3 | Date: Fri, 4 Aug 2023 10:56:36 +0800 4 | Subject: [PATCH 2/2] FFmpeg Raisr-OpenCL filter for n6.0 5 | 6 | Signed-off-by: Liang Xiaoxia 7 | --- 8 | configure | 1 + 9 | libavfilter/Makefile | 1 + 10 | libavfilter/allfilters.c | 1 + 11 | 3 files changed, 3 insertions(+) 12 | 13 | diff --git a/configure b/configure 14 | index f87716611b..a3c22079a8 100755 15 | --- a/configure 16 | +++ b/configure 17 | @@ -3754,6 +3754,7 @@ transpose_opencl_filter_deps="opencl" 18 | transpose_vt_filter_deps="videotoolbox VTPixelRotationSessionCreate" 19 | transpose_vulkan_filter_deps="vulkan spirv_compiler" 20 | unsharp_opencl_filter_deps="opencl" 21 | +raisr_opencl_filter_deps="opencl" 22 | uspp_filter_deps="gpl avcodec" 23 | vaguedenoiser_filter_deps="gpl" 24 | vflip_vulkan_filter_deps="vulkan spirv_compiler" 25 | diff --git a/libavfilter/Makefile b/libavfilter/Makefile 26 | index 13126f7f48..c138e2565b 100644 27 | --- a/libavfilter/Makefile 28 | +++ b/libavfilter/Makefile 29 | @@ -546,6 +546,7 @@ OBJS-$(CONFIG_XBR_FILTER) += vf_xbr.o 30 | OBJS-$(CONFIG_XCORRELATE_FILTER) += vf_convolve.o framesync.o 31 | OBJS-$(CONFIG_XFADE_FILTER) += vf_xfade.o 32 | OBJS-$(CONFIG_XFADE_OPENCL_FILTER) += vf_xfade_opencl.o opencl.o opencl/xfade.o 33 | +OBJS-$(CONFIG_RAISR_OPENCL_FILTER) += vf_raisr_opencl.o opencl.o 34 | OBJS-$(CONFIG_XFADE_VULKAN_FILTER) += vf_xfade_vulkan.o vulkan.o vulkan_filter.o 35 | OBJS-$(CONFIG_XMEDIAN_FILTER) += vf_xmedian.o framesync.o 36 | OBJS-$(CONFIG_XSTACK_FILTER) += vf_stack.o framesync.o 37 | diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c 38 | index 0dc81faaed..ef5ce4df9c 100644 39 | --- a/libavfilter/allfilters.c 40 | +++ b/libavfilter/allfilters.c 41 | @@ -403,6 +403,7 @@ extern const AVFilter ff_vf_pullup; 42 | extern const AVFilter ff_vf_qp; 43 | extern const AVFilter ff_vf_raisr; 44 | extern const AVFilter ff_vf_random; 45 | +extern const AVFilter ff_vf_raisr_opencl; 46 | extern const AVFilter ff_vf_readeia608; 47 | extern const AVFilter ff_vf_readvitc; 48 | extern const AVFilter ff_vf_realtime; 49 | -- 50 | 2.34.1 51 | -------------------------------------------------------------------------------- /ffmpeg/vf_raisr_opencl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Intel Library for Video Super Resolution ffmpeg plugin 3 | * 4 | * Copyright (c) 2023 Intel Corporation 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "raisr/RaisrHandler.h" 22 | #include "raisr/RaisrDefaults.h" 23 | #include "libavutil/opt.h" 24 | #include "avfilter.h" 25 | #include "internal.h" 26 | #include "opencl.h" 27 | #include "libavutil/pixdesc.h" 28 | #include "video.h" 29 | 30 | #define MIN_RATIO 1 31 | #define MAX_RATIO 2 32 | #define DEFAULT_RATIO 2 33 | 34 | typedef struct RaisrOpenCLContext { 35 | OpenCLFilterContext ocf; 36 | 37 | int initialised; 38 | float ratio; 39 | int bits; 40 | char *filterfolder; 41 | BlendingMode blending; 42 | int passes; 43 | int mode; 44 | RangeType range; 45 | enum AVPixelFormat sw_format; 46 | int evenoutput; 47 | } RaisrOpenCLContext; 48 | 49 | 50 | static int raisr_opencl_init(AVFilterContext *avctx) 51 | { 52 | RaisrOpenCLContext *ctx = avctx->priv; 53 | RNLERRORTYPE err; 54 | 55 | err = RNLHandler_SetOpenCLContext(ctx->ocf.hwctx->context, ctx->ocf.hwctx->device_id, 0, 0); 56 | if (err != RNLErrorNone) { 57 | av_log(avctx, AV_LOG_ERROR, "RNLHandler_SetExternalOpenCLContext failed\n"); 58 | return AVERROR(ENAVAIL); 59 | } 60 | 61 | err = RNLHandler_Init(ctx->filterfolder, ctx->ratio, ctx->bits, ctx->range, 1, 62 | OpenCLExternal, ctx->passes, ctx->mode); 63 | if (err != RNLErrorNone) { 64 | av_log(avctx, AV_LOG_ERROR, "RNLInit failed\n"); 65 | return AVERROR(ENAVAIL); 66 | } 67 | return 0; 68 | } 69 | 70 | static int raisr_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input) 71 | { 72 | AVFilterContext *avctx = inlink->dst; 73 | AVFilterLink *outlink = avctx->outputs[0]; 74 | RaisrOpenCLContext *ctx = avctx->priv; 75 | AVFrame *output = NULL; 76 | const AVPixFmtDescriptor *desc; 77 | int err, wsub, hsub; 78 | int nb_planes = 0; 79 | VideoDataType vdt_in[3] = { 0 }; 80 | VideoDataType vdt_out[3] = { 0 }; 81 | 82 | av_log(ctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n", 83 | av_get_pix_fmt_name(input->format), 84 | input->width, input->height, input->pts); 85 | 86 | if (!input->hw_frames_ctx) 87 | return AVERROR(EINVAL); 88 | 89 | output = ff_get_video_buffer(outlink, outlink->w, outlink->h); 90 | if (!output) { 91 | err = AVERROR(ENOMEM); 92 | goto fail; 93 | } 94 | desc = av_pix_fmt_desc_get(ctx->sw_format); 95 | if (!desc) { 96 | err = AVERROR(EINVAL); 97 | goto fail; 98 | } 99 | 100 | for(int p = 0; p < desc->nb_components; p++) 101 | if (desc->comp[p].plane > nb_planes) 102 | nb_planes = desc->comp[p].plane; 103 | 104 | for (int p = 0; p <= nb_planes; p++) { 105 | wsub = p ? 1 << desc->log2_chroma_w : 1; 106 | hsub = p ? 1 << desc->log2_chroma_h : 1; 107 | vdt_in[p].pData = input->data[p]; 108 | vdt_in[p].width = input->width / wsub; 109 | vdt_in[p].height = input->height / hsub; 110 | vdt_in[p].step = input->linesize[p]; 111 | vdt_in[p].bitShift = desc->comp[p].shift; 112 | // fill in the output video data type structure 113 | vdt_out[p].pData = output->data[p]; 114 | vdt_out[p].width = output->width / wsub; 115 | vdt_out[p].height = output->height / hsub; 116 | vdt_out[p].step = output->linesize[p]; 117 | vdt_out[p].bitShift = desc->comp[p].shift; 118 | } 119 | 120 | if (!ctx->initialised) { 121 | err = RNLHandler_SetRes(&vdt_in[0], &vdt_in[1], &vdt_in[2], 122 | &vdt_out[0], &vdt_out[1], &vdt_out[2]); 123 | if (err != RNLErrorNone) { 124 | av_log(ctx, AV_LOG_ERROR, "RNLHandler_SetRes error\n"); 125 | return AVERROR(ENOMEM); 126 | } 127 | ctx->initialised = 1; 128 | } 129 | 130 | err = RNLHandler_Process(&vdt_in[0], &vdt_in[1], &vdt_in[2], 131 | &vdt_out[0], &vdt_out[1], &vdt_out[2], 132 | ctx->blending); 133 | if (err != RNLErrorNone) { 134 | av_log(ctx, AV_LOG_ERROR, "RNLHandler_Process error\n"); 135 | return AVERROR(ENOMEM); 136 | } 137 | 138 | err = av_frame_copy_props(output, input); 139 | if (err < 0) 140 | goto fail; 141 | 142 | av_frame_free(&input); 143 | 144 | av_log(ctx, AV_LOG_DEBUG, "Filter output: %s, %ux%u (%"PRId64").\n", 145 | av_get_pix_fmt_name(output->format), 146 | output->width, output->height, output->pts); 147 | 148 | return ff_filter_frame(outlink, output); 149 | 150 | fail: 151 | av_frame_free(&input); 152 | av_frame_free(&output); 153 | return err; 154 | } 155 | 156 | static int raisr_filter_config_input(AVFilterLink *inlink) 157 | { 158 | AVHWFramesContext *input_frames; 159 | int err; 160 | 161 | input_frames = (AVHWFramesContext*)inlink->hw_frames_ctx->data; 162 | if (input_frames->format != AV_PIX_FMT_OPENCL) 163 | return AVERROR(EINVAL); 164 | 165 | if (input_frames->sw_format != AV_PIX_FMT_NV12 && 166 | input_frames->sw_format != AV_PIX_FMT_YUV420P && 167 | input_frames->sw_format != AV_PIX_FMT_P010) 168 | return AVERROR(EINVAL); 169 | 170 | err = ff_opencl_filter_config_input(inlink); 171 | if (err < 0) 172 | return err; 173 | 174 | return 0; 175 | } 176 | 177 | static int raisr_opencl_config_output(AVFilterLink *outlink) 178 | { 179 | AVFilterContext *avctx = outlink->src; 180 | AVFilterLink *inlink = avctx->inputs[0]; 181 | RaisrOpenCLContext *ctx = avctx->priv; 182 | AVHWFramesContext *input_frames; 183 | const AVPixFmtDescriptor *desc; 184 | int err; 185 | 186 | err = raisr_opencl_init(avctx); 187 | if (err < 0) 188 | return err; 189 | 190 | input_frames = (AVHWFramesContext*)inlink->hw_frames_ctx->data; 191 | ctx->sw_format = (enum AVPixelFormat)input_frames->sw_format; 192 | desc = av_pix_fmt_desc_get(ctx->sw_format); 193 | if (desc && desc->comp[0].depth != ctx->bits) { 194 | av_log(ctx, AV_LOG_ERROR, "input pixel doesn't match model's bitdepth\n"); 195 | return AVERROR(EINVAL); 196 | } 197 | 198 | ctx->ocf.output_width = inlink->w * ctx->ratio; 199 | ctx->ocf.output_height = inlink->h * ctx->ratio; 200 | if (ctx->evenoutput == 1) { 201 | ctx->ocf.output_width -= ctx->ocf.output_width % 2; 202 | ctx->ocf.output_height -= ctx->ocf.output_height % 2; 203 | } 204 | 205 | err = ff_opencl_filter_config_output(outlink); 206 | if (err < 0) 207 | return err; 208 | 209 | return 0; 210 | } 211 | 212 | static av_cold void raisr_opencl_uninit(AVFilterContext *avctx) 213 | { 214 | RNLHandler_Deinit(); 215 | ff_opencl_filter_uninit(avctx); 216 | } 217 | 218 | #define OFFSET(x) offsetof(RaisrOpenCLContext, x) 219 | #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) 220 | static const AVOption raisr_opencl_options[] = { 221 | {"ratio", "ratio of the upscaling, between 1 and 2", OFFSET(ratio), 222 | AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT_RATIO}, MIN_RATIO, MAX_RATIO, FLAGS}, 223 | {"bits", "bit depth", OFFSET(bits), AV_OPT_TYPE_INT, {.i64 = 8}, 8, 10, FLAGS}, 224 | {"range", "input color range", OFFSET(range), AV_OPT_TYPE_INT, {.i64 = VideoRange}, VideoRange, FullRange, FLAGS, "range"}, 225 | { "video", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = VideoRange }, INT_MIN, INT_MAX, FLAGS, "range" }, 226 | { "full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FullRange }, INT_MIN, INT_MAX, FLAGS, "range" }, 227 | {"filterfolder", "absolute filter folder path", OFFSET(filterfolder), AV_OPT_TYPE_STRING, {.str = "filters_2x/filters_lowres"}, 0, 0, FLAGS}, 228 | {"blending", "CT blending mode (1: Randomness, 2: CountOfBitsChanged)", 229 | OFFSET(blending), AV_OPT_TYPE_INT, {.i64 = CountOfBitsChanged}, Randomness, CountOfBitsChanged, FLAGS, "blending"}, 230 | { "Randomness", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = Randomness }, INT_MIN, INT_MAX, FLAGS, "blending" }, 231 | { "CountOfBitsChanged", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CountOfBitsChanged }, INT_MIN, INT_MAX, FLAGS, "blending" }, 232 | {"passes", "passes to run (1: one pass, 2: two pass)", OFFSET(passes), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, FLAGS}, 233 | {"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}, 234 | {"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}, 235 | {NULL} 236 | }; 237 | 238 | AVFILTER_DEFINE_CLASS(raisr_opencl); 239 | 240 | static const AVFilterPad raisr_opencl_inputs[] = { 241 | { 242 | .name = "default", 243 | .type = AVMEDIA_TYPE_VIDEO, 244 | .filter_frame = &raisr_opencl_filter_frame, 245 | .config_props = &raisr_filter_config_input, 246 | } 247 | }; 248 | 249 | static const AVFilterPad raisr_opencl_outputs[] = { 250 | { 251 | .name = "default", 252 | .type = AVMEDIA_TYPE_VIDEO, 253 | .config_props = &raisr_opencl_config_output, 254 | } 255 | }; 256 | 257 | const AVFilter ff_vf_raisr_opencl = { 258 | .name = "raisr_opencl", 259 | .description = NULL_IF_CONFIG_SMALL("Raisr"), 260 | .priv_size = sizeof(RaisrOpenCLContext), 261 | .priv_class = &raisr_opencl_class, 262 | .init = &ff_opencl_filter_init, 263 | .uninit = &raisr_opencl_uninit, 264 | FILTER_INPUTS(raisr_opencl_inputs), 265 | FILTER_OUTPUTS(raisr_opencl_outputs), 266 | FILTER_SINGLE_PIXFMT(AV_PIX_FMT_OPENCL), 267 | .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, 268 | }; 269 | -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/Qfactor_cohbin_2_8: -------------------------------------------------------------------------------- 1 | 0.103713 2 | 0.210206 3 | -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/Qfactor_cohbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.213046 2 | 0.441748 3 | -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/Qfactor_strbin_2_8: -------------------------------------------------------------------------------- 1 | 0.017460 2 | 0.067435 3 | -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/Qfactor_strbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.001149 2 | 0.020424 3 | -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/config: -------------------------------------------------------------------------------- 1 | 24 3 3 11 -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/filterbin_2_8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_1.5x/filters_denoise/filterbin_2_8 -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/filterbin_2_8_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_1.5x/filters_denoise/filterbin_2_8_2 -------------------------------------------------------------------------------- /filters_1.5x/filters_denoise/filternotes.txt: -------------------------------------------------------------------------------- 1 | Filter for 2 pass for 1.5x upscale 2 | 1. Filters trained on ~700 images of pexels with linear degradation 3 | 2. Angle=24 Strength=3 Coherence=3 setting for both filters 4 | 3. The 1st is a denoiser and the 2d pass an upscaler with some sharpness added. 5 | 4. Need to run this filter with passes=2 and mode=2 6 | -------------------------------------------------------------------------------- /filters_1.5x/filters_highres/Qfactor_cohbin_2_8: -------------------------------------------------------------------------------- 1 | 0.213046 2 | 0.441748 3 | -------------------------------------------------------------------------------- /filters_1.5x/filters_highres/Qfactor_strbin_2_8: -------------------------------------------------------------------------------- 1 | 0.001149 2 | 0.020424 3 | -------------------------------------------------------------------------------- /filters_1.5x/filters_highres/config: -------------------------------------------------------------------------------- 1 | 24 3 3 11 -------------------------------------------------------------------------------- /filters_1.5x/filters_highres/filterbin_2_8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_1.5x/filters_highres/filterbin_2_8 -------------------------------------------------------------------------------- /filters_1.5x/filters_highres/filternotes.txt: -------------------------------------------------------------------------------- 1 | Filter for 1 pass for 1.5x upscale 2 | 1. Filters trained on ~700 images of pexels with linear degradation 3 | 2. Angle=24 Strength=3 Coherence=3 setting for both filters 4 | 3. The 1st is an upscaler with some sharpness added with cheapupscaled generated with linear upscaler. 5 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_cohbin_2_10: -------------------------------------------------------------------------------- 1 | 0.124204 2 | 0.246693 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_cohbin_2_10_2: -------------------------------------------------------------------------------- 1 | 0.227554 2 | 0.473945 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_cohbin_2_8: -------------------------------------------------------------------------------- 1 | 0.124204 2 | 0.246693 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_cohbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.215022 2 | 0.446761 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_strbin_2_10: -------------------------------------------------------------------------------- 1 | 0.000212 2 | 0.002861 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_strbin_2_10_2: -------------------------------------------------------------------------------- 1 | 0.000184 2 | 0.001952 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_strbin_2_8: -------------------------------------------------------------------------------- 1 | 0.000212 2 | 0.002861 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/Qfactor_strbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.001044 2 | 0.018442 3 | -------------------------------------------------------------------------------- /filters_2x/filters_denoise/config: -------------------------------------------------------------------------------- 1 | 24 3 3 11 -------------------------------------------------------------------------------- /filters_2x/filters_denoise/filterbin_2_10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_denoise/filterbin_2_10 -------------------------------------------------------------------------------- /filters_2x/filters_denoise/filterbin_2_10_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_denoise/filterbin_2_10_2 -------------------------------------------------------------------------------- /filters_2x/filters_denoise/filterbin_2_8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_denoise/filterbin_2_8 -------------------------------------------------------------------------------- /filters_2x/filters_denoise/filterbin_2_8_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_denoise/filterbin_2_8_2 -------------------------------------------------------------------------------- /filters_2x/filters_denoise/filternotes.txt: -------------------------------------------------------------------------------- 1 | Filter for 2 pass for denoise and 2x upscale 2 | 1. Filters trained on ~700 images of pexels with linear degradation 3 | 2. Angle=24 Strength=3 Coherence=3 setting for both filters 4 | 3. The 1st is a denoiser and the 2d pass an upscaler with some sharpness added (same as filters4 1st pass) 5 | 4. Need to run this filter with passes=2 and mode=2 6 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_cohbin_2_10: -------------------------------------------------------------------------------- 1 | 0.194645 2 | 0.425714 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_cohbin_2_10_2: -------------------------------------------------------------------------------- 1 | 0.142225 2 | 0.346073 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_cohbin_2_8: -------------------------------------------------------------------------------- 1 | 0.192916 2 | 0.405942 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_cohbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.152097 2 | 0.342539 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_strbin_2_10: -------------------------------------------------------------------------------- 1 | 0.000270 2 | 0.002110 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_strbin_2_10_2: -------------------------------------------------------------------------------- 1 | 0.000569 2 | 0.003027 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_strbin_2_8: -------------------------------------------------------------------------------- 1 | 0.001269 2 | 0.022169 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/Qfactor_strbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.002912 2 | 0.059248 3 | -------------------------------------------------------------------------------- /filters_2x/filters_highres/config: -------------------------------------------------------------------------------- 1 | 24 3 3 11 -------------------------------------------------------------------------------- /filters_2x/filters_highres/filterbin_2_10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_highres/filterbin_2_10 -------------------------------------------------------------------------------- /filters_2x/filters_highres/filterbin_2_10_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_highres/filterbin_2_10_2 -------------------------------------------------------------------------------- /filters_2x/filters_highres/filterbin_2_8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_highres/filterbin_2_8 -------------------------------------------------------------------------------- /filters_2x/filters_highres/filterbin_2_8_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_highres/filterbin_2_8_2 -------------------------------------------------------------------------------- /filters_2x/filters_highres/filternotes.txt: -------------------------------------------------------------------------------- 1 | 1. Filters trained on 675 images of pexels with area & bicubic & lancoz & nearest & blur degradation. 2 | 2. Angle=24 Strength=3 Coherence=3 setting for both filters. 3 | 3. Cheapupscale: using output with bilinear upscaling for 1st pass, No cheapupscale of 2nd pass training. 4 | 4. 10bit 1pass filter uses the multi-lr: bicubic+area+nearest+lanczos as LR and higher sharpened HR as reference (s=1.5). 5 | 10bit 2pass filter uses the HR after single augment:blur as cheapupscale images and higher sharpened HR as reference (s=1.5). 6 | 8bit 1pass filter uses the multi-lr: bicubic+area+nearest+lanczos as LR and higher sharpened HR as reference (s=1.5) as reference. 7 | 8bit 2pass filter uses the output images of the filter trained using bilinear upscaling & HR as cheapupscale images and uses higher sharpened HR as reference (s=1.5). -------------------------------------------------------------------------------- /filters_2x/filters_lowres/Qfactor_cohbin_2_10: -------------------------------------------------------------------------------- 1 | 0.224847 2 | 0.471328 3 | -------------------------------------------------------------------------------- /filters_2x/filters_lowres/Qfactor_cohbin_2_8: -------------------------------------------------------------------------------- 1 | 0.220909 2 | 0.449185 3 | -------------------------------------------------------------------------------- /filters_2x/filters_lowres/Qfactor_cohbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.220909 2 | 0.449185 3 | -------------------------------------------------------------------------------- /filters_2x/filters_lowres/Qfactor_strbin_2_10: -------------------------------------------------------------------------------- 1 | 0.000022 2 | 0.000557 3 | -------------------------------------------------------------------------------- /filters_2x/filters_lowres/Qfactor_strbin_2_8: -------------------------------------------------------------------------------- 1 | 0.001579 2 | 0.018353 3 | -------------------------------------------------------------------------------- /filters_2x/filters_lowres/Qfactor_strbin_2_8_2: -------------------------------------------------------------------------------- 1 | 0.001579 2 | 0.018353 3 | -------------------------------------------------------------------------------- /filters_2x/filters_lowres/config: -------------------------------------------------------------------------------- 1 | 24 3 3 11 -------------------------------------------------------------------------------- /filters_2x/filters_lowres/filterbin_2_10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_lowres/filterbin_2_10 -------------------------------------------------------------------------------- /filters_2x/filters_lowres/filterbin_2_8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_lowres/filterbin_2_8 -------------------------------------------------------------------------------- /filters_2x/filters_lowres/filterbin_2_8_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/filters_2x/filters_lowres/filterbin_2_8_2 -------------------------------------------------------------------------------- /filters_2x/filters_lowres/filternotes.txt: -------------------------------------------------------------------------------- 1 | 1. Filters trained on 5000 images of coco_val with bicubic degradation 2 | 2. Angle=24 Strength=3 Coherence=3 setting for both filters 3 | 3. Same filters for 1st and 2nd pass 4 | -------------------------------------------------------------------------------- /license/ThreadPool_zLib_license: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Jakob Progsch, Václav Zeman 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source 20 | distribution. 21 | -------------------------------------------------------------------------------- /scripts/01_pull_resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: BSD-3-Clause 4 | # Copyright 2024-2025 Intel Corporation 5 | 6 | # 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. 7 | set -eo pipefail 8 | 9 | SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" 10 | REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../")" 11 | . "${SCRIPT_DIR}/common.sh" 12 | 13 | log_info Starting script execution "${BASH_SOURCE[0]}" 14 | raisr_folder="${raisr_folder:-raisr}" 15 | 16 | mkdir -p "${raisr_folder}" "/tmp/Video-Super-Resolution-Library" 17 | cp -r ${REPOSITORY_DIR}/* /tmp/Video-Super-Resolution-Library 18 | pushd "${raisr_folder}" 19 | 20 | package_flag=true 21 | 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' 22 | 23 | # Usage: 01_pull_resource 24 | while [ -n "$*" ]; do 25 | case "$(printf %s "$1" | tr '[:upper:]' '[:lower:]')" in 26 | no_package) package_flag=false && shift ;; 27 | *) break ;; 28 | esac 29 | done 30 | 31 | # pull raisr code 32 | # git clone https://github.com/OpenVisualCloud/Video-Super-Resolution-Library.git 33 | mv /tmp/Video-Super-Resolution-Library . 34 | if [ ! -d "Video-Super-Resolution-Library" ];then 35 | log_error "Failed to pull source code of Video-Super-Resolution-Library!" 36 | exit 1 37 | fi 38 | 39 | # pull cmake 3.14 40 | wget --tries=5 --progress=dot:giga https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz 41 | if [ ! -f "cmake-3.14.0.tar.gz" ];then 42 | log_error "Failed to download Cmake 3.14!" 43 | exit 1 44 | fi 45 | 46 | 47 | # pull ffmpeg 48 | git clone https://github.com/FFmpeg/FFmpeg ffmpeg 49 | if [ ! -d "ffmpeg" ];then 50 | log_error "Failed to pull source code of ffmpeg!" 51 | exit 1 52 | fi 53 | 54 | pushd ffmpeg 55 | git checkout -b n6.0 n6.0 56 | git am ../Video-Super-Resolution-Library/ffmpeg/0001-ffmpeg-raisr-filter.patch 57 | popd 58 | 59 | # pull nasm used for build x264 60 | wget --tries=5 --progress=dot:giga https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2 61 | if [ ! -f "nasm-2.15.05.tar.bz2" ];then 62 | log_log_error "Failed to download nasm!" 63 | exit 1 64 | fi 65 | 66 | # pull x264 67 | git clone https://github.com/mirror/x264 -b stable --depth 1 68 | if [ ! -d "x264" ];then 69 | log_error "Failed to pull source code of x264!" 70 | exit 1 71 | fi 72 | 73 | # pull x265 74 | wget --tries=5 --progress=dot:giga https://github.com/videolan/x265/archive/3.4.tar.gz 75 | if [ ! -f "3.4.tar.gz" ];then 76 | log_error "Failed to download source code of x265!" 77 | exit 1 78 | fi 79 | 80 | # pull IPP 81 | wget --tries=5 --progress=dot:giga "${ipp_offline_uri}" 82 | if [ ! -f "${ipp_offline_uri##*/}" ];then 83 | log_error "Failed to download IPP package!" 84 | exit 1 85 | fi 86 | 87 | log_info "Successfully downloaded all these resources!" 88 | 89 | if [ "$package_flag" == "true" ]; then 90 | cd .. 91 | tar -zcvf ./$raisr_folder.tar.gz ./$raisr_folder 92 | if [ ! -f "$raisr_folder.tar.gz" ];then 93 | log_error "Failed to package these resources to $raisr_folder.tar.gz!" 94 | exit 1 95 | else 96 | echo "Successfully packaged these resources to $raisr_folder.tar.gz!" 97 | rm -rf ./$raisr_folder 98 | fi 99 | fi 100 | 101 | popd 102 | log_info Finished script execution "${BASH_SOURCE[0]}" 103 | -------------------------------------------------------------------------------- /scripts/02_install_prerequisites.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: BSD-3-Clause 4 | # Copyright 2024-2025 Intel Corporation 5 | 6 | # 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 7 | # 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. 8 | 9 | # Usage: 02_install_prerequisites.sh /xxx/raisr.tar.gz 10 | 11 | set -eo pipefail 12 | 13 | SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" 14 | REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../")" 15 | . "${SCRIPT_DIR}/common.sh" 16 | 17 | log_info Starting script execution "${BASH_SOURCE[0]}" 18 | package_path=$1 19 | if [ -z "$package_path" ];then 20 | log_error "Usage:" 21 | log_error "\t02_install_prerequisites.sh /xxx/raisr.tar.gz" 22 | exit 1 23 | fi 24 | 25 | tar -zxf $package_path ./ 26 | cd raisr 27 | 28 | # install IPP 29 | chmod +x ./l_ipp_oneapi_p_2021.12.1.16_offline.sh 30 | sudo ./l_ipp_oneapi_p_2021.12.1.16_offline.sh -a -s --eula accept 31 | echo "source /opt/intel/oneapi/ipp/latest/env/vars.sh" | tee -a ~/.bash_profile 32 | 33 | # build and install CMake 3.14 34 | tar zxf ./cmake-3.14.0.tar.gz 35 | cd cmake-3.14.0 && \ 36 | ./bootstrap --prefix=/usr/local && \ 37 | make -j "$(nproc)" && \ 38 | sudo make install 39 | cd - 40 | 41 | # build and install nasm 42 | tar xjf ./nasm-2.15.05.tar.bz2 && \ 43 | cd nasm-2.15.05 && \ 44 | ./autogen.sh && \ 45 | ./configure --prefix=/usr/local --libdir=/usr/local/lib && \ 46 | make -j "$(nproc)" && \ 47 | sudo make install 48 | cd - 49 | 50 | # build and install x264 51 | cd x264 && \ 52 | ./configure --prefix=/usr/local --libdir=/usr/local/lib \ 53 | --enable-shared && \ 54 | make -j "$(nproc)" && \ 55 | sudo make install 56 | cd - 57 | 58 | # build and install x265 59 | tar xzf ./3.4.tar.gz 60 | cd x265-3.4/build/linux && \ 61 | cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DHIGH_BIT_DEPTH=ON ../../source && \ 62 | make -j "$(nproc)" && \ 63 | sudo make install 64 | cd - 65 | 66 | # remove the resources except Raisr and ffmpeg 67 | rm l_ipp_oneapi_p_2021.12.1.16_offline.sh 68 | rm 3.4.tar.gz 69 | rm cmake-3.14.0.tar.gz 70 | rm nasm-2.15.05.tar.bz2 71 | rm -rf ./x264 72 | rm -rf ./x265-3.4 73 | rm -rf ./cmake-3.14.0 74 | rm -rf ./nasm-2.15.05 75 | log_info Finished script execution "${BASH_SOURCE[0]}" 76 | -------------------------------------------------------------------------------- /scripts/03_build_raisr_ffmpeg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: BSD-3-Clause 4 | # Copyright 2024-2025 Intel Corporation 5 | 6 | # This script is used to build raisr and ffmpeg 7 | 8 | # Usage: 03_build_raisr_ffmpeg.sh /xxx/raisr/Video-Super-Resolution-Library 9 | 10 | set -eo pipefail 11 | 12 | SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" 13 | REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../")" 14 | . "${SCRIPT_DIR}/common.sh" 15 | 16 | log_info Starting script execution "${BASH_SOURCE[0]}" 17 | raisr_path=$1 18 | 19 | if [ -z "$raisr_path" ];then 20 | echo "Usage: 03_build_raisr_ffmpeg.sh /xxx/raisr/Video-Super-Resolution-Library" 21 | exit 1 22 | fi 23 | 24 | # set IPP, x264 and x265 env 25 | . /opt/intel/oneapi/ipp/latest/env/vars.sh 26 | export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" 27 | export C_INCLUDE_PATH="/opt/intel/oneapi/ipp/latest/include/ipp" 28 | 29 | # build raisr 30 | pushd "${raisr_path}" 31 | sudo -E ./build.sh 32 | popd 33 | 34 | 35 | # build ffmpeg 36 | pushd "${raisr_path}/../ffmpeg" 37 | 38 | # TO-DO: Remove patch apply from bellow lines: 39 | # Apply a temporary patch - this will be removed after version of FFmpeg gets updated 40 | patch -p1 -i "${REPOSITORY_DIR}/scripts/patch/ffmpeg/0001-avcodec-x86-mathops-clip-constants.patch" 41 | 42 | cp "${raisr_path}/ffmpeg/vf_raisr.c" libavfilter/ 43 | 44 | ./configure \ 45 | --disable-debug \ 46 | --disable-doc \ 47 | --enable-libipp \ 48 | --enable-gpl \ 49 | --enable-libx264 \ 50 | --enable-libx265 \ 51 | --extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \ 52 | --extra-cflags='-fopenmp -I/opt/intel/oneapi/ipp/latest/include/ipp' \ 53 | --extra-ldflags='-fopenmp' \ 54 | --enable-cross-compile 55 | make clean 56 | make -j"$(nproc)" 57 | sudo -E make install 58 | 59 | # copy filters to ffmpeg directory 60 | cp -r "${raisr_path}/filters"* . 61 | popd 62 | 63 | log_info "\tTo run the library you can do the following:" 64 | log_info 65 | log_info "\t\tcd raisr/ffmpeg" 66 | log_info "\t\t./ffmpeg -y -i /input_files/input.mp4 -vf raisr=threadcount=20 -pix_fmt yuv420p /output_files/out.yuv" 67 | log_info 68 | log_info And you can see more use cases in README file of Video-Super-Resolution-Library. 69 | log_info "\tNotice: If you get \"ffmpeg: error while loading shared libraries\", try first doing:" 70 | log_info "\t\texport LD_LIBRARY_PATH=\"/opt/intel/oneapi/ipp/latest/lib/intel64:/usr/local/lib:${LD_LIBRARY_PATH}\"" 71 | 72 | log_info "Finished script execution \"${BASH_SOURCE[0]}\"" 73 | -------------------------------------------------------------------------------- /scripts/patch/ffmpeg/0001-avcodec-x86-mathops-clip-constants.patch: -------------------------------------------------------------------------------- 1 | From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= 3 | Date: Sun, 16 Jul 2023 18:18:02 +0300 4 | Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift 5 | instructions within inline assembly 6 | 7 | Fixes assembling with binutil as >= 2.41 8 | 9 | Signed-off-by: James Almer 10 | --- 11 | libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++--- 12 | 1 file changed, 23 insertions(+), 3 deletions(-) 13 | 14 | diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h 15 | index 6298f5ed19..ca7e2dffc1 100644 16 | --- a/libavcodec/x86/mathops.h 17 | +++ b/libavcodec/x86/mathops.h 18 | @@ -35,12 +35,20 @@ 19 | static av_always_inline av_const int MULL(int a, int b, unsigned shift) 20 | { 21 | int rt, dummy; 22 | + if (__builtin_constant_p(shift)) 23 | __asm__ ( 24 | "imull %3 \n\t" 25 | "shrdl %4, %%edx, %%eax \n\t" 26 | :"=a"(rt), "=d"(dummy) 27 | - :"a"(a), "rm"(b), "ci"((uint8_t)shift) 28 | + :"a"(a), "rm"(b), "i"(shift & 0x1F) 29 | ); 30 | + else 31 | + __asm__ ( 32 | + "imull %3 \n\t" 33 | + "shrdl %4, %%edx, %%eax \n\t" 34 | + :"=a"(rt), "=d"(dummy) 35 | + :"a"(a), "rm"(b), "c"((uint8_t)shift) 36 | + ); 37 | return rt; 38 | } 39 | 40 | @@ -113,19 +121,31 @@ __asm__ volatile(\ 41 | // avoid +32 for shift optimization (gcc should do that ...) 42 | #define NEG_SSR32 NEG_SSR32 43 | static inline int32_t NEG_SSR32( int32_t a, int8_t s){ 44 | + if (__builtin_constant_p(s)) 45 | __asm__ ("sarl %1, %0\n\t" 46 | : "+r" (a) 47 | - : "ic" ((uint8_t)(-s)) 48 | + : "i" (-s & 0x1F) 49 | ); 50 | + else 51 | + __asm__ ("sarl %1, %0\n\t" 52 | + : "+r" (a) 53 | + : "c" ((uint8_t)(-s)) 54 | + ); 55 | return a; 56 | } 57 | 58 | #define NEG_USR32 NEG_USR32 59 | static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ 60 | + if (__builtin_constant_p(s)) 61 | __asm__ ("shrl %1, %0\n\t" 62 | : "+r" (a) 63 | - : "ic" ((uint8_t)(-s)) 64 | + : "i" (-s & 0x1F) 65 | ); 66 | + else 67 | + __asm__ ("shrl %1, %0\n\t" 68 | + : "+r" (a) 69 | + : "c" ((uint8_t)(-s)) 70 | + ); 71 | return a; 72 | } 73 | 74 | -- 75 | 2.34.1 76 | -------------------------------------------------------------------------------- /test/validation_suite/create_wrong_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: BSD-3-Clause 4 | # Copyright 2024-2025 Intel Corporation 5 | 6 | SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" 7 | REPO_DIR="$(readlink -f "${SCRIPT_DIR}/../..")" 8 | 9 | ffmpeg_path="${ffmpeg_path:-${REPO_DIR}/raisr/ffmpeg}" 10 | out_filters=(filters_badNums filters_wrongConfig filters_noPathes) 11 | bad_configs=(12_3_3_11 24_3_3 24_3_3_6 24_3_3_9) 12 | bad_nums=(bad_cohpath_nums bad_hashtable_nums bad_strpath_nums) 13 | no_pathes=(noCohPath noConfig noHashTable noStrPath) 14 | 15 | for outfilter in ${out_filters[@]}; do 16 | echo $outfilter 17 | if [ -e $outfilter ] 18 | then 19 | rm -rf $outfilter 20 | fi 21 | mkdir -p "$ffmpeg_path/$outfilter" 22 | case "$outfilter" in 23 | "filters_badNums") 24 | for bad_num in ${bad_nums[@]}; do 25 | mild_path=filters1_$bad_num 26 | cp -r ${REPO_DIR}/filters_2x/filters_highres "$ffmpeg_path/$outfilter/$mild_path" 27 | cd "$ffmpeg_path/$outfilter/$mild_path" 28 | case "$mild_path" in 29 | "filters1_bad_cohpath_nums") 30 | mv Qfactor_cohbin_2_8 Qfactor_cohbin_6_8 31 | mv Qfactor_cohbin_2_8_2 Qfactor_cohbin_6_8_2 32 | mv Qfactor_cohbin_2_10 Qfactor_cohbin_6_10 33 | ;; 34 | "filters1_bad_hashtable_nums") 35 | mv filterbin_2_8 filterbin_6_8 36 | mv filterbin_2_8_2 filterbin_6_8_2 37 | mv filterbin_2_10 filterbin_6_10 38 | ;; 39 | "filters1_bad_strpath_nums") 40 | mv Qfactor_strbin_2_8 Qfactor_strbin_6_8 41 | mv Qfactor_strbin_2_8_2 Qfactor_strbin_6_8_2 42 | mv Qfactor_strbin_2_10 Qfactor_strbin_6_10 43 | ;; 44 | esac 45 | cd "$OLDPWD" 46 | done 47 | ;; 48 | "filters_wrongConfig") 49 | for bad_conf in ${bad_configs[@]}; do 50 | mild_path=filters1_$bad_conf 51 | cp -r ${REPO_DIR}/filters_2x/filters_highres "$ffmpeg_path/$outfilter/$mild_path" 52 | cd "$ffmpeg_path/$outfilter/$mild_path" 53 | confignum=${bad_conf//_/ } 54 | sed -i "1c$confignum" config 55 | cd "$OLDPWD" 56 | done 57 | ;; 58 | "filters_noPathes") 59 | for bad_path in ${no_pathes[@]}; do 60 | mild_path=filters1_$bad_path 61 | cp -r ${REPO_DIR}/filters_2x/filters_highres "$ffmpeg_path/$outfilter/$mild_path" 62 | cd "$ffmpeg_path/$outfilter/$mild_path" 63 | echo $mild_path 64 | type_Coh=$(echo $mild_path | grep "Coh") 65 | type_Conf=$(echo $mild_path | grep "Conf") 66 | type_Hash=$(echo $mild_path | grep "Hash") 67 | type_Str=$(echo $mild_path | grep "Str") 68 | if [[ "$type_Coh" != "" ]] 69 | then 70 | rm -rf Qfactor_cohbin_* 71 | elif [[ "$type_Conf" != "" ]] 72 | then 73 | rm -rf config 74 | elif [[ "$type_Hash" != "" ]] 75 | then 76 | rm -rf filterbin* 77 | else 78 | rm -rf Qfactor_strbin_* 79 | fi 80 | cd "$OLDPWD" 81 | done 82 | ;; 83 | esac 84 | done 85 | -------------------------------------------------------------------------------- /test/validation_suite/run_tests_avxout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: BSD-3-Clause 4 | # Copyright 2024-2025 Intel Corporation 5 | 6 | set -x 7 | 8 | SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")" 9 | REPO_DIR="$(readlink -f "${SCRIPT_DIR}/../..")" 10 | LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}" 11 | 12 | ffmpeg_path="${ffmpeg_path:-${REPO_DIR}/raisr/ffmpeg}" 13 | test_video_path="${test_video_path:-${ffmpeg_path}/test_videos}" 14 | 15 | avx_array=("avx2") 16 | if lscpu | grep "avx512f " | grep "avx512vl "; 17 | then avx_array+=("avx512"); 18 | else echo "No avx512 found"; 19 | fi 20 | if lscpu | grep "avx512_fp16 "; 21 | then avx_array+=("avx512fp16"); 22 | else echo "No avx512fp16 found"; 23 | fi 24 | 25 | thread_array=(1 10 20 30 40 50 60 90 120 88) 26 | pass_array=(1 2) 27 | blending_array=(1 2) 28 | mode_array=(1 2) 29 | fixed_thread=120 30 | 31 | #bad inputs 32 | wrong_bit=9 33 | wrong_blending=0 34 | wrong_ratio=0 35 | wrong_mode=-1 36 | wrong_thread=121 37 | wrong_pass=3 38 | negtive_pass=-1 39 | negtive_thread=-1 40 | bad_configs=(12_3_3_11 24_3_3 24_3_3_6 24_3_3_9) 41 | bad_nums=(bad_cohpath_nums bad_hashtable_nums bad_strpath_nums) 42 | no_pathes=(noCohPath noConfig noHashTable noStrPath) 43 | #log path 44 | common_log_path="${ffmpeg_path}/test_logs" 45 | wrong_input_log_path="${ffmpeg_path}/test_bad_input_logs" 46 | opath="${ffmpeg_path}/outputs/" 47 | mkdir -p "${common_log_path}" "${wrong_input_log_path}" "${opath}" 48 | 49 | cd $ffmpeg_path 50 | for filename in $test_video_path/*; do 51 | fname=$(basename $filename) 52 | ext="${fname##*.}" 53 | fname1="${fname%.*}" 54 | ofname="$fname1"_out."$ext" 55 | for avx in ${avx_array[@]}; do 56 | #test diff thread &diff avx 57 | for thread in ${thread_array[@]};do 58 | printf -v digi '%02d' ${thread##+(0)} 59 | ofname="$fname1"_out_th"$digi"_"$avx".mp4 60 | ./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 61 | done 62 | 63 | #test diff pass &diff avx, thread is fixed to 120 64 | for pass in ${pass_array[@]};do 65 | printf -v digip '%02d' ${pass##+(0)} 66 | ofname="$fname1"_out_pass"$digip"_"$avx".mp4 67 | ./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 68 | done 69 | 70 | #test diff blending &diff avx, thread is fixed to 120 71 | for blending in ${blending_array[@]};do 72 | printf -v digib '%02d' ${blending##+(0)} 73 | ofname="$fname1"_out_bld"$digib"_"$avx".mp4 74 | ./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 75 | done 76 | 77 | #test diff mode &diff avx, thread is fixed to 120 78 | for mode in ${mode_array[@]};do 79 | printf -v digim '%02d' ${mode##+(0)} 80 | ofname="$fname1"_out_mode"$digim"_"$avx".mp4 81 | ./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 82 | done 83 | 84 | #test diff filter_1 &diff avx, thread is fixed to 120 85 | for f in filters_1*/*;do 86 | digif="${f/"/"/"_"}" 87 | ofname="$fname1"_out_ft"$digif"_"$avx".mp4 88 | ./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 89 | done 90 | 91 | #test diff filter_2 &diff avx, thread is fixed to 120 92 | for f in filters_2*/*;do 93 | digif="${f/"/"/"_"}" 94 | ofname="$fname1"_out_ft"$digif"_"$avx".mp4 95 | ./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 96 | done 97 | 98 | #test diff bit &diff avx, thread is fixed to 120 99 | result=$(echo $fname1 | grep "10bit") 100 | if [[ "$result" != "" ]] 101 | then 102 | ofname="$fname1"_out_bit"10"_"$avx".mp4 103 | ./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 104 | else 105 | ofname="$fname1"_out_bit"08"_"$avx".mp4 106 | ./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 107 | fi 108 | 109 | #test wrong inputs 110 | #bad bits: 111 | printf -v digi '%02d' ${wrong_bit##+(0)} 112 | ofname="$fname1"_out_wbit"$digi"_"$avx".mp4 113 | ./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 114 | #bad blending: 115 | printf -v digi '%02d' ${wrong_blending##+(0)} 116 | ofname="$fname1"_out_wbld"$digi"_"$avx".mp4 117 | ./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 118 | #bad raito 119 | printf -v digi '%02d' ${wrong_raito##+(0)} 120 | ofname="$fname1"_out_wrat"$digi"_"$avx".mp4 121 | ./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 122 | #bad mode 123 | printf -v digi '%02d' ${wrong_mode##+(0)} 124 | ofname="$fname1"_out_wmod"$digi"_"$avx".mp4 125 | ./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 126 | #bad thread count 127 | printf -v digi '%02d' ${wrong_thread##+(0)} 128 | ofname="$fname1"_out_wth"$digi"_"$avx".mp4 129 | ./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 130 | #bad pass 131 | printf -v digi '%02d' ${wrong_pass##+(0)} 132 | ofname="$fname1"_out_wps"$digi"_"$avx".mp4 133 | ./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 134 | #not matching pass&mode#[RAISR WARNING] 1 pass with upscale in 2d pass, mode = 2 ignored ! 135 | ofname="$fname1"_no_match_pm_"$avx".mp4 136 | ./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 137 | #negtive pass 138 | printf -v digi '%02d' ${negtive_pass##+(0)} 139 | ofname="$fname1"_out_nps"$digi"_"$avx".mp4 140 | ./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 141 | #negtive thread 142 | printf -v digi '%02d' ${negtive_thread##+(0)} 143 | ofname="$fname1"_out_nth"$digi"_"$avx".mp4 144 | ./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 145 | #directory_input 146 | ofname="$fname1"_directory_input_"$avx".mp4 147 | ./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 148 | #no_input #Did you mean file:-profile:v? 149 | ofname="$fname1"_no_input_"$avx".mp4 150 | ./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 151 | #bad config 12 3 3 11|24 3 3|24 3 3 6|24 3 3 9 152 | for config in ${bad_configs[@]}; do 153 | ofname="$fname1"_config_"$config"_"$avx".mp4 154 | ./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 155 | done 156 | #bad nums 157 | for badpath in ${bad_nums[@]}; do 158 | ofname="$fname1"_"$badpath"_"$avx".mp4 159 | ./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 160 | done 161 | #no pathes 162 | for confpath in ${no_pathes[@]}; do 163 | ofname="$fname1"_"$confpath"_"$avx".mp4 164 | ./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 165 | done 166 | done 167 | done 168 | 169 | echo "========== Start of summary" 170 | echo "Finished tests:" 171 | echo "Test logs: ${ffmpeg_path}/test_logs" 172 | echo "Test bad input logs: ${ffmpeg_path}/test_bad_input_logs" 173 | echo "Test outputs: ${ffmpeg_path}/outputs/" 174 | echo "Results:" 175 | echo "Should find 0 match per file:" 176 | grep -c failed ${ffmpeg_path}/test_logs/* 177 | echo "Should find 1 match per file:" 178 | grep -Ec "failed|not found|RAISR WARNING|Is a directory" ${ffmpeg_path}/test_bad_input_logs/* 179 | echo "========== End of summary" 180 | -------------------------------------------------------------------------------- /versions.env: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/Video-Super-Resolution-Library/7b01ba5552a8e9b1f2af54ec9aebd2f22bea23e1/versions.env --------------------------------------------------------------------------------