Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:

- name: Dependencies
shell: bash
env:
RTA_ENABLE_LENSFUN: 'ON'
RTA_ENABLE_EIGEN: 'ON'
RTA_ENABLE_CERES: 'ON'
run: |
bash build_scripts/install_deps_ubuntu.bash

Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ on:
enable_eigen:
type: string
default: 'ON'
enable_ceres:
type: string
default: 'ON'
vfxyear:
type: number
default: 0
Expand Down Expand Up @@ -80,8 +83,12 @@ jobs:
vcpkg-binary-cache-${{ runner.os }}-${{ hashFiles('build_scripts/vcpkg.json') }}
restore-keys: |
vcpkg-binary-cache-${{ runner.os }}-

- name: Dependencies
env:
RTA_ENABLE_LENSFUN: '${{inputs.enable_lensfun}}'
RTA_ENABLE_EIGEN: '${{inputs.enable_eigen}}'
RTA_ENABLE_CERES: '${{inputs.enable_ceres}}'
shell: bash
run: |
bash build_scripts/${{ inputs.install_deps }}.bash
Expand All @@ -98,6 +105,7 @@ jobs:
-D ENABLE_SHARED="${{ inputs.build_shared_libs }}"
-D RTA_ENABLE_LENSFUN="${{ inputs.enable_lensfun }}"
-D RTA_ENABLE_EIGEN="${{ inputs.enable_eigen }}"
-D RTA_ENABLE_CERES="${{ inputs.enable_ceres }}"
-D RTA_SANITISER_MODE="${{ inputs.sanitiser_mode }}"
-D RTA_PYTHON_VERSION="${{ inputs.python_version }}"

Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ jobs:
install_deps: install_deps_${{ matrix.os }}
toolchain_file: ${{ matrix.toolchain_file }}
build_shared_libs: ${{ matrix.build_shared_libs || 'ON' }}
workflow_name: ${{matrix.options[0]}}
enable_eigen: ${{ matrix.options[1] }}
enable_lensfun: ${{ matrix.options[2] }}
workflow_name: ${{ matrix.options[0] }}
enable_eigen: ${{ matrix.options[1] }}
enable_ceres: ${{ matrix.options[2] }}
enable_lensfun: ${{ matrix.options[3] }}
cxx_standard: 17
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
Expand All @@ -75,10 +76,11 @@ jobs:
matrix:
os: [ macos, ubuntu, windows ]
options: [
# [ name, enable_eigen, enable_lensfun]
["minimal", OFF, OFF],
["eigen", ON, OFF],
["full", ON, ON ]
# [ name, enable_eigen, enable_ceres, enable_lensfun]
["minimal", 'OFF', 'OFF', 'OFF'],
["eigen", 'ON', 'OFF', 'OFF'],
["ceres", 'OFF', 'ON', 'OFF'],
["full", 'ON', 'ON', 'ON' ]
]
include:
- os: windows
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:

- name: Install OS dependencies
shell: bash
env:
RTA_ENABLE_LENSFUN: 'ON'
RTA_ENABLE_EIGEN: 'ON'
RTA_ENABLE_CERES: 'ON'
run: |
bash build_scripts/install_deps_macos.bash

Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ option( RTA_INSTALL_DATABASE "Download and install the spectral measurements dat
option( ENABLE_COVERAGE "Enable code coverage reporting" OFF )
option( RTA_ENABLE_LENSFUN "Use lensfun for lens correction" ON )
option( RTA_ENABLE_EIGEN "Use Eigen for linear algebra" ON )
option( RTA_ENABLE_CERES "Use Ceres Solver for matrix calculation" ON )
set ( RTA_SANITISER_MODE "none" CACHE STRING "Dynamic analysis sanitiser mode ('none', 'address', 'memory', or 'thread')" )
set ( RTA_PYTHON_VERSION "" CACHE STRING "Python version to use" )

Expand Down Expand Up @@ -151,6 +152,12 @@ endif ()
## Install RAWTOACES.pc

if ( PKG_CONFIG_FOUND )
if ( RTA_ENABLE_CERES )
set ( RTA_PC_CERES_LIB "-lCeres" )
else ()
set ( RTA_PC_CERES_LIB "" )
endif ()

configure_file(config/RAWTOACES.pc.in "${PROJECT_BINARY_DIR}/RAWTOACES.pc" @ONLY)
install( FILES "${PROJECT_BINARY_DIR}/RAWTOACES.pc" DESTINATION lib/pkgconfig COMPONENT dev )
endif()
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ To build `rawtoaces` you would need to satisfy these dependencies:
| ------- | -----------| -------- | -------------------------------- |
| `cmake` | `3.12` | | [CMake download](https://cmake.org/download/)|
| `ceres` | `1.12.0` | Ceres Solver is an open source library for solving Non-linear Least Squares problems with bounds constraints and unconstrained optimization problems. It processes non-linear regression for rawtoaces. | [Ceres Solver installation](http://ceres-solver.org/installation.html)|
| `eigen` | `3.3.7` | Eigen is an open source library for solving linear algebra problems. | [Eigen installation](https://libeigen.gitlab.io/#download)|
| `OpenImageIO` | `3.0` | OpenImageIO is an open source library providing vast functionality for image processing. rawtoaces relies on OpenImageIO for reading raw files, saving AcesContainer files, and also all pixel operations. | [OpenImageIO installation](https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/main/INSTALL.md) |
| `nlohmann-json` | `3.6` | nlohmann-json is a simple header-only library for parsing JSON files. | [nlohmann-json integration](https://github.com/nlohmann/json#integration) |
| `nanobind` | `2.2.0` | nanobind is a small binding library that exposes C++ types in Python and vice versa. | [nanobind installation](https://nanobind.readthedocs.io/en/latest/installing.html) |
| `lensfun` | `0.3.2` | Lensfun itself is a library for correcting several lens artefacts and a database for storing lens profiles. | [lensfun installation](https://lensfun.github.io/development/) |

> [!NOTE]
> There is an experimental mode allowing to build rawtoaces without requiring Eigen and/or Ceres. In order to do so, please provide these
> parameters to cmake: `-D RTA_ENABLE_EIGEN=OFF -D RTA_ENABLE_CERES=OFF`. If both dependencies are disabled, there is no need to install
> Eigen and Ceres. Note that Eigen is a transient dependency of Ceres, so if Eigen is disabled in rawtoaces, but Ceres isn't, you still
> need to install Eigen.

### MacOS

Install homebrew if not already installed
Expand Down
20 changes: 17 additions & 3 deletions build_scripts/install_deps_macos.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,26 @@ set -ex
brew update

brew install \
ceres-solver \
nlohmann-json \
openimageio \
nanobind \
robin-map \
exiftool \
lensfun
exiftool

if [ "$RTA_ENABLE_EIGEN" != "OFF" ];
then
brew install eigen
fi

if [ "$RTA_ENABLE_CERES" != "OFF" ];
then
brew install ceres-solver
fi

if [ "$RTA_ENABLE_LENSFUN" != "OFF" ];
then
brew install lensfun
fi


python3 -m pip install --break-system-packages pytest
23 changes: 20 additions & 3 deletions build_scripts/install_deps_ubuntu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,30 @@ set -ex
time sudo apt-get update

time sudo apt-get -q -f install -y \
libceres-dev \
nlohmann-json3-dev \
libopencv-dev \
openimageio-tools libopenimageio-dev \
exiftool \
liblensfun-dev \
liblensfun-data-v1

if [ "$RTA_ENABLE_EIGEN" != "OFF" ];
then
time sudo apt-get -q -f install -y \
libeigen3-dev
fi

if [ "$RTA_ENABLE_CERES" != "OFF" ];
then
time sudo apt-get -q -f install -y \
libceres-dev
fi

if [ "$RTA_ENABLE_LENSFUN" != "OFF" ];
then
time sudo apt-get -q -f install -y \
liblensfun-dev \
liblensfun-data-v1
fi


# Nanobind in apt is still v1.9, we need at least v2.2.
pip3 install pytest nanobind
15 changes: 14 additions & 1 deletion build_scripts/install_deps_windows.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,23 @@ export VCPKG_BINARY_SOURCES="clear;files,C:/vcpkg/binary-cache,readwrite"
# Baseline is pinned in vcpkg.json. The latest hash can be found with:
# git ls-remote https://github.com/microsoft/vcpkg HEAD | cut -f1

FEATURES=""

if [ "$RTA_ENABLE_LENSFUN" != "OFF" ]; then
FEATURES="$FEATURES --x-feature=lensfun"
fi

if [ "$RTA_ENABLE_CERES" != "OFF" ]; then
FEATURES="$FEATURES --x-feature=ceres"
elif [ "$RTA_ENABLE_EIGEN" != "OFF" ]; then
FEATURES="$FEATURES --x-feature=eigen"
fi

# Install dependencies - vcpkg will automatically use binary cache if available
vcpkg install \
--x-install-root="C:/vcpkg/installed" \
--x-manifest-root="./build_scripts"
--x-manifest-root="./build_scripts" \
$FEATURES

# Install pip and pytest to the vcpkg Python
# Since vcpkg Python doesn't include pip, install it first using ensurepip
Expand Down
18 changes: 15 additions & 3 deletions build_scripts/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@
{
"builtin-baseline": "2b6a882f61eaa764ec3cf816e2265fe804a44cd0",
"dependencies": [
"ceres",
"nlohmann-json",
{ "name": "openimageio", "features": [ "libraw" ] },
"nanobind",
"lensfun"
"nanobind"
],
"features": {
"lensfun": {
"description": "use lensfun for lens correction",
"dependencies": ["lensfun"]
},
"eigen": {
"description": "use eigen for linear algebra",
"dependencies": ["eigen3"]
},
"ceres": {
"description": "use ceres in the non-linear solver",
"dependencies": ["ceres"]
}
},
"overrides": [
{ "name": "eigen3", "version": "3.4.0" }
]
Expand Down
2 changes: 1 addition & 1 deletion config/RAWTOACES.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ RAWTOACES_includedir=@INSTALL_INCLUDE_DIR@/rawtoaces
Name: RAWTOACES
Description: RAWTOACES raw image to ACES
Version: @RAWTOACES_VERSION@
Libs: -L${libdir} -lCeres
Libs: -L${libdir} @RTA_PC_CERES_LIB@
Cflags: -I${RAWTOACES_includedir}
9 changes: 5 additions & 4 deletions config/RAWTOACESConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ set(rawtoaces_VERSION "@RAWTOACES_VERSION@")

@PACKAGE_INIT@

include(${CMAKE_CURRENT_LIST_DIR}/RAWTOACESTargets.cmake)

include(CMakeFindDependencyMacro)

find_dependency ( OpenImageIO )

if ( NOT @ENABLE_SHARED@ )
Expand All @@ -17,7 +14,11 @@ if ( NOT @ENABLE_SHARED@ )
find_dependency ( Eigen3 )
endif ()

find_dependency ( Ceres )
if ( @RTA_ENABLE_CERES@ )
find_dependency ( Ceres )
endif ()
endif ( NOT @ENABLE_SHARED@ )

include(${CMAKE_CURRENT_LIST_DIR}/RAWTOACESTargets.cmake)

check_required_components(rawtoaces)
4 changes: 3 additions & 1 deletion configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ if ( RTA_ENABLE_EIGEN )
find_package ( Eigen3 CONFIG REQUIRED )
endif ( RTA_ENABLE_EIGEN )

find_package ( Ceres CONFIG REQUIRED )
if ( RTA_ENABLE_CERES )
find_package ( Ceres CONFIG REQUIRED )
endif ()

if ( RTA_ENABLE_LENSFUN )
find_package ( PkgConfig REQUIRED )
Expand Down
17 changes: 11 additions & 6 deletions src/rawtoaces_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ add_library( ${RAWTOACES_CORE_LIB} ${DO_SHARED}
rawtoaces_core_priv.h
define.h
core_math.h
core_math_priv.h
)

target_link_libraries(
Expand All @@ -34,12 +35,16 @@ if ( RTA_ENABLE_EIGEN )
target_compile_definitions(${RAWTOACES_CORE_LIB} PRIVATE RTA_ENABLE_EIGEN=1 )
endif ( RTA_ENABLE_EIGEN )

if ( ${Ceres_VERSION_MAJOR} GREATER 1 )
target_link_libraries( ${RAWTOACES_CORE_LIB} PRIVATE Ceres::ceres )
else ()
target_include_directories(${RAWTOACES_CORE_LIB} PRIVATE ${CERES_INCLUDE_DIRS})
target_link_libraries(${RAWTOACES_CORE_LIB} PRIVATE ${CERES_LIBRARIES})
endif ()
if ( RTA_ENABLE_CERES )
if ( ${Ceres_VERSION_MAJOR} GREATER 1 )
target_link_libraries( ${RAWTOACES_CORE_LIB} PRIVATE Ceres::ceres )
else ()
target_include_directories(${RAWTOACES_CORE_LIB} PRIVATE ${CERES_INCLUDE_DIRS})
target_link_libraries(${RAWTOACES_CORE_LIB} PRIVATE ${CERES_LIBRARIES})
endif ()

target_compile_definitions(${RAWTOACES_CORE_LIB} PRIVATE RTA_ENABLE_CERES=1 )
endif ( RTA_ENABLE_CERES )

target_include_directories( ${RAWTOACES_CORE_LIB} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
Expand Down
Loading
Loading