2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef ML_ML_PIPELINE_CUSTOM_FILTER_H_
18 #define ML_ML_PIPELINE_CUSTOM_FILTER_H_
23 #include <unordered_map>
25 #include <nnstreamer/nnstreamer.h>
27 #include "common/extension.h"
28 #include "common/platform_result.h"
30 #include "ml_tensors_data_manager.h"
31 #include "ml_tensors_info_manager.h"
33 using common::PlatformResult;
41 static PlatformResult CreateAndRegisterCustomFilter(
42 const std::string& name, const std::string& listener_name,
43 TensorsInfo* input_tensors_info_ptr, TensorsInfo* output_tensors_info_ptr,
44 common::Instance* instance_ptr, TensorsInfoManager* tensors_info_manager_ptr,
45 TensorsDataManager* tensors_data_manager_ptr, std::unique_ptr<CustomFilter>* out);
49 PlatformResult Unregister();
51 CustomFilter(const CustomFilter&) = delete;
52 CustomFilter& operator=(const CustomFilter&) = delete;
55 CustomFilter(const std::string& name, const std::string& listener_name,
56 TensorsInfo* input_tensors_info, TensorsInfo* output_tensors_info,
57 common::Instance* instance_ptr, TensorsInfoManager* tensors_info_manager_ptr,
58 TensorsDataManager* tensors_data_manager_ptrr,
59 const std::thread::id& main_thread_id);
61 static int CustomFilterListener(const ml_tensors_data_h tensors_data_in,
62 ml_tensors_data_h tensors_data_out, void* user_data);
64 const std::string name_;
65 const std::string listener_name_;
66 TensorsInfo* input_tensors_info_ptr_;
67 TensorsInfo* output_tensors_info_ptr_;
68 ml_custom_easy_filter_h custom_filter_;
69 common::Instance* instance_ptr_;
70 TensorsInfoManager* tensors_info_manager_ptr_;
71 TensorsDataManager* tensors_data_manager_ptr_;
73 std::thread::id main_thread_id_;
76 } // namespace pipeline
78 } // namespace extension
80 #endif // ML_ML_PIPELINE_CUSTOM_FILTER_H_