hc
2025-02-14 bbb9540dc49f70f6b703d1c8d1b85fa5f602d86e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * rk_aiq_user_api2_camgroup.h
 *
 *  Copyright (c) 2021 Rockchip Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
 
#ifndef RK_AIQ_USER_API2_CAMGROUP_H
#define RK_AIQ_USER_API2_CAMGROUP_H
 
#include "rk_aiq.h"
#include "rk_aiq_algo_des.h"
#include "rk_aiq_user_api2_sysctl.h"
#include "rk_aiq_user_api_common.h"
 
/*****************************************
 * Useage examples
 *
 * 1) create single cam ctxs
 * sns_ctx1 = rk_aiq_uapi2_sysctl_init (ent_name_sns1,...);
 * sns_ctx2 = rk_aiq_uapi2_sysctl_init (ent_name_sns2,...);
 * sns_ctx3 = rk_aiq_uapi2_sysctl_init (ent_name_sns3,...);
 *
 * 2) create cam group ctx, and add single cam's ctx to group
 * camgroup_ctx = rk_aiq_uapi2_camgroup_create(cfg);
 * // will control the life cycle of sns_ctx till unbind
 * rk_aiq_uapi2_camgroup_bind(camgroup_ctx, sns_ctx_array, 3);
 *
 * 3) prepare camgroup, will prepare each single cam internal
 * rk_aiq_uapi2_camgroup_prepare(camgroup_ctx)
 *
 * 4) start camgroup, will prepare each single cam internal
 * rk_aiq_uapi2_camgroup_start(camgroup_ctx)
 *
 *   running single AIQ and group cams algo
 *
 * 5) stop camgroup, will stop each single cam internal
 * rk_aiq_uapi2_camgroup_stop(camgroup_ctx)
 * 5.1) may unbind, the unbinded cam's life cycle will not controlled by cam group 
 *  rk_aiq_uapi2_camgroup_unbind 
 * 6) destroy camgroup, will deinit each single cam
 * rk_aiq_uapi2_camgroup_destroy(camgroup_ctx)
 * 6.1) may call unbinded cam's deinit 
 
 ****************************************/
 
RKAIQ_BEGIN_DECLARE
 
typedef struct rk_aiq_camgroup_ctx_s rk_aiq_camgroup_ctx_t;
 
typedef struct rk_aiq_camgroup_instance_cfg_s {
    const char* sns_ent_nm_array[RK_AIQ_CAM_GROUP_MAX_CAMS];
    int sns_num;
    const char* config_file_dir;
    /* followings are relative path to config_file_dir */
    const char* single_iq_file;
    const char* group_iq_file;
    const char* overlap_map_file;
    rk_aiq_hwevt_cb pHwEvt_cb;
    void* pHwEvtCbCtx;
} rk_aiq_camgroup_instance_cfg_t;
 
typedef struct rk_aiq_camgroup_camInfos_s {
    int valid_sns_num;
    const char* sns_ent_nm[RK_AIQ_CAM_GROUP_MAX_CAMS];
    int sns_camPhyId[RK_AIQ_CAM_GROUP_MAX_CAMS];
} rk_aiq_camgroup_camInfos_t;
 
rk_aiq_camgroup_ctx_t*
rk_aiq_uapi2_camgroup_create(rk_aiq_camgroup_instance_cfg_t* cfg);
 
struct RK_PS_SrcOverlapMap*
rk_aiq_uapi2_camgroup_getOverlapMap(rk_aiq_camgroup_ctx_t* camgroup_ctx);
 
XCamReturn
rk_aiq_uapi2_camgroup_getOverlapMap_from_file(const char* map_file, struct RK_PS_SrcOverlapMap** overlapMap);
 
rk_aiq_sys_ctx_t*
rk_aiq_uapi2_camgroup_getAiqCtxBySnsNm(rk_aiq_camgroup_ctx_t* camgroup_ctx, const char* sns_entity_name);
 
XCamReturn
rk_aiq_uapi2_camgroup_bind(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_sys_ctx_t** ctx, int num);
 
XCamReturn
rk_aiq_uapi2_camgroup_unbind(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_sys_ctx_t** ctx, int num);
 
XCamReturn
rk_aiq_uapi2_camgroup_prepare(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_working_mode_t mode);
 
XCamReturn
rk_aiq_uapi2_camgroup_start(rk_aiq_camgroup_ctx_t* camgroup_ctx);
 
XCamReturn
rk_aiq_uapi2_camgroup_stop(rk_aiq_camgroup_ctx_t* camgroup_ctx);
 
XCamReturn
rk_aiq_uapi2_camgroup_destroy(rk_aiq_camgroup_ctx_t* camgroup_ctx);
 
XCamReturn
rk_aiq_uapi2_camgroup_getCamInfos(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_camgroup_camInfos_t* camInfos);
 
RKAIQ_END_DECLARE
 
#endif