Dewobble
Video motion stabilization with awareness of lens projection
filter_base.hpp
1 #ifndef DEWOBBLE_FILTER_BASE_HPP
2 #define DEWOBBLE_FILTER_BASE_HPP
3 
4 #include <CL/opencl.hpp>
5 #include <opencv2/core.hpp>
6 #include <queue>
7 
8 #include "filter_config.hpp"
9 
10 namespace dewobble
11 {
12 
19 {
20  FilterConfig m_config;
21  std::queue<cl_mem> m_preallocated_input_buffers;
22  std::queue<cl_mem> m_preallocated_output_buffers;
23  cl_mem get_frame_buffer(
24  std::queue<cl_mem> &preallocated_buffers,
25  cl_mem_flags flags);
26  void free_preallocated_buffers(std::queue<cl_mem> &preallocated_buffers);
27  void release_frame_buffer(
28  std::queue<cl_mem> &preallocated_buffers,
29  cl_mem *output_buffer);
30 
31  protected:
37  virtual cl_mem get_output_frame_buffer();
38 
39  public:
44  virtual ~FilterBase();
50  virtual cl_mem get_input_frame_buffer();
51 
58  virtual void release_input_frame_buffer(cl_mem *input_buffer);
59 
70  virtual void push_frame(cl_mem input_buffer, void *extra) = 0;
71 
76  virtual void end_input() = 0;
77 
82  virtual bool frame_ready() = 0;
83 
91  virtual void release_output_frame_buffer(cl_mem *output_buffer);
92 
102  virtual void
103  pull_frame(cl_mem *output_buffer, cl_mem *input_buffer, void **extra) = 0;
104 };
105 } // namespace dewobble
106 
107 #endif // DEWOBBLE_FILTER_BASE_HPP
Definition: filter_base.hpp:19
FilterBase(FilterConfig config)
virtual void release_input_frame_buffer(cl_mem *input_buffer)
virtual void pull_frame(cl_mem *output_buffer, cl_mem *input_buffer, void **extra)=0
virtual bool frame_ready()=0
virtual void push_frame(cl_mem input_buffer, void *extra)=0
virtual void end_input()=0
virtual void release_output_frame_buffer(cl_mem *output_buffer)
virtual cl_mem get_output_frame_buffer()
virtual cl_mem get_input_frame_buffer()
Definition: filter_config.hpp:83