├── .github
└── workflows
│ ├── flip-deploy.yml
│ └── flip_ci.yml
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── images
├── reference.exr
├── reference.png
├── teaser.png
├── test.exr
└── test.png
├── misc
├── CLA.md
├── FLIP.txt
├── HDRFLIP.txt
├── LDRFLIP.txt
├── LICENSE-third-party.md
├── papersUsingFLIP.md
├── precision.md
├── separatedConvolutions.pdf
└── versionList.md
├── pyproject.toml
└── src
├── CMakeLists.txt
├── cmake
└── FLIPConfig.cmake
├── cpp
├── CMakeLists.txt
├── FLIP.h
├── FLIP.sln
├── README.md
└── tool
│ ├── CMakeLists.txt
│ ├── CPP.vcxproj
│ ├── CPP.vcxproj.filters
│ ├── CUDA.vcxproj
│ ├── CUDA.vcxproj.filters
│ ├── FLIP-tool.cpp
│ ├── FLIP-tool.cu
│ ├── FLIPToolHelpers.h
│ ├── commandline.h
│ ├── filename.h
│ ├── imagehelpers.h
│ ├── pooling.h
│ ├── stb_image.h
│ ├── stb_image_write.h
│ └── tinyexr.h
├── flip_evaluator
├── __init__.py
└── flip_python_api.py
├── nanobindFLIP.cpp
├── python
├── README.md
└── api_example.py
├── pytorch
├── README.md
├── data.py
├── flip_loss.py
└── train.py
└── tests
├── correct_hdrflip_cpp.png
├── correct_hdrflip_cuda.png
├── correct_ldrflip_cpp.png
├── correct_ldrflip_cuda.png
├── test.py
└── test_pytorch.py
/.github/workflows/flip-deploy.yml:
--------------------------------------------------------------------------------
1 | # Much of the code retrieved from Mitsuba3 (https://github.com/mitsuba-renderer/mitsuba3/blob/master/.github/workflows/wheels.yml.)
2 |
3 | name: Build wheels
4 |
5 | on:
6 | workflow_dispatch:
7 | pull_request:
8 | push:
9 | branches:
10 | - main
11 | release:
12 | types:
13 | - published
14 |
15 | jobs:
16 | build_wheels:
17 | strategy:
18 | matrix:
19 | # macos-13 is an intel runner, macos-14 is apple silicon
20 | os: [ubuntu-latest, windows-latest, macos-13, macos-14]
21 | python: [cp38, cp39, cp310, cp311, cp312, cp312_stable, cp313]
22 | exclude:
23 | # The first Python version to target Apple arm64 architectures is 3.9.
24 | - os: macos-14
25 | python: cp38
26 | name: >
27 | ${{ matrix.python }} wheel for ${{ matrix.os }}
28 | ${{ (endsWith(matrix.python, '_stable') && '(stable ABI)') || '' }}
29 | runs-on: ${{ matrix.os }}
30 |
31 | steps:
32 | - uses: actions/checkout@v4
33 |
34 | - uses: actions/setup-python@v4
35 | name: Install Python
36 | with:
37 | python-version: '3.8'
38 |
39 | - name: Install cibuildwheel
40 | run: |
41 | python -m pip install cibuildwheel==2.20.0
42 |
43 | #########################
44 | # Build and store wheels
45 | #########################
46 | - name: Build wheel
47 | run: |
48 | python -m cibuildwheel --output-dir wheelhouse
49 |
50 | - uses: actions/upload-artifact@v3
51 | with:
52 | name: wheels
53 | path: ./wheelhouse/*.whl
54 |
55 | build_sdist:
56 | name: Build source distribution
57 | runs-on: ubuntu-latest
58 | steps:
59 | - uses: actions/checkout@v4
60 |
61 | - name: Build sdist
62 | run: pipx run build --sdist
63 |
64 | - uses: actions/upload-artifact@v4
65 | with:
66 | name: cibw-sdist
67 | path: dist/*.tar.gz
--------------------------------------------------------------------------------
/.github/workflows/flip_ci.yml:
--------------------------------------------------------------------------------
1 | name: FLIP CI
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 |
9 | jobs:
10 | build:
11 | runs-on: ${{ matrix.os }}
12 | strategy:
13 | matrix:
14 | os: [ubuntu-latest, windows-latest, macos-latest]
15 | config: [Release, Debug]
16 |
17 | steps:
18 | - name: Checkout Sources
19 | uses: actions/checkout@v3
20 |
21 | - name: Install CUDA
22 | if: ${{ matrix.os == 'ubuntu-latest' }}
23 | run: sudo apt update && sudo apt install -y nvidia-cuda-toolkit g++-10
24 |
25 | - name: Configure CMake
26 | run: >
27 | cmake -LA -B ${{github.workspace}}/src/build -S ${{github.workspace}}/src/
28 | -DCMAKE_BUILD_TYPE=${{ matrix.config }}
29 | -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/src/build/install
30 | -DCMAKE_CUDA_ARCHITECTURES=all
31 | -DCMAKE_CUDA_HOST_COMPILER=g++-10
32 | -DFLIP_ENABLE_CUDA=${{ matrix.os == 'ubuntu-latest' }}
33 |
34 | - name: Build
35 | run: cmake --build ${{github.workspace}}/src/build --config ${{ matrix.config }} --target install
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore thumbnails created by Windows
2 | Thumbs.db
3 |
4 | # Ignore files built by Visual Studio
5 | *.user
6 | *.aps
7 | *.pch
8 | *.vspscc
9 | *_i.c
10 | *_p.c
11 | *.ncb
12 | *.suo
13 | *.bak
14 | *.cache
15 | *.ilk
16 | *.log
17 | #[Bb]in
18 | [Dd]ebug*/
19 | *.sbr
20 | obj/
21 | [Rr]elease*/
22 | _ReSharper*/
23 | *.VC.VC.opendb
24 | *.VC.db
25 | .vs/
26 |
27 | # Matlab
28 | *.asv
29 |
30 | # Emacs ignores
31 | *~
32 |
33 | # Python ignores
34 | *__pycache__*
35 | dist/
36 | *.egg-info/
37 |
38 | # LaTeX ignores
39 | *.synctex.gz
40 | *.out
41 | *.aux
42 | *.bbl
43 | *.blg
44 |
45 | # VSCode ignores
46 | *.vscode
47 |
48 | # Ignore build
49 | build/
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | #
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 | #
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 | #
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 | #
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | #
29 | # SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
30 | # SPDX-License-Identifier: BSD-3-Clause
31 | #################################################################################
32 |
33 | cmake_minimum_required(VERSION 3.15...3.27)
34 | project(flip_evaluator LANGUAGES CXX)
35 |
36 | # Warn if the user invokes CMake directly
37 | if (NOT SKBUILD)
38 | message(WARNING "\
39 | This CMake file is meant to be executed using 'scikit-build-core'.
40 | Running it directly will almost certainly not produce the desired
41 | result. If you are a user trying to install this package, use the
42 | command below, which will install all necessary build dependencies,
43 | compile the package in an isolated environment, and then install it.
44 | =====================================================================
45 | $ pip install .
46 | =====================================================================
47 | If you are a software developer, and this is your own package, then
48 | it is usually much more efficient to install the build dependencies
49 | in your environment once and use the following command that avoids
50 | a costly creation of a new virtual environment at every compilation:
51 | =====================================================================
52 | $ pip install nanobind scikit-build-core[pyproject]
53 | $ pip install --no-build-isolation -ve .
54 | =====================================================================
55 | You may optionally add -Ceditable.rebuild=true to auto-rebuild when
56 | the package is imported. Otherwise, you need to rerun the above
57 | after editing C++ files.")
58 | endif()
59 |
60 | if (CMAKE_VERSION VERSION_LESS 3.18)
61 | set(DEV_MODULE Development)
62 | else()
63 | set(DEV_MODULE Development.Module)
64 | endif()
65 |
66 | if(MSVC)
67 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp")
68 | elseif((NOT APPLE) AND UNIX)
69 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
70 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgomp")
71 | endif()
72 |
73 | find_package(Python 3.8
74 | REQUIRED COMPONENTS Interpreter Development.Module
75 | OPTIONAL_COMPONENTS Development.SABIModule)
76 |
77 | if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
78 | set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
79 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
80 | endif()
81 |
82 | execute_process(
83 | COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
84 | OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT)
85 | find_package(nanobind CONFIG REQUIRED)
86 |
87 | nanobind_add_module(nbflip STABLE_ABI src/nanobindFLIP.cpp)
88 |
89 | install(TARGETS nbflip LIBRARY DESTINATION flip_evaluator)
90 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | 2. Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
31 | SPDX-License-Identifier: BSD-3-Clause
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # FLIP: A Tool for Visualizing and Communicating Errors in Rendered Images (v1.6)
4 |
5 | By
6 | [Pontus Ebelin](https://research.nvidia.com/person/pontus-ebelin)
7 | and
8 | [Tomas Akenine-Möller](https://research.nvidia.com/person/tomas-akenine-m%C3%B6ller),
9 | with
10 | Jim Nilsson,
11 | [Magnus Oskarsson](https://www1.maths.lth.se/matematiklth/personal/magnuso/),
12 | [Kalle Åström](https://www.maths.lu.se/staff/kalleastrom/),
13 | [Mark D. Fairchild](https://www.rit.edu/directory/mdfpph-mark-fairchild),
14 | and
15 | [Peter Shirley](https://research.nvidia.com/person/peter-shirley).
16 |
17 | This repository holds implementations of the [LDR-FLIP](https://research.nvidia.com/publication/2020-07_FLIP)
18 | and [HDR-FLIP](https://research.nvidia.com/publication/2021-05_HDR-FLIP) image error metrics.
19 | It also holds code for the FLIP tool, presented in [Ray Tracing Gems II](https://www.realtimerendering.com/raytracinggems/rtg2/index.html).
20 |
21 | The changes made for the different versions of FLIP are summarized in the [version list](https://github.com/NVlabs/flip/blob/main/misc/versionList.md).
22 |
23 | [A list of papers](https://github.com/NVlabs/flip/blob/main/misc/papersUsingFLIP.md) that use/cite FLIP.
24 |
25 | [A note](https://github.com/NVlabs/flip/blob/main/misc/precision.md) about the precision of FLIP.
26 |
27 | [An image gallery](https://research.nvidia.com/node/3525) displaying a large quantity of reference/test images and corresponding error maps from
28 | different metrics.
29 |
30 | **Note**: since v1.6, the Python version of FLIP can now be installed via `pip install flip-evaluator`.
31 |
32 | **Note**: in v1.3, we switched to a *single header* ([FLIP.h](src/cpp/FLIP.h)) for C++/CUDA for easier integration.
33 |
34 | # License
35 |
36 | Copyright © 2020-2025, NVIDIA Corporation & Affiliates. All rights reserved.
37 |
38 | This work is made available under a [BSD 3-Clause License](LICENSE).
39 |
40 | The repository distributes code for `tinyexr`, which is subject to a [BSD 3-Clause License](https://github.com/NVlabs/flip/blob/main/misc/LICENSE-third-party.md#bsd-3-clause-license),
41 | and `stb_image`, which is subject to an [MIT License](https://github.com/NVlabs/flip/blob/main/misc/LICENSE-third-party.md#mit-license).
42 |
43 | For individual contributions to the project, please confer the [Individual Contributor License Agreement](https://github.com/NVlabs/flip/blob/main/misc/CLA.md).
44 |
45 | For business inquiries, please visit our website and submit the form: [NVIDIA Research Licensing](https://www.nvidia.com/en-us/research/inquiries/).
46 |
47 | # Simplest Way To Get Started
48 | The simplest way to run FLIP to compare a test image `testImage.png` to a reference image `referenceImage.png` is as follows:
49 | ```
50 | pip install flip-evaluator
51 | flip -r referenceImage.png -t testImage.png
52 | ```
53 | For more information about the tool's capabilities, try running `flip -h`.
54 |
55 | If you wish to use FLIP in your Python or C++ evaluation scripts, please read the next sections.
56 |
57 | # Python (API and Tool)
58 | **Setup** (with pip):
59 | ```
60 | pip install flip-evaluator
61 | ```
62 |
63 | **Usage:**
64 |
65 | API:
66 | See the example script `src/python/api_example.py`.
67 |
68 | Tool:
69 | ```
70 | flip --reference reference.{exr|png} --test test.{exr|png} [--options]
71 | ```
72 |
73 | See the [README](https://github.com/NVlabs/flip/blob/main/src/python/README.md) in the `python` folder and run `flip -h` for further information and usage instructions.
74 |
75 | # C++ and CUDA (API and Tool)
76 | **Setup:**
77 |
78 | The `src/cpp/FLIP.sln` solution contains one CUDA backend project and one pure C++ backend project.
79 |
80 | Compiling the CUDA project requires a CUDA compatible GPU. Instruction on how to install CUDA can be found [here](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html).
81 |
82 | Alternatively, a CMake build can be done by creating a build directory in the `src` directory and invoking CMake on the source `cpp` directory (add `--config Release` to build release configuration on Windows):
83 |
84 | ```
85 | cd src
86 | mkdir build
87 | cd build
88 | cmake ..
89 | cmake --build . [--config Release]
90 | ```
91 |
92 | CUDA support is enabled via the `FLIP_ENABLE_CUDA`, which can be passed to CMake on the command line with
93 | `-DFLIP_ENABLE_CUDA=ON` or set interactively with `ccmake` or `cmake-gui`.
94 | `FLIP_LIBRARY` option allows to output a library rather than an executable.
95 |
96 | **Usage:**
97 |
98 | API:
99 | See the [README](https://github.com/NVlabs/flip/blob/main/src/cpp/README.md).
100 |
101 | Tool:
102 | ```
103 | flip[-cuda].exe --reference reference.{exr|png} --test test.{exr|png} [options]
104 | ```
105 |
106 | See the [README](https://github.com/NVlabs/flip/blob/main/src/cpp/README.md) in the `src/cpp` folder and run `flip[-cuda].exe -h` for further information and usage instructions.
107 |
108 | # PyTorch (Loss Function)
109 | **Setup** (with Anaconda3 or Miniconda):
110 | ```
111 | conda create -n flip_dl python numpy matplotlib
112 | conda activate flip_dl
113 | conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
114 | conda install -c conda-forge openexr-python
115 | ```
116 |
117 | **Usage:**
118 |
119 | *Remember to activate the* `flip_dl` *environment through* `conda activate flip_dl` *before using the loss function.*
120 |
121 | LDR- and HDR-FLIP are implemented as loss modules in `src/pytorch/flip_loss.py`. An example where the loss function is used to train a simple autoencoder is provided in `src/pytorch/train.py`.
122 |
123 | See the [README](https://github.com/NVlabs/flip/blob/main/src/pytorch/README.md) in the `pytorch` folder for further information and usage instructions.
124 |
125 | # Citation
126 | If your work uses the FLIP tool to find the errors between *low dynamic range* images,
127 | please cite the LDR-FLIP paper:
128 | [Paper](https://research.nvidia.com/publication/2020-07_FLIP) | [BibTeX](https://github.com/NVlabs/flip/blob/main/misc/LDRFLIP.txt)
129 |
130 | If it uses the FLIP tool to find the errors between *high dynamic range* images,
131 | instead cite the HDR-FLIP paper:
132 | [Paper](https://research.nvidia.com/publication/2021-05_HDR-FLIP) | [BibTeX](https://github.com/NVlabs/flip/blob/main/misc/HDRFLIP.txt)
133 |
134 | Should your work use the FLIP tool in a more general fashion, please cite the Ray Tracing Gems II article:
135 | [Chapter](https://link.springer.com/chapter/10.1007%2F978-1-4842-7185-8_19) | [BibTeX](https://github.com/NVlabs/flip/blob/main/misc/FLIP.txt)
136 |
137 | # Acknowledgements
138 | We appreciate the following peoples' contributions to this repository:
139 | Jonathan Granskog, Jacob Munkberg, Jon Hasselgren, Jefferson Amstutz, Alan Wolfe, Killian Herveau, Vinh Truong, Philippe Dagobert, Hannes Hergeth, Matt Pharr, Tizian Zeltner, Jan Honsbrok, Chris Zhang, and Wenzel Jakob.
140 |
--------------------------------------------------------------------------------
/images/reference.exr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVlabs/flip/9629de66b29663772d286c11321ae6eef140a580/images/reference.exr
--------------------------------------------------------------------------------
/images/reference.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVlabs/flip/9629de66b29663772d286c11321ae6eef140a580/images/reference.png
--------------------------------------------------------------------------------
/images/teaser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVlabs/flip/9629de66b29663772d286c11321ae6eef140a580/images/teaser.png
--------------------------------------------------------------------------------
/images/test.exr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVlabs/flip/9629de66b29663772d286c11321ae6eef140a580/images/test.exr
--------------------------------------------------------------------------------
/images/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVlabs/flip/9629de66b29663772d286c11321ae6eef140a580/images/test.png
--------------------------------------------------------------------------------
/misc/CLA.md:
--------------------------------------------------------------------------------
1 | ## Individual Contributor License Agreement (CLA)
2 |
3 | **Thank you for submitting your contributions to this project.**
4 |
5 | By signing this CLA, you agree that the following terms apply to all of your past, present and future contributions
6 | to the project.
7 |
8 | ### License.
9 |
10 | You hereby represent that all present, past and future contributions are governed by the
11 | [MIT License](https://opensource.org/licenses/MIT)
12 | copyright statement.
13 |
14 | This entails that to the extent possible under law, you transfer all copyright and related or neighboring rights
15 | of the code or documents you contribute to the project itself or its maintainers.
16 | Furthermore you also represent that you have the authority to perform the above waiver
17 | with respect to the entirety of you contributions.
18 |
19 | ### Moral Rights.
20 |
21 | To the fullest extent permitted under applicable law, you hereby waive, and agree not to
22 | assert, all of your “moral rights” in or relating to your contributions for the benefit of the project.
23 |
24 | ### Third Party Content.
25 |
26 | If your Contribution includes or is based on any source code, object code, bug fixes, configuration changes, tools,
27 | specifications, documentation, data, materials, feedback, information or other works of authorship that were not
28 | authored by you (“Third Party Content”) or if you are aware of any third party intellectual property or proprietary
29 | rights associated with your Contribution (“Third Party Rights”),
30 | then you agree to include with the submission of your Contribution full details respecting such Third Party
31 | Content and Third Party Rights, including, without limitation, identification of which aspects of your
32 | Contribution contain Third Party Content or are associated with Third Party Rights, the owner/author of the
33 | Third Party Content and Third Party Rights, where you obtained the Third Party Content, and any applicable
34 | third party license terms or restrictions respecting the Third Party Content and Third Party Rights. For greater
35 | certainty, the foregoing obligations respecting the identification of Third Party Content and Third Party Rights
36 | do not apply to any portion of a Project that is incorporated into your Contribution to that same Project.
37 |
38 | ### Representations.
39 |
40 | You represent that, other than the Third Party Content and Third Party Rights identified by
41 | you in accordance with this Agreement, you are the sole author of your Contributions and are legally entitled
42 | to grant the foregoing licenses and waivers in respect of your Contributions. If your Contributions were
43 | created in the course of your employment with your past or present employer(s), you represent that such
44 | employer(s) has authorized you to make your Contributions on behalf of such employer(s) or such employer
45 | (s) has waived all of their right, title or interest in or to your Contributions.
46 |
47 | ### Disclaimer.
48 |
49 | To the fullest extent permitted under applicable law, your Contributions are provided on an "as is"
50 | basis, without any warranties or conditions, express or implied, including, without limitation, any implied
51 | warranties or conditions of non-infringement, merchantability or fitness for a particular purpose. You are not
52 | required to provide support for your Contributions, except to the extent you desire to provide support.
53 |
54 | ### No Obligation.
55 |
56 | You acknowledge that the maintainers of this project are under no obligation to use or incorporate your contributions
57 | into the project. The decision to use or incorporate your contributions into the project will be made at the
58 | sole discretion of the maintainers or their authorized delegates.
--------------------------------------------------------------------------------
/misc/FLIP.txt:
--------------------------------------------------------------------------------
1 | @incollection{Andersson2021b,
2 | author = {Pontus Andersson and Jim Nilsson and Tomas Akenine{-}M{\"{o}}ller},
3 | editor = {Adam Marrs and Peter Shirley and Ingo Wald},
4 | title = "{Visualizing and Communicating Errors in Rendered Images}",
5 | booktitle = {Ray Tracing Gems II},
6 | year = {2021},
7 | chapter = {19},
8 | pages = {301--320},
9 | }
--------------------------------------------------------------------------------
/misc/HDRFLIP.txt:
--------------------------------------------------------------------------------
1 | @inproceedings{Andersson2021a,
2 | author = {Pontus Andersson and
3 | Jim Nilsson and
4 | Peter Shirley and
5 | Tomas Akenine{-}M{\"{o}}ller},
6 | title = "{Visualizing Errors in Rendered High Dynamic Range Images}",
7 | booktitle = {Eurographics Short Papers},
8 | year = {2021},
9 | month = {May},
10 | DOI = {10.2312/egs.20211015}
11 | }
12 |
--------------------------------------------------------------------------------
/misc/LDRFLIP.txt:
--------------------------------------------------------------------------------
1 | % The \FLIP command is defined using \usepackage{mathtools} \usepackage{xspace} \newcommand{\FLIP}{\protect\reflectbox{F}LIP\xspace}
2 | @article{Andersson2020,
3 | author = {Pontus Andersson and
4 | Jim Nilsson and
5 | Tomas Akenine{-}M{\"{o}}ller and
6 | Magnus Oskarsson and
7 | Kalle {\AA}str{\"{o}}m and
8 | Mark D. Fairchild},
9 | title = "{{\FLIP:} {A} Difference Evaluator for Alternating Images}",
10 | journal = {Proceedings of the ACM on Computer Graphics and Interactive Techniques},
11 | volume = {3},
12 | number = {2},
13 | pages = {15:1--15:23},
14 | year = {2020},
15 | doi={10.1145/3406183}
16 | }
17 |
--------------------------------------------------------------------------------
/misc/LICENSE-third-party.md:
--------------------------------------------------------------------------------
1 | `tinyexr`:
2 |
3 | # BSD 3-Clause License
4 |
5 | Copyright (c) 2014 - 2020, Syoyo Fujita and many contributors.
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 | * Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 | * Neither the name of the Syoyo Fujita nor the
16 | names of its contributors may be used to endorse or promote products
17 | derived from this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | TinyEXR contains some OpenEXR code, which is licensed under
31 |
32 | ================================================================================
33 |
34 | Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
35 | Digital Ltd. LLC
36 |
37 | All rights reserved.
38 |
39 | Redistribution and use in source and binary forms, with or without
40 | modification, are permitted provided that the following conditions are
41 | met:
42 | * Redistributions of source code must retain the above copyright
43 | notice, this list of conditions and the following disclaimer.
44 | * Redistributions in binary form must reproduce the above
45 | copyright notice, this list of conditions and the following disclaimer
46 | in the documentation and/or other materials provided with the
47 | distribution.
48 | * Neither the name of Industrial Light & Magic nor the names of
49 | its contributors may be used to endorse or promote products derived
50 | from this software without specific prior written permission.
51 |
52 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 |
64 | ================================================================================
65 |
66 | End of OpenEXR license -------------------------------------------------
67 |
68 | `tinyexr` uses miniz, which is developed by Rich Geldreich richgel99@gmail.com, and licensed under public domain.
69 |
70 | `tinyexr` tools uses stb, which is licensed under public domain: https://github.com/nothings/stb tinyexr uses some code from OpenEXR, which is licensed under a BSD 3-clause license.
71 |
72 | *************************************************************************************************************************************************************************************
73 | *************************************************************************************************************************************************************************************
74 |
75 | `stb_image`:
76 |
77 | # MIT License
78 |
79 | Copyright (c) 2017 Sean Barrett
80 |
81 | Permission is hereby granted, free of charge, to any person obtaining a copy of
82 | this software and associated documentation files (the "Software"), to deal in
83 | the Software without restriction, including without limitation the rights to
84 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
85 | of the Software, and to permit persons to whom the Software is furnished to do
86 | so, subject to the following conditions:
87 |
88 | The above copyright notice and this permission notice shall be included in all
89 | copies or substantial portions of the Software.
90 |
91 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
96 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
97 | SOFTWARE.
--------------------------------------------------------------------------------
/misc/precision.md:
--------------------------------------------------------------------------------
1 | # A note about precision
2 |
3 | We have several different implementations of FLIP (Python, PyTorch, C++, and CUDA) and we have tried to make
4 | the implementations as similar as possible. However, there are several facts about these that make it very hard
5 | to get perfect matches between the implementations.
6 | These include:
7 | 1. Our computations are made using 32-bit floating-point arithmetic.
8 | 2. The order of operations matter, with respect to the result.
9 | * We are using different versions of functions in the different versions of FLIP, and these may not all use similar implementations.
10 | Even computing the mean of an array can give different results because of this.
11 | * As an example, if a 2D filter implementation's outer loop is on `x` and the inner loop is on `y`, that will in the majority
12 | of cases give a different floating-point result compared to have the outer loop be `y` and the inner `x`.
13 | 4. GPUs attempt to try to use fused multiply-and-add (FMA) operations, i.e., `a*b+c`, as much as possible. These are faster, but the entire
14 | operation is also computed at higher precision. Since the CPU implementation may not use FMA, this is another source of difference
15 | between implementations.
16 | 5. Depending on compiler flags, `sqrt()` may be computed using lower precision on GPUs.
17 | 6. For the C++ and CUDA implementations, we have changed to using separated filters for faster performance.
18 | This has given rise to small differences compared to previous versions. For our tests,
19 | we have therefore updated the `images/correct_{ldr|hdr}flip_{cpp|cuda}.{png|exr}` images.
20 |
21 | That said, we have tried to make the results of our different implementations as close to each other as we could. There may still be differences.
22 |
23 | Furthermore, the Python version of FLIP, installed using `pip install flip_evaluator`, runs on Windows, Linux (tested on Ubuntu 24.04),
24 | and OS X ($\ge$ 10.15). However, its output sometimes differ slightly between the different operative systems.
25 | The references used for `flip_evaluator/tests/test.py` are made for Windows. While the mean tests (means compared up to six decimal points)
26 | pass on each mentioned operative system, not all error map pixels are identical.
27 |
--------------------------------------------------------------------------------
/misc/separatedConvolutions.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVlabs/flip/9629de66b29663772d286c11321ae6eef140a580/misc/separatedConvolutions.pdf
--------------------------------------------------------------------------------
/misc/versionList.md:
--------------------------------------------------------------------------------
1 | # FLIP Version List
2 |
3 | In addition to various minor changes, the following was
4 | changed for the different versions of FLIP:
5 |
6 | # Version 1.6 (commit 7967578)
7 | - Flipped the ꟻ in ꟻLIP. The entire name (FLIP) should now be readable on all devices.
8 | - Published Python version of FLIP to PyPI (URL: https://pypi.org/project/flip-evaluator/).
9 | - The Python version of FLIP (tool and API) is now installed by `pip install flip-evaluator`.
10 | - The distribution has been tested on Windows, Linux (Ubuntu 24.04), and OS X ($\ge$ 10.15). Wheels are built for each (and various CPython versions $\ge$ 3.8) using [cibuildwheel](https://github.com/pypa/cibuildwheel). Note that FLIP's output might differ slightly between the different operative systems. The references used for `src/tests/test.py` are made for Windows. While the mean tests (means compared up to six decimal points) pass on each mentioned operative system, not all error map pixels are identical.
11 | - After installation, the tool can be run directly in a shell by `flip --reference reference.{png|exr} --test test.{png|exr}`.
12 | - After installation, the FLIP API is available in Python by `import flip_evaluator as flip`.
13 | - Python version is now built using `scikit` instead of `setuptools`, and uses [nanobind](https://github.com/wjakob/nanobind) instead of [pybind11](https://github.com/pybind/pybind11).
14 | - Directory structure in the FLIP repository has been slightly altered to accomodate the Python version being published to PyPI.
15 | - Updated Python/C++/CUDA test script.
16 | - Various significant bugfixes.
17 |
18 | # Version 1.5 (commit -)
19 | - Skipped version 1.5 due to PyPI-related mistake. Version 1.6 is the same as version 1.5 was supposed to be.
20 |
21 | # Version 1.4 (commits 6265f80 to 0349494)
22 | - Changed the Python version of FLIP so that it leverages the C++ code through [pybind11](https://github.com/pybind/pybind11).
23 | - Results (only evaluation, not including file load/save, etc; measured on an AMD Ryzen Threadripper 3970X 32-Core Processor, 3693 MHz, with 32 Cores and 64 Logical Processors):
24 | - 20-47x faster for LDR/HDR CPU.
25 | - Timings for 1920x1080 images:
26 | - Python/LDR: 77 ms
27 | - Python/HDR: 1007 ms
28 | - **NOTE**: The Python version can currently _not_ run the CUDA version of FLIP (see issue [#22](https://github.com/NVlabs/flip/issues/22)).
29 | - **NOTE**: The Python tool now uses the C++ tool. Compared to before, you will need to change `_` to `-` when calling flip.py (e.g., `python flip.py -r reference.exr -t test.exr --start_exposure 3` is now `python flip.py -r reference.exr -t test.exr --start-exposure 3`; see `python flip.py -h`).
30 | - The Python version of FLIP can now be installed using `pip` (run `pip install -r requirements.txt .` from the `python` folder).
31 | - The code for the C++/CUDA tool is now in `FLIPToolHelpers.h`.
32 | - **NOTE**: The fourth `evaluate()` function in `FLIP.h` now takes two additional arguments: `computeMeanError` and `meanError`. Furthermore, its list of arguments has been partly reordered.
33 | - **NOTE**: The median computation (used for automatic start and stop expsoure computations in HDR-FLIP) in the C++/CUDA code has been changed, sometimes causing a minor change in results but always resulting in a significant speedup. The tests have been updated following this change.
34 | - Timings for 1920x1080 images (only evaluation, not including file load/save, etc, *but* measured with another GPU and including more code than the numbers presented in the v1.2 update, so the numbers are not directly comparable; measured on an AMD Ryzen Threadripper 3970X 32-Core Processor, 3693 MHz, with 32 Cores and 64 Logical Processors and an NVIDIA RTX 4090 GPU):
35 | - CPP/LDR: 86 ms
36 | - CPP/HDR: 1179 ms
37 | - CUDA/LDR: 8 ms
38 | - CUDA/HDR: 131 ms
39 | - Added check for OpenMP for CMake build.
40 | - Overlapped histograms are now available in the C++ tool code. These are created when one reference and _two_ test images are input, together with the `--histogram` flag.
41 | - Text file output are now available in the C++ tool code. These are created when the `--textfile` flag is input.
42 | - The Python and C++ tests now use the same targets.
43 |
44 | # Version 1.3 (commit a00bc7d)
45 | - Changed to CUDA 12.3.
46 | - Rewrote C++ code so that FLIP is in a single header (both CPP/CUDA).
47 | - Rewrote `FLIP-tool.cpp` to use many more local functions to make the code easier to read.
48 | - Some of the `tests/correct_*.png` images have been update due to minor changes in output that occurred as part of switching to CUDA 12.3 and changing the order of some transforms.
49 |
50 | # Version 1.2 (commit dde1eca)
51 | - Changed to CUDA 11.5 (was done after v1.1, but before v1.2).
52 | - Adds tests for C++ and CUDA in the tests-directory.
53 | Additionally, the Python and PyTorch tests were moved to that directory.
54 | - Performance optimizations for C++ and CUDA implementations:
55 | - Uses separable filters.
56 | - Merges several functions/kernels into fewer.
57 | - Uses OpenMP for the CPU.
58 | - Results (not including file load/save):
59 | - 111-124x faster for LDR/HDR CPU (measured on an AMD Ryzen Threadripper 3970X 32-Core Processor, 3693 MHz, with 32 Cores and 64 Logical Processors).
60 | - 2.4-2.8x faster LDR/HDR CUDA (measured on an AMD Ryzen Threadripper 3970X 32-Core Processor, 3693 MHz, with 32 Cores and 64 Logical Processors, together with an NVIDIA RTX 3090).
61 | - Timings for 1920x1080 images:
62 | - CPP/LDR: 63 ms
63 | - CPP/HDR: 1050 ms
64 | - CUDA/LDR: 13 ms
65 | - CUDA/HDR: 136 ms
66 |
67 | # Version 1.1 (commit 4ed59e9)
68 | - NVIDIA Source Code License changed to a BSD 3-Clause License
69 | - Precision updates:
70 | - Constants use nine decimal digits (a float32 number has the same
71 | bit representation if stored with nine or more decimals in NumPy
72 | and C++)
73 | - Increased accuracy in the XYZ2CIELab transform and its inverse in
74 | C++ and CUDA
75 | - Changed reference_illuminant to a float32 array in Python
76 | (reducing LDR-FLIP runtime by almost 30% for a 1080p image)
77 | - Magma and Viridis are indexed into using round instead of floor
78 | - Introduced the constant 1.0 / referenceIlluminant to avoid unnecessary
79 | divisions during color transforms
80 | - Updated the Python reference error maps based on the changes above
81 | - Updated the PyTorch test script based on the changes above
82 | - Expected CUDA version updated from 11.2 to 11.3
83 | - Removed erroneous abs() from the XYZ2CIELab transform in C++ and CUDA
84 | - Added "Acknowledgements" section to the main README file
85 | - A cross platform CMake build was added recently (commit 6bdbbaa)
86 |
87 | # Version 1.0
88 | - Initial release
89 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | #
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 | #
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 | #
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 | #
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | #
29 | # SPDX-FileCopyrightText: Copyright (c) 2020-2024 NVIDIA CORPORATION & AFFILIATES
30 | # SPDX-License-Identifier: BSD-3-Clause
31 | #################################################################################
32 |
33 | [build-system]
34 | requires = ["scikit-build-core >=0.4.3", "nanobind >=1.3.2"]
35 | build-backend = "scikit_build_core.build"
36 |
37 | [project]
38 | name = "flip_evaluator"
39 | version = "1.6.0.1"
40 | description = "A Difference Evaluator for Alternating Images"
41 | readme = "README.md"
42 | requires-python = ">=3.8"
43 | authors = [
44 | { name = "Pontus Ebelin" },
45 | { name = "Tomas Akenine-Möller" }
46 | ]
47 | classifiers = [
48 | "License :: OSI Approved :: BSD License"
49 | ]
50 |
51 | [project.scripts]
52 | flip = "flip_evaluator.flip_python_api:main"
53 |
54 | [project.urls]
55 | Homepage = "https://github.com/nvlabs/flip"
56 |
57 | [tool.cibuildwheel]
58 | build-verbosity = 1
59 | build = ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*"]
60 | test-command = ["flip -h"]
61 |
62 | [tool.cibuildwheel.macos.environment]
63 | MACOSX_DEPLOYMENT_TARGET = "10.15"
64 |
65 | [tool.scikit-build]
66 | minimum-version = "0.4"
67 | sdist.include = ["src/flip_evaluator/__init__.py", "src/flip_evaluator/flip_python_api.py", "src/cpp/FLIP.h", "src/cpp/tool/*.h"]
68 | sdist.exclude = [".github", ".gitignore", "images", "misc", "dist", "*__pycache__*", "src/pytorch", "src/cmake", "src/tests", "src/CMakeLists.txt", "src/python", "src/cpp/FLIP.sln", "src/cpp/CMakeLists.txt", "src/cpp/README.md", "src/cpp/tool/CMakeLists.txt", "src/cpp/tool/CPP.vcxproj*", "src/cpp/tool/CUDA.vcxproj*", "src/cpp/tool/*.cpp", "src/cpp/tool/*.cu"]
69 |
70 | [tool.hatch.metadata.hooks.fancy-pypi-readme]
71 | content-type = "text/markdown"
72 |
73 | build-dir = "build/{wheel_tag}"
74 |
75 | wheel.py-api = "cp312"
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | #
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 | #
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 | #
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 | #
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | #
29 | # SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
30 | # SPDX-License-Identifier: BSD-3-Clause
31 | #################################################################################
32 |
33 | cmake_minimum_required(VERSION 3.9)
34 |
35 | set(CMAKE_DISABLE_SOURCE_CHANGES ON)
36 | set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
37 |
38 | set(CMAKE_CXX_STANDARD 17)
39 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
40 | set(CMAKE_CXX_EXTENSIONS OFF)
41 |
42 | set(CMAKE_BUILD_TYPE_INIT "Release")
43 |
44 | project(flip LANGUAGES CXX)
45 |
46 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
47 | include(GNUInstallDirs)
48 |
49 | option(FLIP_ENABLE_CUDA "Include CUDA version of flip" OFF)
50 |
51 | add_subdirectory(cpp)
52 |
--------------------------------------------------------------------------------
/src/cmake/FLIPConfig.cmake:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | #
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 | #
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 | #
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 | #
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | #
29 | # SPDX-FileCopyrightText: Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES
30 | # SPDX-License-Identifier: BSD-3-Clause
31 | #################################################################################
32 |
33 | if (TARGET FLIP::flip OR FLIP_FOUND)
34 | return()
35 | endif()
36 |
37 | add_library(FLIP::flip INTERFACE IMPORTED)
38 | set_target_properties(FLIP::flip PROPERTIES
39 | INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../cpp"
40 | )
41 |
42 |
--------------------------------------------------------------------------------
/src/cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | #
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 | #
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 | #
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 | #
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | #
29 | # SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
30 | # SPDX-License-Identifier: BSD-3-Clause
31 | #################################################################################
32 |
33 | add_subdirectory(tool)
34 |
--------------------------------------------------------------------------------
/src/cpp/FLIP.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.8.34330.188
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPP", "tool\CPP.vcxproj", "{4B544BFF-EFF8-417A-9F6A-911C4EDB5675}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CUDA", "tool\CUDA.vcxproj", "{F9C72EA1-F42E-4640-8E03-C9AE310AAEB3}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {4B544BFF-EFF8-417A-9F6A-911C4EDB5675}.Debug|x64.ActiveCfg = Debug|x64
17 | {4B544BFF-EFF8-417A-9F6A-911C4EDB5675}.Debug|x64.Build.0 = Debug|x64
18 | {4B544BFF-EFF8-417A-9F6A-911C4EDB5675}.Release|x64.ActiveCfg = Release|x64
19 | {4B544BFF-EFF8-417A-9F6A-911C4EDB5675}.Release|x64.Build.0 = Release|x64
20 | {F9C72EA1-F42E-4640-8E03-C9AE310AAEB3}.Debug|x64.ActiveCfg = Debug|x64
21 | {F9C72EA1-F42E-4640-8E03-C9AE310AAEB3}.Debug|x64.Build.0 = Debug|x64
22 | {F9C72EA1-F42E-4640-8E03-C9AE310AAEB3}.Release|x64.ActiveCfg = Release|x64
23 | {F9C72EA1-F42E-4640-8E03-C9AE310AAEB3}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {59E3C0F7-4245-4A91-8E0A-F1CF8D15FDCA}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/cpp/README.md:
--------------------------------------------------------------------------------
1 | # FLIP: A Tool for Visualizing and Communicating Errors in Rendered Images (v1.6)
2 |
3 | By
4 | [Pontus Ebelin](https://research.nvidia.com/person/pontus-ebelin)
5 | and
6 | [Tomas Akenine-Möller](https://research.nvidia.com/person/tomas-akenine-m%C3%B6ller),
7 | with
8 | Jim Nilsson,
9 | [Magnus Oskarsson](https://www1.maths.lth.se/matematiklth/personal/magnuso/),
10 | [Kalle Åström](https://www.maths.lu.se/staff/kalleastrom/),
11 | [Mark D. Fairchild](https://www.rit.edu/directory/mdfpph-mark-fairchild),
12 | and
13 | [Peter Shirley](https://research.nvidia.com/person/peter-shirley).
14 |
15 | This [repository](https://github.com/NVlabs/flip) holds implementations of the [LDR-FLIP](https://research.nvidia.com/publication/2020-07_FLIP)
16 | and [HDR-FLIP](https://research.nvidia.com/publication/2021-05_HDR-FLIP) image error metrics in C++ and CUDA.
17 | It also holds code for the FLIP tool, presented in [Ray Tracing Gems II](https://www.realtimerendering.com/raytracinggems/rtg2/index.html).
18 |
19 | Note that since v1.2, we use separated convolutions for the C++ and CUDA versions of FLIP. A note explaining those
20 | can be found [here](https://github.com/NVlabs/flip/blob/main/misc/separatedConvolutions.pdf).
21 |
22 | With v1.3, we have switched to a single header [FLIP.h](FLIP.h) for easier integration into other projects.
23 |
24 | Since v1.4, the majority of the code for the tool is contained in [FLIPToolHelpers.h](FLIPToolHelpers.h), but the tool is still run through [FLIP-tool.cpp](FLIP-tool.cpp) and [FLIP-tool.cu](FLIP-tool.cu), respectively.
25 |
26 |
27 | # License
28 |
29 | Copyright © 2020-2025, NVIDIA Corporation & Affiliates. All rights reserved.
30 |
31 | This work is made available under a [BSD 3-Clause License](https://github.com/NVlabs/flip/blob/main/LICENSE).
32 |
33 | The repository distributes code for `tinyexr`, which is subject to a [BSD 3-Clause License](https://github.com/NVlabs/flip/blob/main/misc/LICENSE-third-party.md#bsd-3-clause-license),
34 | and `stb_image`, which is subject to an [MIT License](https://github.com/NVlabs/flip/blob/main/misc/LICENSE-third-party.md#mit-license).
35 |
36 | For individual contributions to the project, please confer the [Individual Contributor License Agreement](https://github.com/NVlabs/flip/blob/main/misc/CLA.md).
37 |
38 | For business inquiries, please visit our website and submit the form: [NVIDIA Research Licensing](https://www.nvidia.com/en-us/research/inquiries/).
39 |
40 | # C++ and CUDA (API and Tool)
41 | - If you want to use FLIP in your own project, it should suffice to use the header [FLIP.h](FLIP.h). Typical usage would be:
42 | ```
43 | #define FLIP_ENABLE_CUDA // You need to define this if you want to run FLIP using CUDA. Otherwise, comment this out.
44 | #include "FLIP.h" // See the bottom of FLIP.h for four different FLIP::evaluate(...) functions that can be used.
45 |
46 | void someFunction()
47 | {
48 | FLIP::evaluate(...); // See FLIP-tool.cpp for an example of how to use one of these overloaded functions.
49 | }
50 | ```
51 | - The FLIP.sln solution contains one CUDA backend project and one pure C++ backend project for the FLIP tool.
52 | - Compiling the CUDA project requires a CUDA compatible GPU. Instruction on how to install CUDA can be found [here](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html).
53 | - Alternatively, a CMake build can be done by creating a build directory in the `src` directory and invoking CMake on the source `cpp` directory (add `--config Release` to build release configuration on Windows):
54 |
55 | ```
56 | cd src
57 | mkdir build
58 | cd build
59 | cmake ..
60 | cmake --build . [--config Release]
61 | ```
62 |
63 | CUDA support is enabled via the `FLIP_ENABLE_CUDA`, which can be passed to CMake on the command line with `-DFLIP_ENABLE_CUDA=ON` or set interactively with `ccmake` or `cmake-gui`.
64 | `FLIP_LIBRARY` option allows to output a library rather than an executable.
65 | - Usage: `flip[-cuda].exe --reference reference.{exr|png} --test test.{exr|png} [options]`, where the list of options can be seen by `flip[-cuda].exe -h`.
66 | - Tested on Windows 10 version 22H2 and Windows 11 version 23H2 with CUDA 12.6. Compiled with Visual Studio 2022. If you use another version of CUDA, you will need to change the `CUDA 12.6` strings in the `CUDA.vcxproj` file accordingly.
67 | - `src/tests/test.py` contains simple tests used to test whether code updates alter results. Notice that those scripts require `numpy` and `matplotlib`, both of which may be installed using pip.
68 | - Weighted histograms are output as Python scripts. Running the script will create a PDF version of the histogram. Like the test script, these scripts require `numpy` and `matplotlib`, both of which may be installed using pip.
69 | - The naming convention used for the FLIP tool's output is as follows (where `ppd` is the assumed number of pixels per degree,
70 | `tm` is the tone mapper assumed by HDR-FLIP, `cstart` and `cstop` are the shortest and longest exposures, respectively, assumed by HDR-FLIP,
71 | with `p` indicating a positive value and `m` indicating a negative value,
72 | `N` is the number of exposures used in the HDR-FLIP calculation, `nnn` is a counter used to sort the intermediate results,
73 | and `exp` is the exposure used for the intermediate LDR image / FLIP map):
74 |
75 | **Default:**
76 |
77 | *Low dynamic range images:*
78 |
79 | LDR-FLIP: `flip...ppd.ldr.png`
80 | Weighted histogram: `weighted_histogram.reference>..ppd.ldr.py`
81 | Overlapping weighted histogram: `overlapping_weighted_histogram....ppd.ldr.py`
82 | Text file: `pooled_values...ppd.ldr.txt`
83 |
84 | *High dynamic range images:*
85 |
86 | HDR-FLIP: `flip...ppd.hdr.._to_..png`
87 | Exposure map: `exposure_map...ppd.hdr.._to_..png`
88 | Intermediate LDR-FLIP maps: `flip...ppd.ldr....png`
89 | Intermediate LDR images: `....png`
90 | Weighted histogram: `weighted_histogram...ppd.hdr.._to_..py`
91 | Overlapping weighted histogram: `overlapping_weighted_histogram....ppd.hdr.._to_..py`
92 | Text file: `pooled_values...ppd.hdr.._to_..txt`
93 |
94 | **With** `--basename ` **(note: not applicable if more than one test image is evaluated):**
95 |
96 | *Low dynamic range images:*
97 |
98 | LDR-FLIP: `.png`
99 | Weighted histogram: `.py`
100 | Overlapping weighted histogram: N/A
101 | Text file: `.txt`
102 |
103 | *High dynamic range images:*
104 |
105 | HDR-FLIP: `.png`
106 | Exposure map: `.exposure_map.png`
107 | Intermediate LDR-FLIP maps: `..png`
108 | Intermediate LDR images: `.reference|test..png`
109 | Weighted histogram: `.py`
110 | Overlapping weighted histogram: N/A
111 | Text file: `.txt`
112 |
113 | **Example usage:**
114 | After compiling the `src/cpp/FLIP.sln` project, navigate to the `flip[-cuda].exe` executable and try:
115 | ```
116 | flip[-cuda].exe -r ../../../images/reference.exr -t ../../../images/test.exr
117 | ```
118 | Assuming using the images in the source bundle, the result should be:
119 | ```
120 | Invoking HDR-FLIP
121 | Pixels per degree: 67
122 | Assumed tone mapper: ACES
123 | Start exposure: -12.5423
124 | Stop exposure: 0.9427
125 | Number of exposures: 14
126 |
127 | FLIP between reference image and test image :
128 | Mean: 0.283478
129 | Weighted median: 0.339430
130 | 1st weighted quartile: 0.251122
131 | 3rd weighted quartile: 0.434673
132 | Min: 0.003123
133 | Max: 0.962022
134 | Evaluation time: seconds
135 | FLIP error map location:
136 | FLIP exposure map location:
137 | ```
138 | where `` is the time it took to evaluate HDR-FLIP. In addition, you will now find the files `flip.reference.test.67ppd.hdr.aces.m12.5423_to_p0.9427.14.png` and `exposure_map.reference.test.67ppd.hdr.aces.m12.5423_to_p0.9427.14.png`
139 | in the directory containing the `flip[-cuda].exe` executable, and we urge you to inspect those, which will reveal where the errors in the test image are located.
140 |
--------------------------------------------------------------------------------
/src/cpp/tool/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | #
4 | # Redistribution and use in source and binary forms, with or without
5 | # modification, are permitted provided that the following conditions are met:
6 | #
7 | # 1. Redistributions of source code must retain the above copyright notice, this
8 | # list of conditions and the following disclaimer.
9 | #
10 | # 2. Redistributions in binary form must reproduce the above copyright notice,
11 | # this list of conditions and the following disclaimer in the documentation
12 | # and/or other materials provided with the distribution.
13 | #
14 | # 3. Neither the name of the copyright holder nor the names of its
15 | # contributors may be used to endorse or promote products derived from
16 | # this software without specific prior written permission.
17 | #
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | #
29 | # SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
30 | # SPDX-License-Identifier: BSD-3-Clause
31 | #################################################################################
32 |
33 | set(FLIP_DIR ${CMAKE_CURRENT_LIST_DIR}/../../cmake)
34 | find_package(FLIP REQUIRED CONFIG) # Exercise CMake config in cmake/ directory
35 |
36 | ## CPU version ##
37 |
38 | project(flip-cli LANGUAGES CXX)
39 | add_executable(${PROJECT_NAME} FLIP-tool.cpp)
40 | target_link_libraries(${PROJECT_NAME} FLIP::flip)
41 | set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME flip)
42 | install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
43 |
44 | find_package(OpenMP)
45 | if (TARGET OpenMP::OpenMP_CXX)
46 | target_link_libraries(${PROJECT_NAME} OpenMP::OpenMP_CXX)
47 | endif()
48 |
49 | ## CUDA version ##
50 |
51 | if (FLIP_ENABLE_CUDA)
52 | project(flip-cuda-cli LANGUAGES CUDA)
53 | add_executable(${PROJECT_NAME} FLIP-tool.cu)
54 | target_link_libraries(${PROJECT_NAME} FLIP::flip)
55 | set_target_properties(${PROJECT_NAME} PROPERTIES
56 | CUDA_ARCHITECTURES OFF
57 | OUTPUT_NAME flip-cuda
58 | )
59 | install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
60 | endif()
61 |
--------------------------------------------------------------------------------
/src/cpp/tool/CPP.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 | 16.0
15 | Win32Proj
16 | {4b544bff-eff8-417a-9f6a-911c4edb5675}
17 | CPP
18 | 10.0
19 |
20 |
21 |
22 | Application
23 | true
24 | v143
25 | Unicode
26 |
27 |
28 | Application
29 | false
30 | v143
31 | true
32 | Unicode
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | true
48 | flip
49 | $(VC_IncludePath);$(WindowsSDK_IncludePath);../
50 |
51 |
52 | false
53 | flip
54 | $(VC_IncludePath);$(WindowsSDK_IncludePath);../
55 |
56 |
57 |
58 | Level3
59 | true
60 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
61 | true
62 | $(ProjectDir);%(AdditionalIncludeDirectories)
63 | true
64 | stdcpp17
65 |
66 |
67 | Console
68 | true
69 |
70 |
71 |
72 |
73 | Level3
74 | true
75 | true
76 | true
77 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
78 | true
79 | $(ProjectDir);%(AdditionalIncludeDirectories)
80 | stdcpp17
81 | true
82 |
83 |
84 |
85 |
86 | Console
87 | true
88 | true
89 | true
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/src/cpp/tool/CPP.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | tool
7 |
8 |
9 | tool
10 |
11 |
12 | tool
13 |
14 |
15 | tool
16 |
17 |
18 | tool
19 |
20 |
21 | tool
22 |
23 |
24 | tool
25 |
26 |
27 | tool
28 |
29 |
30 |
31 |
32 | {d88e6fe1-629c-4cb2-a204-549ed75b0fc0}
33 |
34 |
35 |
36 |
37 | tool
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/cpp/tool/CUDA.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | true
30 | true
31 |
32 |
33 |
34 | {F9C72EA1-F42E-4640-8E03-C9AE310AAEB3}
35 | CUDA
36 | 10.0
37 |
38 |
39 |
40 | Application
41 | true
42 | MultiByte
43 | v143
44 |
45 |
46 | Application
47 | false
48 | true
49 | MultiByte
50 | v143
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | true
65 | flip-cuda
66 | $(VC_IncludePath);$(WindowsSDK_IncludePath);../
67 |
68 |
69 | flip-cuda
70 | $(VC_IncludePath);$(WindowsSDK_IncludePath);../
71 |
72 |
73 |
74 | Level3
75 | Disabled
76 | WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
77 | $(ProjectDir);%(AdditionalIncludeDirectories)
78 | stdcpp17
79 |
80 |
81 | true
82 | Console
83 | cudart_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
84 |
85 |
86 | 64
87 | /std:c++17
88 | --std c++17 %(AdditionalOptions)
89 |
90 |
91 |
92 |
93 | Level3
94 | MaxSpeed
95 | true
96 | true
97 | WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
98 | $(ProjectDir);%(AdditionalIncludeDirectories)
99 | stdcpp17
100 |
101 |
102 | true
103 | true
104 | true
105 | Console
106 | cudart_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
107 |
108 |
109 | 64
110 | /std:c++17
111 | --std c++17 %(AdditionalOptions)
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/src/cpp/tool/CUDA.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | tool
7 |
8 |
9 | tool
10 |
11 |
12 | tool
13 |
14 |
15 | tool
16 |
17 |
18 | tool
19 |
20 |
21 | tool
22 |
23 |
24 | tool
25 |
26 |
27 | tool
28 |
29 |
30 |
31 |
32 | {272613f8-4491-449f-8116-7a1ad0cee96a}
33 |
34 |
35 |
36 |
37 | tool
38 |
39 |
40 |
41 |
42 | tool
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/cpp/tool/FLIP-tool.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation
12 | * and/or other materials provided with the distribution.
13 | *
14 | * 3. Neither the name of the copyright holder nor the names of its
15 | * contributors may be used to endorse or promote products derived from
16 | * this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | *
29 | * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
30 | * SPDX-License-Identifier: BSD-3-Clause
31 | */
32 |
33 | // Visualizing and Communicating Errors in Rendered Images
34 | // Ray Tracing Gems II, 2021,
35 | // by Pontus Andersson, Jim Nilsson, and Tomas Akenine-Moller.
36 | // Pointer to the chapter: https://research.nvidia.com/publication/2021-08_Visualizing-and-Communicating.
37 |
38 | // Visualizing Errors in Rendered High Dynamic Range Images
39 | // Eurographics 2021,
40 | // by Pontus Andersson, Jim Nilsson, Peter Shirley, and Tomas Akenine-Moller.
41 | // Pointer to the paper: https://research.nvidia.com/publication/2021-05_HDR-FLIP.
42 |
43 | // FLIP: A Difference Evaluator for Alternating Images
44 | // High Performance Graphics 2020,
45 | // by Pontus Andersson, Jim Nilsson, Tomas Akenine-Moller,
46 | // Magnus Oskarsson, Kalle Astrom, and Mark D. Fairchild.
47 | // Pointer to the paper: https://research.nvidia.com/publication/2020-07_FLIP.
48 |
49 | // Code by Pontus Ebelin (formerly Andersson), Jim Nilsson, and Tomas Akenine-Moller.
50 |
51 | #include "../FLIP.h"
52 | #include "FLIPToolHelpers.h"
53 | #include "commandline.h"
54 |
55 | int main(int argc, char** argv)
56 | {
57 | commandline commandLine = commandline(argc, argv, getAllowedCommandLineOptions());
58 | FLIPTool::execute(commandLine);
59 | }
60 |
--------------------------------------------------------------------------------
/src/cpp/tool/FLIP-tool.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation
12 | * and/or other materials provided with the distribution.
13 | *
14 | * 3. Neither the name of the copyright holder nor the names of its
15 | * contributors may be used to endorse or promote products derived from
16 | * this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | *
29 | * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
30 | * SPDX-License-Identifier: BSD-3-Clause
31 | */
32 |
33 | // Visualizing and Communicating Errors in Rendered Images
34 | // Ray Tracing Gems II, 2021,
35 | // by Pontus Andersson, Jim Nilsson, and Tomas Akenine-Moller.
36 | // Pointer to the chapter: https://research.nvidia.com/publication/2021-08_Visualizing-and-Communicating.
37 |
38 | // Visualizing Errors in Rendered High Dynamic Range Images
39 | // Eurographics 2021,
40 | // by Pontus Andersson, Jim Nilsson, Peter Shirley, and Tomas Akenine-Moller.
41 | // Pointer to the paper: https://research.nvidia.com/publication/2021-05_HDR-FLIP.
42 |
43 | // FLIP: A Difference Evaluator for Alternating Images
44 | // High Performance Graphics 2020,
45 | // by Pontus Andersson, Jim Nilsson, Tomas Akenine-Moller,
46 | // Magnus Oskarsson, Kalle Astrom, and Mark D. Fairchild.
47 | // Pointer to the paper: https://research.nvidia.com/publication/2020-07_FLIP.
48 |
49 | // Code by Pontus Ebelin (formerly Andersson), Jim Nilsson, and Tomas Akenine-Moller.
50 |
51 | #define FLIP_ENABLE_CUDA // Let FLIP.h know that we want the CUDA implementation.
52 | #include "FLIP-tool.cpp" // This was done so that all code could be shared between the CPU and CUDA versions of the tool.
--------------------------------------------------------------------------------
/src/cpp/tool/commandline.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation
12 | * and/or other materials provided with the distribution.
13 | *
14 | * 3. Neither the name of the copyright holder nor the names of its
15 | * contributors may be used to endorse or promote products derived from
16 | * this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | *
29 | * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES
30 | * SPDX-License-Identifier: BSD-3-Clause
31 | */
32 |
33 | // Visualizing and Communicating Errors in Rendered Images
34 | // Ray Tracing Gems II, 2021,
35 | // by Pontus Andersson, Jim Nilsson, and Tomas Akenine-Moller.
36 | // Pointer to the chapter: https://research.nvidia.com/publication/2021-08_Visualizing-and-Communicating.
37 |
38 | // Visualizing Errors in Rendered High Dynamic Range Images
39 | // Eurographics 2021,
40 | // by Pontus Andersson, Jim Nilsson, Peter Shirley, and Tomas Akenine-Moller.
41 | // Pointer to the paper: https://research.nvidia.com/publication/2021-05_HDR-FLIP.
42 |
43 | // FLIP: A Difference Evaluator for Alternating Images
44 | // High Performance Graphics 2020,
45 | // by Pontus Andersson, Jim Nilsson, Tomas Akenine-Moller,
46 | // Magnus Oskarsson, Kalle Astrom, and Mark D. Fairchild.
47 | // Pointer to the paper: https://research.nvidia.com/publication/2020-07_FLIP.
48 |
49 | // Code by Pontus Ebelin (formerly Andersson), Jim Nilsson, and Tomas Akenine-Moller.
50 |
51 | #pragma once
52 |
53 | #include