processing-blocks-factory.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 
5 
6 #include "sse/sse-align.h"
7 #include "cuda/cuda-align.h"
8 
9 #include "stream.h"
10 
11 namespace librealsense
12 {
13 #ifdef RS2_USE_CUDA
14  std::shared_ptr<librealsense::align> create_align(rs2_stream align_to)
15  {
16  return std::make_shared<librealsense::align_cuda>(align_to);
17  }
18 #else
19 #ifdef __SSSE3__
20  std::shared_ptr<librealsense::align> create_align(rs2_stream align_to)
21  {
22  return std::make_shared<librealsense::align_sse>(align_to);
23  }
24 #else // No optimizations
25  std::shared_ptr<librealsense::align> create_align(rs2_stream align_to)
26  {
27  return std::make_shared<librealsense::align>(align_to);
28  }
29 #endif // __SSSE3__
30 #endif // RS2_USE_CUDA
31 
32  processing_block_factory::processing_block_factory(const std::vector<stream_profile>& from, const std::vector<stream_profile>& to, std::function<std::shared_ptr<processing_block>(void)> generate_func) :
33  _source_info(from), _target_info(to), generate_processing_block(generate_func)
34  {}
35 
36  std::shared_ptr<processing_block> processing_block_factory::generate()
37  {
39  }
40 
42  {
43  processing_block_factory id_pbf = {
44  { {format} },
45  { {format, stream, idx} },
46  []() { return std::make_shared<identity_processing_block>(); }
47  };
48  return id_pbf;
49  }
50 
52  {
53  const auto&& rhs_src = rhs.get_source_info();
54  for (auto&& src : _source_info)
55  {
56  auto equals = [&src](const stream_profile& prof) { return prof == src; };
57  if (std::none_of(begin(rhs_src), end(rhs_src), equals))
58  return false;
59  }
60 
61  const auto&& rhs_tgt = rhs.get_target_info();
62  for (auto&& tgt : _target_info)
63  {
64  auto equals = [&tgt](const stream_profile& prof) { return prof == tgt; };
65  if (std::none_of(begin(rhs_tgt), end(rhs_tgt), equals))
66  return false;
67  }
68 
69  return true;
70  }
71 
72  bool processing_block_factory::has_source(const std::shared_ptr<stream_profile_interface>& source) const
73  {
74  for (auto s : _source_info)
75  {
76  if (source->get_format() == s.format)
77  return true;
78  }
79  return false;
80  }
81 
83  {
84  // Return all requests which are related to this processing block factory.
85 
86  stream_profiles satisfied_req;
87  for (auto&& req : requests)
88  {
89  auto equal_profiles_predicate = [&req](const std::shared_ptr<stream_profile_interface>& sp) {
90  return to_profile(req.get()) == to_profile(sp.get());
91  };
92  if (std::any_of(begin(supported_profiles), end(supported_profiles), equal_profiles_predicate))
93  satisfied_req.push_back(req);
94  }
95  return satisfied_req;
96  }
97 }
GLuint GLuint end
GLdouble s
bool has_source(const std::shared_ptr< stream_profile_interface > &source) const
GLuint GLuint stream
Definition: glext.h:1790
GLenum src
Definition: glext.h:1751
bool operator==(const processing_block_factory &rhs) const
not_this_one begin(...)
std::function< std::shared_ptr< processing_block >void)> generate_processing_block
GLint GLint GLsizei GLint GLenum format
static processing_block_factory create_id_pbf(rs2_format format, rs2_stream stream, int idx=0)
rs2_format
A stream&#39;s format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:59
std::vector< stream_profile > get_target_info() const
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
Definition: streaming.h:165
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:42
stream_profile to_profile(const stream_profile_interface *sp)
Definition: src/stream.h:185
std::shared_ptr< librealsense::align > create_align(rs2_stream align_to)
std::vector< stream_profile > get_source_info() const
GLsizei GLsizei GLchar * source
std::shared_ptr< processing_block > generate()
stream_profiles find_satisfied_requests(const stream_profiles &sp, const stream_profiles &supported_profiles) const


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:39