Skip to content

Commit 5be0592

Browse files
Mionszxiaoxial
andauthored
Fetch RAISR internal work with upstream main. (#19)
* Fetch RAISR internal work with upstream main. Fetch RAISR internal work with upstream main. Added RockyLinux:9 and RockyLinux:9-mini Added RockyLinux:9: - based on IntelOneApi Dockerfile - big image is downloaded and about 16Gb of space required - runtime image based on RockyLinux9 Added RockyLinux:9-mini: - based on Rocky Linux version 9 Dockerfile - small image used in both stages - takes more time to build and uses yum repositories Added Ubuntu20.04: - based on Ubuntu22.04 Dockerfile - usees IntelOneApi Dockerfile as a based Minor to medium changes made to the repository code and other Dockerfiles. Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> * Make output resolution to even (#137) * Modify output resolution to even due to encoder only support even resolution. And fixed core dump issue when running on some input odd resolutions. Signed-off-by: Xiaoxia Liang <xiaoxia.liang@intel.com> * Add evenoutput option to make output to even or not in ffmpeg plugin. Signed-off-by: Xiaoxia Liang <xiaoxia.liang@intel.com> --------- Signed-off-by: Xiaoxia Liang <xiaoxia.liang@intel.com> * Minor Fixes added to all dockerfiles Fetch RAISR internal work with upstream main. Quote fix * Minor changes Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> --------- Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> Signed-off-by: Xiaoxia Liang <xiaoxia.liang@intel.com> Co-authored-by: Xiaoxia Liang <xiaoxia.liang@intel.com>
1 parent 0c8128d commit 5be0592

30 files changed

+2091
-476
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.md
2+
./Jenkinsfile*
3+
./license*
4+
./test*
5+
*Dockerfile*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ build
5757
*.*proj
5858
*.*advi*
5959
config/
60+
raisr/

.shellcheckrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
external-sources=true

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ SET(CMAKE_REQUIRED_FLAGS "-march=native")
4545
check_cxx_source_runs("
4646
#include <immintrin.h>
4747
int main(int argc, char** argv) {
48-
_Float16 data[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
49-
_Float16 output[16];
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];
5050
__m512h a = _mm512_loadu_ph(data); // avx512fp16
5151
__m512h b = _mm512_loadu_ph(data);
5252
__mmask32 mask = _mm512_cmp_ph_mask(a, b, _CMP_EQ_OQ); // avx512fp16

How to build.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ To build this project you will need:
33
- Linux based OS
44
- For CPU tested and validated on Ubuntu 18.04 LTS, Ubuntu 22.04 and CentOS 7.9
55
- 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/)
6+
- [Docker](https://www.docker.com/)
77
- Intel Xeon hardware which supports Intel AVX512 (Skylake generation or later)
88
- Compiler (clang++, g++, icc), and enabling AVX512-FP16 on Sapphire Rapiads needs:
99
- clang++ version 14.0.0 or later
1010
- g++ version 12.1.0 with binutils 2.38 or later
1111
- icc version 2021.2 or later
12-
- Cmake version 3.14 or later
12+
- Cmake version 3.14 or later
1313
- Intel® Integrated Performance Primitives (Intel® IPP) (Stand-Alone Version is the minimum requirement)
1414
- zlib1g-dev, pkg-config (The pkg-config is used to find x264.pc/x265.pc in specific pkgconfig path.)
1515

1616
We provide 3 ways to build the Intel VSR with FFmpeg environment:
17-
- build docker images with dockerfiles(only for CPU).
18-
- build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/master/scripts)(only for CPU).
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).
1919
- build manually(both CPU and GPU).
2020

2121
# Build Docker Images.
2222

23-
We provide 3 Dockerfile for Intel Xeon platforms: Ubuntu18.04, Ubuntu22.04 and CentOS7.9. You can refer to below steps to build docker images.
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.
2424
## Setup docker proxy as follows if you are behind a firewall:
2525
```
2626
sudo mkdir -p /etc/systemd/system/docker.service.d
@@ -32,23 +32,25 @@ sudo systemctl restart docker
3232
## build docker image via docker_build.sh
3333
The usage of the script is as follows
3434
```
35-
./docker_build.sh <OS> <OS_VERSION>
35+
./docker_build.sh <PLATFORM> <OS> <OS_VERSION>
3636
37-
./docker_build.sh ubuntu 22.04 #for building Ubuntu22.04
38-
./docker_build.sh ubuntu 18.04 #for building Ubuntu18.04
39-
./docker_build.sh centos 7.9 #for building CentOS7.9
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
4041
```
41-
If the image is built successfully, you can find a docker image named `raisr:ubuntu22.04` or `raisr:ubuntu18.04` or `raisr:centos7.9` with command `docker images`
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.
4244

43-
# Build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/master/scripts)
45+
# Build via [scripts](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/tree/main/scripts)
4446
If the user would prefer not to use Docker, you can follow the steps below to setup enviroment: \
4547
`cd Video-Super-Resolution-Library/scripts` \
4648
`./01_pull_resources.sh` \
4749
`./02_install_prerequisites.sh /xxx/raisr.tar.gz` \
4850
`./03_build_raisr_ffmpeg.sh /xxx/raisr/Video-Super-Resolution-Library`
49-
- [01_pull_resources.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/master/scripts/01_pull_resources.sh): Download the resources used for build Intel Library for VSR and FFmpeg(cmake 3.14, nasm, x264, x265, ipp, Intel Library for VSR and FFmpeg) and package these resource to raisr.tar.gz.
50-
- [02_install_prerequisites.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/master/scripts/02_install_prerequisites.sh): Extract the tarball raisr.tar.gz of resources and build and install the libraries required by building Intel Library for VSR and FFmpeg.
51-
- [03_build_raisr_ffmpeg.sh](https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/master/scripts/03_build_raisr_ffmpeg.sh): Build Intel Library for VSR and FFmpeg.
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.
5254

5355
# Build manually following the steps below
5456
## Install Intel IPP
@@ -66,7 +68,7 @@ The x264/x265 libraries can be installed via apt on Ubuntu OS or built and insta
6668

6769
### Build and install x264/x265 from source code(Option-2)
6870

69-
#### Build and install x264
71+
#### Build and install x264
7072

7173
`git clone https://github.com/mirror/x264 -b stable --depth 1` \
7274
`cd x264` \

Library/Raisr.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static bool machine_supports_feature(MachineVendorType vendor, ASMType type)
7373
bool ret = false;
7474
unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
7575

76-
if (vendor == INTEL ) {
76+
if (vendor == INTEL || vendor == AMD ) {
7777
__get_cpuid_count(0x7, 0x0, &eax, &ebx, &ecx, &edx);
7878

7979
if (type == AVX512_FP16) {
@@ -98,20 +98,6 @@ static bool machine_supports_feature(MachineVendorType vendor, ASMType type)
9898
}
9999
}
100100
}
101-
else if (vendor == AMD)
102-
{
103-
__get_cpuid_count(0x7, 0x0, &eax, &ebx, &ecx, &edx);
104-
if (type == AVX512_FP16) {
105-
ret = false;
106-
} else if (type == AVX512) {
107-
ret = false;
108-
} else if (type == AVX2) {
109-
if ( (ebx >> 5) & 0x1)
110-
{
111-
ret = true;
112-
}
113-
}
114-
}
115101
return ret;
116102
}
117103

@@ -898,7 +884,7 @@ __m256i inline modulo_imm( __m256i a, int b) {
898884
void inline write_pixeltype(int c, __m256i gPatchMargin_epi32, __m256i partone, int* out) {
899885
__m256i b = _mm256_sub_epi32( _mm256_add_epi32(_mm256_set1_epi32(c), _mm256_setr_epi32(0,1,2,3,4,5,6,7)), gPatchMargin_epi32);
900886
__m256i pixelType_epi32 = _mm256_add_epi32( partone, modulo_imm(b, gRatio) );
901-
_mm256_storeu_epi32(out, pixelType_epi32);
887+
_mm256_storeu_si256((__m256i *)(out), pixelType_epi32);
902888
}
903889

904890
RNLERRORTYPE processSegment(VideoDataType *srcY, VideoDataType *final_outY, BlendingMode blendingMode, int threadIdx)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Enhanced RAISR is provided as an FFmpeg plugin inside of a Docker container(Dock
1414

1515
- 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
1616

17+
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.
1718

1819
## How to build
1920
Please see "How to build.md" to build via scripts or manually.

build.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
#!/bin/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 -ex -o pipefail
8+
9+
SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")"
10+
. "${SCRIPT_DIR}/scripts/common.sh"
11+
nproc="${nproc:-$(nproc)}"
12+
213
# Helpful when copying and pasting functions and debuging.
314
if printf '%s' "$0" | grep -q '\.sh'; then
415
IN_SCRIPT=true
516
fi
617

7-
# Fails the script if any of the commands error (Other than if and some others)
8-
set -e
18+
919

1020
cd_safe() {
1121
if (cd "$1"); then
@@ -20,7 +30,7 @@ cd_safe() {
2030
# Usage: build [test]
2131
build() (
2232
build_type=Release
23-
echo "Create folder: build, build type: $build_type"
33+
log_info "Create folder: build, build type: $build_type"
2434
mkdir -p build > /dev/null 2>&1
2535
cd_safe build
2636

@@ -32,8 +42,8 @@ build() (
3242
#cmake .. -DCMAKE_BUILD_TYPE="RelWithDebInfo" $CMAKE_EXTRA_FLAGS "$@"
3343

3444
if [ -f Makefile ]; then
35-
# make -j
36-
make install -j
45+
make -j "${nproc}"
46+
make install -j "${nproc}"
3747
fi
3848

3949
cd ..
@@ -74,4 +84,4 @@ else
7484
fi
7585
export CXX
7686

77-
build $@
87+
build "$@"

docker/Dockerfile.centos7.9

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)