1 /*
2 * Copyright (c) 2019-2022 Rockchip Eletronics Co., Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include "rk_aiq_user_api2_acp.h"
17 #include "RkAiqCamGroupHandleInt.h"
18 #include "algo_handlers/RkAiqAcpHandle.h"
19
20 RKAIQ_BEGIN_DECLARE
21
22 #ifdef RK_SIMULATOR_HW
23 #define CHECK_USER_API_ENABLE
24 #endif
25
26 #if RKAIQ_HAVE_ACP_V10
rk_aiq_user_api2_acp_SetAttrib(const rk_aiq_sys_ctx_t * sys_ctx,const acp_attrib_t * attr)27 XCamReturn rk_aiq_user_api2_acp_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
28 const acp_attrib_t* attr)
29 {
30 XCamReturn ret = XCAM_RETURN_NO_ERROR;
31 CHECK_USER_API_ENABLE2(sys_ctx);
32 CHECK_USER_API_ENABLE(RK_AIQ_ALGO_TYPE_AIE);
33 RKAIQ_API_SMART_LOCK(sys_ctx);
34
35 if (sys_ctx->cam_type == RK_AIQ_CAM_TYPE_GROUP) {
36 #ifdef RKAIQ_ENABLE_CAMGROUP
37 const rk_aiq_camgroup_ctx_t* camgroup_ctx = (rk_aiq_camgroup_ctx_t *)sys_ctx;
38 for (auto camCtx : camgroup_ctx->cam_ctxs_array) {
39 if (!camCtx)
40 continue;
41
42 RkAiqAcpHandleInt* singleCam_algo_handle =
43 algoHandle<RkAiqAcpHandleInt>(camCtx, RK_AIQ_ALGO_TYPE_ACP);
44
45 if (singleCam_algo_handle) {
46 ret = singleCam_algo_handle->setAttrib(attr);
47 }
48 }
49 #else
50 return XCAM_RETURN_ERROR_FAILED;
51 #endif
52 } else {
53 RkAiqAcpHandleInt* algo_handle =
54 algoHandle<RkAiqAcpHandleInt>(sys_ctx, RK_AIQ_ALGO_TYPE_ACP);
55
56 if (algo_handle) {
57 return algo_handle->setAttrib(attr);
58 }
59 }
60
61 return (ret);
62 }
63
rk_aiq_user_api2_acp_GetAttrib(const rk_aiq_sys_ctx_t * sys_ctx,acp_attrib_t * attr)64 XCamReturn rk_aiq_user_api2_acp_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
65 acp_attrib_t *attr)
66 {
67 RKAIQ_API_SMART_LOCK(sys_ctx);
68 XCamReturn ret = XCAM_RETURN_NO_ERROR;
69
70 if (sys_ctx->cam_type == RK_AIQ_CAM_TYPE_GROUP) {
71 #ifdef RKAIQ_ENABLE_CAMGROUP
72 const rk_aiq_camgroup_ctx_t* camgroup_ctx = (rk_aiq_camgroup_ctx_t *)sys_ctx;
73 for (auto camCtx : camgroup_ctx->cam_ctxs_array) {
74 if (!camCtx)
75 continue;
76 RkAiqAcpHandleInt* singleCam_algo_handle =
77 algoHandle<RkAiqAcpHandleInt>(camCtx, RK_AIQ_ALGO_TYPE_ACP);
78
79 if (singleCam_algo_handle) {
80 return singleCam_algo_handle->getAttrib(attr);
81 }
82 }
83 #else
84 return XCAM_RETURN_ERROR_FAILED;
85 #endif
86 } else {
87 RkAiqAcpHandleInt* algo_handle =
88 algoHandle<RkAiqAcpHandleInt>(sys_ctx, RK_AIQ_ALGO_TYPE_ACP);
89
90 if (algo_handle) {
91 return algo_handle->getAttrib(attr);
92 }
93 }
94
95 return (ret);
96
97 }
98 #else
99 XCamReturn rk_aiq_user_api2_acp_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
100 const acp_attrib_t* attr)
101 {
102
103 return XCAM_RETURN_ERROR_UNKNOWN;
104
105 }
106
107 XCamReturn rk_aiq_user_api2_acp_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
108 acp_attrib_t *attr)
109 {
110
111 return XCAM_RETURN_ERROR_UNKNOWN;
112
113 }
114 #endif
115 RKAIQ_END_DECLARE
116
117
118
119