---
title: 'HDR+'
disqus: hackmd
---
HDR+ installation steps (2022/11/07)
===
Original content: https://github.com/timothybrooks/hdr-plus
Environment: Ubuntu-20.04
## Table of Contents
[TOC]
## Upgrade CMake (if needed)
```gherkin=
$ sudo apt purge cmake
$ wget https://github.com/Kitware/CMake/releases/download/v3.25.0-rc2/cmake-3.25.0-rc2.tar.gz
$ tar zxvf cmake-3.25.0-rc2.tar.gz
$ cd cmake-3.25.0-rc2
$ sudo ./bootstrap
$ sudo make
$ sudo make install
$ cmake --version
```
Check out the [latest version of CMake](https://cmake.org/download/)
If seeing the following error while checking version:
```gherkin=
/usr/bin/cmake: No such file or directory
```
Then we need to let OS recognize we've already install CMake by doing:
```gherkin=
sudo cp ./cmake-3.25.0-rc2/bin/cmake /usr/bin/
```
[Source](https://stackoverflow.com/questions/49859457/how-to-reinstall-the-latest-cmake-version)
## Download required packages / LLVM
Packages
```bash=
$ sudo apt install -y nasm
$ sudo apt install -y libraw-dev
$ sudo apt install -y libpng-dev
$ sudo apt install -y libjpeg-dev
$ sudo apt install -y libtiff-dev
$ sudo apt install -y libssl-dev
```
Instructions below support for <font color="red">Ubuntu-20.04</font> but not <font color="red">Ubuntu-20.04.5</font>.
<font color="red">To build Halide10 from source, LLVM10 is required.</font>
Check out [LLVM](https://apt.llvm.org/) for more details.
```bash=
$ wget https://apt.llvm.org/llvm.sh
$ chmod +x llvm.sh
$ sudo ./llvm.sh <version number>
# at least >= 3.9
# 15.0.4 is fine for this project
# ignore version number to download the latest version
```
## Download Halide 10.0.0
<font color="red">This binary does not enable RISCV!</font>
```bash=
$ sudo wget https://github.com/halide/Halide/releases/download/v10.0.0/Halide-10.0.0-x86-64-linux-db901f7f7084025abc3cbb9d17b0f2d3f1745900.tar.gz
$ tar zxvf Halide-10.0.0-x86-64-linux-db901f7f7084025abc3cbb9d17b0f2d3f1745900.tar.gz
```
[Halide download page](https://github.com/halide/Halide/releases?page=2)
(We don't need the latest version because it's not supported yet)
## Building hdr-plus
```bash=
$ git clone https://github.com/timothybrooks/hdr-plus
$ cd hdr-plus
$ mkdir build
$ cd build
$ cmake -DHALIDE_DISTRIB_DIR=$(Insert halide directory)
$(-DCMAKE_BUILD_TYPE=Debug) .. #add this line for debug purpose.
$ make -j$(nproc)
```
## HDR+ examples / usage
http://www.gardling.com/hdr_plus
```bash=
#Usage
$ ./hdrplus [-c comp -g gain (optional)] dir_path out_img_name raw_img1 raw_img2 [...]
```
The -c and -g flags change the amount of dynamic range compression and gain respectively. Although they are optional because they both have default values.
## Build LLVM10 from source
http://www.gardling.com/hdr_plus
```bash=
#Usage
$ ./hdrplus [-c comp -g gain (optional)] dir_path out_img_name raw_img1 raw_img2 [...]
```
The -c and -g flags change the amount of dynamic range compression and gain respectively. Although they are optional because they both have default values.
---