xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/algos/aeis/eis_loader.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * algo_loader.h - The dynamic loads algorithm library
3  *
4  *  Copyright (c) 2021 Rockchip Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Author: Cody Xie <cody.xie@rock-chips.com>
19  */
20 #ifndef ALGOS_AEIS_EIS_LOADER_H
21 #define ALGOS_AEIS_EIS_LOADER_H
22 
23 #include <string>
24 
25 #include "dvs_app.h"
26 #include "rk_aiq_mems_sensor.h"
27 
28 namespace RkCam {
29 
30 using dvsRegisterRemap   = int (*)(struct dvsEngine* engine, dvsFrameCallBackFEC callback);
31 using dvsPrepare         = int (*)(struct dvsEngine* engine);
32 using getMeshSize        = void (*)(int image_height, int image_width, int* mesh_size);
33 using getOriginalMeshXY  = void (*)(int image_width, int image_height, double clip_ratio_x, double clip_ratio_y, meshxyFEC* pmesh_fec);
34 using dvsPutImageFrame   = int (*)(struct dvsEngine* engine, struct imageData* pimage_data);
35 using dvsPutMesh         = int (*)(struct dvsEngine* engine, struct meshxyFEC* pmesh_fec);
36 using dvsPutImuFrame     = int (*)(struct dvsEngine* engine, mems_sensor_event_s* pimu_data,
37                                int buff_number);
38 using dvsInitFromXmlFile = int (*)(struct dvsEngine* engine, const char* path);
39 using dvsInitParams      = int (*)(struct dvsEngine* engine, struct initialParams* init_params);
40 using dvsStart           = int (*)(struct dvsEngine* engine);
41 using dvsRequestStop     = int (*)(struct dvsEngine* engine);
42 using dvsDeinit          = int (*)(struct dvsEngine* engine);
43 
44 struct DvsOps {
45     dvsRegisterRemap RegisterRemap;
46     dvsPrepare Prepare;
47     getMeshSize GetMeshSize;
48     getOriginalMeshXY GetOriginalMeshXY;
49     dvsPutImageFrame PutImageFrame;
50     dvsPutMesh PutMesh;
51     dvsPutImuFrame PutImuFrame;
52     dvsInitFromXmlFile InitFromXmlFile;
53     dvsInitParams InitParams;
54     dvsStart Start;
55     dvsRequestStop RequestStop;
56     dvsDeinit DeInit;
57 };
58 
59 class DvsLibrary {
60  public:
61     DvsLibrary() = default;
62     virtual ~DvsLibrary();
63 
64     bool Init();
65     bool LoadSymbols();
66 
67     DvsOps* GetOps();
68 
69  private:
70     void* handle_;
71     DvsOps ops_;
72 };
73 
74 }  // namespace RkCam
75 
76 #endif  // ALGOS_AEIS_EIS_LOADER_H
77