xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/aiq_core/algo_handlers/RkAiqAynrV22Handle.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_YNR_V22_HANDLE_INT_H_
17 #define _RK_AIQ_YNR_V22_HANDLE_INT_H_
18 
19 #include "RkAiqHandle.h"
20 #include "aynrV22/rk_aiq_uapi_aynr_int_v22.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_YNR_V22
27 
28 class RkAiqAynrV22HandleInt : virtual public RkAiqHandle {
29 public:
RkAiqAynrV22HandleInt(RkAiqAlgoDesComm * des,RkAiqCore * aiqCore)30     explicit RkAiqAynrV22HandleInt(RkAiqAlgoDesComm* des, RkAiqCore* aiqCore)
31         : RkAiqHandle(des, aiqCore) {
32 #ifndef DISABLE_HANDLE_ATTRIB
33         updateAtt      = false;
34         updateStrength = 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     };
~RkAiqAynrV22HandleInt()45     virtual ~RkAiqAynrV22HandleInt() {
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_ynr_attrib_v22_t* att);
56     XCamReturn getAttrib(rk_aiq_ynr_attrib_v22_t* att);
57     XCamReturn setStrength(const rk_aiq_ynr_strength_v22_t* pStrength);
58     XCamReturn getStrength(rk_aiq_ynr_strength_v22_t* pStrength);
59 
60     XCamReturn getInfo(rk_aiq_ynr_info_v22_t* pInfo);
61 
62 protected:
63     virtual void init();
deInit()64     virtual void deInit() {
65         RkAiqHandle::deInit();
66     };
67 
68     SmartPtr<RkAiqAlgoProcResAynrV22IntShared> mProcResShared;
69 
70  private:
71     // TODO
72 #ifndef DISABLE_HANDLE_ATTRIB
73     rk_aiq_ynr_attrib_v22_t mCurAtt;
74     rk_aiq_ynr_attrib_v22_t mNewAtt;
75     rk_aiq_ynr_strength_v22_t mCurStrength;
76     rk_aiq_ynr_strength_v22_t mNewStrength;
77     mutable std::atomic<bool> updateStrength;
78     rk_aiq_ynr_info_v22_t mCurInfo;
79     rk_aiq_ynr_info_v22_t mNewInfo;
80     mutable std::atomic<bool> updateInfo;
81 #endif
82     Aynr_ProcResult_V22_t mLatestparam;
83 
84 private:
85     DECLARE_HANDLE_REGISTER_TYPE(RkAiqAynrV22HandleInt);
86 };
87 #endif
88 }  // namespace RkCam
89 
90 #endif
91