1 /* 2 * cac_algo_adaptor.h 3 * 4 * Copyright (c) 2021 Rockchip Electronics Co.,Ltd 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * Author: Cody Xie <cody.xie@rock-chips.com> 19 */ 20 #ifndef ALGOS_ACAC_CAC_ALGO_H 21 #define ALGOS_ACAC_CAC_ALGO_H 22 23 #include <memory> 24 #include <vector> 25 26 #include "algos/acac/lut_buffer.h" 27 #include "algos/acac/rk_aiq_types_acac_algo_int.h" 28 #include "algos/rk_aiq_algo_des.h" 29 #include "algos/rk_aiq_algo_types.h" 30 #include "common/rk_aiq_types_priv.h" 31 #include "iq_parser_v2/RkAiqCalibDbTypesV2.h" 32 #include "xcore/base/xcam_common.h" 33 34 namespace RkCam { 35 36 class CacAlgoAdaptor { 37 public: 38 CacAlgoAdaptor() = default; 39 virtual ~CacAlgoAdaptor(); 40 CacAlgoAdaptor(const CacAlgoAdaptor&) = delete; 41 const CacAlgoAdaptor& operator=(const CacAlgoAdaptor&) = delete; 42 43 #if RKAIQ_HAVE_CAC_V03 44 XCamReturn Config(const AlgoCtxInstanceCfg* config, const CalibDbV2_Cac_V03_t* calib); 45 #elif RKAIQ_HAVE_CAC_V10 46 XCamReturn Config(const AlgoCtxInstanceCfg* config, const CalibDbV2_Cac_V10_t* calib); 47 #elif RKAIQ_HAVE_CAC_V11 48 XCamReturn Config(const AlgoCtxInstanceCfg* config, const CalibDbV2_Cac_V11_t* calib); 49 #endif 50 #if RKAIQ_HAVE_CAC_V03 51 XCamReturn SetApiAttr(const rkaiq_cac_v03_api_attr_t* attr); 52 #elif RKAIQ_HAVE_CAC_V10 53 XCamReturn SetApiAttr(const rkaiq_cac_v10_api_attr_t* attr); 54 #elif RKAIQ_HAVE_CAC_V11 55 XCamReturn SetApiAttr(const rkaiq_cac_v11_api_attr_t* attr); 56 #endif 57 #if RKAIQ_HAVE_CAC_V03 58 XCamReturn GetApiAttr(rkaiq_cac_v03_api_attr_t* attr); 59 #elif RKAIQ_HAVE_CAC_V10 60 XCamReturn GetApiAttr(rkaiq_cac_v10_api_attr_t* attr); 61 #elif RKAIQ_HAVE_CAC_V11 62 XCamReturn GetApiAttr(rkaiq_cac_v11_api_attr_t* attr); 63 #endif 64 65 66 XCamReturn Prepare(const RkAiqAlgoConfigAcac* config); IsEnabled()67 bool IsEnabled() const { return enable_; } IsStarted()68 bool IsStarted() const { return started_; } 69 70 void OnFrameEvent(const RkAiqAlgoProcAcac* input, RkAiqAlgoProcResAcac* output); 71 GetConfig()72 const AlgoCtxInstanceCfg* GetConfig() { return ctx_config_; } 73 74 private: 75 bool enable_ = false; 76 bool started_ = false; 77 bool valid_ = true; 78 bool isReCal_ = true; 79 int lastIso_ = 0; 80 std::unique_ptr<LutBufferManager> lut_manger_; 81 std::vector<std::unique_ptr<LutBuffer>> current_lut_ = {}; 82 83 const AlgoCtxInstanceCfg* ctx_config_ = nullptr; 84 const RkAiqAlgoConfigAcac* config_ = nullptr; 85 #if RKAIQ_HAVE_CAC_V03 86 const CalibDbV2_Cac_V03_t* calib_ = nullptr; 87 #elif RKAIQ_HAVE_CAC_V10 88 const CalibDbV2_Cac_V10_t* calib_ = nullptr; 89 #elif RKAIQ_HAVE_CAC_V11 90 const CalibDbV2_Cac_V11_t* calib_ = nullptr; 91 #endif 92 #if RKAIQ_HAVE_CAC_V03 93 std::unique_ptr<rkaiq_cac_v03_api_attr_t> attr_ = nullptr; 94 #elif RKAIQ_HAVE_CAC_V10 95 std::unique_ptr<rkaiq_cac_v10_api_attr_t> attr_ = nullptr; 96 #elif RKAIQ_HAVE_CAC_V11 97 std::unique_ptr<rkaiq_cac_v11_api_attr_t> attr_ = nullptr; 98 #endif 99 }; 100 101 } // namespace RkCam 102 103 #endif // ALGOS_ACAC_CAC_ALGO_H 104