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_ALGO_PLUGIN_H 17 #define HOS_CAMERA_ALGO_PLUGIN_H 18 19 #include "camera.h" 20 #include "camera_metadata_info.h" 21 #include "ibuffer.h" 22 #include "ipp_algo.h" 23 #include <memory> 24 #include <string> 25 #include <vector> 26 27 namespace OHOS::Camera { 28 class AlgoPlugin { 29 public: 30 AlgoPlugin(); 31 ~AlgoPlugin(); 32 AlgoPlugin(std::string name, std::string description, int mode, std::string path); 33 34 int GetMode() const; 35 RetCode LoadLib(); 36 RetCode UnloadLib(); 37 RetCode Init(std::shared_ptr<CameraMetadata> meta); 38 RetCode Start(); 39 RetCode Flush(); 40 RetCode Process(std::shared_ptr<IBuffer>& outBuffer, 41 std::vector<std::shared_ptr<IBuffer>>& inBuffers, 42 std::shared_ptr<CameraMetadata>& meta); 43 RetCode Stop(); 44 std::string GetName() const; 45 46 private: 47 RetCode CheckLibPath(const char *path); 48 49 public: 50 struct IppAlgoHandler { 51 void* handle; 52 IppAlgoFunc func; 53 }; 54 55 private: 56 std::string path_ = ""; 57 std::string desc_ = ""; 58 std::string name_ = ""; 59 int mode_ = -1; 60 IppAlgoHandler* algoHandler_ = nullptr; 61 }; 62 } // namespace OHOS::Camera 63 #endif 64