PICCANTE  0.4
The hottest HDR imaging library!
pu_encode.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_METRICS_PU_ENCODE_HPP
19 #define PIC_METRICS_PU_ENCODE_HPP
20 
21 #include <math.h>
22 
23 #include "../base.hpp"
24 #include "../image.hpp"
25 #include "../util/array.hpp"
26 
27 #include "../metrics/pu_encode_data.hpp"
28 
29 namespace pic {
30 
37 float PUEncode(float L)
38 {
39  return Arrayf::interp(C_PU_x, C_PU_y, 256, log10f(L + 1e-7f));
40 }
41 
47 float PUDecode(float p)
48 {
49  return powf(10.0f, Arrayf::interp(C_PU_y, C_PU_x, 256, p));
50 }
51 
52 } // end namespace pic
53 
54 #endif /* PIC_METRICS_PU_ENCODE_HPP */
55 
static T interp(T *x, T *y, int size, T xval)
interp linearly interpolates x and y data
Definition: array.hpp:569
float C_PU_y[256]
Definition: pu_encode_data.hpp:288
float C_PU_x[256]
Definition: pu_encode_data.hpp:29
float PUEncode(float L)
PUEncode encodes luminance values in a perceptually uniform space.
Definition: pu_encode.hpp:37
Definition: bilateral_separation.hpp:25
float PUDecode(float p)
PUDecode decodes perceptually uniform values into luminance values.
Definition: pu_encode.hpp:47