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 "algos/agic/rk_aiq_uapi_agic_int.h"
17
18 #include "algos/agic/rk_aiq_types_algo_agic_prvt.h"
19
rk_aiq_uapi_agic_v1_SetAttrib(RkAiqAlgoContext * ctx,const rkaiq_gic_v1_api_attr_t * attr,bool need_sync)20 XCamReturn rk_aiq_uapi_agic_v1_SetAttrib(RkAiqAlgoContext* ctx, const rkaiq_gic_v1_api_attr_t* attr,
21 bool need_sync) {
22 (void)(need_sync);
23
24 if (ctx == NULL) {
25 LOGE_AGIC("%s(%d): null pointer\n", __FUNCTION__, __LINE__);
26 return XCAM_RETURN_ERROR_PARAM;
27 }
28
29 AgicContext_t* pAgicCtx = (AgicContext_t*)&ctx->agicCtx;
30 pAgicCtx->attr.v1.gic_en = attr->gic_en;
31 pAgicCtx->attr.v1.op_mode = attr->op_mode;
32 pAgicCtx->attr.v1.edge_open = attr->edge_open;
33 pAgicCtx->attr.v1.noise_cut_en = attr->noise_cut_en;
34 pAgicCtx->attr.v1.iso_cnt = attr->iso_cnt;
35 memcpy(pAgicCtx->attr.v1.auto_params, attr->auto_params, sizeof(attr->auto_params));
36 memcpy(&pAgicCtx->attr.v1.manual_param, &attr->manual_param, sizeof(attr->manual_param));
37
38 return XCAM_RETURN_NO_ERROR;
39 }
40
rk_aiq_uapi_agic_v1_GetAttrib(RkAiqAlgoContext * ctx,rkaiq_gic_v1_api_attr_t * attr)41 XCamReturn rk_aiq_uapi_agic_v1_GetAttrib(RkAiqAlgoContext* ctx, rkaiq_gic_v1_api_attr_t* attr) {
42 if (ctx == NULL || attr == NULL) {
43 LOGE_AGIC("%s(%d): null pointer\n", __FUNCTION__, __LINE__);
44 return XCAM_RETURN_ERROR_PARAM;
45 }
46
47 AgicContext_t* pAgicCtx = (AgicContext_t*)&ctx->agicCtx;
48
49 attr->gic_en = pAgicCtx->attr.v1.gic_en;
50 attr->op_mode = pAgicCtx->attr.v1.op_mode;
51 attr->edge_open = pAgicCtx->attr.v1.edge_open;
52 attr->noise_cut_en = pAgicCtx->attr.v1.noise_cut_en;
53 attr->iso_cnt = pAgicCtx->attr.v1.iso_cnt;
54 memcpy(attr->auto_params, pAgicCtx->attr.v1.auto_params, sizeof(attr->auto_params));
55 memcpy(&attr->manual_param, &pAgicCtx->attr.v1.manual_param, sizeof(attr->manual_param));
56
57 return XCAM_RETURN_NO_ERROR;
58 }
59
rk_aiq_uapi_agic_v2_SetAttrib(RkAiqAlgoContext * ctx,const rkaiq_gic_v2_api_attr_t * attr,bool need_sync)60 XCamReturn rk_aiq_uapi_agic_v2_SetAttrib(RkAiqAlgoContext* ctx, const rkaiq_gic_v2_api_attr_t* attr,
61 bool need_sync) {
62 (void)(need_sync);
63
64 if (ctx == NULL) {
65 LOGE_AGIC("%s(%d): null pointer\n", __FUNCTION__, __LINE__);
66 return XCAM_RETURN_ERROR_PARAM;
67 }
68
69 AgicContext_t* pAgicCtx = (AgicContext_t*)&ctx->agicCtx;
70 pAgicCtx->attr.v2.op_mode = attr->op_mode;
71 pAgicCtx->attr.v2.gic_en = attr->gic_en;
72 pAgicCtx->attr.v2.iso_cnt = attr->iso_cnt;
73 memcpy(pAgicCtx->attr.v2.auto_params, attr->auto_params, sizeof(attr->auto_params));
74 memcpy(&pAgicCtx->attr.v2.manual_param, &attr->manual_param, sizeof(attr->manual_param));
75
76 return XCAM_RETURN_NO_ERROR;
77 }
78
rk_aiq_uapi_agic_v2_GetAttrib(RkAiqAlgoContext * ctx,rkaiq_gic_v2_api_attr_t * attr)79 XCamReturn rk_aiq_uapi_agic_v2_GetAttrib(RkAiqAlgoContext* ctx, rkaiq_gic_v2_api_attr_t* attr) {
80 if (ctx == NULL || attr == NULL) {
81 LOGE_AGIC("%s(%d): null pointer\n", __FUNCTION__, __LINE__);
82 return XCAM_RETURN_ERROR_PARAM;
83 }
84
85 AgicContext_t* pAgicCtx = (AgicContext_t*)&ctx->agicCtx;
86
87 attr->gic_en = pAgicCtx->attr.v2.gic_en;
88 attr->op_mode = pAgicCtx->attr.v2.op_mode;
89 attr->iso_cnt = pAgicCtx->attr.v2.iso_cnt;
90 memcpy(attr->auto_params, pAgicCtx->attr.v2.auto_params, sizeof(attr->auto_params));
91 memcpy(&attr->manual_param, &pAgicCtx->attr.v2.manual_param, sizeof(attr->manual_param));
92
93 return XCAM_RETURN_NO_ERROR;
94 }
95
96