• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HOS_CAMERA_IPP_NODE_H
17 #define HOS_CAMERA_IPP_NODE_H
18 
19 #include "node_base.h"
20 #include "camera.h"
21 #include "offline_pipeline.h"
22 #include "algo_plugin_manager.h"
23 #include "algo_plugin.h"
24 
25 namespace OHOS::Camera {
26 class IppNode : public NodeBase, public OfflinePipeline {
27 public:
28     IppNode(const std::string& name, const std::string& type);
29     ~IppNode();
30     virtual RetCode Init(const int32_t streamId) override;
31     virtual RetCode Start(const int32_t streamId) override;
32     virtual RetCode Stop(const int32_t streamId) override;
33     virtual RetCode Flush(const int32_t streamId) override;
34     virtual RetCode Config(const int32_t streamId, const CaptureMeta& meta) override;
35     virtual void DeliverBuffer(std::shared_ptr<IBuffer>& buffer) override;
36     virtual void DeliverBuffers(std::vector<std::shared_ptr<IBuffer>>& buffers) override;
37     virtual void ProcessCache(std::vector<std::shared_ptr<IBuffer>>& buffers) override;
38     virtual void DeliverCache(std::vector<std::shared_ptr<IBuffer>>& buffers) override;
39     virtual void DeliverCancelCache(std::vector<std::shared_ptr<IBuffer>>& buffers) override;
40 
41 protected:
42     RetCode GetOutputBuffer(std::vector<std::shared_ptr<IBuffer>>& buffers, std::shared_ptr<IBuffer>& outBuffer);
43     void DeliverAlgoProductBuffer(std::shared_ptr<IBuffer>& result);
44     void ClassifyOutputBuffer(std::shared_ptr<IBuffer>& outBuffer,
45                               std::vector<std::shared_ptr<IBuffer>>& inBuffers,
46                               std::shared_ptr<IBuffer>& product,
47                               std::vector<std::shared_ptr<IBuffer>>& recycleBuffers);
48 
49 protected:
50     std::shared_ptr<AlgoPluginManager> algoPluginManager_ = nullptr;
51     std::shared_ptr<AlgoPlugin> algoPlugin_ = nullptr;
52 };
53 } // namespace OHOS::Camera
54 
55 #endif
56