diff options
author | Umang Jain <umang.jain@ideasonboard.com> | 2021-05-10 17:27:04 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2021-06-28 14:12:06 +0530 |
commit | 2ed7faa7cb7e7b164a75bc249fa24bde1006db38 (patch) | |
tree | f759b4a3ce93a229968c98c5f54c477b7f46ec52 /aiq/aiq_results.h | |
parent | 249b42db7cd39d7ec20094242cd7a8c41ea3b442 (diff) |
aiq: Provide managed AIQ Results structures
The AIQ results structures returned from the AIQ library has many
complex and deeply nested data structures which must be copied out.
This class handles the correct initialisation of a full set of AIQ
results, along with the allocations required, and the ability to copy
data into those structures correctly.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'aiq/aiq_results.h')
-rw-r--r-- | aiq/aiq_results.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/aiq/aiq_results.h b/aiq/aiq_results.h new file mode 100644 index 0000000..ae19a6c --- /dev/null +++ b/aiq/aiq_results.h @@ -0,0 +1,115 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* + * Copyright (C) 2021, Google Inc. + * + * aiq_results.h - Intel IA Imaging library C++ wrapper + * + * AIQ results container, capable of depth copies and assignments + * of the aiq result structures. + */ + +#include <vector> + +#include <ia_imaging/ia_aiq.h> + +#ifndef IPA_IPU3_AIQ_RESULTS_H +#define IPA_IPU3_AIQ_RESULTS_H + +namespace libcamera::ipa::ipu3::aiq { + +static const unsigned int NUM_FLASH_LEDS = 1; /*!> Number of leds AEC algorithm + provides output for */ + +/** + * The result structures for 3A algorithm are full of pointers to other structs, + * some of those depends on the RGBS grid size or LSC grid size + * We should query those at init time and initialize the struct with the correct + * amount of memory. This is a TODO as an optimization + * for now we just allocate statically big values. + */ +static const unsigned int MAX_AE_GRID_SIZE = 2048; /*!> Top limit for the RGBS grid size + This is an upper limit to avoid dynamic allocation*/ +static const unsigned int DEFAULT_LSC_SIZE = 2048; +static const unsigned int MAX_GAMMA_LUT_SIZE = 1024; +static const unsigned int MAX_NUM_TONE_MAP_LUTS = 1024; + +class AiqResults +{ +public: + AiqResults(); + + const ia_aiq_ae_results *ae() { return &ae_; } + ia_aiq_af_results *af() { return &af_; } + const ia_aiq_af_bracket_results *afBracket() { return &afBracket_; } + ia_aiq_awb_results *awb() { return &awb_; } + const ia_aiq_gbce_results *gbce() { return &gbce_; } + const ia_aiq_pa_results *pa() { return &pa_; } + const ia_aiq_sa_results *sa() { return &sa_; } + + void setAe(ia_aiq_ae_results *ae); + void setAf(ia_aiq_af_results *af); + void setAfBracket(ia_aiq_af_bracket_results *afBracket); + void setAwb(ia_aiq_awb_results *awb); + void setGbce(ia_aiq_gbce_results *gbce); + void setDetectedSceneMode(ia_aiq_scene_mode dsm); + void setPa(ia_aiq_pa_results *pa); + void setSa(ia_aiq_sa_results *sa); + +private: + ia_aiq_ae_results ae_; + ia_aiq_af_results af_; + ia_aiq_af_bracket_results afBracket_; + ia_aiq_awb_results awb_; + ia_aiq_gbce_results gbce_; + ia_aiq_pa_results pa_; + ia_aiq_sa_results sa_; + + ia_aiq_scene_mode detectedSceneMode_; + + /*!< ia_aiq_ae_results pointer contents */ + ia_aiq_ae_exposure_result aeExposureResult_; + ia_aiq_hist_weight_grid aeWeightGrid_; + unsigned char aeWeights_[MAX_AE_GRID_SIZE]; + ia_aiq_flash_parameters aeFlashes_[NUM_FLASH_LEDS]; + + /*!< ia_aiq_ae_exposure_result pointer contents */ + ia_aiq_exposure_parameters aeExposureParameters_; + ia_aiq_exposure_sensor_parameters aeSensorParaemeters_; + + /*!< ia_aiq_gbce results */ + /* The actual size of this table can be calculated by running cold + * GBCE, it will provide those tables. TODO!! + */ + float RGammaLut_[MAX_GAMMA_LUT_SIZE]; + float GGammaLut_[MAX_GAMMA_LUT_SIZE]; + float BGammaLut_[MAX_GAMMA_LUT_SIZE]; + float toneMapLut_[MAX_NUM_TONE_MAP_LUTS]; + + /*!< ia_aiq_af_bracket_results pointer contents */ + unsigned short distanceBracketing_; + int lensPosBracketing_; + + /*!< ia_aiq_pa_results */ + ia_aiq_advanced_ccm_t prefAcm_; + ia_aiq_ir_weight_t irWeight_; + + /*!< ia_aiq_advanced_ccm_t pointer contents */ + unsigned int hueOfSectors_; + float advancedColorConversionMatrices_[3][3]; + + /*!< ia_aiq_ir_weight_t pointer contents */ + unsigned short irWeightGridR_; + unsigned short irWeightGridG_; + unsigned short irWeightGridB_; + + /*!< ia_aiq_sa_results pointer contents */ + std::vector<float> channelGr_; + std::vector<float> channelR_; + std::vector<float> channelB_; + std::vector<float> channelGb_; +}; + +} /* namespace libcamera::ipa::ipu3::aiq */ + +#endif /* IPA_IPU3_AIQ_RESULTS_H */ + |