PICCANTE  0.4
The hottest HDR imaging library!
cached_table.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_UTIL_CACHED_TABLE_HPP
19 #define PIC_UTIL_CACHED_TABLE_HPP
20 
21 namespace pic {
22 
27 {
28 public:
29  int n;
30  float COS_TABLE[512];
31  float SIN_TABLE[512];
32  float *PATCH;
34 
41  CachedTable(int patchSize, int width, int height)
42  {
43  n = 512;
44  float C_PI_2_inv_n = C_PI_2 / float(n);
45 
46  for(int i = 0; i < n; i++) {
47  float value = float(i) * C_PI_2_inv_n;
48 
49  COS_TABLE[i] = cosf(value);
50  SIN_TABLE[i] = sinf(value);
51  }
52 
53  PATCH = new float [patchSize + 1];
54  int halfPatchSize = patchSize >> 1;
55 
56  for(int i = -halfPatchSize; i <= halfPatchSize; i++) {
57  PATCH[i + halfPatchSize] = float(i);
58  }
59 
60  inv_width = 1.0f / float(width - 1);
61  inv_height = 1.0f / float(height - 1);
62 
63  }
64 };
65 
66 } // end namespace pic
67 
68 #endif /* PIC_UTIL_CACHED_TABLE_HPP */
69 
float COS_TABLE[512]
Definition: cached_table.hpp:30
float inv_width
Definition: cached_table.hpp:33
CachedTable(int patchSize, int width, int height)
CachedTable creates a precomputed table of sin and cos values.
Definition: cached_table.hpp:41
const float C_PI_2
Definition: math.hpp:52
float SIN_TABLE[512]
Definition: cached_table.hpp:31
float inv_height
Definition: cached_table.hpp:33
The CachedTable class.
Definition: cached_table.hpp:26
int n
Definition: cached_table.hpp:29
Definition: bilateral_separation.hpp:25
float * PATCH
Definition: cached_table.hpp:32