xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/algos/again2/rk_aiq_uapi_again_int_v2.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 
17 #include "again2/rk_aiq_uapi_again_int_v2.h"
18 #include "again2/rk_aiq_types_again_algo_prvt_v2.h"
19 #include "again2/rk_aiq_again_algo_gain_v2.h"
20 
21 
22 XCamReturn
rk_aiq_uapi_againV2_SetAttrib(RkAiqAlgoContext * ctx,const rk_aiq_gain_attrib_v2_t * attr,bool need_sync)23 rk_aiq_uapi_againV2_SetAttrib(RkAiqAlgoContext *ctx,
24                               const rk_aiq_gain_attrib_v2_t *attr,
25                               bool need_sync)
26 {
27 
28     Again_Context_V2_t* pCtx = (Again_Context_V2_t*)ctx;
29 
30     pCtx->eMode = attr->eMode;
31     if(pCtx->eMode == AGAINV2_OP_MODE_AUTO) {
32         pCtx->stAuto = attr->stAuto;
33     } else if(pCtx->eMode == AGAINV2_OP_MODE_MANUAL) {
34         pCtx->stManual.stSelect = attr->stManual.stSelect;
35     }
36     pCtx->isReCalculate |= 1;
37 
38     return XCAM_RETURN_NO_ERROR;
39 }
40 
41 XCamReturn
rk_aiq_uapi_againV2_GetAttrib(const RkAiqAlgoContext * ctx,rk_aiq_gain_attrib_v2_t * attr)42 rk_aiq_uapi_againV2_GetAttrib(const RkAiqAlgoContext *ctx,
43                               rk_aiq_gain_attrib_v2_t *attr)
44 {
45 
46     Again_Context_V2_t* pCtx = (Again_Context_V2_t*)ctx;
47 
48     attr->eMode = pCtx->eMode;
49     memcpy(&attr->stAuto, &pCtx->stAuto, sizeof(attr->stAuto));
50     memcpy(&attr->stManual, &pCtx->stManual, sizeof(attr->stManual));
51 
52     return XCAM_RETURN_NO_ERROR;
53 }
54 
55 XCamReturn
rk_aiq_uapi_againV2_GetInfo(const RkAiqAlgoContext * ctx,rk_aiq_gain_info_v2_t * pInfo)56 rk_aiq_uapi_againV2_GetInfo(const RkAiqAlgoContext *ctx,
57                             rk_aiq_gain_info_v2_t *pInfo)
58 {
59 
60     Again_Context_V2_t* pCtx = (Again_Context_V2_t*)ctx;
61 
62     pInfo->iso = pCtx->stExpInfo.arIso[pCtx->stExpInfo.hdr_mode];
63     pInfo->expo_info = pCtx->stExpInfo;
64 
65     return XCAM_RETURN_NO_ERROR;
66 }
67 
68