Skip to content

Commit

Permalink
Huge code reorganization. Does not compile yet. This commit is made t…
Browse files Browse the repository at this point in the history
…o save these changes before moving submodules from src/ext to ext
  • Loading branch information
malbou committed Oct 31, 2017
1 parent ff9df29 commit 10ea5eb
Show file tree
Hide file tree
Showing 44 changed files with 249 additions and 178 deletions.
7 changes: 2 additions & 5 deletions .gitignore
@@ -1,7 +1,4 @@
build*
CMakeLists.txt.user*
*build*
*.tmp
*~
!.gitignore
!src
!bin
!data
20 changes: 10 additions & 10 deletions .gitmodules
@@ -1,15 +1,15 @@
[submodule "src/ext/nanogui"]
path = src/ext/nanogui
[submodule "ext/nanogui"]
path = ext/nanogui
url = https://github.com/wjakob/nanogui
[submodule "src/ext/eigen"]
path = src/ext/eigen
[submodule "ext/eigen"]
path = ext/eigen
url = https://github.com/libigl/eigen.git
[submodule "src/ext/openexr"]
path = src/ext/openexr
[submodule "ext/openexr"]
path = ext/openexr
url = https://github.com/openexr/openexr
[submodule "src/ext/json"]
path = src/ext/json
[submodule "ext/json"]
path = ext/json
url = https://github.com/nlohmann/json
[submodule "src/ext/zlib"]
path = src/ext/zlib
[submodule "ext/zlib"]
path = ext/zlib
url = https://github.com/madler/zlib.git
File renamed without changes.
122 changes: 122 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,122 @@
# This file is part of the reference implementation for the paper
# Bayesian Collaborative Denoising for Monte-Carlo Rendering
# Malik Boughida and Tamy Boubekeur.
# Computer Graphics Forum (Proc. EGSR 2017), vol. 36, no. 4, p. 137-153, 2017
#
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.txt file.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)

PROJECT(BayesianCollaborativeDenoising)

OPTION(BCD_BUILD_GUI "Build a GUI executable for bcd, using library NanoGUI" ON)
OPTION(BCD_USE_CUDA "Use CUDA for accelerating computations" ON)

# Add CMake folder to the module path : contains CMake specific files *.cmake
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH} )

# Set the default build to Release. Note this doesn't do anything for the VS
# default build target which defaults to Debug when you first start it.
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)







# OpenMP
FIND_PACKAGE(OpenMP)

IF(${CMAKE_VERSION} VERSION_GREATER 3.8)

# not tested yet
MESSAGE(AUTHOR_WARNING "Using OpenMP detection from cmake 3.9.0+: not tested yet")
IF(OPENMP_CXX_FOUND)
ADD_LIBRARY(OpenMP ALIAS OpenMP::OpenMP_CXX)
ELSE()
MESSAGE(WARNING "Could not find OpenMP library")
ENDIF()

ELSE()

IF(OPENMP_FOUND)
ADD_LIBRARY(OpenMP INTERFACE)
TARGET_COMPILE_OPTIONS(OpenMP INTERFACE ${OpenMP_CXX_FLAGS})
TARGET_LINK_LIBRARIES(OpenMP INTERFACE
$<$<CXX_COMPILER_ID:GNU>:${OpenMP_CXX_FLAGS}>
$<$<CXX_COMPILER_ID:Clang>:${OpenMP_CXX_FLAGS}>
$<$<CXX_COMPILER_ID:Intel>:${OpenMP_CXX_FLAGS}>
)
ELSE()
MESSAGE(WARNING "Could not find OpenMP library")
ENDIF()

ENDIF()







IF(BCD_USE_CUDA)

SET(CUDA_PROPAGATE_HOST_FLAGS OFF)
FIND_PACKAGE(CUDA)

IF(NOT CUDA_FOUND)
MESSAGE(WARNING "Could not find CUDA")
ELSE(NOT CUDA_FOUND)

SET(CUDA_LIBRARIES PUBLIC ${CUDA_LIBRARIES}) # hack to avoid cmake warnings related to policy CMP0023 (see https://gitlab.kitware.com/cmake/cmake/issues/16602 )

SET(config_types DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)

# We have to manually propagate all host flags but C++11...
FOREACH(config ${config_types})
SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}} -Xcompiler ")
# SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}} -g -lineinfo -Xcompiler ") #use this line instead of the previous one for debugging and line info (for nvprof for example)
IF(OPENMP_FOUND)
SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}},\"${OpenMP_CXX_FLAGS}\"")
ENDIF(OPENMP_FOUND)
STRING(REPLACE " " ";" FLAGS_LIST ${CMAKE_CXX_FLAGS_${config}})
FOREACH(flag ${FLAGS_LIST})
SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}},\"${flag}\"")
ENDFOREACH()
ENDFOREACH()
ENDIF(NOT CUDA_FOUND)

# Verbose option: put ON to see the whole build command lines
IF(CUDA_FOUND)
SET(CUDA_VERBOSE_BUILD ON)
ENDIF(CUDA_FOUND)

ENDIF(BCD_USE_CUDA)






# Verbose option: put ON to see the whole build command lines
#SET(CMAKE_VERBOSE_MAKEFILE ON)


SET(bcd_include_folder "${CMAKE_SOURCE_DIR}/include/bcd")


#MESSAGE(STATUS "Entering subdirectory 'ext'")
ADD_SUBDIRECTORY(ext)

#MESSAGE(STATUS "Entering subdirectory 'src'")
ADD_SUBDIRECTORY(src)


#INCLUDE(CPack)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -37,6 +37,7 @@ namespace bcd
SamplesStatisticsImages(SamplesStatisticsImages&&) = default;
SamplesStatisticsImages& operator=(const SamplesStatisticsImages&) = default;
SamplesStatisticsImages& operator=(SamplesStatisticsImages&&) = default;
~SamplesStatisticsImages() = default;

DeepImage<float> m_nbOfSamplesImage;
DeepImage<float> m_meanImage;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/.gitignore
@@ -1,2 +1 @@
CMakeLists.txt.user*
*.tmp
132 changes: 18 additions & 114 deletions src/CMakeLists.txt
Expand Up @@ -6,131 +6,35 @@
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.txt file.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)

PROJECT(BayesianCollaborativeDenoising)

OPTION(BCD_BUILD_GUI "Build a GUI executable for bcd, using library NanoGUI" ON)
OPTION(BCD_USE_CUDA "Use CUDA for accelerating computations" ON)

# Add CMake folder to the module path : contains CMake specific files *.cmake
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH} )

# Set the default build to Release. Note this doesn't do anything for the VS
# default build target which defaults to Debug when you first start it.
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)







# OpenMP
FIND_PACKAGE(OpenMP)

IF(${CMAKE_VERSION} VERSION_GREATER 3.8)

# not tested yet
MESSAGE(AUTHOR_WARNING "Using OpenMP detection from cmake 3.9.0+: not tested yet")
IF(OPENMP_CXX_FOUND)
ADD_LIBRARY(OpenMP ALIAS OpenMP::OpenMP_CXX)
ELSE()
MESSAGE(WARNING "Could not find OpenMP library")
ENDIF()

ELSE()

IF(OPENMP_FOUND)
ADD_LIBRARY(OpenMP INTERFACE)
TARGET_COMPILE_OPTIONS(OpenMP INTERFACE ${OpenMP_CXX_FLAGS})
TARGET_LINK_LIBRARIES(OpenMP INTERFACE
$<$<CXX_COMPILER_ID:GNU>:${OpenMP_CXX_FLAGS}>
$<$<CXX_COMPILER_ID:Clang>:${OpenMP_CXX_FLAGS}>
$<$<CXX_COMPILER_ID:Intel>:${OpenMP_CXX_FLAGS}>
)
ELSE()
MESSAGE(WARNING "Could not find OpenMP library")
ENDIF()

ENDIF()







IF(BCD_USE_CUDA)

SET(CUDA_PROPAGATE_HOST_FLAGS OFF)
FIND_PACKAGE(CUDA)

IF(NOT CUDA_FOUND)
MESSAGE(WARNING "Could not find CUDA")
ELSE(NOT CUDA_FOUND)

SET(CUDA_LIBRARIES PUBLIC ${CUDA_LIBRARIES}) # hack to avoid cmake warnings related to policy CMP0023 (see https://gitlab.kitware.com/cmake/cmake/issues/16602 )

SET(config_types DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)

# We have to manually propagate all host flags but C++11...
FOREACH(config ${config_types})
SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}} -Xcompiler ")
# SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}} -g -lineinfo -Xcompiler ") #use this line instead of the previous one for debugging and line info (for nvprof for example)
IF(OPENMP_FOUND)
SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}},\"${OpenMP_CXX_FLAGS}\"")
ENDIF(OPENMP_FOUND)
STRING(REPLACE " " ";" FLAGS_LIST ${CMAKE_CXX_FLAGS_${config}})
FOREACH(flag ${FLAGS_LIST})
SET(CUDA_NVCC_FLAGS_${config} "${CUDA_NVCC_FLAGS_${config}},\"${flag}\"")
ENDFOREACH()
ENDFOREACH()
ENDIF(NOT CUDA_FOUND)

# Verbose option: put ON to see the whole build command lines
IF(CUDA_FOUND)
SET(CUDA_VERBOSE_BUILD ON)
ENDIF(CUDA_FOUND)

ENDIF(BCD_USE_CUDA)






# Verbose option: put ON to see the whole build command lines
#SET(CMAKE_VERBOSE_MAKEFILE ON)

SET(bcd_folder_name "BayesianCollaborativeDenoiser")
SET(bcd_folder "${CMAKE_SOURCE_DIR}/${bcd_folder_name}")
SET(common_folder "${CMAKE_SOURCE_DIR}/Common")
SET(exr_folder "${common_folder}/exr")

SET(bcd_library "")
#SET(bcd_library "")

#MESSAGE(STATUS "Entering subdirectory 'ext'")
ADD_SUBDIRECTORY(ext)
SET(lib_bcd_core "bcdcore")
SET(lib_bcd_io "bcdio")
SET(exe_bcd_cli "bcd-cli")
SET(exe_bcd_raw_converter "bcd-raw-converter")
SET(exe_bcd_gui "bcd-gui")

#MESSAGE(STATUS "Entering subdirectory '${bcd_folder_name}'")
ADD_SUBDIRECTORY(${bcd_folder_name})
#MESSAGE(STATUS "Entering subdirectory 'core'")
ADD_SUBDIRECTORY(core)

#MESSAGE(STATUS "Entering subdirectory 'bcd_cli'")
ADD_SUBDIRECTORY(bcd_cli)
#MESSAGE(STATUS "Entering subdirectory 'io'")
ADD_SUBDIRECTORY(io)

#MESSAGE(STATUS "Entering subdirectory 'Raw2BcdInputs'")
ADD_SUBDIRECTORY(Raw2BcdInputs)
#MESSAGE(STATUS "Entering subdirectory 'cli'")
ADD_SUBDIRECTORY(cli)

#MESSAGE(STATUS "Entering subdirectory 'raw_converter'")
ADD_SUBDIRECTORY(raw_converter)

IF(BCD_BUILD_GUI)
ADD_SUBDIRECTORY(bcd_gui)
# MESSAGE(STATUS "Entering subdirectory 'gui'")
ADD_SUBDIRECTORY(gui)
ELSE(BCD_BUILD_GUI)
MESSAGE(STATUS "skipping building of GUI executable")
MESSAGE(STATUS "skipping building of bcd_gui executable")
ENDIF(BCD_BUILD_GUI)

#INCLUDE(CPack)

5 changes: 3 additions & 2 deletions src/bcd_cli/CMakeLists.txt → src/cli/CMakeLists.txt
Expand Up @@ -6,7 +6,7 @@
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.txt file.

SET(target_name bcd_cli)
SET(target_name ${exe_bcd_cli})

SET(src_files
main.cpp
Expand All @@ -20,6 +20,7 @@ ADD_EXECUTABLE(${target_name} ${src_files} ${header_files} ${header_implementati

SET_TARGET_PROPERTIES(${target_name} PROPERTIES CXX_STANDARD 11)

TARGET_LINK_LIBRARIES(${target_name} PRIVATE ${bcd_library})
TARGET_LINK_LIBRARIES(${target_name} PRIVATE ${lib_bcd_core})
TARGET_LINK_LIBRARIES(${target_name} PRIVATE ${lib_bcd_io})

INSTALL(TARGETS ${target_name} RUNTIME DESTINATION bin)
4 changes: 3 additions & 1 deletion src/bcd_cli/main.cpp → src/cli/main.cpp
Expand Up @@ -16,6 +16,7 @@
#include "CudaHistogramDistance.h"
#endif

#include "ParametersIO.h"
#include "ImageIO.h"
#include "DeepImage.h"

Expand Down Expand Up @@ -97,12 +98,13 @@ namespace bcd
cout << "Bayesian Collaborative Denoising"<< endl << endl;
cout << "Usage: " << g_pProgramPath << " <arguments list>" << endl;
cout << "Only EXR images are supported." << endl << endl;
cout << "Required arguments list:" << endl;
cout << "Required arguments list (unless a pipeline file is provided and contains this data):" << endl;
cout << " -o <output> The file path to the output image" << endl;
cout << " -i <input> The file path to the input image" << endl;
cout << " -h <hist> The file path to the input histograms buffer" << endl;
cout << " -c <cov> The file path to the input covariance matrices buffer" << endl;
cout << "Optional arguments list:" << endl;
cout << " -a <file> The file path to the .bcd.json file containing arguments for the program" << endl;
cout << " -d <float> Histogram patch distance threshold (default: " << defaultProgramArgs.m_histogramPatchDistanceThreshold << ")" << endl;
cout << " -b <int> Radius of search windows (default: " << defaultProgramArgs.m_searchWindowRadius << ")" << endl;
cout << " -w <int> Radius of patches (default: " << defaultProgramArgs.m_patchRadius << ")" << endl;
Expand Down

0 comments on commit 10ea5eb

Please sign in to comment.