1 /* 2 * rk_aiq_user_api2_camgroup.h 3 * 4 * Copyright (c) 2021 Rockchip Corporation 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 */ 19 20 #ifndef RK_AIQ_USER_API2_CAMGROUP_H 21 #define RK_AIQ_USER_API2_CAMGROUP_H 22 23 #include "rk_aiq.h" 24 #include "rk_aiq_algo_des.h" 25 #include "rk_aiq_user_api2_sysctl.h" 26 #include "rk_aiq_user_api_common.h" 27 28 /***************************************** 29 * Useage examples 30 * 31 * 1) create single cam ctxs 32 * sns_ctx1 = rk_aiq_uapi2_sysctl_init (ent_name_sns1,...); 33 * sns_ctx2 = rk_aiq_uapi2_sysctl_init (ent_name_sns2,...); 34 * sns_ctx3 = rk_aiq_uapi2_sysctl_init (ent_name_sns3,...); 35 * 36 * 2) create cam group ctx, and add single cam's ctx to group 37 * camgroup_ctx = rk_aiq_uapi2_camgroup_create(cfg); 38 * // will control the life cycle of sns_ctx till unbind 39 * rk_aiq_uapi2_camgroup_bind(camgroup_ctx, sns_ctx_array, 3); 40 * 41 * 3) prepare camgroup, will prepare each single cam internal 42 * rk_aiq_uapi2_camgroup_prepare(camgroup_ctx) 43 * 44 * 4) start camgroup, will prepare each single cam internal 45 * rk_aiq_uapi2_camgroup_start(camgroup_ctx) 46 * 47 * running single AIQ and group cams algo 48 * 49 * 5) stop camgroup, will stop each single cam internal 50 * rk_aiq_uapi2_camgroup_stop(camgroup_ctx) 51 * 5.1) may unbind, the unbinded cam's life cycle will not controlled by cam group 52 * rk_aiq_uapi2_camgroup_unbind 53 * 6) destroy camgroup, will deinit each single cam 54 * rk_aiq_uapi2_camgroup_destroy(camgroup_ctx) 55 * 6.1) may call unbinded cam's deinit 56 57 ****************************************/ 58 59 RKAIQ_BEGIN_DECLARE 60 61 typedef struct rk_aiq_camgroup_ctx_s rk_aiq_camgroup_ctx_t; 62 63 typedef struct rk_aiq_camgroup_instance_cfg_s { 64 const char* sns_ent_nm_array[RK_AIQ_CAM_GROUP_MAX_CAMS]; 65 int sns_num; 66 const char* config_file_dir; 67 /* followings are relative path to config_file_dir */ 68 const char* single_iq_file; 69 const char* group_iq_file; 70 const char* overlap_map_file; 71 rk_aiq_hwevt_cb pHwEvt_cb; 72 void* pHwEvtCbCtx; 73 } rk_aiq_camgroup_instance_cfg_t; 74 75 typedef struct rk_aiq_camgroup_camInfos_s { 76 int valid_sns_num; 77 const char* sns_ent_nm[RK_AIQ_CAM_GROUP_MAX_CAMS]; 78 int sns_camPhyId[RK_AIQ_CAM_GROUP_MAX_CAMS]; 79 } rk_aiq_camgroup_camInfos_t; 80 81 rk_aiq_camgroup_ctx_t* 82 rk_aiq_uapi2_camgroup_create(rk_aiq_camgroup_instance_cfg_t* cfg); 83 84 struct RK_PS_SrcOverlapMap* 85 rk_aiq_uapi2_camgroup_getOverlapMap(rk_aiq_camgroup_ctx_t* camgroup_ctx); 86 87 XCamReturn 88 rk_aiq_uapi2_camgroup_getOverlapMap_from_file(const char* map_file, struct RK_PS_SrcOverlapMap** overlapMap); 89 90 rk_aiq_sys_ctx_t* 91 rk_aiq_uapi2_camgroup_getAiqCtxBySnsNm(rk_aiq_camgroup_ctx_t* camgroup_ctx, const char* sns_entity_name); 92 93 XCamReturn 94 rk_aiq_uapi2_camgroup_bind(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_sys_ctx_t** ctx, int num); 95 96 XCamReturn 97 rk_aiq_uapi2_camgroup_unbind(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_sys_ctx_t** ctx, int num); 98 99 XCamReturn 100 rk_aiq_uapi2_camgroup_prepare(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_working_mode_t mode); 101 102 XCamReturn 103 rk_aiq_uapi2_camgroup_start(rk_aiq_camgroup_ctx_t* camgroup_ctx); 104 105 XCamReturn 106 rk_aiq_uapi2_camgroup_stop(rk_aiq_camgroup_ctx_t* camgroup_ctx); 107 108 XCamReturn 109 rk_aiq_uapi2_camgroup_destroy(rk_aiq_camgroup_ctx_t* camgroup_ctx); 110 111 XCamReturn 112 rk_aiq_uapi2_camgroup_getCamInfos(rk_aiq_camgroup_ctx_t* camgroup_ctx, rk_aiq_camgroup_camInfos_t* camInfos); 113 114 XCamReturn 115 rk_aiq_uapi2_camgroup_resetCam(rk_aiq_camgroup_ctx_t* camgroup_ctx, int camId); 116 117 RKAIQ_END_DECLARE 118 119 #endif 120