xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/aiq_core/algo_handlers/RkAiqAcnrV30Handle.h (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 #ifndef _RK_AIQ_CNR_V30_HANDLE_INT_H_
17 #define _RK_AIQ_CNR_V30_HANDLE_INT_H_
18 
19 #include "RkAiqHandle.h"
20 #include "acnrV30/rk_aiq_uapi_acnr_int_v30.h"
21 #include "rk_aiq_api_private.h"
22 #include "rk_aiq_pool.h"
23 #include "xcam_mutex.h"
24 
25 namespace RkCam {
26 #if (RKAIQ_HAVE_CNR_V30 || RKAIQ_HAVE_CNR_V30_LITE)
27 
28 class RkAiqAcnrV30HandleInt : virtual public RkAiqHandle {
29 public:
RkAiqAcnrV30HandleInt(RkAiqAlgoDesComm * des,RkAiqCore * aiqCore)30     explicit RkAiqAcnrV30HandleInt(RkAiqAlgoDesComm* des, RkAiqCore* aiqCore)
31         : RkAiqHandle(des, aiqCore) {
32 #ifndef DISABLE_HANDLE_ATTRIB
33         updateStrength = false;
34         updateAtt      = false;
35         memset(&mCurStrength, 0x00, sizeof(mCurStrength));
36         mCurStrength.percent = 1.0;
37         memset(&mNewStrength, 0x00, sizeof(mNewStrength));
38         mNewStrength.percent = 1.0;
39         memset(&mCurAtt, 0x00, sizeof(mCurAtt));
40         memset(&mNewAtt, 0x00, sizeof(mNewAtt));
41         memset(&mCurInfo, 0x00, sizeof(mCurInfo));
42         memset(&mNewInfo, 0x00, sizeof(mNewInfo));
43 #endif
44     };
~RkAiqAcnrV30HandleInt()45     virtual ~RkAiqAcnrV30HandleInt() {
46         RkAiqHandle::deInit();
47     };
48     virtual XCamReturn updateConfig(bool needSync);
49     virtual XCamReturn prepare();
50     virtual XCamReturn preProcess();
51     virtual XCamReturn processing();
52     virtual XCamReturn postProcess();
53     virtual XCamReturn genIspResult(RkAiqFullParams* params, RkAiqFullParams* cur_params);
54     // TODO add algo specific methords, this is a sample
55     XCamReturn setAttrib(const rk_aiq_cnr_attrib_v30_t* att);
56     XCamReturn getAttrib(rk_aiq_cnr_attrib_v30_t* att);
57     XCamReturn setStrength(const rk_aiq_cnr_strength_v30_t* pStrength);
58     XCamReturn getStrength(rk_aiq_cnr_strength_v30_t* pStrength);
59     XCamReturn getInfo(rk_aiq_cnr_info_v30_t* pInfo);
60 
61 protected:
62     virtual void init();
deInit()63     virtual void deInit() {
64         RkAiqHandle::deInit();
65     };
66 
67 private:
68     // TODO
69 #ifndef DISABLE_HANDLE_ATTRIB
70     rk_aiq_cnr_attrib_v30_t mCurAtt;
71     rk_aiq_cnr_attrib_v30_t mNewAtt;
72     rk_aiq_cnr_strength_v30_t mCurStrength;
73     rk_aiq_cnr_strength_v30_t mNewStrength;
74     mutable std::atomic<bool> updateStrength;
75     rk_aiq_cnr_info_v30_t mCurInfo;
76     rk_aiq_cnr_info_v30_t mNewInfo;
77     mutable std::atomic<bool> updateInfo;
78 #endif
79 
80 private:
81     DECLARE_HANDLE_REGISTER_TYPE(RkAiqAcnrV30HandleInt);
82 };
83 #endif
84 }  // namespace RkCam
85 
86 #endif
87