Skip to content

Commit ad12ef5

Browse files
committed
Initial commit
0 parents  commit ad12ef5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+138965
-0
lines changed

.gitignore

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
*.jpg
2+
*.JPG
3+
*.BMP
4+
*.PNG
5+
*.o
6+
*.bin
7+
*.log
8+
Debug
9+
Release
10+
x64
11+
12+
# Visual Studio user-specific files
13+
*.rsuser
14+
*.suo
15+
*.user
16+
*.userosscache
17+
*.sln.docstates
18+
.vscode
19+
20+
# Visual C++ cache files
21+
*.aps
22+
*.ncb
23+
*.opendb
24+
*.opensdf
25+
*.sdf
26+
*.cachefile
27+
*.VC.db
28+
*.VC.VC.opendb
29+
30+
# Visual Studio cache/options directory
31+
*.vs
32+
33+
# Visual Studio project files
34+
#*.filters
35+
#*.vcxproj
36+
#*.sln
37+
38+
#cmake
39+
CMakeLists.txt.user
40+
CMakeCache.txt
41+
CMakeFiles
42+
CMakeScripts
43+
Testing
44+
Makefile
45+
cmake_install.cmake
46+
install_manifest.txt
47+
compile_commands.json
48+
CTestTestfile.cmake
49+
50+
RaisrTestApp.dir
51+
test_images*
52+
result_images
53+
build
54+
*.diff
55+
*.perf
56+
*.data
57+
*.old
58+
*.*proj
59+
*.*advi*
60+
config/

CMakeLists.txt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 "22")
18+
set(RAISR_VERSION_MINOR "9")
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+
foreach(cflag ${flags_to_test})
34+
string(REGEX REPLACE "[^A-Za-z0-9]" "_" cflag_var "${cflag}")
35+
set(test_cxx_flag "CXX_FLAG${cflag_var}")
36+
check_cxx_compiler_flag(${cflag} "${test_cxx_flag}")
37+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cflag}")
38+
endforeach()
39+
40+
endif(UNIX)
41+
42+
43+
# Intel Library for Video Super Resolution
44+
add_subdirectory(Library)
45+
46+
# Raisr Sample app
47+
include_directories(${PROJECT_SOURCE_DIR}/Library/)
48+
49+
# Requires OpenCV
50+
find_package(OpenCV 4.0.0 REQUIRED)
51+
# Show a message with the opencv version detected
52+
message("OpenCV version : ${OpenCV_VERSION}")
53+
# Add the paths to the include directories/to the header files
54+
include_directories(${OpenCV_INCLUDE_DIRS})
55+
56+
# Requires Pythons Libs
57+
find_package(PythonLibs REQUIRED)
58+
# Set Numpy dependency
59+
set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} /usr/local/lib/python2.7/dist-packages/numpy/core/include)
60+
include_directories(${PYTHON_INCLUDE_DIRS})
61+
62+
# NOTE: enable below line to build python library
63+
#target_link_libraries(py_raisr ${PYTHON_LIBRARIES} ${OpenCV_LIBS} raisr)
64+

Dockerfile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# INTEL CONFIDENTIAL
2+
#
3+
# Copyright (C) 2022 Intel Corporation
4+
#
5+
# This software and the related documents are Intel copyrighted materials, and your use of them is governed by the express license under which they were provided to you ("License").
6+
# Unless the License provides otherwise, you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related documents without Intel's prior written
7+
# permission.
8+
#
9+
# This software and the related documents are provided as is, with no express or implied warranties, other than those that are expressly stated in the License.
10+
11+
# use Ubuntu 18.04 with Intel IPP
12+
FROM intel/oneapi-basekit:devel-ubuntu18.04
13+
14+
#
15+
# Use bash shell
16+
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
17+
#
18+
# Update apt and install dependances
19+
RUN apt-get update && apt-get install -y \
20+
build-essential \
21+
git \
22+
libx265-dev \
23+
libx264-dev \
24+
nasm \
25+
software-properties-common \
26+
zlib1g-dev
27+
#
28+
# Install and configure gcc 9
29+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
30+
RUN apt-get -y install gcc-9 g++-9
31+
RUN update-alternatives \
32+
--install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \
33+
--slave /usr/bin/g++ g++ /usr/bin/g++-9 \
34+
--slave /usr/bin/gcov gcov /usr/bin/gcov-9
35+
#
36+
# Setup raisrfolder as the working folder
37+
WORKDIR /raisrfolder
38+
#
39+
# Copy raisr library and include files to usr/local
40+
COPY ./libraisr.a /usr/local/lib/
41+
COPY Library/*.h /usr/local/include/raisr/
42+
#
43+
# Clone ffmpeg and checkout branch n4.4
44+
RUN git clone https://github.com/FFmpeg/FFmpeg ffmpeg
45+
WORKDIR /raisrfolder/ffmpeg
46+
RUN git checkout -b mybranch n4.4
47+
#
48+
# Apply the raisr filter patch
49+
COPY ./ffmpeg/*.patch .
50+
COPY ./ffmpeg/vf_raisr.c libavfilter/
51+
RUN git config --global user.email "[email protected]"
52+
RUN git apply 0001-ffmpeg-raisr-filter.patch
53+
#
54+
# Source the IPP library
55+
#
56+
ENV CPATH "/opt/intel/oneapi/ipp/latest/include"
57+
ENV IPPROOT "/opt/intel/oneapi/ipp/latest"
58+
ENV IPP_TARGET_ARCH "intel64"
59+
ENV LD_LIBRARY_PATH "/opt/intel/oneapi/ipp/latest/lib/intel64"
60+
ENV LIBRARY_PATH "/opt/intel/oneapi/ipp/latest/lib/intel64"
61+
62+
# Configure and build ffmpeg
63+
RUN ./configure \
64+
--enable-libipp \
65+
--enable-zlib \
66+
--extra-cflags="-fopenmp" \
67+
--extra-ldflags=-fopenmp \
68+
--enable-gpl \
69+
--enable-libx264 \
70+
--enable-libx265 \
71+
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi' \
72+
--enable-cross-compile
73+
RUN make clean
74+
RUN make -j $(nproc)
75+
#
76+
# Copy the raisr filters from the raisr library
77+
COPY ./filters1/* ./filters1/
78+
COPY ./filters2/* ./filters2/
79+
COPY ./filters3/* ./filters3/
80+
COPY ./filters4/* ./filters4/
81+
COPY ./filters5/* ./filters5/
82+
#
83+
# Run ffmpeg and verify that the raisr filter is supported
84+
RUN ./ffmpeg -h filter=raisr

Library/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
set(SOURCES Raisr.cpp RaisrHandler.cpp)
2+
set(HEADERS Raisr.h ThreadPool.h RaisrHandler.h RaisrDefaults.h)
3+
4+
add_library(raisr STATIC ${SOURCES} ${HEADERS})
5+
6+
# Link our library
7+
# for IPP
8+
if( UNIX )
9+
include_directories($ENV{IPPROOT}/include)
10+
find_library(IPP_CORE libippcore.a PATHS $ENV{IPPROOT}/lib/intel64)
11+
find_library(IPP_VM libippvm.a PATHS $ENV{IPPROOT}/lib/intel64)
12+
find_library(IPP_S libipps.a PATHS $ENV{IPPROOT}/lib/intel64)
13+
find_library(IPP_I libippi.a PATHS $ENV{IPPROOT}/lib/intel64)
14+
find_package(Threads REQUIRED)
15+
else()
16+
include_directories("C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/include")
17+
find_library(IPP_CORE ippcore.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64")
18+
find_library(IPP_VM ippvm.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64")
19+
find_library(IPP_S ipps.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64")
20+
find_library(IPP_I ippi.lib PATHS "C:/Program Files (x86)/Intel/oneAPI/ipp/2021.2.0/lib/intel64")
21+
endif(UNIX)
22+
target_link_libraries(raisr ${IPP_I} ${IPP_VM} ${IPP_S} ${IPP_CORE} ${CMAKE_THREAD_LIBS_INIT})
23+
include(GNUInstallDirs)
24+
install(DIRECTORY "." DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/raisr" FILES_MATCHING PATTERN "*.h")
25+
install(TARGETS "raisr" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
26+

0 commit comments

Comments
 (0)