summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUmang Jain <umang.jain@ideasonboard.com>2021-05-21 10:27:24 +0530
committerUmang Jain <umang.jain@ideasonboard.com>2021-06-28 14:12:06 +0530
commitf21b9306a7893017b9f7e6b95001da9abade30f7 (patch)
tree82332eb640a9725ceef3ec487033b524cd49ecd7
parentd05fd744448d37739cf4f919578d0ac8c73bc0a1 (diff)
include: Link to ia_imaging library and import headers
libia_imaging is provided by the ChromeOS system, however the headers aren't installed at the system's $includedir locations. We need to carry them in-tree, to be able to use them. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
-rw-r--r--include/ia_imaging/IPU3AICCommon.h243
-rw-r--r--include/ia_imaging/InterpMachine.h125
-rw-r--r--include/ia_imaging/KBL_AIC.h46
-rw-r--r--include/ia_imaging/Pipe.h82
-rw-r--r--include/ia_imaging/SkyCamAIC.h45
-rw-r--r--include/ia_imaging/SkyCamAICCommon.h46
-rw-r--r--include/ia_imaging/SkyCamAICVersion.h19
-rw-r--r--include/ia_imaging/ae_public.h112
-rw-r--r--include/ia_imaging/af_public.h141
-rw-r--r--include/ia_imaging/anr_public.h185
-rw-r--r--include/ia_imaging/awb_fr_public.h129
-rw-r--r--include/ia_imaging/awb_public.h110
-rw-r--r--include/ia_imaging/bds_public.h87
-rw-r--r--include/ia_imaging/bnr_public.h156
-rw-r--r--include/ia_imaging/cpffData.h947
-rw-r--r--include/ia_imaging/dm_public.h73
-rw-r--r--include/ia_imaging/dpc_public.h91
-rw-r--r--include/ia_imaging/ia_abstraction.h207
-rw-r--r--include/ia_imaging/ia_aiq.h626
-rw-r--r--include/ia_imaging/ia_aiq_types.h784
-rw-r--r--include/ia_imaging/ia_cmc_parser.h43
-rw-r--r--include/ia_imaging/ia_cmc_types.h1069
-rw-r--r--include/ia_imaging/ia_coordinate.h139
-rw-r--r--include/ia_imaging/ia_cp.h408
-rw-r--r--include/ia_imaging/ia_cp_types.h252
-rw-r--r--include/ia_imaging/ia_css_lin_types.h40
-rw-r--r--include/ia_imaging/ia_css_rgbir_types.h80
-rw-r--r--include/ia_imaging/ia_css_tnr3_types.h61
-rw-r--r--include/ia_imaging/ia_css_xnr3_types.h101
-rw-r--r--include/ia_imaging/ia_dpc.h133
-rw-r--r--include/ia_imaging/ia_dvs.h272
-rw-r--r--include/ia_imaging/ia_dvs2_types.h190
-rw-r--r--include/ia_imaging/ia_dvs_2.h454
-rw-r--r--include/ia_imaging/ia_dvs_types.h245
-rw-r--r--include/ia_imaging/ia_exc.h189
-rw-r--r--include/ia_imaging/ia_face.h483
-rw-r--r--include/ia_imaging/ia_ipf.h202
-rw-r--r--include/ia_imaging/ia_ipf_buffer_container.h68
-rw-r--r--include/ia_imaging/ia_ipf_buffer_list.h56
-rw-r--r--include/ia_imaging/ia_ipf_types.h229
-rw-r--r--include/ia_imaging/ia_isp_2_2.h161
-rw-r--r--include/ia_imaging/ia_isp_2_7.h161
-rw-r--r--include/ia_imaging/ia_isp_bxt_deprecated.h61
-rw-r--r--include/ia_imaging/ia_isp_ipf.h23
-rw-r--r--include/ia_imaging/ia_isp_types.h95
-rw-r--r--include/ia_imaging/ia_log.h93
-rw-r--r--include/ia_imaging/ia_ltm.h130
-rw-r--r--include/ia_imaging/ia_ltm_types.h116
-rw-r--r--include/ia_imaging/ia_mkn_decoder.h136
-rw-r--r--include/ia_imaging/ia_mkn_encoder.h166
-rw-r--r--include/ia_imaging/ia_mkn_types.h165
-rw-r--r--include/ia_imaging/ia_montage.h152
-rw-r--r--include/ia_imaging/ia_types.h207
-rw-r--r--include/ia_imaging/obgrid_public.h77
-rw-r--r--include/ia_imaging/rgbpp_public.h189
-rw-r--r--include/ia_imaging/shd_public.h160
-rw-r--r--include/ia_imaging/skycam_statistics.h35
-rw-r--r--include/ia_imaging/stats_3a_public.h67
-rw-r--r--include/ia_imaging/yuvp1_b0_public.h138
-rw-r--r--include/ia_imaging/yuvp1_c0_public.h315
-rw-r--r--include/ia_imaging/yuvp1_common_public.h81
-rw-r--r--include/ia_imaging/yuvp2_common_defs.h30
-rw-r--r--include/ia_imaging/yuvp2_public.h145
-rw-r--r--meson.build18
64 files changed, 11889 insertions, 0 deletions
diff --git a/include/ia_imaging/IPU3AICCommon.h b/include/ia_imaging/IPU3AICCommon.h
new file mode 100644
index 0000000..79f388f
--- /dev/null
+++ b/include/ia_imaging/IPU3AICCommon.h
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "ia_aiq_types.h"
+#include "ia_isp_types.h"
+#include "InterpMachine.h"
+#include "Pipe.h"
+#include "cpffData.h"
+#include <vector>
+#include "ia_dpc.h"
+#include <memory>
+#include "dpc_public.h"
+#include "bds_public.h"
+#include "obgrid_public.h"
+#include "ia_css_lin_types.h"
+#include "shd_public.h"
+#include "bnr_public.h"
+#include "anr_public.h"
+#include "dm_public.h"
+#include "ia_css_tnr3_types.h"
+#include "yuvp1_b0_public.h"
+#include "yuvp1_c0_public.h"
+#include "yuvp2_public.h"
+#include "rgbpp_public.h"
+#include "ia_css_xnr3_types.h"
+
+#ifdef MACRO_KBL_AIC
+#include "ia_css_rgbir_types.h"
+#endif
+#define BypassPowerSaveMode 1
+
+#define OBG_TILE_SIZE 16
+
+#define __AIC_UNUSED(x) (void)(x)
+
+typedef struct ia_aiq_output_frame_parameters{
+ //output_resolution resolution;
+ unsigned short width;
+ unsigned short height;
+ bool fix_flip_x; // fix the x flipping if was done in sensor
+ bool fix_flip_y; // fix the y flipping if was done in sensor
+} ia_aiq_output_frame_parameters_t;
+
+typedef struct aic_input_frame_parameters{
+ ia_aiq_frame_params sensor_frame_params; /*!< Mandatory. Sensor frame parameters. Describe frame scaling/cropping done in sensor. */
+ bool fix_flip_x; // fix the x flipping if was done in sensor
+ bool fix_flip_y; // fix the y flipping if was done in sensor
+} aic_input_frame_parameters_t;
+
+typedef struct aic_resolution_config_parameters{
+ uint16_t horizontal_IF_crop;
+ uint16_t vertical_IF_crop;
+ uint16_t BDSin_img_width;
+ uint16_t BDSin_img_height;
+ uint16_t BDSout_img_width; //without padding
+ uint16_t BDSout_img_height; //without padding
+ //float horizontal_BDS_scale;=BDSout_img_width/BDSin_img_width
+ //float vertical_BDS_scale;=BDSout_img_height/BDSin_img_height
+ uint16_t BDS_horizontal_padding;
+} aic_resolution_config_parameters_t;
+//Note that effective_img_width+horizontal_padding= image_output_resolution_width
+//Note that effective_img_height+vertical_padding= image_output_resolution_height
+
+class Array2DInterpMachine {
+ size_t m_size;
+ int m_frameNum, m_modeNum;
+ std::vector<InterpMachine *> m_data;
+public:
+ Array2DInterpMachine() :
+ m_size(0), m_frameNum(2), m_modeNum(0), m_data(1)
+ {}
+ Array2DInterpMachine(int frames, int modes) :
+ m_size(0), m_frameNum(frames), m_modeNum(modes), m_data((frames + 1)*(modes + 1)) {
+ __AIC_UNUSED(m_modeNum);
+ }
+ void Set(InterpMachine* intMach, int frame_index, int mode_index) {
+ if ((mode_index*m_frameNum + frame_index) >= (int)m_data.size())
+ m_data.resize(mode_index*m_frameNum + m_frameNum);
+ m_data.at(mode_index*m_frameNum + frame_index) = intMach;
+ m_size++;
+ //std::vector<InterpMachine *>::pointer ptr = &m_data[0];
+ }
+ void Push(InterpMachine* intMach) {
+ m_data.push_back(intMach);
+ m_size++;
+ }
+ size_t GetSize() {
+ return m_size;
+ }
+ void Clear() {
+ for(unsigned i=0;i<m_data.size();i++) {
+ if(m_data[i]) {delete[] m_data[i];m_data[i]=NULL;}
+ }
+ m_data.clear();
+ m_size = 0;
+ }
+ InterpMachine* operator()(int frame_index, int mode_index) {
+ if ((0 != m_data.size()) && ((int)m_data.size() > (mode_index*m_frameNum + frame_index)))
+ return m_data.at(mode_index*m_frameNum + frame_index);
+ return 0;
+ }
+ const InterpMachine* const operator()(const int frame_index, const int mode_index) const {
+ if ((0 != m_data.size()) && ((int)m_data.size() > (mode_index*m_frameNum + frame_index)))
+ return m_data.at(mode_index*m_frameNum + frame_index);
+ return 0;
+ }
+};
+
+class Array2DInt {
+ size_t m_size;
+ size_t m_width, m_height;
+ std::vector<int> m_data;
+public:
+ Array2DInt() :
+ m_size(0), m_width(2), m_height(0), m_data(10)
+ {}
+ Array2DInt(size_t x, size_t y, int init = 0) :
+ m_size(0), m_width(x), m_height(y), m_data(x*y, init) {
+ __AIC_UNUSED(m_height);
+ }
+ void Set(int domNum, int x, int y) {
+ if ((int)m_data.size() <= (int)(y*m_width + x))
+ m_data.resize(y*m_width + m_width);
+ m_data.at(y*m_width + x) = domNum;
+ m_size++;
+ }
+ void Push(int domNum) {
+ m_data.push_back(domNum);
+ m_size++;
+ }
+ size_t GetSize() {
+ return m_size;
+ }
+};
+
+//////////////////////////////
+// IPU3AICRuntimeParams - gathers all the IPU3 AIC runtime parameters together
+// (former IPU3AICRuntimeParams)
+struct IPU3AICRuntimeParams
+{
+ long long time_stamp;
+ ia_aiq_frame_use frame_use;
+ int mode_index;
+ const aic_input_frame_parameters_t *input_frame_params; /*!< Mandatory. Inputr frame parameters. Describe frame scaling/cropping done in sensor. */
+ const aic_resolution_config_parameters_t *frame_resolution_parameters;
+ const ia_aiq_output_frame_parameters_t *output_frame_params; /*!< Mandatory. Output frame parameters. */
+ const ia_aiq_exposure_parameters *exposure_results; /*!< Mandatory. Exposure parameters which are to be used to calculate next ISP parameters. */
+ const ia_aiq_hist_weight_grid *weight_grid;
+ const ia_aiq_awb_results *awb_results; /*!< Mandatory. WB results which are to be used to calculate next ISP parameters (WB gains, color matrix,etc). */
+ const ia_aiq_gbce_results *gbce_results; /*!< Mandatory. GBCE Gamma tables which are to be used to calculate next ISP parameters.
+ If NULL pointer is passed, AIC will use static gamma table from the CPF. */
+ const ia_aiq_pa_results *pa_results; /*!< Mandatory. Parameter adaptor results from AIQ. */
+ const ia_aiq_sa_results *sa_results; /*!< Mandatory. Shading adaptor results from AIQ. */
+ uint32_t isp_vamem_type; /*!< Mandatory. ISP vamem type. */
+
+ char manual_brightness; /*!< Optional. Manual brightness value range [-128,127]. */
+ char manual_contrast; /*!< Optional. Manual contrast value range [-128,127]. */
+ char manual_hue; /*!< Optional. Manual hue value range [-128,127]. */
+ char manual_saturation; /*!< Optional. Manual saturation value range [-128,127]. */
+ char manual_sharpness; /*!< Optional. Manual setting for sharpness [-128,127]. */
+ ia_isp_effect effects; /*!< Optional. Manual setting for special effects. Combination of ia_aiq_effect enums.*/
+ ia_rectangle *focus_rect;
+ sd_dpc_output *scdpc_data;
+
+ bool disable_gamma; /*!< Optional. disable gamma for VHDR.*/
+ bool preserve_color; /*!< Optional. use previous calibration for color processing blocks for VHDR.*/
+ bool ull_on; /*!< Optional. Flag that is true in the system will run ULL2 after the ISP */
+}; /* IPU3AICRuntimeParams owns all pointer variables */
+
+typedef struct aic_inputs {
+ const ia_cmc_t *CMCParsed;
+ ISPPipe *SkyCamPipe;
+ std::vector<CPFF*> cpf_in;
+} aic_inputs_t;
+
+#ifdef MACRO_KBL_AIC
+typedef struct ISP_adjustment {
+ bool adjust_denoise_sharpening;
+ float denoise_power;
+ float sharpening_power;
+} ISP_adjustment_t;
+#endif
+
+typedef struct aic_parameters {
+ aic_inputs_t inputs;
+ Array2DInterpMachine domain_interp_list;
+ Array2DInt domain_num;
+
+ unsigned int dump_aic_parameters;
+ bool rgbs_af_grid_valid;
+ bool awbfr_grid_valid;
+ bool ae_grid_valid;
+
+#ifdef MACRO_KBL_AIC
+ ISP_adjustment_t isp_adjustment;
+#endif
+
+} aic_parameters_t;
+
+typedef struct aic_config {
+ struct ia_css_2500_lin_kernel_config lin_2500_config; /**< Skylake: Linearization config */
+ struct ia_css_2500_obgrid_kernel_config obgrid_2500_config; /**< Skylake: OBGRID config */
+ struct ia_css_2500_bnr_kernel_config bnr_2500_config; /**< Skylake: bayer denoise config */
+ struct ia_css_2500_shd_kernel_config shd_2500_config; /**< Skylake: shading config */
+ struct ia_css_2500_dm_kernel_config dm_2500_config; /**< Skylake: demosaic config */
+ struct ia_css_2500_rgbpp_kernel_config rgbpp_2500_config; /**< Skylake: RGBPP config */
+ struct ia_css_2500_yuvp1_b0_kernel_config yuvp1_2500_config; /**< Skylake: yuvp1 config */
+ struct ia_css_2500_yuvp1_c0_kernel_config yuvp1_c0_2500_config; /**< Skylake: yuvp1_c0 config */
+ struct ia_css_2500_yuvp2_kernel_config yuvp2_2500_config; /**< Skylake: yuvp2 config */
+ struct ia_css_tnr3_kernel_config tnr3_2500_config; /**< Skylake: TNR3 config */
+ struct ia_css_2500_dpc_kernel_config dpc_2500_config; /**< Skylake: DPC config */
+ struct ia_css_2500_awb_kernel_config awb_2500_config; /**< Skylake: auto white balance config */
+ struct ia_css_2500_awb_fr_kernel_config awb_fr_2500_config; /**< Skylake: auto white balance filter response config */
+ struct ia_css_2500_anr_kernel_config anr_2500_config; /**< Skylake: ANR config */
+ struct ia_css_2500_af_kernel_config af_2500_config; /**< Skylake: auto focus config */
+ struct ia_css_2500_ae_kernel_config ae_2500_config; /**< Skylake: auto exposure config */
+ struct ia_css_2500_bds_kernel_config bds_2500_config; /**< Skylake: bayer downscaler config */
+ struct ia_css_xnr3_config xnr_2500_config; /**< Skylake: XNR3 config */
+#ifdef MACRO_KBL_AIC
+ struct ia_css_2500_rgbir_kernel_config rgbir_2500_config; /**< Skylake: rgbir config */
+#endif
+} aic_config_t;
+
+#ifdef MACRO_KBL_AIC
+struct ia_cp_config {
+ ia_vhdr_config vhdr_config; /**< KBL: vHDR config */
+};
+#endif
diff --git a/include/ia_imaging/InterpMachine.h b/include/ia_imaging/InterpMachine.h
new file mode 100644
index 0000000..c17a9be
--- /dev/null
+++ b/include/ia_imaging/InterpMachine.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "cpffData.h"
+#include <math.h>
+
+
+
+//#ifdef SKYCAMAIC_DYNAMIC_EXPORTS
+//#define SKYCAMAIC_DYNAMIC_API __declspec(dllexport)
+//#else
+//#define SKYCAMAIC_DYNAMIC_API __declspec(dllimport)
+//#endif
+
+#define MAX_3D_INTERPOLATION 3
+
+class VoidBuffer
+{
+public:
+ VoidBuffer(int buffer_size, Type buffer_type, Precision buffer_prec);
+ VoidBuffer(int buffer_size, Type buffer_type, Precision buffer_prec, void *buffer_data);
+ ~VoidBuffer();
+ float GetBufferValue(int ind)const;
+ void SetBufferValue(float float_val, int ind);
+ int Size()const;
+ Type Btype()const;
+ Precision Prec()const;
+ VoidBuffer & operator=(const VoidBuffer &x_in);
+
+protected:
+
+ int buffer_size_;
+ Type type_;
+ Precision prec_;
+ void *val_;
+ bool allocated_here_;
+
+ int GetPrecShift(Precision prec)const;
+};
+
+
+class InterpMachine
+{
+public:
+ enum ia_isp_interpolatio_method {
+ AIC_INTERP_METHOD_NN,
+ AIC_INTERP_METHOD_LINEAR,
+ AIC_INTERP_METHOD_PARABOLA,
+ AIC_INTERP_METHOD_HERMIT,
+ AIC_INTERP_METHOD_LANCZOS2
+ };
+ InterpMachine(int GridD, const ISPGage *Gage,int *GInds);
+ InterpMachine(void);
+ ~InterpMachine(void);
+ virtual void const Interpolate(const Type ValType, const void *Values, const int ValNdims,
+ const int *ValNVals ,float *currentGage, Type resType, void *result)const;
+ virtual void Set(int GridD, const ISPGage *Gage,int *GInds);
+ bool const IsGridValid() const;
+ void const InterpolateCU(const int xValNdims, const int *xValNVals ,
+ float *currentGage, Type in_x_type, Type in_a_type,
+ Type in_b_type, Precision in_x_prec, Precision in_a_prec,
+ Precision in_b_prec, void *x1_val, void *a1_val, void *b1_val,
+ Type res_x_type, Type res_a_type, Type res_b_type,
+ Precision res_x_prec, Precision res_a_prec,
+ Precision res_b_prec, void *x_result,
+ void *a_result, void *b_result) const;
+
+protected:
+ int grid_dim_;
+ const ISPGage *gage_list_; // NofGages in list == GridDim, example: AnalogGain and CCT gaged
+ int gage_index_[MAX_3D_INTERPOLATION]; //max 3D interpolation
+ int domian_name_;
+
+ void *GetBufferPntr(int buffer_size, Type buffer_type, void *buffer_data, int g_ind)const;
+ void const Interpolate1D(INTERPOLATION_TYPE InterpType, double x1, double val1, double x2,
+ double val2, double target_x, double *target_val)const;
+ float const GetGageNodeVal(const uint8_t* source, int index, NodeType node_type)const;
+ void const findLUboundIndex(int &ind1, int &ind2, int GageInd, float currentGage)const;
+ void const Calc_Linear(double x1, double val1, double x2, double val2, double target_x, double * target_val)const;
+ void const Calc_NearestNeighbor(double x1, double val1, double x2, double val2, double target_x, double * target_val)const;
+ void const Calc_Parabola(float x1, float val1, float x2, float val2, float x3, float val3, float target_x, float * target_val)const;
+ void const Calc_Parabola4(float x1, float val1, float x2, float val2,
+ float x3, float val3,float x4, float val4, float target_x, float * target_val)const;
+ void const Calc_Hermit(float val1, float val2, float val3, float val4, float x2, float x3, float target_x, float * target_val)const;
+ float const Sinc(float t) const;
+ void const Calc_Lanczos2(float val1, float val2, float val3, float val4, float x2, float x3, float target_x, float * target_val)const;
+ inline int Calc_Cubic(float val1, float val2, float val3, float val4,float x2,
+ float x3, float target_x, float * target_val, ia_isp_interpolatio_method InterpolationMothod);
+ const void InterpolateCU1DNN(VoidBuffer &x1_in, VoidBuffer &a1_in,VoidBuffer &b1_in,
+ VoidBuffer &x2_in, VoidBuffer &a2_in,VoidBuffer &b2_in,
+ float g1,float g2, float target_g,
+ VoidBuffer &x_result, VoidBuffer &a_result, VoidBuffer &b_result)const;
+ void const InterpolateCU1DLinear(VoidBuffer &x1_in, VoidBuffer &a1_in,VoidBuffer &b1_in,
+ VoidBuffer &x2_in, VoidBuffer &a2_in,VoidBuffer &b2_in,
+ float g1,float g2, float target_g,
+ VoidBuffer &x_result, VoidBuffer &a_result, VoidBuffer &b_result)const ;
+ void CovertBuffer(VoidBuffer &x_in, VoidBuffer &x_res)const;
+ void CalcWeightedAvrageBuffer(VoidBuffer &x1, VoidBuffer &x2, float w, VoidBuffer &x_res)const;
+ float CalcWeightedAvrage(Type in_type, void* in_1buff, void *in_2buff, float w, int buf_ind)const;
+ const void InterpolateCU1D(INTERPOLATION_TYPE InterpType, VoidBuffer &x1_in, VoidBuffer &a1_in,VoidBuffer &b1_in,
+ VoidBuffer &x2_in, VoidBuffer &a2_in,VoidBuffer &b2_in,
+ float g1,float g2, float target_g,
+ VoidBuffer &x_result, VoidBuffer &a_result, VoidBuffer &b_result)const;
+ void ConvertXABToXYvectors(VoidBuffer &x, VoidBuffer &a, VoidBuffer &b,
+ VoidBuffer &y)const;
+ void ConvertXYToXABvectors(VoidBuffer &x, VoidBuffer &y,
+ VoidBuffer &a, VoidBuffer &b)const;
+
+};
+
diff --git a/include/ia_imaging/KBL_AIC.h b/include/ia_imaging/KBL_AIC.h
new file mode 100644
index 0000000..f9307ea
--- /dev/null
+++ b/include/ia_imaging/KBL_AIC.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <string>
+#include "ia_cmc_types.h"
+#include "cpffData.h"
+#include "Pipe.h"
+#include "IPU3AICCommon.h"
+#include "SkyCamAICVersion.h"
+
+class SkyCamAICImpl;
+
+class KBL_AIC
+{
+public:
+ LIBEXPORT KBL_AIC(ISPPipe **pipe, int numPipes,
+ const ia_cmc_t* cmc_parsed,
+ /*std::string cpf_file*/ const ia_binary_data* aiqb_,
+ IPU3AICRuntimeParams runtime_params,
+ unsigned int dump_aic_parameters = 0, int test_framework_dump = 0);
+ LIBEXPORT void Run(IPU3AICRuntimeParams *runtime_params, int length);
+ LIBEXPORT void Reset(IPU3AICRuntimeParams runtime_params);
+ static LIBEXPORT std::string GetAICVersion() { return SKYCAMAICVERSION; };
+ LIBEXPORT ~KBL_AIC(void);
+
+private:
+ SkyCamAICImpl** pimpl_;
+ int numAics_;
+};
+
+
diff --git a/include/ia_imaging/Pipe.h b/include/ia_imaging/Pipe.h
new file mode 100644
index 0000000..b1eb70e
--- /dev/null
+++ b/include/ia_imaging/Pipe.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "ia_aiq_types.h"
+#include "stats_3a_public.h"
+#include "rgbpp_public.h"
+#include "ia_cp_types.h"
+
+
+struct ia_cp_output {
+ ia_vhdr_config *vhdr_config; /**< KBL: vHDR config */
+};
+
+typedef struct aic_output{
+ struct ia_css_2500_lin_kernel_config *lin_2500_config; /**< Skylake: Linearization config */
+ struct ia_css_2500_obgrid_kernel_config *obgrid_2500_config; /**< Skylake: OBGRID config */
+ struct ia_css_2500_bnr_kernel_config *bnr_2500_config; /**< Skylake: bayer denoise config */
+ struct ia_css_2500_shd_kernel_config *shd_2500_config; /**< Skylake: shading config */
+ struct ia_css_2500_dm_kernel_config *dm_2500_config; /**< Skylake: demosaic config */
+ struct ia_css_2500_rgbpp_kernel_config *rgbpp_2500_config; /**< Skylake: RGBPP config */
+ struct ia_css_2500_yuvp1_b0_kernel_config *yuvp1_2500_config; /**< Skylake: yuvp1 config */
+ struct ia_css_2500_yuvp2_kernel_config *yuvp2_2500_config; /**< Skylake: yuvp2 config */
+ struct ia_css_2500_yuvp1_c0_kernel_config *yuvp1_c0_2500_config; /**< Skylake: yuvp1_c0 config */
+ struct ia_css_tnr3_kernel_config *tnr3_2500_config; /**< Skylake: TNR3 config */
+ struct ia_css_2500_dpc_kernel_config *dpc_2500_config; /**< Skylake: DPC config */
+ struct ia_css_2500_awb_kernel_config *awb_2500_config; /**< Skylake: auto white balance config */
+ struct ia_css_2500_awb_fr_kernel_config *awb_fr_2500_config; /**< Skylake: auto white balance filter response config */
+ struct ia_css_2500_anr_kernel_config *anr_2500_config; /**< Skylake: ANR config */
+ struct ia_css_2500_af_kernel_config *af_2500_config; /**< Skylake: auto focus config */
+ struct ia_css_2500_ae_kernel_config *ae_2500_config; /**< Skylake: auto exposure config */
+ struct ia_css_xnr3_config *xnr_2500_config; /**< Skylake: XNR3 config */
+ struct ia_css_2500_rgbir_kernel_config *rgbir_2500_config; /**< Skylake: rgbir config */
+} aic_output_t;
+
+
+class ISPPipe
+{
+public:
+ enum pipe_ver{
+ Bzero,
+ Czero,
+ Czero_KBL
+ };
+
+ ISPPipe(void)
+ {
+ }
+
+ virtual ~ISPPipe(void)
+ {
+ }
+
+ // HACK, not pure virtual function for backward compatibility
+ // This function transfers the vHDR paramters to CPlibs vHDR
+ virtual void SetCpConfig(const ia_cp_output cp_config) { (void)cp_config; }
+
+ // This function configures the HW/FW pipe via CSS interface
+ virtual void SetPipeConfig(const aic_output_t pipe_config) = 0;
+
+ virtual pipe_ver GetPipeVer() = 0;
+
+ virtual const ia_aiq_rgbs_grid* GetAWBStats() = 0;
+ virtual const ia_aiq_af_grid* GetAFStats() = 0;
+ virtual const ia_aiq_histogram* GetAEStats() = 0;
+
+};
+
diff --git a/include/ia_imaging/SkyCamAIC.h b/include/ia_imaging/SkyCamAIC.h
new file mode 100644
index 0000000..7ad63bb
--- /dev/null
+++ b/include/ia_imaging/SkyCamAIC.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "ia_cmc_types.h"
+#include "cpffData.h"
+#include "Pipe.h"
+#include "SkyCamAICCommon.h"
+#include "SkyCamAICVersion.h"
+
+class SkyCamAICImpl;
+
+class SkyCamAIC
+{
+
+public:
+ LIBEXPORT SkyCamAIC(ISPPipe *pipe, const ia_cmc_t* cmc_parsed,
+/*std::string cpf_file*/ const ia_binary_data* aiqb_, SkyCamAICRuntimeParams runtime_params,
+ unsigned int dump_aic_parameters=0, int test_framework_dump=0);
+ LIBEXPORT void Run(SkyCamAICRuntimeParams runtime_params);
+ LIBEXPORT void Reset(SkyCamAICRuntimeParams runtime_params);
+ static LIBEXPORT std::string GetAICVersion(){return SKYCAMAICVERSION;};
+ LIBEXPORT ~SkyCamAIC(void);
+
+private:
+ SkyCamAICImpl* pimpl_;
+
+ void ConvertRuntimeSkyCamToIPU3(const SkyCamAICRuntimeParams &sklParams, IPU3AICRuntimeParams &ipu3Params);
+};
+
+
diff --git a/include/ia_imaging/SkyCamAICCommon.h b/include/ia_imaging/SkyCamAICCommon.h
new file mode 100644
index 0000000..aebba0a
--- /dev/null
+++ b/include/ia_imaging/SkyCamAICCommon.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "IPU3AICCommon.h"
+
+struct SkyCamAICRuntimeParams
+{
+ long long time_stamp;
+ ia_aiq_frame_use frame_use;
+ int mode_index;
+ const aic_input_frame_parameters_t *input_frame_params; /*!< Mandatory. Inputr frame parameters. Describe frame scaling/cropping done in sensor. */
+ const aic_resolution_config_parameters_t *frame_resolution_parameters;
+ const ia_aiq_output_frame_parameters_t *output_frame_params; /*!< Mandatory. Output frame parameters. */
+ const ia_aiq_exposure_parameters *exposure_results; /*!< Mandatory. Exposure parameters which are to be used to calculate next ISP parameters. */
+ const ia_aiq_hist_weight_grid *weight_grid;
+ const ia_aiq_awb_results *awb_results; /*!< Mandatory. WB results which are to be used to calculate next ISP parameters (WB gains, color matrix,etc). */
+ const ia_aiq_gbce_results *gbce_results; /*!< Mandatory. GBCE Gamma tables which are to be used to calculate next ISP parameters.
+ If NULL pointer is passed, AIC will use static gamma table from the CPF. */
+ const ia_aiq_pa_results *pa_results; /*!< Mandatory. Parameter adaptor results from AIQ. */
+ const ia_aiq_sa_results *sa_results; /*!< Mandatory. Shading adaptor results from AIQ. */
+ uint32_t isp_vamem_type; /*!< Mandatory. ISP vamem type. */
+
+ char manual_brightness; /*!< Optional. Manual brightness value range [-128,127]. */
+ char manual_contrast; /*!< Optional. Manual contrast value range [-128,127]. */
+ char manual_hue; /*!< Optional. Manual hue value range [-128,127]. */
+ char manual_saturation; /*!< Optional. Manual saturation value range [-128,127]. */
+ char manual_sharpness; /*!< Optional. Manual setting for sharpness [-128,127]. */
+ ia_isp_effect effects; /*!< Optional. Manual setting for special effects. Combination of ia_aiq_effect enums.*/
+ ia_rectangle *focus_rect;
+ sd_dpc_output *scdpc_data;
+};
diff --git a/include/ia_imaging/SkyCamAICVersion.h b/include/ia_imaging/SkyCamAICVersion.h
new file mode 100644
index 0000000..80ab180
--- /dev/null
+++ b/include/ia_imaging/SkyCamAICVersion.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _SKYCAMAICVERSION_H_
+#define _SKYCAMAICVERSION_H_
+#define SKYCAMAICVERSION "3.1.1.0"
+#endif
diff --git a/include/ia_imaging/ae_public.h b/include/ia_imaging/ae_public.h
new file mode 100644
index 0000000..2741dda
--- /dev/null
+++ b/include/ia_imaging/ae_public.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AE_PUBLIC_H_
+#define _AE_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Auto Exposure (AE) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+typedef struct {
+ unsigned short gain_GR;
+ unsigned short gain_R;
+ unsigned short gain_B;
+ unsigned short gain_GB;
+} ae_public_config_ccm_wb_coeffs_t;
+
+
+#define AE_CCM_NUM_OF_MAT_COEFFS 16
+
+typedef struct {
+ signed short coeffs[AE_CCM_NUM_OF_MAT_COEFFS];
+} ae_public_config_ccm_mat_coeffs_t;
+
+
+#define AE_NUM_OF_WEIGHTS (32*24)
+
+typedef struct ae_public_config_weights {
+ unsigned char val[AE_NUM_OF_WEIGHTS];
+} ae_public_config_weights_t;
+
+
+struct ae_public_config_grid_config{
+ unsigned char grid_width; /**< number of horizontal grid cells */
+ unsigned char grid_height; /**< number of vertical grid cells */
+ unsigned char block_width; /**< log2 the width of each cell (8,16,32,64,128) */
+ unsigned char block_height; /**< log2 the height of each cell (8,16,32,64,128) */
+ unsigned short x_start; /**< x top left corner of the grid */
+ unsigned short y_start; /**< y top left corner of the grid */
+ unsigned char ae_en; /**< 0 - ae ff does not write to meta-data array,
+ 1 - ae ff writes to meta-data array */
+};
+
+typedef struct ae_public_config_ccm_coeffs {
+ ae_public_config_ccm_wb_coeffs_t wb_coeffs;
+ ae_public_config_ccm_mat_coeffs_t mat_coeffs;
+} ae_public_config_ccm_coeffs_t;
+
+struct ae_public_config {
+ ae_public_config_ccm_coeffs_t ae_ccm;
+ ae_public_config_weights_t ae_weights;
+ struct ae_public_config_grid_config ae_grid_config;
+};
+
+struct ia_css_2500_ae_kernel_config {
+ struct ae_public_config ae;
+};
+
+
+
+/* ae public meta-data types */
+#define AE_NUM_OF_HIST_BINS 256
+typedef struct {
+ unsigned int vals[AE_NUM_OF_HIST_BINS];
+} ae_public_color_hist_t;
+
+typedef struct ae_public_raw_buffer {
+ ae_public_color_hist_t hist_R;
+ ae_public_color_hist_t hist_G;
+ ae_public_color_hist_t hist_B;
+ ae_public_color_hist_t hist_Y;
+} ae_public_raw_buffer_t;
+
+/** @brief Print AE public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print AE public configuration.
+ */
+void ia_css_ae_public_cfg_dump(
+ const struct ia_css_2500_ae_kernel_config *cfg);
+
+/** @brief Compare two AE public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two AE public configurations
+ */
+bool ia_css_ae_public_cfg_compare(
+ const struct ia_css_2500_ae_kernel_config *cfg1,
+ const struct ia_css_2500_ae_kernel_config *cfg2,
+ bool cfg_dump);
+#endif /* _AE_PUBLIC_H_ */
diff --git a/include/ia_imaging/af_public.h b/include/ia_imaging/af_public.h
new file mode 100644
index 0000000..d521ba2
--- /dev/null
+++ b/include/ia_imaging/af_public.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AF_PUBLIC_H_
+#define _AF_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Auto Focus (AF) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+/* All structs in this file will be visible to the CSS APU User.
+ * The User will be able to set each one of the config params separately by
+ * specifying a different config type (see sh_config_type in sh_css.h).
+ * If one of those config structs is not set explicitly, a default value will
+ * be use instead.
+ */
+
+#define AF_MIN_GRID_WIDTH 16
+#define AF_MIN_GRID_HEIGHT 16
+#define AF_MAX_GRID_WIDTH 32
+#define AF_MAX_GRID_HEIGHT 24
+#define AF_MIN_BLOCK_WIDTH 3
+#define AF_MIN_BLOCK_HEIGHT 3
+#define AF_MAX_BLOCK_WIDTH 6 /**< HSD1403986067 bug in c0, restrict max block width to 6 instead of 7 */
+#define AF_MAX_BLOCK_HEIGHT 6 /**< HSD1403986067 bug in c0, restrict max block height to 6 instead of 7 */
+
+typedef struct af_public_coeffs_config{
+ unsigned char A1; /**< default value 0 */
+ unsigned char A2; /**< default value 0 */
+ unsigned char A3; /**< default value 0 */
+ unsigned char A4; /**< default value 0 */
+ unsigned char A5; /**< default value 0 */
+ unsigned char A6; /**< default value 0 */
+ unsigned char A7; /**< default value 0 */
+ unsigned char A8; /**< default value 0 */
+ unsigned char A9; /**< default value 0 */
+ unsigned char A10; /**< default value 0 */
+ unsigned char A11; /**< default value 0 */
+ unsigned char A12; /**< default value 128 */
+ unsigned int sign_vec;
+} af_public_coeffs_config_t;
+
+/** constraint:
+* y_gen_rate_gr + y_gen_rate_r + y_gen_rate_b + y_gen_rate_gb = 32
+*/
+typedef struct af_public_y_calc_config{
+ unsigned char y_gen_rate_gr; /**< default value 8 */
+ unsigned char y_gen_rate_r; /**< default value 8 */
+ unsigned char y_gen_rate_b; /**< default value 8 */
+ unsigned char y_gen_rate_gb; /**< default value 8 */
+} af_public_y_calc_config_t;
+
+typedef struct af_public_nf_config{
+ /* TODO - do these numbers need to be calculated from the other config params? */
+ unsigned char y1_nf; /**< default value 7 */
+ unsigned char y2_nf; /**< default value 7 */
+} af_public_nf_config_t;
+
+/**
+* constraint: this grid has to be totally internal to the processed frame plane
+* with margins of 10 per horizontal direction and 2 per vertical direction
+* therefore, we'll set its default vaule to represent the smallest size;
+* this will restrain the processed resolution the less
+*/
+struct af_public_grid_config{
+ unsigned char grid_width; /**< default value 16 */
+ unsigned char grid_height; /**< default value 16 */
+ unsigned char block_width; /**< default value 3, Log2 the width of each cell (8,16,32,64,128) */
+ unsigned char block_height; /**< default value 3, Log2 the height of each cell (8,16,32,64,128) */
+ unsigned short x_start; /**< default value 10, X top left corner of the grid x_start is even */
+ unsigned short y_start; /**< default value 2, Y top left corner of the grid y_start is even */
+ unsigned char af_y_en; /**< default value 1, af ff enable/disable meta data generation */
+} ;
+
+struct af_public_config {
+ af_public_coeffs_config_t y1_coeffs;
+ af_public_coeffs_config_t y2_coeffs;
+ af_public_y_calc_config_t y_calc;
+ af_public_nf_config_t nf;
+ struct af_public_grid_config grid;
+};
+
+struct ia_css_2500_af_kernel_config {
+ struct af_public_config af;
+};
+
+#define AF_PUBLIC_NUM_OF_SETS_IN_BUFFER AF_MAX_GRID_HEIGHT
+/** Based on max grid width + Spare for bubbles */
+#define AF_PUBLIC_NUM_OF_ITEMS_IN_SET (AF_MAX_GRID_WIDTH + 20)
+
+/* af public meta-data */
+typedef struct af_public_y_item{
+ unsigned short y1_avg;
+ unsigned short y2_avg;
+} af_public_y_item_t;
+
+#define AF_BUFF_RATIO 2 /**< AF stats buffer ratio */
+
+typedef struct af_public_raw_buffer{
+ af_public_y_item_t y_table[AF_PUBLIC_NUM_OF_SETS_IN_BUFFER * AF_PUBLIC_NUM_OF_ITEMS_IN_SET *
+ AF_BUFF_RATIO]; /**< af statistics table */
+} af_public_raw_buffer_t;
+
+/** @brief Print AF public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print AF public configuration.
+ */
+void ia_css_af_public_cfg_dump(const struct ia_css_2500_af_kernel_config *cfg);
+
+/** @brief Compare two AF public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two AF public configurations
+ */
+bool ia_css_af_public_cfg_compare(
+ const struct ia_css_2500_af_kernel_config *cfg1,
+ const struct ia_css_2500_af_kernel_config *cfg2,
+ bool cfg_dump);
+#endif /* _AF_PUBLIC_H_ */
diff --git a/include/ia_imaging/anr_public.h b/include/ia_imaging/anr_public.h
new file mode 100644
index 0000000..32c1ef6
--- /dev/null
+++ b/include/ia_imaging/anr_public.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ANR_PUBLIC_H_
+#define _ANR_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Advanced Noice Reduction (ANR) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+/* All structs in this file will be visible to the CSS API User.
+* The User will be able to set each one of the config params separately by
+* specifying a different config type (see sh_config_type in sh_css.h).
+* If one of those config structs is not set explicitly, a default value will
+* be use instead.
+*/
+
+//////////////////////////////////////////////////////////////
+// ANR SEARCH //
+//////////////////////////////////////////////////////////////
+
+/* NONE TO EXPOSE */
+
+
+//////////////////////////////////////////////////////////////
+// ANR TRANSFORM //
+//////////////////////////////////////////////////////////////
+
+
+typedef struct alpha
+{
+ short Alpha_Gr;
+ short Alpha_R;
+ short Alpha_B;
+ short Alpha_Gb;
+ short Alpha_DC_Gr;
+ short Alpha_DC_R;
+ short Alpha_DC_B;
+ short Alpha_DC_Gb;
+
+}alpha_t;
+
+
+typedef struct beta
+{
+
+ short Beta_Gr;
+ short Beta_R;
+ short Beta_B;
+ short Beta_Gb;
+
+}beta_t;
+
+
+#define W_MATRIX_SIZE 16
+typedef struct plain_color_w_matrix
+{
+ short Gr[W_MATRIX_SIZE];
+ short R[W_MATRIX_SIZE];
+ short B[W_MATRIX_SIZE];
+ short Gb[W_MATRIX_SIZE];
+
+
+}plain_color_w_matrix_t;
+
+
+typedef struct anr_transform_plane
+{
+ alpha_t alpha;
+ beta_t beta;
+ plain_color_w_matrix_t color_reg_w;
+
+}anr_transform_plane_t;
+
+
+
+#define LUT_ENTRY_NUM 25
+
+
+typedef struct anr_transform_R_CALC
+{
+ /** bits 0:12 - Xreset */
+ short Xreset;
+ /** bits 16:28 - Yreset */
+ short Yreset;
+
+ /** BITS 32:39 - A = RADIAL GAIN R^2 norm - shift */
+ short R_NormFactor;
+
+ /** bits 40:47 - a = Radial gain scale factor*2^6 */
+ short radial_gain_scale_factor;
+
+ /** calculated from Xreset */
+ int X_sqr_reset;
+ /** calculated from Yreset */
+ int Y_sqr_reset;
+
+}anr_transform_R_CALC_t;
+
+
+typedef struct anr_transform_public
+{
+
+ short ADAPTIVE_TRESHHOLD_EN;
+ anr_transform_plane_t plane_0;
+ anr_transform_plane_t plane_1;
+ anr_transform_plane_t plane_2;
+ anr_transform_R_CALC_t CALC;
+
+}anr_transform_public_t;
+
+
+
+
+/////////////////////////////////////////////////////////////
+// ANR STITCH //
+//////////////////////////////////////////////////////////////
+
+
+#define PYRAMID_ENTRY_NUM 64
+typedef struct anr_stitch_public
+{
+ short pyramid_reg[PYRAMID_ENTRY_NUM];
+
+}anr_stitch_public_t;
+
+
+
+//////////////////////////////////////////////////////////////
+// ANR TILE 2 STRM //
+//////////////////////////////////////////////////////////////
+
+/* NONE to expose */
+
+
+struct anr_public_config
+{
+ anr_transform_public_t transform;
+ anr_stitch_public_t stitch;
+};
+
+struct ia_css_2500_anr_kernel_config
+{
+ struct anr_public_config anr;
+};
+
+/** @brief Print ANR public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print ANR public configuration.
+ */
+void ia_css_anr_public_cfg_dump(const struct ia_css_2500_anr_kernel_config *cfg);
+
+/** @brief Compare two ANR public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two ANR public configurations
+ */
+bool ia_css_anr_public_cfg_compare(
+ const struct ia_css_2500_anr_kernel_config *cfg1,
+ const struct ia_css_2500_anr_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif
diff --git a/include/ia_imaging/awb_fr_public.h b/include/ia_imaging/awb_fr_public.h
new file mode 100644
index 0000000..15f2853
--- /dev/null
+++ b/include/ia_imaging/awb_fr_public.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AWB_FR_PUBLIC_H_
+#define _AWB_FR_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Auto White Balance Filter Response (AWB) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+/* All structs in this file will be visible to the CSS API User.
+ * The User will be able to set each one of the config params separately by
+ * specifying a different config type (see sh_config_type in sh_css.h).
+ * If one of those config structs is not set explicitly, a default value will
+ * be used instead.
+ */
+
+#define AWB_FR_MIN_GRID_WIDTH 16
+#define AWB_FR_MIN_GRID_HEIGHT 16
+#define AWB_FR_MAX_GRID_WIDTH 32
+#define AWB_FR_MAX_GRID_HEIGHT 24
+#define AWB_FR_MIN_BLOCK_WIDTH 3
+#define AWB_FR_MIN_BLOCK_HEIGHT 3
+#define AWB_FR_MAX_BLOCK_WIDTH 6 /**< HSD1403986067 bug in c0, restrict max block width to 6 instead of 7 */
+#define AWB_FR_MAX_BLOCK_HEIGHT 6 /**< HSD1403986067 bug in c0, restrict max block height to 6 instead of 7 */
+
+typedef struct awb_fr_public_coeffs_config {
+ unsigned char A1; /**< default value 0 */
+ unsigned char A2; /**< default value 0 */
+ unsigned char A3; /**< default value 0 */
+ unsigned char A4; /**< default value 0 */
+ unsigned char A5; /**< default value 0 */
+ unsigned char A6; /**< default value 128 */
+ unsigned int sign_vec; /**< default value 0 */
+} awb_fr_public_coeffs_config_t;
+
+
+typedef struct awb_fr_public_nf_config {
+ //TODO - this is calculate by log2 of the sum ofcoeffs, should it be exposed to user?
+ unsigned char bayer_nf;
+
+} awb_fr_public_nf_config_t;
+
+/**
+* constraint: this grid has to be totally internal to the processed frame plane
+* with margins of 10 per horizontal direction and 2 per vertical direction
+* therefore, we'll set its default value to represent the smallest size;
+* this will restrain the processed resolution the less
+*/
+struct awb_fr_public_grid_config{
+ unsigned char grid_width; /**< default value 16, Note: according to HAS - 32 */
+ unsigned char grid_height; /**< default value 16, Note: according to HAS - 24 */
+ unsigned char block_width; /**< default value 3, Log2 the width of each cell (8,16,32,64,128) */
+ unsigned char block_height; /**< default value 3, Log2 the width of each cell (8,16,32,64,128) */
+ unsigned short x_start; /**< default value 10, X top left corner of the grid x_start is even */
+ unsigned short y_start; /**< default value 2, Y top left corner of the grid y_start is even */
+ unsigned char af_bayer_en; /**< default value 1, awb_fr ff enable/disable meta data generation */
+};
+
+struct awb_fr_public_config {
+ awb_fr_public_coeffs_config_t bayer_coeffs;
+ awb_fr_public_nf_config_t nf;
+ struct awb_fr_public_grid_config grid;
+};
+
+struct ia_css_2500_awb_fr_kernel_config {
+ struct awb_fr_public_config awb_fr;
+};
+
+// awb_fr public meta-data
+typedef struct awb_fr_public_bayer_item{
+ unsigned short gr_avg; /**< Average level of GreenR color */
+ unsigned short r_avg; /**< Average level of Red color */
+ unsigned short b_avg; /**< Average level of Blue color */
+ unsigned short gb_avg; /**< Average level of GreenB color */
+
+} awb_fr_public_bayer_item_t;
+
+/** Based on max grid width + spare for bubbles */
+#define AWB_FR_PUBLIC_NUM_OF_ITEMS_IN_SET (AWB_FR_MAX_GRID_WIDTH + 20)
+#define AWB_FR_PUBLIC_NUM_OF_SETS_IN_BUFFER AWB_FR_MAX_GRID_HEIGHT
+
+#define AWB_FR_BUFF_RATIO 2 /**< AWB_FR stats buffer ratio */
+
+typedef struct awb_fr_public_raw_buffer{
+ awb_fr_public_bayer_item_t bayer_table[AWB_FR_PUBLIC_NUM_OF_ITEMS_IN_SET *
+ AWB_FR_PUBLIC_NUM_OF_SETS_IN_BUFFER * AWB_FR_BUFF_RATIO]; /**< awb_fr statistics table */
+} awb_fr_public_raw_buffer_t;
+
+/** @brief Print AWB_FR public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print AWB_FR public configuration.
+ */
+void ia_css_awb_fr_public_cfg_dump(
+ const struct ia_css_2500_awb_fr_kernel_config *cfg);
+
+/** @brief Compare two AWB_FR public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two AWB_FR public configurations
+ */
+bool ia_css_awb_fr_public_cfg_compare(
+ const struct ia_css_2500_awb_fr_kernel_config *cfg1,
+ const struct ia_css_2500_awb_fr_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif /* _AWB_FR_PUBLIC_H_ */
diff --git a/include/ia_imaging/awb_public.h b/include/ia_imaging/awb_public.h
new file mode 100644
index 0000000..7095b41
--- /dev/null
+++ b/include/ia_imaging/awb_public.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _AWB_PUBLIC_H_
+#define _AWB_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Auto White Balance (AWB) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+// All structs in this file will be visible to the CSS APU User.
+// The User will be able to set each one of the config params separately by
+// specifying a different config type (see sh_config_type in sh_css.h).
+// If one of those config structs is not set explicitly, a default value will
+// be use instead.
+
+#define AWB_MIN_GRID_WIDTH 16
+#define AWB_MIN_GRID_HEIGHT 16
+#define AWB_MAX_GRID_WIDTH 80
+#define AWB_MAX_GRID_HEIGHT 60
+
+struct awb_public_config_grid_config{
+ unsigned char grid_width; /**< number of horizontal grid cells */
+ unsigned char grid_height; /**< number of vertical grid cells */
+ unsigned char grid_block_width; /**< log2 the width of each cell (8,16,32,64) */
+ unsigned char grid_block_height; /**< log2 the height of each cell (8,16,32,64) */
+ unsigned short grid_x_start; /**< x top left corner of the grid */
+ unsigned short grid_y_start; /**< y top left corner of the grid */
+};
+
+struct awb_public_config {
+ unsigned short rgbs_Gr_threshold;
+ unsigned short rgbs_R_threshold;
+ unsigned short rgbs_B_threshold;
+ unsigned short rgbs_Gb_threshold;
+ unsigned char rgbs_en;
+ unsigned char rgbs_incl_sat;
+ struct awb_public_config_grid_config grid;
+};
+
+struct ia_css_2500_awb_kernel_config{
+ struct awb_public_config awb;
+};
+
+
+
+// awb public meta-data types
+typedef struct awb_public_meta{
+ int dummy;
+} awb_public_meta_t;
+
+typedef struct awb_public_set_item{
+ unsigned char Gr_avg;
+ unsigned char R_avg;
+ unsigned char B_avg;
+ unsigned char Gb_avg;
+ unsigned char sat_ratio;
+ unsigned char padding0; /**< Added the padding so that the public matches that private */
+ unsigned char padding1; /**< Added the padding so that the public matches that private */
+ unsigned char padding2; /**< Added the padding so that the public matches that private */
+} awb_public_set_item_t;
+
+
+#define AWB_PUBLIC_NUM_OF_ITEMS_IN_SET 160
+/** Based on max grid height + Spare for bubbles */
+#define AWB_PUBLIC_NUM_OF_SETS_IN_BUFFER (60 + 20)
+
+typedef struct awb_public_raw_buffer{
+ awb_public_set_item_t rgb_table[AWB_PUBLIC_NUM_OF_SETS_IN_BUFFER*AWB_PUBLIC_NUM_OF_ITEMS_IN_SET];
+} awb_public_raw_buffer_t;
+
+/** @brief Print AWB public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print AWB public configuration.
+ */
+void ia_css_awb_public_cfg_dump(const struct ia_css_2500_awb_kernel_config *cfg);
+
+/** @brief Compare two AWB public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two AWB public configurations
+ */
+bool ia_css_awb_public_cfg_compare(
+ const struct ia_css_2500_awb_kernel_config *cfg1,
+ const struct ia_css_2500_awb_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif // _AWB_PUBLIC_H_
diff --git a/include/ia_imaging/bds_public.h b/include/ia_imaging/bds_public.h
new file mode 100644
index 0000000..95239a0
--- /dev/null
+++ b/include/ia_imaging/bds_public.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** @file
+* CSS-API header file for 2500/Skycam Bayer Down-scaling (BDS) kernel/accelerator.
+*
+* Created on: Aug 18, 2013
+* Author: ynahum
+*/
+//#include <type_support.h>
+
+#ifndef BDS_PUBLIC_H_
+#define BDS_PUBLIC_H_
+
+#define BDS_MAX_SEQ_PATTERN_SIZE 8
+#define BDS_MAX_PHASES 64
+#define BDS_NUM_OF_TAPS 6
+
+#define BDS_SCALE_RATIO_GRANULARITY 32
+#define BDS_MAX_SF (BDS_SCALE_RATIO_GRANULARITY * 4)
+#define BDS_MIN_SF (BDS_SCALE_RATIO_GRANULARITY)
+
+#define BDS_NUM_OF_SF ( 1 + BDS_MAX_SF - BDS_MIN_SF )
+
+struct bds_public_config {
+
+ unsigned int hor_crop_enable;
+ unsigned int hor_crop_start;
+ unsigned int hor_crop_end;
+
+ unsigned int hor_enable;
+ int hor_coeffs[BDS_MAX_PHASES][BDS_NUM_OF_TAPS];
+ unsigned int hor_nf[BDS_MAX_PHASES];
+
+ unsigned int ver_enable;
+ int ver_coeffs[BDS_MAX_PHASES][BDS_NUM_OF_TAPS];
+ unsigned int ver_nf[BDS_MAX_PHASES];
+
+ unsigned int phase_count;
+ unsigned int sequence_len;
+ unsigned int sequence_pat[BDS_MAX_SEQ_PATTERN_SIZE];
+
+
+};
+
+struct ia_css_2500_bds_kernel_config {
+ struct bds_public_config bds;
+};
+
+/** @brief Print BDS public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print BDS public configuration.
+ */
+void ia_css_bds_public_cfg_dump(const struct ia_css_2500_bds_kernel_config *cfg);
+
+/** @brief Compare two BDS public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two BDS public configurations
+ */
+bool ia_css_bds_public_cfg_compare(
+ const struct ia_css_2500_bds_kernel_config *cfg1,
+ const struct ia_css_2500_bds_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif /* BDS_PUBLIC_H_ */
diff --git a/include/ia_imaging/bnr_public.h b/include/ia_imaging/bnr_public.h
new file mode 100644
index 0000000..d121c9d
--- /dev/null
+++ b/include/ia_imaging/bnr_public.h
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _BNR_PUBLIC_H_
+#define _BNR_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Bayer Noise Removal (BNR) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+// All structs in this file will be visible to the CSS API User.
+// The User will be able to set each one of the config params separately by
+// specifying a different config type (see sh_config_type in sh_css.h).
+// If one of those config structs is not set explicitly, a default value will
+// be use instead.
+
+typedef struct {
+ unsigned short gr;
+ unsigned short r;
+ unsigned short b;
+ unsigned short gb;
+}bnr_public_config_wb_gains_config_t;
+
+typedef struct {
+ unsigned char gr;
+ unsigned char r;
+ unsigned char b;
+ unsigned char gb;
+}bnr_public_config_wb_gains_thr_config_t;
+
+typedef struct {
+ unsigned short cf;
+ unsigned char cg;
+ unsigned char ci;
+ unsigned char r_nf;
+}bnr_public_config_thr_coeffs_config_t;
+
+typedef struct {
+ unsigned char gr;
+ unsigned char r;
+ unsigned char b;
+ unsigned char gb;
+}bnr_public_config_thr_ctrl_shd_config_t;
+
+typedef struct {
+ short x_reset;
+ short y_reset;
+ unsigned int x_sqr_reset;
+ unsigned int y_sqr_reset;
+}bnr_public_config_opt_center_config_t;
+
+typedef struct {
+ unsigned char bp_thr_gain;
+ unsigned char defect_mode;
+ unsigned int bp_gain;
+ unsigned int w0_coeff;
+ unsigned int w1_coeff;
+}bnr_public_config_bp_ctrl_config_t;
+
+
+typedef struct {
+ unsigned char alpha; /**< Weight of central element of
+ smoothing filter
+ range: [0..0xF]*/
+ unsigned char beta; /**< Weight of peripheral elements of
+ smoothing filter
+ range: [0..0xF]*/
+ unsigned char gamma; /**< Weight of diagonal elements of
+ smoothing filter
+ range: [0..0xF]*/
+ unsigned short max_inf; /**< Maximum increase of peripheral
+ or diagonal element influence
+ relative to the predefined value
+ range: [0x5..0xA]*/
+ unsigned char gd_en; /**< Greenn Disparity ff enable control
+ range: [0 - disable, 1 - enable] */
+ unsigned char bpc_en; /**< Bad Pixel Correction ff enable control
+ range: [0 - disable, 1 - enable] */
+ unsigned char bnr_en; /**< Bayer Noise Removal ff enable control
+ range: [0 - disable, 1 - enable] */
+}bnr_public_config_dn_detect_ctrl_config_t;
+
+#define BNR_LUT_SIZE 32
+typedef struct {
+ unsigned char values[BNR_LUT_SIZE];
+} bnr_public_config_lut_config_t;
+
+typedef struct bnr_public_config_green_disparity {
+ unsigned int GD_Red;
+ unsigned int GD_Green;
+ unsigned int GD_Blue;
+ unsigned int GD_Black;
+ unsigned int GD_Shading;
+ unsigned int GD_Support;
+ unsigned int GD_Clip;
+ unsigned int GD_Central_Weight;
+} bnr_public_config_lut_config_green_disparity_t;
+
+struct bnr_public_config
+{
+ bnr_public_config_wb_gains_config_t wb_gains;
+ bnr_public_config_wb_gains_thr_config_t wb_gains_thr;
+ bnr_public_config_thr_coeffs_config_t thr_coeffs;
+ bnr_public_config_thr_ctrl_shd_config_t thr_ctrl_shd;
+ bnr_public_config_opt_center_config_t opt_center;
+ bnr_public_config_bp_ctrl_config_t bp_ctrl;
+ bnr_public_config_dn_detect_ctrl_config_t dn_detect_ctrl;
+ bnr_public_config_lut_config_t lut;
+};
+
+struct ia_css_2500_bnr_kernel_config
+{
+ struct bnr_public_config bnr;
+ bnr_public_config_lut_config_green_disparity_t green_disparity;
+};
+
+/** @brief Print BNR public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print BNR public configuration.
+ */
+void ia_css_bnr_public_cfg_dump(
+ const struct ia_css_2500_bnr_kernel_config *cfg);
+
+/** @brief Compare two BNR public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two BNR public configurations
+ */
+bool ia_css_bnr_public_cfg_compare(
+ const struct ia_css_2500_bnr_kernel_config *cfg1,
+ const struct ia_css_2500_bnr_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif // _BNR_PUBLIC_H_
diff --git a/include/ia_imaging/cpffData.h b/include/ia_imaging/cpffData.h
new file mode 100644
index 0000000..0b28f77
--- /dev/null
+++ b/include/ia_imaging/cpffData.h
@@ -0,0 +1,947 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CPFF_SPECIFIC_DATA_H_
+#define _CPFF_SPECIFIC_DATA_H_
+
+#include <new>
+
+#include <stdint.h>
+#include "ia_types.h"
+
+#pragma pack(push,1)
+
+enum INTERPOLATION_TYPE
+{
+ Linear_INT = 0,
+ NearestNeighbor_INT = 1
+};
+
+enum EXTRAPOLATION_TYPE
+{
+ Native_EXT = 0,
+ Replicate_EXT = 1,
+ NearestNeighbor_EXT = 2
+};
+
+enum GageType
+{
+ AnalogGain_Gage = 0,
+ CCT_Gage = 1,
+ Contrast_Gage = 2,
+ ExposureTime_Gage = 3,
+ Const_Gage = 4,
+ ScaleFactor_Gage = 5,
+ TotalGain_Gage = 6
+};
+
+enum NodeType
+{
+ int32_NodeType = 0,
+ float_NodeType = 1
+};
+
+enum Blocks
+{
+ ISP_DefectPixelCorrection = 3,
+ ISP_BayerDownScale = 4,
+ ISP_GridBlackLevelSubtraction = 7,
+ ISP_Linearization = 10,
+ ISP_AWB_Statistics = 12,
+ ISP_AF_Statistics = 13,
+ ISP_BNR_DynamicDPC = 17,
+ ISP_Bayer_ANR = 18,
+ ISP_Demosaicing = 19,
+ ISP_Gamma = 21,
+ ISP_ColorSpaceConversion_ChromaDownsampling = 22,
+ ISP_Y_EdgeEnhance_NoiseReduction = 25,
+ ISP_ChromaNoiseReduction = 27,
+ ISP_XNR = 28,
+ ISP_UV_Color_Enhancement = 32,
+ ISP_TNR = 34,
+ ISP_AWB_Filter_Response_Statistics = 37,
+ ISP_IEFD = 38,
+ ISP_vHDR = 40
+};
+
+enum ISP_DefectPixelCorrection
+{
+ gradThresh = 0
+};
+
+enum ISP_BayerDownScale
+{
+ hor_enable = 0,
+ ver_enable = 1,
+ hor_coeffs = 2,
+ hor_nf = 3,
+ ver_coeffs = 4,
+ ver_nf = 5,
+ phase_count = 6,
+ sequence_len = 7,
+ sequence_pat = 8
+};
+
+enum ISP_GridBlackLevelSubtraction
+{
+ GBLS_grid_width = 0,
+ GBLS_grid_height = 1,
+ GBLS_coeff_R = 2,
+ GBLS_coeff_Gr = 3,
+ GBLS_coeff_Gb = 4,
+ GBLS_coeff_B = 5
+};
+
+enum ISP_Linearization
+{
+ LinGr = 0,
+ LinR = 1,
+ LinB = 2,
+ LinGb = 3
+};
+
+enum ISP_AWB_Statistics
+{
+ Rgbs_thr_gr = 0,
+ Rgbs_thr_r = 1,
+ Rgbs_thr_b = 2,
+ Rgbs_thr_gb = 3,
+ Rgbs_incl_sat = 4,
+ Rgbs_grid_width = 5,
+ Rgbs_grid_height = 6,
+ Rgbs_block_width = 7,
+ Rgbs_block_height = 8,
+ Rgbs_Xstart = 9,
+ Rgbs_Ystart = 10
+};
+
+enum ISP_AWB_Filter_Response_Statistics
+{
+ grid_width = 0,
+ grid_height = 1,
+ block_width = 2,
+ block_height = 3,
+ Xstart = 4,
+ Ystart = 5,
+ bayer_filter_coeffs_A = 6,
+ bayer_filter_coeffs_sign_vector = 7
+};
+
+enum ISP_AF_Statistics
+{
+ YgenRateGr = 0,
+ YgenRateR = 1,
+ YgenRateB = 2,
+ YgenRateGb = 3,
+ Filter_grid_width = 4,
+ Filter_grid_height = 5,
+ Filter_block_width = 6,
+ Filter_block_height = 7,
+ Filter_Xstart = 8,
+ Filter_Ystart = 9,
+ Y1_filter_coeffs_A = 10,
+ Y1_filter_coeffs_sign_vector = 11,
+ Y2_filter_coeffs_A = 12,
+ Y2_filter_coeffs_sign_vector = 13
+};
+
+enum ISP_BNR_DynamicDPC
+{
+ Cf = 0,
+ Cg = 1,
+ Ci = 2,
+ R_NF = 3,
+ bpThresholdGain = 4,
+ Defect_mode = 5,
+ bpGain = 6,
+ w0_coef = 7,
+ w1_coef = 8,
+ alpha_param = 9,
+ beta_param = 10,
+ gama_param = 11,
+ MaxInf = 12,
+ GD_en = 13,
+ BPC_En = 14,
+ BNR_En = 15,
+ GD_red = 16,
+ GD_green = 17,
+ GD_blue = 18,
+ GD_black = 19,
+ GD_shading = 20,
+ GD_suppoprt = 21,
+ GD_Clip = 22,
+ GD_Central_Weight = 23,
+ ShadCoef_gr = 24,
+ ShadCoef_r = 25,
+ ShadCoef_b = 26,
+ ShadCoef_gb = 27,
+ X_Center = 28,
+ Y_Center = 29
+};
+
+enum ISP_Bayer_ANR
+{
+ adaptive_treshhold_en = 0,
+ basic_transPlane0_Alpha_Gr = 1,
+ basic_transPlane0_Alpha_R = 2,
+ basic_transPlane0_Alpha_B = 3,
+ basic_transPlane0_Alpha_Gb = 4,
+ basic_transPlane0_Alpha_DC_Gr = 5,
+ basic_transPlane0_Alpha_DC_R = 6,
+ basic_transPlane0_Alpha_DC_B = 7,
+ basic_transPlane0_Alpha_DC_Gb = 8,
+ basic_transPlane1_Alpha_Gr = 9,
+ basic_transPlane1_Alpha_R = 10,
+ basic_transPlane1_Alpha_B = 11,
+ basic_transPlane1_Alpha_Gb = 12,
+ basic_transPlane1_Alpha_DC_Gr = 13,
+ basic_transPlane1_Alpha_DC_R = 14,
+ basic_transPlane1_Alpha_DC_B = 15,
+ basic_transPlane1_Alpha_DC_Gb = 16,
+ basic_transPlane2_Alpha_Gr = 17,
+ basic_transPlane2_Alpha_R = 18,
+ basic_transPlane2_Alpha_B = 19,
+ basic_transPlane2_Alpha_Gb = 20,
+ basic_transPlane2_Alpha_DC_Gr = 21,
+ basic_transPlane2_Alpha_DC_R = 22,
+ basic_transPlane2_Alpha_DC_B = 23,
+ basic_transPlane2_Alpha_DC_Gb = 24,
+ basic_transPlane0_Beta_Gr = 25,
+ basic_transPlane0_Beta_R = 26,
+ basic_transPlane0_Beta_B = 27,
+ basic_transPlane0_Beta_Gb = 28,
+ basic_transPlane1_Beta_Gr = 29,
+ basic_transPlane1_Beta_R = 30,
+ basic_transPlane1_Beta_B = 31,
+ basic_transPlane1_Beta_Gb = 32,
+ basic_transPlane2_Beta_Gr = 33,
+ basic_transPlane2_Beta_R = 34,
+ basic_transPlane2_Beta_B = 35,
+ basic_transPlane2_Beta_Gb = 36,
+ R_NormFactor = 37,
+ radial_gain_scale_factor = 38,
+ X_Center_ANR = 39,
+ Y_Center_ANR = 40,
+ stitch_pyramid_reg = 41,
+ basic_transPlane0_plainColorWMatrix_Gr = 42,
+ basic_transPlane0_plainColorWMatrix_R = 43,
+ basic_transPlane0_plainColorWMatrix_B = 44,
+ basic_transPlane0_plainColorWMatrix_Gb = 45,
+ basic_transPlane1_plainColorWMatrix_Gr = 46,
+ basic_transPlane1_plainColorWMatrix_R = 47,
+ basic_transPlane1_plainColorWMatrix_B = 48,
+ basic_transPlane1_plainColorWMatrix_Gb = 49,
+ basic_transPlane2_plainColorWMatrix_Gr = 50,
+ basic_transPlane2_plainColorWMatrix_R = 51,
+ basic_transPlane2_plainColorWMatrix_B = 52,
+ basic_transPlane2_plainColorWMatrix_Gb = 53
+};
+
+enum ISP_Demosaicing
+{
+ ChAR_enable = 0,
+ FCC_En = 1,
+ gamma_sc = 2,
+ LC_Ctrl = 3,
+ CR_Param1 = 4,
+ CR_Param2 = 5,
+ Coring_Param = 6
+};
+
+enum ISP_Gamma
+{
+ GammaLUT = 0
+};
+
+enum ISP_ColorSpaceConversion_ChromaDownsampling
+{
+ CSC_matrix = 0,
+ bias_coeffs = 1,
+ downscaling_filter_coefficients = 2,
+ filter_norm_factor = 3
+};
+
+enum ISP_Y_EdgeEnhance_NoiseReduction
+{
+ a_diag = 0,
+ a_perif = 1,
+ T1 = 2,
+ T2 = 3,
+ YeeEdgeSense0 = 4,
+ DeltaEdgeSense = 5,
+ YeeCornerSense0 = 6,
+ DeltaCornerSense = 7,
+ FcGainPosi0 = 8,
+ DeltaGainPosi = 9,
+ FcGainNeg0 = 10,
+ DeltaGainNeg = 11,
+ FcCropPosi0 = 12,
+ DeltaCropPosi = 13,
+ FcCropNeg0 = 14,
+ DeltaCropNeg = 15,
+ FcGainExp = 16,
+ FcMixRange = 17,
+ MinEdge = 18,
+ LinSegParam = 19,
+ DiagDiscG = 20,
+ HVW_hor = 21,
+ DW_hor = 22,
+ HVW_diag = 23,
+ DW_diag = 24,
+ FcCoringPosi0 = 25,
+ FcCoringPosiDelta = 26,
+ FcCoringNega0 = 27,
+ FcCoringNegaDelta = 28
+};
+
+enum ISP_ChromaNoiseReduction
+{
+ CnrCoringU = 0,
+ CnrCoringV = 1,
+ CnrSenseGainVY = 2,
+ CnrSenseGainVU = 3,
+ CnrSenseGainVV = 4,
+ CnrSenseGainHY = 5,
+ CnrSenseGainHU = 6,
+ CnrSenseGainHV = 7,
+ Fir0H = 8,
+ Fir1H = 9,
+ MinPrev = 10
+};
+
+enum ISP_UV_Color_Enhancement
+{
+ gain_according_to_y_only = 0,
+ macc_tables = 1,
+ m_gain_pcwl_lut = 2,
+ m_Strength = 3
+};
+
+enum ISP_XNR
+{
+ XnrSigma_Y0 = 0,
+ XnrSigma_Y1 = 1,
+ XnrSigma_U0 = 2,
+ XnrSigma_U1 = 3,
+ XnrSigma_V0 = 4,
+ XnrSigma_V1 = 5,
+ CnrCoring_U0 = 6,
+ CnrCoring_U1 = 7,
+ CnrCoring_V0 = 8,
+ CnrCoring_V1 = 9,
+ blending_strength = 10
+};
+
+enum ISP_IEFD
+{
+ CU1_x = 0,
+ CU1_a = 1,
+ CU1_b = 2,
+ CU_ED_x = 3,
+ CU_ED_a = 4,
+ CU_ED_b = 5,
+ CU3_x = 6,
+ CU3_a = 7,
+ CU3_b = 8,
+ CU5_x = 9,
+ CU5_a = 10,
+ CU5_b = 11,
+ CU6_x = 12,
+ CU6_a = 13,
+ CU6_b = 14,
+ CU7_x = 15,
+ CU7_a = 16,
+ CU7_b = 17,
+ CUUnSharp_x = 18,
+ CUUnSharp_a = 19,
+ CUUnSharp_b = 20,
+ CURad_x = 21,
+ CURad_a = 22,
+ CURad_b = 23,
+ CUVss_x = 24,
+ CUVss_a = 25,
+ CUVss_b = 26,
+ m_horver_diag_coef = 27,
+ m_shrpn_nega_lmt_txt = 28,
+ m_shrpn_posi_lmt_txt = 29,
+ m_shrpn_nega_lmt_dir = 30,
+ m_shrpn_posi_lmt_dir = 31,
+ m_clamp_stitch = 32,
+ m_dir_far_sharp_w = 33,
+ m_dir_far_dns_w = 34,
+ m_ndir_dns_powr = 35,
+ m_denoise_en = 36,
+ m_unsharp_weight = 37,
+ m_unsharp_amount = 38,
+ m_unsharp_c00 = 39,
+ m_unsharp_c01 = 40,
+ m_unsharp_c02 = 41,
+ m_unsharp_c11 = 42,
+ m_unsharp_c12 = 43,
+ m_unsharp_c22 = 44,
+ m_direct_metric_update = 45,
+ m_directional_smooth_en = 46,
+ m_vssnlm_enable = 47,
+ m_vs_x0 = 48,
+ m_vs_x1 = 49,
+ m_vs_x2 = 50,
+ m_vs_y1 = 51,
+ m_vs_y2 = 52,
+ m_vs_y3 = 53,
+ m_rad_enable = 54,
+ m_rad_Xreset = 55,
+ m_rad_Yreset = 56,
+ m_rad_X2reset = 57,
+ m_rad_Y2reset = 58,
+ x_Center = 59,
+ y_Center = 60,
+ m_rad_NF = 61,
+ m_rad_inv_r2 = 62,
+ m_CU6_pow = 63,
+ m_CUUnsharp_pow = 64,
+ m_rad_CU6_pow = 65,
+ m_rad_CUUnsharp_pow = 66,
+ m_radCU6_X1 = 67,
+ m_radCUUnSharp_X1 = 68,
+ m_ed_horver_diag_coeff = 69,
+ m_rad_dir_far_sharp_w = 70,
+ m_rad_dir_far_dns_w = 71,
+ m_rad_ndir_dns_powr = 72,
+ m_iefd_en = 73
+};
+
+enum ISP_TNR
+{
+ TnrMaxFB_Y = 0,
+ TnrMaxFB_U = 1,
+ TnrMaxFB_V = 2,
+ TnrRoundADJ_Y = 3,
+ TnrRoundADJ_U = 4,
+ TnrRoundADJ_V = 5,
+ TnrY0_Sigma_Y = 6,
+ TnrY0_Sigma_U = 7,
+ TnrY0_Sigma_V = 8,
+ TnrY1_Knee_P = 9,
+ TnrY1_Sigma_Y = 10,
+ TnrY1_Sigma_U = 11,
+ TnrY1_Sigma_V = 12,
+ TnrY2_Knee_P = 13,
+ TnrY2_Sigma_Y = 14,
+ TnrY2_Sigma_U = 15,
+ TnrY2_Sigma_V = 16,
+ TnrY3_Sigma_Y = 17,
+ TnrY3_Sigma_U = 18,
+ TnrY3_Sigma_V = 19
+};
+enum ISP_vHDR
+{
+ GaeBrightThrLow = 0,
+ GaeBrightThrHigh = 1,
+ GaePyrLow = 2,
+ GaePyrHigh = 3,
+ GaeZerosThrWeight = 4,
+ GaeFlatThrRatio = 5,
+ GaeMotionMinAreaLow = 6,
+ GaeMotionMinAreaHigh = 7,
+ MrgBlendThrLow = 8,
+ MrgBlendThrHigh = 9
+};
+enum Type
+{
+ uint32_ = 0,
+ matrix_int32_ = 1,
+ array_uint32_ = 2,
+ uint8_ = 3,
+ array_int16_ = 4,
+ array_uint16_ = 5,
+ int16_ = 6,
+ uint16_ = 7,
+ array_uint8_ = 8,
+ matrix_int16_ = 9,
+ int8_ = 10,
+ array_int8_ = 11
+};
+
+enum Precision
+{
+ NOT_SET = 0,
+ uint1_Precision = 1,
+ uint2_Precision = 2,
+ uint3_Precision = 3,
+ uint4_Precision = 4,
+ uint5_Precision = 5,
+ uint6_Precision = 6,
+ uint7_Precision = 7,
+ uint8_Precision = 8,
+ uint9_Precision = 9,
+ uint10_Precision = 10,
+ uint11_Precision = 11,
+ uint12_Precision = 12,
+ uint13_Precision = 13,
+ uint14_Precision = 14,
+ uint15_Precision = 15,
+ int8_Precision = 16,
+ int5_Precision = 17,
+ int12_Precision = 18,
+ int13_Precision = 19,
+ uint5q2_Precision = 20,
+ uint6q2_Precision = 21,
+ uint4q4_Precision = 22,
+ uint4q2_Precision = 23,
+ int15q14_Precision = 24,
+ int16q6_Precision = 25,
+ uint16q16_Precision = 26,
+ uint32_Precision = 27,
+ uint16q13_Precision = 28,
+ uint16q8_Precision = 29,
+ uint6q6_Precision = 30,
+ uint7q3_Precision = 31,
+ uint6q3_Precision = 32,
+ uint5q4_Precision = 33,
+ uint16q4_Precision = 34,
+ uint12q10_Precision = 35,
+ uint8q6_Precision = 36,
+ uint9q4_Precision = 37,
+ uint11q4_Precision = 38,
+ int9q4_Precision = 39,
+ uint7q6_Precision = 40,
+ uint9q5_Precision = 41,
+ int9q8_Precision = 42,
+ uint7q4_Precision = 43,
+ uint6q4_Precision = 44,
+ int10_Precision = 45,
+ uint24_Precision = 46,
+ int16q8_Precision = 47,
+ uint10q10_Precision = 48,
+ uint15q15_Precision = 49,
+ int14q13_Precision = 50,
+ uint12q11_Precision = 51,
+ int12q11_Precision = 52,
+ uint8q8_Precision = 53
+};
+
+char* GET_PTR(char *startAddress,long long int offset);
+
+union INT32PTR
+{
+public:
+ long long int offset;
+ int32_t *address;
+
+ const int32_t * operator->() const
+ {
+ return address;
+ }
+
+ const int32_t & operator[](int i) const
+ {
+ return address[i];
+ }
+
+ const int32_t * GetPtr() const
+ {
+ return address;
+ }
+
+};
+
+union UINT8PTR
+{
+public:
+ long long int offset;
+ uint8_t *address;
+
+ const uint8_t * operator->() const
+ {
+ return address;
+ }
+
+ const uint8_t & operator[](int i) const
+ {
+ return address[i];
+ }
+
+ const uint8_t * GetPtr() const
+ {
+ return address;
+ }
+
+};
+
+union INT8PTR
+{
+public:
+ long long int offset;
+ int8_t *address;
+ const int8_t * operator->() const
+ {
+ return address;
+ }
+
+ const int8_t & operator[](int i) const
+ {
+ return address[i];
+ }
+
+ const int8_t * GetPtr() const
+ {
+ return address;
+ }
+
+};
+class globalHeader
+{
+public:
+ uint32_t tag;
+ uint32_t data_size;
+ uint32_t system_version;
+ uint32_t enum_revision;
+ uint16_t sensor_model_id;
+ uint8_t module_model_id;
+ uint8_t revision_number;
+ uint8_t manufacturer_id;
+ uint32_t config_bits;
+ uint32_t checksum;
+};
+
+class ISPGage
+{
+public:
+ int32_t ID;
+ GageType gage_type;
+ NodeType node_type;
+ INT8PTR min;
+ INT8PTR max;
+ uint8_t num_of_nodes;
+ int32_t type_size;
+ UINT8PTR nodes_values;
+ INTERPOLATION_TYPE interpolation_type;
+ EXTRAPOLATION_TYPE extrapolation_type;
+ ISPGage();
+};
+union UISPGage
+{
+public:
+ long long int offset;
+ ISPGage *address;
+
+ const ISPGage * operator->() const
+ {
+ return address;
+ }
+
+ const ISPGage & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+
+class ISPDomain
+{
+public:
+ int32_t ID;
+ uint8_t num_of_gages;
+ INT8PTR gage_ids;
+ ISPDomain();
+};
+
+union UISPDomain
+{
+public:
+ long long int offset;
+ ISPDomain *address;
+
+ const ISPDomain * operator->() const
+ {
+ return address;
+ }
+
+ const ISPDomain & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+class RecordParam
+{
+public:
+ int paramID;
+ Type type;
+ Precision precision;
+ int32_t domain_name;
+ INT8PTR min;
+ INT8PTR max;
+ int32_t valueSize;
+ int32_t numberOfDims;
+ INT32PTR numOfValues;
+ int32_t nOfNodes;
+ INT8PTR value;
+ RecordParam();
+};
+
+union URecordParam
+{
+public:
+ long long int offset;
+ RecordParam *address;
+
+ const RecordParam * operator->() const
+ {
+ return address;
+ }
+
+ const RecordParam & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+class ISPRecord
+{
+public:
+ Blocks NameId; // from recordHeader
+ int32_t nOfRecordParmas;
+ URecordParam paramList;
+ ISPRecord();
+ const RecordParam * Param(int paramID) const
+ {
+ for (int32_t i = 0; i < nOfRecordParmas; ++i)
+ {
+ if (paramList[i].paramID == paramID)
+ {
+ return &paramList[i];
+ }
+ }
+ return 0;
+ }
+};
+union UISPRecord
+{
+public:
+ long long int offset;
+ ISPRecord *address;
+
+ const ISPRecord * operator->() const
+ {
+ return address;
+ }
+
+ const ISPRecord & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+class ParamsInDomain
+{
+public:
+ int paramID;
+ Blocks recordID;
+ URecordParam paramPtr;
+ ParamsInDomain();
+};
+union UParamsInDomain
+{
+public:
+ long long int offset;
+ ParamsInDomain *address;
+
+ const ParamsInDomain * operator->() const
+ {
+ return address;
+ }
+
+ const ParamsInDomain & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+class DomainsTable
+{
+public:
+ int32_t domainID;
+ int32_t nOfParams = 0;
+ UParamsInDomain params;
+ DomainsTable();
+};
+union UDomainsTable
+{
+public:
+ long long int offset;
+ DomainsTable *address;
+
+ const DomainsTable * operator->() const
+ {
+ return address;
+ }
+
+ const DomainsTable & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+class ISP
+{
+public:
+ globalHeader gh;
+ int32_t nOfGages;
+ UISPGage gagesList;
+ int32_t nOfDomains;
+ UISPDomain domainList;
+ int32_t nOfRecords;
+ UISPRecord recordList;
+ int32_t numOfNonConstDomians;
+ UDomainsTable domainsTables;
+ ISP();
+ const ISPGage* Gage(int32_t gageId) const
+ {
+ for (int i = 0; i < nOfGages; ++i)
+ {
+ if (gagesList[i].ID == gageId)
+ {
+ return &gagesList[i];
+ }
+ }
+ return 0;
+ }
+
+ const ISPDomain* Domain(int32_t domainId) const
+ {
+ for (int i = 0; i < nOfDomains; ++i)
+ {
+ if (domainList[i].ID == domainId)
+ {
+ return &domainList[i];
+ }
+ }
+ return 0;
+ }
+
+ const ISPRecord* Record(Blocks recordId) const
+ {
+ for (int i = 0; i < nOfRecords; ++i)
+ {
+ if (recordList[i].NameId == recordId)
+ {
+ return &recordList[i];
+ }
+ }
+
+ return 0;
+ }
+
+ const DomainsTable * DomainInDomainTables(int32_t DomainID) const
+ {
+ for (int i = 0; i < numOfNonConstDomians; ++i)
+ {
+ if (domainsTables[i].domainID == DomainID)
+ {
+ return &domainsTables[i];
+ }
+ }
+
+ return 0;
+ }
+
+ const ParamsInDomain * ParamsInDomainTables(int32_t DomainID) const
+ {
+ for (int i = 0; i < numOfNonConstDomians; ++i)
+ {
+ if (domainsTables[i].domainID == DomainID)
+ {
+ return domainsTables[i].params.address;
+ }
+ }
+
+ return 0;
+ }
+
+
+
+ const RecordParam * ParamsInDomainTables(int32_t DomainID,Blocks RecordID,int ParamID) const
+ {
+ for (int i = 0; i < numOfNonConstDomians; ++i)
+ {
+ if (domainsTables[i].domainID == DomainID)
+ {
+ for (int j = 0; j < domainsTables[i].nOfParams; ++j)
+ {
+ if (domainsTables[i].params[j].paramID == ParamID && domainsTables[i].params[j].recordID == RecordID)
+ {
+ return domainsTables.address[i].params[j].paramPtr.address;
+ }
+ }
+ }
+ }
+
+ return 0;
+ }
+
+
+};
+
+union UISP
+{
+public:
+ long long int offset;
+ ISP *address;
+
+ const ISP * operator->() const
+ {
+ return address;
+ }
+
+ const ISP & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+class CPFF
+{
+public:
+ UISP IspPreviewVideo;
+ UISP IspStills;
+ CPFF();
+};
+union UCPFF
+{
+public:
+ long long int offset;
+ CPFF *address;
+
+ const CPFF * operator->() const
+ {
+ return address;
+ }
+
+ const CPFF & operator[](int i) const
+ {
+ return address[i];
+ }
+
+};
+
+LIBEXPORT CPFF * ReadCpff(char * buffer);
+
+#pragma pack(pop)
+
+
+#endif //_CPFF_SPECIFIC_DATA_H_
+
diff --git a/include/ia_imaging/dm_public.h b/include/ia_imaging/dm_public.h
new file mode 100644
index 0000000..e2d5bfe
--- /dev/null
+++ b/include/ia_imaging/dm_public.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DM_PUBLIC_H_
+#define _DM_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Demosaic (DM) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+struct dm_public_config {
+ /** Demosaic enable flag */
+ unsigned char dm_en;
+ /** Checker Artifact Removal enable */
+ unsigned char ch_ar_en;
+ /** false color correction enable */
+ unsigned char fcc_en;
+ /** sharpening coefficient for green calculation [0..31] */
+ unsigned char gamma_sc;
+ /** control param for weights of Chroma Homogeneity metric [0..31] */
+ unsigned char lc_ctrl;
+ /** Control param for Checker artifact removal [0..31] */
+ unsigned char cr_param1;
+ /** Control param for Checker artifact removal [0..31] */
+ unsigned char cr_param2;
+ /** False color correction control [0..31] */
+ unsigned char coring_param;
+};
+
+struct ia_css_2500_dm_kernel_config {
+ struct dm_public_config dm;
+};
+
+/** @brief Print DM public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print DM public configuration.
+ */
+void ia_css_dm_public_cfg_dump(
+ const struct ia_css_2500_dm_kernel_config *cfg);
+
+/** @brief Compare two DM public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two DM public configurations
+ */
+bool ia_css_dm_public_cfg_compare(
+ const struct ia_css_2500_dm_kernel_config *cfg1,
+ const struct ia_css_2500_dm_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif // _DM_PUBLIC_H_
diff --git a/include/ia_imaging/dpc_public.h b/include/ia_imaging/dpc_public.h
new file mode 100644
index 0000000..f9dbae1
--- /dev/null
+++ b/include/ia_imaging/dpc_public.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** @file
+* CSS-API header file for 2500/Skycam Defect Pixel Correction (DPC) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+#ifndef DPC_PUBLIC_H_
+#define DPC_PUBLIC_H_
+
+/** DPC can correct due to hardware limitations up to 192 pixels per 50 lines.
+ * So for an input height of 3840 lines this results into 77 sets of 50 lines.
+ * As a result the maximum number of dead pixels is 192*77.
+ */
+#define DPC_MAX_NUMBER_OF_DP 14784
+
+// lut entry
+typedef struct dpc_public_lut_elem {
+
+ unsigned int nghbr_sts:5;
+ unsigned int skip:1;
+ unsigned int nghbr_order:1;
+ unsigned int column:13;
+ unsigned int row_pair_delta:4;
+ unsigned int spare0:8;
+
+} dpc_public_lut_elem_t;
+
+
+typedef struct dpc_public_lut {
+
+ dpc_public_lut_elem_t elems[DPC_MAX_NUMBER_OF_DP];
+
+} dpc_public_lut_t;
+
+struct dpc_public_config {
+
+ unsigned int grad_threshold;
+ unsigned int num_of_dp_gr;
+ unsigned int num_of_dp_bg;
+ dpc_public_lut_t lut_gr;
+ dpc_public_lut_t lut_bg;
+
+};
+
+struct ia_css_2500_dpc_kernel_config {
+
+ struct dpc_public_config dpc;
+
+};
+
+/** @brief Print DPC public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print DPC public configuration.
+ */
+void ia_css_dpc_public_cfg_dump(
+ const struct ia_css_2500_dpc_kernel_config *cfg);
+
+/** @brief Compare two DPC public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two DPC public configurations
+ */
+bool ia_css_dpc_public_cfg_compare(
+ const struct ia_css_2500_dpc_kernel_config *cfg1,
+ const struct ia_css_2500_dpc_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif /* DPC_PUBLIC_H_ */
diff --git a/include/ia_imaging/ia_abstraction.h b/include/ia_imaging/ia_abstraction.h
new file mode 100644
index 0000000..368432d
--- /dev/null
+++ b/include/ia_imaging/ia_abstraction.h
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*! \file ia_abstraction.h
+ \brief Constants, definitions and macros used IA modules.
+*/
+#ifndef _IA_ABSTRACTION_H_
+#define _IA_ABSTRACTION_H_
+
+#include <string.h> /* defines memcpy and memset */
+#include <stdlib.h> /* defines malloc and free */
+#include <stddef.h> /* defines NULL */
+#include <stdint.h> /* defines fixed width integers */
+#include <assert.h>
+#include <math.h>
+
+
+/*!
+ * \brief extra Q number format typedefs.
+ */
+typedef int16_t sq7_8_t;
+typedef uint16_t uq8_8_t;
+typedef uint16_t uq6_10_t;
+typedef uint16_t uq4_12_t;
+typedef int32_t sq15_16_t;
+typedef uint32_t uq16_16_t;
+
+#define FLOAT_TO_Q16_16(n) (uint32_t)(((float)(n))*65536.0f)
+#define INT_TO_Q16_16(n) ((n)<<16)
+#define Q16_16_TO_FLOAT(n) (((float)(n))*0.0000152587890625f)
+#define Q16_16_TO_INT(n) ((n)>>16)
+
+#define FLOAT_TO_Q1_15(n) (uint16_t)(((float)(n))*32768.0f)
+#define Q1_15_TO_FLOAT(n) (((float)(n))*0.000030518f)
+#define QX_15_TO_FLOAT(n) (((float)(n))*0.000030517578125f)
+
+#define FLOAT_TO_Q8_8(n) (uint16_t)(((float)(n))*256.0f)
+#define INT_TO_Q8_8(n) ((n)<<8)
+#define Q8_8_TO_FLOAT(n) (((float)(n))*0.00390625f)
+#define Q8_8_TO_INT(n) ((n)>>8)
+
+#define FLOAT_TO_QX_10(n) ((n)*1024.0f)
+#define FLOAT_TO_QX_11(n) ((float)(n)*2048.0f)
+#define FLOAT_TO_QX_12(n) ((float)(n)*4096.0f)
+#define FLOAT_TO_QX_15(n) ((float)(n)*32768.0f)
+#define INT_TO_QX_10(n) ((n)<<10)
+#define QX_10_TO_FLOAT(n) (((float)(n))*0.0009765625f)
+#define QX_18_TO_FLOAT(n) (((float)(n))*0.00000381469f)
+#define QX_20_TO_FLOAT(n) (((float)(n))*0.00000095367431640625f)
+#define QX_10_TO_INT(n) ((n)>>10)
+
+#define Q16_12_TO_FLOAT(n) (((float)(n))*0.000244141f)
+
+
+
+/*!
+ * \brief Calculates aligned value.
+ * Works only with unsigned values.
+ * \param a Number to align.
+ * \param b Alignment.
+ * \return Aligned number.
+ */
+#define IA_ALIGN(a,b) (((unsigned)(a)+(unsigned)(b-1)) & ~(unsigned)(b-1))
+
+#define IA_ALLOC(x) malloc(x)
+#define IA_CALLOC(x) calloc(1, x)
+#define IA_REALLOC(x, y) realloc(x, y)
+#define IA_FREEZ(x) { free(x); x = NULL;}
+#define IA_MEMSET(x, y, z) memset(x, y, z)
+#define IA_MEMCOMPARE(x,y,z) memcmp(x, y, z)
+#define IA_ABS(a) abs((int)(a))
+#define IA_FABS(a) fabsf((float)(a))
+#define IA_MIN(a, b) ((a) < (b) ? (a) : (b))
+#define IA_MAX(a, b) ((a) > (b) ? (a) : (b))
+#define IA_LIMIT(val, min, max) IA_MIN(IA_MAX(val, min), max)
+#define IA_POW(a, b) powf((float)(a), (float)(b))
+#define IA_EXP(a) expf((float)(a))
+#define IA_SQRT(a) sqrtf((float)(a))
+#define IA_ROUND(a) (((float)(a) > 0.0f) ? floorf((float)(a) + 0.5f) : ceilf((float)(a) - 0.5f))
+#define IA_CEIL(a) ceilf((float)(a))
+#define IA_FLOOR(a) floorf((float)(a))
+#define IA_SIN(a) sinf((float)(a))
+#define IA_COS(a) cosf((float)(a))
+#define IA_ATAN(a) atanf((float)(a))
+#define IA_LN(a) logf((float)(a))
+#define IA_UNUSED(x) (void)x
+#define IA_LOG2(x) (logf((float)(x)) / logf(2.0f))
+#define IA_ASSERT assert
+#define IA_SIGN(a) (((a) > 0) - ((a) < 0))
+
+#if (defined(__STDC_LIB_EXT1__) || defined(memcpy_s))
+#define IA_MEMCOPY(x, y, z) memcpy_s(x, z, y, z)
+#define IA_MEMCOPYS(x, xs, y, z) memcpy_s(x, xs, y, z)
+#else
+#define IA_MEMCOPY(x, y, z) memcpy(x, y, z)
+#define IA_MEMCOPYS(x, xs, y, z) { IA_ASSERT((z) <= (xs)); memcpy(x, y, IA_MIN((xs), (z))); }
+#endif
+
+#if (defined(__STDC_LIB_EXT1__) || defined(memmove_s))
+#define IA_MEMMOVE(x, y, z) memmove_s(x, z, y, z)
+#define IA_MEMMOVES(x, xs, y, z) memmove_s(x, xs, y, z)
+#else
+#define IA_MEMMOVE(x, y, z) memmove(x, y, z)
+#define IA_MEMMOVES(x, xs, y, z) { IA_ASSERT((size_t)(z) <= (size_t)(xs)); memmove(x, y, IA_MIN((size_t)(xs), (size_t)(z))); }
+#endif
+
+
+#if (defined(__STDC_LIB_EXT1__) || defined(strnlen_s))
+#define IA_STRNLENS(x,y) strnlen_s(x, y)
+#else
+#define IA_STRNLENS(x,y) strlen(x)
+#endif
+
+#if (defined(__STDC_LIB_EXT1__) || defined(sprintf_s))
+#define IA_SPRINTFS(x,y,z,...) sprintf_s(x, y, z, ##__VA_ARGS__)
+#else
+#define IA_SPRINTFS(x,y,z,...) sprintf(x, z, ##__VA_ARGS__)
+#endif
+
+
+ #include <stdbool.h> /* defines bool */
+
+ #ifdef __BUILD_FOR_GSD_AOH__
+ typedef char mutex_t;
+ typedef char rwlock_t;
+ #define IA_MUTEX_CREATE(m)
+ #define IA_MUTEX_DELETE(m)
+ #define IA_MUTEX_LOCK(m)
+ #define IA_MUTEX_UNLOCK(m)
+ #define IA_RWLOCK_CREATE(l)
+ #define IA_RWLOCK_DELETE(l)
+ #define IA_RWLOCK_WRLOCK(l)
+ #define IA_RWLOCK_WRUNLOCK(l)
+ #define IA_RWLOCK_RDLOCK(l)
+ #define IA_RWLOCK_RDUNLOCK(l)
+
+ #undef IA_SIN
+ #define IA_SIN(a) dsp_sin_f32((float)(a))
+ #else
+
+ #include <pthread.h> /* defined POSIX thread model */
+ typedef pthread_mutex_t mutex_t;
+ typedef pthread_rwlock_t rwlock_t;
+
+ #define IA_MUTEX_CREATE(m) (pthread_mutex_init(&m, NULL) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_MUTEX_DELETE(m) (pthread_mutex_destroy(&m) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_MUTEX_LOCK(m) (pthread_mutex_lock(&m) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_MUTEX_UNLOCK(m) (pthread_mutex_unlock(&m) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_RWLOCK_CREATE(l) (pthread_rwlock_init(&l, NULL) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_RWLOCK_DELETE(l) (pthread_rwlock_destroy(&l) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_RWLOCK_WRLOCK(l) (pthread_rwlock_wrlock(&l) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_RWLOCK_WRUNLOCK(l) (pthread_rwlock_unlock(&l) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_RWLOCK_RDLOCK(l) (pthread_rwlock_rdlock(&l) == 0) ? IA_ASSERT(true) : ((void)0)
+ #define IA_RWLOCK_RDUNLOCK(l) (pthread_rwlock_unlock(&l) == 0) ? IA_ASSERT(true) : ((void)0)
+
+/* Use GNU-specific headers for SSE vector intrinsics */
+ #include <x86intrin.h>
+ #include <malloc.h>
+ #define ALIGNED_MALLOC(size, align) memalign(align, size)
+ #define ALIGNED_FREE free
+ #define ALIGNED_TYPE(x, ALIGNMENT) x __attribute__((aligned(ALIGNMENT)))
+ #endif
+
+/* These macros are used for allocating one big chunk of memory and assigning parts of it.
+* MEMDEBUG flag can be used to debug / check with if memory read & writes stay within the
+* boundaries by allocating each memory block individually from system memory. */
+#ifdef MEMDEBUG
+#define IA_MEMASSIGN(ptr, size) IA_CALLOC(size); IA_UNUSED(ptr)
+#else
+#define IA_MEMASSIGN(ptr, size) ptr; ptr += IA_ALIGN(size, 8);
+#endif
+
+#ifndef __cplusplus
+#if !defined(__GNUC__)
+#define inline __inline
+#elif defined(__GNUC__)
+#define inline __inline__
+#else
+#define inline /* default is to define inline to empty */
+#endif
+#endif
+
+#define ROUND_DOWN(input_size, step_size) ((input_size) & ~((step_size)-1))
+#define STEP_SIZE_4 4
+#define STEP_SIZE_2 2
+
+#if defined(__ANDROID__)
+ #define FILE_DEBUG_DUMP_PATH "/data/misc/cameraserver/"
+ #define FILE_DEBUG_DUMP_PATH "c:\\tmp\\"
+ #define FILE_DEBUG_DUMP_PATH "/tmp/"
+#endif
+
+
+#endif /* _IA_ABSTRACTION_H_ */
diff --git a/include/ia_imaging/ia_aiq.h b/include/ia_imaging/ia_aiq.h
new file mode 100644
index 0000000..10c9372
--- /dev/null
+++ b/include/ia_imaging/ia_aiq.h
@@ -0,0 +1,626 @@
+/*
+ * Copyright (C) 2015 - 2018 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \mainpage IA AIQ API documentation
+ *
+ * Browse Files and Classes tabs for details.
+ *
+ * \section general General info
+ *
+ * AIQ API has been designed to be re-entrant. Each algorithm function can be called multiple times per frame.
+ * Input parameters for the algorithms define what is the output ie. running an algorithm with same input parameters
+ * and same statistics produce the same output. For example one can run AE multiple times with different EV compensations
+ * to get parameters for exposure bracketing.
+ *
+ * AIQ (Algorithms and Image Quality) library contains several algorithm which are used to modify RAW image.
+ * Currently following features and algorithms are supported:
+ * - \ref aec (Automatic Exposure Control)
+ * - \ref awb (Automatic White Balance)
+ * - \ref af (Automatic Focus)
+ * - \ref sa (Shading Adaptor)
+ * - \ref pa (Parameter Adaptor)
+ * - \ref dsd (Discrete Scene Detection)
+ * - \ref gbce (Global Brightness and Contrast Enhancement)
+ *
+ * AIQ also supports calculation of parameters for multiframe bracketing cases:
+ * - \ref afbracket (Automatic Focus Bracket)
+ * - \ref aebracket (Automatic Exposure Bracket)
+ *
+ * Running AIQ algorithms requires following steps:
+ * - \ref init
+ * - \ref stats
+ * - \ref running
+ * - \ref deinit
+ *
+ * Some AIQ algorithms require coordinates as inputs to specify a certain area in the image. Coordinates are relative to
+ * the statistics thus not necessarily the whole sensor area. Coordinates are not absolute but relative. See \link ia_coordinate.h \endlink
+ * for detailed description of the used coordinate system.
+ * <br><hr><br>
+ *
+ * \section init Initialization of AIQ library
+ *
+ * \copybrief ia_aiq_init
+ * To create an instance of AIQ library one must call function:
+ * \code ia_aiq_init \endcode
+ * \copydetails ia_aiq_init
+ *
+ * <br><hr><br>
+ *
+ * \section stats Setting of frame statistics
+ *
+ * Algorithms depend on statistics collected from the RAW image. Some or all of the statistics are
+ * calculated by the ISP after RAW image capture from camera sensor. These statistics are always collected from
+ * captured image data. To convert statistics from ISP specific format to AIQ format, a helper function can be used:
+ * \code ia_isp_XXX_statistics_convert \endcode
+ * See ia_isp documentation for details.
+ *
+ * \copybrief ia_aiq_statistics_set
+ * To set statistics for algorithms AIQ library, one must call function:
+ * \code ia_aiq_statistics_set \endcode
+ * \copydetails ia_aiq_statistics_set
+ *
+ * Algorithms can also utilize external sensor data for making better decisions. For example external light sensor
+ * can be used by AEC to determine correct cold start exposure parameters when AEC is called the first time without
+ * statistics.
+ *
+ * \copybrief ia_aiq_sensor_events_set
+ * To set external sensor data statistics for algorithms AIQ library, one must call function:
+ * \code ia_aiq_sensor_events_set \endcode
+ * \copydetails ia_aiq_sensor_events_set
+ *
+ * <br><hr><br>
+ *
+ * \section running Running AIQ algorithms
+ *
+ * Once the AIQ instance is initialized and statistics are set, algorithms can be run in any order.
+ * \subsection af AF
+ * \copybrief ia_aiq_af_run
+ * \code ia_aiq_af_run \endcode
+ * \copydetails ia_aiq_af_run
+ *
+ * \subsection aec AEC
+ * \copybrief ia_aiq_ae_run
+ * \code ia_aiq_ae_run \endcode
+ * \copydetails ia_aiq_ae_run
+ *
+ * \subsection awb AWB
+ * \copybrief ia_aiq_awb_run
+ * \code ia_aiq_awb_run \endcode
+ * \copydetails ia_aiq_awb_run
+ *
+ * \subsection sa SA
+ * \copybrief ia_aiq_sa_run
+ * \code ia_aiq_sa_run \endcode
+ * \copydetails ia_aiq_sa_run
+ *
+ * \subsection pa PA
+ * \copybrief ia_aiq_pa_run
+ * \code ia_aiq_pa_run \endcode
+ * \copydetails ia_aiq_pa_run
+ *
+ * \subsection dsd DSD
+ * \copybrief ia_aiq_dsd_run
+ * \code ia_aiq_dsd_run \endcode
+ * \copydetails ia_aiq_dsd_run
+ *
+ * \subsection gbce GBCE
+ * \copybrief ia_aiq_gbce_run
+ * \code ia_aiq_gbce_run \endcode
+ * \copydetails ia_aiq_gbce_run
+ *
+ * \subsection afbracket AF Bracket
+ * \copybrief ia_aiq_af_bracket
+ * \code ia_aiq_af_bracket \endcode
+ * \copydetails ia_aiq_af_bracket
+ *
+ * \subsection aebracket AE Bracket & HDR
+ * AEC supports outputting of multiple exposure results. By setting the "num_exposures" parameter >1 in ia_aiq_ae_input_params, AEC determines
+ * the best exposure parameters to cover as much as possible of the sensor's dynamic range. AIQ's client can then queue the exposure parameters
+ * to the sensor for consecutive frames for best speed.
+ *
+ * HDR support in AEC works the same way. Client requests >1 "num_exposures" but also gives AIQ the resulting statistics from all requested
+ * exposures. AEC uses the given (multiple) statistics to calculate new exposure parameters.
+ *
+ *
+ * <br><hr><br>
+ *
+ * \section deinit De-initialization of AIQ library
+ *
+ * To de-initialize and free memory AIQ library instance has allocated, one must call function:
+ * \code
+ * ia_aiq_deinit
+ * \endcode
+ *
+ * After this call AIQ library instance is destroyed and can't be used.
+ */
+
+/*!
+ * \file ia_aiq.h
+ * \brief Definitions and declarations of Intel 3A library.
+ */
+
+#ifndef _IA_AIQ_H_
+#define _IA_AIQ_H_
+
+#include "ia_aiq_types.h"
+#include "ia_types.h"
+#include "ia_face.h"
+#include "ia_mkn_types.h"
+#include "ia_cmc_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \brief Initialize IA_AIQ and its submodules.
+ * This function must be called before any other function in the library. It allocates memories for all AIQ algorithms based on input parameters
+ * given by the user. AIQB (from CPFF) and NVM data are parsed and combined resulting camera module specific tuning parameters which the
+ * AIQ algorithms use. Initialization returns a handle to the AIQ instance, which is given as input parameter for all the
+ * algorithms. Therefore, multiple instances of AIQ library can running simultaneously. For example one instance per camera.
+ *
+ * \param[in] aiqb_data Mandatory although function will not return error, if it not given.\n
+ * Contains tuning parameters for AIQ algorithms.
+ * \param[in] nvm_data Optional.\n
+ * NVM (Non Volatile Memory) containing sensor unit specific calibration data.
+ * AIC uses camera unit specific calibration data, if given.
+ * \param[in] aiqd_data Optional.\n
+ * AIQ generic input data, provided by the host. Contains various AIQ related information, collected
+ * during run-time and stored in a host file system. AIQ will parse this data in to internal storage.
+ * \param[in] stats_max_width Mandatory.\n
+ * Maximum width of RGBS and AF statistics grids from ISP. Used to calculate size of
+ * memory buffers for the IA_AIQ algorithms. The same maximum width will be used for all RGBS
+ * and AF statistics grid allocations.
+ * \param[in] stats_max_height Mandatory.\n
+ * Maximum height of RGBS and AF statistics grids from ISP. Used to calculate size of
+ * memory buffers for the IA_AIQ algorithms. The same maximum height will be used for all RGBS
+ * and AF statistics grid allocations.
+ * \param[in] max_num_stats_in Mandatory.\n
+ * The maximum number of input statistics for one frame. Each statistics is related to different exposure.
+ * Used especially for sensors that support two or more simultaneous exposures (HDR).
+ * \param[in] ia_cmc Mandatory.\n
+ * Parsed camera module characterization structure. ia_cmc structure needs to be kept available by client for
+ * the lifetime of AIQ component.
+ * \param[in,out] ia_mkn Optional.\n
+ * Makernote handle which can be initialized with ia_mkn library. If debug data from AIQ is needed
+ * to be stored into EXIF, this parameter is needed. Algorithms will update records inside this makernote instance.
+ * Client writes the data into Makernote section in EXIF.
+ * return IA_AIQ handle. Use the returned handle as input parameter for the consequent IA_AIQ calls.
+ */
+LIBEXPORT ia_aiq*
+ia_aiq_init(const ia_binary_data *aiqb_data,
+ const ia_binary_data *nvm_data,
+ const ia_binary_data *aiqd_data,
+ unsigned int stats_max_width,
+ unsigned int stats_max_height,
+ unsigned int max_num_stats_in,
+ ia_cmc_t *ia_cmc,
+ ia_mkn *ia_mkn);
+
+/*!
+ * \brief Set tuning to an existing AIQ instance.
+ * This function can be used to switch tunings on-the-fly in a way that 3A preserves its state and offers smooth transition from one tuning to another.
+ */
+LIBEXPORT ia_err
+ia_aiq_set_tuning(ia_aiq *ia_aiq,
+ const ia_binary_data *aiqb_data);
+
+/*!
+ * \brief De-initialize IA_AIQ and its submodules.
+ * All memory allocated by AIQ algoriths are freed. AIQ handle can no longer be used.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ */
+LIBEXPORT void
+ia_aiq_deinit(ia_aiq *ia_aiq);
+
+/*!
+ * \brief Manual AEC limit parameters.
+ */
+typedef struct
+{
+ int manual_exposure_time_min; /*!< Optional. Minimum exposure time in microseconds. -1 if NA. */
+ int manual_exposure_time_max; /*!< Optional. Maximum exposure time in microseconds. -1 if NA. */
+ int manual_frame_time_us_min; /*!< Optional. Manual minimum frame length in microseconds. Defines maximum frame rate -1 if NA. */
+ int manual_frame_time_us_max; /*!< Optional. Manual maximum frame length in microseconds. Defines minimum frame rate. -1 if NA. */
+ short manual_iso_min; /*!< Optional. Manual minimum ISO. -1 if NA. */
+ short manual_iso_max; /*!< Optional. Manual maximum ISO. -1 if NA. */
+} ia_aiq_ae_manual_limits;
+
+/*!
+ * \brief Input parameter structure for AE algorithm.
+ */
+typedef struct
+{
+ unsigned int num_exposures; /*!< Mandatory. The number of exposure outputs to have. Must be positive. One for LDR, two or more for HDR/exposure bracketing. */
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the AEC calculations (Preview, Still, video etc.). */
+ ia_aiq_flash_mode flash_mode; /*!< Mandatory. Manual flash mode. If AEC should make flash decision, set mode to ia_aiq_flash_mode_auto. */
+ ia_aiq_ae_operation_mode operation_mode; /*!< Mandatory. AEC operation mode. */
+ ia_aiq_ae_metering_mode metering_mode; /*!< Mandatory. AEC metering mode. */
+ ia_aiq_ae_priority_mode priority_mode; /*!< Mandatory. AEC priority mode. */
+ ia_aiq_ae_flicker_reduction flicker_reduction_mode; /*!< Mandatory. AEC flicker reduction mode. */
+ ia_aiq_exposure_sensor_descriptor *sensor_descriptor; /*!< Mandatory although function will not return error, if not given.
+ Sensor specific descriptor and limits of the used sensor mode for target frame use.
+ AEC will not limit and calculate sensor specific parameters, if not given */
+ ia_rectangle *exposure_window; /*!< Optional. Rectangle of area which AEC uses to to calculate new exposure parameters. */
+ ia_coordinate *exposure_coordinate; /*!< Optional. Coordinate for a point in which the exposure should be prioritized.
+ AEC increases weight of given point in final AEC results. */
+ float ev_shift; /*!< Optional. Exposure Value shift [-4,4]. */
+ long *manual_exposure_time_us; /*!< Optional. Manual exposure time in microseconds. NULL if NA. Otherwise, array of values
+ of num_exposures length. Order of exposure times corresponds to exposure_index of ae_results,
+ e.g., manual_exposure_time_us[ae_results->exposures[0].exposure_index] = 33000; */
+ float *manual_analog_gain; /*!< Optional. Manual analog gain. NULL if NA. Otherwise, array of values of num_exposures length.
+ Order of gain values corresponds to exposure_index of ae_results,
+ e.g., manual_analog_gain[ae_results->exposures[0].exposure_index] = 4.0f; */
+ short *manual_iso; /*!< Optional. Manual ISO. Overrides manual_analog_gain. NULL if NA. Otherwise, array of values
+ of num_exposures length. Order of ISO values corresponds to exposure_index of ae_results,
+ e.g., manual_iso[ae_results->exposures[0].exposure_index] = 100; */
+ ia_aiq_ae_features *aec_features; /*!< Optional. AEC features in use when calculating new exposure parameters. */
+ ia_aiq_ae_manual_limits *manual_limits; /*!< Optional. Manual limits which override limits defined in AEC tunings. */
+ float manual_aperture_fn; /*!< Optional. Manual f-number of aperture (e.g. 2.8), -1.0 for N/A. Used only with P iris. */
+ ia_aiq_aperture_control_dc_iris_command manual_dc_iris_command; /*!< Optional. Used only with DC iris. 0 (auto) for N/A. */
+ ia_aiq_ae_exposure_distribution_priority exposure_distribution_priority; /*!< Mandatory. AEC exposure distribution priority mode. */
+ float manual_convergence_time; /*!< Optional. Manual AEC convergence speed in seconds. -1.0 if NA. Overrides convergence speed from tunings. */
+} ia_aiq_ae_input_params;
+
+/*!
+ * \brief AEC calculation based on input parameters and frame statistics.
+ * AE calculates new exposure parameters to be used for the next frame based on previously given statistics and user parameters.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] ae_input_params Mandatory.\n
+ * Input parameters for AEC calculations.
+ * \param[out] ae_results Mandatory.\n
+ * Pointer's pointer where address of ISP parameters are stored.
+ * Results from AEC calculations. Results can be used directly as input for AIC.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_ae_run(ia_aiq *ia_aiq,
+ const ia_aiq_ae_input_params *ae_input_params,
+ ia_aiq_ae_results **ae_results);
+
+/*!
+ * \brief Input parameter structure for AF algorithm.
+ */
+typedef struct
+{
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the AF calculations (Preview, Still, video etc.). */
+ int lens_position; /*!< Mandatory. Current lens position. */
+ unsigned long long lens_movement_start_timestamp; /*!< Mandatory. Lens movement start timestamp in us. Timestamp is compared against statistics timestamp
+ to determine if lens was moving during statistics collection. */
+ ia_aiq_af_operation_mode focus_mode; /*!< Mandatory. Focusing mode. */
+ ia_aiq_af_range focus_range; /*!< Mandatory. Focusing range. Only valid when focus_mode is ia_aiq_af_operation_mode_auto. */
+ ia_aiq_af_metering_mode focus_metering_mode; /*!< Mandatory. Metering mode (multispot, touch). */
+ ia_aiq_flash_mode flash_mode; /*!< Mandatory. User setting for flash. */
+ ia_rectangle *focus_rect; /*!< Optional. */
+ ia_aiq_manual_focus_parameters *manual_focus_parameters; /*!< Optional. Manual focus parameters (manual lens position, manual focusing distance). Used only if
+ focus mode 'ia_aiq_af_operation_mode_manual' is used. */
+ bool trigger_new_search; /*!< TRUE if new AF search is needed, FALSE otherwise. Host is responsible for flag cleaning. */
+} ia_aiq_af_input_params;
+
+/*!
+ * \brief AF calculation based on input parameters and frame statistics.
+ * AF calculates new lens position based on statistics and given input parameters.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] af_input_params Mandatory.\n
+ * Input parameters for AF calculations.
+ * \param[out] af_results Mandatory.\n
+ * Pointer's pointer where address of AF results are stored.
+ * Results from AF calculations.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_af_run(ia_aiq *ia_aiq,
+ const ia_aiq_af_input_params *af_input_params,
+ ia_aiq_af_results **af_results);
+
+/*!
+ * \brief Input parameter structure for AWB algorithm.
+ */
+typedef struct
+{
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the AWB calculations (Preview, Still, video etc.). */
+ ia_aiq_awb_operation_mode scene_mode; /*!< Mandatory. AWB scene mode. */
+ ia_aiq_awb_manual_cct_range *manual_cct_range; /*!< Optional. Manual CCT range. Used only if AWB scene mode 'ia_aiq_awb_operation_manual_cct_range' is used. */
+ ia_coordinate *manual_white_coordinate; /*!< Optional. Manual white point coordinate relative to the full FOV of the scene. Used only if AWB scene mode 'ia_aiq_awb_operation_manual_white' is used. */
+ float manual_convergence_time; /*!< Optional. Manual AWB convergence speed in seconds. -1.0 if NA. Overrides convergence speed from tunings. */
+} ia_aiq_awb_input_params;
+
+/*!
+ * \brief AWB calculation based on input parameters and frame statistics.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] awb_input_params Mandatory.\n
+ * Input parameters for AWB calculations.
+ * \param[out] awb_results Mandatory.\n
+ * Pointer's pointer where address of AWB results are stored.
+ * Results from AWB calculations. Results can be used directly as input for ia_isp.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_awb_run(ia_aiq *ia_aiq,
+ const ia_aiq_awb_input_params *awb_input_params,
+ ia_aiq_awb_results **awb_results);
+
+
+/*!
+ * \brief Input parameter structure for GBCE algorithm.
+ */
+typedef struct
+{
+ ia_aiq_gbce_level gbce_level; /*!< Mandatory. GBCE level. -1 to use tuning defaults.*/
+ ia_aiq_tone_map_level tone_map_level; /*!< Mandatory. Tone Map level. -1 to use tuning defaults.*/
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the GBCE calculations (Preview, Still, video etc.). */
+ float ev_shift; /*!< Optional. Exposure Value shift [-4,4]. */
+} ia_aiq_gbce_input_params;
+
+/*!
+ * \brief GBCE calculation based on input parameters and frame statistics.
+ * Computes gamma
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] gbce_input_params Mandatory.\n
+ * Input parameters for GBCE calculations.
+ * \param[out] gbce_results Mandatory.\n
+ * Pointer's pointer where address of GBCE results are stored.
+ * Results contain GBCE Gamma table. Results can be used directly as input for AIC.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_gbce_run(ia_aiq *ia_aiq,
+ const ia_aiq_gbce_input_params *gbce_input_params,
+ ia_aiq_gbce_results **gbce_results);
+
+/*!
+ * \brief Input parameter structure for DSD algorithm.
+ */
+typedef struct
+{
+ ia_aiq_af_results *af_results; /*!< Mandatory although function will not return error, if not given.
+ DSD will not return all scene modes, if not given. */
+ ia_aiq_scene_mode scene_modes_selection; /*!<configure which scene modes should be detected by DSD*/
+} ia_aiq_dsd_input_params;
+
+/*!
+ * \brief DSD based on statistics analysis.
+ * Determine scene (DSD) the given image.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] dsd_input_params Mandatory.\n
+ * Input parameters for DSD calculations.
+ * \param[out] dsd_scene Mandatory.\n
+ * Detected scene mode.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_dsd_run(ia_aiq *ia_aiq,
+ const ia_aiq_dsd_input_params *dsd_input_params,
+ ia_aiq_scene_mode *dsd_scene);
+
+/*!
+ * \brief Input parameter structure for Parameter adaptor.
+ */
+typedef struct
+{
+ ia_aiq_awb_results *awb_results; /*!< Mandatory. WB results which are to be used to calculate next ISP parameters (WB gains, color matrix,etc). */
+ ia_aiq_exposure_parameters *exposure_params; /*!< Mandatory. Analog gain and exposure time. */
+ ia_aiq_color_channels *color_gains; /*!< Optional. RGB gains for each color channels. These gain will be applied on top of RGB gains calculated from WB results. */
+} ia_aiq_pa_input_params;
+
+/*!
+ * \brief Parameter adaptor calculations for the next frame.
+ * Compute generic parameters (Color Correction Matrix and Black Level Correction),
+ * which should be used to correct the next frame. Calculations are based on previously calculated AIQ algorithm results.
+ * These generic results are converted to ISP specific parameters by ia_isp component.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] pa_input_params Mandatory.\n
+ * Input parameters for PA calculations.
+ * \param[out] pa_results Mandatory.\n
+ * Pointer's pointer where address of parameter adaptor results are stored.
+
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_pa_run(ia_aiq *ia_aiq,
+ const ia_aiq_pa_input_params *pa_input_params,
+ ia_aiq_pa_results **pa_results);
+
+/*!
+ * \brief Input parameter structure for Shading Adaptor.
+ */
+typedef struct
+{
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the AIC calculations (Preview, Still, video etc.). */
+ ia_aiq_frame_params *sensor_frame_params; /*!< Mandatory. Sensor frame parameters. Describe frame scaling/cropping done in sensor. */
+ ia_aiq_awb_results *awb_results; /*!< Mandatory. WB results which are to be used to calculate next ISP parameters (WB gains, color matrix,etc). */
+} ia_aiq_sa_input_params;
+
+/*!
+ * \brief Shading Adaptor calculations for the next frame.
+ * Compute shading correction parameters.
+ * which should be used to correct the next frame. Calculations are based on previously calculated AIQ algorithm results.
+ * These generic results are converted to ISP specific parameters by ia_isp component.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] sa_input_params Mandatory.\n
+ * Input parameters for SA calculations.
+ * \param[out] sa_results Mandatory.\n
+ * Pointer's pointer where address of shading adaptor results are stored.
+
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_sa_run(ia_aiq *ia_aiq,
+ const ia_aiq_sa_input_params *sa_input_params,
+ ia_aiq_sa_results **sa_results);
+
+/*!
+ * \brief Input parameter structure for setting the statistics.
+ */
+typedef struct
+{
+ unsigned long long frame_id; /*!< The frame identifier which identifies to which frame the given statistics correspond. Must be positive. */
+ unsigned long long frame_timestamp; /*!< Mandatory although function will not return error, if not given.
+ Start of frame timestamp in microseconds. This value is used in conjunction with timestamps
+ provided in the AIQ algorithms function calls to calculate the convergence
+ speed of AIQ algorithms.
+ AEC, AWB and AF will not converge, if not given. */
+ const ia_aiq_ae_results *frame_ae_parameters; /*!< Mandatory although function will not return error, if not given.
+ Exposure results from AEC which were used to capture this frame.
+ AEC depends on this parameters. AEC will return cold start values if not given.*/
+ const ia_aiq_af_results *frame_af_parameters; /*!< Mandatory although function will not return error, if not given.
+ Focus results from AF which were used to capture this frame.
+ AEC with AF assist light and flash usage in macro functionalities depend on these parameters. */
+ const ia_aiq_rgbs_grid **rgbs_grids; /*!< Mandatory. Almost all AIQ algorithms require RGBS grid statistics. */
+ unsigned int num_rgbs_grids; /*!< The number of RGBS grids. */
+ const ia_aiq_hdr_rgbs_grid* hdr_rgbs_grid; /*!< Optional. HDR statistics grid. */
+ const ia_aiq_af_grid **af_grids; /*!< Mandatory although function will not return error, if not given.
+ AF will return a NULL pointer, if not given.
+ DSD will not return all scene modes, if not given. */
+ unsigned int num_af_grids; /*!< The number of AF grids. */
+ const ia_aiq_histogram **external_histograms; /*!< Optional. If ISP calculates histogram, if can be given. If external histogram is not given,
+ AIQ internally calculates the histogram from the RGBS grid statistics and given AWB parameters. */
+ unsigned int num_external_histograms; /*!< The number of external histograms. */
+ const ia_aiq_pa_results *frame_pa_parameters; /*!< Optional (Mandatory if external_histogram is not given).
+ AWB results used in the frame from where the statistics are collected.
+ GBCE will give default gamma table if external histogram or AWB results are not available. */
+ const ia_face_state *faces; /*!< Mandatory although function will not return error, if not given.
+ Face coordinates from external face detector.
+ DSD will not return all scene modes, if not given.
+ AWB will not take face information into account, if not given. */
+ ia_aiq_camera_orientation camera_orientation; /*!< The orientation of the camera. Currently unused. */
+
+ const ia_aiq_awb_results *awb_results; /*!< Optional. Estimated AWB results from the previous run of AWB */
+ const ia_aiq_sa_results *frame_sa_parameters; /*!< Optional. LSC results used in the frame for statistics collected. */
+ const ia_aiq_depth_grid **depth_grids; /*!< Optional. Depth grid statistics */
+ unsigned int num_depth_grids; /*!< Optional. Number of depth grid statistics */
+} ia_aiq_statistics_input_params;
+
+/*!
+ * \brief Set input statistics and information about the captured image.
+ * AIQ algorithms need various information about the conditions in which the frame and statistics were captured in order to
+ * calculate new parameters.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] statistics_input_params Mandatory.\n
+ * Input parameters containing statistics and information about a frame.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_statistics_set(ia_aiq *ia_aiq,
+ const ia_aiq_statistics_input_params *statistics_input_params);
+
+/*!
+ * \brief Focus bracketing parameters.
+ */
+typedef struct
+{
+ unsigned char focus_positions; /*!< Number of focus positions */
+ ia_aiq_af_results af_results; /*!< Autofocus results */
+ ia_aiq_af_bracket_mode af_bracket_mode; /*!< Focus bracketing mode */
+} ia_aiq_af_bracket_input_params;
+
+/*!
+ * \brief Calculates the list of lens positions for focus bracketing.
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] af_bracket_input_params Mandatory.\n
+ * Autofocus bracketing parameters.
+ * \param[out] af_bracket_results Mandatory.\n
+ * Pointer's pointer where address of focus bracketing results are stored.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_af_bracket(ia_aiq *ia_aiq,
+ const ia_aiq_af_bracket_input_params *af_bracket_input_params,
+ ia_aiq_af_bracket_results **af_bracket_results);
+
+/*!
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[out] out_ia_aiq_data Mandatory.\n
+ * Contains various AIQ related information, collected during run-time and subject to
+ * be stored in a host file system. Host will copy this data, if ia_aiq_data->size > 0
+ * and ia_aiq_data->data != NULL; AIQ is responsible to deallocate data buffer
+ * during ia_aiq_deinit().
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_get_aiqd_data(ia_aiq *ia_aiq,
+ ia_binary_data *out_ia_aiq_data);
+
+
+
+/*!
+* \brief Data from external sensors
+*/
+typedef struct
+{
+ ia_aiq_sensor_data *accelerometer_events; /*!< The data holds information on the acceleration of the device in mg/sec (miligravity per second).
+ Acceleration = Gravity + Linear Acceleration*/
+ unsigned int num_accelerometer_events; /*!< Number of accelerometer events */
+ ia_aiq_sensor_data *gravity_events; /*!< The data holds information on the gravitation of the device in mg/sec (miligravity per second) */
+ unsigned int num_gravity_events; /*!< Number of gravity events */
+ ia_aiq_sensor_data *gyroscope_events; /*!< The data holds information on the angular velocity of the device in rad/sec */
+ unsigned int num_gyroscope_events; /*!< Number of gyroscope events */
+ ia_aiq_ambient_light_events *ambient_light_events; /*!< The data holds information on the ambient light */
+ unsigned int num_ambient_light_events; /*!< Number of ambient light events */
+} ia_aiq_sensor_events;
+
+/*!
+ * \brief Set event statistics.
+ * Some of the AIQ algorithms benefit from sensor information which tells about the conditions in which the device is in use
+ *
+ * \param[in] ia_aiq Mandatory.\n
+ * AIQ instance handle.
+ * \param[in] sensor_events_input Mandatory.\n
+ * Sensor events input holds data from libsensorhub.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_aiq_sensor_events_set(ia_aiq *ia_aiq,
+ const ia_aiq_sensor_events *sensor_events_input);
+
+
+
+/*!
+ * \brief Get version.
+ * Get version from version header.
+ *
+ * \return Version string.
+ */
+LIBEXPORT const char* ia_aiq_get_version(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_AIQ_H_ */
diff --git a/include/ia_imaging/ia_aiq_types.h b/include/ia_imaging/ia_aiq_types.h
new file mode 100644
index 0000000..f6b7344
--- /dev/null
+++ b/include/ia_imaging/ia_aiq_types.h
@@ -0,0 +1,784 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_aiq_types.h
+ * \brief Definitions of input/output structures of the Intel 3A library.
+ */
+
+#ifndef _IA_AIQ_TYPES_H_
+#define _IA_AIQ_TYPES_H_
+
+#include "ia_types.h"
+#include "ia_cmc_types.h"
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_COLOR_CONVERSION_MATRIX 3
+typedef struct ia_aiq_t ia_aiq;
+
+/*!
+ * \brief Target (frame use) for the analysis algorithms calculations.
+ */
+typedef enum
+{
+ ia_aiq_frame_use_preview,
+ ia_aiq_frame_use_still,
+ ia_aiq_frame_use_continuous,
+ ia_aiq_frame_use_video,
+} ia_aiq_frame_use;
+
+/*!
+ * \brief Camera orientations.
+ */
+typedef enum
+{
+ ia_aiq_camera_orientation_unknown, /*!< Orientation not known. */
+ ia_aiq_camera_orientation_rotate_0, /*!< Non-rotated landscape. */
+ ia_aiq_camera_orientation_rotate_90, /*!< Portrait i.e. rotated 90 degrees clockwise. */
+ ia_aiq_camera_orientation_rotate_180, /*!< Landscape (upside down) i.e. rotated 180 degrees clockwise. */
+ ia_aiq_camera_orientation_rotate_270 /*!< Portrait (upside down) i.e. rotated 270 degrees clockwise. */
+} ia_aiq_camera_orientation;
+
+/*!
+ * \brief AEC flicker reduction modes.
+ */
+typedef enum
+{
+ ia_aiq_ae_flicker_reduction_off, /*!< Disables flicker detection and reduction. */
+ ia_aiq_ae_flicker_reduction_50hz, /*!< Manual flicker reduction for 50Hz mains frequency. */
+ ia_aiq_ae_flicker_reduction_60hz, /*!< Manual flicker reduction for 60Hz mains frequency. */
+ ia_aiq_ae_flicker_reduction_auto, /*!< Detects flicker frequency and applies detected reduction. */
+ ia_aiq_ae_flicker_reduction_detect, /*!< Detects only flicker frequency but doesn't apply reduction. */
+} ia_aiq_ae_flicker_reduction;
+
+/*!
+ * \brief AEC operation modes.
+ */
+typedef enum {
+ ia_aiq_ae_operation_mode_automatic, /*!< Automatic mode. */
+ ia_aiq_ae_operation_mode_long_exposure, /*!< AEC produces exposure parameters with long exposure (low light & static) scene. */
+ ia_aiq_ae_operation_mode_action, /*!< AEC produces exposure parameters for fast moving scene. */
+ ia_aiq_ae_operation_mode_video_conference, /*!< AEC produces exposure parameters which can be used in video conferencing scene. */
+ ia_aiq_ae_operation_mode_production_test, /*!< AEC produces exposure parameters which are used in production test environment. */
+ ia_aiq_ae_operation_mode_ultra_low_light, /*!< AEC produces exposure parameters which are used in ultra low light scene. */
+ ia_aiq_ae_operation_mode_fireworks, /*!< AEC produces exposure parameters which are used in fireworks scene. */
+ ia_aiq_ae_operation_mode_hdr, /*!< AEC produces exposure parameters which are used for HDR imaging (vHDR or exposure bracketing). */
+ ia_aiq_ae_operation_mode_custom_1, /*!< AEC produces exposure parameters for a specialized custom scene 1. */
+ ia_aiq_ae_operation_mode_custom_2, /*!< AEC produces exposure parameters for a specialized custom scene 2. */
+ ia_aiq_ae_operation_mode_custom_3, /*!< AEC produces exposure parameters for a specialized custom scene 3. */
+} ia_aiq_ae_operation_mode;
+
+/*!
+ * \brief AEC metering modes.
+ */
+typedef enum {
+ ia_aiq_ae_metering_mode_evaluative, /*!< Exposure is evaluated from the whole frame. */
+ ia_aiq_ae_metering_mode_center, /*!< Exposure is evaluated center weighted. */
+} ia_aiq_ae_metering_mode;
+
+/*!
+ * \brief AEC priority modes.
+ */
+typedef enum {
+ ia_aiq_ae_priority_mode_normal, /*!< All areas are equally important. */
+ ia_aiq_ae_priority_mode_highlight, /*!< Highlights must be preserved even if it means that dark parts become very dark. */
+ ia_aiq_ae_priority_mode_shadow, /*!< Shadow areas are more important. */
+} ia_aiq_ae_priority_mode;
+
+/*!
+ * \brief AEC exposure distribution priority modes
+ *
+ * This enumeration values are used to control distribution of AEC exposure parameters. For example in some situation user may want to keep
+ * aperture at smallest value (in order to have large DOF) as long as possible in expense of motion blur (caused by long exposure time) and
+ * noise (caused by high ISO).
+ *
+ * Note. Manual priority modes as understood by SLRs are achieved by using manual exposure parameters when running AEC:
+ * Shutter priority: Set manual_exposure_time_us in ia_aiq_ae_input_params.
+ * ISO priority: Set manual_iso in ia_aiq_ae_input_params.
+ * Aperture priority: Set manual_aperture_fn in ia_aiq_ae_input_params.
+ */
+typedef enum
+{
+ ia_aiq_ae_exposure_distribution_auto, /*!< AEC internally prioritizes between exposure time, aperture and ISO when calculating distribution. */
+ ia_aiq_ae_exposure_distribution_shutter, /*!< AEC tries to keep the exposure time at minimum until ISO and aperture are at maximum. */
+ ia_aiq_ae_exposure_distribution_iso, /*!< AEC tries to keep the ISO at minimum until exposure time and aperture are at maximum. */
+ ia_aiq_ae_exposure_distribution_aperture, /*!< AEC tries to keep the aperture at minimum until exposure time and ISO are at maximum. */
+} ia_aiq_ae_exposure_distribution_priority;
+
+/*!
+ * \brief AEC feature setting.
+ */
+typedef enum {
+ ia_aiq_ae_feature_setting_tuning, /*!< Feature setting is taken from tuning data. */
+ ia_aiq_ae_feature_setting_disabled, /*!< Feature setting is disabled. */
+ ia_aiq_ae_feature_setting_enabled, /*!< Feature setting is enabled. */
+} ia_aiq_ae_feature_setting;
+
+
+/*!
+ * \brief Autofocus states
+ */
+typedef enum
+{
+ ia_aiq_af_status_idle, /*!< Focus is idle */
+ ia_aiq_af_status_local_search, /*!< Focus is in local search state */
+ ia_aiq_af_status_extended_search, /*!< Focus is in extended search state */
+ ia_aiq_af_status_success, /*!< Focus has succeeded */
+ ia_aiq_af_status_fail, /*!< Focus has failed */
+ ia_aiq_af_status_depth_search /*!< Focus in depth search mode */
+} ia_aiq_af_status;
+
+/*!
+ * \brief Action for the lens driver
+ */
+typedef enum
+{
+ ia_aiq_lens_driver_action_none,
+ ia_aiq_lens_driver_action_move_to_unit,
+ ia_aiq_lens_driver_action_move_by_units
+} ia_aiq_lens_driver_action;
+
+/*!
+ * \brief Autofocus modes
+ */
+typedef enum
+{
+ ia_aiq_af_operation_mode_auto, /*!< Auto mode */
+ ia_aiq_af_operation_mode_infinity, /*!< Inifinity mode */
+ ia_aiq_af_operation_mode_hyperfocal, /*!< Hyperfocal mode */
+ ia_aiq_af_operation_mode_manual, /*!< Manual mode */
+ ia_aiq_af_operation_mode_production_test, /*!< Production test mode. */
+ ia_aiq_af_operation_mode_depth_map, /*!< Depth-map generation mode. */
+ ia_aiq_af_operation_mode_depth, /*!< Automatic focusing based on depth measurements only. */
+ ia_aiq_af_operation_mode_contrast /*!< Automatic focusing based on contrast measurements only. */
+} ia_aiq_af_operation_mode;
+
+/*!
+ * \brief Autofocus range
+ */
+typedef enum
+{
+ ia_aiq_af_range_normal, /*!< Normal range */
+ ia_aiq_af_range_macro, /*!< Macro range */
+ ia_aiq_af_range_extended, /*!< Extended/full range */
+} ia_aiq_af_range;
+
+
+/*!
+ * \brief Autofocus metering modes
+ */
+typedef enum
+{
+ ia_aiq_af_metering_mode_auto, /*!< Auto metering mode */
+ ia_aiq_af_metering_mode_touch /*!< Touch metering mode */
+} ia_aiq_af_metering_mode;
+
+/*!
+ * \brief Lens actuator status
+ */
+typedef enum
+{
+ ia_aiq_lens_status_stopped, /*!< Lens has not moved during the frame integration*/
+ ia_aiq_lens_status_moving /*!< Lens has been moving during the frame integration */
+} ia_aiq_lens_status;
+
+/*!
+ * \brief Action for the manual focus
+ */
+typedef enum
+{
+ ia_aiq_manual_focus_action_none, /*!< No action for the manual focus is required */
+ ia_aiq_manual_focus_action_set_distance, /*!< Set manual focus distance */
+ ia_aiq_manual_focus_action_set_lens_position, /*!< Set manual lens position */
+ ia_aiq_manual_focus_action_set_focal_distance /*!< Set manual focal distance in um (distance between the lens and the sensor plane, e.g. 4390) */
+} ia_aiq_manual_focus_action;
+
+/*!
+ * \brief Focus bracketing mode.
+ */
+typedef enum
+{
+ ia_aiq_af_bracket_mode_symmetric, /*!< Symmetric focus bracketing around the reference lens position*/
+ ia_aiq_af_bracket_mode_towards_near, /*!< One side focus bracketing. Images are taken towards NEAR end (macro) */
+ ia_aiq_af_bracket_mode_towards_far /*!< One side focus bracketing. Images are taken towards FAR end (infinity)*/
+} ia_aiq_af_bracket_mode;
+
+/*!
+ * \brief Detected scene mode.
+ */
+typedef enum
+{
+ ia_aiq_scene_mode_none = 0,
+ ia_aiq_scene_mode_close_up_portrait = (1 << 0),
+ ia_aiq_scene_mode_portrait = (1 << 1),
+ ia_aiq_scene_mode_lowlight_portrait = (1 << 2),
+ ia_aiq_scene_mode_low_light = (1 << 3),
+ ia_aiq_scene_mode_action = (1 << 4),
+ ia_aiq_scene_mode_backlight = (1 << 5),
+ ia_aiq_scene_mode_landscape = (1 << 6),
+ ia_aiq_scene_mode_document = (1 << 7),
+ ia_aiq_scene_mode_firework = (1 << 8),
+ ia_aiq_scene_mode_lowlight_action = (1 << 9),
+ ia_aiq_scene_mode_baby = (1 << 10),
+ ia_aiq_scene_mode_barcode = (1 << 11)
+} ia_aiq_scene_mode;
+
+/*!
+* \brief Mode for calculating AE bracketing.
+*/
+typedef enum
+{
+ ia_aiq_bracket_mode_none, /*!< No bracketing used. */
+ ia_aiq_bracket_mode_ull = (1 << 0), /*!< Ultra Low Light bracketing used. */
+ ia_aiq_bracket_mode_hdr = (1 << 1) /*!< High Dynamic Range bracketing used. */
+} ia_aiq_bracket_mode;
+
+/*!
+ * \brief Manual focus parameters.
+ */
+typedef struct
+{
+ unsigned int manual_focus_distance; /*!< Manual focus distance in mm*/
+ int manual_lens_position; /*!< Manual lens position */
+ unsigned int manual_focal_distance; /*!< Manual focal_distance in um (e.g. 4390) */
+ ia_aiq_manual_focus_action manual_focus_action; /*!< Manual focus action */
+} ia_aiq_manual_focus_parameters;
+
+/*!
+ * \brief Exposure parameters in terms of generic units.
+ * Structure can be used as input or output from AEC.
+ */
+typedef struct
+{
+ int exposure_time_us; /*!< Exposure time in microseconds, -1 if N/A. */
+ float analog_gain; /*!< Analog gain as a multiplier (e.g. 1.0), -1.0 if N/A. */
+ float digital_gain; /*!< Digital gain as a multiplier (e.g. 1.0), -1.0 if N/A. */
+ float aperture_fn; /*!< f-number of aperture (e.g. 2.8), -1.0 for N/A. TODO: Move to ia_aiq_aperture_control structure. */
+ int total_target_exposure; /*!< Total exposure ie. combination of Et, Ag, Dg, Aperture gain and ND gain, -1 if N/A. */
+ bool nd_filter_enabled; /*!< true or false, false for N/A. */
+ int iso; /*!< ISO value corresponding to the analog gain. -1 if N/A. */
+} ia_aiq_exposure_parameters;
+
+/*!
+ * \brief Exposure parameters in terms of sensor units.
+ * Structure can be used as input or output from AEC.
+ */
+typedef struct
+{
+ unsigned short fine_integration_time; /*!< Integration time specified as a number of pixel clocks added on top of coarse_integration_time. */
+ unsigned short coarse_integration_time; /*!< Integration time specified in multiples of pixel_periods_per_line.*/
+ unsigned short analog_gain_code_global; /*!< Global analog gain code. */
+ unsigned short digital_gain_global; /*!< Global digital gain code. */
+ unsigned short line_length_pixels; /*!< The number of pixels in one row. This includes visible lines and horizontal blanking lines. */
+ unsigned short frame_length_lines; /*!< The number of complete lines (rows) in the output frame. This includes visible lines and vertical blanking lines. */
+} ia_aiq_exposure_sensor_parameters;
+
+/*!
+ * \brief Exposure related restrictions and constants in terms of sensor units.
+ * Camera driver fills and updates these parameters whenever they are changed (for example in mode change).
+ */
+typedef struct
+{
+ float pixel_clock_freq_mhz; /*!< Video timing pixel clock frequency. */
+ unsigned short pixel_periods_per_line; /*!< The number of pixel clock periods in one line (row) time. This includes visible pixels and horizontal blanking time. */
+ unsigned short line_periods_per_field; /*!< The number of complete lines (rows) in the output frame. This includes visible lines and vertical blanking lines. */
+ unsigned short line_periods_vertical_blanking; /*!< Number of vertical blanking lines. Visible lines can be calculated using this and line_periods_per_field (above) value. */
+ unsigned short fine_integration_time_min; /*!< The minimum allowed value for fine_integration_time in AEC outputs. */
+ unsigned short fine_integration_time_max_margin; /*!< fine_integration_time_max = pixel_periods_per_line - fine_integration_time_max_margin. */
+ unsigned short coarse_integration_time_min; /*!< The minimum allowed value for coarse_integration_time in AEC outputs. */
+ unsigned short coarse_integration_time_max_margin; /*!< coarse_integration_time_max = line_periods_per_field - coarse_integration_time_max_margin */
+} ia_aiq_exposure_sensor_descriptor;
+
+/*!
+ * AEC features.
+ * Parameters for enabling/disabling AEC features. Setting ia_aiq_ae_feature_setting_tuning takes feature definitions from CPF.
+ */
+typedef struct {
+
+ ia_aiq_ae_feature_setting motion_blur_control; /*!< AEC modifies exposure time/analog gain ratio based on movement in the image. */
+ ia_aiq_ae_feature_setting backlight_compensation; /*!< AEC analyzes and modifies exposure parameters based on backlight detection algorithm. */
+ ia_aiq_ae_feature_setting face_utilization; /*!< AEC uses face coordinates in exposure calculations for next frame. */
+ ia_aiq_ae_feature_setting red_eye_reduction_flash; /*!< AEC will propose flashes before pre-flashes to reduce red eye effect. */
+ ia_aiq_ae_feature_setting fill_in_flash; /*!< AEC will propose flash in back light situations, where target is close enough. */
+} ia_aiq_ae_features;
+
+
+/*!
+ * \brief Flash modes from the user.
+ */
+typedef enum
+{
+ ia_aiq_flash_mode_auto,
+ ia_aiq_flash_mode_on,
+ ia_aiq_flash_mode_off,
+} ia_aiq_flash_mode;
+
+/*!
+ * \brief Flash status.
+ */
+typedef enum
+{
+ ia_aiq_flash_status_no, /*!< No flash use. */
+ ia_aiq_flash_status_torch, /*!< Torch flash use. */
+ ia_aiq_flash_status_pre, /*!< Pre-flash use. */
+ ia_aiq_flash_status_main, /*!< Main flash use. */
+ ia_aiq_flash_status_red_eye_reduction, /*!< Red Eye Reduction flash use. */
+} ia_aiq_flash_status;
+
+/*!
+ * \brief Depth data type.
+ */
+typedef enum
+{
+ ia_aiq_depth_data_type_vcm, /*!< VCM units */
+ ia_aiq_depth_data_type_mm, /*!< Distance to the object in mm */
+} ia_aiq_depth_data_type;
+
+/*!
+ * \brief Flash parameters.
+ * Structure can be used as input or output from AEC.
+ */
+typedef struct
+{
+ ia_aiq_flash_status status; /*!< Flash status. */
+ char power_prc; /*!< Flash power [0,100] value range maps 0% to 100%, 0 if off. */
+} ia_aiq_flash_parameters;
+
+
+/*!
+ * \brief Grid for weighted histograms.
+ * Pixel values of certain area can be weighted differently based of specified grid.
+ * Weight grid should be passed and used by the component which is calculating the histograms from the frame data. If no pixel accurate
+ * histograms are calculated, the weight map should be given back to AIQ library along with the statistics so that AIQ library can
+ * calculate the weighted histograms itself from the RGBS statistics.
+ * This structure is output as part of AEC results but it can be replaced with custom weight map.
+ */
+typedef struct
+{
+ unsigned short width; /*!< Width of the weight grid. */
+ unsigned short height; /*!< Height of the weight grid. */
+ unsigned char *weights; /*!< Multipliers (weight) of RGB values in the grid. Values range [0, 15]. */
+} ia_aiq_hist_weight_grid;
+
+/*!
+ * \brief Histogram.
+ * AIQ uses internally histogram, which are calculated from RGBS statistics:
+ * - "RAW" frame data i.e. RGBS statistics (corrected BLC + LSC).
+ * - "Color corrected" frame data (corrected BLC + LSC + CCM + WB)
+ * - "Color corrected and weighted" frame data (corrected BLC + LSC + CCM + WB + Weight Map)
+ * If histograms are calculated outside AIQ from frame pixel data (more accurate), it is expected to be "Color corrected and weighted".
+ * Size of histogram data arrays behind the pointers depends on value of num_bins variable in the structure.
+ */
+typedef struct
+{
+ unsigned int num_bins; /*!< Number of histogram bins. */
+ unsigned int *r; /*!< R histogram. */
+ unsigned int *g; /*!< G (both Gr and Gb values) histogram. */
+ unsigned int *b; /*!< B histogram. */
+ unsigned int *rgb; /*!< Combined RGB histogram (all pixel values of R, G and B together) TODO: Remove?. Used in percentile calculation but if GW AWB is done always, the same values are calculated. */
+ unsigned int *rgb_ch; /*!< RGB channel-independent histogram where all channels are treated as grayscale intensities and combined into one histogram. */
+ unsigned int *y; /*!< Luminance histogram. */
+ unsigned int num_r_elements; /*!< Number of elements in the R histogram. */
+ unsigned int num_g_elements; /*!< Number of elements in the G histogram. */
+ unsigned int num_b_elements; /*!< Number of elements in the B histogram. */
+ unsigned int num_rgb_elements; /*!< Number of elements in the combined RGB histogram. */
+ unsigned int num_rgb_ch_elements; /*!< Number of elements in the RGB channel-independent histogram. */
+ unsigned int num_y_elements; /*!< Number of elements in the luminance histogram. */
+} ia_aiq_histogram;
+
+/*!
+ * \brief Grid block
+ * As defined in the AIQ statistics specification.
+ * Ranges of all parameters are [0, 255].
+ */
+typedef struct
+{
+ unsigned char avg_gr; /*!< Average Gr value in the grid. */
+ unsigned char avg_r; /*!< Average R value in the grid. */
+ unsigned char avg_b; /*!< Average B value in the grid. */
+ unsigned char avg_gb; /*!< Average Gb value in the grid. */
+ unsigned char sat; /*!< Percentage of saturated pixels in the block [0, 255]. */
+} rgbs_grid_block;
+
+/*!
+ * \brief R, G, B and Saturation grid block.
+ * As defined in the AIQ statistics specification.
+ * RGBS grid covers the full Field Of View (FOV) of the sensor.
+ */
+typedef struct
+{
+ rgbs_grid_block *blocks_ptr; /*!< RGBS blocks. */
+ unsigned short grid_width; /*!< Grid width. */
+ unsigned short grid_height; /*!< Grid height. */
+} ia_aiq_rgbs_grid; /* ia_aiq_rgbs_grid owns this */
+
+/*!
+ * \brief Grid block for 32-bit HDR.
+ * As defined in the AIQ statistics specification.
+ * Ranges of all parameters are [0, 255].
+ */
+typedef struct
+{
+ unsigned int avg_gr; /*!< Average Gr value in the grid. */
+ unsigned int avg_r; /*!< Average R value in the grid. */
+ unsigned int avg_b; /*!< Average B value in the grid. */
+ unsigned int avg_gb; /*!< Average Gb value in the grid. */
+ unsigned int sat; /*!< Percentage of saturated pixels in the block [0, 255]. */
+} hdr_rgbs_grid_block;
+
+/*!
+ * \brief R, G, B and Saturation grid block for 32-bit HDR statistics.
+ * As defined in the AIQ statistics specification.
+ * HDR RGBS grid covers the full Field Of View (FOV) of the sensor.
+ */
+typedef struct
+{
+ hdr_rgbs_grid_block *blocks_ptr; /*!< HDR RGBS blocks. */
+ unsigned int grid_width; /*!< Grid width. */
+ unsigned int grid_height; /*!< Grid height. */
+ unsigned int grid_data_bit_depth; /*!< Bit depth of data in channel data. */
+} ia_aiq_hdr_rgbs_grid;
+
+/*!
+ * \brief AF statistics
+ * As defined in the AIQ statistics specification.
+ * AF grid covers the full Field Of View (FOV) of the sensor.
+ */
+typedef struct
+{
+ unsigned short grid_width; /*!< Number of block elements horizontally in a grid. */
+ unsigned short grid_height; /*!< Number of block elements vertically in a grid. */
+ unsigned short block_width; /*!< Block width (bq per block element). */
+ unsigned short block_height; /*!< Block height (bq per grid element). */
+ int *filter_response_1; /*!< Filter response of filter 1 (e.g. low pass, used by auto focus). */
+ int *filter_response_2; /*!< Filter response of filter 2 (e.g. high pass, used by auto focus). */
+} ia_aiq_af_grid; /* ia_aiq_af_grid owns filter_response_1 and filter_response_2 */
+
+/*!
+ * \brief Depth grid statistics
+ */
+typedef struct
+{
+ ia_aiq_depth_data_type type; /*!< Data type (VCM units/mm)*/
+ ia_rectangle *grid_rect; /*!< ROI for the grid */
+ int *depth_data; /*!< Depth data (type of data is defined by ia_aiq_depth_data_type) */
+ unsigned char *confidence; /*!< Confidence level */
+ unsigned short grid_width; /*!< Number of grid elements horizontally */
+ unsigned short grid_height; /*!< Number of grid elements vertically */
+} ia_aiq_depth_grid;
+
+/*!
+ * \brief AWB scene modes
+ * Used in AWB as input to restrict White Point between certain CCT range.
+ * Note that not in all cases only CCT range is used to restrict White Point but more intelligent estimation may be used.
+ */
+typedef enum
+{
+ ia_aiq_awb_operation_mode_auto,
+ ia_aiq_awb_operation_mode_daylight, /*!< Restrict CCT range to [5000, 7000]. */
+ ia_aiq_awb_operation_mode_partly_overcast, /*!< Restrict CCT range to [5500, 9000]. */
+ ia_aiq_awb_operation_mode_fully_overcast, /*!< Restrict CCT range to [6000, 7000]. */
+ ia_aiq_awb_operation_mode_fluorescent, /*!< Restrict CCT range to [2700, 5500]. */
+ ia_aiq_awb_operation_mode_incandescent, /*!< Restrict CCT range to [2700, 3100]. */
+ ia_aiq_awb_operation_mode_sunset,
+ ia_aiq_awb_operation_mode_video_conference,
+ ia_aiq_awb_operation_mode_manual_cct_range, /*!< Use given CCT range (see ia_aiq_awb_manual_cct_range). */
+ ia_aiq_awb_operation_mode_manual_white, /*!< Use coordinate (see ia_coordinate) relative to full FOV which should be used as white point. */
+ ia_aiq_awb_operation_mode_production_test,
+ ia_aiq_awb_operation_mode_candlelight,
+ ia_aiq_awb_operation_mode_flash,
+ ia_aiq_awb_operation_mode_snow,
+ ia_aiq_awb_operation_mode_beach,
+} ia_aiq_awb_operation_mode;
+
+/*!
+ * \brief Manual CCT range
+ */
+typedef struct
+{
+ unsigned int min_cct;
+ unsigned int max_cct;
+} ia_aiq_awb_manual_cct_range;
+
+/*!
+ * \brief Frame parameters which describe cropping and scaling (need to be filled by AIQ client for every frame)
+ */
+typedef struct
+{
+ unsigned short horizontal_crop_offset; /*!< Read out offset horizontal. */
+ unsigned short vertical_crop_offset; /*!< Read out offset vertical. */
+ unsigned short cropped_image_width; /*!< Width of cropped area in native resolution. */
+ unsigned short cropped_image_height; /*!< Height of cropped area in native resolution. */
+ unsigned char horizontal_scaling_numerator; /*!< Horizontal scaling factor applied to the cropped image. Horizontal scaling factor = horizontal_scaling_numerator / horizontal_scaling_denominator. */
+ unsigned char horizontal_scaling_denominator; /*!< Horizontal scaling factor applied to the cropped image. Horizontal scaling factor = horizontal_scaling_numerator / horizontal_scaling_denominator. */
+ unsigned char vertical_scaling_numerator; /*!< Vertical scaling factor applied to the cropped image. Vertical scaling factor = vertical_scaling_numerator / vertical_scaling_denominator. */
+ unsigned char vertical_scaling_denominator; /*!< Vertical scaling factor applied to the cropped image. Vertical scaling factor = vertical_scaling_numerator / vertical_scaling_denominator. */
+} ia_aiq_frame_params;
+
+/*!
+ * \brief DC iris control.
+ * When using DC iris, there are no distinct aperture steps. Use these commands to increase or decrease aperture size.
+ */
+typedef enum
+{
+ ia_aiq_aperture_control_dc_iris_auto, /*!< State of the iris is selected automatically. */
+ ia_aiq_aperture_control_dc_iris_hold, /*!< Iris should hold current aperture. */
+ ia_aiq_aperture_control_dc_iris_open, /*!< Iris should open. */
+ ia_aiq_aperture_control_dc_iris_close, /*!< Iris should close. */
+} ia_aiq_aperture_control_dc_iris_command;
+
+/*!
+ * \brief Aperture control parameters.
+ * Aperture controls for both P (where iris has discrete amount of apertures) and DC (where iris has indefinite amount of possible apertures) iris.
+ */
+typedef struct
+{
+ float aperture_fn; /*!< f-number of aperture (e.g. 2.8), -1.0 for N/A. Used only with P iris. */
+ ia_aiq_aperture_control_dc_iris_command dc_iris_command; /*!< Used only with DC iris. */
+ int code; /*!< Iris module HW register value. */
+} ia_aiq_aperture_control;
+
+/*!
+ * \brief Exposure data for all exposures.
+ */
+typedef struct
+{
+ unsigned int exposure_index; /*!< Exposure index which identifies the exposure. */
+ ia_aiq_exposure_parameters* exposure; /*!< Exposure parameters to be used in the next frame in generic format. */
+ ia_aiq_exposure_sensor_parameters* sensor_exposure; /*!< Exposure parameters to be used in the next frame in sensor specific format. */
+ float distance_from_convergence; /*!< Distance of convergence as an EV shift value. Negative is underexposure, positive is overexposure */
+ bool converged; /*!< Indicates that AE has converged. */
+ unsigned int num_exposure_plan; /*!< Size of the exposure plan. Indicates how many exposure and sensor_exposure parameter structures are in the arrays above. */
+ unsigned int *exposure_plan_ids; /*!< Exposure plan IDs. Used to identify and sync what parameters were changed in the exposure plan. */
+} ia_aiq_ae_exposure_result;
+
+/*!
+ * \brief AEC results.
+ */
+typedef struct
+{
+ ia_aiq_ae_exposure_result* exposures; /*!< Results for each exposure to be used in the next frame. */
+ unsigned int num_exposures; /*!< The number of calculated exposures. */
+ ia_aiq_hist_weight_grid* weight_grid; /*!< Weight map to be used in the next frame histogram calculation. */
+ ia_aiq_flash_parameters* flashes; /*!< Array of flash parameters for each flashes to be used in the next frame. */
+ unsigned int num_flashes; /*!< Number of independent flashes. */
+ unsigned int lux_level_estimate; /*!< Lux level estimate. */
+ ia_aiq_bracket_mode multiframe; /*!< AEC may propose to use multiframe for optimal results. */
+ ia_aiq_ae_flicker_reduction flicker_reduction_mode; /*!< Flicker reduction mode proposed by the AEC algorithm */
+ ia_aiq_aperture_control *aperture_control; /*!< Aperture control parameters. */
+} ia_aiq_ae_results;
+
+/*!
+ * \brief Autofocus algorithm results
+ */
+typedef struct
+{
+ ia_aiq_af_status status; /*!< Focus status */
+ unsigned short current_focus_distance; /*!< Current focusing distance in mm */
+ int next_lens_position; /*!< Next lens position */
+ ia_aiq_lens_driver_action lens_driver_action; /*!< Lens driver action*/
+ bool use_af_assist; /*!< True if the af assist light is to be used at half press, false otherwise */
+ bool final_lens_position_reached; /*!< Lens has reached the final lens position */
+} ia_aiq_af_results;
+
+/*!
+ * \brief Results from AWB.
+ */
+typedef struct
+{
+ float accurate_r_per_g; /*!< Accurate White Point for the image. */
+ float accurate_b_per_g; /*!< Accurate White Point for the image. */
+ float final_r_per_g; /*!< Final White Point, including color appearance modeling. */
+ float final_b_per_g; /*!< Final White Point, including color appearance modeling.*/
+ unsigned int cct_estimate; /*!< Correlated Color Temperature estimate calculated from the accurate WP. */
+ float distance_from_convergence; /*!< Range [0.0f, 1.0f]. Distance from convergence. Value 0.0f means converged. */
+} ia_aiq_awb_results;
+
+/*!
+ * \brief GBCE level.
+ * Allows to override GBCE level defined in the tuning.
+ */
+typedef enum
+{
+ ia_aiq_gbce_level_use_tuning = -1, /*!< Use GBCE level defined in the tuning. */
+ ia_aiq_gbce_level_bypass = 0, /*!< Use the default gamma table without stretching. This level should be used when manual AE parameters are set. */
+ ia_aiq_gbce_level_gamma_stretch, /*!< Apply histogram stretching. */
+ ia_aiq_gbce_level_gamma_stretch_and_power_adaptation, /*!< Histogram stretching & gamma power adaptation. */
+} ia_aiq_gbce_level;
+
+/*!
+* \brief Tone Map level.
+* Allows to override Tone Map level defined in the tuning.
+*/
+
+typedef enum
+{
+ ia_aiq_tone_map_level_use_tuning = -1, /*!< Use Tone Map level defined in the tuning. */
+ ia_aiq_tone_map_level_bypass = 0, /*!< Bypass TM LUT (i.e. legacy GBCE behavior) */
+ ia_aiq_tone_map_level_default, /*!< Put the gains in TM LUT (gamma LUT will have sRGB gamma only) */
+ ia_aiq_tone_map_level_dynamic, /*!< Force dynamic calculation of TM LUT */
+} ia_aiq_tone_map_level;
+
+/*!
+ * \brief Results from GBCE.
+ */
+typedef struct {
+ float* r_gamma_lut; /*!< Gamma LUT for R channel. Range [0.0, 1.0]. */
+ float* b_gamma_lut; /*!< Gamma LUT for B channel. Range [0.0, 1.0]. */
+ float* g_gamma_lut; /*!< Gamma LUT for G channel. Range [0.0, 1.0]. */
+ unsigned int gamma_lut_size; /*!< Number of elements in each gamma LUT. */
+ float* tone_map_lut; /*!< Tone Mapping Gain LUT. Range [0.0 FLT_MAX] */
+ unsigned int tone_map_lut_size; /*!< Number of elements in tone mapping LUT. */
+} ia_aiq_gbce_results;
+
+/*!
+ * \brief Values used in various operations for each color channels.
+ * Value range depends on algorithm output.
+ */
+typedef struct
+{
+ float gr; /*!< A value affecting Gr color channel. */
+ float r; /*!< A value affecting R color channel. */
+ float b; /*!< A value affecting B color channel. */
+ float gb; /*!< A value affecting Gb color channel. */
+} ia_aiq_color_channels;
+
+/*!
+ * \brief LUTs for each color channel.
+ */
+typedef struct
+{
+ float *gr; /*!< LUT for Gr color channel. Range [0.0, 1.0].*/
+ float *r; /*!< LUT for R color channel. Range [0.0, 1.0]. */
+ float *b; /*!< LUT for B color channel. Range [0.0, 1.0]. */
+ float *gb; /*!< LUT for Gb color channel. Range [0.0, 1.0]. */
+ unsigned int size; /*!< Number of elements in each LUT. */
+} ia_aiq_color_channels_lut;
+
+/*!
+ * \brief Shading Adaptor light source weight and its type.
+ */
+typedef struct {
+ float weight;
+ cmc_light_source source_type;
+} light_source_t;
+
+/*!
+* \brief Advanced Color Correction Matrix Structure Returned by Parameter Adaptor.
+*/
+typedef struct {
+ unsigned int sector_count; /*!< Number of color matrix sectors. */
+ unsigned int *hue_of_sectors; /*!< Starting hues of sectors. */
+ float (*advanced_color_conversion_matrices)[3][3]; /*!< Advanced CC matrices. Array of color matrices. Each color matrix optimized using a certain sector. Array size is sector_count*/
+}
+ia_aiq_advanced_ccm_t;
+
+
+
+/*!
+* \brief IR Weight Grid.
+*/
+typedef struct {
+ unsigned int width; /*!< IR Weight grid width */
+ unsigned int height; /*!< IR Weight grid height */
+ unsigned short *ir_weight_grid_R; /*!< Interpolated IR Weight for R channel */
+ unsigned short *ir_weight_grid_G; /*!< Interpolated IR Weight for G channel */
+ unsigned short *ir_weight_grid_B; /*!< Interpolated IR Weight for B channel */
+}
+ia_aiq_ir_weight_t;
+
+/*!
+ * \brief Shading Adaptor results.
+ */
+typedef struct {
+ float *channel_gr; /*!< Pointer to the LSC table for Gr color channel. */
+ float *channel_r; /*!< Pointer to the LSC table for R color channel. */
+ float *channel_b; /*!< Pointer to the LSC table for B color channel. */
+ float *channel_gb; /*!< Pointer to the LSC table for Gb color channel. */
+ unsigned short width; /*!< Width of LSC table. */
+ unsigned short height; /*!< Height of LSC table. */
+ bool lsc_update; /*!< Indicates if LSC table has been modified and shall be updated in ISP. false - no change, true - new LSC. */
+ light_source_t light_source[CMC_NUM_LIGHTSOURCES];/*!< Weights per light source type used in calculation of the LSC tables. */
+ float scene_difficulty; /*!< Weighted cumulative confidence within selected patches (normalized against num_patches). */
+ unsigned short num_patches; /*!< Number of patches that were used to make decision. */
+ float covered_area; /*!< Statistics area covered by selected patches (%). */
+ ia_aiq_frame_params frame_params; /*!< Frame parameters that describe cropped area size and its position under LSC grid. */
+} ia_aiq_sa_results; /* ia_aiq_sa_results owns lsc_grid */
+
+/*!
+ * \brief Results from Parameter Adaptor.
+ */
+typedef struct {
+ float color_conversion_matrix[MAX_COLOR_CONVERSION_MATRIX][MAX_COLOR_CONVERSION_MATRIX]; /*!< CC matrix. */
+ ia_aiq_color_channels black_level; /*!< Black level coefficients of each Bayer channel (absolute level). */
+ ia_aiq_color_channels color_gains; /*!< RGB gains for each color channels including given (in ia_aiq_pa_input_params) color gains and gains calculated from AWB results. */
+ ia_aiq_color_channels_lut linearization; /*!< LUTs for linearization of each color channel after black level correction. */
+ float saturation_factor; /*!< Saturation factor to increase/decrease saturation.*/
+ float brightness_level; /*!< Range [0.0, 1.0]. Indicates level of brightness in the image. */
+ ia_aiq_advanced_ccm_t *preferred_acm; /*!< Advanced CC matrix. */
+ ia_aiq_ir_weight_t *ir_weight; /*!< IR Weight. */
+} ia_aiq_pa_results;
+
+/*!
+ * \brief Autofocus bracketing results
+ */
+typedef struct
+{
+ unsigned short *distances_bracketing; /*!< Ordered array of distances in mm for focus bracketing. Distances are ordered from Infinity to close up.*/
+ int *lens_positions_bracketing; /*!< Ordered array of lens positions for focus bracketing. Order is from FAR and to NEAR end. */
+} ia_aiq_af_bracket_results;
+
+/*!
+ * \brief Accelerometer Events
+ * Gravity Events
+ * Gyroscope Events
+ */
+typedef struct
+{
+ unsigned long long ts; /*!< Time stamp in usec (microseconds) */
+ float x; /*!< Sensor Data in X direction depending on the type of the sensor */
+ float y; /*!< Sensor Data in Y direction depending on the type of the sensor */
+ float z; /*!< Sensor Data in Z direction depending on the type of the sensor */
+ float sensitivity; /*!< Sensitivity of the sensor */
+ unsigned long long fs; /*!< Frame stamp in usec (microseconds) */
+} ia_aiq_sensor_data;
+
+
+/* TODO: Update the structure according to the API */
+/*!
+ * \brief Ambient Light EventsLIGHT_AMBIENTLIGHT
+ * NOTE: This should always match to libsensorhub API
+ */
+typedef struct
+{
+ unsigned long long ts; /*!< Time stamp in usec (microseconds) */
+ float data; /*!< Ambient Light data ? */
+ float sensitivity; /*!< Sensitivity of Ambient Light sensor */
+ unsigned long long fs; /*!< Frame stamp in usec (microseconds) */
+} ia_aiq_ambient_light_events;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_AIQ_TYPES_H_ */
+
+
diff --git a/include/ia_imaging/ia_cmc_parser.h b/include/ia_imaging/ia_cmc_parser.h
new file mode 100644
index 0000000..944fe49
--- /dev/null
+++ b/include/ia_imaging/ia_cmc_parser.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_cmc_parser.h
+ * \brief Parser for CMC data.
+*/
+
+
+#ifndef IA_CMC_PARSER_H_
+#define IA_CMC_PARSER_H_
+
+#include "ia_types.h"
+#include "ia_cmc_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBEXPORT ia_cmc_t*
+ia_cmc_parser_init(const ia_binary_data *aiqb_binary);
+
+LIBEXPORT void
+ia_cmc_parser_deinit(ia_cmc_t *ia_cmc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IA_CMC_PARSER_H_ */
diff --git a/include/ia_imaging/ia_cmc_types.h b/include/ia_imaging/ia_cmc_types.h
new file mode 100644
index 0000000..d367457
--- /dev/null
+++ b/include/ia_imaging/ia_cmc_types.h
@@ -0,0 +1,1069 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_cmc_types.h
+ * \brief Definitions of Camera Module Characterization (CMC) records.
+*/
+
+#ifndef IA_CMC_TYPES_H_
+#define IA_CMC_TYPES_H_
+
+#include "ia_mkn_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* All CMC records are inside AIQB record in CPFF file. */
+#define AIQB_TAG IA_MKN_CHTOUL('A','I','Q','B') /*!< AIQ configuration block tag. */
+
+/*
+ * Color Channels (1-4) refer to Raw Bayer quad in the following order.
+ * -------------
+ * | CC1 | CC2 |
+ * -------------
+ * | CC3 | CC4 |
+ * -------------
+ *
+ * Structures defined in this header file, which are stored into memory/file must start from 64 bit boundary (for 64 bit systems).
+ * Keep in mind also structures' internal padding when defining new structures.
+ */
+#define CMC_NUM_CHANNELS 4
+
+typedef struct
+{
+ uint16_t cc1;
+ uint16_t cc2;
+ uint16_t cc3;
+ uint16_t cc4;
+} cmc_color_channels;
+
+/*!
+ * \brief CIE x and Y coordinates.
+ */
+typedef struct
+{
+ uint16_t x;
+ uint16_t y;
+} cie_coords_t;
+
+/*!
+ * \brief R/G and B/G ratios.
+ */
+typedef struct
+{
+ uint16_t r_per_g;
+ uint16_t b_per_g;
+} chromaticity_t;
+
+/*!
+ * \brief Physical pixel coordinates.
+ */
+typedef struct
+{
+ uint16_t x;
+ uint16_t y;
+} cmc_coords;
+
+/*!
+ * \brief Chromaticity coordinates in CIE 1931 space.
+ */
+typedef struct
+{
+ float x;
+ float y;
+} cmc_cie_coords;
+
+/*!
+ * \brief Chromaticity coordinates in R/G & B/G space.
+ */
+typedef struct
+{
+ float r_per_g;
+ float b_per_g;
+} cmc_chromaticity;
+
+/*!
+* \brief 3x3 color matrix.
+*/
+typedef struct
+{
+ float matrix[3][3]; /*!< 3x3 accurate CCM, each consequtive elements sum to 1. */
+} cmc_color_matrix;
+
+/*!
+ * \brief Raw image bayer order.
+ */
+typedef enum
+{
+ cmc_bayer_order_grbg = 0, /*!< First row contains pixels Gr, R. Second row contains pixels B, Gb. */
+ cmc_bayer_order_rggb = 1, /*!< First row contains pixels R, Gr. Second row contains pixels Gb, B. */
+ cmc_bayer_order_bggr = 2, /*!< First row contains pixels B, Gb. Second row contains pixels Gr, R. */
+ cmc_bayer_order_gbrg = 3, /*!< First row contains pixels Gb, B. Second row contains pixels R, Gr. */
+} cmc_bayer_order;
+
+/*!
+ * \brief CMC names used in the record headers.
+ */
+typedef enum
+{
+ cmc_name_id_reserved = 0, /*!< 00 */
+ cmc_name_id_comment, /*!< 01 */
+ cmc_name_id_general_data, /*!< 02 */
+ cmc_name_id_black_level, /*!< 03 */
+ cmc_name_id_black_level_spatial, /*!< 04 */
+ cmc_name_id_saturation_level, /*!< 05 */
+ cmc_name_id_dynamic_range_and_linearity, /*!< 06 */
+ cmc_name_id_module_sensitivity, /*!< 07 */
+ cmc_name_id_defect_pixels, /*!< 08 */
+ cmc_name_id_noise, /*!< 09 */
+ cmc_name_id_lens_shading_correction, /*!< 10 */
+ cmc_name_id_lens_shading_correction_ratio, /*!< 11 */
+ cmc_name_id_geometric_distortion_correction, /*!< 12 */
+ cmc_name_id_optics_and_mechanics, /*!< 13 */
+ cmc_name_id_module_spectral_response, /*!< 14 */
+ cmc_name_id_chromaticity_response, /*!< 15 */
+ cmc_name_id_flash_chromaticity, /*!< 16 */
+ cmc_name_id_nvm_info, /*!< 17 */
+ cmc_name_id_color_matrices, /*!< 18 */
+ cmc_name_id_analog_gain_conversion, /*!< 19 */
+ cmc_name_id_digital_gain, /*!< 20 */
+ cmc_name_id_sensor_metadata, /*!< 21 */
+ cmc_name_id_geometric_distortion_correction2, /*!< 22 */
+ cmc_name_id_exposure_range, /*!< 23 */
+ cmc_name_id_multi_led_flash_chromaticity, /*!< 24 */
+ cmc_name_id_advanced_color_matrices, /*!< 25 */
+ cmc_name_id_hdr, /*!< 26 */
+ cmc_name_id_infrared_correction, /*!< 27 */
+ cmc_name_id_lens_shading_correction_4x4, /*!< 28 */
+ cmc_name_id_lateral_chromatic_aberration_correction /*!< 29 */
+} cmc_name_id;
+
+/*!
+ * \brief Camera features flags (see cmc_optomechanics_t.camera_features).
+ * Bit '1' means that the feature is presented.
+ */
+typedef enum {
+ cmc_camera_feature_lens_position_sensor = 1, /*!< Physical Lens Position sensor */
+ cmc_camera_feature_voice_coil_actuator = (1 << 1), /*!< 'Voice Coil' type of lens actuator */
+ cmc_camera_feature_hybrid_voice_coil_actuator = (1 << 2), /*!< 'Hybrid Voice Coil' type of lens actuator */
+ cmc_camera_feature_piezo_actuator = (1 << 3), /*!< 'Piezo' type of lens actuator */
+ cmc_camera_feature_mems_actuator = (1 << 4), /*!< 'MEMS' type of lens actuator */
+ cmc_camera_feature_nd_filter = (1 << 5), /*!< Neutral Density filter */
+ cmc_camera_feature_mechanical_shutter = (1 << 6), /*!< Mechanical Shutter */
+ cmc_camera_feature_variable_apertures = (1 << 7), /*!< Variable Apertures */
+ cmc_camera_feature_optical_zoom = (1 << 8) /*!< Optical Zoom */
+} cmc_camera_feature;
+
+/*!
+ * \brief Camera module orientation
+ */
+typedef enum {
+ cmc_camera_orientation_down = 0, /*!< Camera module is pointing down */
+ cmc_camera_orientation_horizontally, /*!< Camera module is pointing horizontally */
+ cmc_camera_orientation_up /*!< Camera module is pointing up */
+} cmc_camera_orientation;
+
+/*!
+ * \brief LSC level enumeration.
+ */
+typedef enum {
+ cmc_lsc_force_first_grid = 0, /*!< Use always first LSC grid */
+ cmc_lsc_without_nvm, /*!< Use LSC adaptation without NVM */
+ cmc_lsc_with_nvm /*!< Use LSC adaptation with NVM */
+} cmc_lsc_level;
+
+/*!
+ * \brief Shading Adaptor Level enumeration.
+ */
+typedef enum {
+ cmc_sa_disable = 0, /*!< Do not apply shading tables (bypass LSC) */
+ cmc_sa_cct_based, /*!< Use CCT based LSC selection */
+ cmc_sa_adaptive, /*!< Use adaptive LSC selection */
+ cmc_sa_self_adjusting /*!< Use module variation correcting LSC */
+} cmc_sa_level;
+
+/*!
+ * \brief Light source enumeration
+ */
+typedef enum {
+ cmc_light_source_none = 0, /*!< Light source N/A */
+ cmc_light_source_a, /*!< Incandescent / Tungsten */
+ cmc_light_source_b, /*!< Obsolete. Direct sunlight at noon */
+ cmc_light_source_c, /*!< Obsolete. Average / north sky daylight */
+ cmc_light_source_d50, /*!< Horizon light. ICC profile PCS */
+ cmc_light_source_d55, /*!< Mid-morning / mid-afternoon daylight */
+ cmc_light_source_d65, /*!< Noon daylight. Television, sRGB color space */
+ cmc_light_source_d75, /*!< North sky daylight */
+ cmc_light_source_e, /*!< Equal energy */
+ cmc_light_source_f1, /*!< Daylight fluorescent */
+ cmc_light_source_f2, /*!< Cool white fluorescent */
+ cmc_light_source_f3, /*!< White fluorescent */
+ cmc_light_source_f4, /*!< Warm white fluorescent */
+ cmc_light_source_f5, /*!< Daylight fluorescent */
+ cmc_light_source_f6, /*!< Lite white fluorescent */
+ cmc_light_source_f7, /*!< D65 simulator, daylight simulator */
+ cmc_light_source_f8, /*!< D50 simulator, Sylvania F40 Design 50 */
+ cmc_light_source_f9, /*!< Cool white deluxe fluorescent */
+ cmc_light_source_f10, /*!< Philips TL85, Ultralume 50 */
+ cmc_light_source_f11, /*!< Philips TL84, Ultralume 40 */
+ cmc_light_source_f12 /*!< Philips TL83, Ultralume 30 */
+} cmc_light_source;
+#define CMC_NUM_LIGHTSOURCES 20
+
+/*!
+ * \brief CMC Comment
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt8 (See AIQB_DataID), Name ID: cmc_name_id_comment (See cmc_name_id). */
+ uint8_t project_id[16]; /*!< NULL terminated Project ID string. Date format: yymmddHHMMSSFFF. For example: 1202201823444. */
+/* uint8_t comment[]; / *!< Free C string text comment (NULL terminated). Must end at 64 bit alignment. * / */
+} cmc_comment_t;
+#define SIZEOF_CMC_COMMENT_T 24
+
+/*!
+ * \brief CMC General Data
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Uint16 (See AIQB_DataID) Name ID: cmc_name_id_general_data. (enum cmc_name_id). */
+ uint16_t width; /*!< Sensor native maximum width. */
+ uint16_t height; /*!< Sensor native maximum height. */
+ uint16_t bit_depth; /*!< Sensor native maximum bit depth (after sensor linearization). */
+ uint16_t color_order; /*!< Sensor color order in native orientation. */
+ uint16_t bit_depth_packed; /*!< Sensor native maximum bit depth (before sensor linearization = packed) . */
+ uint8_t sve_pattern[16]; /*!< 4x4 pixel pattern. 0 means shortest exposure time and n the longest. */
+} cmc_general_data_t;
+#define SIZEOF_CMC_GENERAL_DATA_V100_T 16
+#define SIZEOF_CMC_GENERAL_DATA_V101_T 18
+#define SIZEOF_CMC_GENERAL_DATA_V102_T 34
+
+/*!
+ * \brief CMC Black Level
+ * - Global black level compensation.
+ */
+typedef struct
+{
+ uint32_t exposure_time; /*!< Exposure time. */
+ uint32_t analog_gain; /*!< Analog gain. */
+ cmc_color_channels color_channels; /*!< Color channel correction for given exposure time and analog gain. */
+} cmc_black_level_lut_t;
+#define SIZEOF_CMC_BLACK_LEVEL_LUT_T 16
+
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Custom (See AIQB_DataID) Name ID: cmc_name_id_black_level. (enum cmc_name_id). */
+ uint32_t num_bl_luts; /*!< Number of black level lookup tables (number of analog gain * number of exposures). */
+/* cmc_black_level_lut_t bl_luts[]; / *!< Lookup tables for black level correction. * / */
+} cmc_black_level_t;
+#define SIZEOF_CMC_BLACK_LEVEL_T 12
+
+/*!
+ * \brief CMC Saturation Level
+ * - Defined for each color channels.
+ * - Absolute pixel values using native max bit depth.
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID) Name ID: cmc_name_id_saturation_level. (enum cmc_name_id). */
+ uint16_t saturation_cc1; /*!< Saturation level of 1st color channel. */
+ uint16_t saturation_cc2; /*!< Saturation level of 2nd color channel. */
+ uint16_t saturation_cc3; /*!< Saturation level of 3rd color channel. */
+ uint16_t saturation_cc4; /*!< Saturation level of 4th color channel. */
+} cmc_saturation_level_t;
+#define SIZEOF_CMC_SATURATION_LEVEL_T 16
+
+/*!
+ * \brief CMC Pixel Dynamic Range And Linearity
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Custom (See AIQB_DataID) Name ID: cmc_name_id_dynamic_range_and_linearity. (enum cmc_name_id). */
+ uint32_t dynamic_range; /*!< Pixel dynamic range in dB. */
+ uint8_t num_linearity_cc1; /*!< Number of points in color channel 1 linearity lookup table. */
+ uint8_t num_linearity_cc2; /*!< Number of points in color channel 2 linearity lookup table. */
+ uint8_t num_linearity_cc3; /*!< Number of points in color channel 3 linearity lookup table. */
+ uint8_t num_linearity_cc4; /*!< Number of points in color channel 4 linearity lookup table. */
+/* uint16_t lut_linearities[]; / *!< Linearity lookup table for color channels in order: Ch1, Ch2, Ch3 and Ch4. * / */
+} cmc_linearity_t;
+#define SIZEOF_CMC_LINEARITY_T 16
+
+/*!
+ * \brief CMC Module Sensitivity
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_module_sensitivity (See cmc_name_id). */
+ uint16_t base_iso; /*!< Base ISO value of the camera module. */
+} cmc_sensitivity_t;
+#define SIZEOF_CMC_SENSITIVITY_T 10
+
+/*!
+ * \brief CMC Defect Pixels
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: ??? (See AIQB_DataID), Name ID: cmc_name_id_defect_pixels (See cmc_name_id). */
+ uint16_t not_defined; /*!< */
+} cmc_defect_pixel_t;
+#define SIZEOF_CMC_DEFECT_PIXEL_T 10
+
+/*!
+ * \brief CMC Noise
+ * - signal dependent and signal independent noise models.
+ * - Parametric model (a and b); variance as a function of relative pixel intensity.
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Float (See AIQB_DataID), Name ID: cmc_name_id_noise (See cmc_name_id). */
+ float noise_model_a[2]; /*!< Linear signal dependent noise model. */
+ float noise_model_b[3]; /*!< Quadratic signal independent noise model. */
+} cmc_noise_t;
+#define SIZEOF_CMC_NOISE_T 28
+
+typedef struct
+{
+ uint16_t source_type; /*!< Light source type (enum), e.g. Fluorescent. */
+ uint16_t correction_level; /*!< Luminance correction level. */
+ cie_coords_t cie_coords; /*!< CIE x and y coordinates. */
+/* uint16_t lsc_grid[]; / *!< LSC Grid. * / */
+} cmc_lsc_grid_t;
+#define SIZEOF_CMC_LSC_GRID_T 8
+
+/*!
+ * \brief CMC_Lens Shading Correction
+ * - Full native FOV
+ * - Absolute gain values
+ * - 100% color shading correction
+ * - x% grid "divided by" NVM_calibration_grid (=ratio) - if no NVM use ones
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Custom (See AIQB_DataID), Name ID: cmc_name_id_lens_shading_correction (See cmc_name_id). */
+ uint16_t lsc_level; /*!< LSC level enumeration. */
+ uint16_t num_grids; /*!< Number of LSC grids. */
+ uint16_t grid_width; /*!< LSC Grid width. */
+ uint16_t grid_height; /*!< LSC Grid height. */
+/* cmc_lsc_grid_t lsc_grids[]; / *!< LSC grids. * / */
+} cmc_lens_shading_t;
+#define SIZEOF_CMC_LENS_SHADING_T 16
+
+typedef struct
+{
+ uint16_t pair_index; /*!< Calibration light source pair index. */
+ uint16_t source_type; /*!< Light source type (enum), e.g. Fluorescent. */
+ uint16_t correction_level; /*!< Luminance correction level. */
+ cie_coords_t cie_coords; /*!< CIE x and y coordinates. */
+/* uint16_t lsc_grid[]; / *!< LSC Grid. * / */
+} cmc_lsc_ratio_grid_t;
+#define SIZEOF_CMC_LSC_RATIO_GRID_T 10
+
+/*!
+ * \brief Lens Shading Correction Ratio
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Custom (See AIQB_DataID), Name ID: cmc_name_id_lens_shading_correction_ratio (See cmc_name_id). */
+ uint16_t num_grids; /*!< Number of LSC grids. */
+ uint16_t grid_width; /*!< LSC Grid width. */
+ uint16_t grid_height; /*!< LSC Grid height. */
+/* cmc_lsc_ratio_grid_t lsc_grids[]; / *!< LSC grids. * / */
+} cmc_lens_shading_ratio_t;
+#define SIZEOF_CMC_LENS_SHADING_RATIO_T 14
+
+/*!
+ * \brief CMC Geometric Distortion Correction
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Float (See AIQB_DataID), Name ID: cmc_name_id_geometric_distortion_correction (See cmc_name_id). */
+ float gdck1; /*!< 1st order radial distortion coefficient. */
+ float gdck2; /*!< 2nd order radial distortion coefficient. */
+ float gdck3; /*!< 3rd order radial distortion coefficient. */
+ float gdcp1; /*!< 1st order tangential distortion coefficient. */
+ float gdcp2; /*!< 2nd order tangential distortion coefficient. */
+} cmc_geometric_distortion_t;
+#define SIZEOF_CMC_GEOMETRIC_DISTORTION_T 28
+
+/*!
+ * \brief CMC Optics and Mechanics
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_optics_and_mechanics (See cmc_name_id). */
+ uint8_t actuator; /*!< Actuator type (enum). */
+ uint8_t camera_module_orientation; /*!< Camera module orientation during the AF calibration (enum from Camera Module Orientation). */
+ uint16_t camera_actuator_features; /*!< Camera features list (flags from cmc_camera_feature enumeration). */
+ uint16_t nd_gain; /*!< Neutral density filter gain. */
+ uint16_t effect_focal_length; /*!< Effective Focal Length, (mm * 100). */
+ uint16_t sensor_pix_size_v; /*!< Sensor pixel size Vertical, (um * 100). */
+ uint16_t sensor_pix_size_h; /*!< Sensor pixel size Horizontal, (um * 100). */
+ uint16_t sensor_width_pix_total; /*!< Sensor width in pixels, total. */
+ uint16_t sensor_height_pix_total; /*!< Sensor height in pixels, total. */
+ uint16_t lens_offset_up_to_horz; /*!< Lens displacement when module turns from Up to Horizontal, (um). */
+ uint16_t lens_offset_horz_to_down; /*!< Lens displacement when module turns from Horizontal to Down, (um). */
+ uint16_t range_inf_to_85mm; /*!< Optical range 'Inf - 8.5 cm', (um). */
+ uint16_t range_inf_to_100mm; /*!< Optical range 'Inf - 10 cm', (um). */
+ uint16_t range_inf_to_300mm; /*!< Optical range 'Inf - 30 cm', (um). */
+ uint16_t range_inf_to_500mm; /*!< Optical range 'Inf - 50 cm', (um). */
+ uint16_t range_inf_to_950mm; /*!< Optical range 'Inf - 95 cm', (um). */
+ uint16_t range_inf_to_1200mm; /*!< Optical range 'Inf - 120 cm', (um). */
+ uint16_t range_inf_to_hyperfocal; /*!< Optical range 'Inf - Hyperfocal', (um). */
+ uint16_t range_inf_to_calibration_distance_far; /*!< Optical range 'Inf - calibration distance far', (um). */
+ uint16_t range_inf_to_calibration_distance_near; /*!< Optical range 'Inf - calibration_distance_near', (um). */
+ uint16_t range_inf_to_min_focusing_distance; /*!< Optical range 'Inf - calibration_distance_near', (um). */
+ uint16_t calibration_distance_far; /*!< Distance to supplier's FAR production calibration target, (cm). */
+ uint16_t calibration_distance_near; /*!< Distance to supplier's NEAR production calibration target, (cm). */
+ int16_t calibration_position_far; /*!< Supplier's FAR production calibration target in ACTUATOR UNITS, default (used in case NVM is not available).*/
+ int16_t calibration_position_near; /*!< Supplier's NEAR production calibration target in ACTUATOR UNITS, default (used in case NVM is not available).*/
+ int32_t lens_range_limit; /*!< Maximum available value for the lens actuator. */
+ int32_t lens_actuator_offset; /*!< Permanent offset to lens actuator values. */
+ uint32_t lens_movement_time; /*!< Time (in us) needed to move the lens per single VC unit (if linear_lens_movement_time is 1). Total time needed per one lens move (if linear_lens_movement_time is 0)*/
+ uint16_t min_focus_distance; /*!< Minimum focusing distance, (cm). */
+ uint16_t num_apertures; /*!< Actual number of apertures, presented in camera. */
+} cmc_optomechanics_t;
+#define SIZEOF_CMC_OPTOMECHANICS 72
+
+/*!
+ * \brief CMC Module Spectral Response
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_module_spectral_response (See cmc_name_id). */
+ uint16_t min_wavelength; /*!< Minimum wave length. */
+ uint16_t max_wavelength; /*!< Maximum wave length. */
+ uint16_t wavelength_sampling_rate; /*!< Wave length sampling rate. */
+/* cmc_color_channels spectral_response[]; / *!< Module spectral response in order: Ch1,Ch2,Ch3 and Ch4. * / */
+} cmc_spectral_response_t;
+#define SIZEOF_CMC_SPECTRAL_RESPONSE 14
+
+/*!
+ * \brief Lightsource definition.
+ */
+typedef struct
+{
+ cie_coords_t cie_coords; /*!< Light source CIE xy coordinates. */
+ chromaticity_t chromaticity_response; /*!< Avg Chromaticity response for R/G anf B/G.*/
+} cmc_lightsource_t;
+#define SIZEOF_CMC_LIGHTSOURCE_T 8
+
+/*!
+ * \brief CMC Chromaticity Response
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_chromaticity_response (See cmc_name_id). */
+ uint16_t num_lightsources; /*!< Number of avg light sources. */
+ uint16_t num_nvm_lightsources; /*!< Number of nvm light sources. */
+/* cmc_lightsource_t lightsources[]; / *!< Lightsources in the order: avg, high and low. * / */
+} cmc_chromaticity_response_t;
+#define SIZEOF_CMC_CHROMATICITY_RESPONSE 12
+
+/*!
+ * \brief Flash chromaticity responses for a point.
+ */
+typedef struct
+{
+ chromaticity_t flash_chromaticity_response; /*!< Flash Chromaticity response, R/G and B/G */
+} cmc_poly_point_t;
+#define SIZEOF_CMC_POLY_POINT_T 4
+
+/*!
+ * \brief CMC Flash Chromaticity
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_flash_chromaticity (See cmc_name_id). */
+ chromaticity_t flash_avg_chromaticity; /*!< Flash chromaticity in R/G, B/G plane. */
+ uint16_t num_poly_points; /*!< Number of points defining polygon. */
+/* cmc_poly_point_t poly_point[]; / *!< Flash Chromaticity Deviation in R/G, B/G plane. * / */
+} cmc_flash_chromaticity_t;
+#define SIZEOF_CMC_FLASH_CHROMATICITY_T 14
+
+typedef struct
+{
+ cmc_light_source light_src_type; /*!< Light-source type. See enum cmc_light_source. */
+ chromaticity_t chromaticity; /*!< Chromaticity (sensor) in R/G, B/G plane. */
+ cie_coords_t cie_coords; /*!< CIE x and y coordinates. */
+ int32_t matrix_accurate[9]; /*!< 3x3 accurate CCM, each 3 consequtive elemets sum to 1. */
+ int32_t matrix_preferred[9]; /*!< 3x3 preferred CCM, each 3 consequtive elemets sum to 1. */
+} cmc_color_matrix_t;
+#define SIZEOF_CMC_COLOR_MATRIX_T 84
+
+/*!
+ * \brief CMC Color matrices
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_color_matrices (See cmc_name_id). */
+ uint16_t num_matrices; /*!< Number of color matrices. */
+/* cmc_color_matrix_t color_matrices[]; / *!< Color matrices. * / */
+} cmc_color_matrices_t;
+#define SIZEOF_CMC_COLOR_MATRICES_T 10
+/*!
+ * \brief CMC NVM Info
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_nvm_info (See cmc_name_id). */
+ uint16_t nvm_parser_version; /*!< Parser version for current camera module type */
+ uint16_t nvm_data_color_order; /*!< NVM data color order */
+ uint16_t nvm_data_orientation; /*!< NVM data orientation */
+} cmc_nvm_info_t;
+#define SIZEOF_CMC_NVM_INFO_T 14
+
+/*!
+ * \brief CMC NVM Info v101
+ */
+typedef struct
+{
+ uint16_t nvm_scaling_method; /*!< NVM table scaling method. */
+} cmc_nvm_info_v101_t;
+#define SIZEOF_CMC_NVM_INFO_V101_T 2
+
+typedef struct
+{
+ cmc_nvm_info_t *cmc_nvm_info; /*!< CMC NVM info data. */
+ cmc_nvm_info_v101_t *cmc_nvm_info_v101; /*!< CMC NVM info data v101. */
+} cmc_parsed_nvm_info_t;
+
+/*!
+ * \brief Analog gain to gain code mapping.
+ * Gains must be defined in ascending order.
+ */
+typedef struct
+{
+ uint32_t gain; /*!< Gain in fixed point format (16bit integer part + 16bit fraction part). */
+ uint32_t code; /*!< Code corresponding to gain. */
+} cmc_analog_gain_pair_t;
+#define SIZEOF_CMC_ANALOG_GAIN_PAIR_T 8
+
+/*!
+ * \brief Analog gain to gain code mapping of a segment.
+ * Segments contain SMIA analog gain parameters. When ranges is defined, beginning is always inclusive and end exclusive.
+ * For example analog gain 2.0 and ranges: [1.0, 2.0[; [2.0, 4.0[;. Analog gain 2.0 is not calculated from the first range parameters but from the second range.
+ */
+typedef struct
+{
+ uint32_t gain_begin; /*!< Begin of gain of the segment (inclusive) in fixed point format (16bit integer part + 16bit fraction part). */
+ uint32_t gain_end; /*!< End of gain of the segment (exclusive) in fixed point format (16bit integer part + 16bit fraction part). */
+ uint32_t code_min; /*!< The minimum recommended setting for the analog gain control. */
+ uint32_t code_max; /*!< The maximum recommended setting for the analog gain control. */
+ uint32_t code_step; /*!< The precision of the analog gain control. */
+ int16_t M0; /*!< Gain code M0 as in SMIA. */
+ int16_t C0; /*!< Gain code C0 as in SMIA. */
+ int16_t M1; /*!< Gain code M1 as in SMIA. */
+ int16_t C1; /*!< Gain code C1 as in SMIA. */
+} cmc_analog_gain_segment_t;
+#define SIZEOF_CMC_ANALOG_GAIN_SEGMENT_T 28
+
+/*!
+ * \brief CMC Analog gain conversion types
+ * Enum definses different analog gain conversion types.
+ */
+typedef enum
+{
+ cmc_analog_gain_conversion_type_none, /*!< No analog gain conversion should be done. */
+ cmc_analog_gain_conversion_type_segment, /*!< Segments contain SMIA compatible parameters for calculating register value for a certain range of analog gain. */
+ cmc_analog_gain_conversion_type_pair, /*!< Pairs contain analog gain value & corresponding register value. */
+} cmc_analog_gain_conversion_type_t;
+
+/*!
+ * \brief CMC Analog gain conversion table
+ * Analog gain can be represented with n amount of gain code (register value) pairs/segments.
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_analog_gain_conversion (See cmc_name_id). */
+ uint16_t conversion_type; /*!< Analog gain conversion type. See cmc_analog_gain_conversion_type_t. */
+ uint16_t reserved; /*!< Reserved due to byte alignment. */
+ uint16_t num_segments; /*!< Number of gain/code segments which describe the analog gain. */
+ uint16_t num_pairs; /*!< Number of gain/code pairs which describe the analog gain. */
+/* cmc_analog_gain_segment_t gain_segments[]; */
+/* cmc_analog_gain_pair_t gain_pairs[]; */
+} cmc_analog_gain_conversion_t;
+#define SIZEOF_CMC_ANALOG_GAIN_CONVERSION_T 16
+
+/*!
+ * \brief CMC Digital gain conversion types
+ * Enum definses different digital gain conversion types.
+ */
+typedef enum
+{
+ cmc_digital_gain_conversion_type_fixed_point, /*!< Digital gain is defined in fixed point format. */
+ cmc_digital_gain_conversion_type_pair, /*!< Pairs contain digital gain value & corresponding register value. */
+} cmc_digital_gain_conversion_type_t;
+
+/*!
+ * \brief CMC digital gain limits and step.
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_digital_gain (See cmc_name_id). */
+ uint16_t digital_gain_min; /*!< The minimum valid limit of the digital gain control parameters in fixed point format (16bit integer part + 16bit fraction part). */
+ uint16_t digital_gain_max; /*!< The maximum valid limit of the digital gain control parameters in fixed point format (16bit integer part + 16bit fraction part). */
+ uint8_t digital_gain_step_size; /*!< Step size of digital gain code register value. */
+ uint8_t digital_gain_fraction_bits; /*!< Number of bits used for the fraction part of the 16 bit register value. */
+/* cmc_digital_gain_v102_t dg_v102; */
+/* cmc_analog_gain_pair_t dg_pairs[];*/
+} cmc_digital_gain_t;
+#define SIZEOF_CMC_DIGITAL_GAIN_T 14
+
+/*!
+ * \brief Defines additions to digital gain structure with gain/code pairs support.
+ */
+typedef struct
+{
+ uint16_t conversion_type; /*!< Digital gain conversion type. See cmc_digital_gain_conversion_type_t. */
+ uint16_t num_pairs; /*!< Number of gain/code pairs which describe the digital gain. */
+ uint16_t reserved; /*!< Not used at the moment. Reserved to ensure correct (32 bit) alignment. */
+} cmc_digital_gain_v102_t;
+#define SIZEOF_CMC_DIGITAL_GAIN_V102_T 6
+
+/*!
+ * \brief CMC geometric distortion correction (grid based)
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: CMC_GeometricDistortion2 (See cmc_name_id). */
+ int16_t GDC_col_start; /*!< Table X offset in pixels from left corner of the sensor maximum visible area e.g. If GDC_col_start=GDC_block_width*(-1)
+ then GDC table offset is is one block left compared to the maximum visible sensor area. */
+ int16_t GDC_row_start; /*!< Table Y offset in pixels from upper corner of the sensor maximum visible area e.g. If GDC_row_start=GDC_block_height*(-1)
+ then GDC table offset is is one block up compared to the maximum visible sensor area. */
+ int16_t GDC_grid_width; /*!< Indicates number of grid vertices on the horizontal axis. */
+ int16_t GDC_grid_height; /*!< Indicates number of grid vertices on the vertical axis. */
+ int16_t GDC_block_width; /*!< Average width of the grid cell in pixel count. */
+ int16_t GDC_block_height; /*!< Average height of the grid cell in pixel count. */
+ uint16_t nGrids; /*!< Number of LDC grids (focus positions). */
+} cmc_geometric_distortion2_t;
+#define SIZEOF_CMC_GEOMETRIC_DISTORTION2_T 22
+
+/*!
+ * \brief CMC geometric distortion correction grids
+ */
+typedef struct
+{
+ uint16_t focus_position; /*!< Focus motor position in terms of those used by the sensor module.
+ Range should be depicted from the cmc_name_id_optics_and_mechanics section in the CPFF.). */
+ int32_t *x_deltas; /*!< Table of x-axis deltas of the grid points. The delta at each point represents the distortion
+ that was done. Contains [GDC_grid_height x GDC_grid_width] values. */
+ int32_t *y_deltas; /*!< Table of y-axis deltas of the grid points. The delta at each point represents the distortion
+ that was done. Contains [GDC_grid_height x GDC_grid_width] values. */
+} cmc_geometric_distortion2_grid_t;
+#define SIZEOF_CMC_ANALOG_GAIN_PAIR_T 8
+
+/*!
+ * \brief CMC Sensor exposure registers ranges.
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_exposure_range (See cmc_name_id). */
+ uint32_t coarse_integration_min; /*!< Minimum sensor register value for coarse integration time. */
+ uint32_t coarse_integration_max; /*!< Maximum sensor register value for coarse integration time.*/
+ uint32_t fine_integration_min; /*!< Minimum sensor register value for fine integration time.*/
+ uint32_t fine_integration_max; /*!< Maximum sensor register value for fine integration time.*/
+} cmc_exposure_range_t;
+#define SIZEOF_CMC_EXPOSURE_RANGE_T 24
+
+/*!
+ * \brief CMC Multiple LED flash chromaticity.
+ */
+typedef struct
+{
+ uint16_t device_id; /*!< Flash device ID enumerator. */
+ uint16_t num_poly_points; /*!< Number of points defining polygon. */
+ chromaticity_t flash_avg_chromaticity; /*!< Flash chromaticity in R/G, B/G plane. */
+ cie_coords_t flash_avg_cie; /*!< Flash chromaticity in CIE X, CIE Y plane. */
+ uint16_t reserved[2]; /*!< Reserved for future changes. Always 0 (for now).. */
+ cmc_poly_point_t *poly_points; /*!< Flash Chromaticity Deviation in R/G, B/G plane. */
+} cmc_flash_device_t;
+#define SIZEOF_CMC_FLASH_DEVICE_T 16 /*!< Size of the structure without pointers. Used in copying data from CPF to this structure. */
+
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_multi_led_flash_chromaticity (See cmc_name_id). */
+ uint16_t max_flash_output; /*!< Flash maximum energy output for full power, lumen per second [lm/s] */
+ uint16_t multi_led_flash_mode; /*!< Reserved for future changes. Always 0 (for now). */
+ uint16_t reserved; /*!< Reserved for future changes. Always 0 (for now). */
+ uint16_t num_flash_devices; /*!< Number of flash devices/LEDs. */
+ cmc_flash_device_t *flash_devices; /*!< Data of all flash devices. */
+} cmc_multi_led_flash_t;
+#define SIZEOF_CMC_MULTI_LED_FLASH_T 16 /*!< Size of the structure without pointers. Used in copying data from CPF to this structure. */
+
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_sensor_metadata (See cmc_name_id). */
+ uint16_t total_num_of_cfg_blocks; /*!< Total number of config blocks (ia_emd_config_block_t). */
+ uint16_t total_num_of_data_blocks; /*!< Total number of decoded data blocks (ia_emd_decoded_block_t). */
+ uint8_t num_of_exposure_sets; /*!< Number of exposure sets in sensor embedded data. */
+ uint8_t num_of_color_channels; /*!< Number of color channels in sensor embedded data. */
+ uint8_t max_num_of_faces; /*!< Maximum number of faces in external ISP embedded data. */
+ uint8_t reserved; /*!< Reserved. */
+ /* ia_emd_config_block_t cfg_blocks[];*/ /*!< Configuration blocks array. */
+} cmc_emd_decoder_config_t;
+#define SIZEOF_CMC_EMD_DECODER_CONFIG_T 16 /*!< Size of cmc_emd_decoder_config_t without pointer. Used in copying data from CPF to this structure. */
+
+typedef struct
+{
+ cmc_comment_t *cmc_comment;
+ uint8_t *comment;
+} cmc_parsed_comment_t;
+
+typedef struct
+{
+ cmc_black_level_t *cmc_black_level;
+ cmc_black_level_lut_t *cmc_black_level_luts;
+} cmc_parsed_black_level_t;
+
+typedef struct
+{
+ cmc_linearity_t *cmc_linearity;
+ uint16_t *cmc_linearity_lut;
+} cmc_parsed_linearity_t;
+
+typedef struct
+{
+ cmc_lens_shading_t *cmc_lens_shading;
+ cmc_lsc_grid_t *cmc_lsc_grids;
+ uint16_t *lsc_grids;
+ chromaticity_t *cmc_lsc_rg_bg_ratios; /* Sensor R/G B/G ratios, available in
+ cmc_name_id_lens_shading_correction v101. */
+} cmc_parsed_lens_shading_t;
+
+typedef struct
+{
+ cmc_lens_shading_ratio_t *cmc_lens_shading_ratio;
+ cmc_lsc_ratio_grid_t *cmc_lsc_ratio_grids;
+ uint16_t *lsc_grids;
+} cmc_parsed_lens_shading_ratio_t;
+
+typedef enum
+{
+ cmc_aperture_type_fixed = 0, /*!< Aperture is fixed. */
+ cmc_aperture_type_dc_iris, /*!< Aperture is controlled by DC-iris. */
+ cmc_aperture_type_p_iris, /*!< Aperture is controlled by P-iris. */
+} cmc_aperture_type_t;
+
+typedef struct
+{
+ int16_t cmc_dac_min; /*!< Minimum value of the DA-converter (will close the iris). */
+ int16_t cmc_dac_hold; /*!< A value for DA-converter that will hold the iris ("barely open or barely close"). */
+ int16_t cmc_dac_max; /*!< Maximum value of the DA-converter (will open the iris). */
+} cmc_dc_iris_dac_t;
+
+typedef struct
+{
+ cmc_optomechanics_t *cmc_optomechanics;
+ uint16_t *lut_apertures;
+ uint16_t aperture_type; /*!< Aperture type control of type cmc_aperture_type_t, v101 and onwards. */
+ cmc_dc_iris_dac_t dc_iris_dac; /*!< DAC values for DC-iris, v102 and onwards. */
+} cmc_parsed_optics_t;
+
+typedef struct
+{
+ cmc_spectral_response_t *cmc_spectral_response;
+ cmc_color_channels *spectral_responses;
+} cmc_parsed_spectral_response_t;
+
+/*!
+ * \brief CMC Gamut.
+ */
+typedef struct
+{
+ uint16_t light_source; /*!< Light source type (0 if not known). */
+ uint16_t r_per_g; /*!< Gamut achromatic point R per G (white balance gains for given gamut).*/
+ uint16_t b_per_g; /*!< Gamut achromatic point R per G (white balance gains for given gamut).*/
+ uint16_t CIE_x; /*!< Illumination CIE x coordinate.*/
+ uint16_t CIE_y; /*!< Illumination CIE x coordinate.*/
+ uint16_t size; /*!< Size of the gamut tables.*/
+ uint16_t *gamut_r_per_g; /*!< Illumination gamut (convex hull). R per g points in clockwise order*/
+ uint16_t *gamut_b_per_g; /*!< Illumination gamut (convex hull). R per g points in clockwise order*/
+} cmc_gamut_t;
+#define SIZEOF_CMC_GAMUT_T 12
+
+typedef struct
+{
+ uint16_t num_illumination_gamuts; /*!< Number of illumination gamuts */
+ cmc_gamut_t *cmc_gamut;
+} cmc_chromaticity_response_v101_t;
+#define SIZEOF_CMC_CHROMATICITY_RESPONSE_V101 2
+
+typedef struct
+{
+ cmc_chromaticity_response_t *cmc_chromaticity_response;
+ cmc_chromaticity_response_v101_t *cmc_chromaticity_response_v101;
+ cmc_lightsource_t *cmc_lightsources_avg;
+ cmc_lightsource_t *cmc_lightsources_hi;
+ cmc_lightsource_t *cmc_lightsources_lo;
+ cmc_lightsource_t *cmc_lightsources_nvm;
+} cmc_parsed_chromaticity_response_t;
+
+typedef struct
+{
+ cmc_flash_chromaticity_t *cmc_flash_chromaticity;
+ cmc_poly_point_t *cmc_poly_points;
+} cmc_parsed_flash_chromaticity_t;
+
+typedef enum
+{
+ ccm_estimate_method_bypass, /*!< Return unity CCM matrix. */
+ ccm_estimate_method_wp, /*!< Return CCM matrix using only white point estimate from AWB. */
+ ccm_estimate_method_wp_sa, /*!< Return CCM matrix using both white point estimate from AWB and Shading Adaptor Results. */
+} ccm_estimate_method_t;
+
+typedef struct
+{
+ cmc_color_matrices_t *cmc_color_matrices;
+ cmc_color_matrix_t *cmc_color_matrix;
+ uint16_t *ccm_estimate_method; /*!< ccm_estimate_method for interpolation -> ccm_estimate_method_t */
+} cmc_parsed_color_matrices_t;
+
+typedef struct
+{
+ cmc_analog_gain_conversion_t *cmc_analog_gain_conversion;
+ cmc_analog_gain_segment_t *cmc_analog_gain_segments;
+ cmc_analog_gain_pair_t *cmc_analog_gain_pairs;
+} cmc_parsed_analog_gain_conversion_t;
+
+typedef struct
+{
+ cmc_digital_gain_t *cmc_digital_gain;
+ cmc_digital_gain_v102_t *cmc_digital_gain_v102;
+ cmc_analog_gain_pair_t *cmc_digital_gain_pairs;
+} cmc_parsed_digital_gain_t;
+
+typedef struct
+{
+ cmc_geometric_distortion2_t *geometric_distortion2;
+ cmc_geometric_distortion2_grid_t *gdc_grids;
+} cmc_parsed_geometric_distortion2_t;
+
+/*!
+ * \brief CMC advanced color matrix info
+ */
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: CMC_GeometricDistortion2 (See cmc_name_id). */
+ uint16_t light_sources_count; /*!< Number of light sources. */
+ uint16_t sector_count; /*!< Number of color matrix sectors. */
+} cmc_advanced_color_matrix_info_t;
+#define SIZEOF_CMC_ADVANCED_COLOR_MATRIX_INFO_T 12
+
+/*!
+ * \brief CMC color matrix
+ */
+typedef struct
+{
+ float color_matrix[9]; /*!< 3x3 accurate CCM, each consequtive elements sum to 1. */
+} cmc_acm_color_matrix_t;
+#define SIZEOF_CMC_ACM_COLOR_MATRIX_T 36
+
+/*!
+ * \brief CMC advanced color matrices info for light sources
+ */
+typedef struct
+{
+ uint32_t src_type; /*!< Light source type (enum), e.g. Fluorescent. */
+ float chromaticity[2]; /*!< Chromaticity (sensor) in R/G, B/G plane. */
+ float src_cie_xy[2]; /*!< CIE x and y coordinates. */
+} cmc_acm_color_matrices_info_t;
+#define SIZEOF_CMC_ACM_COLOR_MATRICES_INFO_T 20
+
+typedef struct
+{
+ cmc_acm_color_matrices_info_t *color_matrices_info; /*! < Information for Color matrices. */
+ cmc_acm_color_matrix_t traditional_color_matrix; /*! < Color matrix optimized using all sectors. */
+ cmc_acm_color_matrix_t *advanced_color_matrices; /*! < Array of color matrices. Array size is sector_count */
+} cmc_parsed_advanced_color_matrices_ls_t;
+
+typedef struct
+{
+ cmc_advanced_color_matrix_info_t *cmc_advanced_color_matrix_info;
+ uint32_t *hue_of_sectors; /*! < Starting hue angle array of sectors. Array size is sector_count. */
+ cmc_parsed_advanced_color_matrices_ls_t *cmc_parsed_advanced_color_matrices_ls; /*! < Array of color matrices
+ for different light sources.
+ Array size is light_sources_count. */
+} cmc_parsed_advanced_color_matrix_t;
+
+/*!
+* \brief CMC HDR Parameters
+*/
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Uint16 (See AIQB_DataID) Name ID: cmc_name_id_hdr. */
+ float hdr_exposure_ratio_min; /*!< Minimum HDR exposure ratio between different exposures. */
+ float hdr_exposure_ratio_max; /*!< Maximum HDR exposure ratio between different exposures. */
+}
+cmc_parsed_hdr_parameters_t;
+#define SIZEOF_CMC_HDR_T 16
+
+typedef enum
+{
+ ir_correction_level_bypass, /*!< Set PA IR Weight grid pointer as NULL. */
+ ir_correction_level_wp, /*!< Interpolate IR Weight grid using only white point estimate from AWB. */
+} ir_correction_level_t;
+
+/*!
+* \brief CMC IR Weight Grids Parameters
+*/
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: Uint16 (See AIQB_DataID) Name ID: cmc_name_id_hdr. */
+ int8_t grid_indices[16]; /*!< IR Weight grid indices showing which tables in the structure holds information. -1 means no correction for that pixel */
+ uint16_t num_light_sources; /*!< Number of light sources for which IR Weight Grids are characterized . */
+ uint16_t num_grids; /*!< Number of grids per light source. This depends on the CFA type and non -1 elements in . */
+ uint16_t grid_width; /*!< IR Weight Grid width. */
+ uint16_t grid_height; /*!< IR Weight Grid height. */
+}
+cmc_ir_weight_info_t;
+#define SIZEOF_CMC_IR_WEIGHT_INFO_T 32
+
+
+typedef struct
+{
+ cmc_light_source source_type; /*!< Light-source type. See enum cmc_light_source. */
+ float chromaticity[2]; /*!< Chromaticity (sensor) in R/G, B/G plane. */
+ float cie_coords[2]; /*!< CIE x and y coordinates. */
+} cmc_ir_weight_grid_info_t;
+#define SIZEOF_CMC_IR_WEIGHT_GRID_INFO_T 20
+
+typedef struct
+{
+ cmc_ir_weight_grid_info_t *ir_weight_grid_info; /*!< IR Weight Grid Info. */
+ uint16_t *ir_weight_grid; /*!< IR Weight Grids for all channels. */
+}
+cmc_ir_weight_grids_t;
+
+typedef struct
+{
+ cmc_ir_weight_info_t *ir_weight_info; /*!< IR Weight Info . */
+ cmc_ir_weight_grids_t *ir_weight_grids; /*!< IR Weight Grids. */
+}
+cmc_parsed_ir_weight_t;
+
+/* CMC structures with version ID >= v200 */
+
+typedef struct
+{
+ cmc_light_source source_type; /*!< Light source type (enum), e.g. Fluorescent. */
+ cmc_chromaticity chromaticity; /*!< Chromaticity (sensor) in R/G, B/G plane. */
+ cmc_cie_coords cie_coords; /*!< CIE x and y coordinates. */
+ cmc_color_matrix traditional; /*!< Color matrix optimized using all sectors. */
+ cmc_color_matrix *advanced; /*!< Array of color matrices (as defined by num_sectors). */
+} cmc_advanced_color_matrices;
+
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_advanced_color_matrices (See cmc_name_id). */
+ unsigned short num_light_srcs; /*!< Number of light sources. */
+ unsigned short num_sectors; /*!< Number of color matrix sectors. */
+ cmc_advanced_color_matrices *acms; /*!< Advanced color matrices for all light sources (as defined by num_light_srcs). */
+ unsigned int *hue_of_sectors; /*!< Starting hue angle array of sectors (as defined by num_sectors). */
+} cmc_advanced_color_matrix_correction;
+
+typedef struct
+{
+ cmc_light_source source_type; /*!< Light source type. */
+ float chromaticity_i_per_g; /*!< Sensor Ir/G ratio. */
+ cmc_chromaticity chromaticity; /*!< Sensor R/G B/G ratios. */
+ cmc_cie_coords cie_coords; /*!< CIE x and y coordinates. */
+ uint16_t *grids[4][4]; /*!< IR Grids for all color channels (as defined by grid_indices). */
+} cmc_ir_grid;
+
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_infrared_correction (See cmc_name_id). */
+ char grid_indices[4][4]; /*!< IR grid indices showing which tables in the structure holds information. -1 means no correction. */
+ unsigned short num_light_srcs; /*!< Number of light sources. */
+ unsigned short grid_width; /*!< IR Grid width. */
+ unsigned short grid_height; /*!< IR Grid height. */
+ cmc_ir_grid *ir_grids; /*!< IR grids for all light sources (as defined by num_light_srcs). */
+} cmc_infrared_correction;
+
+typedef struct
+{
+ cmc_light_source source_type; /*!< Light source type. */
+ float correction_level; /*!< Luminance correction level. */
+ cmc_chromaticity chromaticity; /*!< Sensor R/G B/G ratios. */
+ cmc_cie_coords cie_coords; /*!< CIE x and y coordinates. */
+ uint16_t *grids[4][4]; /*!< LSC Grids for all color channels (as defined by grid_indices). */
+} cmc_lsc_grid;
+
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_lens_shading_correction_4x4 (See cmc_name_id). */
+ char grid_indices[4][4]; /*!< LSC grid indices showing which tables in the structure holds information. -1 means no correction. */
+ unsigned short num_light_srcs; /*!< Number of light sources. */
+ unsigned short grid_width; /*!< LSC Grid width. */
+ unsigned short grid_height; /*!< LSC Grid height. */
+ cmc_lsc_grid *lsc_grids; /*!< LSC grids for all light sources (as defined by num_light_srcs). */
+} cmc_lens_shading_correction;
+
+typedef struct
+{
+ ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_lateral_chromatic_aberration_correction (See cmc_name_id). */
+ cmc_coords optical_center; /*!< Optical center distance from the left uppermost corner of the sensor (in native sensors resolution). This the location where no lateral chromatic aberration is present. [x, y]. */
+ uint16_t grid_width; /*!< Width of the grid. */
+ uint16_t grid_height; /*!< Height of the grid. */
+ uint16_t cell_size_x; /*!< X-dimension distance (in pixels) between the grid points (lca_grid_*). Guaranteed to be 2^n. This is always in respect to the maximum native sensor width defined in ID2 (General Data). All adaptations to other resolutions is done in the imaging system code in the device in the runtime.*/
+ uint16_t cell_size_y; /*!< Same as above but y-dimension */
+ float *lca_grid_red_x; /*!< Amount of absolute lateral chromatic aberration in horizontal direction in each of the grid locations for red pixels, in respect to the green pixel. The grid is evenly spaced over the native maximum sensor resolution and maximum field of view. 0 means no aberration, -x means shifted to left, +x mean shifted to right. Grid is aligned to the left uppermost corner of the maximum focal plane. This, as all other CMC tables, are in respect to the maximum native image sensor resolution. All adaptations to other resolutions is done in the imaging system code in the device in the runtime. */
+ float *lca_grid_red_y; /*!< Same as above but in vertical direction. */
+ float *lca_grid_blue_x; /*!< Same as above but for horizontal and blue pixel. */
+ float *lca_grid_blue_y; /*!< Same as above but in vertical direction. */
+} cmc_lateral_chromatic_aberration_correction;
+
+/*!
+ * \brief Parsed CMC structure.
+ * Parser will fill the pointers in this structure so that data can be accessed more easily.
+ */
+typedef struct
+{
+ cmc_parsed_comment_t cmc_parsed_comment; /* 0 */
+ cmc_general_data_t *cmc_general_data; /* 8 */
+ cmc_parsed_black_level_t cmc_parsed_black_level; /* 12 */
+ cmc_saturation_level_t *cmc_saturation_level; /* 20 */
+ cmc_parsed_linearity_t cmc_parsed_linearity; /* 24 */
+ cmc_sensitivity_t *cmc_sensitivity; /* 32 */
+ cmc_defect_pixel_t *cmc_defect_pixel; /* 36 */
+ cmc_noise_t *cmc_noise; /* 40 */
+ cmc_parsed_lens_shading_t cmc_parsed_lens_shading; /* 44 */
+ cmc_parsed_lens_shading_ratio_t cmc_parsed_lens_shading_ratio; /* 56 */
+ cmc_geometric_distortion_t *cmc_geometric_distortion; /* 68 */
+ cmc_parsed_optics_t cmc_parsed_optics; /* 72 */
+ cmc_parsed_spectral_response_t cmc_parsed_spectral_response; /* 80 */
+ cmc_parsed_chromaticity_response_t cmc_parsed_chromaticity_response; /* 88 */
+ cmc_parsed_flash_chromaticity_t cmc_parsed_flash_chromaticity; /* 108 */
+ cmc_parsed_nvm_info_t cmc_parsed_nvm_info; /* 114 */
+ cmc_parsed_color_matrices_t cmc_parsed_color_matrices; /* */
+ cmc_parsed_analog_gain_conversion_t cmc_parsed_analog_gain_conversion;
+ cmc_parsed_digital_gain_t cmc_parsed_digital_gain;
+ cmc_parsed_geometric_distortion2_t cmc_parsed_geometric_distortion2;
+ cmc_exposure_range_t *cmc_exposure_range;
+ cmc_multi_led_flash_t *cmc_multi_led_flashes;
+ cmc_emd_decoder_config_t *cmc_emd_decoder_config;
+ cmc_parsed_advanced_color_matrix_t cmc_parsed_advanced_color_matrix;
+ cmc_parsed_hdr_parameters_t *cmc_parsed_hdr_parameters;
+ cmc_parsed_ir_weight_t cmc_parsed_ir_weight;
+} ia_cmc_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IA_CMC_TYPES_H_ */
diff --git a/include/ia_imaging/ia_coordinate.h b/include/ia_imaging/ia_coordinate.h
new file mode 100644
index 0000000..fafa099
--- /dev/null
+++ b/include/ia_imaging/ia_coordinate.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_coordinate.h
+ * \brief Definitions of IA imaging coordinate system and conversion functions.
+ *
+ * IA Imaging algorithms use relative coordinate system where top left corner
+ * is (0,0) and bottom right corner is (8192,8192).
+ *
+ * Coordinate conversions can happen between arbitrary coordinate systems.
+ *
+ * Width and height of coordinate system must be > 0.
+ *
+ * Zoom factor is not considered in coordinate conversions but it should be
+ * calculated when defining the target coordinate system.
+ *
+ * For example:
+ *
+ * |-------------------------------------------|
+ * |(0,0) |
+ * | |
+ * | (1800,1700) |
+ * | |--------------| |
+ * | |(-100,-100) | |
+ * | | | |
+ * | | (100,100)| |
+ * | |--------------| |
+ * | (5500,4000) |
+ * | |
+ * | |
+ * | |
+ * | |
+ * | (8192,8192)|
+ * |-------------------------------------------|
+ *
+ *
+ * There is an algorithm which works on cropped area with own coordinate system A
+ * [(-100,100), (100.100)] inside another coordinate system B [(0,0), (8192,8192)].
+ *
+ * To convert results from coordinate system A to B, one must define source and target
+ * coordinate systems:
+ * Source system is coordinate system A.
+ * src_system: [(-100,100), (100.100)]
+ *
+ * Target system defines the cropped rectangle from inside coordinate system B.
+ * trg_system: [(1800,1700), (5500,4000)]
+ *
+ */
+
+
+#ifndef IA_COORDINATE_H_
+#define IA_COORDINATE_H_
+
+#include "ia_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! \brief Definitions of IA imaging coordinate system. */
+#define IA_COORDINATE_TOP 0
+#define IA_COORDINATE_LEFT 0
+#define IA_COORDINATE_BOTTOM 8192
+#define IA_COORDINATE_RIGHT 8192
+#define IA_COORDINATE_WIDTH (IA_COORDINATE_RIGHT-IA_COORDINATE_LEFT)
+#define IA_COORDINATE_HEIGHT (IA_COORDINATE_BOTTOM-IA_COORDINATE_TOP)
+
+/*!
+ * \brief Coordinate system.
+ * Defines the coordinate space boundaries.
+ */
+typedef struct
+{
+ long top; /*!< Top coordinate value in the coordinate system. */
+ long left; /*!< Left coordinate value in the coordinate system. */
+ long bottom; /*!< Bottom coordinate value in the coordinate system. */
+ long right; /*!< Right coordinate value in the coordinate system. */
+} ia_coordinate_system;
+
+/*!
+ * \brief Convert coordinate from source coordinate space to target coordinate space.
+ * \param[in] src_system Source coordinate system boundaries.
+ * \param[in] trg_system Target coordinate system boundaries.
+ * \param[in] src_coordinate Coordinate values in source coordinate system.
+ * \return Target coordinate converted from source coordinate.
+ */
+LIBEXPORT ia_coordinate
+ia_coordinate_convert(
+ const ia_coordinate_system *src_system,
+ const ia_coordinate_system *trg_system,
+ const ia_coordinate src_coordinate);
+
+/*!
+* Converts a rectangle from one coordinate system to another.
+*
+* \param [in] a_src_system_ptr The source coordinate system.
+* \param [in] a_src_rect_ptr The source rectangle.
+* \param [in] a_tgt_system_ptr The target coordinate system.
+* \param [out] a_tgt_rect_ptr The calculated target rectangle.
+*/
+LIBEXPORT void
+ia_coordinate_convert_rect(
+ const ia_coordinate_system* a_src_system_ptr,
+ const ia_rectangle* a_src_rect_ptr,
+ const ia_coordinate_system* a_tgt_system_ptr,
+ ia_rectangle* a_tgt_rect_ptr);
+
+/*!
+ * \brief Convert face coordinates to target coordinate system.
+ * \param[in,out] face_state Structure containing face information from face tracker.
+ * \param[in] src_system Source coordinate system boundaries.
+ * \param[in] trg_system Target coordinate system boundaries.
+ */
+LIBEXPORT void
+ia_coordinate_convert_faces(
+ const ia_coordinate_system *src_system,
+ const ia_coordinate_system *trg_system);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* IA_COORDINATE_H_ */
+
diff --git a/include/ia_imaging/ia_cp.h b/include/ia_imaging/ia_cp.h
new file mode 100644
index 0000000..598d146
--- /dev/null
+++ b/include/ia_imaging/ia_cp.h
@@ -0,0 +1,408 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_CP_H_
+#define _IA_CP_H_
+
+/** @file ia_cp.h
+ * This file declares the Intel camera computational photography API.
+ */
+
+#include "ia_types.h"
+#include "ia_cp_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @brief Initialize HDR acceleration setup
+ *
+ * @param[out] cp_context pointer to CP instance
+ * @param[in] acc_api pointer to acceleration api
+ * @param[in] environment pointer to environment setup
+ * @param[in] mem_environment pointer to memory environment setup
+ *
+ * This function initializes the acceleration setup by using input acc_api
+ * and log_env.
+*/
+LIBEXPORT void
+ia_cp_init (ia_cp_context ** cp_context,
+ const ia_acceleration * acc_api,
+ const ia_env * environment,
+ const ia_mem_env * mem_environment);
+
+
+/** @brief Close HDR acceleration setup
+ *
+ * @param[in] cp_context pointer to CP instance
+ *
+ * This function frees and closes all the resources allocated for HDR
+ * in its initialization call.
+ */
+LIBEXPORT void
+ia_cp_uninit (ia_cp_context * cp_context);
+
+/** @brief allocate and map all HDR intermediate data buffers
+ *
+ * @param[out] hdr pointer to HDR instance
+ * @param[in] cp_context pointer to CP instance
+ * @param[in] width input frame width
+ * @param[in] height input frame height
+ * @param[in] hdrb_data CPF binary data with tuning choices
+ * @param[in] tgt target platform for HDR execution (host, ipu etc.)
+ * @return error status
+ *
+ * This function allocates and maps all HDR intermediate buffers
+ * required to do the processing. It also passes tuning choices
+ * set in the CPFF for the particular platform. If hdrb_data is
+ * NULL, default choices are used.
+ */
+LIBEXPORT ia_err
+ia_cp_hdr_init (ia_cp_hdr ** hdr, ia_cp_context * cp_context, int width, int height, const ia_binary_data * hdrb_data, ia_cp_target tgt);
+
+/** @brief release and unmap intermediate HDR data buffers
+ *
+ * @param[in] hdr pointer to HDR instance
+ * @return error status
+ *
+ * This function release all resources used for intermediate
+ * data storage during HDR composition.
+ */
+LIBEXPORT ia_err
+ia_cp_hdr_uninit (ia_cp_hdr * hdr);
+
+/** @brief compose HDR image
+ *
+ * @param[in] hdr pointer to HDR instance
+ * @param[out] out pointer to the HDR output buffer
+ * @param[out] out_pv pointer to postview output buffer
+ * @param[in] in pointer to the input frame sequence
+ * @param[in] in_pv pointer to the downscaled input frame sequence
+ * @param[in] num_frames number of input frames
+ * @param[in] cfg configuration parameters
+ * @return error status
+ *
+ * This function composes an HDR image. It produces and output HDR frame and a downscaled version
+ * of the full resolution output. Composition of the output frame is controlled via configuration
+ * structure given as an input.
+ */
+LIBEXPORT ia_err
+ia_cp_hdr_compose (ia_cp_hdr * hdr,
+ ia_frame * out,
+ ia_frame * out_pv,
+ const ia_frame * in,
+ const ia_frame * in_pv,
+ unsigned int num_frames,
+ const ia_cp_hdr_cfg * cfg);
+
+/** @brief abort HDR image composition
+ *
+ * @param[in] hdr pointer to HDR instance
+ * @return error status
+ *
+ * This function aborts composition of an HDR image.
+ */
+LIBEXPORT ia_err
+ia_cp_hdr_abort (ia_cp_hdr * hdr);
+
+/** @brief allocate and map all VHDR intermediate data buffers
+ *
+ * @param[out] vhdr pointer to VHDR instance
+ * @param[in] cp_context pointer to CP instance
+ * @param[in] width input frame width
+ * @param[in] height input frame height
+ * @param[in] vhdrb_data CPF binary data with tuning choices
+ * @param[in] tgt target platform for VHDR execution (host, gpu etc.)
+ * @return error status
+ *
+ * This function allocates and maps all VHDR intermediate buffers
+ * required to do the processing. It also passes tuning choices
+ * set in the CPF for the particular platform. If vhdrb_data is
+ * NULL, default choices are used.
+ */
+LIBEXPORT ia_err
+ia_cp_vhdr_init (ia_cp_vhdr ** vhdr, ia_cp_context * cp_context, int width, int height, const ia_binary_data * vhdrb_data, ia_cp_target tgt);
+
+/** @brief release and unmap intermediate VHDR data buffers
+ *
+ * @param[in] vhdr pointer to VHDR instance
+ * @return error status
+ *
+ * This function release all resources used for intermediate
+ * data storage during VHDR composition.
+ */
+LIBEXPORT ia_err
+ia_cp_vhdr_uninit (ia_cp_vhdr * vhdr);
+
+/** @brief compose VHDR image
+ *
+ * @param[in] vhdr pointer to VHDR instance
+ * @param[out] out pointer to the VHDR output buffer
+ * @param[in] in pointer to the input frame sequence
+ * @param[in] num_frames number of input frames
+ * @param[in] cfg configuration parameters
+ * @return error status
+ *
+ * This function composes an VHDR image. It produces and output VHDR frame.
+ * Composition of the output frame is controlled via configuration
+ * structure given as an input.
+ */
+LIBEXPORT ia_err
+ia_cp_vhdr_compose (ia_cp_vhdr * vhdr,
+ ia_frame * out,
+ const ia_frame * in,
+ unsigned int num_frames,
+ const ia_cp_vhdr_cfg * cfg);
+
+/** @brief abort VHDR image composition
+ *
+ * @param[in] vhdr pointer to VHDR instance
+ * @return error status
+ *
+ * This function aborts composition of an VHDR image.
+ */
+LIBEXPORT ia_err
+ia_cp_vhdr_abort (ia_cp_vhdr * vhdr);
+
+/** @brief allocate and map all VHDR intermediate data buffers
+ *
+ * @param[out] vhdr address of pointer to VHDR instance
+ * @param[in] cp_context pointer to CP instance
+ * @param[in] width input frame width
+ * @param[in] height input frame height
+ * @param[in] vhdrb_data CPF binary data with tuning choices
+ * @param[in] tgt target platform for VHDR execution (host, gpu etc.)
+ * @return error status
+ *
+ * This function allocates and maps all VHDR intermediate buffers
+ * required to do the processing. It also passes tuning choices
+ * set in the CPF for the particular platform. If vhdrb_data is
+ * NULL, default choices are used.
+ */
+LIBEXPORT ia_err
+ia_cp_vhdr_v2_init (ia_cp_vhdr_v2 **vhdr, ia_cp_context *cp_context, int width, int height, const ia_binary_data *vhdrb_data, ia_cp_target tgt);
+
+/** @brief release and unmap intermediate VHDR data buffers
+ *
+ * @param[in] vhdr pointer to VHDR instance
+ * @return error status
+ *
+ * This function release all resources used for intermediate
+ * data storage during VHDR composition.
+ */
+LIBEXPORT ia_err
+ia_cp_vhdr_v2_uninit (ia_cp_vhdr_v2 *vhdr);
+
+/** @brief compose VHDR image
+ *
+ * @param[in] vhdr pointer to VHDR instance
+ * @param[out] out pointer to the VHDR output buffer
+ * @param[in] in pointer to the input frame sequence
+ * @param[in] cfg configuration parameters
+ * @return error status
+ *
+ * This function composes an VHDR image. It produces and output VHDR frame.
+ * Composition of the output frame is controlled via configuration
+ * structure given as an input.
+ */
+LIBEXPORT ia_err
+ia_cp_vhdr_v2_compose (ia_cp_vhdr_v2 *vhdr,
+ ia_frame *out,
+ const ia_frame *in,
+ const ia_cp_vhdr_cfg *cfg);
+
+/** @brief initialize ULL parameters
+ *
+ * @param[out] ull pointer to ULL instance
+ * @param[in] cp_context pointer to CP instance
+ * @param[in] width input frame width
+ * @param[in] height input frame height
+ * @param[in] ullb_data CPF binary data with tuning choices
+ * @param[in] tgt target platform for ULL execution (host, ipu etc.)
+ * @return error status
+ *
+ * This function initializes internals for ULL processing. It also
+ * passes tuning choices set in the CPFF for the particular platform.
+ * If ullb_data is NULL, default choices are used.
+ */
+LIBEXPORT ia_err
+ia_cp_ull_init (ia_cp_ull ** ull, ia_cp_context * cp_context, int width, int height, const ia_binary_data * ullb_data, ia_cp_target tgt);
+
+/** @brief deinitialize ULL internals
+ *
+ * @param[in] ull pointer to ULL instance
+ * @return error status
+ *
+ * This function release all resources used during ULL composition.
+ */
+LIBEXPORT ia_err
+ia_cp_ull_uninit (ia_cp_ull * ull);
+
+/** @brief compose ULL image
+ *
+ * @param[in] ull pointer to ULL instance
+ * @param[out] out pointer to the ULL output buffer
+ * @param[out] out_pv pointer to postview output buffer
+ * @param[in] in pointer to the input frame sequence
+ * @param[in] in_pv pointer to the downscaled input frame sequence
+ * @param[in] num_frames number of input frames
+ * @param[in] cfg configuration parameters
+ * @return error status
+ *
+ * This function composes a denoised image from a set of input images captured in exteme low-light
+ * conditions. It produces an output frame and a downscaled version of the full resolution output.
+ * Composition of the output frame is controlled via configuration structure given as an input.
+ */
+LIBEXPORT ia_err
+ia_cp_ull_compose (ia_cp_ull * ull,
+ ia_frame * out,
+ ia_frame * out_pv,
+ const ia_frame * in,
+ const ia_frame * in_pv,
+ unsigned int num_frames,
+ const ia_cp_ull_cfg * cfg);
+
+/** @brief abort ULL image composition
+ *
+ * @return error status
+ *
+ * This function aborts composition of a ULL image.
+ */
+LIBEXPORT ia_err
+ia_cp_ull_abort (void);
+
+/** @brief Estimate global motion between two frames provided in a form of gaussian pyramids
+ *
+ * @param[out] result outcome of the estimation process
+ * @param[in] target_pyr array of target frame pyramid levels
+ * @param[in] source_pyr array of source frame pyramid levels
+ * @param[in] cfg configuration parameters
+ * @return error status
+ *
+ * This function estimates global motion between the source frame and the target (base) frame given in a form of
+ * gaussian pyramids. Results are produced in a form of a 3x3 global transformation matrix sufficient to cover the
+ * most complex use case of projective transformation. Estimation also advocates fallback in case the global motion
+ * was sufficiently large.
+ *
+ */
+LIBEXPORT ia_err
+ia_cp_global_me_multires (ia_cp_me_result * result, const ia_frame target_pyr[],
+ const ia_frame source_pyr[], const ia_cp_me_cfg * cfg);
+
+/** @brief Estimate global motion between two frames
+ *
+ * @param[out] result outcome of the estimation process
+ * @param[in] target pointer to the target buffer
+ * @param[in] source pointer to the source buffer
+ * @param[in] cfg configuration parameters
+ * @return error status
+ *
+ * This function estimates global motion between the source frame and the target (base) frame. Results are
+ * produced in a form of a 3x3 global transformation matrix sufficient to cover the most complex use case
+ * of projective transformation. Estimation also advocates fallback in case the global motion was
+ * sufficiently large.
+ *
+ */
+LIBEXPORT ia_err
+ia_cp_global_me (ia_cp_me_result * result, const ia_frame * target, const ia_frame * source,
+ const ia_cp_me_cfg * cfg);
+
+/** @brief Compensate frame motion based on the transformation matrix
+ *
+ * @param[out] target pointer to the target buffer
+ * @param[in] source pointer to the source buffer
+ * @param[in] result outcome of the estimation process
+ * @return error status
+ *
+ * This function compensates global motion based on the provided motion estimation results.
+ *
+ */
+LIBEXPORT ia_err
+ia_cp_global_mc (ia_frame * target, ia_frame * source, ia_cp_me_result * result);
+
+
+/** @brief Zoom provided frame with specified zoom factor
+ *
+ * @param[inout] in_out frame
+ * @param[in] zoom_factor
+ * @return error status
+ *
+ * This function performs zooming of input frame with specified zoom factor.
+ *
+ */
+LIBEXPORT ia_err
+ia_cp_zoom_frame(ia_frame * in_out, int zoom_factor);
+
+/** @brief Load extension binaries
+ *
+ * @param[in] cp_context pointer to CP instance
+ * @return error status
+ *
+ * This function loads CP binaries as an extension to the preview pipe.
+ */
+LIBEXPORT ia_err
+ia_cp_load_extensions (ia_cp_context * cp_context);
+
+/** @brief Unload extension binaries
+ *
+ * @param[in] cp_context pointer to CP instance
+ * @return error status
+ *
+ * This function unloads CP binaries which are previously loaded as an extension
+ * to the preview pipe.
+ */
+LIBEXPORT ia_err
+ia_cp_unload_extensions (ia_cp_context * cp_context);
+
+/**
+ * @brief Computes standard deviation for the patches in the provided chart
+ *
+ * @param[in] chart Chart descriptor
+ * @param[in] mean_min Minimal valid patch mean
+ * @param[in] mean_max Maximal valid patch mean
+ * @param[out] deviation Average deviation for valid patches
+ *
+ * @return Flag indicating success or failure
+ *
+ * Function computes standard deviation for the patches in the provided chart. Chart data type contains
+ * a frame and location of all patches of interest. Expected are 8-bit frames, computation is done only
+ * for the first plane in the frame. Resulting deviation is scaled into the [0, 1) range.
+ */
+LIBEXPORT ia_err
+ia_cp_chart_compute_deviation (ia_cp_chart chart, int mean_min, int mean_max, float *deviation);
+
+/**
+ * @brief Performs linear regression fitting for the given dataset
+ *
+ * @param[in] psrc_x Pointer to dataset X values
+ * @param[in] psrc_y Pointer to dataset Y values
+ * @param[in] len Length of the dataset
+ * @param[out] slope Slope of the resulting linear curve
+ * @param[out] offset Offset of the resulting linear curve
+ *
+ * @return Flag indicating success or failure
+ *
+ * Function performs linear curve fitting for the given dataset via means of linear regression. Resulting
+ * slope and offset describe the linear fit as y = slope * x + offset.
+ */
+LIBEXPORT ia_err
+ia_cp_linear_regression (const float *psrc_x, const float *psrc_y, int len, float *slope, float *offset);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_CP_H */
diff --git a/include/ia_imaging/ia_cp_types.h b/include/ia_imaging/ia_cp_types.h
new file mode 100644
index 0000000..8f54067
--- /dev/null
+++ b/include/ia_imaging/ia_cp_types.h
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_CP_TYPES_H_
+#define _IA_CP_TYPES_H_
+
+#include "ia_aiq_types.h"
+#include "rgbpp_public.h"
+
+/** @file ia_cp_types.h
+ * This file declares data types used for computational photography.
+ * These data types are declared in a separate header file to allow re-use
+ * across components in the software stack.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IA_CP_HISTOGRAM_SIZE 256
+
+/** @brief Histogram and related statistics.
+ *
+ * The structure to hold the plane histogram and the corresponding
+ * cumulative distribution function (CDF).
+ */
+typedef struct
+{
+ int data[IA_CP_HISTOGRAM_SIZE]; /**< Histogram values */
+ int cdf[IA_CP_HISTOGRAM_SIZE]; /**< Normalized CDF for the histogram */
+ int levels[IA_CP_HISTOGRAM_SIZE + 1]; /**< Histogram levels */
+ int size; /**< Total number of samples in all bins */
+} ia_cp_histogram;
+
+/** @brief Local contrast enhancement controls
+ *
+ * Contrast enhancement can be applied as part of the computational photography pipelines.
+ * This is usually done as a post-processing step to make up for a loss in sharpness and
+ * texture details introduced by composition of multiple images. This can be achieved either
+ * as a multi-level sharpening, or as a pixel modification based on its local neighbourhood.
+ */
+typedef enum
+{
+ ia_cp_contrast_none, /**< No contrast enhancement */
+ ia_cp_contrast_sharpening, /**< Enable sharpening */
+ ia_cp_contrast_details, /**< Enable texture enhancement */
+ ia_cp_contrast_all, /**< Enable both sharpening and texture enhancement */
+} ia_cp_contrast;
+
+/** @brief Vividness enhancement
+ *
+ * Vividness enhancement can be enabled in certain CP features to boost color saturation.
+ * Processing operates on the S channel (HSV color space) and increases its value while
+ * preserving the color gammut. Saturation is not applied to skin tones.
+ */
+typedef enum
+{
+ ia_cp_vividness_off, /**< Color saturation enhancement disabled */
+ ia_cp_vividness_on, /**< Color saturation enhancement enabled */
+} ia_cp_vividness;
+
+/** @brief Gamma LUT applied on each of RGB channels.
+ *
+ */
+typedef struct {
+ unsigned short *r_gamma_lut;
+ unsigned short *b_gamma_lut;
+ unsigned short *g_gamma_lut;
+ unsigned int gamma_lut_size;
+} ia_cp_gamma_lut;
+
+/** @brief HDR configuration interface
+ *
+ * This structure contains HDR runtime parameters computed by the
+ * AIQ+ module or obtain differently (e.g. read from the disk). These
+ * settings represent HDR runtime control interface.
+ */
+typedef struct
+{
+ ia_cp_gamma_lut gamma_lut; /**< Gamma LUT applied on each of RGB channels */
+} ia_cp_hdr_cfg;
+
+/** @brief vHDR configuration interface
+ *
+ * This structure contains vHDR runtime parameters computed by the
+ * AIQ+ module or obtain differently (e.g. read from the disk). These
+ * settings represent vHDR runtime control interface.
+ */
+#define IA_CP_GAIN_LUT_SZ 18
+#define IA_CP_GAMMA_LUT_SZ 1024
+
+typedef struct
+{
+ ia_aiq_ae_results *ae_results; /* Exposure times, analog and digital gain, lux level,... */
+ ia_aiq_gbce_results *gbce_results; /* Long gamma LUTs applied on each RGB channel */
+} ia_cp_vhdr_cfg;
+
+typedef struct gtm_coeff {
+ struct csc_public_config yuv2rgbConv; /**< vHDR: GTM: YUV to RGB converstion */
+ struct csc_public_config rgb2yuvConv; /**< vHDR: GTM: RGB to YUV converstion */
+ struct cds_public_config rgb2yuvDs; /**< vHDR: GTM: RGB to YUV downscale */
+} gtm_coeff_t;
+
+typedef struct gtm_luts_t {
+ float gtm_gamma_lut[IA_CP_GAMMA_LUT_SZ]; /* limited to 1024 entries */
+ float gtm_gain_lut[IA_CP_GAIN_LUT_SZ]; /* limited to 18 entries */
+} gtm_luts_t;
+
+typedef struct
+{
+ int se_exposure_time;
+ int le_exposure_time;
+ uint8_t gae_model; /* 0 - None (GAE is off), 1 - Translation [1]*/
+ uint8_t gae_bright_thr_low; /* Brightness threshold low (can be sensor dependent) [4] */
+ uint8_t gae_bright_thr_high; /* Brightness threshold high (can be sensor dependent) [250] */
+ int gae_pyr_low;
+ int gae_pyr_high;
+ float gae_zeros_thr_w; /*!< Minimal weight of zero motion vectors before declaring that camera is still */
+ float gae_flat_thr_ratio; /*!< Flat regions ratio */
+ float gae_motion_min_area_low; /*!< Minimal motion area wieght before entering fallback state */
+ float gae_motion_min_area_high; /*!< Minimal motion area wieght before leaving fallback state */
+ uint8_t mrg_blend_thr_low;
+ uint8_t mrg_blend_thr_high;
+ gtm_luts_t gtm_luts;
+ gtm_coeff_t gtm_coeff; /* GTM color space & down Scale converstion parameters */
+} ia_vhdr_config; /* dynamic config params, given by aic */
+
+
+
+/** @brief ULL configuration interface
+ *
+ * This structure contains ULL runtime parameters computed by the
+ * AIQ+ module or obtain differently (e.g. read from the disk). These
+ * settings represent ULL runtime control interface.
+ */
+typedef struct
+{
+ ia_aiq_exposure_parameters exposure; /**< Generic exposure parameters for the input captures */
+ int * imreg_fallback; /**< List of frames to ignore when using external alignment estimation (NULL for internal) */
+ unsigned int zoom_factor; /**< Zoom factor */
+} ia_cp_ull_cfg;
+
+/** @brief Global motion estimation model
+ *
+ * This enumerator lists valid global motion estimation models
+ * which can be specified during the global motion estimation process.
+ */
+typedef enum
+{
+ ia_cp_me_translation, /**< Pure in-plane translation model */
+ ia_cp_me_translation_rotation, /**< Pure in-plane translation and rotation model */
+ ia_cp_me_affine, /**< General affine model */
+ ia_cp_me_projective /**< General projective (homography) model */
+} ia_cp_me_model;
+
+/** @brief Global motion estimation configuration interface
+ *
+ * This structure contains global motion estimation parameters. These
+ * settings control the execution of the algorithm at runtime.
+ */
+typedef struct
+{
+ int pyr_depth; /**< Depth of the pyramid for coarse-to-fine search */
+ ia_cp_me_model model; /**< Transformation model */
+} ia_cp_me_cfg;
+
+/** @brief Results of the global motion estimation
+ *
+ * This structure contains results of the global motion estimation.
+ */
+typedef struct
+{
+ double transform[3][3]; /**< Resulting 3x3 transformation matrix */
+ int fallback; /**< Flag to indicate large global motion */
+} ia_cp_me_result;
+
+/** @brief Processing unit target
+ *
+ * This enumerator lists valid targets for execution of CP applications.
+ */
+typedef enum
+{
+ ia_cp_tgt_ia, /**< Intel Architecture (IA) host */
+ ia_cp_tgt_ipu, /**< Image Processing Unit */
+ ia_cp_tgt_gpu, /**< Graphics Processing Unit */
+ ia_cp_tgt_ate, /**< ATE C bitexact reference model */
+ ia_cp_tgt_ref, /**< Generic C reference model */
+ ia_cp_tgt_skl_gpu, /**< Platform SKL, target GPU */
+ ia_cp_tgt_skl_ref, /**< Platform SKL, Generic C reference model */
+ ia_cp_tgt_none /**< Use to indicate error in target choice */
+} ia_cp_target;
+
+/** @brief HDR internal state.
+ *
+ * Opaque structure which holds HDR internal state.
+ */
+typedef struct ia_cp_hdr ia_cp_hdr;
+
+/** @brief vHDR internal state.
+ *
+ * Opaque structure which holds vHDR internal state.
+ */
+typedef struct ia_cp_vhdr ia_cp_vhdr;
+
+/** @brief vHDR internal state.
+ *
+ * Opaque structure which holds vHDR internal state.
+ */
+typedef struct ia_cp_vhdr_v2 ia_cp_vhdr_v2;
+
+/** @brief ULL internal state.
+ *
+ * Opaque structure which holds ULL internal state.
+ */
+typedef struct ia_cp_ull ia_cp_ull;
+
+/** @brief CP library context.
+ *
+ * Opaque structure which holds CP library internal state.
+ */
+typedef struct ia_cp_context ia_cp_context;
+
+/**
+ * @brief Chart descriptor
+ */
+typedef struct {
+ ia_frame container; /**< Image container */
+ int roi_width; /**< Width of the patch ROI */
+ int roi_height; /**< Height of the patch ROI */
+ int patch_num; /**< Number of relevant patches */
+ int *points_x; /**< Top-left X coordinates of the patch */
+ int *points_y; /**< Top-left Y coordinates of the patch */
+} ia_cp_chart;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_CP_TYPES_H_ */
diff --git a/include/ia_imaging/ia_css_lin_types.h b/include/ia_imaging/ia_css_lin_types.h
new file mode 100644
index 0000000..84cf129
--- /dev/null
+++ b/include/ia_imaging/ia_css_lin_types.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LIN_PUBLIC_H_
+#define _LIN_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam linearization lookup (LIN) kernel.
+*/
+
+/** Linearization lookup table size. The number of piecewise linear segments is
+ * one less than the table size. */
+#define LIN_TABLE_SIZE 65
+
+/** Number of piecewise linear segments */
+#define LIN_SEGMENTS (LIN_TABLE_SIZE - 1)
+
+struct ia_css_2500_lin_kernel_config
+{
+ short curve_lut_GR[LIN_TABLE_SIZE];
+ short curve_lut_R[LIN_TABLE_SIZE];
+ short curve_lut_B[LIN_TABLE_SIZE];
+ short curve_lut_GB[LIN_TABLE_SIZE];
+};
+
+
+#endif // _LIN_PUBLIC_H_
diff --git a/include/ia_imaging/ia_css_rgbir_types.h b/include/ia_imaging/ia_css_rgbir_types.h
new file mode 100644
index 0000000..5c01f37
--- /dev/null
+++ b/include/ia_imaging/ia_css_rgbir_types.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _RGBIR_PUBLIC_H_
+#define _RGBIR_PUBLIC_H_
+#include <stdint.h>
+
+/** @file
+* CSS-API header file for 2500/Skycam RGBIR Remosaic parameters.
+*/
+
+/** max lut table width */
+#define IA_CSS_RGBIR_MAX_LUT_WIDTH 17
+/** max lut table height */
+#define IA_CSS_RGBIR_MAX_LUT_HEIGHT 10
+/** max lut table size */
+#define IA_CSS_RGBIR_MAX_LUT_SIZE (IA_CSS_RGBIR_MAX_LUT_WIDTH * IA_CSS_RGBIR_MAX_LUT_HEIGHT)
+
+#define DEFAULT_IR_GAIN 512
+#define DEFAULT_OB 64
+
+/**
+ * RGBIR Remosaic configuration
+ *
+ * - ob: Optical black level
+ * u10.0: default: 16
+ *
+ * - ir_height: height of the weights lut
+ * Valid values: [1, IA_CSS_RGBIR_MAX_LUT_HEIGHT]
+ *
+ * - ir_width: width of the weights lut
+ * Valid values: [1, IA_CSS_RGBIR_MAX_LUT_WIDTH]
+ *
+ * - ir_weights_r: lut values for red channel
+ * u3.8: spatial varying IR correction
+ * Amount of IR contamination on Red Channel
+ * Must contain at least 'ir_width * ir_height'
+ * valid elements in row-major order.
+ *
+ * - ir_weights_g: lut values for green channel
+ * u3.8: spatial varying IR correction
+ * Amount of IR contamination on Green Channel
+ * Must contain at least 'ir_width * ir_height'
+ * valid elements in row-major order.
+ *
+ * - ir_weights_b: lut values for blue channel
+ * u3.8: spatial varying IR correction
+ * Amount of IR contamination on Blue Channel
+ * Must contain at least 'ir_width * ir_height'
+ * valid elements in row-major order.
+ *
+ * - ir_gain: Digital Gain
+ * u3.8: digital gain applied on raw to compensate
+ * DR loss caused by IR contamination
+ */
+struct ia_css_2500_rgbir_kernel_config {
+ uint16_t ob; /**< optical black level */
+ uint16_t ir_height; /**< lut height */
+ uint16_t ir_width; /**< lut width */
+ uint16_t ir_weights_r[IA_CSS_RGBIR_MAX_LUT_SIZE]; /**< lut values for red channel */
+ uint16_t ir_weights_g[IA_CSS_RGBIR_MAX_LUT_SIZE]; /**< lut values for green channel */
+ uint16_t ir_weights_b[IA_CSS_RGBIR_MAX_LUT_SIZE]; /**< lut values for blue channel */
+ uint16_t ir_gain; /**< digital gain */
+};
+
+
+#endif /* _RGBIR_PUBLIC_H_ */
diff --git a/include/ia_imaging/ia_css_tnr3_types.h b/include/ia_imaging/ia_css_tnr3_types.h
new file mode 100644
index 0000000..11ac06b
--- /dev/null
+++ b/include/ia_imaging/ia_css_tnr3_types.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_CSS_TNR3_TYPES_H
+#define _IA_CSS_TNR3_TYPES_H
+
+/** @file
+* CSS-API header file for Temporal Noise Reduction v3 (TNR3) kernel
+*/
+
+/**
+ * \brief Number of piecewise linear segments.
+ * \details The parameters to TNR3 are specified as a piecewise linear segment.
+ * The number of such segments is fixed at 3.
+ */
+#define TNR3_NUM_SEGMENTS 3
+
+/** Temporal Noise Reduction v3 (TNR3) configuration.
+ * The parameter to this kernel is fourfold
+ * 1. Three piecewise linear graphs (one for each plane) with three segments
+ * each. Each line graph has Luma values on the x axis and sigma values for
+ * each plane on the y axis. The three linear segments may have a different
+ * slope and the point of Luma value which where the slope may change is called
+ * a "Knee" point. As there are three such segments, four points need to be
+ * specified each on the Luma axis and the per plane Sigma axis. On the Luma
+ * axis two points are fixed (namely 0 and maximum luma value - depending on
+ * ISP bit depth). The other two points are the points where the slope may
+ * change its value. These two points are called knee points. The four points on
+ * the per plane sigma axis are also specified at the interface.
+ * 2. One rounding adjustment parameter for each plane
+ * 3. One maximum feedback threshold value for each plane
+ * 4. Selection of the reference frame buffer to be used for noise reduction.
+ */
+struct ia_css_tnr3_kernel_config {
+ unsigned int maxfb_y; /**< Maximum Feedback Gain for Y */
+ unsigned int maxfb_u; /**< Maximum Feedback Gain for U */
+ unsigned int maxfb_v; /**< Maximum Feedback Gain for V */
+ unsigned int round_adj_y; /**< Rounding Adjust for Y */
+ unsigned int round_adj_u; /**< Rounding Adjust for U */
+ unsigned int round_adj_v; /**< Rounding Adjust for V */
+ unsigned int knee_y[TNR3_NUM_SEGMENTS - 1]; /**< Knee points */
+ unsigned int sigma_y[TNR3_NUM_SEGMENTS + 1]; /**< Standard deviation for Y at points Y0, Y1, Y2, Y3 */
+ unsigned int sigma_u[TNR3_NUM_SEGMENTS + 1]; /**< Standard deviation for U at points U0, U1, U2, U3 */
+ unsigned int sigma_v[TNR3_NUM_SEGMENTS + 1]; /**< Standard deviation for V at points V0, V1, V2, V3 */
+ unsigned int ref_buf_select; /**< Selection of the reference buffer */
+};
+
+#endif
diff --git a/include/ia_imaging/ia_css_xnr3_types.h b/include/ia_imaging/ia_css_xnr3_types.h
new file mode 100644
index 0000000..a0b7f9f
--- /dev/null
+++ b/include/ia_imaging/ia_css_xnr3_types.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __IA_CSS_XNR3_TYPES_H
+#define __IA_CSS_XNR3_TYPES_H
+
+/** @file
+* CSS-API header file for Extra Noise Reduction (XNR) parameters.
+*/
+
+/**
+ * \brief Scale of the XNR sigma parameters.
+ * \details The define specifies which fixed-point value represents 1.0.
+ */
+#define IA_CSS_XNR3_SIGMA_SCALE (1 << 10)
+
+/**
+ * \brief Scale of the XNR coring parameters.
+ * \details The define specifies which fixed-point value represents 1.0.
+ */
+#define IA_CSS_XNR3_CORING_SCALE (1 << 15)
+
+/**
+ * \brief Scale of the XNR blending parameter.
+ * \details The define specifies which fixed-point value represents 1.0.
+ */
+#define IA_CSS_XNR3_BLENDING_SCALE (1 << 11)
+
+
+/**
+ * \brief XNR3 Sigma Parameters.
+ * \details Sigma parameters define the strength of the XNR filter.
+ * A higher number means stronger filtering. There are two values for each of
+ * the three YUV planes: one for dark areas and one for bright areas. All
+ * sigma parameters are fixed-point values between 0.0 and 1.0, scaled with
+ * IA_CSS_XNR3_SIGMA_SCALE.
+ */
+struct ia_css_xnr3_sigma_params {
+ int y0; /**< Sigma for Y range similarity in dark area */
+ int y1; /**< Sigma for Y range similarity in bright area */
+ int u0; /**< Sigma for U range similarity in dark area */
+ int u1; /**< Sigma for U range similarity in bright area */
+ int v0; /**< Sigma for V range similarity in dark area */
+ int v1; /**< Sigma for V range similarity in bright area */
+};
+
+/**
+ * \brief XNR3 Coring Parameters
+ * \details Coring parameters define the "coring" strength, which is a soft
+ * thresholding technique to avoid false coloring. There are two values for
+ * each of the two chroma planes: one for dark areas and one for bright areas.
+ * All coring parameters are fixed-point values between 0.0 and 1.0, scaled
+ * with IA_CSS_XNR3_CORING_SCALE. The ineffective value is 0.
+ */
+struct ia_css_xnr3_coring_params {
+ int u0; /**< Coring threshold of U channel in dark area */
+ int u1; /**< Coring threshold of U channel in bright area */
+ int v0; /**< Coring threshold of V channel in dark area */
+ int v1; /**< Coring threshold of V channel in bright area */
+};
+
+/**
+ * \brief XNR3 Blending Parameters
+ * \details Blending parameters define the blending strength of filtered
+ * output pixels with the original chroma pixels from before xnr3. The
+ * blending strength is a fixed-point value between 0.0 and 1.0 (inclusive),
+ * scaled with IA_CSS_XNR3_BLENDING_SCALE.
+ * A higher number applies xnr filtering more strongly. A value of 1.0
+ * disables the blending and returns the xnr3 filtered output, while a
+ * value of 0.0 bypasses the entire xnr3 filter.
+ */
+struct ia_css_xnr3_blending_params {
+ int strength; /**< Blending strength */
+};
+
+/**
+ * \brief XNR3 public parameters.
+ * \details Struct with all parameters for the XNR3 kernel that can be set
+ * from the CSS API.
+ */
+struct ia_css_xnr3_config {
+ struct ia_css_xnr3_sigma_params sigma; /**< XNR3 sigma parameters */
+ struct ia_css_xnr3_coring_params coring; /**< XNR3 coring parameters */
+ struct ia_css_xnr3_blending_params blending; /**< XNR3 blending parameters */
+};
+
+#endif /* __IA_CSS_XNR3_TYPES_H */
diff --git a/include/ia_imaging/ia_dpc.h b/include/ia_imaging/ia_dpc.h
new file mode 100644
index 0000000..b787ed3
--- /dev/null
+++ b/include/ia_imaging/ia_dpc.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*!
+ * \mainpage IA DPC API documentation
+ *
+ * Browse Files and Classes tabs for details.
+ *
+ */
+/*!
+ * \file ia_dpc.h
+ * \brief Definitions and declarations of IA SD-DPC library.
+ */
+#ifndef _IA_DPC_H_
+#define _IA_DPC_H_
+
+#include "ia_aiq_types.h"
+#include "ia_types.h"
+#include "ia_mkn_types.h"
+#include "ia_cmc_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define IA_DPC_VERSION "1.0.0.0"
+typedef struct ia_dpc_t ia_dpc;
+
+/*!
+ * \brief SD-DPC runtime input.
+ */
+typedef struct {
+ short *frame_data; /*!< fixed point image */
+ int frame_width; /*!< current frame width (might be cropped) */
+ int frame_height; /*!< current frame height (might be cropped) */
+} sd_dpc_input;
+
+/*!
+ * \brief SD-DPC per-run output.
+ */
+typedef struct {
+ short *defect_lut; /*!< defects LUT stores the column indices (one-based) of the approved defects per row. size frame_height x max_defects_per_line */
+ int dpc_lut_width; /*!< the width of the DP LUT, equal to maximum number of defects per line */
+ int dpc_lut_height; /*!< the height of the DP LUT, equal to sensor height */
+ bool dpc_lut_changed; /*!< true if the new defects have been added */
+} sd_dpc_output;
+
+/*!
+ * \brief Initialize IA_DPC.The function parses the given AIQB data and determines if the SD-DPC should be used.
+ * If yes the object is allocated and initialized.
+ * If not, null is returned
+ *
+ * \param[in] aiqb_data Mandatory.\n
+ * CPFF that contains tuning parameters for camera, ISP and AIQ algorithms.
+ * If NULL is given the function will return NULL.
+ * \param[in] ia_cmc Mandatory.\n
+ * Parsed camera module characterization structure. Internal copy of the structure will be taken.
+ * If NULL is given the function will return NULL.
+ * \param[in] ia_dpcd_data Mandatory.\n
+ * loaded DPCD data. Should not be NULL, but have size = 0 instead
+ * \param[in] max_defects_per_line Mandatory.\n
+ * maximum number of defects per line support by the ISP.
+ * \param[in] stripe_number_of_lines Mandatory.\n
+ * The maximum stripe height.
+ * return IA_DPC handle. Use the returned handle as input parameter for the consequent IA_DPC calls.
+ * Returns NULL is SD-DPC should be bypassed.
+ */
+LIBEXPORT ia_dpc*
+ia_dpc_init(const ia_binary_data *aiqb_data,
+ const ia_cmc_t *ia_cmc,
+ const ia_binary_data *ia_dpcd_data,
+ unsigned int max_defects_per_line,
+ unsigned int stripe_number_of_lines);
+
+/*!
+ * \brief De-initialize IA_DPC.
+ * All memory allocated by DPC algoriths are freed. DPC handle can no longer be used.
+ *
+ * \param[in] ia_dpc Mandatory.\n
+ * DPC instance handle.
+ */
+LIBEXPORT void
+ia_dpc_deinit(ia_dpc *ia_dpc);
+/*!
+ * \brief SD-DPC execution based on input parameters and stripe.
+ *
+ * \param [in] ia_dpc Mandatory.\n
+ * SD-DPC state, updated with the intermediate results
+ * \param [in,out] stripe_ptr Mandatory.\n
+ * Stripe data that include the RAW pixels and the exisitng/ missing margins information.
+ * \param [out] dpc_output Mandatory.\n
+ * Output LUT of the verified defect pixels. The new defect pixels can be only in the given stripe region.
+ * Results can be used directly as input for AIC.
+ * \return Error code.
+ */
+
+LIBEXPORT ia_err
+ia_dpc_run(ia_dpc *ia_dpc,
+ const sd_dpc_input *stripe_ptr,
+ const ia_aiq_frame_params *aiq_frame_params_ptr,
+ const ia_aiq_ae_exposure_result *ae_exposure_result_ptr,
+ sd_dpc_output *dpc_output);
+
+/*!
+ * \param[in] ia_aiq Mandatory.\n
+ * DPC instance handle.
+ * \param[out] out_ia_dpcd_data Mandatory.\n
+ * Contains various DPC related information, collected during run-time and subject to
+ * be stored in a host file system. Host will copy this data, if ia_dpcd_data->size > 0
+ * and ia_dpcd_data->data != NULL; SD-DPC is responsible to deallocate data buffer
+ * during ia_dpc_deinit().
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_dpc_get_dpcd_data(
+ ia_dpc *ia_dpc,
+ ia_binary_data *out_ia_dpcd_data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _IA_DPC_H_ */
diff --git a/include/ia_imaging/ia_dvs.h b/include/ia_imaging/ia_dvs.h
new file mode 100644
index 0000000..a09a61b
--- /dev/null
+++ b/include/ia_imaging/ia_dvs.h
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \mainpage IA DVS documentation
+ *
+ * \section general General info
+ *
+ * Digital video stabilization API.
+ *
+ */
+
+/*!
+ * \file ia_dvs.h
+ * \brief Definitions and declarations of Intel DVS library.
+ */
+
+#ifndef _IA_DVS_H_
+#define _IA_DVS_H_
+
+#include <stdint.h>
+#include "ia_dvs_types.h"
+#include "ia_aiq_types.h"
+#include "ia_cmc_types.h"
+#include "ia_aiq.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! \brief Initialize the DVS module.
+ *
+ * \param[out] dvs_state dvs state.
+ * This is a pointer to a pointer to a module.
+ * \param[in] a_aiq_tuning_binary aiqb binary tuning parameter.
+ * \param[in] cmc cmc_t parameter.
+ * \return 0 for no error, others for error.
+ *
+ * This function initializes the DVS module. This allocates and initializes
+ * internal data structures. This function must always be called before any
+ * other ia_dvs function.
+ */
+LIBEXPORT ia_err
+ia_dvs_init(ia_dvs_state **dvs_state,
+ const ia_binary_data *a_aiq_tuning_binary,
+ const ia_cmc_t *cmc);
+
+/*! \brief Configure the DVS module.
+ *
+ * \param[in] dvs_state dvs state.
+ * \param[in] config dvs configuration
+ * \param[in] digital_zoom_ratio digital zoom ratio.
+ * \return 0 for no error, others for error.
+ *
+ * This function configures the DVS module. This allocates and initializes
+ * internal data structures. This function must always be called after ia_dvs_init
+ * and before any other ia_dvs function is called.
+ */
+LIBEXPORT ia_err
+ia_dvs_config(ia_dvs_state *dvs_state,
+ const ia_dvs_configuration *config,
+ float digital_zoom_ratio);
+
+/*! \brief Deinitialize the DVS module.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ *
+ * This function deinitilizes the DVS module. This frees the allocated memory.
+ */
+LIBEXPORT void
+ia_dvs_deinit(ia_dvs_state *dvs_state);
+
+/*! \brief Set the DVS statistics.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[in] statistics Pointer to generic DVS statistics
+ * \param[in] ae_results Optional. Pointer to AIQ AE results.
+ * \param[in] af_results Optional. Pointer to AIQ AF results.
+ * \param[in] sensor_events Optional. Pointer to sensor events data which contains accelerometer,
+ * gravity and gyroscope events.
+ * \param[in] frame_exposure_start Frame exposure start time. Optional for image based DVS. Mandatory for gyro based DVS
+ * \param[in] frame_readout_end Frame readout end time. Optional for image based DVS. Mandatory for gyro based DVS
+ * \return 0 for no error, others for error.
+ *
+ * This function receives DVS statistics in generic format.
+ */
+LIBEXPORT ia_err
+ia_dvs_set_statistics(ia_dvs_state *dvs_state,
+ const ia_dvs_statistics *statistics,
+ const ia_aiq_ae_results *ae_results,
+ const ia_aiq_af_results *af_results,
+ const ia_aiq_sensor_events *sensor_events,
+ const unsigned long long frame_exposure_start,
+ const unsigned long long frame_readout_end);
+
+/*! \brief Execute DVS main process.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[in] focus_position Focus motor position in terms of those used by the sensor module.
+ * Value 0 will use the first LDC grid from the CPF.
+ * \return 0 for no error, others for error.
+ *
+ * This function processes the DVS main functionality. This generates a
+ * lens distortion configuration and calculates global motion.
+ */
+LIBEXPORT ia_err
+ia_dvs_execute(ia_dvs_state *dvs_state,
+ uint16_t focus_position);
+
+/*! \brief allocate the DVS morphing table.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[out] morph_table Pointer to Pointer to morphing table.
+ * \return 0 for no error, others for error.
+ *
+ * This function allocates the memory of dvs morphing table.
+ * This allocates the struct ia_dvs_morph_table itself, and the members in the structure.
+ */
+LIBEXPORT ia_err
+ia_dvs_allocate_morph_table(ia_dvs_state *dvs_state,
+ ia_dvs_morph_table **morph_table);
+
+/*! \brief Free the DVS morphing table.
+ *
+ * \param[in] morph_table Pointer to morphing table.
+ * \return 0 for no error, others for error.
+ *
+ * This function frees the memory of dvs morphing table.
+ * Each allocated member in morph_table, and morph_table itself are freed.
+ */
+LIBEXPORT ia_err
+ia_dvs_free_morph_table(ia_dvs_morph_table *morph_table);
+
+/*! \brief Get the GDC morphing table.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[out] morph_table Pointer to the GDC morph table
+ * \return 0 for no error, others for error.
+ *
+ * This function calculates GDC morphing table from lens distortion configuration, digital zoom and global motion.
+ */
+LIBEXPORT ia_err
+ia_dvs_get_morph_table(ia_dvs_state *dvs_state,
+ ia_dvs_morph_table *morph_table);
+
+/*! \brief Set non blanking ratio.
+ *
+ * \param[in] dvs_state dvs_state.
+ * This is a pointer to a module.
+ * \param[in] nonblanking_ratio non blanking ratio.
+ * Value 0.0 means no rolling shutter correction.
+ * \return 0 for no error, others for error.
+ *
+ * This function specifies the rolling shutter correction effect.
+ */
+LIBEXPORT ia_err
+ia_dvs_set_non_blank_ratio(ia_dvs_state *dvs_state,
+ float nonblanking_ratio);
+
+/*! \brief Set digital zoom magnitude.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[in] magnitude digital zoom magnitude
+ * \return 0 for no error, others for error.
+ *
+ * This function specifies the digital zoom magnitude
+ */
+LIBEXPORT ia_err
+ia_dvs_set_digital_zoom_magnitude(ia_dvs_state *dvs_state,
+ float magnitude);
+
+/*!
+ * \brief Set the distortion configuration.
+ *
+ * This function specifies lens distortion correction grid. This will override LDC defined in CPF.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[in] distortion_config Distortion grid configuration.
+ * \return 0 for no error, others for error.
+ */
+LIBEXPORT ia_err
+ia_dvs_set_distortion_config(ia_dvs_state *dvs_state,
+ const ia_dvs_distortion_config *distortion_config);
+
+/*!
+ * \brief Set digital zoom mode.
+ *
+ * This function specifies the digital zoom mode.
+ *
+ * In mode ia_dvs_zoom_mode_center ia_dvs_set_digital_zoom_magnitude() is used to control
+ * digital zoom. Zooming is performed to the center of the image.
+ *
+ * In mode ia_dvs_zoom_mode_region ia_dvs_set_digital_zoom_region() is used to control
+ * zooming position and magnitude.
+ *
+ * By default mode ia_dvs_zoom_mode_center is used.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[in] zoom_mode digital zoom mode
+ * \return 0 for no error, others for error.
+ */
+LIBEXPORT ia_err
+ia_dvs_set_digital_zoom_mode(ia_dvs_state *dvs_state,
+ ia_dvs_zoom_mode zoom_mode);
+
+/*!
+ * \brief Set digital zoom region.
+ *
+ * This function specifies the digital zoom region. It requires setting
+ * the zoom mode to ia_dvs_zoom_mode_region.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[in] zoom_region Rectangle which is zoomed in.
+ * This region is cropped and scaled
+ * to the size of the output image.
+ * Coordinates are given in BQs.
+ * \return 0 for no error, others for error.
+ */
+LIBEXPORT ia_err
+ia_dvs_set_digital_zoom_region(ia_dvs_state *dvs_state,
+ ia_rectangle *zoom_region);
+
+/*!
+ * \brief Set digital zoom coordinate.
+ *
+ * This function specifies the digital zoom coordinate. It requires setting
+ * the zoom mode to ia_dvs_zoom_mode_coordinate.
+ *
+ * \param[in] dvs_state dvs state.
+ * This is a pointer to a module.
+ * \param[in] zoom_coordinate Coordinate which is zoomed in.
+ * Coordinate is given in BQs.
+ * \return 0 for no error, others for error.
+ */
+LIBEXPORT ia_err
+ia_dvs_set_digital_zoom_coordinate(ia_dvs_state *dvs_state,
+ ia_coordinate *zoom_coordinate);
+
+/*!
+ * \brief Get version.
+ * Get version from version header.
+ *
+ * \return Version string.
+ */
+LIBEXPORT const char* ia_dvs_get_version(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_DVS_H_ */
diff --git a/include/ia_imaging/ia_dvs2_types.h b/include/ia_imaging/ia_dvs2_types.h
new file mode 100644
index 0000000..105cd4b
--- /dev/null
+++ b/include/ia_imaging/ia_dvs2_types.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** @file ia_dvs2_types.h
+ * IA_DVS2 data types. This provides data types to access to the DVS2 Host Library.
+ */
+#ifndef _IA_DVS2_TYPES_H_
+#define _IA_DVS2_TYPES_H_
+#include <stdint.h>
+#include "ia_types.h"
+
+/** DVS2 Algorithm.
+ * These settings specify the nembers of correction axes.
+ * ia_dvs2_algorihm_0_axis is special mode. In this case, library does not compensate the
+ * motion, works for digital zoom / scaling.
+ */
+typedef enum {
+ ia_dvs2_algorihm_0_axis = 0, /**< 0 axis, means digital zoom/scaling mode */
+ ia_dvs2_algorihm_2_axis = 2, /**< 2 axis */
+ ia_dvs2_algorihm_4_axis = 4, /**< 4 axis */
+ ia_dvs2_algorihm_6_axis = 6, /**< 6 axis */
+ ia_dvs2_algorihm_max_axis = ia_dvs2_algorihm_6_axis, /**< maximum axis */
+} ia_dvs2_algorithm_version;
+
+/** DVS2 resolution configuration.
+ * These parameter are DVS2 resolution configuration.
+ */
+typedef struct {
+ int width; /**< width [pixel] */
+ int height; /**< height [pixel] */
+} ia_dvs2_resolution;
+
+/** DVS2 BQ resolution.
+ * These parameter are BQ resolution configuration.
+ */
+typedef struct {
+ int width_bq; /**< width [BQ] */
+ int height_bq; /**< height [BQ] */
+} ia_dvs2_bq_resolution;
+
+/** GDC Scan Mode
+ * These settings specify the gdc scan mode.
+ */
+typedef enum {
+ ia_dvs2_gdc_scan_mode_stb = 0, /**< STB (slide to the bottom) */
+ ia_dvs2_gdc_scan_mode_str, /**< STR (slide to the right) */
+} ia_dvs2_gdc_scan_mode;
+
+/** GDC Interpolation Method
+ * These settings specify the gdc interpolation method.
+ */
+typedef enum {
+ ia_dvs2_gdc_interpolation_nnd = 0, /**< NND (nearest neighbor) */
+ ia_dvs2_gdc_interpolation_bli, /**< BLI (bilinear) */
+ ia_dvs2_gdc_interpolation_bci, /**< BCI (bicubic) */
+ ia_dvs2_gdc_interpolation_lut, /**< LUT (look up table) */
+} ia_dvs2_gdc_interpolation;
+
+/** GDC Performance Point
+ * These settings specify the gdc performance point.
+ */
+typedef enum {
+ ia_dvs2_gdc_performance_point_1x1 = 0, /**< 1x1 */
+ ia_dvs2_gdc_performance_point_2x1, /**< 2x1 */
+ ia_dvs2_gdc_performance_point_1x2, /**< 1x2 */
+ ia_dvs2_gdc_performance_point_2x2, /**< 2x2 */
+} ia_dvs2_gdc_performance_point;
+
+/** GDC hardware configuration
+ * These parametes are the gdc hardware block configuration.
+ * dvs2 library use these parameters just check the gdc constraints,
+ * do NOT use these parameters for any controls nor calculations.
+ */
+typedef struct {
+ ia_dvs2_gdc_scan_mode scan_mode;
+ ia_dvs2_gdc_interpolation interpolation;
+ ia_dvs2_gdc_performance_point performance_point;
+} ia_dvs2_gdc_hw_configuration;
+
+/** GDC distortion coefficients.
+ * This structure contains GDC distortion coefficients.
+ */
+typedef struct {
+ float gdc_k1; /**< Distortion Coefficient K1 */
+ float gdc_k2; /**< Distortion Coefficient K2 */
+ float gdc_k3; /**< Distortion Coefficient K3 */
+ float gdc_p1; /**< Distortion Coefficient P1 */
+ float gdc_p2; /**< Distortion Coefficient P2 */
+} ia_dvs2_distortion_coefs;
+
+/** DVS configuration.
+ * This structure contains DVS configuration.
+ */
+typedef struct {
+ ia_dvs2_algorithm_version num_axis; /**< algorithm */
+ float nonblanking_ratio; /**< effective vertical scan ratio, used for rolling correction (Non-blanking ration of frame interval) */
+ int grid_size; /**< isp process grid size [BQ] */
+ ia_dvs2_bq_resolution source_bq; /**< GDC source image size [BQ] */
+ ia_dvs2_bq_resolution output_bq; /**< GDC output image size [BQ] */
+ ia_dvs2_bq_resolution envelope_bq; /**< GDC effective envelope size [BQ] */
+ ia_dvs2_bq_resolution ispfilter_bq; /**< isp pipe filter size [BQ] */
+ int gdc_shift_x; /**< shift value of morphing table depend on ISP pipe. [chroma pixel] */
+ int gdc_shift_y; /**< shift value of morphing table depend on ISP pipe. [chroma pixel] */
+ unsigned int oxdim_y; /**< output block width for Y plane [pixel] */
+ unsigned int oydim_y; /**< output block height for Y plane [pixel] */
+ unsigned int oxdim_uv; /**< output block width for U/V plane [chroma pixel] */
+ unsigned int oydim_uv; /**< output block height for U/V plane [chroma pixel] */
+ ia_dvs2_gdc_hw_configuration hw_config; /**< GDC h/w configuration */
+} ia_dvs2_configuration;
+
+/** DVS2 text log setup.
+ * This structure contains the text log infomation.
+ */
+typedef struct {
+ const char *path; /**< path of log file */
+ int enable; /**< enable/disable of the log function */
+} ia_dvs2_log_setup;
+
+/** DVS2 binary dump data type.
+ * This enum contains the binary dump record data type.
+ */
+typedef enum {
+ eBDSupportConfig,
+ eBDGdcConfig,
+ eBDCharacteristics,
+ eBDBasicConfig,
+ eBDDigitalZoomRatio,
+ eBDDvisParam,
+ eBDGdcParam,
+ eBDMatMotion,
+ eBDMatRoll,
+ eBDTimeStamp,
+ eBDFrameCount,
+ eBDBorderFlag,
+ eBDMotionVector,
+ eBDVProd,
+ eBDHProd,
+ eBDLocalMotionDyn,
+ eBDLocalMotionDxn,
+ eBDLocalMotionWy,
+ eBDLocalMotionWx,
+ eBDVProdRawEvenReal,
+ eBDVProdRawEvenImag,
+ eBDVProdRawOddReal,
+ eBDVProdRawOddImag,
+ eBDHProdRawEvenReal,
+ eBDHProdRawEvenImag,
+ eBDHProdRawOddReal,
+ eBDHProdRawOddImag,
+ eBDCompMotionV,
+ eBDCompMotionH,
+ eBDMorphingTableYH,
+ eBDMorphingTableYV,
+ eBDMorphingTableUVH,
+ eBDMorphingTableUVV,
+ eBDsetNonBlankingRatio,
+ eBDsetMinLocalMotion,
+ eBDsetCutOffFrequency,
+ eBDsetDistortionCoeff,
+ eBDsetWaveLength,
+ eBDVelocity,
+ eBDPrevMotion,
+ eBDPrevDisplace,
+ eBDDisplaceLimit,
+ /*---------*/
+ eBDNumsItem
+ /* Do NOT add any items from here. */
+} ia_dvs2_binary_dump_item;
+
+/** DVS2 binary dump parameter.
+ * This structure contains parameter for binary dump.
+ */
+typedef struct {
+ int frames;
+ bool endless;
+ int binaryDumpFailed;
+} ia_dvs2_binary_dump_params;
+#endif // _IA_DVS2_TYPES_H_
diff --git a/include/ia_imaging/ia_dvs_2.h b/include/ia_imaging/ia_dvs_2.h
new file mode 100644
index 0000000..ef9b5ec
--- /dev/null
+++ b/include/ia_imaging/ia_dvs_2.h
@@ -0,0 +1,454 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/** @file ia_dvs2.h
+ * IA_DVS2. This provides access to the DVS2 Host Library.
+ */
+#ifndef _IA_DVS2_H_
+#define _IA_DVS2_H_
+
+#include <stdio.h>
+#include <linux/atomisp.h>
+#include "ia_dvs2_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** DVS2 State.
+ * Host code access to the DVS2 api with this.
+ */
+typedef struct t_dvs_facade ia_dvs2_state;
+
+/** @brief Get the DVS2 version.
+ *
+ * @param[out] version text: version
+ * @return 0 for no error, others for error.
+ *
+ * This function provides the version infomation of DVS2. It is allowed to call this
+ * function at anytime include before initialization of DVS2 library.
+ */
+LIBEXPORT ia_err
+dvs_get_version(const char **version);
+
+/** @brief Initialize the DVS2 module.
+ *
+ * @param[out] dvs2_state dvs2 state.
+ * This is a pointer to a pointer to a module.
+ * @param[in] log_setup log file setups.
+ * This is a pointer to a structure which contains
+ * log settings.
+ * @param[in] debug_env IA Imaging environment.
+ * This is a pointer to a structure which contains
+ * IA Imaging environment.
+ * @return 0 for no error, others for error.
+ *
+ * This function initializes the DVS2 module. This allocates and initializes
+ * internal data structures. This function must always be called before any
+ * other dvs2 function except dvs2_get_version is called.
+ */
+LIBEXPORT ia_err
+dvs_init(ia_dvs2_state **dvs2_state,
+ const ia_binary_data *a_aiq_tuning_binary,
+ const ia_cmc_t *cmc,
+ const ia_dvs2_log_setup *log_setup,
+ const ia_env *debug_env);
+
+/** @brief Configure the DVS2 module.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * @param[in] support_config support functionality configuration
+ * @param[in] gdc_config gdc configuration
+ * @param[in] characteristics dvs2 characteristics.
+ * @param[in] digital_zoom_ratio digital zoom ratio.
+ * @param[in] bd_params use binary dump.
+ * If not needed binary dump, then set this to NULL.
+ * @return 0 for no error, others for error.
+ *
+ * This function configures the DVS2 module. This allocates and initializes
+ * internal data structures. This function must always be called after dvs2_init
+ * and before any other dvs2 function is called.
+ */
+LIBEXPORT ia_err
+dvs_config(ia_dvs2_state *dvs2_state,
+ const ia_dvs2_configuration *config,
+ float digital_zoom_ratio,
+ ia_dvs2_binary_dump_params *bd_params);
+
+/** @brief Deinitialize the DVS module.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @return 0 for no error, others for error.
+ *
+ * This function deinitilizes the DVS2 module. This frees the calocated memory.
+ */
+LIBEXPORT ia_err
+dvs_deinit(ia_dvs2_state *dvs2_state);
+
+/** @brief allocate the DVS2 coefficients.
+ *
+ * @param[in] grid grid info for coefficients.
+ * @param[out] dvs_coefs Pointer to Pointer to hor/ver coefficients.
+ * @return 0 for no error, others for error.
+ *
+ * This function allocates the memory of dvs2 coefficients.
+ * allocates the structure: ia_css_dvs2_coefficients, and set the pointer into dvs_coefs.
+ * *dvs_coefs->grid field is filled by input.
+ * *dvs_coefs->hor_coefs, *dvs_coefs->ver_coefs are outputs.
+ * Each member of *dvs_coefs->hor_coefs, *dvs_coefs->ver_coefs are set to allocated memory.
+ */
+LIBEXPORT ia_err
+dvs_allocate_coefficients(const struct atomisp_dvs_grid_info *grid, struct atomisp_dis_coefficients **dvs_coefs);
+
+/** @brief Free the DVS2 coefficients.
+ *
+ * @param[in] dvs_coefs Pointer to hor/ver coefficients.
+ * @return 0 for no error, others for error.
+ *
+ * This function frees the memory of dvs2 coefficients.
+ * Each member of vs_coefs->hor_coefs, dvs_coefs->ver_coefs are freed also.
+ */
+LIBEXPORT ia_err
+dvs_free_coefficients(struct atomisp_dis_coefficients *dvs_coefs);
+
+/** @brief Get the DVS2 coefficients.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[out] dvs_coefs Pointer to hor/ver coefficients
+ * @return 0 for no error, others for error.
+ *
+ * This function gets the dvs2 coefficients
+ */
+LIBEXPORT ia_err
+dvs_get_coefficients(const ia_dvs2_state *dvs2_state, struct atomisp_dis_coefficients *dvs_coefs);
+
+/** @brief Allocate statistics buffer.
+ *
+ * @param[in] grid grid info for statistics.
+ * @param[out] statistics Pointer to pointer to Grid statistics from ISP
+ * @return 0 for no error, others for error.
+ *
+ * Returns allocated DVS statistics.
+ */
+LIBEXPORT ia_err
+dvs_allocate_statistics(const struct atomisp_dvs_grid_info *grid, struct atomisp_dvs2_statistics **statistics);
+
+/** @brief Free statistics buffer.
+ *
+ * @param[in] statistics Pointer to Grid statistics from ISP
+ * @return 0 for no error, others for error.
+ *
+ * Free the statistics buffer.
+ */
+LIBEXPORT ia_err
+dvs_free_statistics(struct atomisp_dvs2_statistics *statistics);
+
+/** @brief Set the DVS2 statistics.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] statistics Pointer to Grid statistics from ISP
+ * @return 0 for no error, others for error.
+ *
+ * This function receives the inner product from the ISP.
+ */
+LIBEXPORT ia_err
+dvs_set_statistics(ia_dvs2_state *dvs2_state, const struct atomisp_dvs2_statistics *statistics);
+
+/** @brief Execute DVS2 main process.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @return 0 for no error, others for error.
+ *
+ * This function processes the DVS2 main functionality. This generates a
+ * GDC morphing table.
+ */
+LIBEXPORT ia_err
+dvs_execute(ia_dvs2_state *dvs2_state);
+
+/** @brief allocate the DVS2 morphing table.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[out] morph_table Pointer to Pointer to morphing table.
+ * @return 0 for no error, others for error.
+ *
+ * This function allocates the memory of dvs2 morphing table.
+ * This allocates the struct atomisp_dvs_6axis_config itself, and the members in the structure.
+ */
+LIBEXPORT ia_err
+dvs_allocate_morph_table(ia_dvs2_state *dvs2Lib, struct atomisp_dvs_6axis_config **morph_table);
+
+/** @brief Free the DVS2 morphing table.
+ *
+ * @param[in] morph_table Pointer to morphing table.
+ * @return 0 for no error, others for error.
+ *
+ * This function frees the memory of dvs2 morphing table.
+ * Each allocated member in morph_table, and morph_table itself are freed.
+ */
+LIBEXPORT ia_err
+dvs_free_morph_table(struct atomisp_dvs_6axis_config *morph_table);
+
+/** @brief Get the GDC morphing table.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[out] morph_table Pointer to the GDC morph table
+ * @return 0 for no error, others for error.
+ *
+ * This function gets the calculated GDC morphing table.
+ */
+LIBEXPORT ia_err
+dvs_get_morph_table(ia_dvs2_state *dvs2_state,
+ struct atomisp_dvs_6axis_config *morph_table);
+
+/** @brief Output log of the GDC morphing table.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] log_path log file path.
+ * This is a pointer to a log file path.
+ * @return 0 for no error, others for error.
+ *
+ * This function outputs the calculated GDC morphing table log.
+ */
+LIBEXPORT ia_err
+dvs_morph_table_log(ia_dvs2_state *dvs2_state,
+ const char *log_path);
+
+/** @brief Set no blanking ratio.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] nonblanking_ratio non blanking ratio.
+ * Value 0.0 means no rolling shutter correction.
+ * @return 0 for no error, others for error.
+ *
+ * This function specifies the rolling shutter correction effect.
+ */
+LIBEXPORT ia_err
+dvs_set_non_blank_ratio(ia_dvs2_state *dvs2_state, float nonblanking_ratio);
+
+/** @brief Set the local motion coring threshold.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] min_local_motion local motion coring threshold.
+ * @return 0 for no error, others for error.
+ *
+ * This function specifies the local motion coring threshold.
+ */
+LIBEXPORT ia_err
+dvs_set_min_local_motion(ia_dvs2_state *dvs2_state, float min_local_motion);
+
+/** @brief Set Cut off frequency (for video only).
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] cutoff_frequency cut off frequency.
+ * @return 0 for no error, others for error.
+ *
+ * This function specifies the cut off frequency.
+ */
+LIBEXPORT ia_err
+dvs_set_cut_off_frequency(ia_dvs2_state *dvs2_state, float *cutoff_frequency);
+
+/** @brief Set digital zoom magnitude.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] magnitude digital zoom magnitude
+ * @return 0 for no error, others for error.
+ *
+ * This function specifies the digital zoom magnitude
+ */
+LIBEXPORT ia_err
+dvs_set_digital_zoom_magnitude(ia_dvs2_state *dvs2_state, float magnitude);
+
+/* */
+/** @brief Set Distortion Coefficient.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] distortion distortion coefficients.
+ * @return 0 for no error, others for error.
+ *
+ * This function specifies the distortion coefficient.
+ */
+LIBEXPORT ia_err
+dvs_set_distortion_coeff(ia_dvs2_state *dvs2_state, const ia_dvs2_distortion_coefs *distortion);
+
+/** @brief Set the wavelength of detector vector in BQs.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] wave_length wave length of detector vector in BQs.
+ * recommended: 1.0*AreaSize for DVS
+ * 0.5*AreaSize for DIS
+ * @return 0 for no error, others for error.
+ *
+ * This function specifies the avelength of detector vector.
+ * This re-calculates the coefficients, so should call dvs2_get_coefficients()
+ * after this was called.
+ */
+LIBEXPORT ia_err
+dvs_set_wave_length(ia_dvs2_state *dvs2_state, float wave_length);
+
+/** @brief Reset the inter_frame parameter.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @return 0 for no error, others for error.
+ *
+ * This function resets the inter_frame parameter.
+ */
+LIBEXPORT ia_err
+dvs_reset_interframe_parameter(ia_dvs2_state *dvs2_state);
+
+/** @brief Get the pointer to inner product.
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[out] v_product pointer to a pointer to the virtical inner product.
+ * @param[out] h_product pointer to a pointer to the horizontal inner product.
+ * @return 0 for no error, others for error.
+ *
+ * This function provides the pointer to the inner product.
+ */
+LIBEXPORT ia_err
+dvs_get_prod_ptr(const ia_dvs2_state *dvs2_state, float **v_product, float **h_product);
+
+/** @brief Set enable flag to main log module.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] enable Enable flag.
+ * @return 0 for no error, others for error.
+ *
+ * This function sets enable flag to main log module.
+ */
+LIBEXPORT ia_err
+dvs_set_enable_info_log(ia_dvs2_state *dvs2_state, int enable);
+
+/** @brief Set enable flag to GDC log module.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] enable Enable flag.
+ * @return 0 for no error, others for error.
+ *
+ * This function sets enable flag to GDC log module.
+ */
+LIBEXPORT ia_err
+dvs_set_enable_gdc_log(ia_dvs2_state *dvs2_state, int enable);
+
+/** @brief Set enable flag to FP log module.
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[in] enable Enable flag.
+ * @return 0 for no error, others for error.
+ *
+ * This function sets enable flag to FP log module.
+ */
+LIBEXPORT ia_err
+dvs_set_enable_fp_log(ia_dvs2_state *dvs2_state, int enable);
+
+/** @brief Check gdc constraints
+ *
+ * @param[in] dvs2_state dvs2 state.
+ * This is a pointer to a module.
+ * @param[out] valid 1 for gdc setup is valid, 0 for invalid.
+ * @param[in] gdc_hw_config GDC hardware configuration info.
+ * @return 0 for no error, others for error.
+ *
+ * This function checks whether gdc setup is valid or not.
+ */
+LIBEXPORT ia_err
+dvs_check_gdc_constraints(ia_dvs2_state *dvs2_state, int *valid, ia_dvs2_gdc_hw_configuration *gdc_hw_config);
+
+/** @brief Start dvs2 debug log.
+ *
+ * @param[in] endless true for endess mode, false for full-end mode.
+ * @return 0 for no error, others for error.
+ *
+ * This function sets enable to debug log.
+ * Endless mode dumps log into buffer circularly.
+ * Full-end mode dumps log into buffer by full.
+ * If buffer is full, stops to dump in full-end mode.
+ */
+LIBEXPORT ia_err
+dvs_start_dbglog(bool endless);
+
+/** @brief Stop dvs2 debug log.
+ *
+ * @return 0 for no error, others for error.
+ *
+ * This function sets disable to debug log.
+ */
+LIBEXPORT ia_err
+dvs_stop_dbglog(void);
+
+/** @brief Resets dvs2 debug log.
+ *
+ * @return 0 for no error, others for error.
+ *
+ * This function resets the buffer counter to 0 and clear the buffer (fill by 0).
+ * In full-end mode, log is activated again.
+ */
+LIBEXPORT ia_err
+dvs_reset_dbglog(void);
+
+/** @brief Denitiaize dvs2 debug log.
+ *
+ * @return 0 for no error, others for error.
+ *
+ * This function deinitializes dvs2 debug log.
+ */
+LIBEXPORT ia_err
+dvs_deinit_dbglog(void);
+
+/** @brief Set enable flag to item of binary dump.
+ *
+ * @param[in] item binary dump item.
+ * @param[in] enable Enable flag.
+ * @return 0 for no error, others for error.
+ *
+ * This function sets enable flag to item of binary dump.
+ */
+LIBEXPORT ia_err
+dvs_set_enable_dbglog_item(ia_dvs2_binary_dump_item item, bool enable);
+
+/** @brief Writes binary dump data into the file.
+ *
+ * @param[in] fp file pointer to be writen log.
+ * @return 0 for no error, others for error.
+ *
+ * This function writes log into the file.
+ */
+LIBEXPORT ia_err
+dvs_fwrite_dbglog(FILE *fp);
+
+LIBEXPORT ia_err
+dvs_dump_prods(ia_dvs2_state *dvs2_state, const struct atomisp_dvs2_statistics *dvs_stats);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_DVS2_H_ */
diff --git a/include/ia_imaging/ia_dvs_types.h b/include/ia_imaging/ia_dvs_types.h
new file mode 100644
index 0000000..fce6663
--- /dev/null
+++ b/include/ia_imaging/ia_dvs_types.h
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*!
+ * \file ia_dvs_types.h
+ * \brief Data types and enumerations for Intel DVS library.
+ */
+#ifndef _IA_DVS_TYPES_H_
+#define _IA_DVS_TYPES_H_
+#include <stdint.h>
+#include "ia_types.h"
+
+typedef struct t_dvs_facade ia_dvs_state;
+
+/** DVS Algorithm.
+ * These settings specify the members of correction axes.
+ * ia_dvs_algorihm_0_axis is a special mode. In this case, library does not compensate the
+ * motion, works for digital zoom and distortion correction.
+ */
+typedef enum
+{
+ ia_dvs_algorithm_0_axis = 0, /**< 0 axis, means video stabilization is turned off */
+ ia_dvs_algorithm_2_axis = 2, /**< 2 axis - x and y translations */
+ ia_dvs_algorithm_3_axis = 3, /**< 3 axis - x and y translations and z-scale*/
+ ia_dvs_algorithm_4_axis = 4, /**< 4 axis */
+ ia_dvs_algorithm_5_axis = 5, /**< 5 axis - x and y translations and all rotations*/
+ ia_dvs_algorithm_6_axis = 6, /**< 6 axis - x and y translations, z-scale and all rotations*/
+ ia_dvs_algorithm_max_axis = ia_dvs_algorithm_6_axis, /**< maximum axis */
+ ia_dvs_algorithm_motion_sensor = 10 /**< motion sensor based stabilization */
+} ia_dvs_algorithm_version;
+
+/** DVS2 BQ resolution.
+ * These parameter are BQ resolution configuration.
+ */
+typedef struct
+{
+ int width_bq; /**< width [BQ] */
+ int height_bq; /**< height [BQ] */
+} ia_dvs_bq_resolution;
+
+/** GDC Scan Mode
+ * These settings specify the gdc scan mode.
+ */
+typedef enum
+{
+ ia_dvs_gdc_scan_mode_stb = 0, /**< STB (slide to the bottom) */
+ ia_dvs_gdc_scan_mode_str, /**< STR (slide to the right) */
+} ia_dvs_gdc_scan_mode;
+
+/** GDC Interpolation Method
+ * These settings specify the gdc interpolation method.
+ */
+typedef enum
+{
+ ia_dvs_gdc_interpolation_nnd= 0, /**< NND (nearest neighbor) */
+ ia_dvs_gdc_interpolation_bli, /**< BLI (bilinear) */
+ ia_dvs_gdc_interpolation_bci, /**< BCI (bicubic) */
+ ia_dvs_gdc_interpolation_lut, /**< LUT (look up table) */
+} ia_dvs_gdc_interpolation;
+
+/** GDC Performance Point
+ * These settings specify the gdc performance point.
+ */
+typedef enum
+{
+ ia_dvs_gdc_performance_point_1x1= 0, /**< 1x1 */
+ ia_dvs_gdc_performance_point_2x1, /**< 2x1 */
+ ia_dvs_gdc_performance_point_1x2, /**< 1x2 */
+ ia_dvs_gdc_performance_point_2x2, /**< 2x2 */
+} ia_dvs_gdc_performance_point;
+
+/** GDC hardware configuration
+ * These parametes are the gdc hardware block configuration.
+ * dvs library use these parameters just check the gdc constraints,
+ * do NOT use these parameters for any controls nor calculations.
+ */
+typedef struct
+{
+ ia_dvs_gdc_scan_mode scan_mode;
+ ia_dvs_gdc_interpolation interpolation;
+ ia_dvs_gdc_performance_point performance_point;
+} ia_dvs_gdc_hw_configuration;
+
+/** GDC buffer configuration
+ * These parameters indicates the limits of the GDC ISP buffer.
+ * DVS needs to limit morphing table coordinates to fit inside GDC
+ * ISP buffer.
+ */
+typedef struct
+{
+ unsigned int x_offset; /* X offset [BQ] for the first pixel of image data */
+ unsigned int y_offset; /* Y offset [BQ] for the first pixel of image data*/
+ unsigned int width; /* Total width [BQ] for the buffer */
+ unsigned int height; /* Total height [BQ] for the buffer */
+} ia_dvs_gdc_buffer_config;
+
+/** Total cropping parameters
+ * These parameters contain sensor and ISP cropping information without any scaling or binning.
+ * In case of scaling before cropping, cropping params needs to be scaled back to the original resolution.
+ * This information is used to crop lens distortion grids accordingly.
+ */
+typedef struct
+{
+ unsigned int horizontal_crop_offset; /* Read out offset horizontal [BQ] */
+ unsigned int vertical_crop_offset; /* Read out offset vertical [BQ] */
+ unsigned int cropped_width; /* Width of cropped area without any scaling [BQ] */
+ unsigned int cropped_height; /* Height of cropped area without any scaling [BQ] */
+} ia_dvs_crop_params;
+
+/** DVS configuration.
+ * This structure contains DVS configuration.
+ */
+typedef struct
+{
+ ia_dvs_algorithm_version num_axis; /**< Algorithm mode */
+ float nonblanking_ratio; /**< Effective vertical scan ratio, used for rolling correction (Non-blanking ration of frame interval) */
+ ia_dvs_bq_resolution source_bq; /**< Input image size [BQ] for GDC block */
+ ia_dvs_bq_resolution output_bq; /**< Output image size [BQ] from GDC block */
+ ia_dvs_bq_resolution envelope_bq; /**< GDC effective envelope size [BQ] */
+ ia_dvs_bq_resolution ispfilter_bq; /**< Padding of the image which is corrupted and should not be visible in the output image [BQ] */
+ int gdc_shift_x; /**< Shift value of morphing table depend on ISP pipe. [chroma pixel] */
+ int gdc_shift_y; /**< Shift value of morphing table depend on ISP pipe. [chroma pixel] */
+ unsigned int oxdim_y; /**< Output block width for Y plane [pixel] */
+ unsigned int oydim_y; /**< Output block height for Y plane [pixel] */
+ unsigned int oxdim_uv; /**< Output block width for U/V plane [chroma pixel] */
+ unsigned int oydim_uv; /**< Output block height for U/V plane [chroma pixel] */
+ ia_dvs_gdc_hw_configuration hw_config; /**< GDC h/w configuration. DVS does not set these values anywhere so it's only
+ used when validating outgoing morphing table. */
+ bool use_lens_distortion_correction; /**< False disables LDC, true enables */
+ int frame_rate; /**< Frame rate */
+ ia_dvs_gdc_buffer_config gdc_buffer_config; /**< Configuration of the GDC buffer is used inside DVS to prevent morphing table to point
+ invalid memory locations in GDC.
+
+ This configuration should come from FW
+ to inform how large buffer is allocated for GDC processing.
+ Morphing table coordinates generated by DVS must fit inside
+ GDC buffer limits. GDC buffer is allocated by FW and
+ it needs to allocate extra padding for each side of the image data.
+ This allows DVS to generate morphing table which points are outside of the image area
+ but still inside GDC buffer (padding area). This might be the case e.g. if LDC grid is
+ barrel shaped. */
+ ia_dvs_crop_params crop_params; /**< Sensor and ISP cropping parameteres in native resolution (without any scaling or binning).
+ If scaling is performed before cropping, cropping offsets need to be calculated in native
+ resolution. Also if cropping is done in multiple places, everything needs to be combined
+ together.
+ Lens distortion correction is calculated from the full sensor resolution and
+ DVS needs to know how distortion grids need to be cropped so that they will match with
+ the GDC input image.*/
+ bool validate_morph_table; /**< False disables morph table validation, true enables. Morph table needs to be validated to
+ protect FW. Starting from IPU4 validation is performed in PAL. */
+} ia_dvs_configuration;
+
+/** Distortion grid configuration.
+ * Structure defines lens distortion grid.
+ */
+typedef struct
+{
+ int16_t GDC_col_start; /*!< Table X offset in pixels from left corner of the sensor maximum visible area.
+ e.g. If GDC_col_start=GDC_block_width*(-1)
+ then GDC table offset is is one block left compared to the maximum visible sensor area. */
+ int16_t GDC_row_start; /*!< Table Y offset in pixels from upper corner of the sensor maximum visible area.
+ e.g. If GDC_row_start=GDC_block_height*(-1)
+ then GDC table offset is is one block up compared to the maximum visible sensor area. */
+ int16_t GDC_grid_width; /*!< Indicates number of grid vertices on the horizontal axis. */
+ int16_t GDC_grid_height; /*!< Indicates number of grid vertices on the vertical axis. */
+ int16_t GDC_block_width; /*!< Width of the original grid cell (without correction). */
+ int16_t GDC_block_height; /*!< Height of the original grid cell (without correction). */
+ float *x_deltas; /*!< Table of x-axis deltas of the grid points. The delta at each point represents the distortion
+ that was done. Contains [GDC_grid_height x GDC_grid_width] values. */
+ float *y_deltas; /*!< Table of y-axis deltas of the grid points. The delta at each point represents the distortion
+ that was done. Contains [GDC_grid_height x GDC_grid_width] values. */
+} ia_dvs_distortion_config;
+
+/** DVS Motion vector structure.
+ * This structure contains definition for one local motion vector.
+ */
+typedef struct
+{
+ float x_start; /* Normalized X start position */
+ float y_start; /* Normalized Y start position */
+ float x_end; /* Normalized X end position */
+ float y_end; /* Normalized y end position */
+ float weight; /* Weight of the motion vector [0.0, 1.0]. Describes accuracy of the motion vector */
+} ia_dvs_motion_vector;
+
+/** DVS Motion vectors.
+ * This structure contains DVS statistics.
+ */
+typedef struct
+{
+ unsigned int vector_count; /* Number of motion vectors */
+ ia_dvs_motion_vector *motion_vectors; /* Table of local motion vectors. Contains [vector_count] values. */
+} ia_dvs_statistics;
+
+/** DVS morphing table structure.
+ * This structure contains morphing table which includes
+ * lens distortion correction, digital zoom, rolling shutter correction and video stabilization.
+ */
+typedef struct
+{
+ uint32_t width_y;
+ uint32_t height_y;
+ uint32_t width_uv;
+ uint32_t height_uv;
+ uint32_t *xcoords_y;
+ uint32_t *ycoords_y;
+ uint32_t *xcoords_uv;
+ uint32_t *ycoords_uv;
+ bool morph_table_changed;
+} ia_dvs_morph_table;
+
+/** Digital zoom mode
+ * These settings specify digital zoom mode.
+ */
+typedef enum {
+ ia_dvs_zoom_mode_center = 0,
+ ia_dvs_zoom_mode_region,
+ ia_dvs_zoom_mode_coordinate
+} ia_dvs_zoom_mode;
+
+/** DVS global translation parameters.
+ * This structure contains the frame-to-frame translations along x and y axes
+ * and also a coefficient for scene reliability in the range [0, 1] with 1 being
+ * totally reliable estimate and 0 being totally unreliable
+ */
+typedef struct
+{
+ uint32_t plane_translation_x;
+ uint32_t plane_translation_y;
+ float reliability_coefficient;
+} ia_dvs_global_translation;
+
+#endif /* _IA_DVS_TYPES_H_ */
diff --git a/include/ia_imaging/ia_exc.h b/include/ia_imaging/ia_exc.h
new file mode 100644
index 0000000..4bd453f
--- /dev/null
+++ b/include/ia_imaging/ia_exc.h
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_exc.h
+ * \brief Definitions of exposure parameters conversions between generic and sensor units.
+*/
+
+
+#ifndef IA_EXC_H_
+#define IA_EXC_H_
+
+#include "ia_types.h"
+#include "ia_aiq_types.h"
+#include "ia_cmc_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*!
+ * \brief Convert exposure time from generic units to sensor units (line & pixel values).
+ * AEC will use default formula for conversion, if not given
+ * \param[in] exposure_range Structure containing coarse and fine integration sensor register ranges. Can be set to NULL if not available.
+ * \param[in] sensor_descriptor Structure containing coarse and fine integration time limits and step size.
+ * \param[in] exposure_time_us Exposure time to convert.
+ * \param[out] coarse_integration_time Coarse (rows of integration) for rolling shutter cameras.
+ * \param[out] fine_integration_time Fine (pixels of integration remaining after coarse quantization) for rolling shutter cameras.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_exposure_time_to_sensor_units(
+ const cmc_exposure_range_t *exposure_range,
+ const ia_aiq_exposure_sensor_descriptor *sensor_descriptor,
+ const int exposure_time_us,
+ unsigned short *coarse_integration_time,
+ unsigned short *fine_integration_time);
+
+/*!
+ * \brief Convert analog gain from generic units to sensor units.
+ * Calculate analog gain code from analog gain, limiting it to the sensor specific values.
+ * \param[in] gain_conversion Structure containing analog gain to gain code conversion tables.
+ * \param[in] analog_gain Analog gain value to convert to sensor unit.
+ * \param[out] analog_gain_code Calculated analog gain code.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_analog_gain_to_sensor_units(
+ const cmc_parsed_analog_gain_conversion_t *gain_conversion,
+ const float analog_gain,
+ unsigned short *analog_gain_code);
+
+/*!
+ * \brief Converts digital gain from generic units to sensor units.
+ * AEC will use default formulae for conversion, if not given
+ * Converts digital gain value to sensor units, limiting the value according to sensor specific limits.
+ * \param[in] gain_conversion Structure containing digital gain to code mapping information.
+ * \param[in] digital_gain Digital gain in generic units.
+ * \param[out] digital_gain_code Calculated digital gain code.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_digital_gain_to_sensor_units(
+ const cmc_parsed_digital_gain_t *gain_conversion,
+ const float digital_gain,
+ unsigned short *digital_gain_code);
+
+/*!
+ * \brief Convert exposure time from sensor units to generic units.
+ * AEC will use default formula for conversion, if not given
+ * \param[in] sensor_descriptor Structure containing pixel clock frequency needed in exposure conversion.
+ * \param[in] coarse_integration_time Coarse (rows of integration) for rolling shutter cameras.
+ * \param[in] fine_integration_time Fine (pixels of integration remaining after coarse quantization) for rolling shutter cameras.
+ * \param[out] exposure_time Calculated exposure value in microseconds.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_sensor_units_to_exposure_time(
+ const ia_aiq_exposure_sensor_descriptor *sensor_descriptor,
+ const unsigned short coarse_integration_time,
+ const unsigned short fine_integration_time,
+ int *exposure_time);
+
+/*!
+ * \brief Convert analog gain from sensor units to generic units.
+ * Using the sensor characteristics info, calculate analog gain from sensor register values.
+ * \param[in] gain_conversion Structure containing analog gain to gain code conversion tables.
+ * \param[in] gain_code Analog gain code in sensor specific units.
+ * \param[out] analog_gain Calculated analog gain.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_sensor_units_to_analog_gain(
+ const cmc_parsed_analog_gain_conversion_t *gain_conversion,
+ const unsigned short gain_code,
+ float *analog_gain);
+
+/*!
+ * \brief Converts digital gain from sensor units to generic units.
+ * AEC will use default formula for conversion, if not given
+ * \param[in] gain_conversion Structure containing digital gain to code mapping information.
+ * \param[in] gain_code Digital gain code in sensor specific units.
+ * \param[out] digital_gain Calculated digital gain.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_sensor_units_to_digital_gain(
+ const cmc_parsed_digital_gain_t *gain_conversion,
+ const unsigned short code,
+ float *digital_gain);
+
+/*!
+ * \brief Gets analog gain and code based on current code.
+ * Offset is used to retrieve previous or next analog gain code pairs from the CMC analog gain conversion tables.
+ * \param[in] gain_conversion Structure containing analog gain to gain code conversion tables.
+ * \param[in] gain_code Analog gain code in sensor specific units.
+ * \param[in] gain_code_offset Offset of code to resolve (-1 or 1).
+ * \param[out] indexed_gain_code Analog gain code matching the offset.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_get_analog_gain_code(
+ const cmc_parsed_analog_gain_conversion_t *gain_conversion,
+ const unsigned short gain_code,
+ const int gain_code_offset,
+ unsigned short *indexed_gain_code);
+
+/*!
+ * \brief Converts ISO to analog gain and digital gain and codes.
+ * Gains are round down except if given ISO is smaller than corresponding gain 1.0.
+ * \param[in] analog_gain_conversion Structure containing analog gain to gain code conversion tables. Can be NULL, if sensor doesn't support analog gain.
+ * \param[in] digital_gain_conversion Structure containing digital gain to code mapping information. Can be NULL, if sensor doesn't support digital gain.
+ * \param[in] sensitivity Structure containing sensor sensitivity information.
+ * \param[in] iso ISO value to be converted into gains.
+ * \param[out] analog_gain Calculated analog gain.-1.0 if not available.
+ * \param[out] analog_gain_code Calculated analog gain code. -1 if not available.
+ * \param[out] digital_gain Calculated digital gain. -1.0 if not available.
+ * \param[out] digital_gain_code Calculated digital gain code. -1 if not available.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_convert_iso_to_gains(
+ const cmc_parsed_analog_gain_conversion_t *analog_gain_conversion,
+ const cmc_parsed_digital_gain_t *digital_gain_conversion,
+ const cmc_sensitivity_t *sensitivity,
+ const int iso,
+ float *analog_gain,
+ int *analog_gain_code,
+ float *digital_gain,
+ int *digital_gain_code);
+
+/*!
+ * \brief Converts analog gain and digital gain codes to ISO.
+ * \param[in] analog_gain_conversion Structure containing analog gain to gain code conversion tables. Can be NULL, if sensor doesn't support analog gain.
+ * \param[in] digital_gain_conversion Structure containing digital gain to code mapping information. Can be NULL, if sensor doesn't support digital gain.
+ * \param[in] sensitivity Structure containing sensor sensitivity information.
+ * \param[in] analog_gain_code Analog gain code. -1 if not available.
+ * \param[in] digital_gain_code Digital gain code. -1 if not available.
+ * \param[out] iso Analog and digital gain codes converted into ISO value. -1 if not available.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_exc_convert_gain_codes_to_iso(
+ const cmc_parsed_analog_gain_conversion_t *analog_gain_conversion,
+ const cmc_parsed_digital_gain_t *digital_gain_conversion,
+ const cmc_sensitivity_t *sensitivity,
+ const int analog_gain_code,
+ const int digital_gain_code,
+ int *iso);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IA_EXC_H_ */
diff --git a/include/ia_imaging/ia_face.h b/include/ia_imaging/ia_face.h
new file mode 100644
index 0000000..30ee1db
--- /dev/null
+++ b/include/ia_imaging/ia_face.h
@@ -0,0 +1,483 @@
+/*
+ * Copyright 2012-2017 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_FACE_H_
+#define _IA_FACE_H_
+
+/** @file ia_face.h
+ * This file declares structures and APIs of face related computer vision engines.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ia_types.h contains generic data types such as coordinate, rectangle etc */
+#include "ia_types.h"
+
+/** @brief Representing eyes.
+ * This structure represents the eye position and the blink state.
+ */
+typedef struct {
+ ia_coordinate position; /**< Position of the eye. */
+ int32_t blink_confidence; /**< Blink status in [0..100] range where 0 means wide open eye and 100 means fully closed eye.
+ negative integer means blink result is invalid (based on invalid ED position result) */
+} ia_eye;
+
+/** @brief Representing 3 dimensional point.
+ */
+typedef struct {
+ int32_t x;
+ int32_t y;
+ int32_t z;
+} ia_face_3d_coordinate;
+
+/** @brief Representing the result of Head Post Tracker.
+ */
+typedef struct {
+ int32_t processing_state; /**< Processing state. 0 : Internal preparation stage where result values are not valid. 1 : Initialized state. 2 : tracking state */
+ int32_t focal_length; /**< Focal length. */
+ ia_face_3d_coordinate rotation; /**< Rotation (in degree) movement of the head around x, y, z axis */
+ ia_face_3d_coordinate translation; /**< Translation movement of the head along x, y, z axis. */
+ ia_face_3d_coordinate head_hexahedron[8]; /**< Each vertex position of hexahedron being tracked. */
+ ia_face_3d_coordinate face_features[4]; /**< Face feature points (left eye, right eye, mouse left, mouse right) */
+ ia_coordinate head_hexahedron_2d[8];/**< 2D projected points of head hexahedron. */
+ ia_coordinate face_features_2d[4]; /**< 2D projected points of face feature points. */
+} ia_face_headpose;
+
+/** @brief Representing the face feature data for Face Recognition.
+ */
+typedef struct {
+ uint32_t id; /**< Unique id of the face feature data. */
+ int32_t data_size; /**< Size of the face feature data in bytes. */
+ int32_t person_id; /**< Unique id of the person associated with the face feature data. This MUST be positive. -1 means unknown person. */
+ uint32_t time_stamp; /**< Time stamp when the face feature was generated. */
+ int32_t condition; /**< Environmental information of the face. Currently not used. */
+ int32_t checksum; /**< Checksum of the face feature data. */
+ int32_t version; /**< Face recognizer version. */
+ uint8_t *data; /**< Face feature data. */
+} ia_face_feature;
+
+/** @brief Representing faces.
+ * This structure represents all information of a face supported by this engine library.
+ */
+typedef struct {
+ ia_rectangle face_area; /**< Bounding box of the face in the coordination system where (0,0) indicates left-top position. */
+ int32_t rip_angle; /**< RIP (rotation in plane) angle in degrees. */
+ int32_t rop_angle; /**< ROP (rotation out of plane) angle in degrees. */
+ int32_t tracking_id; /**< Tracking id of the face. */
+ int32_t confidence; /**< Confidence in face detection result. */
+ int32_t person_id; /**< Person id (typically positive number) of the face. Filled after face recognition. -1 if not recognized. */
+ int32_t similarity; /**< Similarity value between this face and the face in the database which was recognized as the person. */
+ int32_t best_ratio; /**< Indicates the ratio between the most similar face and the 2nd similar face. */
+ int32_t face_condition; /**< Indicates the light condition of the face. Not used at this moment. */
+ int32_t smile_state; /**< Smile state of the face. -1 : invalid info (based on invalid ED position result)
+ 0 : Non-smile, 1 : Smile, 2 : Start of the smile. Auxiliary variable for smile shutter. */
+ int32_t smile_score; /**< Smile score in the range of [0..100] where 0 is non-smile state and 100 is full smile state. */
+ ia_coordinate mouth; /**< Mid-point of the mouth. */
+ ia_eye left_eye; /**< Left eye */
+ ia_eye right_eye; /**< Right eye */
+ int32_t eye_validity; /**< Indicates whether a face was processed to get eye positions */
+ int32_t skin_type_dark_likelihood;/**< Likelihood of skin type being dark. Bright skin likelihood = 100 - dark_skin_type_likelihood */
+ int32_t skin_type_validity; /**< Validity of the Skin Likelihood */
+} ia_face;
+
+/** @brief Face state data.
+ * This structure is used to hold inputs and outputs of functions and also works as a handle of the engine instance.
+ */
+typedef struct {
+ int32_t num_faces; /**< Number of faces in the recently processed input frame. */
+ ia_face *faces; /**< Array of face information. */
+} ia_face_state;
+
+/** @brief Version of face engines
+ * Represents versions of each face engine.
+ */
+typedef struct {
+ ia_version detection_version; /**< the Face Detection version */
+ ia_version recognition_version; /**< the Face Recognition version */
+ ia_version smile_version; /**< the Smile Detection version */
+ ia_version blink_version; /**< the Blink Detection version */
+} ia_face_version;
+
+/** @brief Parameters for face engine.
+ * Used by ia_face_set_parameters() and ia_face_get_parameters() to indicate runtime engine configuration.
+ */
+typedef struct {
+ int32_t max_num_faces; /**< Maximum number of detectable faces in one frame. Default is 32. */
+ int32_t min_face_size; /**< Minimum size of face to detect. Default is 22. */
+ int32_t rip_coverage; /**< RIP (rotation in plane) coverage. */
+ int32_t rop_coverage; /**< ROP (rotation out of plane) coverage. */
+ int32_t max_computable_pixels; /**< Not for general usage. */
+ int32_t smile_sensitivity; /**< The smile sensitve level. Not for general usage. */
+ int32_t smile_threshold; /**< The smile threshold. Not for general usage. */
+} ia_face_parameters;
+
+/** @brief Initialize face engines.
+ *
+ * @param env [IN] platform environment parameters.
+ * @return face state data that will be used to hold results of subsequent API calls. Also works as a handle of the engines.
+ *
+ * This function will instantiate and initialize all face engines.
+ */
+LIBEXPORT
+ia_face_state *
+ia_face_init(const ia_env *env);
+
+/** @brief Destroy face engines.
+ *
+ * @param fs [IN] face state data associated with the engine which was created by ia_face_init().
+ *
+ * This funciton destroys face engines and deallocate all internal memory including ia_face_state struct itself.
+ */
+LIBEXPORT
+void
+ia_face_uninit(ia_face_state *fs);
+
+/** @brief Re-initialize existing face engines.
+ *
+ * @param fs [IN] face state data associated with the engine which was created by ia_face_init().
+ *
+ * This function initializes all face engines. After this call, all internal state will be initialized to the same state as ia_face_init() is called.
+ */
+LIBEXPORT
+void
+ia_face_reinit(ia_face_state *fs);
+
+
+/** @brief Reset all the contexts and results in the existing face engines.
+ *
+ * @param fs [IN] face state data associated with the engine which was created by ia_face_init().
+ *
+ * This function reset all the detected/recognized contexts. Note that the FR database will not be initialized.
+ */
+LIBEXPORT
+void
+ia_face_clear_result(ia_face_state *fs);
+
+/**
+ * @brief Get current version of face engines.
+ *
+ * @return a struct that contains version information of each face engine.
+ */
+LIBEXPORT
+ia_face_version
+ia_face_get_versions(void);
+
+/** @brief Set face parameterss.
+ *
+ * @param fs [IN] face state data.
+ * @param params [IN] parameters for face engines.
+ *
+ * This function is used to configure face engines. Please see the description of ia_face_parameters structure for the detail.
+ */
+LIBEXPORT
+ia_err
+ia_face_set_parameters(ia_face_state *fs, const ia_face_parameters *params);
+
+/** @brief Get current face parameters.
+ *
+ * @param fs [IN] face state data.
+ * @param params [OUT] a buffer that will hold face parameters.
+ *
+ */
+LIBEXPORT
+ia_err
+ia_face_get_parameters(ia_face_state *fs, ia_face_parameters *params);
+
+/** @brief Set the debug message level.
+ */
+LIBEXPORT
+void
+ia_face_set_debug_level(ia_face_state *fs, int32_t level);
+
+/** @brief Set acceleration APIs
+ *
+ * @param fs [INOUT] face state data. This is required to initiate acceleration.
+ * @param acc_api [IN] a structure which contains acceleration APIs. If NULL, acceleration will be made disabled.
+ *
+ * Enable or disable acceleration on the ISP. If this function is not called, face engine will work without acceleration.
+ */
+LIBEXPORT
+void
+ia_face_set_acceleration(ia_face_state *fs, const ia_acceleration *acc_api);
+
+/** @brief Try to detect faces from the input frame, assuming that the frame comes from the camera viewfinder.
+ *
+ * @param fs [INOUT] face state data. Face detection result will be filled after the call.
+ * @param frame [IN] a frame where the engine will try to detect faces from.
+ *
+ * This function tries to find faces from the input image. This function also uses information from the previous frames, so
+ * it is common practice to use this function to detect faces from the camera viewfinder.
+ */
+LIBEXPORT
+void
+ia_face_detect(ia_face_state *fs, const ia_frame *frame); /* uses face tracking and results of previous frame */
+
+/** @brief Try to detect faces from the input frame, assuming that the frame comes from a still image.
+ *
+ * @param fs [INOUT] face state data. Face detection result will be filled after the call.
+ * @param frame [IN] a frame where the engine will try to detect faces from.
+ *
+ * This function tries to find faces from the input image, typically a captured still image.
+ */
+LIBEXPORT
+void
+ia_face_detect_in_image(ia_face_state *fs, const ia_frame *frame);
+
+/** @brief Try to detect eye positions from the given input frame bounded by the face area.
+ *
+ * @param fs [INOUT] face state data. Eye detection result will be filled.
+ * @param frame [IN] a frame where the engine will try to detect eyes from.
+ *
+ * This function tries to find eye positions inside the face area of the input frame.
+ * Using face_area information in faces array in fs structure, this function will fill eye positions to left_eye and right_eye variable of corresponding structure.
+ * Therefore this function should be called only after face detection is performed.
+ */
+LIBEXPORT
+void
+ia_face_eye_detect(ia_face_state *fs, const ia_frame *frame);
+
+/** @brief Try to detect mouth position from the face area of the input frame.
+ *
+ * @param fs [INOUT] face state data. Mouth detection result will be filled.
+ * @param frame [IN] a frame where the engine will try to detect the mouth from.
+ *
+ * This function tries to find the center position of the mouth inside the face area of the input frame.
+ * Using face_area information in faces array in fs structure, this function will fill the mouth field of corresponding structure.
+ * As in case of eye detection, this function also should be called after face detection.
+ */
+LIBEXPORT
+void
+ia_face_mouth_detect(ia_face_state *fs, const ia_frame *frame);
+
+/** @brief Try to detect smile scores of each face in the input frame.
+ *
+ * @param fs [INOUT] face state data. Smile detection result will be filled into faces array.
+ * @param frame [IN] a frame where the faces are in.
+ *
+ * This function tries to find whether each face in the frame is smiling, and if yes, also tries to find how much.
+ * Face area and eye positions should be valid for calling this function to be meaningful.
+ */
+LIBEXPORT
+void
+ia_face_smile_detect(ia_face_state *fs, const ia_frame *frame);
+
+/** @brief Try to detect blink states of each face in the input frame.
+ *
+ * @param fs [INOUT] face state data. Blink detection result will be filled into faces array.
+ * @param frame [IN] a frame where the faces are in.
+ *
+ * This function tries to find whether each eye is closed or open as in the range of 0 to 100.
+ * Face area and eye positions should be valid for calling this function to be meaningful.
+ */
+LIBEXPORT
+void
+ia_face_blink_detect(ia_face_state *fs, const ia_frame *frame);
+
+/** @brief Try to recognize faces in the input frame.
+ *
+ * @param fs [INOUT] face state date. Recognition result will be filled into faces array.
+ * @param frame [IN] a frame that contains faces.
+ *
+ * For the face recognition to work properly, some preconditions should be met :
+ * - Face detection and eye detection results need to be valid.
+ * - Face recognition database (if exists) should be loaded by ia_face_set_feature_db() or ia_face_register_feature().
+ * - Using ISP acceleration is recommended to get the better/faster results.
+ *
+ * This function is intended to be used on the camera preview frames, which means this function also uses temporal information
+ * to get better recognition result. For recognizing faces in still images, use ia_face_recognize_in_image().
+ */
+LIBEXPORT
+void
+ia_face_recognize(ia_face_state *fs, const ia_frame *frame);
+
+/** @brief Try to recognize faces in the still image.
+ *
+ * @param fs [INOUT] face state data. Recognition result will be filled into faces array.
+ * @param frame [IN] a frame that contains faces.
+ *
+ * Works the same way as ia_face_recognize() except that this function should be used for still images.
+ */
+LIBEXPORT
+void
+ia_face_recognize_in_image(ia_face_state *fs, const ia_frame *frame);
+
+/** @brief Try to recognize a single face in the still image.
+ *
+ * @param fs [INOUT] face state data. Recognition result will be filled into faces array.
+ * @param frame [IN] a frame that contains a face.
+ * @param index_to_recognize [IN] index of the face to recognize. i.e. The face in fs->faces[index_to_recognize] will be processed.
+ * @param extracted_feature [OUT] face feature data generated inside the engine. Returned feature data ("data" field) is managed by the engine, so do not try to free it.
+ *
+ * This function will try to recognize the face at the specified index and return the result. Recognition result will be filled into the fs, and
+ * the face feature data is also returned via the structure so as the caller can store it into external database.
+ *
+ * As this function takes the face index to recognize, face detection must be done first. Calling eye detection is optional since it will be called internally
+ * if the result is not present in the fs structure.
+ */
+LIBEXPORT
+int32_t
+ia_face_recognize_single_in_image(ia_face_state *fs, const ia_frame *frame, int32_t index_to_recognize, ia_face_feature *extracted_feature);
+
+/** @brief Unregister (or delete) a face from the face recognition database.
+ *
+ * @param fs [IN] face state data.
+ * @param feature_id [IN] feature id of the face to unregister. This is returned value of ia_face_register_face().
+ *
+ * Delete the face from the face recognition database. Unregistered faces will not be used for recognizing other faces any more.
+ */
+LIBEXPORT
+ia_err
+ia_face_feature_unregister(ia_face_state *fs, int32_t feature_id);
+
+/** @brief Set/modify person_id of registered face.
+ *
+ * @param fs [IN] face state data.
+ * @param feature_id [IN] feature id of the face to modify. This is returned value of ia_face_register_face().
+ * @param person_id [IN] new person id
+ *
+ * This function modifies the person id of existing (already registered) face.
+ */
+LIBEXPORT
+ia_err
+ia_face_feature_set_person_id(ia_face_state *fs, int32_t feature_id, int32_t person_id);
+
+/** @brief Unregister (or delete) a person and all faces associated with the person.
+ *
+ * @param fs [IN] face state data.
+ * @param person_id [IN] person id to delete.
+ *
+ * This function thoroughly deletes a person and all faces registered with the person id from the face recognition database.
+ */
+LIBEXPORT
+ia_err
+ia_face_unregister_person(ia_face_state *fs, int32_t person_id);
+
+/** @brief Get the face recognition database in the memory as a byte stream.
+ *
+ * @param fs [IN] face state data.
+ * @param db_size [OUT] size of database bytestream in bytes.
+ * @param db_data [OUT] pointer to database bytestream. Memory is allocated inside this function.
+ *
+ * This function is typically used to store the face recognition database in the memory to the file system.
+ */
+LIBEXPORT
+ia_err
+ia_face_get_feature_db(ia_face_state *fs, int32_t *db_size, const uint8_t **db_data);
+
+/** @brief Set the given bytestream as the face recognition database.
+ *
+ * @param fs [IN] face state data.
+ * @param db_size [IN] size of the bytestream in bytes.
+ * @param db_data [IN] database bytestream.
+ *
+ * This function copies a bytestream to engine internal memory as the face recognition database.
+ * ia_face_register_feature() also can be used to copy one database entry into the memory.
+ */
+LIBEXPORT
+ia_err
+ia_face_set_feature_db(ia_face_state *fs, int32_t db_size, const uint8_t *db_data);
+
+/** @brief Register (store) the given face feature to the database in the memory.
+ * @deprecated
+ *
+ * @param fs [IN] face state data.
+ * @param new_feature [IN] feature data
+ * @param new_person_id [IN] person id associated with this face feature
+ * @param new_feature_id [IN] feature id associated with this face feature
+ * @param time_stamp [IN] timestamp of this face feature
+ * @param condition [IN] condition value
+ * @param checksum [IN] checksum value
+ * @param version [IN] version value
+ * @return feature id which is the same new_feature_id in case of success. Will be a negative value on error.
+ *
+ * This function copies one feature data to engine internal memory as the face recognition database.
+ * For bulk data, ia_face_set_feature_db() can be used.
+ * Users don't have to concern about meaning of parameters, but only need to pass each parameter as received
+ * from database manager (e.g. in case of Android, SQLite).
+ *
+ * This function is deprecated. Please use ia_face_register_face_feature() instead.
+ */
+LIBEXPORT
+int32_t
+ia_face_register_feature(ia_face_state* fs, const uint8_t *new_feature, int32_t new_person_id,
+ int32_t new_feature_id, int32_t time_stamp, int32_t condition, int32_t checksum, int32_t version);
+
+/** @brief Register (store) the given face feature to the database in the memory.
+ *
+ * @param fs [IN] face state data.
+ * @param feature_to_register [IN] face feature data to store.
+ *
+ * This function copies one feature data to internal face recognition database.
+ * Basically there are two use cases of this function :
+ * - At the engine initialization stage, use this function to copy face feature data from external database to internal database.
+ * - When a new photo is imported, use this function to register a newly detected/recognized face into database.
+ */
+LIBEXPORT
+int32_t
+ia_face_register_face_feature(ia_face_state *fs, const ia_face_feature *feature_to_register);
+
+/** @brief Detect/track headpose information from a face.
+ * @deprecated
+ *
+ * @param fs [IN] Face engine state data.
+ * @param headpose [OUT] Headpose information structure where output will be stored. Caller must manage the memory for this struct.
+ * @param frame [IN] Image frame with faces.
+ * @param tracking_id [IN] Tracking Id of the face as returned by ia_face_detect().
+ *
+ * This function detects/tracks the head pose information of a face inside the input frame. Please refer to ia_face_headpose structure for the available information.
+ * Before calling this function, face detection information should be available and the tracking id of the face to track headpose needs to be passed as an argument.
+ * However please note that once a face is detected by ia_face_detect(), the face information (ia_face struct) will not be used for headpose tracking, meaning that
+ * users don't need to call another ia_face_detect() for headpose tracking.
+ * If returned headpose->processing_state is zero, it means headpose tracking has failed and user needs to start over by calling face detection first.
+ */
+LIBEXPORT
+ia_err
+ia_face_track_headpose(ia_face_state *fs, ia_face_headpose *headpose, const ia_frame *frame, int32_t tracking_id);
+
+/** @brief Apply face beautification filter on the image.
+ *
+ * @param fs [IN] Face engine state data.
+ * @param output [OUT] Output frame where processed image will be stored. Caller must manage the memory for this.
+ * @param input [IN] Input frame to process.
+ * @param strength [IN] Specify the strength of the filter. Values between 0 (bypass) and 9 (strongest) can be specified.
+ *
+ * This function applies face beautification filter on the input image. Depending on the implementation, this function may use face detection information
+ * in the fs structure, in which case face detection may be called internally if it hasn't been called.
+ * Output frame must be allocated and freed by the caller.
+ */
+LIBEXPORT
+ia_err
+ia_face_beautify(ia_face_state *fs, ia_frame *output, const ia_frame *input, int32_t strength);
+
+/** @brief Find skin type likelihood from the faces already found.
+ *
+ * @param fs [IN] Face engine state data.
+ * @param frame [IN] a frame where the faces are in.
+ *
+ * This function attempts to detect the skin type of the faces which are already found and stored in the handle,
+ * results the dark-skin likelihood back to the member 'skin_type_dark_likelihood' and 'skin_type_validity' in each ia_faces.
+ */
+LIBEXPORT
+void
+ia_face_detect_skin(ia_face_state *fs, const ia_frame *frame);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_FACE_H_ */
diff --git a/include/ia_imaging/ia_ipf.h b/include/ia_imaging/ia_ipf.h
new file mode 100644
index 0000000..8473595
--- /dev/null
+++ b/include/ia_imaging/ia_ipf.h
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_IPF_H_
+#define _IA_IPF_H_
+
+/** @file ia_ipf.h
+ *
+*/
+
+#include <stdarg.h>
+
+#include "ia_types.h"
+#include "ia_ipf_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Pipe Line Header Information
+*/
+
+/**
+ * unique identifier for a buffer in the pipe line
+*/
+typedef struct {
+ ia_ipf_engine *engine; /**< */
+ int32_t index; /**< output index : for a provider the index ranges {0,M-1} for M outputs */
+ int32_t nesting_index; /**< output index to accommodates nesting levels for arrays */
+ ia_ipf_buffer_owner owner; /**< Indicator of the buffer owner - The owner can be a user app */
+} ia_ipf_pipe_engine_input;
+
+/**
+ * container structure for identifiers of one or multiple buffers involved in the pipe line
+*/
+typedef struct {
+ ia_ipf_pipe_engine_input *connection;
+ int32_t num_connections;
+} ia_ipf_pipe_engine_input_container;
+
+/**
+ * unique identifier for a buffer in the pipe line
+*/
+typedef struct {
+ int32_t index; /**< output index : for a provider the index ranges {0,M-1} for M outputs */
+ int32_t nesting_index; /**< output index to accommodates nesting levels for arrays */
+ int32_t num_users;
+ int32_t time_to_live;
+} ia_ipf_pipe_engine_output;
+
+/**
+ * container structure for identifiers of one or multiple buffers involved in the pipe line
+*/
+typedef struct {
+ ia_ipf_pipe_engine_output *connection;
+ int32_t num_connections;
+} ia_ipf_pipe_engine_output_container;
+
+/**
+ * Enum for states for io conn in the pipe line
+*/
+typedef enum {
+ ia_ipf_pipe_io_state_uninit,
+ ia_ipf_pipe_io_state_pipe_io,
+ ia_ipf_pipe_io_state_buf_list,
+ ia_ipf_pipe_io_state_eng_init,
+ ia_ipf_pipe_io_state_eng_execute,
+ ia_ipf_pipe_io_state_eng_destroy,
+ ia_ipf_pipe_io_state_buf_list_dealloc,
+ ia_ipf_pipe_io_state_pipe_io_dealloc,
+} ia_ipf_pipe_io_state;
+
+/**
+ * Enum for states of the pipe line
+*/
+typedef enum {
+ ia_ipf_pipe_state_uninit,
+ ia_ipf_pipe_state_created,
+ ia_ipf_pipe_state_finalized,
+ ia_ipf_pipe_state_processed,
+ ia_ipf_pipe_state_eng_init,
+ ia_ipf_pipe_state_eng_init_done,
+ ia_ipf_pipe_state_eng_exec,
+ ia_ipf_pipe_state_eng_exec_done,
+ ia_ipf_pipe_state_destroy,
+} ia_ipf_pipe_state;
+
+/**
+ * Declare IPF pipeline structure
+*/
+typedef struct ia_ipf_pipe_t ia_ipf_pipe;
+
+/**
+ * creation routine for a pipe line
+*/
+ia_err
+ia_ipf_pipe_create ( const char *name, int num_engines, ia_ipf_pipe **pipe);
+
+/**
+ * add engine to a pipe line
+ * inputs:
+ * 1. pipe line
+ * 2. engine to be added
+ * 3. container structure for buffer identifiers
+ * : this is sufficient to specify all input buffer connectivity for the engine
+ * outputs:
+ * engine_id
+ * : every engine on addition to the pipeline is assigned a unique engine ID which serially increments from 1
+ * return:
+ * error value
+ */
+ia_err
+ia_ipf_pipe_add_engine (ia_ipf_pipe *pipe, ia_ipf_engine *engine, ia_ipf_pipe_engine_input_container *inputs);
+
+/**
+ * set user input to a pipe line
+ * inputs:
+ * 1. pipe line
+ * 2. container structure for buffer identifiers
+ * : this lists all the buffer identifiers that exists in the pipeline which are provided by the user
+ * application as the input to the pipe line
+ * 3. container structure for input buffers
+ * : this specifies the actual input buffer with input data that is the user input to the pipeline that will be
+ * linked to the unique buffer identifiers that exists in the pipeline
+ * return:
+ * error value
+*/
+ia_err
+ia_ipf_pipe_set_input (ia_ipf_pipe *pipe, ia_ipf_engine *engine,
+ ia_ipf_buffer_list *output_buffers);
+
+/**
+ * Init engines in the pipeline
+*/
+void
+ia_ipf_pipe_init_engines (ia_ipf_pipe *pipe);
+
+/**
+ * execute the pipe line
+ * inputs:
+ * 1. pipe line
+ * outputs:
+ * 1. output type (void **)
+ * return:
+ * error value
+*/
+ia_err
+ia_ipf_pipe_execute_engines (ia_ipf_pipe *pipe,
+ ia_ipf_buffer_list **output_buffers);
+
+/**
+ * destroy the pipe line
+ * inputs:
+ * 1. pipe line
+ * return:
+ * error value
+*/
+ia_err
+ia_ipf_pipe_destroy (ia_ipf_pipe *pipe );
+
+/**
+ * IPF helper - create an identifier for a buffer
+*/
+ia_err
+ia_ipf_pipe_engine_input_container_create (ia_ipf_pipe_engine_input_container **engine_input_container,
+ ia_ipf_engine *engine,
+ int32_t src_index, int32_t src_subindex,
+ int32_t dest_index, int32_t dest_subindex,
+ int32_t num_connects);
+
+/**
+ * IPF helper - adds a identifier for a buffer to container
+*/
+ia_err
+ia_ipf_pipe_engine_input_container_add (ia_ipf_pipe_engine_input_container *engine_input_container,
+ ia_ipf_engine *engine,
+ int32_t src_index, int32_t src_subindex,
+ int32_t dest_index, int32_t dest_subindex);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_IPF_H_ */
+
diff --git a/include/ia_imaging/ia_ipf_buffer_container.h b/include/ia_imaging/ia_ipf_buffer_container.h
new file mode 100644
index 0000000..d366a0d
--- /dev/null
+++ b/include/ia_imaging/ia_ipf_buffer_container.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_IPF_BUFFER_CONTAINER_H_
+#define _IA_IPF_BUFFER_CONTAINER_H_
+
+#include "ia_ipf_types.h"
+#include "ia_ipf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ ia_ipf_container_alloc_header,
+ ia_ipf_container_alloc_data,
+} ia_ipf_container_alloc;
+
+/**
+ * IPF helper to populate header and data buffer container fields
+*/
+void
+ia_ipf_buffer_container_populate(ia_ipf_buffer_container *buffer_container, void *header, void *data);
+
+/**
+ * Helper function to get a buffer container from a frame. This function allocates
+ * the container that has to be freed by the user
+ */
+void
+ia_ipf_bufffer_container_from_frame (ia_ipf_buffer_container *buffer_container, ia_frame *frame);
+
+/**
+ * Helper function to get a ia_frame from an ia_ipf_buffer
+ */
+ia_frame *
+ia_ipf_buffer_container_to_frame (ia_ipf_buffer_container *buffer_container);
+
+/*
+ * Helper function to allocate memory for header and data field
+*/
+void
+ia_ipf_buffer_container_init (ia_ipf_buffer_container *buffer_container);
+
+/*
+ * Helper function to deallocate memfory for header and data field
+*/
+void
+ia_ipf_buffer_container_deinit (ia_ipf_buffer_container *buffer_container);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_IPF_BUFFER_CONTAINER_H_ */
+
diff --git a/include/ia_imaging/ia_ipf_buffer_list.h b/include/ia_imaging/ia_ipf_buffer_list.h
new file mode 100644
index 0000000..5462d7f
--- /dev/null
+++ b/include/ia_imaging/ia_ipf_buffer_list.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_IPF_BUFFER_LIST_H_
+#define _IA_IPF_BUFFER_LIST_H_
+
+#include "ia_ipf_types.h"
+#include "ia_ipf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * IPF helper function
+*/
+ia_ipf_buffer_list *
+ia_ipf_buffer_list_create_from_frame (ia_frame *inputframe);
+
+/**
+ * IPF helper function
+*/
+ia_err
+ia_ipf_buffer_list_create_from_descr (const ia_ipf_buffer_descr_list *descrs_list, ia_ipf_buffer_list **buf_list);
+
+/**
+ * IPF helper function to create buffer list
+*/
+ia_ipf_buffer_list *
+ia_ipf_buffer_list_create (const ia_ipf_buffer_descr_list *descrs_list);
+
+/**
+ * Helper function to free ipf buffer list
+*/
+void
+ia_ipf_buffer_list_destroy (ia_ipf_buffer_list *buffer_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_IPF_BUFFER_LIST_H_ */
+
diff --git a/include/ia_imaging/ia_ipf_types.h b/include/ia_imaging/ia_ipf_types.h
new file mode 100644
index 0000000..c203890
--- /dev/null
+++ b/include/ia_imaging/ia_ipf_types.h
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_IPF_TYPES_H_
+#define _IA_IPF_TYPES_H_
+
+/** @file ia_ipf_types.h
+ * This file contains data types for the Imaging Pipeline Framework (IPF).
+ * This framework provides functions to construct and execute pipelines
+ * consisting of so-called engines. Each pipeline stage executes one such
+ * engine.
+ * The engine structure defined in this file contains the interface that all
+ * IPF compatible engines need to implement.
+ * Each engine is expected to implement its own function to create an instance
+ * of such an engine.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "ia_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** The following macros define ranges for each of the IA imaging
+ * library's built-in IPF compatible modules. Each module
+ * will define its own buffer type identifiers for its own data
+ * types that are used for input, output or temporary (internal)
+ * buffers.
+ */
+#define IA_IPF_BUFFER_TYPES 0x00001000
+#define IA_CP_BUFFER_TYPES 0x00002000
+#define IA_FACE_BUFFER_TYPES 0x00003000
+#define IA_REDEYE_BUFFER_TYPES 0x00004000
+#define IA_ISP_BUFFER_TYPES 0x00005000
+/** Externally defined engines can define their own buffer
+ * types starting at this number. */
+#define IA_CUSTOM_BUFFER_TYPES 0x00100000
+
+/**
+ * Define specific buffer types below
+*/
+#define IA_IPF_BUFFER_TYPE_FRAME (IA_IPF_BUFFER_TYPES + 0)
+#define IA_IPF_BUFFER_TYPE_INT32 (IA_IPF_BUFFER_TYPES + 1)
+#define IA_FACE_BUFFER_TYPE_FACE_LIST (IA_FACE_BUFFER_TYPES + 0)
+
+typedef struct ia_ipf_buffer_container_t ia_ipf_buffer_container;
+typedef struct ia_ipf_buffer_container_descr_t ia_ipf_buffer_container_descr;
+
+/** Container type.
+ * This enum contains possible types of containers.
+ * Containers can either be a buffer or a buffer list.
+ */
+typedef enum {
+ ia_ipf_container_type_buffer,
+ ia_ipf_container_type_buffer_list,
+}ia_ipf_container_type;
+
+/** Buffer owner.
+ * This enum contains possible owners of buffers.
+ * Ownership is defined as the module that allocated the buffer.
+ * This means that the owner of the buffer is responsible for freeing
+ * the memory.
+ */
+typedef enum {
+ ia_ipf_buffer_owner_user, /**< Buffer is owned by the user of the IPF API */
+ ia_ipf_buffer_owner_framework, /**< Buffer is owned by the IPF implementation */
+ ia_ipf_buffer_owner_engine, /**< Buffer is owned by the firmware engine */
+} ia_ipf_buffer_owner;
+
+/** Compute resources.
+ * This is used in a number of places where we need to know whether code runs
+ * on a particular resource.
+ */
+typedef enum {
+ ia_ipf_resource_isp, /**< The ISP is the compute resource */
+ ia_ipf_resource_cpu, /**< The CPU is the compute resource */
+ ia_ipf_resource_num_resources,
+} ia_ipf_resource;
+
+/** IPF Buffer Descriptor.
+ * This structure describes various data buffers (for e.g. image frame) used by the IPF.
+ */
+typedef struct {
+ int32_t type; /**< Data type, module or user defined number */
+ ia_ipf_buffer_owner owner; /**< Indicator of the buffer owner. */
+ int32_t data_size; /**<< Size, in bytes, of the memory */
+ void *header;
+ int32_t header_size;
+} ia_ipf_buffer_descr;
+
+/** IPF Buffer Descriptor List
+ * This structure contains a list of buffer descriptors.
+ */
+typedef struct {
+ ia_ipf_buffer_container_descr *container_descrs;
+ int32_t num_container_descrs;
+} ia_ipf_buffer_descr_list;
+
+/** IPF Buffer.
+ * This structure contains an individual buffer
+ */
+typedef struct {
+ void *data; /**< Data pointer to raw pixel data */
+} ia_ipf_buffer;
+
+/** IPF Buffer list.
+ * This structure contains a list of buffers.
+ */
+typedef struct {
+ ia_ipf_buffer_container *buffer_containers; /**< Array of buffer containers */
+ int32_t num_buffers; /**< Number of buffers in the array */
+} ia_ipf_buffer_list;
+
+/** IPF Buffer Container Descriptor List.
+ * This structure describes the buffer container descriptor used in the IPF framework.
+ */
+struct ia_ipf_buffer_container_descr_t{
+ ia_ipf_container_type container_type; /**<< container type */
+ union {
+ ia_ipf_buffer_descr buffer_descr;
+ ia_ipf_buffer_descr_list buffer_descr_list;
+ }container; /**<< container descriptor */
+};
+
+/** IPF Buffer Container.
+ * This structure describes the buffer container used in the IPF framework.
+ */
+struct ia_ipf_buffer_container_t{
+ ia_ipf_buffer_container_descr container_descr; /**<< container descriptor */
+ union {
+ ia_ipf_buffer *buffer;
+ ia_ipf_buffer_list *buffer_list;
+ }container; /**<< container that holds a buffer or buffer list */
+};
+
+/** IPF Engine structure.
+ * This is the structure that each engine is required to implement in order to
+ * be compatbile with the IPF framework.
+ * Each engine is responsible for providing a function to create such an
+ * engine.
+ * Note that this describes an instance of an engine and each engine can be
+ * instantiated multiple times.
+ * Engines are free to allocate more memory than the size of this structure to
+ * hold internal state. This is why the destroy function in this structure
+ * must always be used to free the allocated memory; do not free this structure
+ * yourself.
+ */
+typedef struct ia_ipf_engine_t {
+ const char *isp_fw_file;
+ /**< Filename of the ISP firmware file. This will be NULL for non-ISP
+ engines. This filename should not include a path. */
+
+ const char *isp_fw_directory;
+ /**< Directory that contains the FW file. Built-in engines will have
+ this set to NULL in which case the IPF FW directory will be used.
+ Custom engines should specify the path themselves. */
+
+ ia_err (*init)(struct ia_ipf_engine_t *me,
+ const ia_ipf_buffer_list *input_buffers,
+ ia_ipf_buffer_descr_list **output_buffer_descrs_list,
+ ia_ipf_buffer_descr_list **temp_buffer_descrs_list,
+ int32_t load[ia_ipf_resource_num_resources]);
+ /**< Initialization function. This initializes this engine instance with
+ a set of input parameters (buffers). This function will fill in the
+ output_buffer_descrs_list, load and if the engine runs on the ISP,
+ the temp_buffers_descrs_list should also be filled in. The engine
+ framework will use this information to allocate all necessary
+ buffers. */
+
+ ia_err (*isp_preprocess)(struct ia_ipf_engine_t *me,
+ const ia_ipf_buffer_list *input_buffers,
+ const ia_ipf_buffer_list *output_buffers,
+ ia_ipf_buffer_list *temp_buffers);
+ /**< Pre-process arguments for ISP binary. ISP engines will fill
+ in this function pointer. CPU engines will set this to NULL.
+ This will convert input and output buffer pointers into the ISP
+ internal format which is stored in temp_buffers.
+ ISP engines need to implement this function because only the
+ temp_buffers are passed as arguments to the ISP FW. */
+
+ ia_err (*isp_postprocess)(struct ia_ipf_engine_t *me,
+ const ia_ipf_buffer_list *input_buffers,
+ ia_ipf_buffer_list *output_buffers,
+ const ia_ipf_buffer_list *temp_buffers);
+ /**< Post-process the ISP FW output, this step is optional.
+ When implemented, this function will peform some type of
+ post-processing on the ISP output before the CPU can use this
+ output data. */
+
+ ia_err (*execute)(struct ia_ipf_engine_t *me,
+ const ia_ipf_buffer_list *input_buffers,
+ ia_ipf_buffer_list *output_buffers,
+ ia_ipf_buffer_list *temp_buffers);
+ /**< Execute a CPU-only engine. ISP engines will be executed by the
+ framework implementation using the acceleration API; ISP
+ engines should set this pointer to NULL. */
+
+ ia_err (*cancel)(struct ia_ipf_engine_t *me,
+ ia_ipf_buffer_list *info);
+ /**< Cancel a CPU-only engine if it's currently running. If the
+ engine is not running when this function is called, this will
+ be a no-op. */
+
+ void (*destroy)(struct ia_ipf_engine_t *me);
+ /**< Destroy this engine instance. This will free any engine-owned
+ internal state as well as this structure. */
+} ia_ipf_engine;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_IPF_TYPES_H_ */
diff --git a/include/ia_imaging/ia_isp_2_2.h b/include/ia_imaging/ia_isp_2_2.h
new file mode 100644
index 0000000..2ac7d5f
--- /dev/null
+++ b/include/ia_imaging/ia_isp_2_2.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_isp_2_2.h
+ * \brief Hive ISP 2.2 specific implementation.
+*/
+
+
+#ifndef IA_ISP_2_2_H_
+#define IA_ISP_2_2_H_
+
+#include "ia_mkn_types.h"
+#include "ia_types.h"
+#include "ia_aiq_types.h"
+#include "ia_isp_types.h"
+#include "ia_cmc_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ia_isp_t ia_isp;
+
+/*!
+ * \brief Initialize IA_ISP and its submodules.
+ * This function must be called before any other function in the library. It allocates memories and parses ISP specific parts from CPFF.
+ * Initialization returns a handle to the ISP instance, which is given as input parameter for all the
+ * ISP functions.
+ *
+ * \param[in] aiqb_data Mandatory although function will not return error, if it not given.\n
+ * ISP Block from CPFF. Contains ISP specific parameters for ISP 1.5.
+ * \param[in] stats_max_width Mandatory.\n
+ * Maximum width of RGBS and AF statistics grids from ISP. Used to calculate size of
+ * memory buffers for the IA_AIQ algorithms. The same maximum width will be used for all RGBS
+ * and AF statistics grid allocations.
+ * \param[in] stats_max_height Mandatory.\n
+ * Maximum height of RGBS and AF statistics grids from ISP. Used to calculate size of
+ * memory buffers for the IA_AIQ algorithms. The same maximum height will be used for all RGBS
+ * and AF statistics grid allocations.
+ * \param[in] ia_cmc Mandatory.\n
+ * Parsed camera module characterization structure. Essential parts of the structure will be copied
+ * into internal structure.
+ * \param[in,out] ia_mkn Optional.\n
+ * Makernote handle which can be initialized with ia_mkn library. If debug data from AIQ is needed
+ * to be stored into EXIF, this parameter is needed. Algorithms will update records inside this makernote instance.
+ * Client writes the data into Makernote section in EXIF.
+ * return IA_AIQ handle. Use the returned handle as input parameter for the consequent IA_AIQ calls.
+ */
+LIBEXPORT ia_isp*
+ia_isp_2_2_init(const ia_binary_data *aiqb_data,
+ unsigned int stats_max_width,
+ unsigned int stats_max_height,
+ ia_cmc_t *ia_cmc,
+ ia_mkn *ia_mkn);
+
+/*!
+ * \brief De-initialize IA_ISP.
+ * All memory allocated by ISP are freed. ISP handle can no longer be used.
+ *
+ * \param[in] ia_isp Mandatory.\n
+ * ISP instance handle.
+ */
+LIBEXPORT void
+ia_isp_2_2_deinit(ia_isp *ia_isp);
+
+/*!
+ * \brief Input parameter structure for ISP.
+ */
+typedef struct
+{
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the AIC calculations (Preview, Still, video etc.). */
+ ia_aiq_frame_params *sensor_frame_params; /*!< Mandatory. Sensor frame parameters. Describe frame scaling/cropping done in sensor. */
+ ia_aiq_exposure_parameters *exposure_results; /*!< Mandatory. Exposure parameters which are to be used to calculate next ISP parameters. */
+ ia_aiq_awb_results *awb_results; /*!< Mandatory. WB results which are to be used to calculate next ISP parameters (WB gains, color matrix,etc). */
+ ia_aiq_gbce_results *gbce_results; /*!< Mandatory. GBCE Gamma tables which are to be used to calculate next ISP parameters.
+ If NULL pointer is passed, AIC will use static gamma table from the CPF. */
+ ia_aiq_pa_results *pa_results; /*!< Mandatory. Parameter adaptor results from AIQ. */
+ uint32_t isp_vamem_type; /*!< Mandatory. ISP vamem type. */
+ ia_isp_feature_setting nr_setting; /*!< Mandatory. Feature setting for noise reduction algorithms. */
+ ia_isp_feature_setting ee_setting; /*!< Mandatory. Feature setting for edge enhancement algorithms. */
+ char manual_brightness; /*!< Optional. Manual brightness value range [-128,127]. */
+ char manual_contrast; /*!< Optional. Manual contrast value range [-128,127]. */
+ char manual_hue; /*!< Optional. Manual hue value range [-128,127]. */
+ char manual_saturation; /*!< Optional. Manual saturation value range [-128,127]. */
+ ia_isp_effect effects; /*!< Optional. Manual setting for special effects. Combination of ia_isp_effect enums.*/
+ bool reduced_range_yuv; /*!< Mandatory. false configures ISP to output full YUV range data [0,255], true configures ISP to output BT601 reduced YUV range data. */
+ ia_aiq_frame_params *isp_frame_params; /*!< Optional. Image output resolution and information about scaling done for the image in the ISP. NULL if not available. */
+ int *custom_tunings_list; /*!< Optional. Array of indices for tunings selected by the user. Tunings are applied in the order they
+ are listed in the array. Indices must match ISP tunings defined in CPF. Index 0 must be last
+ in the list, which indicates the end of custom tunings. */
+ ia_aiq_sa_results *sa_results; /*!< Mandatory. Shading adaptor results from AIQ. */
+} ia_isp_2_2_input_params;
+
+/*!
+ * \brief ISP configuration for the next frame
+ * Computes ISP parameters from input parameters and CPF values for the next image.
+ *
+ * \param[in] ia_isp Mandatory.\n
+ * ISP instance handle.
+ * \param[in] ia_isp_2_2_input_params Mandatory.\n
+ * Input parameters for ISP calculations.
+ * \return Binary data structure with pointer to the ISP configuration structure.
+ */
+LIBEXPORT ia_err
+ia_isp_2_2_run(ia_isp *ia_isp,
+ const ia_isp_2_2_input_params *isp_input_params,
+ ia_binary_data *output_data);
+
+
+/*!
+ * \brief Converts ISP specific statistics to IA_AIQ format.
+ * ISP generated statistics may not be in the format in which AIQ algorithms expect. Statistics need to be converted
+ * from various ISP formats into AIQ statistics format.
+ *
+ * \param[in] ia_isp Mandatory.\n
+ * ISP instance handle.
+ * \param[in] statistics Mandatory.\n
+ * Statistics in ISP specific format.
+ * \param[out] out_rgbs_grid Mandatory.\n
+ * Pointer's pointer where address of converted statistics are stored.
+ * Converted RGBS grid statistics. Output can be directly used as input in function ia_aiq_statistics_set.
+ * \param[out] out_af_grid Mandatory.\n
+ * Pointer's pointer where address of converted statistics are stored.
+ * Converted AF grid statistics. Output can be directly used as input in function ia_aiq_statistics_set.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_isp_2_2_statistics_convert(ia_isp *ia_isp,
+ void *statistics,
+ ia_aiq_rgbs_grid **out_rgbs_grid,
+ ia_aiq_af_grid **out_af_grid);
+
+
+/*!
+ * \brief Get version.
+ * Get version from version header.
+ *
+ * \return Version string.
+ */
+LIBEXPORT const char* ia_isp_2_2_get_version(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IA_ISP_2_2_H_ */
diff --git a/include/ia_imaging/ia_isp_2_7.h b/include/ia_imaging/ia_isp_2_7.h
new file mode 100644
index 0000000..efb9baa
--- /dev/null
+++ b/include/ia_imaging/ia_isp_2_7.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_isp_2_7.h
+ * \brief Hive ISP 2.7 specific implementation.
+*/
+
+
+#ifndef IA_ISP_2_7_H_
+#define IA_ISP_2_7_H_
+
+#include "ia_mkn_types.h"
+#include "ia_abstraction.h"
+#include "ia_types.h"
+#include "ia_aiq_types.h"
+#include "ia_isp_types.h"
+#include "ia_cmc_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ia_isp_t ia_isp;
+
+/*!
+ * \brief Initialize IA_ISP and its submodules.
+ * This function must be called before any other function in the library. It allocates memories and parses ISP specific parts from CPFF.
+ * Initialization returns a handle to the ISP instance, which is given as input parameter for all the
+ * ISP functions.
+ *
+ * \param[in] aiqb_data Mandatory although function will not return error, if it not given.\n
+ * ISP Block from CPFF. Contains ISP specific parameters for ISP 1.5.
+ * \param[in] stats_max_width Mandatory.\n
+ * Maximum width of RGBS and AF statistics grids from ISP. Used to calculate size of
+ * memory buffers for the IA_AIQ algorithms. The same maximum width will be used for all RGBS
+ * and AF statistics grid allocations.
+ * \param[in] stats_max_height Mandatory.\n
+ * Maximum height of RGBS and AF statistics grids from ISP. Used to calculate size of
+ * memory buffers for the IA_AIQ algorithms. The same maximum height will be used for all RGBS
+ * and AF statistics grid allocations.
+ * \param[in] ia_cmc Mandatory.\n
+ * Parsed camera module characterization structure. Essential parts of the structure will be copied
+ * into internal structure.
+ * \param[in,out] ia_mkn Optional.\n
+ * Makernote handle which can be initialized with ia_mkn library. If debug data from AIQ is needed
+ * to be stored into EXIF, this parameter is needed. Algorithms will update records inside this makernote instance.
+ * Client writes the data into Makernote section in EXIF.
+ * return IA_AIQ handle. Use the returned handle as input parameter for the consequent IA_AIQ calls.
+ */
+LIBEXPORT ia_isp*
+ia_isp_2_7_init(const ia_binary_data *aiqb_data,
+ unsigned int stats_max_width,
+ unsigned int stats_max_height,
+ ia_cmc_t *ia_cmc,
+ ia_mkn *ia_mkn);
+
+/*!
+ * \brief De-initialize IA_ISP.
+ * All memory allocated by ISP are freed. ISP handle can no longer be used.
+ *
+ * \param[in] ia_isp Mandatory.\n
+ * ISP instance handle.
+ */
+LIBEXPORT void
+ia_isp_2_7_deinit(ia_isp *ia_isp);
+
+/*!
+ * \brief Input parameter structure for ISP.
+ */
+typedef struct
+{
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the AIC calculations (Preview, Still, video etc.). */
+ ia_aiq_frame_params *sensor_frame_params; /*!< Mandatory. Sensor frame parameters. Describe frame scaling/cropping done in sensor. */
+ ia_aiq_exposure_parameters *exposure_results; /*!< Mandatory. Exposure parameters which are to be used to calculate next ISP parameters. */
+ ia_aiq_awb_results *awb_results; /*!< Mandatory. WB results which are to be used to calculate next ISP parameters (WB gains, color matrix,etc). */
+ ia_aiq_gbce_results *gbce_results; /*!< Mandatory. GBCE Gamma tables which are to be used to calculate next ISP parameters.
+ If NULL pointer is passed, AIC will use static gamma table from the CPF. */
+ ia_aiq_pa_results *pa_results; /*!< Mandatory. Parameter adaptor results from AIQ. */
+ ia_aiq_sa_results *sa_results; /*!< Mandatory. Shading adaptor results from AIQ. */
+ uint32_t isp_vamem_type; /*!< Mandatory. ISP vamem type. */
+ ia_isp_feature_setting nr_setting; /*!< Mandatory. Feature setting for noise reduction algorithms. */
+ ia_isp_feature_setting ee_setting; /*!< Mandatory. Feature setting for edge enhancement algorithms. */
+ char manual_brightness; /*!< Optional. Manual brightness value range [-128,127]. */
+ char manual_contrast; /*!< Optional. Manual contrast value range [-128,127]. */
+ char manual_hue; /*!< Optional. Manual hue value range [-128,127]. */
+ char manual_saturation; /*!< Optional. Manual saturation value range [-128,127]. */
+ ia_isp_effect effects; /*!< Optional. Manual setting for special effects. Combination of ia_isp_effect enums.*/
+ bool reduced_range_yuv; /*!< Mandatory. false configures ISP to output full YUV range data [0,255], true configures ISP to output BT601 reduced YUV range data. */
+ ia_aiq_frame_params *isp_frame_params; /*!< Optional. Image output resolution and information about scaling done for the image in the ISP. NULL if not available. */
+ int *custom_tunings_list; /*!< Optional. Array of indices for tunings selected by the user. Tunings are applied in the order they
+ are listed in the array. Indices must match ISP tunings defined in CPF. Index 0 must be last
+ in the list, which indicates the end of custom tunings. */
+} ia_isp_2_7_input_params;
+
+/*!
+ * \brief Record header for AIC output .
+ */
+typedef struct {
+ int uuid;
+ int size;
+} record_header;
+
+
+/*!
+ * \brief ISP configuration for the next frame
+ * Computes ISP parameters from input parameters and CPF values for the next image.
+ *
+ * \param[in] ia_isp Mandatory.\n
+ * ISP instance handle.
+ * \param[in] ia_isp_2_7_input_params Mandatory.\n
+ * Input parameters for ISP calculations.
+ * \return Binary data structure with pointer to the ISP configuration structure.
+ */
+LIBEXPORT ia_err
+ia_isp_2_7_run(ia_isp *ia_isp,
+ const ia_isp_2_7_input_params *isp_input_params,
+ ia_binary_data *output_data);
+
+
+/*!
+ * \brief Converts ISP specific statistics to IA_AIQ format.
+ * ISP generated statistics may not be in the format in which AIQ algorithms expect. Statistics need to be converted
+ * from various ISP formats into AIQ statistics format.
+ *
+ * \param[in] ia_isp Mandatory.\n
+ * ISP instance handle.
+ * \param[in] statistics Mandatory.\n
+ * Statistics in ISP specific format.
+ * \param[out] out_rgbs_grid Mandatory.\n
+ * Pointer's pointer where address of converted statistics are stored.
+ * Converted RGBS grid statistics. Output can be directly used as input in function ia_aiq_statistics_set.
+ * \param[out] out_af_grid Mandatory.\n
+ * Pointer's pointer where address of converted statistics are stored.
+ * Converted AF grid statistics. Output can be directly used as input in function ia_aiq_statistics_set.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_isp_2_7_statistics_convert(ia_isp *ia_isp,
+ void *statistics,
+ ia_aiq_rgbs_grid **out_rgbs_grid,
+ ia_aiq_af_grid **out_af_grid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IA_ISP_2_7_H_ */
diff --git a/include/ia_imaging/ia_isp_bxt_deprecated.h b/include/ia_imaging/ia_isp_bxt_deprecated.h
new file mode 100644
index 0000000..863a702
--- /dev/null
+++ b/include/ia_imaging/ia_isp_bxt_deprecated.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_isp_bxt_deprecated.h
+ * \brief ia_isp_bxt specific implementation.
+*/
+
+#ifndef IA_ISP_BXT_DEPRECATED_H_
+#define IA_ISP_BXT_DEPRECATED_H_
+
+#include "ia_aiq_types.h"
+#include "ia_types.h"
+#include "ia_isp_bxt_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBEXPORT ia_err
+ia_isp_bxt_statistics_convert_awb_from_binary(
+ ia_isp_bxt *ia_isp_bxt,
+ const ia_binary_data *statistics,
+ ia_aiq_rgbs_grid **out_rgbs_grid);
+
+LIBEXPORT ia_err
+ia_isp_bxt_statistics_convert_awb(
+ ia_isp_bxt *ia_isp_bxt,
+ unsigned int stats_width,
+ unsigned int stats_height,
+ void *c0_avg,
+ void *c1_avg,
+ void *c2_avg,
+ void *c3_avg,
+ void *c4_avg,
+ void *c5_avg,
+ void *c6_avg,
+ void *c7_avg,
+ void *sat_ratio_0,
+ void *sat_ratio_1,
+ void *sat_ratio_2,
+ void *sat_ratio_3,
+ ia_aiq_rgbs_grid **out_rgbs_grid);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IA_ISP_BXT_DEPRECATED_H_ */
diff --git a/include/ia_imaging/ia_isp_ipf.h b/include/ia_imaging/ia_isp_ipf.h
new file mode 100644
index 0000000..8a806a6
--- /dev/null
+++ b/include/ia_imaging/ia_isp_ipf.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _IA_ISP_IPF_H_
+#define _IA_ISP_IPF_H_
+
+#include "ia_ipf_types.h"
+
+ia_ipf_engine* ia_isp_capture_pp_create(void);
+
+#endif /* _IA_ISP_IPF_H_ */
diff --git a/include/ia_imaging/ia_isp_types.h b/include/ia_imaging/ia_isp_types.h
new file mode 100644
index 0000000..ab23b6f
--- /dev/null
+++ b/include/ia_imaging/ia_isp_types.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_isp_types.h
+ * \brief Common ISP enumerations and structures.
+*/
+
+
+#ifndef IA_ISP_TYPES_H_
+#define IA_ISP_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \brief Complexity level for ISP features.
+ */
+typedef enum
+{
+ ia_isp_feature_level_off, /* Feature is turned off */
+ ia_isp_feature_level_low, /* Minimum set of algorithms are used */
+ ia_isp_feature_level_high /* Maximum set of algorithms are used */
+} ia_isp_feature_level;
+
+/*!
+ * \brief Custom control parameters for tuning interpolation in GAIC
+ *
+ * GAIC implements generic interpolations of tuning parameters as factor of certain run-time changing parameter.
+ * This structure defines custom run-time changeable control parameters, which can be used in tuning interpolations.
+ */
+typedef struct
+{
+ int count; /*!< Length of parameters array. */
+ float *parameters; /*!< Parameters used in calculation (interpolation) of tuning values.
+ The first element of the array corresponds custom tuning 0,
+ second corresponds with custom tuning 1 etc.*/
+} ia_isp_custom_controls;
+
+/*!
+ * \brief Definitions for the color effects.
+ */
+typedef enum
+{
+ ia_isp_effect_none = 0,
+ ia_isp_effect_sky_blue = (1 << 0),
+ ia_isp_effect_grass_green = (1 << 1),
+ ia_isp_effect_skin_whiten_low = (1 << 2),
+ ia_isp_effect_skin_whiten = (1 << 3),
+ ia_isp_effect_skin_whiten_high = (1 << 4),
+ ia_isp_effect_sepia = (1 << 5),
+ ia_isp_effect_black_and_white = (1 << 6),
+ ia_isp_effect_negative = (1 << 7),
+ ia_isp_effect_vivid = (1 << 8),
+ ia_isp_effect_invert_gamma = (1 << 9),
+ ia_isp_effect_grayscale = (1 << 10),
+ ia_isp_effect_aqua = (1 << 11)
+} ia_isp_effect;
+
+/*!
+ * \brief Settings for feature level and strength.
+ */
+typedef struct
+{
+ ia_isp_feature_level feature_level; /* Feature level */
+ char strength; /* Setting for the strength [-128,127]. */
+} ia_isp_feature_setting;
+
+/* Thresholds to extract data of given range from statistics. Used to split combined WDR statistics into several low dynamic range statistics. */
+typedef struct
+{
+ float low;
+ float high;
+ float scale;
+} ia_isp_stat_split_thresh;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IA_ISP_TYPES_H_ */
diff --git a/include/ia_imaging/ia_log.h b/include/ia_imaging/ia_log.h
new file mode 100644
index 0000000..74a32d1
--- /dev/null
+++ b/include/ia_imaging/ia_log.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ia_types.h"
+
+#ifndef _IA_LOG_H_
+#define _IA_LOG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __func__
+#define __func__ __FUNCTION__
+#endif
+
+/*!
+ * \brief Macro for not logging.
+ */
+#define IA_NOLOG(...) ((void)0)
+
+/*!
+ * \brief Macro wrapper for ia_log function.
+ */
+#define IA_LOG(level, fmt, ...) ((void)ia_log(level, fmt, ## __VA_ARGS__))
+
+/*!
+ * \brief Logging levels.
+ */
+typedef enum
+{
+ ia_log_error,
+ ia_log_debug,
+ ia_log_info,
+} ia_log_level;
+
+/*!
+ * \brief Initializes ia_log library with external function pointers for logging.
+ * If this function is not called, logging will be directed to stdout and stderr.
+ *
+ * \param[in] a_env_ptr Structure containing the addresses to logging functions.
+ * If NULL is passed as function pointer, there won't be log prints.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_log_init(ia_env *a_env_ptr);
+
+/*!
+ * \brief Prints formatted string.
+ *
+ *
+ * \param[in] level Log level.
+ * \param[in] fmt Format string.
+ * \param[in] ... Variables to be printed out as defined by the format string.
+ */
+LIBEXPORT void
+ia_log(ia_log_level level, const char *fmt, ...);
+
+/*!
+ * \brief Prints formatted string with interpreted error code.
+ *
+ *
+ * \param[in] error Error code.
+ * \return Pointer to all Error string.
+ */
+LIBEXPORT const char *
+ia_log_strerror(ia_err error);
+
+/*!
+ * \brief De-initialization of ia_log library.
+ * Must be called if ia_log_init() was called.
+ */
+LIBEXPORT void
+ia_log_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_LOG_H_ */
diff --git a/include/ia_imaging/ia_ltm.h b/include/ia_imaging/ia_ltm.h
new file mode 100644
index 0000000..999b179
--- /dev/null
+++ b/include/ia_imaging/ia_ltm.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \mainpage IA LTM API documentation
+ *
+ * Browse Files and Classes tabs for details.
+ *
+ * \section general General info
+ *
+ * \section init Initialization of LTM library
+ *
+ * \copybrief ia_ltm_init
+ * To create an instance of LTM library one must call function:
+ * \code ia_ltm_init \endcode
+ * \copydetails ia_ltm_init
+ *
+ * <br><hr><br>
+ */
+/*!
+ * \file ia_ltm.h
+ * \brief Definitions and declarations of Intel LTM library.
+ */
+
+
+#ifndef _IA_LTM_H_
+#define _IA_LTM_H_
+
+#include "ia_ltm_types.h"
+#include "ia_types.h"
+#include "ia_aiq_types.h"
+#include "ia_mkn_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \brief Initialize IA_LTM.
+ * This function must be called before any other function in the library. It allocates memories for all LTM algorithms based on input parameters
+ * given by the user. Tuning parameters are parsed from AIQB and saved for LTM algorithms to use. Initialization returns a handle to the LTM instance,
+ * which is given as input parameter for other functions to access object data. Therefore, multiple instances of LTM library can running simultaneously.
+ * For example one instance per camera.
+ *
+ * \param[in] aiqb_data Mandatory although function will not return error, if it not given.\n
+ * AIQB Block from CPFF. Contains tuning parameters for AIQ, ISP and LTM algorithms.
+ * \param[in,out] ia_mkn Optional.\n
+ * Makernote handle which can be initialized with ia_mkn library. If debug data from LTM is needed
+ * to be stored into EXIF, this parameter is needed. Algorithms will update records inside this makernote instance.
+ * Client writes the data into Makernote section in EXIF.
+ * return IA_LTM handle. Use the returned handle as input parameter for the consequent IA_LTM calls.
+ */
+LIBEXPORT ia_ltm*
+ia_ltm_init(const ia_binary_data *aiqb_data,
+ ia_mkn *ia_mkn);
+
+/*!
+ * \brief De-initialize IA_LTM.
+ * All memory allocated by LTM algorithms is freed. LTM handle can no longer be used.
+ *
+ * \param[in] ia_ltm Mandatory.\n
+ * LTM instance handle.
+ */
+LIBEXPORT void
+ia_ltm_deinit(ia_ltm *ia_ltm);
+
+/*!
+ * \brief Input parameter structure for LTM/DRC algorithm.
+ * Although all the input statistics and image are optional, one of them is always needed.
+ * While certain LTM algorithms (selectable from tunings) can utilize different input, all algorithms can operate on ia_ltm_input_image data.
+ * Notice that input image or statistics may or may not contain WB gains and CCM applied.
+ */
+typedef struct ia_ltm_input_params
+{
+ ia_ltm_level ltm_level; /*!< Mandatory. LTM level. -1 to use tuning defaults.*/
+ ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the LTM calculations (Preview, Still, video etc.). */
+ float ev_shift; /*!< Optional. Exposure Value shift [-4,4]. */
+ char ltm_strength_manual; /*!< Optional. user defined manual control for ltm strength, will be casted into unsigned char, [0, 200], default is 100 and means no manual effect*/
+ ia_aiq_ae_results *ae_results; /*!< Optional. AEC output will be used by LTM.*/
+ int16_t frame_width; /*!< Mandatory. Width of the frame where the results will be applied. */
+ int16_t frame_height; /*!< Mandatory. Height of the frame where the results will be applied. */
+ ia_aiq_rgbs_grid *rgbs_grid_ptr; /*!< Optional. RGBS statistics. LTM may use this small grid instead of given larger grids to reduce PnP (available in IPU4 and onwards). */
+ ia_aiq_hdr_rgbs_grid *hdr_rgbs_grid_ptr;/*!< Optional. HDR RGBS statistics. LTM may use this small grid instead of given larger grids to reduce PnP (available in IPU4 and onwards). */
+ ia_ltm_input_image *input_image_ptr; /*!< Optional. Image data of any resolution based on IQ requirements for particular use case from which LTM calculates local tone maps (HW generated image available in IPU5 and onwards). */
+} ia_ltm_input_params;
+
+/*!
+ * \brief LTM calculation based on input parameters and frame statistics.
+ *
+ * \param[in] ia_ltm Mandatory.\n
+ * LTM instance handle.
+ * \param[in] ltm_input_params Mandatory.\n
+ * Input parameters for LTM calculations.
+ * \param[out] ltm_results Mandatory.\n
+ * Pointer's pointer where address of LTM results are stored.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_ltm_run(ia_ltm *ia_ltm,
+ const ia_ltm_input_params *ltm_input_params,
+ ia_ltm_results **ltm_results,
+ ia_ltm_drc_params **ltm_results_drc);
+
+/*!
+ * \brief Get version.
+ * Get version from version header.
+ *
+ * \return Version string.
+ */
+LIBEXPORT const char* ia_ltm_get_version(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_LTM_H_ */
diff --git a/include/ia_imaging/ia_ltm_types.h b/include/ia_imaging/ia_ltm_types.h
new file mode 100644
index 0000000..0055c75
--- /dev/null
+++ b/include/ia_imaging/ia_ltm_types.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_ltm_types.h
+ * \brief Definitions of input/output structures of the Intel local tone mapping library.
+ */
+
+#ifndef _IA_LTM_TYPES_H_
+#define _IA_LTM_TYPES_H_
+
+#include "ia_types.h"
+#include <stdint.h>
+
+#define CONFIG_UNIT_LUT_SIZE_32 32
+#define NUM_TONE_MAP_PWL_SEGMENTS 7 /*!< Local curves in piece-wise-linear form (7 pieces)*/
+#define MAX_NUM_LUT 72500 /*!< Max. possible number of grids in GammaStar (145 x 500) */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct ia_ltm_t ia_ltm;
+
+/*!
+ * \brief New struct for LTM/DRC (local tone mapping/dynamic range compression),
+ * LTM is a algorithm for local tone mapping when sensor is in HDR mode
+ * LTM/DRC analysis algorithm is in CPU, applying LTM is a FW block called gamma.
+ */
+typedef enum
+{
+ ia_ltm_level_use_tuning = -1, /*!< Use LTM level defined in the tuning. */
+ ia_ltm_level_bypass = 0, /*!< Bypass LTM (DRC) */
+} ia_ltm_level;
+
+/*!
+ * \brief Input image for LTM calculations.
+ */
+typedef struct
+{
+ ia_image_full_info image_info; /*!< Structure defining given image format, size and other characteristics. */
+ const ia_binary_data *image_data; /*!< Input image buffer format, layout and size depends of width & height (and other paddings) defined in image_info structure above. */
+} ia_ltm_input_image;
+
+/*!
+ * \brief struct to hold LTM LUTs
+ * Local curves in pwl format as needed by GammaStar
+ * x & y indexes, slopes for each linear piece
+ */
+typedef struct ia_ltm_lut
+{
+ uint16_t points_x[NUM_TONE_MAP_PWL_SEGMENTS + 1]; /* UQ0.15 + 2^15(offset) */
+ uint16_t slopes_a[NUM_TONE_MAP_PWL_SEGMENTS]; /* UQ8.8 */
+ uint16_t points_y[NUM_TONE_MAP_PWL_SEGMENTS]; /* UQ0.15 */
+} ia_ltm_lut;
+
+/*!
+ * \brief struct to hold LTM results
+ * - Local LUTs
+ * - Number of blocks in each dimension
+ * - Average local gain (An estimate of overall local gains to be applied is needed for accurate denoising)
+ */
+typedef struct ia_ltm_results
+{
+ ia_ltm_lut ltm_luts[MAX_NUM_LUT]; /*!< Local look-up-tables */
+ int grid_width; /*!< Grid width of LTM LUTs. */
+ int grid_height; /*!< Grid height of LTM LUTs. */
+ int block_size; /*!< Block size (width & height in pixels) to which LTM LUTs are applied. */
+ float ltm_gain; /*!< LTM gain. */
+} ia_ltm_results;
+
+/*!
+* \brief GTM parameters for DRC.
+*/
+typedef struct ia_ltm_drc_gtm
+{
+ unsigned short gtm_bypass;
+ unsigned short xcu_gtm_offset_vec[CONFIG_UNIT_LUT_SIZE_32];
+ short xcu_gtm_slope_vec[CONFIG_UNIT_LUT_SIZE_32];
+ unsigned short xcu_gtm_x_cord_vec[CONFIG_UNIT_LUT_SIZE_32];
+ unsigned short xcu_gtm_x_cord_max;
+ unsigned short xcu_gtm_exponent;
+ unsigned short xcu_gtm_slope_resolution;
+ unsigned short gtm_gain_frac_bit;
+} ia_ltm_drc_gtm;
+
+/*!
+ * \brief LTM results from algorithms, passing to DRC in IPU4i HDR pipe.
+ */
+typedef struct ia_ltm_drc_params
+{
+ unsigned short gain_map[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15.gain_map is upscaled by bilateral,
+ applied to pixel-to-pixel in DRC FW block. */
+ unsigned short weight_map[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15.weight_map is for computing similarity
+ inside DRC FW block. */
+ ia_ltm_drc_gtm drc_gtm; /*! GTM parameters. */
+} ia_ltm_drc_params;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_LTM_TYPES_H_ */
diff --git a/include/ia_imaging/ia_mkn_decoder.h b/include/ia_imaging/ia_mkn_decoder.h
new file mode 100644
index 0000000..696e54b
--- /dev/null
+++ b/include/ia_imaging/ia_mkn_decoder.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_mkn_decoder.h
+ * \brief Definitions of functions to decode records from Maker Note.
+*/
+
+#ifndef IA_MKN_DECODER_H_
+#define IA_MKN_DECODER_H_
+
+#include "ia_types.h"
+#include "ia_mkn_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \brief Checks if makernote contents are valid.
+ *
+ * \param[in] a_mknt_data_ptr Mandatory.\n
+ * Pointer to the makernote (MKNT) binary data.
+ * \param[in] a_tag Mandatory.\n
+ * Tag which should match tag in the given data. Can be 0, if tag doesn't matter.
+ * \return True if makernote data is valid.
+ */
+LIBEXPORT bool
+ia_mkn_is_valid(const ia_binary_data *a_mknt_data_ptr,
+ const unsigned int a_tag);
+
+/*!
+ * \brief Changes endianness of given makernote buffer.
+ * Modifies the makernote buffer by changing endianness of makernote header and records.
+ *
+ * \param[in, out] mknt_data Mandatory.\n
+ * Pointer to the makernote (MKNT) binary data which will be changed
+ * to different endianness.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_mkn_change_endianness(ia_binary_data *mknt_data);
+
+/*!
+ * \brief Prints all records contents.
+ * Prints all record headers and record contents into the stdout in the same format as defined by the DFID. If a buffer
+ * containing makernote header file is given as input, the DNID is also printed out as the first value on each row.
+ * Note. Makernote data CRC validity is not checked when printing records. Prior to calling this function,
+ * call ia_mkn_is_valid() to validate integrity of makernote data.
+ *
+ * \param[in] mknt_data Mandatory.\n
+ * Pointer to the makernote (MKNT) binary data.
+ * \param[in] makernote_header_file Optional.\n
+ * Buffer where makernote header file has been read. Can be NULL.
+ * \param[in] mkn_dnid_struct_name Optional.\n
+ * C string of name of structure containing DNIDs in the given header file.
+ * \param[in] dnid Mandatory.\n
+ * Record's DNID to print. If 0, all records will be printed out.
+ * \param[in] binary Mandatory.\n
+ * Flag indicating if data is printed out as binary data into stdout.
+ * \param[in] key Mandatory.\n
+ * Packing key (16 bytes).
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_mkn_print_record(const ia_binary_data *mknt_data,
+ const char *makernote_header_file,
+ const char *mkn_dnid_struct_name,
+ ia_mkn_dnid dnid,
+ bool binary,
+ const char *key);
+
+/*!
+ * \brief Copies record data from the makernote to given buffer.
+ * Checks if a given record exists in the makernote and copies the data from the makernote buffer into the record data buffer.
+ * The amount to copy depends on size value given as input in the record header structure. If size is 0,
+ * only the record header is updated with correct data size and no data is copied. Thus this function can be called twice:
+ * First to get the record size and second time (after allocating a buffer for the output) to get the record data. When querying
+ * for record, DFID and DNID must match the record's DFID and DNID.
+ * Note. Makernote data CRC validity is not checked when getting records. Prior to calling this function,
+ * call ia_mkn_is_valid() to validate integrity of makernote data.
+ *
+ * \param[in] mknt_data Mandatory.\n
+ * Pointer to the makernote (MKNT) binary data.
+ * \param[in] key Mandatory.\n
+ * Packing key (16 bytes).
+ * \param[in,out] mkn_record_header Mandatory.\n
+ * Record header with size set to 0 or wanted data size from record. DFID and DNID
+ * must be set correctly to get record data.
+ * \param[out] record_data Mandatory if record header size is not 0.\n
+ * Large enough buffer to hold whole record data.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_mkn_get_record(const ia_binary_data *mknt_data,
+ const char* key,
+ ia_mkn_record_header *mkn_record_header,
+ void *record_data);
+
+/*!
+ * \brief Copies record data from the makernote to given buffer.
+ * Parses through the makernote file and copies record headers of the first num_mkn_records to the given memory array.
+ * Client should make sure enough memory is allocated for num_mkn_records in the given array.
+ * If mkn_record_headers is NULL, this function will return the number of records. Thus
+ * first call can be used to query how many records there are and second call to get the actual record headers.
+ *
+ * \param[in] mknt_data Mandatory.\n
+ * Pointer to the makernote (MKNT) binary data.
+ * \param[in,out] num_mkn_records Mandatory.\n
+ * Number of makernote records the function is allowed to parse and store to the mkn_record_headers.
+ * \param[in,out] mkn_record_headers Mandatory.\n
+ * Client allocated memory for storing the array of record headers parsed by this function.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_mkn_get_record_headers(const ia_binary_data *mknt_data,
+ int *num_mkn_records,
+ ia_mkn_record_header *mkn_record_headers);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IA_MKN_DECODER_H_ */
diff --git a/include/ia_imaging/ia_mkn_encoder.h b/include/ia_imaging/ia_mkn_encoder.h
new file mode 100644
index 0000000..f540dbf
--- /dev/null
+++ b/include/ia_imaging/ia_mkn_encoder.h
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_mkn_encoder.h
+ * \brief Definitions of functions to control and add records to Maker Note.
+*/
+
+#ifndef IA_MKN_ENCODER_H_
+#define IA_MKN_ENCODER_H_
+
+#include "ia_types.h"
+#include "ia_mkn_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \brief Creates Make Note system handle.
+ * Allocates and initializes makernote handle. Handle must be given as input parameter to all consequent ia_mkn calls.
+ *
+ * \param[in] mkn_config_bits Mandatory.\n
+ * Configuration flag bits.
+ * \param[in] mkn_section_1_size Mandatory.\n
+ * Size of Section 1 data buffer.
+ * \param[in] mkn_section_2_size Mandatory.\n
+ * Size of Section 2 data buffer.
+ * \return Pointer to the makernote handle.
+ */
+LIBEXPORT ia_mkn*
+ia_mkn_init(ia_mkn_config_bits mkn_config_bits,
+ size_t mkn_section_1_size,
+ size_t mkn_section_2_size);
+
+/*!
+ * \brief Deletes Make Note system handle.
+ *
+ * \param[in] mkn Mandatory. \n
+ * Pointer to makernote handle.
+ * \return Error code.
+ */
+LIBEXPORT void
+ia_mkn_uninit(ia_mkn *mkn);
+
+/*!
+ * \brief Reset Make Note system to default state.
+ *
+ * \param[in] mkn Mandatory. \n
+ * Pointer to makernote handle obtained from ia_mkn_init function call.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_mkn_reset(ia_mkn *mkn);
+
+/*!
+ * \brief Adds or updates a data record in the makernote.
+ *
+ * \param[in] mkn Mandatory. \n
+ * Pointer to makernote handle obtained from ia_mkn_init function call.
+ * \param[in] data_format_id Mandatory.\n
+ * Record data format ID.
+ * \param[in] data_name_id Mandatory.\n
+ * Record name ID.
+ * \param[in] data Mandatory.\n
+ * Pointer to record data to be copied into the makernote. Size of data to be copied is calculated
+ * from on DFID and number of elements.
+ * \param[in] num_elements Mandatory.\n
+ * Number of elements to store.
+ * \param[in] key Mandatory.\n
+ * Packing key (16 bytes). NULL means 'no packing'.
+ * \return Error code.
+*/
+LIBEXPORT ia_err
+ia_mkn_add_record(ia_mkn *mkn,
+ ia_mkn_dfid mkn_data_format_id,
+ ia_mkn_dnid mkn_data_name_id,
+ const void *data,
+ unsigned int num_elements,
+ const char *key);
+
+/*!
+ * \brief Deletes a data record from the makernote.
+ *
+ * \param[in] mkn Mandatory. \n
+ * Pointer to makernote handle obtained from ia_mkn_init function call.
+ * \param[in] data_format_id Mandatory.\n
+ * Record data format ID.
+ * \param[in] data_name_id Mandatory.\n
+ * Record name ID.
+ * \return Error code.
+*/
+LIBEXPORT ia_err
+ia_mkn_delete_record(ia_mkn *mkn,
+ ia_mkn_dfid mkn_data_format_id,
+ ia_mkn_dnid mkn_data_name_id);
+
+/*!
+ * \brief Prepares makernote so that it can be included into the EXIF.
+ * Based on data target: Section 1 can be used by client for example for EXIF or Section 2 where all (Section 1 & Section 2) records will be included.
+ * calculates checksum, updates total size of makernote data, compresses and pack makernote data.
+ *
+ * \param[in] mkn Mandatory. \n
+ * Pointer to makernote handle obtained from ia_mkn_init function call.
+ * \param[in] data_target Target of the makernote as defined in enum ia_mkn_trg.
+ * \return Binary data structure with pointer and size of data..
+ */
+LIBEXPORT ia_binary_data
+ia_mkn_prepare(ia_mkn *mkn,
+ ia_mkn_trg data_target);
+
+/*!
+ * \brief Enable/Disable makernote data collecting.
+ *
+ * \param[in] mkn Mandatory. \n
+ * Pointer to makernote handle obtained from ia_mkn_init function call.
+ * \param enable_data_collection Mandatory.\n
+ * Enable/disable data collection.
+ * \return Error code.
+*/
+LIBEXPORT ia_err
+ia_mkn_enable(ia_mkn *mkn,
+ bool enable_data_collection);
+
+/*!
+ * \brief Merge two makernotes.
+ * Copies all records from source makernote to the target makernote. Existing same records in the target are overwritten by source record.
+ * Both makernotes must be created with the same makernote library ie. have the same internal structure.
+ * After merging makernotes, ia_mkn_prepare() function must be called before using the merged makernote.
+ *
+ * \param[in,out] mkn_trg_data Target makernote. Source makernote will be merged into this.
+ * \param[in] mkn_src_data Source makernote.
+ * \return Error code.
+ */
+LIBEXPORT ia_err
+ia_mkn_merge(ia_mkn *mkn_trg,
+ const ia_mkn *mkn_src);
+
+/*!
+ * \brief Converts makernote (MKNT) binary data to full MKN data.
+ * Allocates full MKN data and copies the content of (MKNT) binary data to MKN.
+ *
+ * \param[in] mknt_src_data Pointer to the makernote (MKNT) binary data.
+ * \return Pointer to the makernote handle.
+ */
+LIBEXPORT ia_mkn*
+ia_mknt_to_mkn(const ia_binary_data *mknt_src_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* IA_MKN_ENCODER_H_ */
diff --git a/include/ia_imaging/ia_mkn_types.h b/include/ia_imaging/ia_mkn_types.h
new file mode 100644
index 0000000..3025fd3
--- /dev/null
+++ b/include/ia_imaging/ia_mkn_types.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file ia_mkn_types.h
+ * \brief Enumerations, structures and definitions used in the Maker Note System.
+*/
+
+#ifndef _IA_MKN_TYPES_H_
+#define _IA_MKN_TYPES_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!
+ * \brief combines 4 chars into one unsigned long integer.
+ */
+#define IA_MKN_CHTOUL(a,b,c,d) \
+ ( (uint32_t)(a) | ((uint32_t)(b)<<8) | ((uint32_t)(c)<<16) | ((uint32_t)(d)<<24) )
+
+/*!
+ * \brief Makernote tag. 4 first bytes of the makernote data.
+ */
+#define IA_MKN_TAG IA_MKN_CHTOUL('M','K','N','T')
+
+/*!
+ * \brief Definition of ia_mkn handle.
+ * Definition to clarify when ia_mkn handle is expected to be used.
+ */
+typedef struct ia_mkn_t ia_mkn;
+
+/*!
+ * Start of MKN System enumeration set.
+ * \brief Enumerations set for Maker Note System.
+ * This part contatins two enumerations:
+ * - 'ia_mkn_dfid', describes data type of the 'Data' field in the MKN record;
+ * - 'ia_mkn_dnid',describes a name (or functionality) of data in the 'Data' field.
+ * To modify this file a following procedure is used:
+ * a) Add new enum members of ia_mkn_dfid or ia_mkn_dnid
+ * b) Update MKN_ENUMS_DATA_REVISION accordingly.
+ */
+
+/*!
+ * Revision of MKN System enumeration set, format 0xYYMMDDVV, where:
+ * - YY: year,
+ * - MM: month,
+ * - DD: day,
+ * - VV: version ('01','02' etc.)
+ */
+#define IA_MKN_ENUMS_DATA_REVISION 0x14012702
+
+/*!
+ * \brief Data Format ID (DFID) enumeration describes data type of the 'Data' field in the MKN record.
+ */
+typedef enum
+{
+ ia_mkn_dfid_dummy, /*!< Used for dummy records (no actual data). */
+
+ /*! Standard integer data types */
+ ia_mkn_dfid_signed_char, /*!< 8-bit, int. values, range: -128 to 127 */
+ ia_mkn_dfid_unsigned_char, /*!< 8-bit, int. values, range: 0 to 255 */
+ ia_mkn_dfid_signed_short, /*!< 16-bit, int. values, range: -32768 to 32767 */
+ ia_mkn_dfid_unsigned_short, /*!< 16-bit, int. values, range: 0 to 65535 */
+ ia_mkn_dfid_signed_int, /*!< 32-bit, int. values, range: -2147483648 to 2147483647 */
+ ia_mkn_dfid_unsigned_int, /*!< 32-bit, int. values, range: 0 to 4294967295 */
+ ia_mkn_dfid_signed_long_long, /*!< 64-bit, int. values, range: -9223372036854775808 to 9223372036854775807 */
+ ia_mkn_dfid_unsigned_long_long, /*!< 64-bit, int. values, range: 0 to 18446744073709551615 */
+ ia_mkn_dfid_string, /*!< 8-bit chars which are converted to ASCII. */
+
+ /*! Floating point numbers. */
+ ia_mkn_dfid_float = 14, /*!< IEEE-754 floating point single precision */
+ ia_mkn_dfid_double, /*!< IEEE-754 floating point double precision */
+
+ /*! Fixed point fractional data types */
+ ia_mkn_dfid_unsigned_q16_16, /*!< 32-bit, Unsigned fixed point fractional value, 16 bits integer, 16 bits fractional */
+ ia_mkn_dfid_signed_q15_16, /*!< 32-bit, Signed fixed point fractional value, 1 bit sign, 15 bits integer, 16 bits fractional */
+ ia_mkn_dfid_unsigned_q8_8, /*!< 16-bit, Unsigned fixed point fractional value, 8 bits integer, 8 bits fractional */
+ ia_mkn_dfid_signed_q7_8, /*!< 16-bit, Signed fixed point fractional value, 1 bit sign, 7 bits integer, 8 bits fractional */
+
+ ia_mkn_dfid_last /*!< Total number of data types, keep this enum member as a last one!. */
+} ia_mkn_dfid;
+
+
+/*!
+ * \brief Data Name ID (DNID) enumeration describes a name (or functionality) of data in the 'Data' field.
+ */
+typedef enum
+{
+ ia_mkn_dnid_dummy, /*!< Used for dummy records (no actual data). */
+ ia_mkn_dnid_ia_aiq_records = 1, /*!< ia_aiq library internal records. */
+ ia_mkn_dnid_hal_records = 256, /*!< HAL records. */
+ ia_mkn_dnid_ia_isp_records = 512, /*!< ia_isp library internal records. */
+ ia_mkn_dnid_free_records = 768, /*!< Next free block of records - replace this when assigned. */
+ ia_mkn_dnid_last /*!< Total number of data names, keep this enum member as a last one!. */
+} ia_mkn_dnid;
+
+
+/*!
+ * \brief Bitfield to enable makernote features.
+ */
+typedef enum
+{
+ ia_mkn_cfg_compression = 1, /*!< Enable compression of maker note data */
+ ia_mkn_cfg_imported = 1 << 1, /*!< Shows that MKN has been imported from binary container */
+} ia_mkn_config_bits;
+
+
+/*!
+ * \brief Target of the makernote data: Section 1 or 2 (which could represent e.g. JPEG EXIF or RAW Header data).
+ * Notice that if Section 2 is selected, an output makernote data will contain both Section 1 and Section 2 parts.
+ * Bitwise OR'd with DNID when set for the target sections.
+ */
+typedef enum
+{
+ ia_mkn_trg_section_1 = 0, /*!< Extensions ('or'-ed to ia_mkn_dnid) */
+ ia_mkn_trg_section_2 = 0x10000 /*!< Extensions ('or'-ed to ia_mkn_dnid) */
+} ia_mkn_trg;
+
+
+/*!
+ * \brief Makernote header structure. Records (ia_mkn_record_header) are followed after this header.
+ */
+typedef struct
+{
+ uint32_t tag; /*!< Tag in the beginning of makernote data. It also can be used to determine endianness. */
+ uint32_t size; /*!< Size of the actual makernote records data (including ia_mkn_header) */
+ uint32_t system_version; /*!< Version of makernote system, format 0xYYMMDDVV */
+ uint32_t enum_revision; /*!< Revision of makernote enumerations set, format 0xYYMMDDVV */
+ uint32_t config_bits; /*!< Configuration flag bits set */
+ uint32_t checksum; /*!< Global checksum of all bytes from the maker note buffer */
+} ia_mkn_header;
+
+
+/*!
+ * \brief Record header structure. Data is followed after this header.
+ */
+typedef struct
+{
+ uint32_t size; /*!< Size of record including header */
+ uint8_t data_format_id; /*!< ia_mkn_dfid enumeration values used */
+ uint8_t key_id; /*!< Packing key ID. If 0 - no packing */
+ uint16_t data_name_id; /*!< ia_mkn_dnid enumeration values used */
+} ia_mkn_record_header;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_MKN_TYPES_H_ */
diff --git a/include/ia_imaging/ia_montage.h b/include/ia_imaging/ia_montage.h
new file mode 100644
index 0000000..2160274
--- /dev/null
+++ b/include/ia_imaging/ia_montage.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_MONTAGE_H_
+#define _IA_MONTAGE_H_
+
+/** @file ia_montage.h
+ * This file declares structures and APIs of image montage engine.
+ */
+
+#include "ia_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @brief Image montage state. This is the handle for IM engine.
+ */
+typedef struct {
+ ia_frame *output_image; /**< Allocated and managed internally, result image will be stored here. */
+} ia_montage_state;
+
+
+/** @brief Parameters for ia montage engine.
+ * Used by ia_montage_set_parameter() and ia_montage_get_parameter() to indicate runtime engine configuration.
+ */
+typedef struct {
+ int32_t search_region_margin_percentage; /**< Indicates how much enlarged area to be considered when it crops the object image patch from sub image. Default is 20. */
+} ia_montage_parameters;
+
+/** @brief Initialize Image Montage engine
+ *
+ * @param env [IN] Platform environment parameters.
+ *
+ * This function instantiates and initializes the Image Montage Engine.
+ */
+LIBEXPORT
+ia_montage_state *
+ia_montage_init(const ia_env *env);
+
+/** @brief Destroy Image Montage Engine.
+ */
+LIBEXPORT
+void
+ia_montage_uninit(ia_montage_state *state);
+
+/** @brief Initialize existing Image Montage engine.
+ */
+LIBEXPORT
+void
+ia_montage_reinit(ia_montage_state *state);
+
+/** @brief Get version information of the Image Montage Engine.
+ */
+LIBEXPORT
+ia_version
+ia_montage_get_version(void);
+
+/** @brief Set the parameters.
+ *
+ * @param ms [IN] Image Montage engine context.
+ * @param params [IN] the parameter struct.
+ *
+ * Set ia_montage parameters to the engine context. The params is supposed to be filled by ia_montage_get_parameters().
+ */
+LIBEXPORT
+ia_err
+ia_montage_set_parameter(ia_montage_state *ms, const ia_montage_parameters *params);
+
+/** @brief Get the parameters.
+ *
+ * @param ms [IN] Image Montage engine context.
+ * @param params [IN/OUT] the parameter struct.
+ *
+ * Get ia_montage parameters from the engine context. The params must be allocated before calling this function. The members
+ * would be filled after it returns.
+ */
+LIBEXPORT
+ia_err
+ia_montage_get_parameter(ia_montage_state *ms, ia_montage_parameters *params);
+
+/** @brief Set the main image.
+ *
+ * @param ms [IN] Image Montage engine context.
+ * @param main_frame [IN] Main image.
+ * @param objects [IN] an array of the objects coordinates.
+ * @param num_objects [IN] the number of objects.
+ *
+ * The main image is labelled as the "background" for Image Montage.
+ * Various objects are necessary to consider the overlapping between each object. Objects could be faces for general use-cases.
+ * It is required to call this apposed to ia_montage_set_sub_images(), prior to composing.
+ */
+
+LIBEXPORT
+ia_err
+ia_montage_set_main_image(ia_montage_state *ms, const ia_frame *main_frame, ia_rectangle* objects, int32_t num_objects);
+
+/** @brief Set the sub image where the object patches come from.
+ *
+ * @param ms [IN] Image Montage engine context.
+ * @param sub_frame [IN] Sub image.
+ * @param objects [IN] the coordinates of objects.
+ * @param num_objects [IN] the number of objects.
+ *
+ * The main image is labelled as the "background" for Image Montage.
+ * Various objects are necessary to consider the overlapping between each object. Objects could be faces for general use-cases.
+ * It is required to call this apposed to ia_montage_set_sub_images(), prior to composing.
+ * It is fine to call this before than ia_montage_set_main_image().
+ */
+LIBEXPORT
+ia_err
+ia_montage_set_sub_image(ia_montage_state *ms, const ia_frame *sub_frame, ia_rectangle* objects, int32_t num_objects);
+
+/** @brief Compose the image montage, cropping from the sub image, pasting to the main image.
+ *
+ * @param ms [IN] Image Montage engine context.
+ * @param idx_on_main [IN] the index of the object given along with main image.
+ * @param idx_on_sub [IN] the index of the object given along with sub image.
+ *
+ * This is to combine two images(main, sub), cropping an object image patch placed on 'idx_on_sub'th place of sub objects array,
+ * overlaying it onto the place of 'idx_on_image' th of main objects array.
+ * The composed image would be in the engine context.
+ * Every time this function is called, the result image will be newly composed from main/sub images and the previous image will gone.
+ * You should call ia_montage_set_main_image() again with the result image, in order to paste a new object on the result image,
+ *
+ */
+LIBEXPORT
+ia_err
+ia_montage_compose(ia_montage_state *ms, int32_t idx_on_main, int32_t idx_on_sub);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _IA_MONTAGE_H_ */
diff --git a/include/ia_imaging/ia_types.h b/include/ia_imaging/ia_types.h
new file mode 100644
index 0000000..c0becbf
--- /dev/null
+++ b/include/ia_imaging/ia_types.h
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IA_TYPES_H_
+#define _IA_TYPES_H_
+
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include <stdbool.h>
+
+#define LIBEXPORT
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Bundles binary data pointer with size.
+ */
+typedef struct
+{
+ void *data;
+ unsigned int size;
+} ia_binary_data; /* ia_binay_data owns data */
+
+/**
+ * \brief Defines a common record header.
+ */
+typedef struct
+{
+ unsigned int uuid;
+ unsigned int size;
+} ia_record_header;
+
+typedef struct {
+ int major;
+ int minor;
+} ia_version;
+
+typedef enum {
+ CAPTURE_OUTPUT,
+ CAPTURE_VFPP,
+ PREVIEW_VFPP,
+ ACC_QOS
+} ia_acceleration_fw_dst;
+
+typedef struct {
+ void *isp;
+ void *(*open_firmware) (const char *fw_path, unsigned *size);
+ int (*load_firmware) (void *isp, void *fw, unsigned size, unsigned *handle);
+ int (*unload_firmware) (void *isp, unsigned handle);
+ int (*map_firmware_arg) (void *isp, void *usr_ptr, size_t size, unsigned long *css_ptr);
+ int (*unmap_firmware_arg)(void *isp, unsigned long css_ptr, size_t size);
+ int (*set_firmware_arg) (void *isp, unsigned handle, unsigned num, void *val, size_t size);
+ int (*set_mapped_arg) (void *isp, unsigned handle, unsigned mem, unsigned long css_ptr, size_t size);
+ int (*start_firmware) (void *isp, unsigned handle);
+ int (*wait_for_firmware) (void *isp, unsigned handle);
+ int (*abort_firmware) (void *isp, unsigned handle, unsigned timeout);
+ ia_version version_isp;
+ ia_version version_css;
+ int (*set_stage_state) (void *isp, unsigned int handle, bool enable);
+ int (*wait_stage_update) (void *isp, unsigned int handle);
+ int (*load_firmware_ext) (void *isp, void *fw, unsigned size, unsigned *handle, int fw_dst);
+} ia_acceleration;
+
+typedef enum {
+ ia_frame_format_nv12, /* 12 bit YUV 420, Y, UV plane */
+ ia_frame_format_yuv420, /* 12 bit YUV 420, Y, U, V plane */
+ ia_frame_format_yuv444, /* 24 bit YUV 444, Y, U, V plane */
+ ia_frame_format_raw, /* RAW, 1 plane */
+ ia_frame_format_rgba32, /* RGBA 8 bits per channel */
+ ia_frame_format_yuy2, /* 16 bit YUV 422, YUYV plane */
+ ia_frame_format_raw16, /* 16 bit RAW, 1 plane */
+ ia_frame_format_rgb16p, /* 16 bits per channel, 3 planes */
+ ia_frame_format_yuv420sp16, /* 24 bit YUV 420, Y, UV plane */
+ ia_frame_format_yuv420p16, /* 24 bit YUV 420, Y, U, V plane */
+ ia_frame_format_yuv444p16, /* 48 bit YUV 444, Y, U, V plane */
+} ia_frame_format;
+
+typedef struct {
+ void *data; /**< Pointer to the image data, ia_ipf_buffer_container owns this */
+ int size; /**< Total number of bytes in data*/
+ int width; /**< Width of the frame in pixels */
+ int height; /**< Height of the frame in lines */
+ ia_frame_format format; /**< Frame format */
+ int stride; /**< Stride, bytes per line*/
+ int rotation; /**< degrees 0-360 */
+} ia_frame;
+
+/*!
+* \brief Raw image data format.
+*/
+typedef enum
+{
+ ia_image_data_format_rawplain16, /*!< Data is 16 bits per pixel. */
+ ia_image_data_format_rawplain8, /*!< Data is 8 bits per pixel. */
+ ia_image_data_format_rgb16, /*!< Data is in a buffer contaning planes: R, G and B one after another. Data size is 16 bits per pixel. */
+ ia_image_data_format_smia10, /*!< SMIA 10 format groups 4 pixels: MSBs of four pixels in 4 bytes + LSBs of same 4 pixels in 1 byte. */
+ ia_image_data_format_nv12, /*!< Data is 12 bit YUV 420, Y, UV plane. */
+ ia_image_data_format_yuv420_planar, /*!< Data is YUV 420 planar. */
+ ia_image_data_format_rawplain16_interleaved, /*!< Data is 16 bits per pixel interleaved so that all bayer quad pixels are one after another. Example: GRBGGRBG...*/
+} ia_image_data_format;
+
+/*!
+* \brief Raw image essential information.
+* If raw image data doesn't contain any extra bytes/lines/columns, the image can be decoded with this info.
+* For all signed values in the structs below, negative value indicates N/A.
+*/
+typedef struct
+{
+ unsigned char data_format; /*!< RawPlain16, RawPlain8 etc. as defined in the enum ia_image_data_format */
+ char bayer_order; /*!< GRBG, RGGB, BGGR or GBRG as defined in the enum cmc_bayer_order. -1 if N/A */
+ char data_format_bpp; /*!< Bits per pixel for a given data_format. eg. 16 for RawPlain16 etc. -1 if N/A*/
+ char data_bpp; /*!< Bits per pixel used by the image data. -1 if N/A */
+ unsigned int width_cols; /*!< Visible image width (640, 800, 1280, 1600, etc.) */
+ unsigned int height_lines; /*!< Visible image height (480, 600, 960, 1200, etc.) */
+} ia_image_info;
+
+/*!
+* \brief Raw image info with additional details about extra bytes/lines/columns to skip when decoding the raw image.
+*/
+typedef struct
+{
+ ia_image_info raw_image; /*!< Essential information needed to decode the image. */
+ unsigned int header_size_bytes; /*!< Variable size header */
+ unsigned int footer_size_bytes; /*!< Variable size footer */
+
+ unsigned short extra_bytes_left; /*!< e.g. CCP sync codes */
+ unsigned short extra_bytes_right; /*!< e.g. CCP sync codes */
+
+ unsigned short extra_lines_top; /*!< Non-image data, e.g. embedded data lines */
+ unsigned short extra_cols_left; /*!< Non-image data, extra columns at left */
+ unsigned short extra_cols_right; /*!< Non-image data, extra columns at right */
+ unsigned short extra_lines_bottom; /*!< Non-image data, e.g. embedded data lines */
+
+ char byte_order_xor; /*!< 0, 1 or 3 (for the cases when byte order has been modified for whatever reason) */
+ char spatial_sampling; /*!< 0 or 1 = Bayer or Co-sited */
+} ia_image_full_info;
+
+/** Floating point range struct. */
+typedef struct {
+ float min;
+ float max;
+} ia_float_range;
+
+/*!
+ * Needs to be agreed with ia_imaging error codes.
+ * \brief Error codes.
+*/
+typedef enum {
+ ia_err_none = 0, /*!< No errors*/
+ ia_err_general = (1 << 1), /*!< General error*/
+ ia_err_nomemory = (1 << 2), /*!< Out of memory*/
+ ia_err_data = (1 << 3), /*!< Corrupted data*/
+ ia_err_internal = (1 << 4), /*!< Error in code*/
+ ia_err_argument = (1 << 5), /*!< Invalid argument for a function*/
+ ia_err_disabled = (1 << 6) /*!< Functionality is disabled*/
+} ia_err;
+
+typedef struct {
+ int left;
+ int top;
+ int right;
+ int bottom;
+} ia_rectangle;
+
+/** Vector, used for image stabilization. */
+typedef struct {
+ int x;
+ int y;
+} ia_vector;
+
+/** Coordinate, used in red-eye correction. */
+typedef struct {
+ int x;
+ int y;
+} ia_coordinate;
+
+typedef struct {
+ void (*vdebug)(const char *fmt, ...);
+ void (*verror)(const char *fmt, ...);
+ void (*vinfo)(const char *fmt, ...);
+} ia_env;
+
+typedef struct {
+ void *(*alloc) (void *isp, size_t size);
+ void (*free) (void *isp, void *usr_ptr, size_t size);
+} ia_mem_env;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IA_TYPES_H_ */
diff --git a/include/ia_imaging/obgrid_public.h b/include/ia_imaging/obgrid_public.h
new file mode 100644
index 0000000..0e2816e
--- /dev/null
+++ b/include/ia_imaging/obgrid_public.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _OBGRID_PUBLIC_H_
+#define _OBGRID_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam black level correction (optical black, OB) kernel.
+*
+* This file contains Configuration parameters for grid-based black level correction
+*/
+
+#define IA_CSS_OBGRID_TILE_SIZE 16
+/** width; max grid size is derived from the max frame size as seen from obgrid perspective (4618x3464) */
+#define IA_CSS_OBGRID_MAX_GRID_WIDTH 146
+/** height; max grid size is derived from the max frame size as seen from obgrid perspective (4618x3464) */
+#define IA_CSS_OBGRID_MAX_GRID_HEIGHT 110
+/** size; max grid size is derived from the max frame size as seen from obgrid perspective (4618x3464) */
+#define IA_CSS_OBGRID_MAX_GRID_SIZE (IA_CSS_OBGRID_MAX_GRID_WIDTH * IA_CSS_OBGRID_MAX_GRID_HEIGHT)
+
+/**
+ * Description of the struct members:
+ *
+ * - tile_size: Width and height of a single grid tile.
+ * Valid value is IA_CSS_OBGRID_TILE_SIZE. Any other value is not supported.
+ * This field is provided for future extensions only. The tile size is
+ * given as a number of pixels of the same bayer color. For example, a
+ * 16x16 tile size covers a 32x32 area in the image.
+ *
+ * - x_offset: X value of the top-left grid point relative to ROI.
+ * - y_offset: Y value of the top-left grid point relative to ROI.
+ * Valid value is 0. Any other value is not supported.
+ * These fields are provided for future extensions only.
+ *
+ * - table_width: Width of the grid.
+ * Valid values are between 1 and IA_CSS_OBGRID_MAX_GRID_WIDTH.
+ * - table_height: Heigth of the grid.
+ * Valid values are between 1 and IA_CSS_OBGRID_MAX_GRID_HEIGHT.
+ * To cover the entire image, the width and height must be at least
+ * image_size/tile_size + 1. If the grid is not wide or high enough,
+ * then it will be extended by repeating the right or bottom elements.
+ *
+ * - table_GR: Grid table values for color Gr.
+ * - table_R: Grid table values for color R.
+ * - table_B: Grid table values for color B.
+ * - table_GB: Grid table values for color Gb.
+ * Valid values are between 0 and (2^N)-1, where N is the ISP bit width
+ * minus 1. On skycam, N is 11 bits. Each table must contain at least
+ * table_width*table_height valid elements, in row-major order.
+ */
+struct ia_css_2500_obgrid_kernel_config
+{
+ int x_offset; /**< X offset of the grid origin */
+ int y_offset; /**< Y offset of the grid origin */
+ int tile_size; /**< Grid tile size */
+ int table_width; /**< Grid width */
+ int table_height; /**< Grid height */
+ short table_GR[IA_CSS_OBGRID_MAX_GRID_SIZE]; /**< Grid values for Gr */
+ short table_R [IA_CSS_OBGRID_MAX_GRID_SIZE]; /**< Grid values for R */
+ short table_B [IA_CSS_OBGRID_MAX_GRID_SIZE]; /**< Grid values for B */
+ short table_GB[IA_CSS_OBGRID_MAX_GRID_SIZE]; /**< Grid values for Gb */
+};
+
+#endif /* _OBGRID_PUBLIC_H_ */
diff --git a/include/ia_imaging/rgbpp_public.h b/include/ia_imaging/rgbpp_public.h
new file mode 100644
index 0000000..138873c
--- /dev/null
+++ b/include/ia_imaging/rgbpp_public.h
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _RGBPP_PUBLIC_H_
+#define _RGBPP_PUBLIC_H_
+
+/** @file
+ * \brief CSS-API header file for 2500/Skycam specific RGB Per-pixel Correction (Color Correction) accelerator.
+ * \details RGB PPC accelerator performs mainly per pixels calculations, includes 3 fixed functions: CCM, GC, CSC_CDS
+ * the accelerator inputs RGB stream at s13.0 format and outputs yuv stream at s13.0
+ */
+//#include <type_support.h>
+
+
+/**
+ * \brief Color Correction Matrix (CCM) parameters
+ * \details CCM transforms sensor RGB color space into standard RGB color space
+ */
+
+struct ccm_public_matrix_coeffs {
+ signed short m11; /**< ccm 3x3 coeff m11 */
+ signed short m12; /**< ccm 3x3 coeff m12 */
+ signed short m13; /**< ccm 3x3 coeff m13 */
+ signed short m21; /**< ccm 3x3 coeff m21 */
+ signed short m22; /**< ccm 3x3 coeff m22 */
+ signed short m23; /**< ccm 3x3 coeff m23 */
+ signed short m31; /**< ccm 3x3 coeff m31 */
+ signed short m32; /**< ccm 3x3 coeff m32 */
+ signed short m33; /**< ccm 3x3 coeff m33 */
+};
+
+/**
+ * enum define the range of ccm coeffs values
+ */
+
+enum {
+ CCM_M11_MAX = 32767, /**< max range of ccm 3x3 coeff m11 */
+ CCM_M11_MIM = -32768, /**< min range of ccm 3x3 coeff m11 */
+ CCM_M12_MAX = 8191, /**< max range of ccm 3x3 coeff m12 */
+ CCM_M12_MIM = -8192, /**< min range of ccm 3x3 coeff m12 */
+ CCM_M13_MAX = 32767, /**< max range of ccm 3x3 coeff m13 */
+ CCM_M13_MIM = -32768, /**< min range of ccm 3x3 coeff m13 */
+ CCM_M21_MAX = 32767, /**< max range of ccm 3x3 coeff m21 */
+ CCM_M21_MIM = -32768, /**< min range of ccm 3x3 coeff m21 */
+ CCM_M22_MAX = 8191, /**< max range of ccm 3x3 coeff m22 */
+ CCM_M22_MIM = -8192, /**< min range of ccm 3x3 coeff m22 */
+ CCM_M23_MAX = 32767, /**< max range of ccm 3x3 coeff m23 */
+ CCM_M23_MIM = -32768, /**< min range of ccm 3x3 coeff m23 */
+ CCM_M31_MAX = 32767, /**< max range of ccm 3x3 coeff m31 */
+ CCM_M31_MIM = -32768, /**< min range of ccm 3x3 coeff m31 */
+ CCM_M32_MAX = 8191, /**< max range of ccm 3x3 coeff m32 */
+ CCM_M32_MIM = -8192, /**< min range of ccm 3x3 coeff m32 */
+ CCM_M33_MAX = 32767, /**< max range of ccm 3x3 coeff m33 */
+ CCM_M33_MIM = -32768, /**< min range of ccm 3x3 coeff m33 */
+ CCM_OFF_MAX = 8191, /**< min range of bias 3x1 coeffs */
+ CCM_OFF_MIN = -8192, /**< max range of bias 3x1 coeffs */
+};
+
+struct ccm_public_offsets {
+ signed short R; /**< ccm bias 3x1 coeff r */
+ signed short G; /**< ccm bias 3x1 coeff g */
+ signed short B; /**< ccm bias 3x1 coeff b */
+};
+
+struct ccm_public_config {
+ struct ccm_public_matrix_coeffs matrix_coeffs; /**< ccm 3x3 coeffs matrix */
+ struct ccm_public_offsets offsets; /**< ccm bias 3x1 coeffs */
+};
+
+/**
+ * \brief Gamma Correction (GC) parameters
+ * \details GC applies gamma correction to all pixels
+ */
+
+#define GAMMA_CORR_NUM_OF_LUT_ENTRIES 256 /**< number of elements in gamma correction LUT */
+
+struct gamma_corr_public_config {
+ unsigned short lut_entries[GAMMA_CORR_NUM_OF_LUT_ENTRIES]; /**< gamma correction LUT array */
+ unsigned short enable; /**< enable/disable gamma correction, 0:disable 1:enable */
+};
+
+
+/**
+ * \brief Color Space Converter (SCS) parameters
+ * \details SCS transforms RGB color space to YUV color space
+ */
+
+
+struct csc_public_C_mat {
+ signed short c11; /**< csc 3x3 coeff c11 */
+ signed short c12; /**< csc 3x3 coeff c12 */
+ signed short c13; /**< csc 3x3 coeff c13 */
+ signed short c21; /**< csc 3x3 coeff c21 */
+ signed short c22; /**< csc 3x3 coeff c22 */
+ signed short c23; /**< csc 3x3 coeff c23 */
+ signed short c31; /**< csc 3x3 coeff c31 */
+ signed short c32; /**< csc 3x3 coeff c32 */
+ signed short c33; /**< csc 3x3 coeff c33 */
+};
+
+struct csc_public_b_offset {
+ signed short b1; /**< csc bias 3x1 coeff b1 */
+ signed short b2; /**< csc bias 3x1 coeff b2 */
+ signed short b3; /**< csc bias 3x1 coeff b3 */
+};
+
+struct csc_public_config {
+ struct csc_public_C_mat mat; /**< 3x3 conversion coeffs matrix */
+ struct csc_public_b_offset offset; /**< ccm bias 3x1 coeffs */
+};
+
+/**
+ * \brief Chroma Down Scaling (CDS) parameters
+ * \details CDS performs down sampling of the Chroma plain
+ */
+
+struct cds_public_coeffs {
+ unsigned char c00; /**< cds coeff c00 */
+ unsigned char c01; /**< cds coeff c01 */
+ unsigned char c02; /**< cds coeff c02 */
+ unsigned char c03; /**< cds coeff c03 */
+ unsigned char c10; /**< cds coeff c10 */
+ unsigned char c11; /**< cds coeff c11 */
+ unsigned char c12; /**< cds coeff c12 */
+ unsigned char c13; /**< cds coeff c13 */
+};
+
+
+struct cds_public_config {
+ struct cds_public_coeffs coeffs; /**< 8 coefficients for chroma output downscaling */
+ unsigned char nf; /**< normalization factor for chroma output downscaling */
+ /**
+ * note: css fw currently supports only yuv420 format and always applies cds,
+ * as opposed to HW capabilities which supports yuv420 and yuv422 formats, and can enable or disable cds
+ */
+};
+
+
+/**
+ * /brief RGBPP parameters
+ * /details struct with all parameters for RGBPP kernel that can be
+ * applied from the CSS API.
+ */
+
+struct ia_css_2500_rgbpp_kernel_config {
+ struct ccm_public_config ccm; /** ccm parameters */
+ struct gamma_corr_public_config gamma; /** gamma parameters */
+ struct csc_public_config csc; /** csc parameters */
+ struct cds_public_config cds; /** cds parameters */
+};
+
+/** @brief Print RGBPP public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print RGBPP public configuration.
+ */
+void ia_css_rgbpp_public_cfg_dump(const struct ia_css_2500_rgbpp_kernel_config *cfg);
+
+/** @brief Compare two RGBPP public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two RGBPP public configurations
+ */
+bool ia_css_rgbpp_public_cfg_compare(
+ const struct ia_css_2500_rgbpp_kernel_config *cfg1,
+ const struct ia_css_2500_rgbpp_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif /* _RGBPP_PUBLIC_H_ */
diff --git a/include/ia_imaging/shd_public.h b/include/ia_imaging/shd_public.h
new file mode 100644
index 0000000..0fbaae9
--- /dev/null
+++ b/include/ia_imaging/shd_public.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SHD_PUBLIC_H_
+#define _SHD_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam Shading correction (SHD) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+enum {
+ SHD_MIN_GRID_WIDTH = 8,
+ SHD_MIN_GRID_HEIGHT = 8,
+ SHD_MAX_GRID_WIDTH = 73,
+ SHD_MAX_GRID_HEIGHT = 55,
+ SHD_MAX_GRID_SIZE = SHD_MAX_GRID_WIDTH * SHD_MAX_GRID_HEIGHT
+};
+
+struct shd_public_config {
+ /** description: enable shading correction fixed function processing
+ * range: [0 - disable,1 - enable] */
+ unsigned int shd_enable;
+ /** description: gain factor (aka 'gf')
+ * range: U2 [0,1,2] */
+ unsigned int gain_factor;
+};
+
+/**
+* Config struct for 2500/Skycam Shading correction (SHD) kernel/accelerator.
+*
+* general grid limitation:
+* grid total size is larger than (or equal to) frame size
+*/
+struct shd_grid_public_config {
+ /** description: number of grid vertices on the horizontal axis
+ range: [8..73] */
+ unsigned int grid_width;
+ /** description: number of grid vertices on the vertical axis
+ range: [8..56] */
+ unsigned int grid_height;
+ /** description: log2 of each grid cell width
+ range: [3..7] (cell width values [8,16,32,64,128]) */
+ unsigned int block_width;
+ /** description: log2 of each grid cell height
+ range: [3..7] (cell height values [8,16,32,64,128]) */
+ unsigned int block_height;
+ /** description: horizontal offset of the grid in relation to the frame
+ range: [-4096..0] (grid starts left to the frame start)
+ other limitations: x_start%2=0 */
+ signed int x_start;
+ /** description: vertical offset of the grid in relation to the frame
+ range: [-4096..0] (grid starts above the frame start)
+ other limitations: y_start%2=0 */
+ signed int y_start;
+};
+
+struct shd_black_level_public_config {
+ /** description: black level bias value
+ range: S12 [-2048..2047] */
+ signed int bl_R;
+ /** description: black level bias value
+ range: S12 [-2048..2047] */
+ signed int bl_Gr;
+ /** description: black level bias value
+ range: S12 [-2048..2047] */
+ signed int bl_Gb;
+ /** description: black level bias value
+ range: S12 [-2048..2047] */
+ signed int bl_B;
+ /** description: shift-left value for normaliztion factor (aka 'nf')
+ range: [0,1,3,5] */
+ unsigned int normalization_shift;
+};
+
+struct shd_luts_public_config {
+ /**
+ * description: shading factor
+ * range: U12
+ * note 1: refer to shd HAS doc for internal interpretation
+ * note 2: range is not enforced (too much overhead)
+ */
+ unsigned short R[SHD_MAX_GRID_SIZE];
+ /**
+ * description: shading factor
+ * range: U12
+ * note 1: refer to shd HAS doc for internal interpretation
+ * note 2: range is not enforced (too much overhead)
+ */
+ unsigned short Gr[SHD_MAX_GRID_SIZE];
+ /**
+ * description: shading factor
+ * range: U12
+ * note 1: refer to shd HAS doc for internal interpretation
+ * note 2: range is not enforced (too much overhead)
+ */
+ unsigned short Gb[SHD_MAX_GRID_SIZE];
+ /**
+ * description: shading factor
+ * range: U12
+ * note 1: refer to shd HAS doc for internal interpretation
+ * note 2: range is not enforced (too much overhead)
+ */
+ unsigned short B[SHD_MAX_GRID_SIZE];
+};
+
+// OPEN - what about the enable?
+struct shd_kernel_config {
+
+ struct shd_public_config general;
+
+ struct shd_grid_public_config grid;
+
+ struct shd_black_level_public_config black_level;
+
+ struct shd_luts_public_config luts;
+};
+
+struct ia_css_2500_shd_kernel_config {
+ struct shd_kernel_config shd;
+};
+
+/** @brief Print SHD public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print SHD public configuration.
+ */
+void ia_css_shd_public_cfg_dump(const struct ia_css_2500_shd_kernel_config *cfg);
+
+/** @brief Compare two SHD public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two SHD public configurations
+ */
+bool ia_css_shd_public_cfg_compare(
+ const struct ia_css_2500_shd_kernel_config *cfg1,
+ const struct ia_css_2500_shd_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif // _SHD_PUBLIC_H_
diff --git a/include/ia_imaging/skycam_statistics.h b/include/ia_imaging/skycam_statistics.h
new file mode 100644
index 0000000..168ce27
--- /dev/null
+++ b/include/ia_imaging/skycam_statistics.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+
+#include "ia_aiq.h"
+#include "stats_3a_public.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ ia_err skycam_statistics_convert(
+ const ia_css_4a_statistics* statistics,
+ ia_aiq_rgbs_grid *out_rgbs_grid,
+ ia_aiq_af_grid *out_af_grid);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/ia_imaging/stats_3a_public.h b/include/ia_imaging/stats_3a_public.h
new file mode 100644
index 0000000..1c2bb8f
--- /dev/null
+++ b/include/ia_imaging/stats_3a_public.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _STATS_3A_PUBLIC_H_
+#define _STATS_3A_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam 3A statistics datastructures.
+*/
+
+#include <awb_public.h>
+#include <af_public.h>
+#include <ae_public.h>
+#include <awb_fr_public.h>
+typedef enum{
+ MAX_SIZE_OF_SET_AF=32,
+ MAX_SIZE_OF_SET_AWB_FR=32,
+ MAX_SIZE_OF_SET_AWB=160
+}stat_max_size_of_set ;
+
+typedef enum {
+ stat_af,
+ stat_awb_fr,
+ stat_ae,
+ stat_awb
+} statistic_type_t;
+
+struct ia_css_2500_4a_config {
+ struct ae_public_config_grid_config ae_grd_config;
+ struct awb_public_config_grid_config awb_grd_config;
+ struct af_public_grid_config af_grd_config;
+ struct awb_fr_public_grid_config awb_fr_grd_config;
+};
+
+ struct stats_4a_public_raw_buffer {
+ awb_public_raw_buffer_t awb_raw_buffer;
+ ae_public_raw_buffer_t ae_raw_buffer;
+ awb_fr_public_raw_buffer_t awb_fr_raw_buffer;
+ af_public_raw_buffer_t af_raw_buffer;
+
+};
+
+ struct ia_css_4a_statistics {
+ struct ia_css_2500_4a_config * stats_4a_config;
+ struct stats_4a_public_raw_buffer *data;
+};
+
+/** use ia_css_s3a_roi_offset struct to set 3a ROI coordinates */
+struct ia_css_s3a_roi_offset {
+ unsigned short x_coord; /**< left coordinate */
+ unsigned short y_coord; /**< top coordinate */
+};
+
+#endif /* _STATS_3A_PUBLIC_H_ */
diff --git a/include/ia_imaging/yuvp1_b0_public.h b/include/ia_imaging/yuvp1_b0_public.h
new file mode 100644
index 0000000..3e71768
--- /dev/null
+++ b/include/ia_imaging/yuvp1_b0_public.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _YUVP1_PUBLIC_H_
+#define _YUVP1_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam B0 specific noice reduction (YUV_P1 component) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+/* All structs in this file will be visible to the CSS API User.
+ * The User will be able to set each one of the config params separately by
+ * specifying a different config type (see sh_config_type in sh_css.h).
+ * If one of those config structs is not set explicitly, a default value will
+ * be use instead.
+ */
+
+#include "yuvp1_common_public.h"
+
+struct yuvp1_y_ee_nr_lpf_public_config {
+ unsigned char a_diag;
+ unsigned char a_periph;
+ unsigned char a_cent;
+ unsigned char y_ee_nr_en;
+};
+
+struct yuvp1_y_ee_nr_sense_public_config {
+
+ unsigned short edge_sense_0;
+ unsigned short delta_edge_sense;
+ unsigned short corner_sense_0;
+ unsigned short delta_corner_sense;
+
+};
+
+struct yuvp1_y_ee_nr_gain_public_config {
+
+ unsigned char gain_pos_0;
+ unsigned char delta_gain_posi;
+ unsigned char gain_neg_0;
+ unsigned char delta_gain_neg;
+
+};
+
+struct yuvp1_y_ee_nr_clip_public_config {
+
+ unsigned char clip_pos_0;
+ unsigned char delta_clip_posi;
+ unsigned char clip_neg_0;
+ unsigned char delta_clip_neg;
+
+};
+
+struct yuvp1_y_ee_nr_frng_public_config {
+
+ unsigned char gain_exp;
+ unsigned short min_edge;
+ unsigned char lin_seg_param;
+ unsigned char t1;
+ unsigned char t2;
+};
+
+struct yuvp1_y_ee_nr_diag_public_config {
+
+ unsigned char diag_disc_g;
+ unsigned char hvw_hor;
+ unsigned char dw_hor;
+ unsigned char hvw_diag;
+ unsigned char dw_diag;
+};
+
+struct yuvp1_y_ee_nr_fc_coring_public_config {
+
+ unsigned short pos_0;
+ unsigned short pos_delta;
+ unsigned short neg_0;
+ unsigned short neg_delta;
+
+};
+
+struct yuvp1_y_ee_nr_public_config {
+
+ struct yuvp1_y_ee_nr_lpf_public_config lpf;
+ struct yuvp1_y_ee_nr_sense_public_config sense;
+ struct yuvp1_y_ee_nr_gain_public_config gain;
+ struct yuvp1_y_ee_nr_clip_public_config clip;
+ struct yuvp1_y_ee_nr_frng_public_config frng;
+ struct yuvp1_y_ee_nr_diag_public_config diag;
+ struct yuvp1_y_ee_nr_fc_coring_public_config fc_coring;
+
+};
+
+struct ia_css_2500_yuvp1_b0_kernel_config {
+ struct yuvp1_y_ee_nr_public_config y_ee_nr;
+ struct yuvp1_yds_public_config yds;
+ struct yuvp1_chnr_public_config chnr;
+};
+
+/** @brief Print YUVP1_B0 public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print YUVP1_B0 public configuration.
+ */
+void ia_css_yuvp1_b0_public_cfg_dump(
+ const struct ia_css_2500_yuvp1_b0_kernel_config *cfg);
+
+/** @brief Compare two YUVP1_B0 public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two YUVP1_B0 public configurations
+ */
+bool ia_css_yuvp1_b0_public_cfg_compare(
+ const struct ia_css_2500_yuvp1_b0_kernel_config *cfg1,
+ const struct ia_css_2500_yuvp1_b0_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif
diff --git a/include/ia_imaging/yuvp1_c0_public.h b/include/ia_imaging/yuvp1_c0_public.h
new file mode 100644
index 0000000..6812f3b
--- /dev/null
+++ b/include/ia_imaging/yuvp1_c0_public.h
@@ -0,0 +1,315 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _YUVP1_C0_PUBLIC_H_
+#define _YUVP1_C0_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam C0 specific noice reduction (YUV_P1 component) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+/* All structs in this file will be visible to the CSS API User.
+ * The User will be able to set each one of the config params separately by
+ * specifying a different config type (see sh_config_type in sh_css.h).
+ * If one of those config structs is not set explicitly, a default value will
+ * be use instead.
+ */
+
+#include "yuvp1_common_public.h"
+
+/*******************************************************************/
+/* IEFD Config Units */
+/*******************************************************************/
+struct cux2 {
+ short x[2];
+ short a[1];
+ short b[1];
+};
+
+struct cux4 {
+ short x[4];
+ short a[3];
+ short b[3];
+};
+
+struct cux6 {
+ short x[6];
+ short a[5];
+ short b[5];
+};
+
+
+/**
+ * \brief IEFD's Configuration Units
+ * \details Each configuration unit define weights of different calculations.
+ */
+struct public_cfg_units {
+ struct cux2 cu_1; /**< calculates weight for blending directed and non-directed denoise elements */
+ struct cux6 cu_ed; /**< calculates weight for mean3x3 */
+ struct cux2 cu_3; /**< calculates power wdn of directed denoise element */
+ struct cux2 cu_5; /**< calculates power of non-directed denoise element apply */
+ struct cux4 cu_6; /**< calculates power of non-directed sharpening element apply */
+ struct cux2 cu_7; /**< calculates weight wos_directed for over-sharpening limit calculation */
+ struct cux4 cu_unsharp; /**< calculates unsharp mask for unsharp-blend calculation */
+ struct cux6 cu_radial; /**< calculates various radial parameters */
+ struct cux2 cu_vssnlm; /**< used to apply vssnlm filter only on edges */
+};
+
+/*******************************************************************/
+/* IEFD Config & Cotrol */
+/*******************************************************************/
+/**
+ * \brief IEFD's Configuration
+ * \details Holds general IEFD configurations
+ */
+struct yuvp1_iefd_config_public_config {
+
+ unsigned char horver_diag_coeff;/**< Coefficient that compensates for different distance for
+ vertical/horizontal and diagonal gradient calculation (~1/sqrt(2)) */
+
+ unsigned char clamp_stitch; /**< Slope to stitch between clamped and unclamped edge values */
+
+ unsigned char direct_metric_update; /**< Update coefficient for direction metric */
+
+ unsigned char ed_horver_diag_coeff; /**< Radial Coefficient that compensates for different distance for
+ vertical/horizontal and diagonal gradient calculation (~1/sqrt(2)) */
+};
+
+/**
+ * \brief IEFD's Control
+ * \details Controls algorithm's parts
+ */
+struct yuvp1_iefd_control_public_config {
+ unsigned char iefd_en;
+ unsigned char iefd_denoise_en;
+ unsigned char iefd_dir_en; /**< Enable smooth best direction with second best */
+ unsigned char iefd_radial_en; /**< Enable update radial dependent parameters */
+ unsigned char iefd_vssnlm_en; /**< Enable VSSNLM output filter */
+};
+
+/*******************************************************************/
+/* Sharpening Configuration */
+/*******************************************************************/
+
+/**
+ * \brief Sharpening Limit Configuration
+ */
+struct sharp_public_config {
+
+ unsigned short nega_lmt_txt; /**< Sharpening limit for negative overshoots for texture */
+ unsigned short posi_lmt_txt; /**< Sharpening limit for positive overshoots for texture */
+ unsigned short nega_lmt_dir; /**< Sharpening limit for negative overshoots for direction (edge) */
+ unsigned short posi_lmt_dir; /**< Sharpening limit for positive overshoots for direction (edge) */
+};
+
+/**
+ * \brief Direct/Non-Direct parameters
+ */
+struct far_w_public_config {
+ unsigned char dir_shrp; /**< Weight of wide direct sharpening */
+ unsigned char dir_dns; /**< Weight of wide direct denoising */
+ unsigned char ndir_dns_powr; /**< Power of non-direct denoising */
+};
+
+/**
+ * \brief UnSharp Configuration
+ */
+struct unsharp_cfg_public_config {
+ unsigned char unsharp_weight; /**< Unsharp Mask blending weight. 0 - disabled 64- use only Unsharp */
+ unsigned short unsharp_amount; /**< Unsharp Mask amount */
+};
+
+/**
+ * \brief Sharpening Configuration
+ */
+struct yuvp1_iefd_shrp_cfg_public_config {
+ struct sharp_public_config cfg;
+ struct far_w_public_config far_w;
+ struct unsharp_cfg_public_config unshrp_cfg;
+
+};
+
+/*******************************************************************/
+/* Unsharp mask Configuration */
+/*******************************************************************/
+
+
+struct unsharp_coef0_public_config {
+ unsigned short c00; /* Coeff11 */
+ unsigned short c01; /* Coeff12 */
+ unsigned short c02; /* Coeff13 */
+};
+
+
+struct unsharp_coef1_public_config {
+ unsigned short c11; /* Coeff22 */
+ unsigned short c12; /* Coeff23 */
+ unsigned short c22; /* Coeff33 */
+};
+
+/**
+ * \brief Unsharp Mask Filter Coefficients
+ */
+struct yuvp1_iefd_unshrp_cfg_public_config {
+ struct unsharp_coef0_public_config unsharp_coef0;
+ struct unsharp_coef1_public_config unsharp_coef1;
+};
+
+/*******************************************************************/
+/* Radius calculation Configuration */
+/*******************************************************************/
+
+/**
+ * \brief Radial Reset Parameters
+ */
+struct radial_reset {
+
+ short x; /**< Radial centre of X */
+ short y; /**< Radial centre of Y */
+ unsigned int x2; /**< X^2 */
+ unsigned int y2; /**< Y^2 */
+};
+
+/**
+ * \brief Radial Normalization parameters
+ * \details Used to normalize radius
+ */
+struct radial_cfg_public_config {
+ unsigned char rad_nf; /**< Radial norm factor */
+ unsigned char rad_inv_r2; /**< Radial R2 normalized */
+};
+
+/**
+ * \brief Radial Direct/non-Direct parameters
+ */
+struct rad_far_w_public_config {
+ unsigned char rad_dir_far_sharp_w; /**< Radial weight of wide direct sharpening */
+ unsigned char rad_dir_far_dns_w; /**< Radial weight of wide direct denoising */
+ unsigned char rad_ndir_far_dns_power; /**< Radial Power of non-direct denoising */
+};
+
+/**
+ * \brief Configuration Units Power
+ * \details Determines the power and radial power of various configuration units
+ */
+struct cu_cfg0_public_config {
+ unsigned char cu6_pow; /**< Power of CU6 (power of non-direct sharpening) */
+ unsigned char cu_unsharp_pow; /**< Power of CUUnsharp (power of unsharp mask) */
+ unsigned char rad_cu6_pow; /**< Radial/corner CU6 Directed sharpening power */
+ unsigned char rad_cu_unsharp_pow; /**< Radial power of CUUnsharp (power of unsharp mask) */
+};
+
+/**
+ * \brief Configuration Units Points Radial Configuration
+ */
+struct cu_cfg1_public_config {
+ unsigned short rad_cu6_x1; /**< X1 point of configuration unit 6. must be in the range (X0 of CU6, X2 of CU6)*/
+ unsigned short rad_cu_unsharp_x1; /**< X1 point for configuration unit Unsharp for radial/corner point
+ must be in the range (X0 of CU_unsharp, X2 of CU_unsharp)*/
+};
+
+/**
+ * \brief Radial Configuration
+ */
+struct yuvp1_iefd_rad_cfg_public_config {
+ struct radial_reset reset;
+ struct radial_cfg_public_config cfg;
+ struct rad_far_w_public_config rad_far_w;
+ struct cu_cfg0_public_config cu_cfg0;
+ struct cu_cfg1_public_config cu_cfg1;
+};
+
+/*******************************************************************/
+/* VSSNLM Configuration */
+/*******************************************************************/
+
+/**
+ * \brief VSSNLM X LUT
+ */
+struct vss_lut_x_public_config {
+ unsigned char vs_x0;
+ unsigned char vs_x1;
+ unsigned char vs_x2;
+};
+
+/**
+ * \brief VSSNLM Y LUT
+ */
+struct vss_lut_y_public_config {
+ unsigned char vs_y1;
+ unsigned char vs_y2;
+ unsigned char vs_y3;
+};
+
+/**
+ * \brief VSSNLM LUT Configuration
+ */
+struct yuvp1_iefd_vssnlm_cfg_public_config {
+ struct vss_lut_x_public_config vss_lut_x;
+ struct vss_lut_y_public_config vss_lut_y;
+};
+
+/**
+ * \brief IEFD COnfiguration
+ */
+struct yuvp1_iefd_public_config {
+ struct public_cfg_units cfg_units;
+ struct yuvp1_iefd_config_public_config config;
+ struct yuvp1_iefd_control_public_config control;
+ struct yuvp1_iefd_shrp_cfg_public_config sharp;
+ struct yuvp1_iefd_unshrp_cfg_public_config unsharp;
+ struct yuvp1_iefd_rad_cfg_public_config rad;
+ struct yuvp1_iefd_vssnlm_cfg_public_config vsslnm;
+};
+
+/**
+ * \brief YUVP1 C0 Configuration
+ * \details define full YUVP1 accelerator configuration for C0 (IEFD ff replaces B0's Y_EE_NR)
+ */
+struct ia_css_2500_yuvp1_c0_kernel_config {
+
+ struct yuvp1_iefd_public_config iefd;
+ struct yuvp1_yds_public_config yds_c0;
+ struct yuvp1_chnr_public_config chnr_c0;
+};
+
+/** @brief Print YUVP1_C0 public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print YUVP1_C0 public configuration.
+ */
+void ia_css_yuvp1_c0_public_cfg_dump(
+ const struct ia_css_2500_yuvp1_c0_kernel_config *cfg);
+
+/** @brief Compare two YUVP1_C0 public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two YUVP1_C0 public configurations
+ */
+bool ia_css_yuvp1_c0_public_cfg_compare(
+ const struct ia_css_2500_yuvp1_c0_kernel_config *cfg1,
+ const struct ia_css_2500_yuvp1_c0_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif
diff --git a/include/ia_imaging/yuvp1_common_public.h b/include/ia_imaging/yuvp1_common_public.h
new file mode 100644
index 0000000..1958973
--- /dev/null
+++ b/include/ia_imaging/yuvp1_common_public.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _YUVP1_COMMON_PUBLIC_H_
+#define _YUVP1_COMMON_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam specific noice reduction (YUV_P1 component) kernel/accelerator.
+*/
+
+/* All structs in this file will be visible to the CSS API User.
+ * The User will be able to set each one of the config params separately by
+ * specifying a different config type (see sh_config_type in sh_css.h).
+ * If one of those config structs is not set explicitly, a default value will
+ * be use instead.
+ */
+
+struct yuvp1_yds_public_config {
+
+ unsigned char c00;
+ unsigned char c01;
+ unsigned char c02;
+ unsigned char c03;
+ unsigned char c10;
+ unsigned char c11;
+ unsigned char c12;
+ unsigned char c13;
+ unsigned char norm_factor;
+ unsigned char bin_output;
+
+};
+
+struct yuvp1_chnr_coring_public_config {
+
+ unsigned short u;
+ unsigned short v;
+
+};
+
+struct yuvp1_chnr_sense_gain_public_config {
+
+ unsigned char vy;
+ unsigned char vu;
+ unsigned char vv;
+
+ unsigned char hy;
+ unsigned char hu;
+ unsigned char hv;
+};
+
+struct yuvp1_chnr_iir_fir_public_config {
+
+ unsigned char fir_0h;
+ unsigned char fir_1h;
+ unsigned char fir_2h;
+ unsigned short iir_min_prev; /* like in the ATE filter */
+
+};
+
+struct yuvp1_chnr_public_config {
+
+ struct yuvp1_chnr_coring_public_config coring;
+ struct yuvp1_chnr_sense_gain_public_config sense_gain;
+ struct yuvp1_chnr_iir_fir_public_config iir_fir;
+
+};
+
+#endif
diff --git a/include/ia_imaging/yuvp2_common_defs.h b/include/ia_imaging/yuvp2_common_defs.h
new file mode 100644
index 0000000..ddc4f27
--- /dev/null
+++ b/include/ia_imaging/yuvp2_common_defs.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _YUVP2_COMMON_DEFS_H_
+#define _YUVP2_COMMON_DEFS_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam specific YUV color enhancement kernel/accelerator.
+*/
+
+#define YUVP2_YTM_LUT_NUM_OF_ENTRIES 256
+#define YUVP2_TCC_NUM_OF_MACC_TABLE_ELEMENTS 16
+#define YUVP2_TCC_NUM_OF_INV_Y_LUT_ELEMENTS 14
+#define YUVP2_TCC_NUM_OF_GAIN_PCWL_LUT_ELEMENTS 258
+#define YUVP2_TCC_NUM_OF_R_SQR_LUT_ELEMENTS 24
+
+#endif
diff --git a/include/ia_imaging/yuvp2_public.h b/include/ia_imaging/yuvp2_public.h
new file mode 100644
index 0000000..4c1aab4
--- /dev/null
+++ b/include/ia_imaging/yuvp2_public.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2015 - 2017 Intel Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _YUVP2_PUBLIC_H_
+#define _YUVP2_PUBLIC_H_
+
+/** @file
+* CSS-API header file for 2500/Skycam color enhancement (YUV_P2 component) kernel/accelerator.
+*/
+//#include <type_support.h>
+
+/*
+ * All structs in this file will be visible to the CSS API User.
+ * The User will be able to set each one of the config params separately by
+ * specifying a different config type (see sh_config_type in sh_css.h).
+ * If one of those config structs is not set explicitly, a default value will
+ * be use instead.
+ */
+
+#include "yuvp2_common_defs.h"
+
+/******************
+* Y-TM
+*******************/
+
+struct yuvp2_ytm_public_config {
+ unsigned short entries[YUVP2_YTM_LUT_NUM_OF_ENTRIES];
+ unsigned int ytm_en;
+};
+
+/******************
+* YDS
+*******************/
+struct yuvp2_yds_public_config {
+
+ unsigned char c00;
+ unsigned char c01;
+ unsigned char c02;
+ unsigned char c03;
+ unsigned char c10;
+ unsigned char c11;
+ unsigned char c12;
+ unsigned char c13;
+ unsigned char norm_factor;
+ unsigned char bin_output;
+
+};
+
+/*******************
+* TCC
+********************/
+
+struct yuvp2_tcc_gen_control_public_config {
+ unsigned char blend_shift;
+ unsigned char gain_according_to_y_only;
+ signed char gamma;
+ signed char delta;
+
+};
+
+struct yuvp2_tcc_macc_elem_public_config {
+ signed short A;
+ signed short B;
+ signed short C;
+ signed short D;
+};
+
+struct yuvp2_tcc_macc_table_public_config {
+ struct yuvp2_tcc_macc_elem_public_config entries[YUVP2_TCC_NUM_OF_MACC_TABLE_ELEMENTS];
+};
+
+
+struct yuvp2_tcc_inv_y_lut_public_config {
+ unsigned short entries[YUVP2_TCC_NUM_OF_INV_Y_LUT_ELEMENTS];
+};
+
+
+struct yuvp2_tcc_gain_pcwl_lut_public_config {
+ unsigned short entries[YUVP2_TCC_NUM_OF_GAIN_PCWL_LUT_ELEMENTS];
+};
+
+
+struct yuvp2_tcc_r_sqr_lut_public_config {
+ unsigned short entries[YUVP2_TCC_NUM_OF_R_SQR_LUT_ELEMENTS];
+};
+
+struct yuvp2_tcc_public_config {
+ struct yuvp2_tcc_gen_control_public_config gen_control;
+ struct yuvp2_tcc_macc_table_public_config macc_table;
+ struct yuvp2_tcc_inv_y_lut_public_config inv_y_lut;
+ struct yuvp2_tcc_gain_pcwl_lut_public_config gain_pcwl;
+ struct yuvp2_tcc_r_sqr_lut_public_config r_sqr_lut;
+};
+
+
+/****************************
+* YUVP2 combined
+****************************/
+
+struct ia_css_2500_yuvp2_kernel_config {
+
+ struct yuvp2_ytm_public_config ytm;
+ struct yuvp2_yds_public_config yds2;
+ struct yuvp2_tcc_public_config tcc;
+};
+
+/** @brief Print YUVP2 public configuration
+ *
+ * @param cfg The pointer to configuration data
+ * @return None
+ *
+ * Print YUVP2 public configuration.
+ */
+void ia_css_yuvp2_public_cfg_dump(
+ const struct ia_css_2500_yuvp2_kernel_config *cfg);
+
+/** @brief Compare two YUVP2 public configurations
+ *
+ * @param cfg1 The pointer to first configuration data
+ * @param cfg2 The pointer to second configuration data
+ * @param cfg_dump Configurations are printed in case of
+ * mismatch
+ * @return true - match, false - not match
+ *
+ * Compare two YUVP2 public configurations
+ */
+bool ia_css_yuvp2_public_cfg_compare(
+ const struct ia_css_2500_yuvp2_kernel_config *cfg1,
+ const struct ia_css_2500_yuvp2_kernel_config *cfg2,
+ bool cfg_dump);
+
+#endif
diff --git a/meson.build b/meson.build
index a72f672..683af0e 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,22 @@ libcamera_dep = dependency('libcamera')
libcamera_base = dependency('libcamera-base')
libatomic = cc.find_library('atomic', required : false)
+ia_deps = [
+ cc.find_library('libia_aiq'),
+ cc.find_library('libia_exc'),
+ cc.find_library('libia_coordinate'),
+ cc.find_library('libia_nvm'),
+ cc.find_library('libia_cmc_parser'),
+ cc.find_library('libia_mkn'),
+ cc.find_library('libia_log'),
+ cc.find_library('libSkyCamAICKBL'),
+]
+
+ia_imaging_dep = declare_dependency(
+ dependencies : ia_deps,
+ include_directories : include_directories('include/ia_imaging'),
+)
+
config_h = configuration_data()
if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOURCE')
@@ -33,6 +49,7 @@ common_arguments = [
ipa_includes = [
include_directories('include'),
+ include_directories('include/ia_imaging'),
]
c_arguments = []
@@ -70,6 +87,7 @@ ipu3_ipa_deps = [
libatomic,
libcamera_base,
libcamera_dep,
+ ia_imaging_dep,
]
subdir('data')