Wind Yuan | 75564b1 | 2015-01-15 06:51:15 -0500 | [diff] [blame] | 1 | /* |
| 2 | * x3a_isp_config.h - 3A ISP config |
| 3 | * |
| 4 | * Copyright (c) 2014-2015 Intel Corporation |
| 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: Wind Yuan <feng.yuan@intel.com> |
| 19 | */ |
| 20 | |
| 21 | #ifndef XCAM_3A_ISP_CONFIG_H |
| 22 | #define XCAM_3A_ISP_CONFIG_H |
| 23 | |
Wind Yuan | 75564b1 | 2015-01-15 06:51:15 -0500 | [diff] [blame] | 24 | #include "xcam_utils.h" |
Wind Yuan | 75564b1 | 2015-01-15 06:51:15 -0500 | [diff] [blame] | 25 | #include "x3a_result.h" |
| 26 | #include <linux/atomisp.h> |
Wind Yuan | 29a49f5 | 2015-01-26 17:57:37 +0800 | [diff] [blame] | 27 | #include <base/xcam_3a_result.h> |
Wind Yuan | 75564b1 | 2015-01-15 06:51:15 -0500 | [diff] [blame] | 28 | |
| 29 | namespace XCam { |
| 30 | |
| 31 | #define XCAM_3A_ISP_RESULT_TYPE_START (XCAM_3A_RESULT_USER_DEFINED_TYPE + 0x1000) |
| 32 | |
| 33 | struct AtomIspConfigContent { |
| 34 | struct atomisp_parameters isp_config; |
| 35 | //content |
| 36 | struct atomisp_wb_config wb; |
| 37 | struct atomisp_ob_config ob; //black level |
| 38 | struct atomisp_cc_config cc; |
| 39 | struct atomisp_cc_config yuv2rgb_cc; |
| 40 | struct atomisp_cc_config rgb2yuv_cc; |
| 41 | struct atomisp_nr_config nr; |
| 42 | struct atomisp_tnr_config tnr; |
| 43 | struct atomisp_ynr_config ynr; |
| 44 | struct atomisp_cnr_config cnr; |
| 45 | struct atomisp_anr_config anr; |
| 46 | struct atomisp_xnr_config xnr; |
| 47 | struct atomisp_xnr_table xnr_table; |
| 48 | struct atomisp_ee_config ee; |
| 49 | struct atomisp_dp_config dp; |
| 50 | struct atomisp_de_config de; |
| 51 | struct atomisp_ecd_config ecd_config; |
| 52 | struct atomisp_fc_config fc_config; |
| 53 | struct atomisp_ctc_config ctc_config; |
| 54 | struct atomisp_ctc_table ctc_table; |
| 55 | struct atomisp_macc_config macc_config; |
| 56 | struct atomisp_macc_table macc_table; |
| 57 | struct atomisp_gamma_table gamma_table; |
| 58 | struct atomisp_rgb_gamma_table r_gamma_table; |
| 59 | struct atomisp_rgb_gamma_table g_gamma_table; |
| 60 | struct atomisp_rgb_gamma_table b_gamma_table; |
| 61 | struct atomisp_gc_config gc_config; |
| 62 | struct atomisp_shading_table shading_table; |
| 63 | struct atomisp_3a_config a3a; |
| 64 | |
| 65 | struct atomisp_dvs_6axis_config dvs_6axis; |
| 66 | |
| 67 | |
| 68 | struct atomisp_formats_config formats; |
| 69 | struct atomisp_aa_config aa; |
| 70 | struct atomisp_aa_config baa; |
| 71 | struct atomisp_ce_config ce; |
| 72 | struct atomisp_morph_table morph_table; |
| 73 | struct atomisp_anr_thres anr_thres; |
| 74 | |
| 75 | struct atomisp_dz_config dz_config; |
| 76 | struct atomisp_vector motion_vector; |
| 77 | |
| 78 | void clear (); |
| 79 | void copy (const struct atomisp_parameters &config); |
| 80 | |
| 81 | AtomIspConfigContent () { |
| 82 | clear (); |
| 83 | } |
| 84 | }; |
| 85 | |
| 86 | class IspConfigTranslator; |
| 87 | |
| 88 | class X3aIspConfig |
| 89 | { |
| 90 | public: |
| 91 | enum X3aIspConfigType { |
| 92 | IspAllParameters = XCAM_3A_ISP_RESULT_TYPE_START, |
| 93 | IspExposureParameters, |
| 94 | }; |
| 95 | |
| 96 | struct X3aIspResultDummy { |
| 97 | XCam3aResultHead head; |
| 98 | }; |
| 99 | public: |
| 100 | explicit X3aIspConfig (); |
| 101 | virtual ~X3aIspConfig(); |
| 102 | |
| 103 | public: |
| 104 | const struct atomisp_parameters &get_isp_configs () const { |
| 105 | return _isp_content.isp_config; |
| 106 | } |
| 107 | struct atomisp_parameters &get_isp_configs () { |
| 108 | return _isp_content.isp_config; |
| 109 | } |
| 110 | bool clear (); |
| 111 | bool attach (SmartPtr<X3aResult> &result, IspConfigTranslator *translator); |
| 112 | |
| 113 | private: |
| 114 | XCAM_DEAD_COPY (X3aIspConfig); |
| 115 | |
| 116 | protected: |
| 117 | AtomIspConfigContent _isp_content; |
| 118 | std::list< SmartPtr<X3aResult> > _3a_results; |
| 119 | }; |
| 120 | |
| 121 | template <typename IspConfig, typename StandardResult, uint32_t type> |
| 122 | class X3aIspResultT |
| 123 | : public X3aStandardResultT<StandardResult> |
| 124 | { |
| 125 | public: |
| 126 | X3aIspResultT ( |
| 127 | XCamImageProcessType process_type = XCAM_IMAGE_PROCESS_ALWAYS |
| 128 | ) |
| 129 | : X3aStandardResultT<StandardResult> (type, process_type) |
| 130 | { |
| 131 | X3aResult::set_ptr((void*)&_isp_config); |
| 132 | } |
| 133 | |
| 134 | ~X3aIspResultT () {} |
| 135 | |
| 136 | // set config |
| 137 | void set_isp_config (IspConfig &config) { |
| 138 | _isp_config = config; |
| 139 | } |
| 140 | const IspConfig &get_isp_config () const { |
| 141 | return _isp_config; |
| 142 | } |
| 143 | |
| 144 | private: |
| 145 | IspConfig _isp_config; |
| 146 | }; |
| 147 | |
| 148 | |
| 149 | /* special X3aAtomIspParametersResult type */ |
| 150 | template <> |
| 151 | class X3aIspResultT<struct atomisp_parameters, X3aIspConfig::X3aIspResultDummy, X3aIspConfig::IspAllParameters> |
| 152 | : public X3aStandardResultT<X3aIspConfig::X3aIspResultDummy> |
| 153 | { |
| 154 | public: |
| 155 | X3aIspResultT ( |
| 156 | XCamImageProcessType process_type = XCAM_IMAGE_PROCESS_ALWAYS) |
| 157 | : X3aStandardResultT<X3aIspConfig::X3aIspResultDummy> ((uint32_t)X3aIspConfig::IspAllParameters, process_type) |
| 158 | { |
| 159 | X3aResult::set_ptr((void*)&_content.isp_config); |
| 160 | } |
| 161 | |
| 162 | ~X3aIspResultT () {} |
| 163 | |
| 164 | // get config |
| 165 | struct atomisp_parameters &get_isp_config () { |
| 166 | return _content.isp_config; |
| 167 | } |
| 168 | const struct atomisp_parameters &get_isp_config () const { |
| 169 | return _content.isp_config; |
| 170 | } |
| 171 | |
| 172 | // set config |
| 173 | void set_isp_config (struct atomisp_parameters &config) { |
| 174 | _content.copy (config); |
| 175 | } |
| 176 | |
| 177 | private: |
| 178 | AtomIspConfigContent _content; |
| 179 | }; |
| 180 | |
| 181 | typedef |
| 182 | X3aIspResultT<struct atomisp_parameters, X3aIspConfig::X3aIspResultDummy, X3aIspConfig::IspAllParameters> X3aAtomIspParametersResult; |
| 183 | typedef |
| 184 | X3aIspResultT<struct atomisp_exposure, XCam3aResultExposure, X3aIspConfig::IspExposureParameters> X3aIspExposureResult; |
| 185 | |
| 186 | }; |
| 187 | |
| 188 | #endif //XCAM_3A_ISP_CONFIG_H |
| 189 | |