xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/uAPI/rk_aiq_user_api_afec.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 "rk_aiq_user_api_afec.h"
18 
19 #include "algo_handlers/RkAiqAfecHandle.h"
20 
21 RKAIQ_BEGIN_DECLARE
22 
23 #ifdef RK_SIMULATOR_HW
24 #define CHECK_USER_API_ENABLE
25 #endif
26 
27 #if RKAIQ_HAVE_FEC_V10
28 XCamReturn
rk_aiq_user_api_afec_SetAttrib(const rk_aiq_sys_ctx_t * sys_ctx,rk_aiq_fec_attrib_t attr)29 rk_aiq_user_api_afec_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_fec_attrib_t attr)
30 {
31     CHECK_USER_API_ENABLE2(sys_ctx);
32     CHECK_USER_API_ENABLE(RK_AIQ_ALGO_TYPE_AFEC);
33     RKAIQ_API_SMART_LOCK(sys_ctx);
34     RkAiqAfecHandleInt* algo_handle =
35         algoHandle<RkAiqAfecHandleInt>(sys_ctx, RK_AIQ_ALGO_TYPE_AFEC);
36 
37     if (algo_handle) {
38         return algo_handle->setAttrib(attr);
39     }
40 
41     return XCAM_RETURN_ERROR_FAILED;
42 }
43 
44 XCamReturn
rk_aiq_user_api_afec_GetAttrib(const rk_aiq_sys_ctx_t * sys_ctx,rk_aiq_fec_attrib_t * attr)45 rk_aiq_user_api_afec_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_fec_attrib_t *attr)
46 {
47     RKAIQ_API_SMART_LOCK(sys_ctx);
48     RkAiqAfecHandleInt* algo_handle =
49         algoHandle<RkAiqAfecHandleInt>(sys_ctx, RK_AIQ_ALGO_TYPE_AFEC);
50 
51     if (algo_handle) {
52         return algo_handle->getAttrib(attr);
53     }
54 
55     return XCAM_RETURN_ERROR_FAILED;
56 }
57 #else
58 XCamReturn
59 rk_aiq_user_api_afec_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_fec_attrib_t attr)
60 {
61     return XCAM_RETURN_ERROR_UNKNOWN;
62 }
63 
64 XCamReturn
65 rk_aiq_user_api_afec_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_fec_attrib_t *attr)
66 {
67     return XCAM_RETURN_ERROR_UNKNOWN;
68 }
69 #endif
70 
71 RKAIQ_END_DECLARE
72