forked from OpenVisualCloud/Video-Super-Resolution-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_pull_resources.sh
More file actions
executable file
·102 lines (83 loc) · 3.15 KB
/
Copy path01_pull_resources.sh
File metadata and controls
executable file
·102 lines (83 loc) · 3.15 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2024-2025 Intel Corporation
# This script is used to pull all resources(Cmake 3.14, nasm, x264, x265, IPP, Raisr and ffmpeg) used for build RAISR and ffmpeg. And by default, the script will generate a tarball raisr.tar.gz of these resources and you can use "no_package" option to disable generate the tarball.
set -eo pipefail
SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")"
REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../")"
. "${SCRIPT_DIR}/common.sh"
log_info Starting script execution "${BASH_SOURCE[0]}"
raisr_folder="${raisr_folder:-raisr}"
mkdir -p "${raisr_folder}" "/tmp/Video-Super-Resolution-Library"
cp -r ${REPOSITORY_DIR}/* /tmp/Video-Super-Resolution-Library
pushd "${raisr_folder}"
package_flag=true
ipp_offline_uri='https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7e07b203-af56-4b52-b69d-97680826a8df/l_ipp_oneapi_p_2021.12.1.16_offline.sh'
# Usage: 01_pull_resource <no_package>
while [ -n "$*" ]; do
case "$(printf %s "$1" | tr '[:upper:]' '[:lower:]')" in
no_package) package_flag=false && shift ;;
*) break ;;
esac
done
# pull raisr code
# git clone https://github.com/OpenVisualCloud/Video-Super-Resolution-Library.git
mv /tmp/Video-Super-Resolution-Library .
if [ ! -d "Video-Super-Resolution-Library" ];then
log_error "Failed to pull source code of Video-Super-Resolution-Library!"
exit 1
fi
# pull cmake 3.14
wget --tries=5 --progress=dot:giga https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz
if [ ! -f "cmake-3.14.0.tar.gz" ];then
log_error "Failed to download Cmake 3.14!"
exit 1
fi
# pull ffmpeg
git clone https://github.com/FFmpeg/FFmpeg ffmpeg
if [ ! -d "ffmpeg" ];then
log_error "Failed to pull source code of ffmpeg!"
exit 1
fi
pushd ffmpeg
git checkout -b n7.1 n7.1
git am ../Video-Super-Resolution-Library/ffmpeg/0001-Upgrade-Raisr-ffmpeg-plugin-to-n7.1-from-n6.1.1.patch
popd
# pull nasm used for build x264
wget --tries=5 --progress=dot:giga https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2
if [ ! -f "nasm-2.15.05.tar.bz2" ];then
log_log_error "Failed to download nasm!"
exit 1
fi
# pull x264
git clone https://github.com/mirror/x264 -b stable --depth 1
if [ ! -d "x264" ];then
log_error "Failed to pull source code of x264!"
exit 1
fi
# pull x265
wget --tries=5 --progress=dot:giga https://github.com/videolan/x265/archive/3.4.tar.gz
if [ ! -f "3.4.tar.gz" ];then
log_error "Failed to download source code of x265!"
exit 1
fi
# pull IPP
wget --tries=5 --progress=dot:giga "${ipp_offline_uri}"
if [ ! -f "${ipp_offline_uri##*/}" ];then
log_error "Failed to download IPP package!"
exit 1
fi
log_info "Successfully downloaded all these resources!"
if [ "$package_flag" == "true" ]; then
cd ..
tar -zcvf ./$raisr_folder.tar.gz ./$raisr_folder
if [ ! -f "$raisr_folder.tar.gz" ];then
log_error "Failed to package these resources to $raisr_folder.tar.gz!"
exit 1
else
echo "Successfully packaged these resources to $raisr_folder.tar.gz!"
rm -rf ./$raisr_folder
fi
fi
popd
log_info Finished script execution "${BASH_SOURCE[0]}"