PICCANTE  0.4
The hottest HDR imaging library!
buffer_ops.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_GL_BUFFER_OPS_HPP
19 #define PIC_UTIL_GL_BUFFER_OPS_HPP
20 
21 #include <vector>
22 #include <map>
23 #include <thread>
24 #include <mutex>
25 
26 #include "../../base.hpp"
27 
28 #include "../../util/gl/buffer_op.hpp"
29 
30 namespace pic {
31 
36 
37 typedef std::vector<BufferOpGL*> BufferOperatorsGL;
38 
43 {
44 public:
46 
52  {
53  std::thread::id this_id = std::this_thread::get_id();
54 
55  if(!flag[this_id]) {
56  std::lock_guard<std::mutex> lock(mutex);
57 
58  if(buffer_ops_gl[this_id] == NULL) {
59  buffer_ops_gl[this_id] = new BufferOpsGL();
60  flag[this_id] = true;
61  }
62  }
63 
64  return buffer_ops_gl[this_id];
65  }
66 
68  {
69  }
70 
71 private:
72  static std::mutex mutex;
73  static std::map<std::thread::id, bool> flag;
74  static std::map<std::thread::id, BufferOpsGL*> buffer_ops_gl;
75 
79  BufferOpsGL()
80  {
81  list.push_back(new BufferOpGL("I0 + I1", true));
82  list.push_back(new BufferOpGL("I0 - I1", true));
83  list.push_back(new BufferOpGL("I0 * I1", true));
84  list.push_back(new BufferOpGL("I0 / I1", true));
85 
86  list.push_back(new BufferOpGL("I0 + C0", true));
87  list.push_back(new BufferOpGL("I0 - C0", true));
88  list.push_back(new BufferOpGL("I0 * C0", true));
89  list.push_back(new BufferOpGL("I0 / C0", true));
90 
91  list.push_back(new BufferOpGL("I0 + I1x", true));
92  list.push_back(new BufferOpGL("I0 - I1x", true));
93  list.push_back(new BufferOpGL("I0 * I1x", true));
94  list.push_back(new BufferOpGL("I0 / I1x", true));
95 
96  list.push_back(new BufferOpGL("clamp(I0, C0, C1)", true));
97 
98  list.push_back(new BufferOpGL("I1", true));
99  list.push_back(new BufferOpGL("C0", true));
100  }
101 
102 };
103 
104 std::mutex BufferOpsGL::mutex;
105 
106 std::map<std::thread::id, bool> BufferOpsGL::flag;
107 
108 std::map<std::thread::id, BufferOpsGL*> BufferOpsGL::buffer_ops_gl;
109 
110 } // end namespace pic
111 
112 #endif /* PIC_UTIL_GL_BUFFER_OPS_HPP */
The BufferOpGL class.
Definition: buffer_op.hpp:34
Definition: buffer_ops.hpp:35
Definition: buffer_ops.hpp:34
static BufferOpsGL * getInstance()
getInstance
Definition: buffer_ops.hpp:51
Definition: buffer_ops.hpp:32
Definition: buffer_ops.hpp:34
Definition: buffer_ops.hpp:33
BufferOperatorsGL list
Definition: buffer_ops.hpp:45
Definition: buffer_ops.hpp:35
BOGL
Definition: buffer_ops.hpp:32
Definition: buffer_ops.hpp:34
Definition: buffer_ops.hpp:33
Definition: buffer_ops.hpp:35
Definition: buffer_ops.hpp:33
Definition: buffer_ops.hpp:32
Definition: buffer_ops.hpp:34
The BufferOpsGL class.
Definition: buffer_ops.hpp:42
Definition: bilateral_separation.hpp:25
Definition: buffer_ops.hpp:33
Definition: buffer_ops.hpp:32
Definition: buffer_ops.hpp:32
std::vector< BufferOpGL * > BufferOperatorsGL
Definition: buffer_ops.hpp:37
~BufferOpsGL()
Definition: buffer_ops.hpp:67