diff --git a/include/ipu75xa/ia_imaging/ia_aiq.h b/include/ipu75xa/ia_imaging/ia_aiq.h index 47602bd..908ecca 100644 --- a/include/ipu75xa/ia_imaging/ia_aiq.h +++ b/include/ipu75xa/ia_imaging/ia_aiq.h @@ -1,5 +1,5 @@ /* - * Copyright 2012-2025 Intel Corporation + * Copyright 2012-2026 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -662,6 +662,7 @@ ia_aiq_sensor_events_set_v2(ia_aiq *a_ia_aiq_ptr, */ LIBEXPORT ia_err ia_aiq_segmap_decode( + ia_aiq *a_ia_aiq_ptr, const ia_aiq_segmap_input_params* segmap_input, ia_segmap_grid* segmap_grid_ptr); diff --git a/include/ipu75xa/ia_imaging/ia_configuration.h b/include/ipu75xa/ia_imaging/ia_configuration.h index b1ed4c9..c604c7d 100644 --- a/include/ipu75xa/ia_imaging/ia_configuration.h +++ b/include/ipu75xa/ia_imaging/ia_configuration.h @@ -33,7 +33,7 @@ #define IA_CCAT_ROIS_MAX_NUM 1 #define IA_CCAT_CONVOLUTION_FILTER_GRID_ENABLED #define IA_CCAT_EXTERNAL_SENSORS_ENABLED -/* #undef IA_CCAT_EXTERNAL_SEGMAP_ENABLED */ +#define IA_CCAT_EXTERNAL_SEGMAP_ENABLED #define ENABLE_RGB_IR_SENSOR #define ENABLE_AIQD #define ENABLE_AEC diff --git a/include/ipu75xa/ia_imaging/ia_statistics_types.h b/include/ipu75xa/ia_imaging/ia_statistics_types.h index 4aab6b7..5436e3e 100644 --- a/include/ipu75xa/ia_imaging/ia_statistics_types.h +++ b/include/ipu75xa/ia_imaging/ia_statistics_types.h @@ -1,5 +1,5 @@ /* - * Copyright 2018-2025 Intel Corporation + * Copyright 2018-2026 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,7 +130,14 @@ typedef struct { unsigned int grid_width; /*!< Mandatory. Width of segmap grids. */ unsigned int grid_height; /*!< Mandatory. Height of segmap grids. */ - unsigned char class_id_conf[IA_RGBS_GRID_SIZE]; /*!< Mandatory. Class id and Confidence level data. [0, 15]. */ + unsigned char class_id_conf[IA_RGBS_GRID_SIZE]; /*!< Mandatory. Packed byte structure for efficient storage: + * ┌─────────────┬─────────────┐ + * │ High 4 bits │ Low 4 bits │ + * │ Class ID │ Confidence │ + * │ [0-15] │ [0-15] │ + * └─────────────┴─────────────┘ + * Extract class_id: (class_id_conf >> 4) + * Extract confidence: (class_id_conf & 0xF) */ uint64_t frame_id; } ia_segmap_grid; diff --git a/include/ipu7x/ia_imaging/ia_aiq.h b/include/ipu7x/ia_imaging/ia_aiq.h index 47602bd..908ecca 100644 --- a/include/ipu7x/ia_imaging/ia_aiq.h +++ b/include/ipu7x/ia_imaging/ia_aiq.h @@ -1,5 +1,5 @@ /* - * Copyright 2012-2025 Intel Corporation + * Copyright 2012-2026 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -662,6 +662,7 @@ ia_aiq_sensor_events_set_v2(ia_aiq *a_ia_aiq_ptr, */ LIBEXPORT ia_err ia_aiq_segmap_decode( + ia_aiq *a_ia_aiq_ptr, const ia_aiq_segmap_input_params* segmap_input, ia_segmap_grid* segmap_grid_ptr); diff --git a/include/ipu7x/ia_imaging/ia_configuration.h b/include/ipu7x/ia_imaging/ia_configuration.h index b1ed4c9..c604c7d 100644 --- a/include/ipu7x/ia_imaging/ia_configuration.h +++ b/include/ipu7x/ia_imaging/ia_configuration.h @@ -33,7 +33,7 @@ #define IA_CCAT_ROIS_MAX_NUM 1 #define IA_CCAT_CONVOLUTION_FILTER_GRID_ENABLED #define IA_CCAT_EXTERNAL_SENSORS_ENABLED -/* #undef IA_CCAT_EXTERNAL_SEGMAP_ENABLED */ +#define IA_CCAT_EXTERNAL_SEGMAP_ENABLED #define ENABLE_RGB_IR_SENSOR #define ENABLE_AIQD #define ENABLE_AEC diff --git a/include/ipu7x/ia_imaging/ia_pal_types_isp_ids_autogen.h b/include/ipu7x/ia_imaging/ia_pal_types_isp_ids_autogen.h index ebbc996..45f708b 100644 --- a/include/ipu7x/ia_imaging/ia_pal_types_isp_ids_autogen.h +++ b/include/ipu7x/ia_imaging/ia_pal_types_isp_ids_autogen.h @@ -49,6 +49,7 @@ typedef enum ia_pal_uuid_isp_bxt_demosaic = 48695, ia_pal_uuid_isp_cas_1_0 = 22660, ia_pal_uuid_isp_ccm_3a_2_0 = 62344, + ia_pal_uuid_isp_deskview_1_0 = 39181, ia_pal_uuid_isp_dol_lite_1_0 = 3700, ia_pal_uuid_isp_fr_grid_1_0 = 26958, ia_pal_uuid_isp_gammatm_v3 = 57496, @@ -99,6 +100,7 @@ typedef enum ia_pal_uuid_isp_pext_1_0 = 43213, ia_pal_uuid_isp_rgb_ir_2_0 = 14488, ia_pal_uuid_isp_rgbs_grid_1_1 = 15021, + ia_pal_uuid_isp_rotator_1_0 = 36947, ia_pal_uuid_isp_tm_app = 37003, ia_pal_uuid_isp_tnr_scale_lb = 33723, ia_pal_uuid_isp_tnr_scale_fp = 60056, diff --git a/include/ipu7x/ia_imaging/ia_statistics_types.h b/include/ipu7x/ia_imaging/ia_statistics_types.h index 4aab6b7..5436e3e 100644 --- a/include/ipu7x/ia_imaging/ia_statistics_types.h +++ b/include/ipu7x/ia_imaging/ia_statistics_types.h @@ -1,5 +1,5 @@ /* - * Copyright 2018-2025 Intel Corporation + * Copyright 2018-2026 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,7 +130,14 @@ typedef struct { unsigned int grid_width; /*!< Mandatory. Width of segmap grids. */ unsigned int grid_height; /*!< Mandatory. Height of segmap grids. */ - unsigned char class_id_conf[IA_RGBS_GRID_SIZE]; /*!< Mandatory. Class id and Confidence level data. [0, 15]. */ + unsigned char class_id_conf[IA_RGBS_GRID_SIZE]; /*!< Mandatory. Packed byte structure for efficient storage: + * ┌─────────────┬─────────────┐ + * │ High 4 bits │ Low 4 bits │ + * │ Class ID │ Confidence │ + * │ [0-15] │ [0-15] │ + * └─────────────┴─────────────┘ + * Extract class_id: (class_id_conf >> 4) + * Extract confidence: (class_id_conf & 0xF) */ uint64_t frame_id; } ia_segmap_grid; diff --git a/include/ipu8/ia_imaging/CCAMacro.h b/include/ipu8/ia_imaging/CCAMacro.h new file mode 100644 index 0000000..32f6ae2 --- /dev/null +++ b/include/ipu8/ia_imaging/CCAMacro.h @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2021-2025 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 CCAMacro.h + * @brief This file contains macro definitions and constants used in the CCA module for IPU8. + * + * The constants defined in this file are used throughout the CCA module to configure + * various parameters such as maximum lengths, sizes, and default values. + * These definitions should ideally be generated automatically to support different + * platforms or products, as they depend on sensor, IPU, etc. + */ + +#ifndef CCAMACRO_H_ +#define CCAMACRO_H_ + +#include + +namespace cca { + +/* + * TODO: + * This config file should be generated automatically to support different + * platforms or products, because the below definitions should depend on + * sensor, IPU, etc. + */ +/** + * @brief Maximum number of cameras. + */ +const uint32_t MAX_CAM_NUM = 4U; + +/** + * @brief Maximum length of CPF (Camera Parameter File). + */ +const uint32_t MAX_CPF_LEN = 1024 * 1024 * 4; + +/** + * @brief Maximum length of NVM (Non-Volatile Memory). + */ +const uint32_t MAX_NVM_LEN = 1024 * 16; + +/** + * @brief Maximum length of AIQD (AIQ Data). + */ +const uint32_t MAX_AIQD_LEN = 1024 * 1024; + +/** + * @brief Maximum length of MKN (Makernote). + */ +const uint32_t MAX_MKN_LEN = 80 * 1024; + +/** + * @brief Maximum section size of MKN. + */ +const uint32_t MAX_MKN_SECTION_SIZE = 100000; + +/** + * @brief Maximum length of CMC (Camera Module Calibration). + */ +const uint32_t MAX_CMC_LEN = 1024 * 1024; + +/** + * @brief Maximum length of tag list. + */ +const uint32_t MAX_TAG_LIST_LEN = 8; + +/** + * @brief Default frames per second. + */ +const uint32_t DEFAULT_FPS = 30; + +/** + * @brief Maximum number of exposures. + */ +const uint32_t MAX_NUM_EXPOSURE = 4; + +/** + * @brief Maximum number of statistics. + */ +const uint32_t MAX_NUM_STATS = 5; + +/** + * @brief Maximum number of AF (Auto Focus) statistics. + */ +const uint32_t MAX_NUM_AF_STATS = 1; + +/** + * @brief Maximum number of sensors. + */ +const uint32_t MAX_SENSOR = 2; + +/** + * @brief Maximum exposure plan. + */ +const uint32_t MAX_EXPO_PLAN = 4; + +/** + * @brief Maximum number of flash LEDs. + */ +const uint32_t MAX_NUM_FLASH_LEDS = 1; + +/** + * @brief Maximum Bayer order number. + */ +const uint32_t MAX_BAYER_ORDER_NUM = 4; + +/** + * @brief Maximum DVS (Digital Video Stabilization) vector count. + */ +const uint32_t MAX_DVS_VECTOR_COUNT = 100 * 100; + +/** + * @brief Maximum SIS (Super Image Stabilization) frame size. + */ +const uint32_t MAX_SIS_FRAME_SIZE = 500 * 500 * 4; + +/** + * @brief Maximum PAL (Platform Abstraction Layer) tuning size. + */ +const uint32_t MAX_PAL_TUNING_SIZE = 1024 * 1024; + +/** + * @brief Maximum custom controls parameter size. + */ +const uint32_t MAX_CUSTOM_CONTROLS_PARAM_SIZE = 128; + +/** + * @brief Maximum number of kernels in a pipeline. + */ +const uint32_t MAX_KERNEL_NUMBERS_IN_PIPE = 128; + +/** + * @brief Maximum AF grid width. + */ +const uint32_t MAX_AF_GRID_WIDTH = 128; + +/** + * @brief Maximum AF grid height. + */ +const uint32_t MAX_AF_GRID_HEIGHT = 128; + +/** + * @brief Maximum weight grid size. + */ +const uint32_t MAX_WEIGHT_GRID_SIZE = 64 * 64; + +/** + * @brief Maximum AF statistics grid size. + */ +const uint32_t MAX_AF_STATS_GRID_SIZE = (MAX_AF_GRID_WIDTH * MAX_AF_GRID_HEIGHT); + +/** + * @brief Maximum GRBS grid width. + */ +const uint32_t MAX_GRBS_GRID_WIDTH = 150; + +/** + * @brief Maximum GRBS grid height. + */ +const uint32_t MAX_GRBS_GRID_HEIGHT = 150; + +/** + * @brief Maximum RGBS statistics grid size. + */ +const uint32_t MAX_RGBS_STATS_GRID_SIZE = (MAX_GRBS_GRID_WIDTH * MAX_GRBS_GRID_HEIGHT); + +/** + * @brief Maximum statistics length. + */ +const uint32_t MAX_STATS_LEN = 1024 * 1024; + +/** + * @brief Maximum number of faces. + */ +const uint32_t MAX_FACE_NUM = 32; + +/** + * @brief Maximum LSC (Lens Shading Correction) dimension. + */ +const uint32_t MAX_LSC_DIM = 4; + +/** + * @brief Maximum LSC dimension size. + */ +const uint32_t MAX_LSC_DIM_SIZE = 4; + +/** + * @brief Maximum LSC grid size. + */ +const uint32_t MAX_LSC_GRID_SIZE = 128 * 128; + +/** + * @brief Maximum gamma LUT (Look-Up Table) size. + */ +const uint32_t MAX_GAMMA_LUT_SIZE = 2048; + +/** + * @brief Maximum tone map LUT size. + */ +const uint32_t MAX_TONE_MAP_LUT_SIZE = 2048; + +/** + * @brief Maximum number of sectors. + */ +const uint32_t MAX_NUM_SECTORS = 36; + +/** + * @brief Maximum IR (Infrared) weight grid size. + */ +const uint32_t MAX_IR_WEIGHT_GRID_SIZE = 480; + +/** + * @brief GDC (Geometric Distortion Correction) Y block width. + */ +const uint32_t GDC_Y_BLOCK_WIDTH = 32; + +/** + * @brief GDC UV block width. + */ +const uint32_t GDC_UV_BLOCK_WIDTH = 16; + +/** + * @brief GDC Y block height. + */ +const uint32_t GDC_Y_BLOCK_HEIGHT = 32; + +/** + * @brief GDC UV block height. + */ +const uint32_t GDC_UV_BLOCK_HEIGHT = 16; + +/** + * @brief GDC split metadata length. + */ +const uint32_t GDC_SPLIT_METADATA_LEN = 4; + +/** + * @brief GDC clip maximum angle. + */ +const float GDC_CLIP_MAX_ANGLE = 3.5f; + +/** + * @brief Maximum number of kernels in a processing group. + */ +const uint32_t MAX_KERNEL_NUM_IN_PG = 128; + +/** + * @brief Maximum number of processing groups. + */ +const uint32_t MAX_PG_NUM = 5; + +/** + * @brief Maximum number of terminals in a processing group. + */ +const uint32_t MAX_PG_TERMINAL_NUM = 38; + +/** + * @brief Minimum manual gamma value. + */ +const float MIN_MANUAL_GAMMA = 0.1f; + +/** + * @brief Maximum manual gamma value. + */ +const float MAX_MANUAL_GAMMA = 5.0f; + +/** + * @brief PDAF (Phase Detection Auto Focus) statistics grid width. + */ +const uint32_t PDAF_STATS_GRID_WIDTH = 16; + +/** + * @brief PDAF statistics grid height. + */ +const uint32_t PDAF_STATS_GRID_HEIGHT = 12; + +/** + * @brief Number of non-SVE (Super Video Engine) PDAF statistics. + */ +const uint32_t PDAF_STATS_NUM_NONSVE = 1; + +/** + * @brief Maximum number of streams. + */ +const uint32_t MAX_STREAM_NUM = 5; + +/** + * @brief Maximum number of RGBIR models. + */ +const uint32_t MAX_RGBIR_MODELS = 3; + +/** + * @brief Invalid frame ID. + */ +const uint64_t INVALID_FRAME_ID = static_cast(-1); + +/** + * @brief Number of ACM (Advanced Color Management) segments. + */ +const uint32_t NUM_OF_ACM_SEGMENTS = 6U; + +/** + * @brief Number of sectors per ACM segment. + */ +const uint32_t NUM_OF_SECTORS_PER_SEGMENT = 6U; + +/** + * @brief Maximum number of fragments. + */ +const uint32_t MAX_NUMBER_OF_FRAGMENTS = 10U; +}//cca +#endif //CCAMACRO_H_ diff --git a/include/ipu8/ia_imaging/CCAStorage.h b/include/ipu8/ia_imaging/CCAStorage.h new file mode 100644 index 0000000..974ad39 --- /dev/null +++ b/include/ipu8/ia_imaging/CCAStorage.h @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2020-2024 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 CCAStorage.h + * @brief This file contains the declaration of the CCAStorage class and related structures for AIQ result storage. + * + * The CCAStorage class provides an interface for storing and querying AIQ algorithm results. + * It supports both standard and customized standard libraries for map and list data structures. + */ + +#ifndef CCASTORAGE_H_ +#define CCASTORAGE_H_ + +#include "ia_abstraction.h" +#include "IntelCCATypes.h" +#include "CCAMacro.h" + +#ifndef ENABLE_CUSTOMIZED_STD_LIB +#include +#include +#else +#include "FixedMap.h" +#include "FixedList.h" +#endif + +namespace cca { + +/** + * @brief AIQ results structure used in CCAStorage. + */ +typedef struct { + //aec results + ia_aiq_ae_exposure_result exposure_results[MAX_NUM_EXPOSURE]; /**< AEC results */ + ia_aiq_aperture_control aperture_control; /**< Aperture control */ + ia_aiq_hist_weight_grid weight_grid; /**< Histogram weight grid */ + uint8_t weights[MAX_WEIGHT_GRID_SIZE]; /**< Weights for the histogram grid */ + ia_aiq_flash_parameters flashes[MAX_NUM_FLASH_LEDS]; /**< Flash parameters */ + ia_aiq_exposure_parameters generic_exposure[MAX_NUM_EXPOSURE * MAX_EXPO_PLAN]; /**< Generic exposure parameters */ + ia_aiq_exposure_sensor_parameters sensor_exposure[MAX_NUM_EXPOSURE * MAX_EXPO_PLAN]; /**< Sensor exposure parameters */ + + //gbce results + float32_t r_gamma_lut[MAX_GAMMA_LUT_SIZE]; /**< Red gamma LUT */ + float32_t g_gamma_lut[MAX_GAMMA_LUT_SIZE]; /**< Green gamma LUT */ + float32_t b_gamma_lut[MAX_GAMMA_LUT_SIZE]; /**< Blue gamma LUT */ + float32_t tone_map_lut[MAX_TONE_MAP_LUT_SIZE]; /**< Tone map LUT */ + + //pa results + ia_aiq_advanced_ccm_t preferred_acm; /**< Preferred ACM */ + uint32_t hue_sectors[MAX_NUM_SECTORS]; /**< Hue sectors */ + float32_t ACM[MAX_NUM_SECTORS][3][3]; /**< Advanced color conversion matrices */ + ia_aiq_ir_weight_t ir_weight; /**< IR weight */ + uint16_t ir_weight_r[MAX_IR_WEIGHT_GRID_SIZE]; /**< IR weight for red channel */ + uint16_t ir_weight_g[MAX_IR_WEIGHT_GRID_SIZE]; /**< IR weight for green channel */ + uint16_t ir_weight_b[MAX_IR_WEIGHT_GRID_SIZE]; /**< IR weight for blue channel */ + ia_aiq_rgbir_t rgbir; /**< RGBIR data */ + ia_aiq_rgbir_model_t models[MAX_RGBIR_MODELS]; /**< RGBIR models */ + ia_aiq_advanced_ccm_SAP_t preferred_acm_SAP; /**< Preferred ACM SAP */ + int32_t sector_index_array[NUM_OF_ACM_SEGMENTS][NUM_OF_SECTORS_PER_SEGMENT]; /**< Sector index array */ + float32_t advanced_color_conversion_matrices[NUM_OF_ACM_SEGMENTS][NUM_OF_SECTORS_PER_SEGMENT][3][3]; /**< Advanced color conversion matrices */ + + /*LDRA_INSPECTED 67 X */ + ia_aiq_pa_results_v1 pa_results; /**< PA results */ + ia_aiq_awb_results awb_results; /**< AWB results */ + ia_aiq_ae_results aec_results; /**< AEC results */ + ia_aiq_af_results af_results; /**< AF results */ + /*LDRA_INSPECTED 67 X */ + ia_aiq_gbce_results gbce_results; /**< GBCE results */ + /*LDRA_INSPECTED 67 X */ + ia_aiq_sa_results_v1 sa_results; /**< SA results */ + uint32_t result_bitmap; /**< Result bitmap */ +} aiq_results; + +/** + * @brief Storage for AIQ results. + */ +struct cca_aiq_results_storage { + aiq_results* aiq_results_ptr; /**< Pointer to AIQ results */ + ia_aiq_pa_results_v1* pa_results; /**< Pointer to PA results */ + ia_aiq_awb_results* awb_results; /**< Pointer to AWB results */ + ia_aiq_ae_results* aec_results; /**< Pointer to AEC results */ + ia_aiq_af_results* af_results; /**< Pointer to AF results */ + ia_aiq_gbce_results* gbce_results; /**< Pointer to GBCE results */ + ia_aiq_sa_results_v1 *sa_results; /**< Pointer to SA results */ + uint32_t *aiq_results_bitmap; /**< Pointer to AIQ results bitmap */ + + /** + * @brief Constructor for cca_aiq_results_storage. + */ + cca_aiq_results_storage() : + aiq_results_ptr(nullptr), + pa_results(nullptr), + awb_results(nullptr), + aec_results(nullptr), + af_results(nullptr), + gbce_results(nullptr), + sa_results(nullptr), + aiq_results_bitmap(nullptr) + {} +}; + +/** + * @brief Interface exposed to IntelCCA for AIQ algorithm result storage. + */ +class CCAStorage { +public: + /** + * @brief Constructor for CCAStorage. + * @param len Length of the storage. + */ + explicit CCAStorage(uint8_t len); + + /** + * @brief Save AIQ results. + * @param frameId Frame ID. + * @param results AIQ results to save. + * @return Error code. + */ + ia_err saveAiqResults(uint64_t frameId, const cca_aiq_results_storage& results); + + /** + * @brief Query AIQ results. + * @param frameId Frame ID. + * @param results Pointer to store the queried results. + * @return Error code. + */ + ia_err queryAiqResults(uint64_t frameId, cca_aiq_results_storage* results); + + /** + * @brief Destructor for CCAStorage. + */ + virtual ~CCAStorage(); + +private: + /** + * @brief Create AIQ result. + * @return Error code. + */ + ia_err createAiqResult(); + + /** + * @brief Delete AIQ result. + */ + void deleteAiqResult(); + + /** + * @brief Reset AIQ result. + * @param results Pointer to AIQ results. + * @param bitmap Bitmap for the results. + * @return Error code. + */ + ia_err resetAiqResult(aiq_results* results, CCAModuleBitMap bitmap) const; + + /** + * @brief Initialize AIQ result element. + * @param aiqResults Pointer to AIQ results. + * @return Error code. + */ + ia_err initAiqResultEle(aiq_results *aiqResults) const; + + /** + * @brief Query cold start results. + * @param results Pointer to store the queried results. + * @return Error code. + */ + ia_err queryColdStartResults(cca_aiq_results_storage *results); + +#ifndef ENABLE_CUSTOMIZED_STD_LIB + std::map mAiqResultsMap; /**< Map to store AIQ results */ + std::list mFrameIdList; /**< List of frame IDs */ +#else + static const uint8_t kAiqResultsMapCap = 5U; /**< Capacity of the AIQ results map */ + FixedMap mAiqResultsMap; /**< Fixed map to store AIQ results */ + FixedList mFrameIdList; /**< Fixed list of frame IDs */ +#endif + + uint8_t mStorageLen; /**< Length of the storage */ + mutex_t mStorageMutex; /**< Mutex for storage synchronization */ + aiq_results *mAiqResults; /**< Pointer to AIQ results */ + aiq_results mColdStartAiqResults; /**< Cold start AIQ results */ +}; + +}//cca +#endif //CCASTORAGE_H_ diff --git a/include/ipu8/ia_imaging/IIPUAic.h b/include/ipu8/ia_imaging/IIPUAic.h new file mode 100644 index 0000000..6d99253 --- /dev/null +++ b/include/ipu8/ia_imaging/IIPUAic.h @@ -0,0 +1,489 @@ +/* + * Copyright (C) 2020-2025 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 IIPUAIC_H_ +#define IIPUAIC_H_ + +#include "ia_aic_class.h" +#include "ia_ccat_types.h" +#include "CCAStorage.h" +#include "IntelCCATypes.h" +#include "ia_coordinate.h" +#include "ia_aic_types.h" + +#ifdef ENABLE_CUSTOMIZED_STD_LIB +#include "FixedMap.h" +#include "FixedList.h" +#include "FixedVector.h" +#else +#include +#include +#endif + +namespace cca { + +/*! + * \brief Structure to hold AIC handle information. + */ +typedef struct { + uint32_t cb_num; /*!< Number of cb. */ + int32_t group_id[MAX_PG_NUM]; /*!< Group IDs. */ + aic::IaAic* handle_ptr; /*!< Pointer to the AIC handle. */ +} cca_aic_handle; + +/*! + * \brief configure the kernels in cb for AIC + */ +typedef struct { + int group_id; /*!< Group ID. */ + int fragment_count; /*!< Number of fragments. */ + aic::ImagingKernelGroup *kernel_group; /*!< Pointer to the kernel group. */ +} cca_cb_config; + +/*! + * \brief Configuration for the kernels in the entire pipeline for AIC. + */ +struct cca_aic_config { + uint32_t cb_num; /*!< Number of cb. */ +#ifdef ENABLE_STL_LIB + std::vector cb_config; /*!< Vector of cb configurations. */ +#else + cca_cb_config cb_config[MAX_PG_NUM]; /*!< Array of cb configurations. */ +#endif + + cca_aic_config() : cb_num(0) { +#ifndef ENABLE_STL_LIB + IA_MEMSET(cb_config, 0, MAX_PG_NUM * sizeof(cca_cb_config)); +#endif + } +}; + +/*! + * \brief Structure for terminal buffer. + */ +typedef struct { + uint32_t terminal_index; /*!< Terminal index. */ + size_t buf_size; /*!< Buffer size. */ + aic::IaAicBuffer *payload; /*!< Pointer to the payload buffer. */ + uint32_t fragment_index; /*!< Fragment index. */ +} cca_terminal_buf; + +/*! + * \brief Structure for terminals in a cb. + */ +typedef struct { + int group_id; /*!< Group ID for the cb. */ + uint32_t num_terminal; /*!< Number of terminals. */ +#ifdef ENABLE_STL_LIB + std::vector terminal_buf; /*!< Vector of terminal buffers. */ +#else + cca_terminal_buf terminal_buf[MAX_PG_TERMINAL_NUM * MAX_NUMBER_OF_FRAGMENTS]; /*!< Array of terminal buffers. */ +#endif +} cca_cb_termal_buf; + +/*! + * \brief Configuration for terminals in the entire pipeline for AIC. + */ +typedef struct { + uint32_t cb_num; /*!< Number of cb. */ +#ifdef ENABLE_STL_LIB + std::vector cb_terminal_buf; /*!< Vector of control block terminal buffers. */ +#else + cca_cb_termal_buf cb_terminal_buf[MAX_PG_NUM]; /*!< Array of control block terminal buffers. */ +#endif +} cca_aic_terminal_config; + +/*! + * \brief Structure for kernel offset configuration for AIC. + */ +typedef struct { + int uuid; /*!< UUID for the kernel. */ + aic::IaAicBufferTypes terminal_type; /*!< Terminal type. */ + uint32_t terminal_index; /*!< Terminal index. */ + uint32_t *offsets; /*!< Pointer to the offsets array. */ + uint32_t *sizes; /*!< Pointer to the sizes array. */ + uint32_t num_offsets; /*!< Number of offsets. */ + uint32_t fragment; /*!< Fragment index. */ +} cca_kernel_offset; + +/*! + * \brief Structure for kernel offset configuration for a specific cb. + */ +typedef struct { + int group_id; /*!< Group ID for the cb. */ + uint32_t num_kernels; /*!< Number of kernels. */ +#ifdef ENABLE_STL_LIB + std::vector kernels_offset; /*!< Vector of kernel offsets. */ +#else + cca_kernel_offset kernels_offset[MAX_KERNEL_NUM_IN_PG]; /*!< Array of kernel offsets. */ +#endif +} cca_cb_kernel_offset; + +/*! + * \brief Configuration for all kernel offsets in the entire pipeline for AIC. + */ +typedef struct { + uint32_t cb_num; /*!< Number of cb. */ +#ifdef ENABLE_STL_LIB + std::vector cb_kernel_offset; /*!< Vector of control block kernel offsets. */ +#else + cca_cb_kernel_offset cb_kernel_offset[MAX_PG_NUM]; /*!< Array of control block kernel offsets. */ +#endif +} cca_aic_kernel_offset; + +/*! + * \brief Structure for PAL binary dump. + */ +typedef struct { + int group_id; /*!< Group ID for the cb. */ + aic::IaBinaryData bin; +}cca_pal_output; + +/*! + * \brief Structure for multiple PAL outputs. + */ +typedef struct { + uint32_t cb_num; /*!< Number of cb. */ + cca_pal_output cb_output[MAX_PG_NUM]; /*!< Array of cb outputs. */ +} cca_multi_pal_output; + +/*! + * \brief Structure for frame statistics. + */ +struct cca_frame_stats { + ia_ccat_frame_statistics stats; /*!< Frame statistics filled by calling decodeStats. */ + uint32_t illuminated; /*!< Optional. Filled by driver/HAL. */ + uint32_t flashStage; /*!< Optional. Filled by driver/HAL. */ + float analogGain; /*!< Optional. Filled by driver/HAL. */ + float digitalGain; /*!< Optional. Filled by driver/HAL. */ +}; + +/*! + * \brief Structure for statistics. + */ +struct cca_stats { + cca_frame_stats frameStats; /*!< Frame statistics. */ + bool isFilled; /*!< Flag indicating if the statistics are filled. */ + bool isUsing; /*!< Flag indicating if the statistics are being used. */ +}; + +/*! + * \brief Structure for Intel 3A plus results for AIC run. + */ +typedef struct { + ia_aiq_frame_params* frame_info; /*!< Frame information. */ + unsigned long long frame_timestamp; /*!< Frame timestamp. */ + ia_aiq_pa_results_v1* pa_results; /*!< PA results. */ + ia_aiq_awb_results* awb_results; /*!< AWB results. */ + ia_aiq_ae_results* aec_results; /*!< AE results. */ + ia_aiq_af_results* af_results; /*!< AF results. */ + ia_aiq_gbce_results* gbce_results; /*!< GBCE results. */ + ia_aiq_sa_results_v1 *sa_results; /*!< SA results. */ + ia_ltm_drc_params* drc_params; /*!< DRC parameters. */ + ia_ltm_results* ltm_results; /*!< LTM results. */ + ia_dvs_morph_table* morph_table; /*!< DVS morph table. */ + ia_dvs_image_transformation* dvs_image_transform; /*!< DVS image transformation. */ + ia_bcomp_results* bcomp_results; /*!< BCOMP results. */ +} cca_3a_plus_results; + +/*! + * \brief Enumeration for statistics buffer status. + */ +enum cca_stats_buf_status { + STATS_BUF_FILLED, /*!< Buffer is filled. */ + STATS_BUF_EMPTY, /*!< Buffer is empty. */ + STATS_BUF_USING, /*!< Buffer is being used. */ + STATS_BUF_LATEST /*!< Buffer is the latest. */ +}; + +/*! + * \brief Pure interface exposed to IntelCCA for AIC operations. + */ +class IPU7Aic { +public: + /*! + * \brief Constructor for IPU7Aic. + */ + IPU7Aic(); + + /*! + * \brief Destructor for IPU7Aic. + */ + virtual ~IPU7Aic(); + + /*! + * \brief Initialize all the IPU handles with AIQB/CMC. + * + * \param[in] aiqb Tuning file. + * \param[in] cmc CCA global initial parameters. + * \param[in] max_stats_width Maximum statistics grid width. + * \param[in] max_stats_height Maximum statistics grid height. + * \param[in] max_num_stats_in Maximum number of statistics related to HDR/multi-sensor. + * \param[in] mkn Maker note buffer. + * \param[in] aic_stream_ids (Optional) Stream ID info for AIC handle. + * \return Error code. + */ + ia_err init(const ia_binary_data *aiqb, const ia_cmc_t *cmc, uint32_t max_stats_width, + uint32_t max_stats_height, uint32_t max_num_stats_in, const ia_mkn *mkn, + const cca_stream_ids& aic_stream_ids); + + /*! + * \brief Reinitialize AIC. + * + * \param[in] aiqb Tuning file. + * \param[in] cmc CCA global initial parameters. + * \param[in] max_stats_width Maximum statistics grid width. + * \param[in] max_stats_height Maximum statistics grid height. + * \param[in] max_num_stats_in Maximum number of statistics related to HDR/multi-sensor. + * \param[in] mkn Maker note buffer. + * \param[in] aic_id (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err reInit(const ia_binary_data *aiqb, const ia_cmc_t *cmc, uint32_t max_stats_width, + uint32_t max_stats_height, uint32_t max_num_stats_in, const ia_mkn *mkn, + const int32_t aic_id = -1); + + /*! + * \brief Update tuning file AIQB. + * + * \param[in] aiqb Tuning file. + * \param[in] cmc Parsed CMC data. + * \param[in] streamId (Optional) The stream ID for AIC handle. Default is -1. + * \return Error code. + */ + ia_err updateTuning(const ia_binary_data *aiqb, const ia_cmc_t *cmc, + int32_t streamId = -1); + + /*! + * \brief Get statistics parameters for a specific frame. + * + * \param[in] frame_id Frame ID for statistics. + * \return Pointer to the statistics parameters. + */ + cca_stats* getStatsParams(uint64_t frame_id); + + /*! + * \brief Decode statistics for a specific type (AIQ, LTM, DVS stats). + * + * \param[in] groupId Group ID of CB. + * \param[in] seqId Sequence ID for streaming. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code. + */ + ia_err decodeStats(int32_t groupId, int64_t seqId, int32_t aicId = -1, bool skip = false); + + /*! + * \brief Query statistics buffer. + * + * \param[in] status Statistics buffer status. + * \param[in] frame_id Frame ID. Default is cca::INVALID_FRAME_ID. + * \return Pointer to the statistics buffer. + */ + + cca_stats* queryStatsBuf(cca_stats_buf_status status, uint64_t frame_id = cca::INVALID_FRAME_ID); + + /*! + * \brief Run AIC parameters with graph config and Intel 3A results. + * + * \param[in] params AIQ plus parameters and manual settings. + * \param[in] aaaResults AIQ plus results. + * \param[in] bitmap Bitmap to decide which CB will be run. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \param[out] output AIC results for each CB. + * \return Error code. + */ + ia_err run(const cca_pal_input_params& params, cca_3a_plus_results& aaaResults, + cca_multi_pal_output& output, uint8_t bitmap, int32_t aicId = -1); + + /*! + * \brief Run AIC parameters with graph config and Intel 3A results. + * + * \param[in] params AIQ plus parameters and manual settings. + * \param[in] aaaResults AIQ plus results. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code. + */ + ia_err runAic(const cca_pal_input_params ¶ms, cca_3a_plus_results &aaaResults, int32_t aicId = -1); + + /*! + * \brief Run AIC to get PAL binary for IPU7 HW. + * Calculate the PAL parameters according to 3A+ results and manual settings. + * + * \param[in] groupId Statistics binary generated by CB (groupId). + * \param[in] frameId Indicate PAL results for a specific frame. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \param[out] output_data Binary array of IPU parameters for each CB. + * \param[in] fragment_index Fragment index. Default is 0U. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err runKernels(uint32_t groupId, uint64_t frameId, cca_binary_data *output_data, uint32_t fragment_index = 0U, int32_t aicId = -1); + + /*! + * \brief Get PAL input data. + * + * \param[in] stream_id Stream ID. + * \param[in] seq_id Sequence ID. + * \param[out] aic_output_common AIC output common binary data. + * \param[out] tuning_output Tuning output binary data. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code. + */ + ia_err GetPalInputData(uint32_t stream_id, int32_t seq_id, ia_binary_data* aic_output_common, ia_binary_data* tuning_output, int32_t aicId = -1); + + /*! + * \brief Configure control blocks including kernel groups and kernel offsets. + * + * \param[in] conf Graph config for all kernels. + * \param[in] offset Buffer offsets for all kernels. + * \param[out] termConfig The memory needed by terminals of control blocks. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \param[in] statsBufTypeToTermId (Optional) Mapping from statistics buffer type to terminal ID. + * \return Error code. + */ + ia_err config(const cca_aic_config &conf, const cca_aic_kernel_offset &offset, + cca_aic_terminal_config &termConfig, int32_t aicId = -1, const int32_t* statsBufTypeToTermId = nullptr); + + /*! + * \brief Update configuration resolutions. + * + * \param[in] conf Configuration. + * \param[in] isKeyResolutionChanged Flag indicating if key resolution has changed. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code. + */ + ia_err UpdateConfigurationResolutions(const cca_aic_config& conf, bool isKeyResolutionChanged, int32_t aicId = -1); + + /*! + * \brief Register terminal buffers. + * + * \param[in] termConfig The memory needed by terminals of control blocks. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code. + */ + ia_err registerBuf(const cca_aic_terminal_config &termConfig, int32_t aicId = -1); + + /*! + * \brief Get AIC buffers for FW input after running PAL. + * + * \param[out] termConfig Terminal memory of control blocks filled with IPU parameters. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code. + */ + ia_err getBuf(cca_aic_terminal_config &termConfig, int32_t aicId); + + /*! + * \brief Deinitialize all the AIC handles. + */ + void deinit(); + + /*! + * \brief Get the IPU HW version. + * + * \return IPU HW version. + */ + const char* getVersion() const; + + /*! + * \brief Get the max bin index of non-zero element. + * + * \param[out] outMaxBin Output the max bin index. + * \return Error code. + */ + ia_err getBrightestIndex(uint32_t* outMaxBin); + + /*! + * \brief Calculate the total pixel number in range [luminance_low, luminance_high]. + * + * \param[in] luminance_low The low pixel value. + * \param[in] luminance_high The high pixel value. + * \param[out] outTotalPixels The total pixel number in range [luminance_low, luminance_high]. + * \return Error code. + */ + ia_err getPixelCount(uint32_t luminance_low, uint32_t luminance_high, uint32_t *outTotalPixels); + + /*! + * \brief Get DVS statistics. + * + * \param[out] stats Pointer to the DVS statistics. + * \return Error code. + */ + ia_err getDvsStats(ia_dvs_statistics* stats); + + /*! + * \brief Get PAL size. + * + * \param[in] programGroup Program group. + * \return PAL size. + */ + static uint32_t getPalSize(const cca_program_group& programGroup); + + /*! + * \brief Get if PdafT3AsPdafT2 mode. + * + * \return true when it's PdafT3AsPdafT2 mode, false otherwise. + */ + bool getPdafT3AsPdafT2Mode(void) { return mPdafT3AsPdafT2; } + +private: + /*! + * \brief Initialize statistics list. + * + * \param[in] len Length of the statistics list. + */ + void initStatsList(uint32_t len); + + /*! + * \brief Deinitialize statistics list. + */ + void deInitStatsList(); + + /*! + * \brief Release statistics buffer. + * + * \param[in] status Statistics buffer status. + * \param[in] ccaStats Pointer to the statistics buffer. + */ + void releaseStatsBuf(cca_stats_buf_status status, cca_stats *ccaStats); + + /*! + * \brief Get AIC handle. + * + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Pointer to the AIC handle. + */ + cca_aic_handle* getAicHandle(int32_t aicId = -1); + +private: + static const char* IPU_VER; /*!< IPU version. */ +#ifndef ENABLE_CUSTOMIZED_STD_LIB + std::list mCCAStatsList; + std::map mAicHandleMap; +#else + FixedList mCCAStatsList; + FixedMap mAicHandleMap; +#endif + //buffer feed to AIQ + cca_stats *mStatsAiqBuf; + mutex_t mStatsListMutex; + +#ifdef ENABLE_DVS + ia_dvs_statistics mDvsStatistics{}; +#endif + bool mPdafT3AsPdafT2 = false; +}; + +}//cca +#endif //IIPUAIC_H_ diff --git a/include/ipu8/ia_imaging/IntelCCA.h b/include/ipu8/ia_imaging/IntelCCA.h new file mode 100644 index 0000000..8d679bf --- /dev/null +++ b/include/ipu8/ia_imaging/IntelCCA.h @@ -0,0 +1,284 @@ +/* + * Copyright (C) 2025 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 INTEL_CCA_H_ +#define INTEL_CCA_H_ + +#include "IIPUAic.h" +#include "IntelCCABase.h" + +namespace cca { + +/** + * @brief SegMapQueue for internal usage. + */ +class SegMapQueue; + +/*! + * \brief Main entrance of CCA Flow library. + */ +class LIBEXPORT IntelCCA : public IntelCCABase { + public: + /*! + * \brief Constructor for IntelCCA. + */ + IntelCCA(); + + /*! + * \brief Destructor for IntelCCA. + */ + virtual ~IntelCCA(); + + /*! + * \brief Reinitialize AIC. + * + * \param[in] aic_id Mandatory. The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err reinitAic(const int32_t aic_id = -1); + + /*! + * \brief Reinitialize AIQ. + * + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err reinitAiq(); + + /*! + * \brief Configure the kernels of the pipeline, register all kernel offsets, and return the + * terminal number and payload size. + * + * \param[in] conf Kernel list for the pipeline. + * \param[in] offset Kernel offsets. + * \param[out] termConfig Terminal payload number and size. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \param[in] statsBufToTermId (Optional) Mapping from statistics buffer type to terminal ID. + * Default is nullptr. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err configAIC(const cca_aic_config &conf, const cca_aic_kernel_offset &offset, + cca_aic_terminal_config &termConfig, int32_t aicId = -1, + const int32_t *statsBufToTermId = nullptr); + + /*! + * \brief Register payload buffers to AIC. + * + * \param[out] termConfig Terminal payload. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err registerAICBuf(const cca_aic_terminal_config &termConfig, int32_t aicId = -1); + + /*! + * \brief Query the PAL buffer filled by kernel parameters calculated by AIC. + * + * \param[out] termConfig Terminal payload. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err getAICBuf(cca_aic_terminal_config &termConfig, int32_t aicId = -1); + + /*! + * \brief Decode statistics from HW. + * Parse and decode different statistics from HW including AE/AWB/DVS/HDR. + * + * \param[in] groupId Statistics binary generated by CB (groupId). + * \param[in] seqId Statistics sequence number. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err decodeStats(int32_t groupId, int64_t seqId, int32_t aicId = -1, bool skip = false); + + /*! + * \brief Run AIC to get PAL binary for IPU7 HW. + * Calculate the PAL parameters according to 3A+ results and manual settings. + * + * \param[in] frameId Indicate PAL results for a specific frame. + * \param[in] params Manual settings for IPU pipeline. + * \param[out] output Binary array of IPU parameters for each CB. + * \param[in] bitmap Bitmap to decide which CB will be run. Default is UINT8_MAX. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err runAIC(uint64_t frameId, const cca_pal_input_params ¶ms, + cca_multi_pal_output &output, uint8_t bitmap = UINT8_MAX, int32_t aicId = -1); + + /*! + * \brief Set input information about the segmap. + * + * \param[in] params segmap information about a frame. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err setSegMap(const ia_aiq_segmap_input_params *params); + + /*! + * \brief Get PAL input data. + * + * \param[in] stream_id Stream ID. + * \param[in] seq_id Sequence ID. + * \param[out] aic_output_common AIC output common binary data. + * \param[out] tuning_output Tuning output binary data. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err GetPalInputData(uint32_t stream_id, int32_t seq_id, ia_binary_data *aic_output_common, + ia_binary_data *tuning_output, int32_t aicId = -1); + + /*! + * \brief Run AIC to get PAL binary for IPU7 HW. + * Calculate the PAL parameters according to 3A+ results and manual settings. + * + * \param[in] frameId Indicate PAL results for a specific frame. + * \param[in] params Manual settings for IPU pipeline. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err runAIC(uint64_t frameId, const cca_pal_input_params ¶ms, int32_t aicId = -1); + + /*! + * \brief Run kernels to get PAL binary for IPU7 HW. + * Calculate the PAL parameters according to 3A+ results and manual settings. + * + * \param[in] groupId Statistics binary generated by CB (groupId). + * \param[in] frameId Indicate PAL results for a specific frame. + * \param[out] output_data Binary array of IPU parameters for each CB. + * \param[in] fragment_index Fragment index. Default is 0U. + * \param[in] aicId (Optional) The ID for AIC handle. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err runKernels(uint32_t groupId, uint64_t frameId, cca_binary_data *output_data, + uint32_t fragment_index = 0U, int32_t aicId = -1); + + /*! + * \brief Get PAC output size. + * + * \param[in] programGroup Program group. + * \return PAC output size. + */ + static uint32_t getPacOutputSize(const cca_program_group &programGroup); + + /*! + * \brief Update configuration resolutions. + * + * \param[in] conf Configuration. + * \param[in] aicId The ID for AIC handle. + * \param[in] isKeyResolutionChanged Flag indicating if key resolution has changed. + * \return Error code for status. Zero on success, non-zero on failure. + */ + ia_err updateConfigurationResolutions(const cca_aic_config &conf, int32_t aicId, + bool isKeyResolutionChanged); + + /*! + * \brief Query statistics buffer. + * + * \param[in] status Statistics buffer status. + * \param[in] frameId Frame ID. Default is cca::INVALID_FRAME_ID. + * \return Pointer to the frame statistics. + */ + cca_frame_stats *queryStatsBuf(cca_stats_buf_status status, + uint64_t frameId = cca::INVALID_FRAME_ID); + + private: + /*! + * \brief Set input statistics and information (e.g., faces) about the captured image. + * CCA Flow algorithms need various information about the conditions in which the frame and + * statistics were captured in order to calculate new parameters. + * + * \param[in] params Input parameters containing statistics information about a frame. + * \param[in] aiqResults AIQ results from the corresponding frame. + * \return Error code for status. Zero on success, non-zero on failure. + */ + virtual ia_err setStatsToAiq(const cca_stats_params ¶ms, + const cca_aiq_results_storage &aiqResults) override; + + /*! + * \brief Set LTM tuning data. + * + * \param[in] tuning_data_ptr Pointer to the tuning data. + * \return Error code for status. Zero on success, non-zero on failure. + */ + virtual ia_err setLtmTuning(const ia_binary_data *tuning_data_ptr) override { + (void)tuning_data_ptr; + return ia_err_none; + } + + /*! + * \brief Update LTM result. + * + * \param[in] results Pointer to the 3A+ results. + */ + virtual void updateLtmResult(cca_3a_plus_results *results) override { + if (results != nullptr) { + results->drc_params = nullptr; + results->ltm_results = nullptr; + } + } + + /*! + * \brief Create a new AIC instance. + */ + virtual void newAic() override; + + /*! + * \brief Delete the AIC instance. + */ + virtual void deleteAic() override; + + /*! + * \brief Initialize AIC. + * + * \param[in] aiqb Pointer to the AIQB binary data. + * \param[in] cmc Pointer to the CMC data. + * \param[in] max_stats_width Maximum statistics width. + * \param[in] max_stats_height Maximum statistics height. + * \param[in] max_num_stats_in Maximum number of statistics inputs. + * \param[in] mkn Pointer to the MKN data. + * \param[in] aic_stream_ids AIC stream IDs. + * \return Error code for status. Zero on success, non-zero on failure. + */ + virtual ia_err initAic(const ia_binary_data *aiqb, const ia_cmc_t *cmc, + uint32_t max_stats_width, uint32_t max_stats_height, + uint32_t max_num_stats_in, const ia_mkn *mkn, + const cca_stream_ids &aic_stream_ids) override; + + /*! + * \brief Update AIC tuning. + * + * \param[in] aiqb Pointer to the AIQB binary data. + * \param[in] cmc Pointer to the CMC data. + * \param[in] streamId (Optional) Stream ID. Default is -1. + * \return Error code for status. Zero on success, non-zero on failure. + */ + virtual ia_err updateAicTuning(const ia_binary_data *aiqb, const ia_cmc_t *cmc, + int32_t streamId = -1) override; + + /*! + * \brief Get DVS statistics from AIC. + * + * \param[out] stats Pointer to the DVS statistics. + * \return Error code for status. Zero on success, non-zero on failure. + */ + virtual ia_err getDvsStatsAic(ia_dvs_statistics *stats) override; + + private: + ia_ccat_frame_parameters mFrameParameters{}; /*!< Frame parameters. */ + IPU7Aic *mAic; /*!< Pointer to the IPU7 AIC instance. */ + SegMapQueue *mSegMapQueue; /*!< Pointer to the SegMapQueue instance. */ +}; + +} // namespace cca + +#endif // INTEL_CCA_H_ diff --git a/include/ipu8/ia_imaging/IntelCCABase.h b/include/ipu8/ia_imaging/IntelCCABase.h new file mode 100644 index 0000000..999d31e --- /dev/null +++ b/include/ipu8/ia_imaging/IntelCCABase.h @@ -0,0 +1,611 @@ +/* + * Copyright (C) 2019-2025 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 CCA Flow API documentation + * + * Browse Files and Classes tabs for details. + * + * \section general General info + * + * CCA Flow APIs have 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. + * + * CCA Flow (Camera Control Algorithms Flow) library contains several algorithm which are used to + * modify RAW image. Currently following features and algorithms are supported: + * - \ref aec (Automatic Exposure Control) + * - \ref aiq (Algorithms and Image Quality Algorithm Group) including sub-algorithm + * - awb (Automatic White Balance) + * - af (Automatic Focus) + * - sa (Shading Adaptor) + * - pa (Parameter Adaptor) + * - gbce (Global Brightness and Contrast Enhancement) + * + * Running AIQ algorithms and other standalone algorithms (LTM/DVS) 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.


+ * + * \section init Initialization of CCA Flow library + * + * \copybrief cca::IntelCCA::init + * To create an instance of CCA Flow library one must call function: + * \code cca::IntelCCA::init \endcode + * \copydetails cca::IntelCCA::init + * + *


+ * + * \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. + * + * \copybrief setStatsParams + * To set statistics for algorithms CCA Flow library, one must call function: + * \code cca::IntelCCA::setStatsParams \endcode + * \copydetails cca::IntelCCA::setStatsParams + * + * 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. + * + *


+ * + * \section running Running AIQ/AEC/LTM/DVS/AIC algorithms + * + * Once the CCA Flow instance is initialized and statistics are set, algorithms can be run in any + * order. But AIC must be last one, because the algo shall collect other algo results to generate + * the PAL for IPU HW. + * + * \subsection aiq AIQ + * \copybrief cca::IntelCCA::runAIQ + * \code cca::IntelCCA::runAIQ \endcode + * \copydetails cca::IntelCCA::runAIQ + * + * \subsection aec AEC + * \copybrief cca::IntelCCA::runAEC + * \code cca::IntelCCA::runAEC \endcode + * \copydetails cca::IntelCCA::runAEC + * + * \subsection ltm LTM + * \copybrief cca::IntelCCA::runLTM + * \code cca::IntelCCA::runLTM \endcode + * \copydetails cca::IntelCCA::runLTM + * + * \subsection dvs DVS + * \copybrief cca::IntelCCA::runDVS + * \code cca::IntelCCA::runDVS \endcode + * \copydetails cca::IntelCCA::runDVS + * + * \subsection aic AIC + * \copybrief cca::IntelCCA::runAIC + * \code cca::IntelCCA::runAIC \endcode + * \copydetails cca::IntelCCA::runAIC + * + * + *


+ * + * \section deinit De-initialization of CCA Flow library + * + * To de-initialize and free memory CCA Flow library instance has allocated, one must call function: + * \code + * cca::IntelCCA::deinit + * \endcode + * + * After this call CCA Flow library instance is destroyed and can't be used. + */ + +#ifndef INTEL_CCA_BASE_H_ +#define INTEL_CCA_BASE_H_ + +#include "CCAStorage.h" +#include "IIPUAic.h" +#include "IntelCCATypes.h" +#ifdef INPUTS_IN_FILE +#include "IntelCCA_file_debug.h" +#endif // INPUTS_IN_FILE + +namespace cca { + +class IntelDVS; + +/*! + * \brief Main entrance of CCA Flow library. + */ +class LIBEXPORT IntelCCABase { + public: + IntelCCABase(); + virtual ~IntelCCABase(); + /*! + * \brief initialize the CCA Flow and sub-algos. + * This function must be called before any other function in the library. It allocates memories + * for all CCA Flow 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 CCA Flow instance, which is given + * as input parameter for all the algorithms. Therefore, multiple instances of CCA Flow library + * can running simultaneously. For example one instance per camera. + * + * \param[in] initParams Mandatory.\n + * Input parameters containing tuning/nvm and configuration for + * sub-algos. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err init(const cca_init_params &initParams); + + /*! + * \brief Reconfigure DOL. + * + * \param[in] dolMode Mandatory.\n + * \param[in] conversionGainRatio Mandatory.\n + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err reconfigDol(ia_bcomp_dol_mode_t dolMode, float32_t conversionGainRatio); + + /*! + * \brief Set input statistics and information (e.g faces) about the captured image. + * CCA Flow algorithms need various information about the conditions in which the frame and + * statistics were captured in order to calculate new parameters. + * + * \param[in] params Mandatory.\n + * Input parameters containing statistics information about a + * frame. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err setStatsParams(const cca_stats_params ¶ms); + + /*! + * \brief Set Sensor frame parameters. Describe frame scaling/cropping done in sensor. + * + * \param[in] frameParams Mandatory.\n + */ + void setAiqFrameParams(const ia_aiq_frame_params &frameParams); + + /*! + * \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] frameId Mandatory.\n + * Frame sequence Id. + * \param[in] params Mandatory.\n + * Input parameters for AEC calculations. + * \param[out] results Mandatory.\n + * Results from AEC calculations. Results can be used directly + * as input for AIC/sensor driver. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err runAEC(uint64_t frameId, const cca_ae_input_params ¶ms, cca_ae_results *results); + + /*! + * \brief Run AIQ (Algorithms and Image Quality) Algorithm Group 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] frameId Mandatory.\n + * Run AIQ algo group for frame with frameId. + * \param[in] params Mandatory.\n + * Input parameters containing statistics information about a + * frame. + * \param[out] results Mandatory.\n + * AIQ results. AF results can be used by ACM driver. + * \return Error code. + */ + ia_err runAIQ(uint64_t frameId, const cca_aiq_params ¶ms, cca_aiq_results *results); + + /*! + * \brief Reconfigure DVS configuration info when GDC configuration are changed. + * + * \param[in] dvsInitParam Mandatory.\n + * \param[in] gdcConfig Mandatory.\n + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err reconfigDvs(const cca_dvs_init_param &dvsInitParam, + const cca_gdc_configurations &gdcConfigs); + + /*! + * \brief Update zoom factor/region/coordinate. + * DVS algo supports to zoom the image. Set the zoom params before calling runDVS. + * + * \param[in] DvsId Mandatory.\n + * \param[in] params Mandatory.\n + * Zoom related params. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err updateZoom(uint32_t DvsId, const cca_dvs_zoom ¶ms); + + /*! + * \brief DVS Algorithm calculation based on DVS statistics. + * DVS uses frameId to search the DVS statistic that decoded and stored in CCA Flow, + * then calculates the morph table or image transformation for whole image that used by GDC. + * + * \param[in] DvsId Mandatory.\n + * \param[in] frameId Mandatory.\n + * Frame sequence Id. + * \param[in] enable_video_stablization Optional.\n + * Enable video stabilization. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err runDVS(uint32_t DvsId, uint64_t frameId, bool enable_video_stablization = false); + + /*! + * \brief Reconfigure DVS params with use case (zoom/digital zoom/video stabilization) changing. + * Driver updates all related parameters, then calls the interface. + * + * \param[in] DvsId Mandatory.\n + * \param[in] dvs_config Mandatory.\n + * \param[in] zoom_factor Mandatory.\n + * DVS config params. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err ConfigDvs(uint32_t DvsId, ia_dvs_configuration_v1 *dvs_config, float32_t zoom_factor); + + /*! + * \brief Get DVS image transformation output. + * + * \param[in] DvsId Mandatory.\n + * \param[in] frameId Mandatory.\n + * Frame sequence Id. + * \param[out] ImageTrans Mandatory.\n + * DVS image transformation output. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err getDvsImageTransformationOutput(uint32_t DvsId, uint64_t frameId, + ia_dvs_image_transformation **ImageTrans); + + /*! + * \brief Query the CMC data (camera module characteristic). + * Get the sensor specific data that stored in tuning file, for example optics/tnr... + * + * \param[out] cmc Mandatory.\n + * CMC data. + * \param[in] aiq_cpf Optional.\n + * AIQ CPF data. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err getCMC(cca_cmc &cmc, const cca_cpf *aiq_cpf = nullptr); + + /*! + * \brief Get CCT white map node. + * + * \param[in] cur_cct Mandatory.\n + * Current CCT. + * \param[out] r_g_gain Mandatory.\n + * R/G gain. + * \param[out] b_g_gain Mandatory.\n + * B/G gain. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err getCCTWhiteMapNode(uint32_t cur_cct, float32_t *r_g_gain, float32_t *b_g_gain); + + /*! + * \brief Query the MKN data (maker notes). + * Get the maker note data of AIQ generated by algorithms, mainly cover the exif info needs + * by JPG and other data for debug purpose. + * + * \param[in] type Mandatory.\n + * MKN type. + * \param[out] mkn Mandatory.\n + * MKN data. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err getMKN(ia_mkn_trg type, cca_mkn &mkn); + + /*! + * \brief Add MKN data. + * + * \param[in] a_data_format_id Mandatory.\n + * MKN format id. + * \param[in] a_data_name_id Mandatory.\n + * MKN data name id. + * \param[in] a_data_ptr Mandatory.\n + * Pointer to data. + * \param[in] a_num_elements Mandatory.\n + * Element number. + * \param[in] a_key Mandatory.\n + */ + ia_err addMKN(ia_mkn_dfid a_data_format_id, ia_mkn_dnid a_data_name_id, const void *a_data_ptr, + uint32_t a_num_elements, const char *a_key); + + /*! + * \brief Get the AIQD (AIQ data). + * 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(). + * + * \param[out] aiqd Mandatory.\n + * AIQD buffer. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err getAiqd(cca_aiqd &aiqd); + + /*! + * \brief Update tuning data in run time. + * Update the tuning data to CCA flow, the new tuning data will be taken effect immediately. + * For different use cases, the tuning data should be different, the function is used for the + * scenario. + * + * \param[in] tag Mandatory.\n + * The tag for updated group in tuning file. + * \param[in] lardParams Mandatory.\n + * Lard data. + * \param[in] nvm Mandatory.\n + * Sensor NVM data. + * \param[in] aicId Optional.\n + * The AIC id for AIC handle. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err updateTuning(uint8_t tag, ia_lard_input_params &lardParams, const cca_nvm &nvm, + int32_t aicId = -1); + + /*! + * \brief Update tuning data in run time. + * Update the tuning data to CCA flow, the new tuning data will be taken effect immediately. + * For different use cases, the tuning data should be different, the function is used for the + * scenario. + * + * \param[in] tag Mandatory.\n + * The tag for updated group in tuning file. + * \param[in] lardParams Mandatory.\n + * Lard data. + * \param[in] nvm Mandatory.\n + * Sensor NVM data. + * \param[in] aicId Optional.\n + * The AIC id for AIC handle. + * \param[out] pLardResults Mandatory.\n + * Lard results. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err updateTuning(uint8_t tag, ia_lard_input_params &lardParams, const cca_nvm &nvm, + ia_lard_results **pLardResults, int32_t aicId = -1); + + /*! + * \brief Parse embedded data in run time. + * + * \param[in] bin Mandatory.\n + * Embedded data. + * \param[in] mode Mandatory.\n + * EMD mode. + * \param[in] snrDesc Mandatory.\n + * Sensor specific descriptor and limits of the used sensor + * mode for target frame use. + * \param[out] result Mandatory.\n + * Embedded results. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err runEmdDecoder(const ia_binary_data &bin, const ia_emd_mode_t &mode, + const ia_aiq_exposure_sensor_descriptor &snrDesc, + ia_emd_result_t **result); + + /*! + * \brief De-initialize CCA Flow and its submodules. + * All memory allocated by algorithms are freed. CCA Flow handle can no longer be used. + * + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err deinit(); + + /*! + * \brief Query the current CCA Flow version. + * + * \return Version. + */ + const char *getVersion() const; + + /*! + * \brief Get lard data. + * Get lard results parsed from AIQB. + * + * \param[out] lard Mandatory.\n + * lard data + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err getLardData(cca_lard_data *lard); + + /*! + * \brief Get Aiq results. + * Get Aiq results parsed from CCAStorage. + * + * \param[in] frameId Mandatory.\n + * Get Aiq result for frame with frameId. + * \param[out] results Mandatory.\n + * Aiq results + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err queryAiqResults(uint64_t frameId, cca_aiq_results_storage *results); + + /*! + * \brief Save Aiq results. + * Save Aiq results to internal CCAStorage. + * + * \param[out] results Mandatory.\n + * Aiq results + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err saveAiqResults(uint64_t frameId, const cca_aiq_results_storage &results); + + /*! + * \brief Reload new cpf data and updates ISP tuning for a specific aic id. Used for IQ + * simulator mid pipe injection. Assuming that only ISP tuning has changed from previous cpf. + * Keeps the same tuning mode that was used before the change. Does not reset any other Intel + * CCA state such as AIQ results or AIC configuration. + * + * \param[in] aiqCpf Mandatory.\n + * New cpf binary data. + * \param[in] aicId Optional.\n + * Aic id to update the tuning for. If not provided, assuming + * that there is only one aic instance. + * \return Error code for status. zero on success, non-zero on failure + */ + ia_err reloadIspTuning(const cca_cpf &aiqCpf, int32_t aicId = -1); + + /*! + * \brief set cca log level + * + * \param[in] log_level Mandatory.\n + * 0: disable log + * 1: enable IA_CCA_LOG_ERROR + * 2: enable IA_CCA_LOG + * 3: enable IA_CCA_LOG & IA_CCA_LOG_ERROR + */ + static void setCCALogLevel(uint32_t log_level); + + protected: + ia_binary_data *getAiqData(); + ia_binary_data *getIspData(); + ia_binary_data *getOthersData(); + ia_err initCpfParse(); + void initSaResults(); + ia_err initIspAic(const cca_stream_ids &aic_stream_ids); + void deInitIspAic(); + ia_err initAiq(); + void deinitAiq(); + void deleteSaResultsGrids(); + void copySaResults(const ia_aiq_sa_results_v1 *saResult); + void initAiqb(const cca_cpf &aiqCpf); + void deInitAiqb(); + + protected: + virtual ia_err setStatsToAiq(const cca_stats_params ¶ms, + const cca_aiq_results_storage &aiqResults) = 0; + virtual ia_err setLtmTuning(const ia_binary_data *tuning_data_ptr) = 0; + virtual void updateLtmResult(cca_3a_plus_results *results) = 0; + + ia_err initDVS(const cca_init_params &initParams); + void deInitDvs(); + + ia_err initBcomp(ia_bcomp_dol_mode_t mode, float32_t ratio); + ia_err updateBcomp(); + void deinitBcomp(); + void runAIC_(uint64_t frameId, const cca_pal_input_params ¶ms, + cca_3a_plus_results *results); + + virtual void newAic() = 0; + virtual void deleteAic() = 0; + virtual ia_err initAic(const ia_binary_data *aiqb, const ia_cmc_t *cmc, + uint32_t max_stats_width, uint32_t max_stats_height, + uint32_t max_num_stats_in, const ia_mkn *mkn, + const cca_stream_ids &aic_stream_ids) = 0; + virtual ia_err updateAicTuning(const ia_binary_data *aiqb, const ia_cmc_t *cmc, + int32_t streamId = -1) = 0; + virtual ia_err getDvsStatsAic(ia_dvs_statistics *stats) = 0; + + protected: + CCAStorage *mCCAStorage; + + /* + * aiqb and cmc + */ + ia_binary_data mAiqb; + ia_cmc_t *mParsedCMC; + bool mAiqbInited; + + /* + * NVM + */ + ia_binary_data mNvmb; + + /* + * aiqd + */ + ia_binary_data mAiqd; + + /* + * AIQ structs and params + */ + bool mCCAIsEnabled; + ia_aiq *mAiqHandle; + uint8_t mAECFrameDelay; + uint64_t mFrameTimestamp; + ia_aiq_pa_results_v1 *mPaResults; + ia_aiq_awb_results *mAwbResults; + ia_aiq_ae_results *mAeResults; + ia_aiq_af_results *mAfResults; + ia_aiq_gbce_results *mGbceResults; + ia_aiq_sa_results_v1 mSaResults; + ia_aiq_sa_results_v1 mSaFakeResults; + + ia_aiq_frame_params mAiqFrameParams; + + ia_aiq_awb_input_params_v1 mAwbInput; + ia_aiq_ae_input_params_v1 mAeInput; + ia_aiq_af_input_params mAfInput; + ia_aiq_sa_input_params_v1 mSaInput; + ia_aiq_gbce_input_params mGbceInput; + ia_aiq_pa_input_params mPaInput; + ia_aiq_dsd_input_params mDsdInput; + + uint64_t mFrameIndex; + uint32_t mMaxNumberOfStats; + ia_mkn *mMknData; + uint32_t mInitBitmap; + cca_stream_ids mAicStreamIds; +#ifndef ENABLE_CUSTOMIZED_STD_LIB + std::map *mAicTuningModeMap; +#else + FixedMap *mAicTuningModeMap; +#endif + + uint32_t mNumExpo; + + /* + * RGBS grids + */ + ia_aiq_grid **mCurrentIRGrid; + + /* + * Bcomp structs + */ + ia_bcomp *mBcompState; + ia_bcomp_results *mBcompResults; + + /* + * ia_lard - a library for parsing the cpff and loading it in a dynamic way + */ + ia_lard *mLard; + cca_lard_data mLardData; + ia_lard_input_params mLardInputParams; + + /* + * lard_result - the results which are returned after lard_run + */ + ia_lard_results *mLardResult; + + IntelDVS *mIntelDVSHandles; + + ia_emd_decoder_t *mEmdDecoder; + + uint32_t m3AResultBitmap; + + /* + * mEnableUsingLardResultToInitCCA - whether using lard result to init cca + */ + bool mEnableUsingLardResultToInitCCA; +#ifdef INPUTS_IN_FILE + cca_debug_t *mDebug = nullptr; +#endif // INPUTS_IN_FILE + int8_t reserve[24]; +}; +} // namespace cca +#endif // INTEL_CCA_BASE_H_ diff --git a/include/ipu8/ia_imaging/IntelCCATypes.h b/include/ipu8/ia_imaging/IntelCCATypes.h new file mode 100644 index 0000000..c48cd06 --- /dev/null +++ b/include/ipu8/ia_imaging/IntelCCATypes.h @@ -0,0 +1,751 @@ +/* + * Copyright (C) 2019-2025 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 INTELCCA_TYPES_H_ +#define INTELCCA_TYPES_H_ + +#include "ia_configuration.h" +#include "ia_aiq.h" +#include "ia_types.h" +#include "ia_ob.h" +#include "ia_lard.h" +#ifndef PAC_ENABLE +#ifdef ENABLE_LTM +#include "ia_ltm.h" +#endif +#endif +#ifdef ENABLE_DVS +#include "ia_dvs.h" +#endif +#include "ia_view.h" +#include "ia_cmc_types.h" +#include "ia_cmc_parser.h" +#include "ia_bcomp.h" +#include "ia_mkn_encoder.h" +#ifdef PAC_ENABLE +#include "ia_aic_types.h" +#else +#include "ia_isp_bxt.h" +#include "ia_isp_types.h" +#endif +#include "ia_abstraction.h" +#include "CCAMacro.h" +#include "ia_emd_decoder.h" + +namespace cca { + +/*! + * \brief Structure for CCA CPF data. + */ +typedef struct { + size_t size; /*!< Size of AIQB data. */ + uint8_t buf[MAX_CPF_LEN]; /*!< Buffer of AIQB data. */ +} cca_cpf; + +/*! + * \brief Structure for CCA NVM data. + */ +typedef struct { + size_t size; /*!< Size of sensor NVM data. */ + uint8_t buf[MAX_NVM_LEN]; /*!< Buffer of sensor NVM data. */ +} cca_nvm; + +/*! + * \brief Structure for AIQ data. + */ +typedef struct { + size_t size; /*!< Size of AIQ data. */ + uint8_t buf[MAX_AIQD_LEN]; /*!< Buffer of AIQ data. */ +} cca_aiqd; + +/*! + * \brief Structure for MKN data. + */ +typedef struct { + size_t size; /*!< Size of MKN data. */ + uint8_t buf[MAX_MKN_LEN]; /*!< Buffer of MKN data. */ +} cca_mkn; + +/*! + * \brief Structure for statistics data. + */ +typedef struct { + size_t size; /*!< Size of statistics binary data. */ + uint8_t buf[MAX_STATS_LEN]; /*!< Buffer of statistics data. */ +} cca_stats_bin; + +/*! + * \brief Structure for stream IDs. + */ +typedef struct { + size_t count; /*!< Number of stream IDs. */ + int32_t ids[MAX_STREAM_NUM]; /*!< Array of stream IDs. */ +} cca_stream_ids; + +/*! + * \brief Enumeration for CCA module bitmap. + */ +enum CCAModuleBitMap { + CCA_MODULE_AE = 1, + CCA_MODULE_AF = 1 << 1, + CCA_MODULE_AWB = 1 << 2, + CCA_MODULE_PA = 1 << 3, + CCA_MODULE_SA = 1 << 4, + CCA_MODULE_GBCE = 1 << 5, + CCA_MODULE_LTM = 1 << 6, + CCA_MODULE_DVS = 1 << 7, + CCA_MODULE_OB = 1 << 8, + CCA_MODULE_BCOM = 1 << 9, + CCA_MODULE_LARD = 1 << 10, + CCA_MODULE_EMDED = 1 << 11, + CCA_MODULE_DSD = 1 << 12, + CCA_MODULE_ALL = (1 << 13) - 1, +}; + +/*! + * \brief Enumeration for AIQB contents. + */ +enum CCALardItem { + CCA_LARD_NONE = 0, + CCA_LARD_CMC = 1 << 0, + CCA_LARD_AIQ = 1 << 1, + CCA_LARD_ISP = 1 << 2, + CCA_LARD_OTHER = 1 << 3 +}; + +/*! + * \brief Structure for LARD data. + */ +typedef struct { + uint32_t cmc_count; /*!< Number of CMC tags. */ + uint32_t cmc_tags[MAX_TAG_LIST_LEN]; /*!< Array of CMC tags. */ + uint32_t aiq_count; /*!< Number of AIQ tags. */ + uint32_t aiq_tags[MAX_TAG_LIST_LEN]; /*!< Array of AIQ tags. */ + uint32_t isp_count; /*!< Number of ISP indices. */ + uint32_t isp_index[MAX_TAG_LIST_LEN]; /*!< Array of ISP indices. */ + uint32_t other_count; /*!< Number of other tags. */ + uint32_t other_tags[MAX_TAG_LIST_LEN]; /*!< Array of other tags. */ +} cca_lard_data; + +/*! + * \brief Enumeration for CCA statistics type. + */ +enum CCAStatsType { + CCA_STATS_RGBS = 1, + CCA_STATS_HIST = 1 << 1, + CCA_STATS_AF = 1 << 2, + CCA_STATS_YV = 1 << 3, + CCA_STATS_LTM = 1 << 4, + CCA_STATS_DVS = 1 << 5, + CCA_STATS_PDAF = 1 << 6, + CCA_STATS_RGBIR_IR = 1 << 7 +}; + +/*! + * \brief Enumeration for CCA histogram type. + */ +enum CCAHISTType { + CCA_HIST_NONE = 0, + CCA_HIST_Y = 1 << 0, + CCA_HIST_RGB = 1 << 1, +}; + +/*! + * \brief Enumeration for DVS output type. + */ +enum CCADVSOutputType { + CCA_DVS_MORPH_TABLE = 0, + CCA_DVS_IMAGE_TRANSFORM +}; + +/*! + * \brief Structure for DVS initialization parameters. + */ +typedef struct { + float32_t dvs_zoom_ration; /*!< DVS zoom ratio. */ + CCADVSOutputType dvs_output_type; /*!< DVS output type. */ +} cca_dvs_init_param; + +/*! + * \brief Structure for AEC features input parameters. + */ +typedef struct { + bool aec_features_enabled; /*!< Flag indicating if AEC features are enabled. */ + ia_aiq_ae_features aec_features; /*!< AEC features. */ +} cca_ae_features; + +/*! + * \brief Structure for AEC input parameters. + */ +typedef struct { + bool is_bypass; /*!< Flag indicating if AEC run is bypassed. */ + ia_aiq_frame_use frame_use; /*!< Target frame type of the AEC calculations (Preview, Still, video etc.). */ + uint32_t num_exposures; /*!< Number of exposure outputs to have. Must be positive. One for LDR, two or more for HDR/exposure bracketing. */ + ia_aiq_flash_mode flash_mode; /*!< Manual flash mode. If AEC should make flash decision, set mode to ia_aiq_flash_mode_auto. */ + ia_aiq_ae_metering_mode metering_mode; /*!< AEC metering mode. */ + ia_aiq_ae_priority_mode priority_mode; /*!< AEC priority mode. */ + ia_aiq_ae_operation_mode operation_mode; /*!< AEC operation mode. */ + ia_aiq_ae_flicker_reduction flicker_reduction_mode; /*!< AEC flicker reduction mode. */ + ia_aiq_exposure_sensor_descriptor sensor_descriptor[MAX_SENSOR]; /*!< Sensor specific descriptor and limits of the used sensor mode for target frame use. */ + uint32_t num_sensor_descriptors; /*!< Number of sensor descriptors given in the above pointer. */ + cca_ae_features aec_features; /*!< AEC features in use when calculating new exposure parameters. */ + ia_rectangle exposure_window; /*!< Rectangle of area which AEC uses to calculate new exposure parameters. */ + ia_coordinate exposure_coordinate; /*!< Coordinate for a point in which the exposure should be prioritized. */ + float32_t ev_shift; /*!< Exposure Value shift [-4,4]. */ + uint32_t manual_exposure_time_us[MAX_NUM_EXPOSURE]; /*!< Manual exposure time in microseconds. */ + float32_t manual_analog_gain[MAX_NUM_EXPOSURE]; /*!< Manual analog gain. */ + uint16_t manual_iso[MAX_NUM_EXPOSURE]; /*!< Manual ISO. Overrides manual_analog_gain. */ + ia_aiq_ae_manual_limits manual_limits[MAX_NUM_EXPOSURE]; /*!< Manual limits which override limits defined in AEC tunings. */ + uint32_t manual_total_target_exposure[MAX_NUM_EXPOSURE]; /*!< Manual total target exposure. */ + ia_aiq_ae_exposure_distribution_priority exposure_distribution_priority; /*!< AEC exposure distribution priority mode. */ + float32_t manual_convergence_time; /*!< Manual AEC convergence speed in seconds. */ + bool is_bypass_result; /*!< Flag indicating if AE result needs to be saved to IntelCCA. */ +} cca_ae_input_params; + +/*! + * \brief Structure for AEC exposure results. + */ +typedef struct { + unsigned int exposure_index; /*!< Exposure index which identifies the exposure. */ + ia_aiq_exposure_parameters exposure[MAX_EXPO_PLAN]; /*!< Exposure parameters to be used in the next frame in sensor specific format. */ + ia_aiq_exposure_sensor_parameters sensor_exposure[MAX_EXPO_PLAN]; /*!< Exposure parameters to be used in the next frame in sensor specific format. */ + float32_t distance_from_convergence; /*!< Distance of convergence as an EV shift value. Negative is underexposure, positive is overexposure. */ + bool converged; /*!< Flag indicating if the exposure has converged. */ +} cca_ae_exposure; + +/*! + * \brief Structure for AEC histogram weight map. + */ +typedef struct { + uint16_t width; /*!< Width of the weight grid. */ + uint16_t height; /*!< Height of the weight grid. */ + uint8_t weights[MAX_RGBS_STATS_GRID_SIZE]; /*!< Multipliers (weight) of RGB values in the grid. Values range [0, 15]. */ +} cca_hist_weight_grid; + +/*! + * \brief Structure for AEC results. + */ +typedef struct { + cca_ae_exposure exposures[MAX_SENSOR]; /*!< Exposure results to be used in the next frame. */ + uint32_t num_exposures; /*!< Number of calculated exposures. */ + ia_aiq_flash_parameters flashes[MAX_NUM_FLASH_LEDS]; /*!< Array of flash parameters for each flash to be used in the next frame. */ + uint32_t num_flashes; /*!< Number of flashes. */ + ia_aiq_bracket_mode multiframe; /*!< AEC may propose to use multiframe for optimal results. */ + float lux_level_estimate; /*!< Lux level estimation. */ + ia_aiq_aperture_control aperture_control; /*!< Aperture control parameters. */ + cca_hist_weight_grid weight_grid; /*!< AEC weight map used by the next frame. */ + ia_aiq_ae_flicker_reduction flicker_reduction_mode; /*!< Flicker reduction mode proposed by the AEC algorithm. */ + unsigned short shdr_ldr_mode; /*!< Staggered HDR LDR (low dynamic range) mode. 0 - HDR mode, 1 - LDR mode. */ +} cca_ae_results; + +/*! + * \brief Structure for AF input parameters. + */ +typedef struct { + ia_aiq_frame_use frame_use; /*!< Target frame type of the AF calculations (Preview, Still, video etc.). */ + uint32_t lens_position; /*!< Current lens position. */ + uint64_t lens_movement_start_timestamp; /*!< Lens movement start timestamp in microseconds. */ + ia_aiq_af_operation_mode focus_mode; /*!< Focusing mode. */ + ia_aiq_af_range focus_range; /*!< Focusing range. Only valid when focus_mode is ia_aiq_af_operation_mode_auto. */ + ia_aiq_af_metering_mode focus_metering_mode; /*!< Metering mode (multispot, touch). */ + ia_aiq_flash_mode flash_mode; /*!< User setting for flash. */ + ia_rectangle focus_rect; /*!< Focus rectangle. */ + ia_aiq_manual_focus_parameters manual_focus_parameters; /*!< Manual focus parameters (manual lens position, manual focusing distance). */ + bool trigger_new_search; /*!< Flag indicating if a new AF search is needed. */ + bool exit_success_state; /*!< Flag indicating if AF needs to exit the success state. */ +} cca_af_input_params; + +/*! + * \brief Structure for AF results. + */ +typedef struct { + ia_aiq_af_status status; /*!< Focus status. */ + uint16_t current_focus_distance; /*!< Current focusing distance [mm] between the lens and object plane. */ + uint32_t next_lens_position; /*!< Next lens position. */ + int32_t next_focus_distance; /*!< Next focusing distance [mm] between the lens and object plane. */ + ia_aiq_lens_driver_action lens_driver_action; /*!< Lens driver action. */ + bool use_af_assist; /*!< Flag indicating if the AF assist light is to be used at half press. */ + bool final_lens_position_reached; /*!< Flag indicating if the lens has reached the final lens position. */ +} cca_af_results; + +/*! + * \brief Structure for AWB input parameters. + */ +typedef struct { + bool is_bypass; /*!< Flag indicating if AWB run is bypassed. */ + ia_aiq_awb_operation_mode scene_mode; /*!< AWB scene mode. */ + ia_aiq_awb_manual_cct_range manual_cct_range; /*!< Manual CCT range. */ + ia_coordinate manual_white_coordinate; /*!< Manual white point coordinate relative to the full FOV of the scene. */ + float32_t manual_convergence_time; /*!< Manual AWB convergence speed in seconds. */ + bool have_manual_settings; /*!< Flag indicating if manual settings are used. */ +} cca_awb_input_params; + +/*! + * \brief Structure for AWB results. + */ +typedef struct { + float32_t accurate_r_per_g; /*!< Accurate White Point for the image. */ + float32_t accurate_b_per_g; /*!< Accurate White Point for the image. */ + float32_t final_r_per_g; /*!< Final White Point, including color appearance modeling. */ + float32_t final_b_per_g; /*!< Final White Point, including color appearance modeling. */ + uint32_t cct_estimate; /*!< Correlated Color Temperature estimate calculated from the accurate WP. */ + float32_t distance_from_convergence; /*!< Distance from convergence. Value 0.0f means converged. */ + float acs_usage; /*!< Indicates the acs weight for White Point calculation, along with the weights + for greyworld, RGB, and other factors. (supported systems only) */ +} cca_awb_results; + +/*! + * \brief Structure for GBCE input parameters. + */ +typedef struct { + bool is_bypass; /*!< Flag indicating if GBCE run is bypassed. */ + float32_t ev_shift; /*!< Exposure Value shift [-4,4]. */ + bool gbce_on; /*!< Flag indicating if GBCE is enabled. */ + bool athena_mode; /*!< Flag indicating if Athena mode is enabled in full GTM algorithm. */ + gtm_glare_detection_type glare_detect_type; /*!< Glare detection type. */ + uint32_t lux_level_sensors[2]; /*!< Sensor lux level based glare detection. */ + float32_t manual_gamma; /*!< Manual gamma for GTM. */ +#ifdef _WIN32 + bool cphdr_mode; /*!< Flag indicating if adtm not run WDR in still cpHDR case */ +#endif +} cca_gbce_input_params; + +/*! + * \brief Structure for RGBS grid block. + */ +typedef struct { + rgbs_grid_block blocks_ptr[MAX_RGBS_STATS_GRID_SIZE]; /*!< RGBS blocks. */ + unsigned short grid_width; /*!< Grid width. */ + unsigned short grid_height; /*!< Grid height. */ + bool shading_correction; /*!< Flag indicating if statistics were calculated using lens shading corrected data. */ +} cca_rgbs_grid; + +/*! + * \brief Structure for HDR RGBS grid block. + */ +typedef struct { + hdr_rgbs_grid_block blocks_ptr[MAX_RGBS_STATS_GRID_SIZE]; /*!< HDR RGBS blocks. */ + uint32_t grid_width; /*!< Grid width. */ + uint32_t grid_height; /*!< Grid height. */ + uint32_t grid_data_bit_depth; /*!< Bit depth of data in channel data. */ + bool shading_correction; /*!< Flag indicating if statistics were calculated using lens shading corrected data. */ +} cca_hdr_rgbs_grid; + +/*! + * \brief Structure for AF statistics. + */ +typedef struct { + uint16_t grid_width; /*!< Number of block elements horizontally in a grid. */ + uint16_t grid_height; /*!< Number of block elements vertically in a grid. */ + uint16_t block_width; /*!< Block width (bq per block element). */ + uint16_t block_height; /*!< Block height (bq per grid element). */ + int32_t filter_response_1[MAX_AF_STATS_GRID_SIZE]; /*!< Filter response of filter 1 (e.g. low pass, used by auto focus). */ + int32_t filter_response_2[MAX_AF_STATS_GRID_SIZE]; /*!< Filter response of filter 2 (e.g. high pass, used by auto focus). */ +} cca_af_grid; + +/*! + * \brief Structure for face state data. + */ +typedef struct { + uint32_t num_faces; /*!< Number of faces in the recently processed input frame. */ + ia_atbx_face faces[MAX_FACE_NUM]; /*!< Array of face information. */ + bool updated; /*!< Flag indicating if the face data is updated. */ + bool is_video_conf; /*!< Flag indicating if video conference mode is enabled. */ + FD_IMPL_TYPE fd_algo; /*!< Face detection algorithm type. */ +} cca_face_state; + +/*! + * \brief Structure for statistics parameters. + */ +typedef struct { + uint64_t frame_id; /*!< Frame identifier which identifies to which frame the given statistics correspond. */ + uint64_t frame_timestamp; /*!< Start of frame timestamp in microseconds. */ + cca_face_state faces; /*!< Face coordinates from external face detector. */ + ia_aiq_camera_orientation camera_orientation; /*!< Orientation of the camera. */ + cca_hist_weight_grid weight_grid; /*!< Weight map to be used in the next frame histogram calculation. */ + uint16_t dvs_stats_height; /*!< Height of DVS statistics. */ + uint16_t dvs_stats_width; /*!< Width of DVS statistics. */ + ia_rectangle statistics_crop_area; /*!< RGBS and AF grid area crop with respect to full field of view of sensor output. */ + bool using_rgbs_for_aec; /*!< Flag indicating if RGBS is used to generate the AE histogram. */ + uint32_t reset_hist; /*!< Flag indicating if the histogram should be reset. */ + bool bAssitLightOn; /*!< Flag indicating if the AF assist light is on. */ + uint8_t AECFrameDelay; /*!< Frame delay for auto exposure to take effect. */ + bool hasEmbeddedData; /*!< Flag indicating if embedded data is available. */ + ia_acs_stats acs_stats; /*acs parameters*/ +} cca_stats_params; + +/*! + * \brief Structure for output statistics. + */ +typedef struct { + bool get_rgbs_stats; /*!< Flag indicating if RGBS statistics should be retrieved. */ + ia_aiq_rgbs_grid rgbs_grid[MAX_NUM_EXPOSURE]; /*!< RGBS grid. */ + rgbs_grid_block rgbs_blocks[MAX_NUM_EXPOSURE][BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< RGBS blocks. */ +} cca_out_stats; + +/*! + * \brief Structure for PA input parameters. + */ +typedef struct { + float32_t extra_gain; /*!< Use to recalculate the pa output color_gains. */ + ia_aiq_color_channels color_gains; /*!< RGB gains for each color channel. */ + bool enable_gtm_desaturation; /*!< Flag indicating if GTM desaturation is enabled. */ +} cca_pa_input_params; + +/*! + * \brief Structure for SA input parameters. + */ +typedef struct { + float32_t manual_convergence_time; /*!< Manual convergence time in seconds. Allows override of tunings for LSC transition interval. */ + bool lsc_on; /*!< Flag indicating if LSC results should be returned. */ +} cca_sa_input_params; + +/*! + * \brief Structure for DSD (Determine scene) input and output parameters. + */ +typedef struct { + ia_aiq_scene_mode scene_modes; /*! /* defines memcpy and memset */ +#include /* defines malloc and free */ +#include /* defines NULL */ +#include /* defines fixed width integers */ +#include /* defines sprintf_s */ +#include +#include + +#define CAST_TO_TYPE(type, value) (static_cast(value)) + +#else +#include /* defines memcpy and memset */ +#include /* defines malloc and free */ +#include /* defines NULL */ +#include /* defines fixed width integers */ +#include /* defines sprintf_s */ +#include +#include + +#define CAST_TO_TYPE(type, value) ((type)(value)) + +#endif + +#include "ia_misra_types.h" +#ifndef __cplusplus +#if (defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__) +#define inline __inline +#elif defined(__GNUC__) +#define inline __inline__ +#else +#define inline /* default is to define inline to empty */ + +#endif +#endif + + +/*! + * \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; +typedef uint16_t half; + + +/* Float Epsilon for divide by zero checks */ +#define IA_EPSILON 0.0001F +#define IA_EPSILON_2 0.00000001F + +#define FLOAT_TO_Q16_16(n) (CAST_TO_TYPE(uint32_t, ((CAST_TO_TYPE(float32_t,(n)))*65536.0F))) +#define INT_TO_Q16_16(n) CAST_TO_TYPE(int32_t,(CAST_TO_TYPE(uint32_t,(n))<<16U)) +#define UINT_TO_Q16_16(n) (CAST_TO_TYPE(uint32_t,(n))<<16U) +#define Q16_16_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.0000152587890625F) +#define Q16_16_TO_INT(n) CAST_TO_TYPE(int32_t,(CAST_TO_TYPE(uint32_t,(n))>>16U)) +#define Q16_16_TO_UINT(n) (CAST_TO_TYPE(uint32_t,(n))>>16U) + +#define FLOAT_TO_Q1_15(n) (CAST_TO_TYPE(uint16_t,((CAST_TO_TYPE(float32_t,(n)))*32768.0F))) +#define Q1_15_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.000030518F) +#define QX_15_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.000030517578125F) + +#define FLOAT_TO_Q8_8(n) (CAST_TO_TYPE(uint16_t, ((CAST_TO_TYPE(float32_t,(n)))*256.0F))) +#define INT_TO_Q8_8(n) CAST_TO_TYPE(int32_t,(CAST_TO_TYPE(uint32_t,(n))<<8U)) +#define Q8_8_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.00390625F) +#define Q8_8_TO_INT(n) CAST_TO_TYPE(int32_t,(CAST_TO_TYPE(uint32_t,(n))>>8U)) + +#define FLOAT_TO_QX_3(n) (CAST_TO_TYPE(float32_t,(n))*8.0F) +#define FLOAT_TO_QX_7(n) (CAST_TO_TYPE(float32_t,(n))*128.0F) +#define FLOAT_TO_QX_8(n) (CAST_TO_TYPE(float32_t,(n))*256.0F) +#define FLOAT_TO_QX_10(n) ((n)*1024.0F) +#define FLOAT_TO_QX_11(n) (CAST_TO_TYPE(float32_t,(n))*2048.0F) +#define FLOAT_TO_QX_12(n) (CAST_TO_TYPE(float32_t,(n))*4096.0F) +#define FLOAT_TO_QX_13(n) (CAST_TO_TYPE(float32_t,(n))*8192.0F) +#define FLOAT_TO_QX_14(n) (CAST_TO_TYPE(float32_t,(n))*16384.0F) +#define FLOAT_TO_QX_15(n) (CAST_TO_TYPE(float32_t,(n))*32768.0F) +#define INT_TO_QX_10(n) CAST_TO_TYPE(int32_t,(CAST_TO_TYPE(uint32_t,(n))<<10U)) +#define QX_7_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.0078125F) +#define QX_10_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.0009765625F) +#define QX_13_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.0001220703125F) +#define QX_14_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.00006103515625F) +#define QX_18_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.00000381469F) +#define QX_20_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(n)))*0.00000095367431640625F) +#define QX_10_TO_INT(n) CAST_TO_TYPE(int32_t,(CAST_TO_TYPE(uint32_t,(n))>>10U)) + +#define Q16_12_TO_FLOAT(n) ((CAST_TO_TYPE(float32_t,(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) ((CAST_TO_TYPE(uint32_t, (a)) + CAST_TO_TYPE(uint32_t, (b-1U))) & (~(CAST_TO_TYPE(uint32_t, (b-1U))))) +#define IA_ALIGN_U32(a,b) ((static_cast(a) + (static_cast(b) - 1U)) & (~(static_cast(b) - 1U))) + +#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) { (void)free(x); x = NULL;} +#define IA_MEMSET(_Dst, _Val, _Size) (CAST_TO_TYPE(void, memset(_Dst, _Val, _Size))) +#define IA_MEMCOMPARE(_Buf1,_Buf2,_Size) memcmp(_Buf1, _Buf2, _Size) +#define IA_ABS(a) abs(CAST_TO_TYPE(int,(a))) +// In ARM build in Windows we will use the double builtin fabs +// So it woun't be needed to link with ARM libs of fabsf +#if (defined WIN32 && defined __cplusplus && defined BUILD_FOR_ARM) +#define IA_FABS(a) CAST_TO_TYPE(float32_t,fabs(CAST_TO_TYPE(double,(a)))) +#else +#define IA_FABS(a) fabsf(CAST_TO_TYPE(float32_t,(a))) +#endif +#define IA_FABSD(a) fabs(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(CAST_TO_TYPE(float32_t,(a)), CAST_TO_TYPE(float32_t,(b))) +#define IA_POWD(a, b) pow(a, b) +#define IA_EXP(a) expf(CAST_TO_TYPE(float32_t,(a))) +#define IA_EXPD(a) exp(a) +#define IA_SQRT(a) sqrtf(CAST_TO_TYPE(float32_t,(a))) +#define IA_SQRTD(a) sqrt(a) +#define IA_HYPOT(x,y) hypotf(CAST_TO_TYPE(float32_t,(x)),CAST_TO_TYPE(float32_t,(y))) +#define IA_CEIL(a) ceilf(CAST_TO_TYPE(float32_t,(a))) +#define IA_CEILD(a) ceil(a) +#define IA_FLOOR(a) floorf(CAST_TO_TYPE(float32_t,(a))) +#define IA_FLOORD(a) floor(a) +#define IA_ROUND(a) ((CAST_TO_TYPE(float32_t,(a)) > 0.0F) ? IA_FLOOR(CAST_TO_TYPE(float32_t,(a)) + 0.5F) : IA_CEIL(CAST_TO_TYPE(float32_t,(a)) - 0.5F)) +#define IA_ROUNDD(a) ((CAST_TO_TYPE(float64_t,(a)) > 0.0) ? IA_FLOORD(CAST_TO_TYPE(float64_t,(a)) + 0.5) : IA_CEILD((CAST_TO_TYPE(float64_t,a) - 0.5))) +#define IA_ROUNDF(a) ((static_cast(a) > static_cast(0.0F)) ? IA_FLOOR(static_cast(a) + static_cast(0.5F)) : IA_CEIL(static_cast(a) - static_cast(0.5F))) +#define IA_SIN(a) sinf(CAST_TO_TYPE(float32_t,(a))) +#define IA_COS(a) cosf(CAST_TO_TYPE(float32_t,(a))) +#define IA_ATAN(a) atanf(CAST_TO_TYPE(float32_t,(a))) +#define IA_LN(a) logf(CAST_TO_TYPE(float32_t,(a))) +#define IA_UNUSED(x) (void)x +#define IA_LOGD(x) (log(CAST_TO_TYPE(float64_t,(x)))) +#define IA_LOG2(x) (logf(CAST_TO_TYPE(float32_t,(x))) / logf(CAST_TO_TYPE(float32_t,(2.0F)))) +#define IA_LOG2D(x) (log(x) / log(2.0)) +#define IA_LOG10(x) log10f(CAST_TO_TYPE(float32_t,(x))) +#define IA_ASSERT(x) assert(x) +#define IA_SIGN(a) (((a) > 0) - ((a) < 0)) + + +//#define IA_MAX_FIXEDPOINT(integer_bits, frac_bits) IA_MAX_FIXEDPOINT(integer_bits, frac_bits) + +#define IA_MIN_FIXEDPOINT(integer_bits, frac_bits) (-IA_MAX_FIXEDPOINT((integer_bits), frac_bits)) +#define IA_MAX_Q0_FIXEDPOINT(frac_bits) (1.0 - (1.0F/((float64_t)(frac_bits?((unsigned long)2<<(frac_bits-1)):0)))) + +/* Q0_31 means: total 31 bits = 0 int bits + 31 fractional bits*/ +#define IA_QX_31_FRAC_BITS (31U) +#define IA_Q0_31_MIN (0) +#define IA_Q0_31_MAX IA_MAX_Q0_FIXEDPOINT(IA_QX_31_FRAC_BITS) + +#define IA_QX_26_FRAC_BITS (26U) +#define IA_Q0_26_MIN (0) +#define IA_Q0_26_MAX IA_MAX_Q0_FIXEDPOINT(IA_QX_26_FRAC_BITS) + + +#define IA_QX_16_FRAC_BITS (16U) +#define IA_Q14_16_MIN (0) +#define IA_Q14_16_MAX IA_MAX_FIXEDPOINT(14U, IA_QX_16_FRAC_BITS) + +#define IA_QX_5_FRAC_BITS (5U) +#define IA_Q14_5_MIN (0) +#define IA_Q14_5_MAX IA_MAX_FIXEDPOINT(14U, IA_QX_5_FRAC_BITS) +#define IA_FLOAT_TO_Q14_5(val) CAST_TO_TYPE(uint32_t,(IA_ROUND((IA_LIMIT(val, IA_Q14_5_MIN, IA_Q14_5_MAX)*(CAST_TO_TYPE(uint64_t,2U<<(IA_QX_5_FRAC_BITS-1U))))))) + +#define IA_Q3_16_MIN (0) +#define IA_Q3_16_MAX IA_MAX_FIXEDPOINT(3U, IA_QX_16_FRAC_BITS) + +/* S5.10 means: total 15 bits = 1 sign bit + 5 int bits + 10 fractional bits*/ +#define IA_SX_10_FRAC_BITS (10U) +#define IA_S5_10_MIN IA_MIN_FIXEDPOINT(5U, IA_SX_10_FRAC_BITS) +#define IA_S5_10_MAX IA_MAX_FIXEDPOINT(5U, IA_SX_10_FRAC_BITS) + +/* S4.15 means: total 20 bits = 1 sign bit + 4 int bits + 15 fractional bits*/ +#define IA_SX_15_FRAC_BITS (15U) +#define IA_S4_15_MIN IA_MIN_FIXEDPOINT(4U, IA_SX_15_FRAC_BITS) +#define IA_S4_15_MAX IA_MAX_FIXEDPOINT(4U, IA_SX_15_FRAC_BITS) + +/* S4.14 means: total 20 bits = 1 sign bit + 4 int bits + 14 fractional bits*/ +#define IA_SX_14_FRAC_BITS (14U) +#define IA_S4_14_MIN IA_MIN_FIXEDPOINT(4U, IA_SX_14_FRAC_BITS) +#define IA_S4_14_MAX IA_MAX_FIXEDPOINT(4U, IA_SX_14_FRAC_BITS) +#define IA_FLOAT_TO_S4_14(val) CAST_TO_TYPE(int32_t,(IA_ROUND((IA_LIMIT(val, IA_S4_14_MIN, IA_S4_14_MAX))*(CAST_TO_TYPE(uint64_t,2U<<(IA_SX_14_FRAC_BITS-1U)))))) + +/* S4.19 means: = 1 sign bit + 4 int bits + 19 fractional bits*/ +#define IA_SX_19_FRAC_BITS (19U) +#define IA_S4_19_MIN IA_MIN_FIXEDPOINT(4U, IA_SX_19_FRAC_BITS) +#define IA_S4_19_MAX IA_MAX_FIXEDPOINT(4U, IA_SX_19_FRAC_BITS) +#define IA_FLOAT_TO_S4_19(val) CAST_TO_TYPE(int32_t,(IA_ROUND((IA_LIMIT(val, IA_S4_19_MIN, IA_S4_19_MAX))*(CAST_TO_TYPE(uint64_t,2U<<(IA_SX_19_FRAC_BITS-1U)))))) + +#define IA_SX_20_FRAC_BITS (20U) +#define IA_S1_20_MIN IA_MIN_FIXEDPOINT(1U, IA_SX_20_FRAC_BITS) +#define IA_S1_20_MAX IA_MAX_FIXEDPOINT(1U, IA_SX_20_FRAC_BITS) +#define IA_S4_20_MIN IA_MIN_FIXEDPOINT(4U, IA_SX_20_FRAC_BITS) +#define IA_S4_20_MAX IA_MAX_FIXEDPOINT(4U, IA_SX_20_FRAC_BITS) +#define IA_SX_8_FRAC_BITS (8U) +#define IA_S14_8_MIN IA_MIN_FIXEDPOINT(14U, IA_SX_8_FRAC_BITS) +#define IA_S14_8_MAX IA_MAX_FIXEDPOINT(14U, IA_SX_8_FRAC_BITS) + +#define IA_S18_8_MIN IA_MIN_FIXEDPOINT(18U, IA_SX_8_FRAC_BITS) +#define IA_S18_8_MAX IA_MAX_FIXEDPOINT(18U, IA_SX_8_FRAC_BITS) +#ifdef __cplusplus + +inline float64_t IA_MAX_FIXEDPOINT(const int32_t integer_bits, const int32_t frac_bits) +{ + const uint32_t temp_num = ((((integer_bits) > 0) ? (CAST_TO_TYPE(uint32_t, 2U) << (CAST_TO_TYPE(uint32_t, integer_bits) - 1U)) : 1)); + float64_t res = 0.0; + if (frac_bits > 0) + { + res = 1.0 / CAST_TO_TYPE(float64_t, (CAST_TO_TYPE(uint32_t, 2U) << (CAST_TO_TYPE(uint32_t, frac_bits) - 1U))); + } + res = (CAST_TO_TYPE(float64_t, temp_num)) - res; + return res; +} + +inline uint32_t IA_FLOAT_TO_Q0_31(const float64_t val) +{ + const uint32_t IA_FLOAT_TO_Q0_31_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_QX_31_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_Q0_31_limit_res = (IA_LIMIT(val, IA_Q0_31_MIN, IA_Q0_31_MAX)) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_Q0_31_temp_param)); + const float64_t IA_FLOAT_TO_Q0_31_round_rs = IA_ROUNDD(IA_FLOAT_TO_Q0_31_limit_res); + return CAST_TO_TYPE(uint32_t, IA_FLOAT_TO_Q0_31_round_rs); +} + +inline uint32_t IA_FLOAT_TO_Q0_26(const float64_t val) +{ + const uint32_t IA_FLOAT_TO_Q0_26_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_QX_26_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_Q0_26_limit_res = IA_LIMIT(val, IA_Q0_26_MIN, IA_Q0_26_MAX) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_Q0_26_temp_param)); + const float32_t IA_FLOAT_TO_Q0_26_round_rs = IA_ROUND(IA_FLOAT_TO_Q0_26_limit_res); + return CAST_TO_TYPE(uint32_t, IA_FLOAT_TO_Q0_26_round_rs); +} + + +inline uint32_t IA_FLOAT_TO_Q14_16(const float64_t val) +{ + const uint32_t IA_FLOAT_TO_Q14_16_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_QX_16_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_Q14_16_limit_res = (IA_LIMIT(val, IA_Q14_16_MIN, IA_Q14_16_MAX)) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_Q14_16_temp_param)); + const float64_t IA_FLOAT_TO_Q14_16_round_rs = IA_ROUND(IA_FLOAT_TO_Q14_16_limit_res); + return CAST_TO_TYPE(uint32_t, IA_FLOAT_TO_Q14_16_round_rs); +} +inline uint32_t IA_FLOAT_TO_Q3_16(const float64_t val) +{ + const uint32_t IA_FLOAT_TO_Q3_16_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_QX_16_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_Q3_16_limit_res = (IA_LIMIT(val, IA_Q3_16_MIN, IA_Q3_16_MAX)) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_Q3_16_temp_param)); + const float64_t IA_FLOAT_TO_Q3_16_round_rs = IA_ROUNDD(IA_FLOAT_TO_Q3_16_limit_res); + return CAST_TO_TYPE(uint32_t, IA_FLOAT_TO_Q3_16_round_rs); +} + + +inline int32_t IA_FLOAT_TO_S4_15(const float32_t val) +{ + const uint32_t IA_FLOAT_TO_S4_15_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_SX_15_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_S4_15_limit_res = IA_LIMIT(val, IA_S4_15_MIN, IA_S4_15_MAX) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_S4_15_temp_param)); + const float32_t IA_FLOAT_TO_S4_15_round_rs = IA_ROUND(IA_FLOAT_TO_S4_15_limit_res); + return CAST_TO_TYPE(int32_t, IA_FLOAT_TO_S4_15_round_rs); +} + +inline int32_t IA_FLOAT_TO_S1_20(const float32_t val) +{ + const uint32_t IA_FLOAT_TO_S1_20_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_SX_20_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_S1_20_temp_limit_res = IA_LIMIT(val, IA_S1_20_MIN, IA_S1_20_MAX) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_S1_20_temp_param)); + const float32_t IA_FLOAT_TO_S1_20_temp_round_rs = IA_ROUND(IA_FLOAT_TO_S1_20_temp_limit_res); + return CAST_TO_TYPE(int32_t, IA_FLOAT_TO_S1_20_temp_round_rs); +} + +inline uint16_t IA_FLOAT_TO_S5_10(const float32_t val) +{ + const uint32_t IA_FLOAT_TO_S5_10_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_SX_10_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_S5_10_limit_res = (IA_LIMIT(CAST_TO_TYPE(float64_t, val), IA_S5_10_MIN, IA_S5_10_MAX)) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_S5_10_temp_param)); + const float64_t IA_FLOAT_TO_S5_10_round_rs = IA_ROUNDD(IA_FLOAT_TO_S5_10_limit_res); + return CAST_TO_TYPE(uint16_t, IA_FLOAT_TO_S5_10_round_rs); +} + +inline int32_t IA_FLOAT_TO_S4_20(const float64_t val) +{ + const uint32_t IA_FLOAT_TO_S4_20_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_SX_20_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_S4_20_limit_res = (IA_LIMIT(val, IA_S4_20_MIN, IA_S4_20_MAX)) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_S4_20_temp_param)); + const float64_t IA_FLOAT_TO_S4_20_round_rs = IA_ROUNDD(IA_FLOAT_TO_S4_20_limit_res); + return CAST_TO_TYPE(int32_t, IA_FLOAT_TO_S4_20_round_rs); +} + +inline int32_t IA_FLOAT_TO_S14_8(const float64_t val) +{ + const uint32_t IA_FLOAT_TO_S14_8_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_SX_8_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_S14_8_limit_res = (IA_LIMIT(val, IA_S14_8_MIN, IA_S14_8_MAX)) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_S14_8_temp_param)); + const float64_t IA_FLOAT_TO_S14_8_round_rs = IA_ROUNDD(IA_FLOAT_TO_S14_8_limit_res); + return CAST_TO_TYPE(int32_t, IA_FLOAT_TO_S14_8_round_rs); +} + + +inline int32_t IA_FLOAT_TO_S18_8(const float64_t val) +{ + const uint32_t IA_FLOAT_TO_S18_8_temp_param = CAST_TO_TYPE(uint32_t, 2U) << (IA_SX_8_FRAC_BITS - 1U); + const float64_t IA_FLOAT_TO_S18_8_limit_res = IA_LIMIT(val, IA_S18_8_MIN, IA_S18_8_MAX) * (CAST_TO_TYPE(uint64_t, IA_FLOAT_TO_S18_8_temp_param)); + const float64_t IA_FLOAT_TO_S18_8_round_rs = IA_ROUNDD(IA_FLOAT_TO_S18_8_limit_res); + return CAST_TO_TYPE(int32_t, IA_FLOAT_TO_S18_8_round_rs); +} + +#else + +#define IA_MAX_FIXEDPOINT(integer_bits, frac_bits) (CAST_TO_TYPE(float64_t,((((integer_bits) > 0)?(2U<<(CAST_TO_TYPE(uint32_t,integer_bits)-1U)):1U))) - (1.0/(CAST_TO_TYPE(float64_t,(((frac_bits) > 0)?(2U<<(CAST_TO_TYPE(uint32_t,frac_bits)-1U)):0U))))) + + +#define IA_FLOAT_TO_Q0_31(val) CAST_TO_TYPE(uint32_t,(IA_ROUNDD((IA_LIMIT(val, IA_Q0_31_MIN, IA_Q0_31_MAX))*(CAST_TO_TYPE(uint64_t, 2U<<(IA_QX_31_FRAC_BITS-1U)))))) +#define IA_FLOAT_TO_Q14_16(val) CAST_TO_TYPE(uint32_t,(IA_ROUND((IA_LIMIT(val, IA_Q14_16_MIN, IA_Q14_16_MAX)*(CAST_TO_TYPE(uint64_t,2U<<(IA_QX_16_FRAC_BITS-1U))))))) + +#define IA_FLOAT_TO_Q3_16(val) CAST_TO_TYPE(uint32_t,(IA_ROUND((IA_LIMIT(val, IA_Q3_16_MIN, IA_Q3_16_MAX)*(CAST_TO_TYPE(uint64_t,2U<<(IA_QX_16_FRAC_BITS-1U))))))) + +#define IA_FLOAT_TO_S4_15(val) CAST_TO_TYPE(int32_t,(IA_ROUND((IA_LIMIT(val, IA_S4_15_MIN, IA_S4_15_MAX))*(CAST_TO_TYPE(uint64_t,2U<<(IA_SX_15_FRAC_BITS-1U)))))) + +#define IA_FLOAT_TO_S1_20(val) CAST_TO_TYPE(int32_t,(IA_ROUND((IA_LIMIT(val, IA_S1_20_MIN, IA_S1_20_MAX))*(CAST_TO_TYPE(uint64_t,2U<<(IA_SX_20_FRAC_BITS-1U)))))) + +#define IA_FLOAT_TO_S4_20(val) CAST_TO_TYPE(int32_t,(IA_ROUNDD((IA_LIMIT(val, IA_S4_20_MIN, IA_S4_20_MAX))*(CAST_TO_TYPE(uint64_t,2U<<(IA_SX_20_FRAC_BITS-1U)))))) + +#define IA_FLOAT_TO_S14_8(val) CAST_TO_TYPE(int32_t,(IA_ROUNDD((IA_LIMIT(val, IA_S14_8_MIN, IA_S14_8_MAX))*(CAST_TO_TYPE(uint64_t,2U<<(IA_SX_8_FRAC_BITS-1U)))))) + +#define IA_FLOAT_TO_S18_8(val) CAST_TO_TYPE(int32_t,(IA_ROUNDD((IA_LIMIT(val, IA_S18_8_MIN, IA_S18_8_MAX))*(CAST_TO_TYPE(uint64_t,2U<<(IA_SX_8_FRAC_BITS-1U)))))) + + +#endif + + + + + + + + + + + + + + +#if ((!defined _WIN32) && (!defined WIN32) && (!defined _WINDOWS) && (!defined WINDOWS) && (!defined __STDC_LIB_EXT1__) && (!defined memcpy_s)) + +#include +#include "ia_log.h" + +#define SAFE_MEM_SUCCESS 0 + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif /* _ERRNO_T_DEFINED */ + +inline static errno_t memcpy_s(void *dest, size_t destsz, const void *src, size_t count) +{ + if (NULL == dest) { + IA_LOG(ia_log_error, "memcpy_s: nullptr received\n"); + return EINVAL; + } + errno_t ret = SAFE_MEM_SUCCESS; + if (count > destsz) { + IA_LOG(ia_log_error, "memcpy_s: count(%zu) > destsz(%zu), downsizing count to destsz\n", count, destsz); + count = destsz; + ret = ERANGE; + } + if (src == NULL) { + memset(dest, 0, count); + ret = EINVAL; + } + else { + memcpy(dest, src, count); + } + + return ret; +} + +#elif defined (BUILD_FOR_ARM) +#include "ia_log.h" +inline static int memcpy_s(void *dest, size_t destsz, const void *src, size_t count) +{ + int ret = 0; + if (NULL == dest) { + IA_LOG(ia_log_error, "memcpy_s: nullptr received\n"); + return -1; + } + if (count > destsz) { + IA_LOG(ia_log_error, "memcpy_s: count(%zu) > destsz(%zu), downsizing count to destsz\n", count, destsz); + count = destsz; + ret = -1; + } + if (src == NULL) { + memset(dest, 0, count); + ret = 0; + } + else { + memcpy(dest, src, count); + } + + return 0; +} +#endif + +#define IA_MEMCOPY(_Dst, _Src, _MaxCount) (CAST_TO_TYPE(void,memcpy_s(_Dst, _MaxCount, _Src, _MaxCount))) +#define IA_MEMCOPYS(_Dst, _DstSize, _Src, _MaxCount) (CAST_TO_TYPE(void, memcpy_s(_Dst, _DstSize, _Src, _MaxCount))) + +#if (defined(__STDC_LIB_EXT1__) || defined(_WIN32) || defined(WIN32) || defined(memmove_s)) +#define IA_MEMMOVE(_Dst, _Src, _MaxCount) memmove_s(_Dst, _MaxCount, _Src, _MaxCount) +#define IA_MEMMOVES(_Dst, _DstSize, _Src, _MaxCount) memmove_s(_Dst, _DstSize, _Src, _MaxCount) +#else +#define IA_MEMMOVE(_Dst, _Src, _Size) memmove(_Dst, _Src, _Size) +#define IA_MEMMOVES(_Dst, _DstSize, _Src, _MaxCount) { IA_ASSERT((size_t)(_MaxCount) <= (size_t)(_DstSize)); memmove(_Dst, _Src, IA_MIN((size_t)(_DstSize), (size_t)(_MaxCount))); } +#endif + + +#if (defined(__STDC_LIB_EXT1__) || defined(_WIN32) || defined(WIN32) || defined(strnlen_s)) +#define IA_STRNLENS(_Str, _MaxCount) strnlen_s(_Str, _MaxCount) +#else +#define IA_STRNLENS(_Str, _MaxCount) strlen(_Str) +#endif + +#if (defined(__STDC_LIB_EXT1__) || defined(_WIN32) || defined(WIN32) || 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 + +#if ((defined(_WIN32) || defined(WIN32)) && defined(_MSC_VER)) +#ifndef BUILD_FOR_ARM +#include +#endif +#define IA_ISNAN(val) _isnan((float64_t)(val)) +#else +#define IA_ISNAN(val) isnan((float64_t)(val)) +#endif + +#ifndef BUILD_FOR_ARM +#if (defined(_WIN32) || defined(WIN32)) + +/* P2P_WINDOWS_KERNELSPACE */ +/* To be fixed properly. */ + #ifndef P2P_WINDOWS_KERNELSPACE + #include + #endif + + #if defined(_MSC_VER) + #if _MSC_VER>=1900 + #include /* defines snprintf */ + #endif + #if _MSC_VER<1900 && !defined(P2P_WINDOWS_KERNELSPACE) + #ifndef snprintf + #define snprintf _snprintf + #endif + #endif + #if !defined(__BOOL_DEFINED) + #if _MSC_VER >= 1800 /* stdbool.h is available starting from VS2013. */ + #include + #else /* Fallback for older VS versions. */ + typedef unsigned char bool; + #define true 1 + #define false 0 + #endif + #endif + #else + #include /* defines bool */ + #endif + +/* P2P_WINDOWS_KERNELSPACE */ +/* To be fixed properly. */ + #ifndef P2P_WINDOWS_KERNELSPACE + typedef HANDLE mutex_t; + typedef SRWLOCK rwlock_t; + #endif + + #define IA_MUTEX_CREATE(m) (m) = CreateMutex(NULL, false, NULL) + #define IA_MUTEX_DELETE(m) CloseHandle(m) + #define IA_MUTEX_LOCK(m) WaitForSingleObject(m, INFINITE) + #define IA_MUTEX_UNLOCK(m) {if (ReleaseMutex(m) == 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_CREATE(l) InitializeSRWLock(&l) + #define IA_RWLOCK_DELETE(l) ((void)0) + #define IA_RWLOCK_WRLOCK(l) AcquireSRWLockExclusive(&l) + #define IA_RWLOCK_WRUNLOCK(l) ReleaseSRWLockExclusive(&l) + #define IA_RWLOCK_RDLOCK(l) AcquireSRWLockShared(&l) + #define IA_RWLOCK_RDUNLOCK(l) ReleaseSRWLockShared(&l) + +/* Use VS-specific headers for SSE vector intrinsics */ + #include + #define ALIGNED_MALLOC(size, align) _aligned_malloc(size, align) + #define ALIGNED_FREE _aligned_free + #define ALIGNED_TYPE(x, ALIGNMENT) __declspec(align(ALIGNMENT)) x + +#else + + #include /* 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((float32_t)(a)) + #else + + #include /* defined POSIX thread model */ + typedef pthread_mutex_t mutex_t; + + #define IA_MUTEX_CREATE(m) {if (pthread_mutex_init(&m, NULL) != 0) {IA_ASSERT(false);}} + #define IA_MUTEX_DELETE(m) {if (pthread_mutex_destroy(&m) != 0) {IA_ASSERT(false);}} + #define IA_MUTEX_LOCK(m) {if (pthread_mutex_lock(&m) != 0) {IA_ASSERT(false);}} + #define IA_MUTEX_UNLOCK(m) {if (pthread_mutex_unlock(&m) != 0) {IA_ASSERT(false);}} + +#ifndef ENABLE_CUSTOMIZED_STD_LIB + typedef pthread_rwlock_t rwlock_t; + #define IA_RWLOCK_CREATE(l) {if (pthread_rwlock_init(&l, NULL) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_DELETE(l) {if (pthread_rwlock_destroy(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_WRLOCK(l) {if (pthread_rwlock_wrlock(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_WRUNLOCK(l) {if (pthread_rwlock_unlock(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_RDLOCK(l) {if (pthread_rwlock_rdlock(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_RDUNLOCK(l) {if (pthread_rwlock_unlock(&l) != 0) {IA_ASSERT(false);}} +#else + typedef pthread_mutex_t rwlock_t; + #define IA_RWLOCK_CREATE(l) {if (pthread_mutex_init(&l, NULL) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_DELETE(l) {if (pthread_mutex_destroy(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_WRLOCK(l) {if (pthread_mutex_lock(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_WRUNLOCK(l) {if (pthread_mutex_unlock(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_RDLOCK(l) {if (pthread_mutex_lock(&l) != 0) {IA_ASSERT(false);}} + #define IA_RWLOCK_RDUNLOCK(l) {if (pthread_mutex_unlock(&l) != 0) {IA_ASSERT(false);}} +#endif + +/* Use GNU-specific headers for SSE vector intrinsics */ + #if defined __i386__ || defined __x86_64__ + #include + #include + #define ALIGNED_MALLOC(size, align) memalign(align, size) + #define ALIGNED_FREE free + #define ALIGNED_TYPE(x, ALIGNMENT) x __attribute__((aligned(ALIGNMENT))) + #endif + #endif +#endif +#endif // BUILD_FOR_ARM + +/* 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, 8U) +#endif + +#define IA_ABSTRACTION_ROUND_DOWN(input_size, step_size) ((input_size) & ~((step_size)-1)) +#define IA_ABSTRACTION_STEP_SIZE_4 4 +#define IA_ABSTRACTION_STEP_SIZE_2 2 + +#if defined(__ANDROID__) + #define FILE_DEBUG_DUMP_PATH "/data/misc/cameraserver/" +#elif defined(_WIN32) + #define FILE_DEBUG_DUMP_PATH "c:\\tmp\\" +#else /* Linux */ + #define FILE_DEBUG_DUMP_PATH "/tmp/" +#endif + +#endif /* _IA_ABSTRACTION_H_ */ diff --git a/include/ipu8/ia_imaging/ia_aec_types.h b/include/ipu8/ia_imaging/ia_aec_types.h new file mode 100644 index 0000000..e02a7c5 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_aec_types.h @@ -0,0 +1,143 @@ +/* + * Copyright 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. + */ + + +/*! + * \file ia_aec.h + * \brief Definitions and declarations of Intel AEC algorithm. + */ + +#ifndef _IA_AEC_TYPES_H_ +#define _IA_AEC_TYPES_H_ + +#include "ia_configuration.h" +#include "ia_types.h" +#include "ia_aiq_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef IA_AEC_FEATURE_WEIGHT_GRID +#define IA_AEC_WEIGHT_GRID_SIZE (IA_AEC_WEIGHT_GRID_WIDTH * IA_AEC_WEIGHT_GRID_HEIGHT) +typedef struct +{ + unsigned int grid_width; + unsigned int grid_height; + unsigned char data[IA_AEC_WEIGHT_GRID_SIZE]; +} ia_aec_weight_grid; +#endif + +typedef struct ia_aec_t ia_aec; + +/*! + * \brief Input parameter structure for AE algorithm. + * This structure can be initialized to zero values for basic functionality (disable or make features ineffective). + */ +typedef struct +{ + unsigned int num_exposures; /*!< The number of exposure outputs to have. One for LDR, two or more for HDR/exposure bracketing. */ + ia_aiq_exposure_sensor_descriptor sensor_descriptor[IA_AEC_EXPOSURES_MAX_NUM]; /*!< Sensor specific descriptor and limits of the used sensor mode for target frame use. */ + unsigned int num_sensor_descriptors; /*!< The number of sensor descriptors given in the above pointer. + Used to specify different sensor descriptors for each exposure. */ + ia_aiq_ae_exposure_distribution_priority exposure_distribution_priority; /*!< AEC exposure distribution priority mode. */ + ia_aiq_ae_priority_mode priority_mode; /*!< AEC priority mode. */ + float manual_convergence_time; /*!< Manual AEC convergence speed in seconds. + < 0.0 Use convergence speed from tunings. + 0.0 Convergence filters are bypassed. This is similar behavior as in previous API when using frame_use still + > 0.0 Overrides convergence speed from tunings. */ + ia_aiq_ae_manual_limits manual_limits[IA_AEC_EXPOSURES_MAX_NUM]; /*!< Manual limits which override limits defined in AEC tunings. If tunings are to be used, all values must be set to 0. */ + unsigned int num_manual_limits; /*!< Number of limits to use. One, if same limits are used for all exposures, two or more if different limits for each exposure are used. */ + float ev_shift; /*!< Exposure Value shift [-4,4]. */ +#ifdef IA_AEC_FEATURE_FLASH + ia_aiq_flash_mode flash_mode; /*!< Manual flash mode. If AEC should make flash decision, set mode to ia_aiq_flash_mode_auto. */ +#endif +#ifdef IA_AEC_FEATURE_WEIGHT_GRID + ia_aiq_ae_metering_mode metering_mode; /*!< AEC metering mode. */ +#endif +#ifdef IA_AEC_FEATURE_FLICKER_DETECTION + ia_aiq_ae_flicker_reduction flicker_reduction_mode; /*!< AEC flicker reduction mode. */ +#endif +#ifdef IA_AEC_FEATURE_ROI_ENABLED + ia_rectangle exposure_window; /*!< Rectangle of area which AEC uses to to calculate new exposure parameters. If rectangle is not to be used, all values must be set to 0. */ +#endif +#ifdef IA_AEC_FEATURE_APERTURE_CONTROL + float manual_aperture_fn; /*!< Manual f-number of aperture (e.g. 2.8), <= 0.0 for N/A. Used only with P iris. */ +#endif +#ifdef IA_AEC_FEATURE_DC_IRIS + ia_aiq_aperture_control_dc_iris_command manual_dc_iris_command; /*!< Used only with DC iris. 0 (auto) for N/A. */ +#endif +} ia_aec_input_params; + +/*! + * \brief Gain structure defining gain value and type. + */ +typedef struct +{ + cmc_gain_type_t type; /*!< Gain type (analog, digital, etc.). */ + float value; /*!< Gain value as a multiplier (e.g. 1.0). */ +} ia_aec_gain; + +/*! +* \brief AEC results. +*/ +typedef struct +{ + unsigned int exposure_time_us; /*!< Exposure time in microseconds, -1 if N/A. */ + ia_aec_gain gains[IA_CMC_GAINS_MAX_NUM]; /*!< Gain as multipliers (e.g. 1.0), -1.0f if N/A. */ + unsigned int num_gains; /*!< The number of gains. */ + int iso; /*!< ISO value corresponding to the total gains. -1 if N/A. */ + unsigned int total_target_exposure; /*!< Total exposure ie. combination of Et, Total gains and Aperture gain, -1 if N/A. */ +} ia_aec_exposure_parameters; + +typedef struct +{ + unsigned int exposure_index; /*!< Exposure index which identifies the exposure. */ + ia_aec_exposure_parameters exposure[IA_AEC_EXPOSURE_PLANS_NUM]; /*!< Exposure parameters to be used in the next frame in generic format. */ + ia_aiq_exposure_sensor_parameters sensor_exposure[IA_AEC_EXPOSURE_PLANS_NUM]; /*!< Exposure parameters to be used in the next frame in sensor specific format. */ + unsigned int exposure_plan_ids[IA_AEC_EXPOSURE_PLANS_NUM]; /*!< Exposure plan IDs. Used to identify and sync what parameters were changed in the exposure plan. */ + float distance_from_convergence; /*!< Distance of convergence as an EV shift value. Negative is underexposure, positive is overexposure */ +} ia_aec_exposure_result; + +typedef struct +{ + ia_aec_exposure_result exposures[IA_AEC_EXPOSURES_MAX_NUM]; /*!< Results for each exposure to be used in the next frame. */ + unsigned int num_exposures; /*!< The number of calculated exposures. */ + float lux_level_estimate; /*!< Lux level estimate. */ + bool converged; /*!< Indicates that AE has converged. */ +#ifdef IA_AEC_FEATURE_WEIGHT_GRID + ia_aec_weight_grid weight_grid; /*!< Weight map to be used in the next frame histogram calculation. */ +#endif +#ifdef IA_AEC_FEATURE_FLASH + ia_aiq_flash_parameters flashes[IA_AEC_FLASHES_NUM]; /*!< Array of flash parameters for each flashes to be used in the next frame. */ +#endif +#ifdef IA_AEC_FEATURE_FLICKER_DETECTION + ia_aiq_ae_flicker_reduction flicker_reduction_mode; /*!< Flicker reduction mode proposed by the AEC algorithm */ +#endif +#ifdef IA_AEC_FEATURE_MULTIFRAME_HINT + ia_aiq_bracket_mode multiframe; /*!< AEC may propose to use multiframe for optimal results. */ +#endif +#ifdef IA_AEC_FEATURE_APERTURE_CONTROL + ia_aiq_aperture_control aperture_control; /*!< Aperture control parameters. */ +#endif +} ia_aec_results; + + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_AEC_H_ */ diff --git a/include/ipu8/ia_imaging/ia_aic_class.h b/include/ipu8/ia_imaging/ia_aic_class.h new file mode 100644 index 0000000..85f971c --- /dev/null +++ b/include/ipu8/ia_imaging/ia_aic_class.h @@ -0,0 +1,279 @@ +/* + * INTEL CONFIDENTIAL + * + * Copyright (C) 2018-2025 Intel Corporation + * + * This software and the related documents are Intel copyrighted materials, + * and your use of them is governed by the express license under which they + * were provided to you ("License"). Unless the License provides otherwise, + * you may not use, modify, copy, publish, distribute, disclose or transmit + * this software or the related documents without Intel's prior written permission. + * This software and the related documents are provided as is, with no express + * or implied warranties, other than those that are expressly + * stated in the License. + */ + +/*! + * \file ia_aic_class.h + * \brief AIC specific implementation. +*/ + +#ifndef IA_AIC_CLASS_H +#define IA_AIC_CLASS_H + +#include "ia_aic_types.h" +#if defined INPUTS_IN_FILE +#include "ia_aic_class_file_debug.h" +#endif + +namespace aic { +class LIBEXPORT IaAic +{ + public: + IaAic(); + virtual ~IaAic(); + + /*! Create AIC context and initialize AIC + * + * Create new AIC context for the pipeline. Performs basic initialization of the context + * + * \param [in] aiqb_data Tuning data information + * + * \return Pointer to new context, Null if failed + */ + ia_err Init( + const ia_binary_data *aiqb_data); + + /*! Configure statistics + * + * Configure statistics for the context. This API changes + * while the implementation of the statistics part progress + * + * \param [in] ia_cmc Sensor characterization information + * \param [in] max_stats_width Maximum statistics width + * \param [in] max_stats_height Maximum statistics height + * \param [in] max_num_stats_in Maximum number of statistics + * + * \return ia_error_none / error code on failure + */ + ia_err StatisticsInit( + ia_cmc_t *ia_cmc, + uint32_t max_stats_width, + uint32_t max_stats_height, + uint32_t max_num_stats_in); + + /*! Run AIC common for the pipeline + * + * Run common part of the AIC. Call processes input parameters from + * the 3A+ algoritms and performs tuning interpolation + * for the all the kernels which are registered to this context. + * + * This call is not thread safe. Only one instance may be running at the same time. + * + * Caller must guarantee following: + * Input data buffers pointed by pointers in input_params retains unmodified until + * ia_aic_run_kernels calls for all registered CB/PG's have been run. ia_aic_run_aic doesn't + * make internal copies of the large tables pointed by input_params. + * + * \param [in] sequenceId Sequence number of frame this AicRun should producer to + * \param [in] input_params Pointer to AIC input parameter structure + * + * \return ia_error_none / error code on failure + * + */ + ia_err RunAic( + int64_t sequenceId, + const IaAicInputParams *inputParams); + + /*! Process all kernels from group registered as group_id + * + * Run all kernels from group known as group_id in this context. + * + * \param [in] group_id PG / CB ID given at registration time + * \param [in] sequenceId Frame sequence id + * \param [out] output_data Provide a way to have read-only access to ISP API simulation format data + * \param [in] fragment_index in case of striping, indicates the current stripe index that we calculate parameters for. In case striping is not supported 0 should be used. + * + * return ia_err_none in success. Errorcode on failure + */ + ia_err RunKernels( + int32_t group_id, + int64_t sequenceId, + ia_binary_data *output_data, + uint32_t fragment_index = 0U); + + ia_err GetPalInputParameters(int64_t sequenceId, ia_binary_data* aic_output_common, ia_binary_data* tuning_output); + + /*! Register kernel offsets for a kernel with uuid in CB/PG group_id and terminal + * + * Register kernel offsets for a kernel with uuid in CB/PG group_id and terminal. + * + * \param [in] uuid Kernel identifier (PAL UUID) + * \param [in] group_id CB/PG id given at registration phase + * \param [in] terminal_type CB/PG id given at registration phase + * \param [in] terminal_index The index of the terminal to register the offsets to + * \param [in] offsets List of offsets for all the sections for this kernel in the given terminal + * \param [in] sizes List of sizes for all the sections for this kernel in the given terminal + * \param [in] num_offsets Number of sections for this kernel in the given terminal + * \param [in] fragment Fragment index **Deprecated** + * + * return ia_err_none in success. Error code on failure + * + */ + ia_err RegisterKernelOffset( + int32_t uuid, + int32_t group_id, + IaAicBufferTypes terminal_type, + uint32_t terminal_index, + uint32_t *offsets, + const uint32_t *sizes, + uint32_t num_offsets, + uint32_t fragment); + + /*! Configure CB/PG to AIC context + * + * Configure a CB/PG using kernel run list. This function creates internal + * context for a CB/PG in this context. CB/PG is known as group_id from now on. + * + * Note: Kernel list is fixed after this call. Kernel must cover all kernels in + * CB/PG and it may not contain any extra kernel. + * + * \param [in] pg_id unique identifier for this group of kernels in this context + * \param [in] fragmentCount Number of fragments in this group + * \param [in] kernelGroup List of kernels in this group with per kernel configuration data + * \param [in] statsBufToTermId Mapping from statistics buffer type to terminal ID (Optional) + * + * return ia_err_none in success. Errorcode on failure + */ + ia_err Configure( + int32_t pg_id, + int32_t fragmentCount, + const ImagingKernelGroup *kernelGroup, + const int32_t* statsBufToTermId = nullptr); + + /*! Update tuning including isp + * It provides the functionality that update tuning data in run time after initialization. + * + * \param [in] aiqb_data ISP tuning data + * + * return ia_err_none in success. Errorcode on failure + */ + ia_err updateTuning( + const ia_binary_data *aiqb_data, + const ia_cmc_t *ia_cmc_ptr = nullptr); + + /*! Update resolutions info/history configuration for CB/PG to AIC context + * + * + * + * \param [in] pg_id unique identifier for this group of kernels in this context + * \param [in] fragmentCount Number of fragments in this group + * \param [in] pg List of kernels in this group with per kernel configuration data + * + * return ia_err_none in success. Errorcode on failure + */ + ia_err UpdateConfigurationResolutions(int32_t pg_id, + int32_t fragmentCount, + const ImagingKernelGroup* kernelGroup, bool isKeyResolutionChanged); + + /*! Register HW register format output buffer + * + * Register a buffer to AIC context. All but pixel buffers must be registered to the context + * before the streaming starts. + * + * \param [in] group_id unique identifier for this group of kernels in this context + * \param [in] terminal_index index to terminal. + * \param [in] buffer Buffer descriptor + * \param [in] fragment_index in case of striping, indicates the current stripe index that we register buffer for. In case striping is not supported for this specific buffer or at all, 0 should be used + * + * return ia_err_none in success. Errorcode on failure + * + */ + ia_err RegisterBuffer( + int32_t group_id, + uint32_t terminal_index, + const IaAicBuffer *buffer, + uint32_t fragment_index = 0U); + + /*! Get current buffer + * + * Get current output buffer for terminal. Same buffer can be returned several times + * if the content hasn't been updated. + * + * \param [in] group_id unique identifier for this group of kernels in this context + * \param [in] terminal_index index to terminal + * \param [in] target Pointer to buffer descriptor where this function stores the buffer information + * \param [in] fragment_index in case of striping, indicates the current stripe index that we get buffer for. In case striping is not supported for this specific buffer or at all, 0 should be used + * + * return ia_err_none in success. Errorcode on failure + * + */ + ia_err GetBuffer( + int32_t group_id, + uint32_t terminal_index, + IaAicBuffer *target, + uint32_t fragment_index = 0U); + + /*! Get buffer size for particular terminal + * + * \param [in] group_id unique identifier for this group of kernels in this context + * \param [in] terminal_index index to terminal + * \param [in] fragment_index in case of striping, indicates the current stripe index that we get buffer for. In case striping is not supported for this specific buffer or at all, 0 should be used + * + * return size when success. Zero on failure. + */ + size_t GetBufferSize( + int32_t group_id, + uint32_t terminal_index, + uint32_t fragment_index = 0U) const; + + /*! Decode statistics + * + * Decodes statistics produced by kernels within the group + * + * \param [in] group_id unique identifier for this group of kernels in this context + * \param [in] sequenceId sequence id of the frame to decode from + * \param [out] stats pointer to statistics store where to decode to + * \param [out] dvs_stat pointer to statistics store where to decode to for dvs only + * + * return ia_err_none in success. Error code on failure + */ + ia_err DecodeStatistics( + int32_t group_id, + int64_t sequenceId, + IaCcatStatistics *stats, + ia_dvs_statistics *dvs_stat = nullptr, + bool skip=false); + + static uint32_t getPacOutputSize(const ImagingKernelGroup* kernelGroup); + + private: + IaAic(const IaAic &); + IaAic &operator=(const IaAic &); + + int32_t PgIndex(int32_t group_id) const; + + ia_err IaAicInitPrivate(const ia_binary_data *aiqb_data); + + void IaAicDeinitPrivate(); + ia_err IaAicUpdateGAic(const ia_binary_data *aiqb_data); + + ia_err RunAicPrivate(const IaAicInputParams *inputParams); + size_t MapConversionBuffers(void *buffer); + /* file debug */ +#if defined INPUTS_IN_FILE + aic_debug_t *mDebug; +#endif + /* Pipe level AIC */ + ia_aic_handle *mAic; + + /* Max number of CBs / program groups which one context can handle */ + static const int32_t AIC_MAX_PGS = 5; + /* Num CB/PG in this pipe */ + int32_t mNumPgs; + /* PAC engines in this pipe */ + void* mPgs[AIC_MAX_PGS]; +}; +} /* namespace aic */ + +#endif /* IA_AIC_CLASS_H */ diff --git a/include/ipu8/ia_imaging/ia_aic_types.h b/include/ipu8/ia_imaging/ia_aic_types.h new file mode 100644 index 0000000..d5ad617 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_aic_types.h @@ -0,0 +1,199 @@ +/* +* Copyright 2018-2025 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_aic_types.h + * \brief AIC data types for external use + */ + +#ifndef IA_AIC_TYPES_H +#define IA_AIC_TYPES_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace aic { +/* + * All that external parties needs to know about the AIC internals + */ +struct ia_aic_handle; +typedef struct ia_aic_handle ia_aic_handle_t; + +class IaAic; +typedef ia_rectangle IaRectangle; + +enum IaAicBufferTypes +{ + iaAicParamInBuffer = 0, + iaAicParamOutBuffer, + iaAicProgramBuffer, + iaAicSpatialInBuffer, + iaAicSpatialOutBuffer, + iaAicFrameInBuffer, + iaAicFrameOutBuffer, + iaAicSystemBuffer, + iaAicSRFrameInBuffer, + iaAicSRFragInBuffer, + iaAicBufferTypeNotSet +}; + +struct IaAicUpscalerFragDesc +{ + uint16_t fragmentInputCropLeft; /*!< The amount of pixels to crop on the left before upscaling. */ + uint16_t fragmentInputCropRight; /*!< The amount of pixels to crop on the right before upscaling. */ +}; + +struct IaAicFragmentDesc //must be aligned with: ia_pac_fragment_desc in ia_pac_frag_types +{ + uint16_t fragmentInputWidth; /*!< The input width of the fragment. */ + uint16_t fragmentOutputWidth; /*!< The output width of the fragment. */ + uint16_t fragmentStartX; /*!< The x offset from the top-left corner of the full image. */ + + // Kernel specific additions + union + { + IaAicUpscalerFragDesc upscalerFragDesc; + }; /*!< Extended fragment description. */ +}; + + +/*! AIC buffer descriptor +* +* A structure which descripes buffers between caller and AIC +* +*/ +struct IaAicBuffer +{ + uint32_t id; /*! Buffer type identifier */ + size_t size; /*! Size of the payload data */ + int64_t sequence; /*! Frame sequence the buffer has been previously associated with + NOTE: coherent only for buffer returned from IaAicGetBuffer() */ + void *payloadPtr; /*! Pointer to payload data */ +}; + +struct IaBinaryData +{ + void *data; + uint32_t size; +}; + +/*! +* \brief Defines how ISP kernel should modify bit depth of image passing through it. +*/ + +struct ImagingKernelFormatInfo + { + uint32_t inputFormat; /*!< FourCC of format in input edge of the kernel + (can be used to retrieve full format description from ISP format bridge */ + uint32_t outputFormat; /*!< FourCC of format in output edge of the kernel */ + }; + +struct ImagingKernelBppInfo +{ + uint8_t inBpp; + uint8_t outBpp; +}; + +/*! +* \brief Describes options for run-time kernel control. +*/ +enum ImagingKernelEnableControl +{ + kernelPassthrough = 0, + kernelEnable, + kernelDisable +}; + + +struct ia_pac_kernel_info { + ia_isp_bxt_run_kernels_t run_kernel; + IaAicFragmentDesc* fragment_descs; + bool fragments_defined; +}; + +struct ImagingKernelGroup +{ + uint32_t kernelCount; /*!< Number of kernels in the kernelList .*/ + ia_pac_kernel_info *kernelList; /*!< Array of kernels in the group. */ + uint32_t operationMode; /*!< Operation mode for selecting proper tunings. Is usually associated to different resolutions. */ + uint32_t streamId; /*!< Indicate predefined tuning id to use with this group */ +}; + +struct IaAicInputParams +{ + /* Mandatory parameters */ + ia_aiq_frame_params *sensorFrameParams; /*!< Mandatory. Sensor frame parameters. Describe frame scaling/cropping done in sensor. */ + ia_aiq_awb_results *awbResults; /*!< Mandatory. WB results which are to be used to calculate next ISP parameters (WB gains, color matrix,etc). */ + ia_aiq_gbce_results *gbceResults; /*!< Mandatory. GBCE Gamma tables which are to be used to calculate next ISP parameters.*/ + ia_aiq_ae_results *aeResults; /*!< Mandatory. Exposure results which are to be used to calculate next ISP parameters. + Currently only exposure times, analog and digital gains are used. For convenience reasons AIC takes + ae results and not only needed parameters. */ + ia_aiq_pa_results_v1 *paResults; /*!< Mandatory. Parameter adaptor results from AIQ. */ + ia_aiq_sa_results_v1 *saResults; /*!< Mandatory. Shading adaptor results from AIQ. */ + ia_aiq_hist_weight_grid *weightGrid; /*!< Mandatory. Weight map to be used in the next frame histogram calculation. */ + ia_isp_feature_setting nrSetting; /*!< Mandatory. Feature setting for noise reduction algorithms. */ + ia_isp_feature_setting eeSetting; /*!< Mandatory. Feature setting for edge enhancement algorithms. */ + ia_ltm_results *ltmResults; /*!< Mandatory. Local tone mapping results from LTM. */ + ia_ltm_drc_params *ltmDrcParams; /*!< Mandatory. DRC parameters from LTM. */ + uint64_t timestamp; /*!< Mandatory. Current timestamp (is microseconds) when ia_isp_bxt_run function is called. AIC uses timestamp to decide what + calculations are done based on tunable run rate for each ISP configuration algorithm. */ + ia_dvs_image_transformation *gdcTransformation; /*!< Mandatory. Image transformation parameters for GDC5 ISP FW. This feature replaces the need for morph_table usage.*/ + ia_media_format mediaFormat; /*!< Mandatory. Selected Digital television output format.(e.g. BT709) */ + int32_t ptz_zoom_active; + float32_t zoom_factor; /*!< Mandatory. Zoom factor for zoom mode. If ptz_zoom_active is false, zoom_factor is 1.0. */ + + /* Optional parameters */ + char manualBrightness; /*!< Optional. Manual brightness value range [-128,127]. Value 0 means no change. */ + char manualContrast; /*!< Optional. Manual contrast value range [-128,127]. Value 0 means no change. */ + char manualHue; /*!< Optional. Manual hue value range [-128,127]. Value 0 means no change. + Value -96 means red become blue, green become red, blue become green */ + char manualSaturation; /*!< Optional. Manual saturation value range [-128,127]. Value 0 means no change. */ + ia_isp_effect effects; /*!< Optional. Manual setting for special effects. Combination of ia_isp_effect enums.*/ + ia_isp_custom_controls *customControls; /*!< Optional. Custom control parameter for interpolating between different tunings. + If custom controls are not used, pointer can be set as null.*/ + float32_t manualDigitalGain; /*!< Optional. Additional digital gain that is applied to all color channels of the image before ISP statistics collection. + Values less than 1.0 means no additional gain. */ + ia_ob_output obBlackLevel; /*!< Optional. Black level values calculated on-the-fly when the sensor supports. */ + ia_view_config_t const *viewParams; /*!< Optional. View parameters for running in GDC5 mode.*/ + ia_camera_parameters_t const *cameraParams; /*!< Optional. Camera parameters running in GDC7 for auto calib.*/ + ia_rectify_parameters_t const *rectifyParams; /*!< Optional. Rectification running in GDC7 for UV mapping */ + ia_bcomp_results const *bcompResults; /*!< Optional. bit-compression curves. */ + ia_nntm_parameters_t *nntmParams; /*!< Optional. Neural network tone mapping parameters. */ + ia_faces_roi_results* face_roi; /*!< Optional. Face detection ROI parameters.*/ +#ifdef USE_SCD + ia_aiq_scd_results* scd_results; /*!< Mandatory. SCD results which are to be used to calculate scene change magnitude. */ +#endif +}; + +typedef ia_ccat_frame_statistics IaCcatStatistics; + +typedef uint32_t IaAicStructuralParameter; + +// ========================================================================== +// Deprecated interface +// ========================================================================== + +typedef class IaAic ia_aic_ctx_t; +} // namespace aic + +#endif // IA_AIC_TYPES_H diff --git a/include/ipu8/ia_imaging/ia_aiq.h b/include/ipu8/ia_imaging/ia_aiq.h new file mode 100644 index 0000000..908ecca --- /dev/null +++ b/include/ipu8/ia_imaging/ia_aiq.h @@ -0,0 +1,697 @@ +/* + * Copyright 2012-2026 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. + */ + +/*! + * \note 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. + *


+ * + * \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 + * + *


+ * + * \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_v5 + * To set statistics for algorithms AIQ library, one must call function: + * \code ia_aiq_statistics_set_v5 \endcode + * \copydetails ia_aiq_statistics_set_v5 + * + * 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_v1 + * To set external sensor data statistics for algorithms AIQ library, one must call function: + * \code ia_aiq_sensor_events_set_v1 \endcode + * \copydetails ia_aiq_sensor_events_set_v1 + * + *


+ * + * \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_v1 + * \code ia_aiq_ae_run_v1 \endcode + * \copydetails ia_aiq_ae_run_v1 + * + * \subsection awb AWB + * \copybrief ia_aiq_awb_run_v1 + * \code ia_aiq_awb_run_v1 \endcode + * \copydetails ia_aiq_awb_run_v1 + * + * \subsection sa SA + * \copybrief ia_aiq_sa_run_v2 + * \code ia_aiq_sa_run_v2 \endcode + * \copydetails ia_aiq_sa_run_v2 + * + * \subsection pa PA + * \copybrief ia_aiq_pa_run_v1 + * \code ia_aiq_pa_run_v1 \endcode + * \copydetails ia_aiq_pa_run_v1 + * + * \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. + * + * + *


+ * + * \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_v1.h" +#include "ia_types.h" +#include "ia_mkn_types.h" +#include "ia_cmc_types.h" +#include "ia_statistics_types.h" +#include "ia_ccat_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_ptr 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 *a_aiq_tuning_data_ptr, + const ia_binary_data *a_nvm_data_ptr, + const ia_binary_data *a_aiqd_data_ptr, + uint32_t a_stats_max_width, + uint32_t a_stats_max_height, + uint32_t a_max_num_stats_in, + ia_cmc_t *a_ia_cmc, + ia_mkn *a_ia_mkn_ptr); + +/*! + * \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_ptr, + const ia_binary_data *aiqb_data); + +/*! + * \brief De-initialize IA_AIQ and its submodules. + * All memory allocated by AIQ algorithms are freed. AIQ handle can no longer be used. + * + * \param[in] ia_aiq_ptr Mandatory.\n + * AIQ instance handle. + */ +LIBEXPORT void +ia_aiq_deinit(ia_aiq *a_ia_aiq_ptr); + +/*! + * \brief Input parameter structure for AE algorithm. + */ +typedef struct +{ + uint32_t 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. */ + /*LDRA_INSPECTED 67 X */ + 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 */ + uint32_t num_sensor_descriptors; /*!< Mandatory. The number of sensor descriptors given in the above pointer. + Used to specify different sensor descriptors for each exposure. */ + 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. */ + float32_t ev_shift; /*!< Optional. Exposure Value shift [-4,4]. */ + /*LDRA_INSPECTED 90 S */ + 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; */ + float32_t *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; */ + int16_t *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. */ + uint32_t *manual_total_target_expsure; /*!< Optional. Manual total target exposure. */ + float32_t 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. */ + float32_t manual_convergence_time; /*!< Mandatory. Manual AEC convergence speed in seconds. + -1.0 if NA (uses tunings). + 0.0 means convergence filters are bypassed, this is similar behavior as in previous API when using frame_use still + > 0.0 Overrides convergence speed from tunings. */ +} ia_aiq_ae_input_params_v1; + +/*! + * \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_v1(ia_aiq *a_ia_aiq_ptr, + const ia_aiq_ae_input_params_v1 *ae_input_params, + ia_aiq_ae_results **a_ae_results_ptr); + + +/*! +* \brief Get the AEC calculated histograms. +* AE calculates histograms from the RGBS grid. +* +* \param[in] ia_aiq_ptr Mandatory.\n +* AIQ instance handle. +* \param[in] exposure_index Mandatory.\n +* exposure index. +* \param[in] histogram_type Mandatory.\n +* histogram type. +* \return Pointer to the calculated histograms. +*/ +LIBEXPORT const ia_histogram * +ia_aiq_get_histograms_v2(ia_aiq *a_ia_aiq_ptr, + uint32_t exposure_index, + ia_ccat_histogram_type histogram_type); + +/*! + * \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.). */ + int32_t lens_position; /*!< Mandatory. Current lens position. */ + uint64_t 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 Input parameter structure for AF algorithm for LNL Platform. + */ +typedef struct +{ + ia_aiq_frame_use frame_use; /*!< Mandatory. Target frame type of the AF calculations (Preview, Still, video etc.). */ + int32_t lens_position; /*!< Mandatory. Current lens position. */ + uint64_t 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. */ + uint32_t* focus_offset_pdaf_caf; /*!< Optional. x and y offset between pdaf T2 and caf since input format kernel has a crop*/ +} ia_aiq_af_input_params_v1; +/*! + * \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_ptr 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 *a_ia_aiq_ptr, + const ia_aiq_af_input_params *af_input_params, + ia_aiq_af_results **a_af_results_ptr); + +/*! + * \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_ptr 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_v1( + ia_aiq* a_ia_aiq_ptr, + const ia_aiq_af_input_params_v1* af_input_params, + ia_aiq_af_results** a_af_results_ptr); + +/*! + * \brief calcualte the object focus distance based on the lens position. + * + * \param[in] ia_aiq_ptr Mandatory.\n + * AIQ instance handle. + * \param[in] lens_position Mandatory.\n + * vcm position. + * \param[out] focus_distance Mandatory.\n + * pointer to calculated object focus distance Results from AF calculations. + * \return Error code. + */ +LIBEXPORT ia_err +ia_aiq_calculate_focus_distance(ia_aiq *ia_aiq_ptr, + int32_t lens_position, + int32_t *focus_distance); + +/*! + * \brief Input parameter structure for AWB algorithm. + */ +typedef struct +{ + 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. */ + float32_t manual_convergence_time; /*!< Optional. Manual AWB convergence speed in seconds. -1.0 if NA. Overrides convergence speed from tunings. */ +} ia_aiq_awb_input_params_v1; + +/*! + * \brief AWB calculation based on input parameters and frame statistics. + * + * \param[in] ia_aiq_ptr 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_v1(ia_aiq *a_ia_aiq_ptr, + const ia_aiq_awb_input_params_v1 *awb_input_params, + ia_aiq_awb_results **a_awb_results_ptr); + + +/*! + * \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; /*!< Deprecated. Not used. */ + float32_t ev_shift; /*!< Optional. Exposure Value shift [-4,4]. */ + bool athena_mode; /*!< Optional. This flag is used to indicate whethe athena mode is enabled in ful_gtm algo*/ + gtm_glare_detection_type glare_detect_type; /*!< Optional. Glare detection. */ + uint32_t lux_level_sensors[2]; /*!< Optional. Sensor lux level based glare detection. */ +#ifdef _WIN32 + bool cphdr_mode; +#endif +} ia_aiq_gbce_input_params; + +/*! + * \brief GBCE calculation based on input parameters and frame statistics. + * Computes gamma + * + * \param[in] ia_aiq_ptr 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 *a_ia_aiq_ptr, + const ia_aiq_gbce_input_params *gbce_input_params, + ia_aiq_gbce_results **a_gbce_results_ptr); + +/*! + * \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; /*!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 *a_ia_aiq_ptr, + ia_binary_data *out_ia_aiq_data); + +/*! + * \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_ptr Mandatory.\n + * AIQ instance handle. + * \param[in] frame_statistics Mandatory.\n + * Input parameters containing statistics information about a frame. + * \param[in] frame_parameters Mandatory.\n + * Input parameters containing result information about a frame. + * \return Error code. + */ +LIBEXPORT ia_err +ia_aiq_statistics_set_v5( + ia_aiq *a_ia_aiq_ptr, + const ia_ccat_frame_statistics *frame_statistics, /*!< \param[in] Input statistics */ + const ia_ccat_frame_parameters *frame_parameters); /*!< \param[in] Input parameters */ + +/*! +* \brief Data from external sensors +*/ +typedef struct +{ + ia_ccat_motion_sensor_event *accelerometer_events; /*!< The data holds information on the acceleration of the device in mg/sec (miligravity per second). + Acceleration = Gravity + Linear Acceleration*/ + uint32_t num_accelerometer_events; /*!< Number of accelerometer events */ + ia_ccat_motion_sensor_event *gravity_events; /*!< The data holds information on the gravitation of the device in mg/sec (miligravity per second) */ + uint32_t num_gravity_events; /*!< Number of gravity events */ + ia_ccat_motion_sensor_event *gyroscope_events; /*!< The data holds information on the angular velocity of the device in rad/sec */ + uint32_t num_gyroscope_events; /*!< Number of gyroscope events */ + ia_ccat_ambient_light_event *ambient_light_events; /*!< The data holds information on the ambient light */ + uint32_t num_ambient_light_events; /*!< Number of ambient light events */ +} ia_aiq_sensor_events_v2; + +/*! + * \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_ptr 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_v2(ia_aiq *a_ia_aiq_ptr, + const ia_aiq_sensor_events_v2 *sensor_events_input); +/*! + * \brief Segment downscaling and align with RGBS grids. + * Some of the AIQ algorithms benefit from segment map which tells about content in image + * + * \param[in] ia_aiq_segmap_input_params Mandatory.\n + * Parameters for segmap. + * \param[in] ia_segmap_grid Mandatory.\n + * Segment map. + * \return Error code. + */ +LIBEXPORT ia_err +ia_aiq_segmap_decode( + ia_aiq *a_ia_aiq_ptr, + const ia_aiq_segmap_input_params* segmap_input, + ia_segmap_grid* segmap_grid_ptr); + +/*! + * \brief Set segmap grids into Aiq handle. + * Some of the AIQ algorithms benefit from segment map which tells about content in image + * + * \param[in] ia_aiq_ptr Mandatory.\n + * AIQ instance handle. + * \param[in] ia_segmap_grid Mandatory.\n + * Segment map. + * \return Error code. + */ +LIBEXPORT ia_err +ia_aiq_segmap_set( + ia_aiq* a_ia_aiq_ptr, + const ia_segmap_grid* segmap_ptr); + +/*! + * \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/ipu8/ia_imaging/ia_aiq_types.h b/include/ipu8/ia_imaging/ia_aiq_types.h new file mode 100644 index 0000000..2df548a --- /dev/null +++ b/include/ipu8/ia_imaging/ia_aiq_types.h @@ -0,0 +1,1054 @@ +/* + * Copyright 2012-2025 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 + +#ifdef __cplusplus +extern "C" { +#endif + +#define IA_AIQ_MAX_NUM_EXPOSURES 10 + +/*! + * \brief Maximum number of sensor events supported by AIQ lib. + */ +#define IA_AIQ_MAX_NUMBER_OF_SENSOR_EVENTS 20 + +#define USE_SCD //temporary flag until SCD is fully enabled + +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 sensor stream type. + */ +typedef enum +{ + ia_aiq_sensor_rgb_stream = 0, /*!< RGB sensor stream or RGBIR sensor RGB only stream. */ + ia_aiq_sensor_monoir_stream = 1, /*!< MONOIR sensor stream. */ + ia_aiq_sensor_OG0VA1B_ir_stream = 2, /*!< WA for OG sensor. */ + ia_aiq_sensor_rgbir_stream = 4, /*!< RGBIR sensor IR only stream or RGB+IR stream. */ + ia_aiq_sensor_auto_switch_stream = 5 /*!< 4C/1C sensor auto switch mode. */ +} ia_aiq_sensor_stream_type; + +/*! + * \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. */ + int manual_iso_min; /*!< Optional. Manual minimum ISO. -1 if NA. */ + int manual_iso_max; /*!< Optional. Manual maximum ISO. -1 if NA. */ +} ia_aiq_ae_manual_limits; + +/*! + * \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 = (1U << 0U), + ia_aiq_scene_mode_portrait = (1U << 1U), + ia_aiq_scene_mode_lowlight_portrait = (1U << 2U), + ia_aiq_scene_mode_low_light = (1U << 3U), + ia_aiq_scene_mode_action = (1U << 4U), + ia_aiq_scene_mode_backlight = (1U << 5U), + ia_aiq_scene_mode_landscape = (1U << 6U), + ia_aiq_scene_mode_document = (1U << 7U), + ia_aiq_scene_mode_firework = (1U << 8U), + ia_aiq_scene_mode_lowlight_action = (1U << 9U), + ia_aiq_scene_mode_baby = (1U << 10U), + ia_aiq_scene_mode_barcode = (1U << 11U) +} 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 = (1U << 0U), /*!< Ultra Low Light bracketing used. */ + ia_aiq_bracket_mode_hdr = (1U << 1U), /*!< High Dynamic Range bracketing used. */ + ia_aiq_bracket_mode_ull_auto_switch = (1U << 2U), /*!< 1C (0) 4C (1) auto switch indication. */ + ia_aiq_bracket_mode_shdr_ldr_switch = (1U << 3U), /*!< shdr S and L (0) ldr long only (1) - for DOL */ + ia_aiq_bracket_mode_vai_mode = (1U << 4U) /*!< Video AI mode enable (0) regular mode (1) currently BNR, used to be VAI*/ +} 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; + +/*! + * Gain structure defining gain value and type. + */ +typedef struct +{ + cmc_gain_type_t type; /*!< Gain type (analog, digital, etc.). */ + float value; /*!< Gain value as a multiplier (e.g. 1.0). */ +} ia_aiq_gain; + +/*! + * \brief Exposure parameters in terms of generic units. + * Structure can be used as input or output from AEC. + */ +typedef struct +{ + unsigned int exposure_time_us; /*!< Exposure time in microseconds, -1 if N/A. */ + float analog_gain; /*!< Deprecated. Analog gain as a multiplier (e.g. 1.0), -1.0 if N/A. */ + float digital_gain; /*!< Deprecated. 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. */ + unsigned int total_target_exposure; /*!< Total exposure ie. combination of ET, gains, 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_gain gains[IA_CMC_GAINS_MAX_NUM]; /*!< Gain as multipliers (e.g. 1.0), -1.0f if N/A. */ + unsigned int num_gains; /*!< The number of gains. */ + unsigned int low_limit_total_exposure; /*!< Low limit of total exposure by tuning and sensor*/ + unsigned int up_limit_total_exposure; /*!< Up limit of total exposure by tuning and sensor*/ +} 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. */ + unsigned short gain_codes[IA_CMC_GAINS_MAX_NUM]; /*!< Global gain codes. */ +} 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_sensor_stream_type sensor_stream_type; /*!< Sensor stream type, 0: RGB, others: IR stream */ +} 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_feature_setting continuous_flicker_detection; /*!< AEC runs the flicker detection algorithm continuously in the VF */ + ia_aiq_ae_feature_setting flicker_detection_v2; /*!< AEC will run the new flicker detection algorithm */ +} 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. */ + int8_t 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. */ + bool shading_correction; /*!< Flag indicating if statistics was calculated using lens shading corrected data. */ + bool stitched_stats; /*!< RGBS stats for multi-exposures in stitched stats. */ +} ia_aiq_rgbs_grid; + +/*! +* \brief Generic grid structure. +*/ +typedef struct +{ + unsigned short *data; /*!< Data of size width * height. */ + unsigned short width; /*!< Grid width. */ + unsigned short height; /*!< Grid height. */ + float i_per_y; + float out_ir_compgain_isp; +} ia_aiq_grid; + +/*! + * \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. */ + bool shading_correction; /*!< Flag indicating if statistics was calculated using lens shading corrected 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; + +/*! + * \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. */ + float 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. */ + bool plc_mode_used; /*!< Indicates the PLC mode usage. */ + unsigned int plc_reset_cntr; /*!< Counter for DZ reseted frames after PLC on*/ +} 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 [mm] between the lens and object plane */ + int next_lens_position; /*!< Next lens position */ + int next_focal_distance; /*!< Focal distance [um] between the sensor and lens corresponding to the 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 enum to list scd users +*/ +typedef enum +{ + scd_tnr_6_0, /*!< TNR_6_0. */ + scd_cca_smart_skip, /*!< CCA POWER CONTROL. */ + num_scd_users /*!< always keep last, tracks the number of entities using SCD */ +} scd_users_t; + +/*! + * \brief Results from SCD. + */ +typedef struct +{ + float scd_score[num_scd_users]; /*! 0.0 Overrides convergence speed from tunings */ +} ia_aiq_sa_input_params_v1; + +/*! + * \brief Shading Adaptor results. + */ +typedef struct { + unsigned short* lsc_grid[4][4]; /*!< Pointers to the LSC grid for all color channels. Invalid channels are set to NULL. */ + unsigned short width; /*!< Width of LSC grid. */ + unsigned short height; /*!< Height of LSC grid. */ + unsigned int fraction_bits; /*!< Number of fraction bits for the shading table fix point representation. */ + cmc_bayer_order color_order; /*!< Color channels order. */ + bool lsc_update; /*!< Indicates if LSC grid 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 confidence; /*!< Confidence in results. */ + ia_aiq_frame_params frame_params; /*!< Frame parameters that describe cropped area size and its position under LSC grid. */ + float luma_strength; /*!< Luma correction strength in image corners, which is percent (normalized to be between 0.0f and 1.0f) of + brightness attenutation in corners against image center. Its parametric representation is a semi-sphere with + max 1.0f in the centre and luma_strength (e.g. 0.80f for 80%) in corner of size width x height. luma_strength + 1.0f (see 100%) is a plane of 1.0f of size width x height. -1.0f states for invalid parameter. */ +} ia_aiq_sa_results_v1; + +/*! +* \brief Results from Parameter Adaptor(Deprecated). +*/ +typedef struct { + float color_conversion_matrix[3][3]; /*!< 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_rgbir_t *rgbir; /*!< RGB IR. */ +} ia_aiq_pa_results; + +/*! +* \brief Results from Parameter Adaptor. +*/ +typedef struct { + float color_conversion_matrix[3][3]; /*!< CC matrix. */ + float black_level_4x4[4][4]; /*!< 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_rgbir_t *rgbir; /*!< RGB IR. */ + ia_aiq_advanced_ccm_SAP_t* preferred_acm_SAP; /*!< Advanced CC matrix per segment. */ +} ia_aiq_pa_results_v1; + +/*! + * \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; + + +/*! + * \brief Ambient Light Sensor (ALS) events. + */ +typedef struct +{ + unsigned long long ts; /*!< Time stamp in usec (microseconds) */ + unsigned long long fs; /*!< Frame stamp in usec (microseconds) */ + float lux; /*!< Illuminance (lux), -1 for N/A. */ + float cct; /*!< Correlated color temperature (Kelvin), -1 for N/A. */ + cmc_cie_coords cie_coor; /*!< CIE xy chromaticity, -1 for N/A. */ + float r; /*!< Red mean, -1 for N/A. */ + float g; /*!< Green mean, -1 for N/A. */ + float b; /*!< Blue mean, -1 for N/A. */ + float c; /*!< Clear (white) mean, -1 for N/A. */ + float ir; /*!< Infra-red mean, -1 for N/A. */ +} ia_aiq_ambient_light_events_v1; + +/*! + * \brief Device Movement Detector (DMD) motion level + * Coincides with the definition at ISH. + */ +typedef enum +{ + ia_aiq_dmd_motion_level_sleep = 0, /*!< The device did not move for the last 10 seconds */ + ia_aiq_dmd_motion_level_motionless, + ia_aiq_dmd_motion_level_slightly_drifting, + ia_aiq_dmd_motion_level_slowly_moving, + ia_aiq_dmd_motion_level_moving, + ia_aiq_dmd_motion_level_rapidly_moving, +} ia_aiq_dmd_sensor_motion_level; + +/*! + * \brief Device Movement Detector (DMD) Sensor Events + * This is a virtual sensor designed in ISH to detect if device is in motion. + */ +typedef struct +{ + unsigned long long ts; /*!< Time stamp in usec (microseconds) */ + ia_aiq_dmd_sensor_motion_level motion; + unsigned long long fs; /*!< Frame stamp in usec (microseconds) */ +} ia_aiq_dmd_sensor_events; + +/*! +* \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_v1* ambient_light_events; /*!< The data holds information on the ambient light */ + unsigned int num_ambient_light_events; /*!< Number of ambient light events */ + ia_aiq_dmd_sensor_events* dmd_events; /*!< Device Movement Detector (DMD) virtual sensor */ + unsigned int num_dmd_events; /*!< Number of DMD sensor events */ +} ia_aiq_sensor_events_v1; + +typedef struct +{ + float final_target_average; /*! Final target average calculated by AE. */ +} ia_aiq_ae_debug_info; + +/*! +* \brief Segmented grid structure. +* Contains the segmented grid used for visualization and debug purposes. +*/ +typedef struct +{ + int *grid_ptr; /*!< Segmented grid */ + unsigned int grid_height; /*!< Height of the grid */ + unsigned int grid_width; /*!< Height of the grid */ + unsigned int min; /*!< Minimum element in the grid */ + unsigned int max; /*!< Maximum element in the grid */ + unsigned int background_num; /*!< Number of background elements in the grid */ +} ia_aiq_segmented_grid; + +/** @brief NNTM parameters. + * This structure is used for NNTM (Neural Network Tone Mapping) configuration parameters. + */ + +typedef struct { + bool enable; /**< Is enabled flag */ + + float32_t* nn_coeff_out; /**< Coefficients obtained from neural network inference */ + + int32_t coefficient_width; /**< Width of coefficients structure */ + + int32_t coefficient_height; /**< Height of coefficients structure */ + + int32_t coefficient_depth; /**< Depth of coefficients structure */ + +} ia_nntm_parameters_t; + +#ifdef __cplusplus +} +#endif + +#endif /* IA_AIQ_TYPES_H_ */ + + diff --git a/include/ipu8/ia_imaging/ia_aiq_types_deprecated.h b/include/ipu8/ia_imaging/ia_aiq_types_deprecated.h new file mode 100644 index 0000000..cc1140f --- /dev/null +++ b/include/ipu8/ia_imaging/ia_aiq_types_deprecated.h @@ -0,0 +1,83 @@ +/* + * Copyright 2012-2021 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_deprecated.h + * \brief Definitions of input/output structures of the Intel 3A library. + */ + +#ifndef IA_AIQ_TYPES_DEPRECATED_H_ +#define IA_AIQ_TYPES_DEPRECATED_H_ + +#include "ia_aiq_types.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +* \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; + +/*! +* \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_dmd_sensor_events* dmd_events; /*!< Device Movement Detector (DMD) virtual sensor */ + unsigned int num_dmd_events; /*!< Number of DMD sensor events */ +} ia_aiq_sensor_events; + +/*! +* \brief Shading Adaptor results. +*/ +typedef struct { + unsigned short* lsc_grid[4][4]; /*!< Pointers to the LSC grid for all color channels. Invalid channels are set to NULL. */ + unsigned short width; /*!< Width of LSC grid. */ + unsigned short height; /*!< Height of LSC grid. */ + unsigned int fraction_bits; /*!< Number of fraction bits for the shading table fix point representation. */ + cmc_bayer_order color_order; /*!< Color channels order. */ + bool lsc_update; /*!< Indicates if LSC grid 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 confidence; /*!< Confidence in results. */ + ia_aiq_frame_params frame_params; /*!< Frame parameters that describe cropped area size and its position under LSC grid. */ +} ia_aiq_sa_results; + +#ifdef __cplusplus +} +#endif + +#endif /* IA_AIQ_TYPES_DEPRECATED_H_ */ + + diff --git a/include/ipu8/ia_imaging/ia_aiq_types_v1.h b/include/ipu8/ia_imaging/ia_aiq_types_v1.h new file mode 100644 index 0000000..60c4d60 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_aiq_types_v1.h @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2021 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_v1.h + * \brief Definitions of input/output structures of the Intel 3A library. + */ + +#ifndef IA_AIQ_TYPES_V1_H_ +#define IA_AIQ_TYPES_V1_H_ + +#include "ia_types.h" +#include "ia_aiq_types.h" +#include "ia_cmc_types.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// Placeholder for aiq_v1 types + +#ifdef __cplusplus +} +#endif + +#endif /* IA_AIQ_TYPES_V1_H_ */ diff --git a/include/ipu8/ia_imaging/ia_bcomp.h b/include/ipu8/ia_imaging/ia_bcomp.h new file mode 100644 index 0000000..966b75e --- /dev/null +++ b/include/ipu8/ia_imaging/ia_bcomp.h @@ -0,0 +1,101 @@ +/* + * Copyright 2018-2024 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 BCOMP API documentation + * + * Browse Files and Classes tabs for details. + * + */ +/*! + * \file ia_bcomp.h + * \brief Definitions and declarations of IA_BCOMP library. + */ +#ifndef IA_BCOMP_H_ +#define IA_BCOMP_H_ + +#include "ia_aiq_types.h" +#include "ia_types.h" +#include "ia_bcomp_types.h" +#include "ia_cmc_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \brief Initialize ia_bcomp handle. + * If yes the object is allocated and initialized. + * If not, null is returned + * \param [in] ia_cmc Mandatory, Pointer to CMC structure + * \param [in] dol_mode Mandatory, Operating mode for DOL sensor + * \param [in] cg_ratio Optional, conversion gain ratio for DCG sensor, if sensor is not DCG sensor, this should be set to 1. + * return IA_BCOMP handle. Use the returned handle as input parameter for the consequent IA_BCOMP calls. + * Returns NULL is ia_bcomp initialization fails. + */ +/*LDRA_INSPECTED 67 X*/ +LIBEXPORT ia_bcomp* +ia_bcomp_init(const ia_cmc_t *ia_cmc, ia_bcomp_dol_mode_t dol_mode, + float32_t cg_ratio); + +/*! + * \brief Deinitialize IA_BCOMP. + * All memory allocated by BCOMP algoritmhs are freed. BCOMP handle can no longer be used. + * + * \param[in] ia_bcomp Mandatory. BCOMP instance handle. + * + */ +LIBEXPORT void +ia_bcomp_deinit(ia_bcomp *ia_bcomp_ptr); + +/*! + * \brief Update IA_BCOMP once CMC structure ptr changed. + * + * \param[in] ia_bcomp Mandatory. BCOMP instance handle. + * \param[in] ia_cmc Mandatory. Pointer to CMC structure + * + */ +LIBEXPORT void +ia_bcomp_update_cmc(ia_bcomp* ia_bcomp_ptr, const ia_cmc_t* ia_cmc); + +/*! +* \brief IA_BCOMP parameters to calculate compression info. +*/ +typedef struct +{ + /*LDRA_INSPECTED 67 X*/ + ia_aiq_ae_results *ae_results; /*!< Mandatory. Exposure results which are to be used to calculate next ISP parameters. + Currently only exposure times, analog and digital gains are used. For convenience reasons bcomp takes + ae results and not only needed parameters. */ +} ia_bcomp_input_params; + +/*! +* \brief Run a bit-compression and generates necessary outputs. +* +* \param [in] ia_bcomp Mandatory, initialized ia_bcomp handle.\n +* \param [in] bcomp_input_params Mandatory. Input parameters to run bit-compression.\n +* \param[out] bcomp_results Mandatory. Pointer's pointer where address of bcomp results are stored. +* \return Error code. +* +*/ +LIBEXPORT ia_err +ia_bcomp_run(ia_bcomp *ia_bcomp_ptr, + const ia_bcomp_input_params *bcomp_input_params, + ia_bcomp_results **bcomp_results); + +#ifdef __cplusplus +} +#endif +#endif /* IA_BCOMP_H_ */ diff --git a/include/ipu8/ia_imaging/ia_bcomp_types.h b/include/ipu8/ia_imaging/ia_bcomp_types.h new file mode 100644 index 0000000..87280ad --- /dev/null +++ b/include/ipu8/ia_imaging/ia_bcomp_types.h @@ -0,0 +1,71 @@ +/* + * Copyright 2018-2023 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_bcomp_types.h +*/ + +#ifndef IA_BCOMP_TYPES_H_ +#define IA_BCOMP_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_AMOUNT_OF_KNEE_POINTS 16 + +typedef struct ia_bcomp_t ia_bcomp; + +/*! +* \brief compression curves. +*/ +typedef struct ia_pwl_compression_curve +{ + uint32_t x[MAX_AMOUNT_OF_KNEE_POINTS]; + uint32_t y[MAX_AMOUNT_OF_KNEE_POINTS]; + uint32_t num_of_knee_points; +} ia_pwl_compression_curve; + +/*! + * \brief Current operating modes supported for various DOL sensors. + */ +typedef enum +{ + ia_bcomp_non_dol = 0, /*!< Non-DOL sensor >*/ + ia_bcomp_dol_two_or_three_frame = 1, /*!< UC1 - DOL Sensor outputs two or three exposure readout mode, long, medium , short / long, short >*/ + ia_bcomp_dol_dcg = 2, /*!< UC2 - DOL DCG (Dual Conversion gain) sensor - outputs HCG (long) and LCG (medium) with a constant cg ratio >*/ + ia_bcomp_dol_combined_very_short = 3, /*!< UC3 - DOL DCG sensor - outputs combined image (long and medium exposure stitched in sensor) and very short exposure >*/ + ia_bcomp_dol_dcg_very_short = 4, /*!< UC4 - DOL DCG sensor - outputs HCG (long), LCG(medium) with constant cg ratio and very short exposure frames >*/ + ia_bcomp_linear_hdr_mode = 5, /*!< HDR type2 sensor: 16bit linear data for short/long exposure >*/ + ia_bcomp_pipe_compand = 6, /*!< IPU7 pipe compand curve >*/ + ia_bcomp_staggered_hdr_mode = 7 +} ia_bcomp_dol_mode_t; + +/*! + * \brief calculated compression curves. + */ +typedef struct ia_bcomp_results +{ + ia_pwl_compression_curve pwl_compression_curve; /*!< piecewise linear compression curve >*/ + ia_bcomp_dol_mode_t dol_mode; /*!< Operating Mode for DOL sensor >*/ + float cg_ratio; /*!< Conversion Gain Ratio for the sensor - constant value per sensor >*/ +} ia_bcomp_results; + + +#ifdef __cplusplus +} +#endif +#endif /* IA_BCOMP_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_camera_types.h b/include/ipu8/ia_imaging/ia_camera_types.h new file mode 100644 index 0000000..70b0c12 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_camera_types.h @@ -0,0 +1,127 @@ +/* + * Copyright 2023-2025 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_tnr7_types.h + * \brief Common TNR7 enumerations and structures. +*/ + + +#ifndef IA_CAMERA_TYPES_H_ +#define IA_CAMERA_TYPES_H_ + +#include +#include "ia_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define IA_CAMERA_PARAMETERS_CAMERA_CONFIG_ROTATION_MATRIX_SIZE (3) +#define IA_CAMERA_PARAMETERS_RADIAL_DISTORTION_LUT_SIZE_MAX (2048) +#define IA_CAMERA_INVALID_COORD_SIZE (3) + + +typedef struct +{ + float32_t x; // X value in pixels + float32_t y; // Y value in pixels + +} ia_camera_point_t; + +typedef struct +{ + ia_camera_point_t focal_length; // Focal Length (in pixels) + ia_camera_point_t principal_point; // Principal Point (in pixels) + float32_t rotation_matrix[IA_CAMERA_PARAMETERS_CAMERA_CONFIG_ROTATION_MATRIX_SIZE][IA_CAMERA_PARAMETERS_CAMERA_CONFIG_ROTATION_MATRIX_SIZE]; + +} ia_camera_config_t; + +typedef struct +{ + int32_t num_lut_elements; // Number of LDC(R) LUT elements + float32_t focal_length; // Camera module Focal Length. Range is from CMC_OpticsAndMechanics section in CPFF + float32_t max_fov_lut; // LUT Max incident angle (in degrees) + float32_t max_fov_lens; // Lens Max incident angle (in degrees) + float32_t ldc_r_lut[IA_CAMERA_PARAMETERS_RADIAL_DISTORTION_LUT_SIZE_MAX]; // LDC(R) LUT table in pixels + +} ia_camera_radial_distortion_t; + +typedef struct +{ + int32_t enable; + + ia_camera_config_t camera_params_sensor; + ia_camera_config_t camera_params_view; + + ia_camera_radial_distortion_t camera_radial_distortion; + + int32_t invalid_coordinate_mask[IA_CAMERA_INVALID_COORD_SIZE]; /*!< Used to fill for each color channel when coordinates falls out of bounds */ + +} ia_camera_parameters_t; + +//GDC Rectification parameters: + +typedef struct +{ + ia_camera_point_t focal_length; // Focal Length (in pixels) + ia_camera_point_t principal_point; // Principal Point (in pixels) + float32_t rotation_matrix[IA_CAMERA_PARAMETERS_CAMERA_CONFIG_ROTATION_MATRIX_SIZE][IA_CAMERA_PARAMETERS_CAMERA_CONFIG_ROTATION_MATRIX_SIZE]; + + //Radial distrotion: + float32_t radial_distortion_lut_range_degs; //"The angular range [degrees] covered by the LUT, relative to the optical center. The angles for which the LUT provides values : theta = linspace(0, lut_range_degs, 2048)" + + float32_t radial_distortion_lut_focal_length; //"The reference focal length used by the LUT [pixels]. The LUT values : Rd = distorted range from the optical center[pixels; refereing to lut_focal_length]" + +} ia_rectify_sensor_t; + +typedef struct { + int32_t enable; + + int32_t invalid_coordinate_mask[IA_CAMERA_INVALID_COORD_SIZE]; /*!< Used to fill for each color channel when coordinates falls out of bounds */ + + int32_t force_fov_symmetry; //A flag; if set, the output image will be centered around the optical center. + +} ia_rectify_control_t; + +typedef struct { + ia_camera_point_t principal_point; // [px, py] [pixels] (= intrinsic_matrix([1, 2], 3)); 0 - based coordinates : [0, 0] = center of the top - left pixel + + ia_camera_point_t focal_length; //[fx, fy] [pixels] (= [intrinsic_matrix(1, 1), intrinsic_matrix(2, 2)]) + + int32_t image_width; //width of the available field-of-view for the rectified images + + int32_t image_height; //height of the available field-of-view for the rectified images + +} ia_rectify_calib_t; + +typedef struct { + float32_t rlut[IA_CAMERA_PARAMETERS_RADIAL_DISTORTION_LUT_SIZE_MAX]; //the rgb_rlut calibration table + + ia_rectify_sensor_t calib_sensor; //the "input" part in the RGB calibration table + + ia_rectify_calib_t calib_rectified; //the "rectified" part in the RGB calibration table + + ia_rectify_control_t control; //parameters configured by the control SW + +} ia_rectify_parameters_t; + +#ifdef __cplusplus +} +#endif + +#endif // IA_CAMERA_TYPES_H_ diff --git a/include/ipu8/ia_imaging/ia_ccat_types.h b/include/ipu8/ia_imaging/ia_ccat_types.h new file mode 100644 index 0000000..8fb6fcb --- /dev/null +++ b/include/ipu8/ia_imaging/ia_ccat_types.h @@ -0,0 +1,319 @@ +/* + * INTEL CONFIDENTIAL + * + * Copyright (C) 2012-2025 Intel Corporation + * + * This software and the related documents are Intel copyrighted materials, + * and your use of them is governed by the express license under which they + * were provided to you ("License"). Unless the License provides otherwise, + * you may not use, modify, copy, publish, distribute, disclose or transmit + * this software or the related documents without Intel's prior written permission. + * This software and the related documents are provided as is, with no express + * or implied warranties, other than those that are expressly + * stated in the License. + */ + +/*! + * \file ia_ccat.h + * \brief Definitions of common analysis types used by Intel 3A modules. +*/ + +#ifndef IA_CCAT_TYPES_H_ +#define IA_CCAT_TYPES_H_ + +#include "ia_configuration.h" +#include "ia_statistics_types.h" +#include "ia_aiq_types.h" +#include "ia_aec_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum +{ + ia_ccat_frame_type_nonflash, +#ifdef IA_AEC_FEATURE_FLASH + ia_ccat_frame_type_flash, +#endif + ia_ccat_frame_type_count +} ia_ccat_frame_type; + +typedef enum +{ + ia_ccat_histogram_type_cc_start = 0, + ia_ccat_histogram_type_cc_rgb_averaged = ia_ccat_histogram_type_cc_start, /*!< Color corrected and weighted R, G and B histograms averaged into one histogram. */ + ia_ccat_histogram_type_cc_rgb_combined, /*!< Color corrected and weighted R, G and B histograms summed into one histogram. */ + ia_ccat_histogram_type_cc_y, /*!< Color corrected and weighted R, G and B histograms converted to Y (luminance) histogram. */ + ia_ccat_histogram_type_cc_end, + ia_ccat_histogram_type_raw_start = ia_ccat_histogram_type_cc_end, +#ifdef IA_CCAT_RGBS_GRID_ENABLED + ia_ccat_histogram_type_raw_rgb_averaged = ia_ccat_histogram_type_cc_end, /*!< Raw (calculated from RGBS grid before color correction) R, G and B histograms averaged into one histogram. */ + ia_ccat_histogram_type_raw_rgb_combined, /*!< Raw (calculated from RGBS grid before color correction) R, G and B histograms summed into one histogram. */ + ia_ccat_histogram_type_raw_y, /*!< Raw (calculated from RGBS grid before color correction) R, G and B histograms converted to Y (luminance) histogram. */ + ia_ccat_histogram_type_uncorrected_raw_y, /*!< Raw (calculated from RGBS grid before LSC and color correction) R, G and B histograms converted to Y (luminance) histogram. */ + ia_ccat_histogram_type_raw_end, +#else + ia_ccat_histogram_type_raw_end = ia_ccat_histogram_type_raw_start, + ia_ccat_histogram_type_raw_rgb_averaged = ia_ccat_histogram_type_raw_end, + ia_ccat_histogram_type_raw_rgb_combined = ia_ccat_histogram_type_raw_end, + ia_ccat_histogram_type_raw_y = ia_ccat_histogram_type_raw_end, + ia_ccat_histogram_type_uncorrected_raw_y = ia_ccat_histogram_type_raw_end, +#endif + ia_ccat_histogram_type_count = ia_ccat_histogram_type_raw_end, + ia_ccat_histogram_type_invalid = ia_ccat_histogram_type_count, +} ia_ccat_histogram_type; + +typedef struct +{ + ia_histogram r; + ia_histogram g; + ia_histogram b; +} ia_ccat_histograms; + +#ifdef IA_CCAT_RGBS_GRID_ENABLED +#ifdef IA_CCAT_HSV_GRID_ENABLED +typedef struct +{ + float h; + float s; + float v; +} ia_ccat_hsv_channels; + +/*! +* \brief HSV grid structure. +*/ +typedef struct +{ + unsigned int grid_width; /*! Width of the grid. */ + unsigned int grid_height; /*! Height of the grid. */ + ia_ccat_hsv_channels data[IA_RGBS_GRID_SIZE]; /*! Grid data. */ +} ia_ccat_hsv_grid; +#endif +#endif + +#if defined IA_CCAT_RGBS_GRID_ENABLED || defined IA_CCAT_LUMINANCE_GRID_ENABLED || defined IA_CCAT_IR_GRID_ENABLED +/*! + * \brief Generic 8 bit grid structure. + */ +typedef struct ia_ccat_grid_char +{ + unsigned int grid_width; /*! Width of the grid. */ + unsigned int grid_height; /*! Height of the grid. */ + unsigned char data[IA_RGBS_GRID_SIZE]; /*! Grid data. */ +} ia_ccat_grid_char; + +/*! +* \brief Generic 16 bit grid structure. +*/ +typedef struct +{ + unsigned int grid_width; /*! Width of the grid. */ + unsigned int grid_height; /*! Height of the grid. */ + unsigned short data[IA_RGBS_GRID_SIZE]; /*! Grid data. */ +} ia_ccat_grid_short; + +/*! + * \brief Generic grid structure with floating point values. + */ +typedef struct +{ + unsigned int grid_width; /*! Width of the grid. */ + unsigned int grid_height; /*! Height of the grid. */ + float data[IA_RGBS_GRID_SIZE]; /*! Grid data in floating point format. */ +} ia_ccat_grid_float; + +typedef struct +{ + ia_ccat_grid_char grid_data; + float i_per_y; + float out_ir_compgain_isp; +} ia_ccat_ir_grid; + +#endif + +typedef struct +{ + bool frame_parameters_available; /*!< Mandatory. Flag indicating that frame parameters can be used by CCAT. Set to false to invalidate frame parameters. */ + bool shading_corrected; /*!< Mandatory. Flag indicating if statistics were calculated using lens shading corrected data. */ + bool stitched_stats; /*!< RGBS stats for multi-exposures in stitched stats. */ + ia_ccat_frame_type frame_type; /*!< Mandatory. Indicates if statistics were captured from non-flash or flash illuminated frame. */ + uint64_t frame_id; /*!< Mandatory. ID for the captured frame. */ + uint64_t frame_timestamp; /*!< Mandatory. Time stamp for captured frame. */ + ia_rectangle statistics_crop_area; /*!< Mandatory. RGBS and AF grid area crop with respect to full field of view of sensor output using (relative)ranges from ia_coordinate.h. */ + float32_t stitched_stats_norm_factor; /*!< Mandatory. For companded pipe usually statistivs represent more than 16bits then factor > 1 depends on highest bit represent by stat. */ + uint32_t rgbs_stats_bit_depth; /*!< Mandatory. indicate the bit depth of rgbs stats */ + int32_t cropped_image_height; /*!< Mandatory. Cropped RGBS raw height */ +#ifdef IA_CCAT_EXTERNAL_RGB_HISTOGRAMS_ENABLED + ia_ccat_histograms rgb_histograms[IA_CCAT_STATISTICS_MAX_NUM]; /*!< Optional. RGB histograms pointer for each exposure statistics. */ +#endif +#ifdef IA_CCAT_EXTERNAL_LUMINANCE_HISTOGRAM_ENABLED + ia_histogram y_histogram[IA_CCAT_STATISTICS_MAX_NUM]; /*!< Optional. Luminance histogram. */ +#endif +#ifdef IA_CCAT_RGBS_GRID_ENABLED + ia_rgbs_grid rgbs_grids[IA_CCAT_STATISTICS_MAX_NUM]; /*!< Optional. RGBS grids for each exposure statistics. */ +#endif +#ifdef IA_CCAT_CONVOLUTION_FILTER_GRID_ENABLED + ia_filter_response_grid af_grids[IA_CCAT_STATISTICS_MAX_NUM]; /*!< Optional. AF grids for each exposure statistics. */ +#endif +#ifdef IA_CCAT_EXTERNAL_LUMINANCE_GRID_ENABLED + ia_ccat_grid_char y_grid[IA_CCAT_STATISTICS_MAX_NUM]; /*!< Optional. Luminance (LSC and color corrected) grids for each exposure statistics. */ +#endif +#ifdef IA_CCAT_IR_GRID_ENABLED + ia_ccat_ir_grid ir_grid; /*!< Optional. Ir grid (Non LSC corrected grid). */ +#endif +#ifdef IA_CCAT_DEPTH_GRID_ENABLED + ia_depth_grid depth_grid; /*!< Optional. Depth grid. */ +#endif + ia_acs_stats acs_stats; /*!< Optional. Statistics from the ACS sensor (if available) .*/ +} ia_ccat_frame_statistics; + +typedef struct +{ + ia_aec_results aec_results; /*!< Mandatory. Exposure parameters used to capture the frame. */ + ia_aiq_pa_results_v1 pa_results; /*!< Optional. */ + ia_aiq_sa_results_v1 sa_results; /*!< Optional. */ + ia_aiq_awb_results awb_results; /*!< Optional. */ + ia_aiq_af_results af_results; /*!< Optional. */ + bool bAssitLightOn; /*!< True if the af assist light is on, false otherwise .*/ +#ifdef IA_CCAT_FACE_ANALYSIS_ENABLED + ia_face_roi faces[IA_CCAT_FACES_MAX_NUM]; /*!< Optional. Face coordinates from external face detector. NULL if not available. */ + bool updated; /*!< The update status of face. true is the real statistics, and false is the false statistics that have not been updated.*/ + bool is_video_conf; /*!< video confenerce mode. */ + FD_IMPL_TYPE fd_algo; /*!< face detection algo type. */ +#endif +} ia_ccat_frame_parameters; + +/*! + * \brief Structure for various motion sensors + * Accelerometer Events: + * - The data holds information on the acceleration of the device in mg/sec (miligravity per second). Acceleration = Gravity + Linear Acceleration. + * Gravity Events: + * - The data holds information on the gravitation of the device in mg/sec (miligravity per second). + * Gyroscope Events: + * - The data holds information on the angular velocity of the device in rad/sec. + */ +typedef struct +{ + uint64_t 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 */ + uint64_t fs; /*!< Frame stamp in usec (microseconds) */ +} ia_ccat_motion_sensor_event; + +/*! + * \brief Ambient Light Events + * NOTE: This should always match to libsensorhub API + * TODO: Update the structure according to the API + */ +typedef struct +{ + uint64_t ts; /*!< Time stamp in usec (microseconds) */ + float data; /*!< Ambient Light data ? */ + float sensitivity; /*!< Sensitivity of Ambient Light sensor */ + uint64_t fs; /*!< Frame stamp in usec (microseconds) */ +} ia_ccat_ambient_light_event; + +typedef struct ia_ccat_lse_size_t +{ + uint16_t width; + uint16_t height; +} ia_ccat_lse_size_t; + +typedef struct ia_ccat_color_order_bayer_t +{ + uint8_t r; + uint8_t gr; + uint8_t gb; + uint8_t b; +} ia_ccat_color_order_bayer_t; + +/*! +* \brief enum for accurate or preferred CCM interpolation +*/ +typedef enum +{ + ia_ccat_ccm_type_accurate = 0, /*!< Label for accurate CCM interpolation. */ + ia_ccat_ccm_type_preferred = 1, /*!< Label for preferred CCM interpolation. */ +} ia_ccat_ccm_type_t; + +/*! +* \brief enum for accurate or preferred CCM interpolation +*/ +typedef enum +{ + ia_ccat_point_type_rg_bg = 0, /*!< Label for using RperG, BperG point for CCM interpolation. */ + ia_ccat_point_type_cie_xy = 1, /*!< Label for using CieXY point for CCM interpolation. */ +} ia_ccat_point_type_t; + +typedef enum +{ + ccat_project_adaption_bitmap_0 = 1 << 0, /*!< is special bw chart detection on */ + ccat_project_adaption_bitmap_1 = 1 << 1, /*!< is wb face_base bitmap on - if on not give priority to face in LSC */ + ccat_project_adaption_bitmap_2 = 1 << 2, /*!< is for sthdr ae skip */ + ccat_project_adaption_bitmap_3 = 1 << 3, /*!< is for vcx */ + ccat_project_adaption_bitmap_4 = 1 << 4, /*!< is for AF document mode in IPU6 */ + ccat_project_adaption_bitmap_5 = 1 << 5, /*!< is for MSFT OV02C10 NVM issue */ + ccat_project_adaption_bitmap_6 = 1 << 6, /*!< is for wfov skin tone alignment */ + ccat_project_adaption_bitmap_7 = 1 << 7, /*!< is CAF fine-search bitmap on - if on use CAF to perform fine search after PDAF */ + ccat_project_adaption_bitmap_8 = 1 << 8, /*!< TBD */ + ccat_project_adaption_bitmap_9 = 1 << 9, /*!< TBD */ + ccat_project_adaption_bitmap_10 = 1 << 10, /*!< TBD */ + ccat_project_adaption_bitmap_11 = 1 << 11, /*!< TBD */ + ccat_project_adaption_bitmap_12 = 1 << 12, /*!< TBD */ + ccat_project_adaption_bitmap_13 = 1 << 13, /*!< TBD */ + ccat_project_adaption_bitmap_14 = 1 << 14, /*!< TBD */ + ccat_project_adaption_bitmap_15 = 1 << 15 /*!< TBD */ +} ccat_project_adaption_bitmap_reg_t; + +#ifdef IA_CCAT_LIGHT_SOURCE_ESTIMATION_ENABLED +typedef struct { + light_source_t light_source[CMC_NUM_LIGHTSOURCES]; /* Weights per each light source type */ + unsigned short likelihood[CMC_NUM_LIGHTSOURCES]; /* Likelihood based on CCT for different light source */ + float confidence; /* Confidence of LSE result */ +} ia_ccat_lse_results_t; +#endif + +/*! +* \brief Map data from SAP +*/ +typedef struct +{ + uint32_t grid_width; + uint32_t grid_height; + uint32_t stride; + ia_binary_data* segmap_data; + ia_rectangle segmap_crop_area; + + uint32_t rgbs_grid_width; + uint32_t rgbs_grid_height; + ia_rectangle rgbs_crop_area; + + uint64_t frame_id; +}ia_aiq_segmap_input_params; + +#if 0 +/*! + * \brief Face rectangle + * Range of rectangle values is defined in ia_coordinate.h: + * IA_COORDINATE_TOP, IA_COORDINATE_LEFT, IA_COORDINATE_BOTTOM, IA_COORDINATE_RIGHT + */ +typedef struct +{ + int tracking_id; /*!< Tracking id of the face. */ + ia_rectangle face_area; /*!< Bounding box of the face in the coordination system where (0,0) indicates left-top position. */ + ia_coordinate mouth; /*!< Mid-point of the mouth. */ + ia_coordinate left_eye; /*!< Left eye */ + ia_coordinate right_eye; /*!< Right eye */ + bool eye_validity; /*!< Indicates whether a face was processed to get eye positions */ + float skin_type_dark_likelihood; /*!< Likelihood of skin type being dark [0.0, 1.0]. Bright skin likelihood = 1.0 - dark_skin_type_likelihood */ + bool skin_type_validity; /*!< Indicates whether a face was processed to get skin likelihood */ +} ia_face_roi; +#endif +#ifdef __cplusplus +} +#endif + +#endif /* IA_CCAT_H_ */ diff --git a/include/ipu8/ia_imaging/ia_cmc_parser.h b/include/ipu8/ia_imaging/ia_cmc_parser.h new file mode 100644 index 0000000..111e67d --- /dev/null +++ b/include/ipu8/ia_imaging/ia_cmc_parser.h @@ -0,0 +1,52 @@ +/* + * Copyright 2012-2021 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" +#include "ia_nvm.h" +#include "ia_cmc_parser_deprecated.h" + +#ifdef __cplusplus +extern "C" { +#endif + +LIBEXPORT ia_cmc_t* +ia_cmc_parser_init_v1( + const ia_binary_data *a_aiqb_binary, + const ia_binary_data *a_nvm_binary); + +LIBEXPORT void +ia_cmc_parser_deinit(ia_cmc_t *ia_cmc); + +LIBEXPORT void +ia_aiqb_others_parser_init( + const ia_binary_data *a_aiqb_binary, + ia_cmc_t *cmc); + +#ifdef __cplusplus +} +#endif + +#endif /* IA_CMC_PARSER_H_ */ diff --git a/include/ipu8/ia_imaging/ia_cmc_parser_deprecated.h b/include/ipu8/ia_imaging/ia_cmc_parser_deprecated.h new file mode 100644 index 0000000..db37648 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_cmc_parser_deprecated.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/*! + * \file ia_cmc_parser.h + * \brief Parser for CMC data. +*/ + + +#ifndef IA_CMC_PARSER_DEPRECATED_H_ +#define IA_CMC_PARSER_DEPRECATED_H_ + +#include "ia_types.h" +#include "ia_cmc_types.h" +#include "ia_nvm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +LIBEXPORT ia_cmc_t* +ia_cmc_parser_init( + const ia_binary_data *a_aiqb_binary); + +#ifdef __cplusplus +} +#endif + +#endif /* IA_CMC_PARSER_DEPRECATED_H_ */ diff --git a/include/ipu8/ia_imaging/ia_cmc_types.h b/include/ipu8/ia_imaging/ia_cmc_types.h new file mode 100644 index 0000000..c3bd5c2 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_cmc_types.h @@ -0,0 +1,1635 @@ +/* + * Copyright 2021-2025 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" +#include "ia_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 +#define VERSION_LEN 16 + +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 consecutive elements sum to 1. */ +} cmc_color_matrix; + +/*! + * \brief Raw image bayer order. + */ +typedef enum +{ + cmc_bayer_order_2x2, /*!< Start of enumerations for 2x2 bayer types. */ + cmc_bayer_order_grbg = cmc_bayer_order_2x2, /*!< First row contains pixels Gr, R. Second row contains pixels B, Gb. */ + cmc_bayer_order_rggb, /*!< First row contains pixels R, Gr. Second row contains pixels Gb, B. */ + cmc_bayer_order_bggr, /*!< First row contains pixels B, Gb. Second row contains pixels Gr, R. */ + cmc_bayer_order_gbrg, /*!< First row contains pixels Gb, B. Second row contains pixels R, Gr. */ + cmc_bayer_order_grbi, /*!< First row contains pixels Gr, R. Second row contains pixels B, IR. */ + cmc_bayer_order_irbg, /*!< First row contains pixels IR, R. Second row contains pixels B, Gb. */ + cmc_bayer_order_rgib, /*!< First row contains pixels R, Gr. Second row contains pixels IR, B. */ + cmc_bayer_order_rigb, /*!< First row contains pixels R, IR. Second row contains pixels Gb, B. */ + cmc_bayer_order_bgir, /*!< First row contains pixels B, Gb. Second row contains pixels IR, R. */ + cmc_bayer_order_bigr, /*!< First row contains pixels B, IR. Second row contains pixels Gr, R. */ + cmc_bayer_order_gbri, /*!< First row contains pixels Gb, B. Second row contains pixels R, IR. */ + cmc_bayer_order_ibrg, /*!< First row contains pixels IR, B. Second row contains pixels R, Gr. */ + cmc_bayer_order_4x2 = 128, /*!< Start of enumerations for 4x2 bayer types. */ + cmc_bayer_order_2pd_grbg = cmc_bayer_order_4x2, /*!< Two photodiodes per pixel in Gr, R, B, Gb order (4x2). */ + cmc_bayer_order_2pd_rggb, /*!< Two photodiodes per pixel in R, Gr, Gb, B order (4x2). */ + cmc_bayer_order_2pd_bggr, /*!< Two photodiodes per pixel in B, Gb, Gr, R order (4x2). */ + cmc_bayer_order_2pd_gbrg, /*!< Two photodiodes per pixel in Gb, B, R, Gr order (4x2). */ + cmc_bayer_order_4x4 = 256, /*!< Start of enumerations for 4x4 bayer types. */ + cmc_bayer_order_bgrg_gigi_rgbg_gigi = cmc_bayer_order_4x4, /*!< Order: 1st row: B G R G, 2nd row: G I G I, 3rd row: R G B G, 4th row: G I G I (4x4). */ + cmc_bayer_order_grgb_igig_gbgr_igig, /*!< Order: 1st row: G R G B, 2nd row: I G I G, 3rd row: G B G R, 4th row: I G I G (4x4). */ + cmc_bayer_order_rgbg_gigi_bgrg_gigi, /*!< Order: 1st row: R G B G, 2nd row: G I G I, 3rd row: B G R G, 4th row: G I G I (4x4). */ + cmc_bayer_order_gbgr_igig_grgb_igig, /*!< Order: 1st row: G B G R, 2nd row: I G I G, 3rd row: G R G B, 4th row: I G I G (4x4). */ + cmc_bayer_order_gigi_rgbg_gigi_bgrg, /*!< Order: 1st row: G I G I, 2nd row: R G B G, 3rd row: G I G I, 4th row: B G R G (4x4). */ + cmc_bayer_order_igig_gbgr_igig_grgb, /*!< Order: 1st row: I G I G, 2nd row: G B G R, 3rd row: I G I G, 4th row: G R G B (4x4). */ + cmc_bayer_order_gigi_bgrg_gigi_rgbg, /*!< Order: 1st row: G I G I, 2nd row: B G R G, 3rd row: G I G I, 4th row: R G B G (4x4). */ + cmc_bayer_order_igig_grgb_igig_gbgr /*!< Order: 1st row: I G I G, 2nd row: G R G B, 3rd row: I G I G, 4th row: G B G R (4x4). */ +} cmc_bayer_order; + +/*! + * \brief Color space definitions. + */ +typedef enum +{ + cmc_color_space_srgb, + cmc_color_space_bt601, + cmc_color_space_bt709, + cmc_color_space_bt2020, + cmc_color_space_bt2100_rgb, + cmc_color_space_bt2100_lms, + cmc_color_space_dci_p3, + cmc_color_space_adobergb, +} cmc_color_space; + +/*! + * \brief LSC NVM interpolation/upscaling method. + */ +typedef enum +{ + cmc_nvm_interpolation_polynomial, + cmc_nvm_interpolation_bi_cubic, + cmc_nvm_interpolation_polynomial_crop_two_pixels, + cmc_nvm_interpolation_polynomial_with_valid_area +} cmc_nvm_interpolation; + + +/*! + * \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 DEPRECATED */ + 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_phase_difference, /*!< 30 */ + cmc_name_id_black_level_global, /*!< 31 */ + cmc_name_id_valid_image_area, /*!< 32 */ + cmc_name_id_lens_shading_correction_4x4_ratio, /*!< 33 */ + cmc_name_id_multi_gain_conversions, /*!< 34 */ + cmc_name_id_pipe_comp_decomp, /*!< 35 */ + cmc_name_id_sensor_decomp, /*!< 36 */ + cmc_name_id_media_format, //preview/video /*!< 37 */ + cmc_name_id_cbd, /*!< 38 */ + cmc_name_id_media_format_stills, /*!< 39 */ + cmc_name_id_seg_net /*!< 40 */ +} 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 = 1U, /*!< Physical Lens Position sensor */ + cmc_camera_feature_voice_coil_actuator = (1U << 1U), /*!< 'Voice Coil' type of lens actuator */ + cmc_camera_feature_hybrid_voice_coil_actuator = (1U << 2U), /*!< 'Hybrid Voice Coil' type of lens actuator */ + cmc_camera_feature_piezo_actuator = (1U << 3U), /*!< 'Piezo' type of lens actuator */ + cmc_camera_feature_mems_actuator = (1U << 4U), /*!< 'MEMS' type of lens actuator */ + cmc_camera_feature_nd_filter = (1U << 5U), /*!< Neutral Density filter */ + cmc_camera_feature_mechanical_shutter = (1U << 6U), /*!< Mechanical Shutter */ + cmc_camera_feature_variable_apertures = (1U << 7U), /*!< Variable Apertures */ + cmc_camera_feature_optical_zoom = (1U << 8U) /*!< 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_hz, /*!< Horizon IR */ + cmc_light_source_a_md, /*!< A - Incandescent / Tungsten Medium light */ + cmc_light_source_a_lw, /*!< A - Incandescent / Tungsten Low light */ +} cmc_light_source; +#define CMC_NUM_LIGHTSOURCES 24u + +/*! + * \brief PD sensor type enumeration. + */ +typedef enum { + cmc_pd_sensor_type_non_pd = 0, /*!< Non-PD sensor */ + cmc_pd_sensor_type_1, /*!< Type 1 (All processing done on sensor) */ + cmc_pd_sensor_type_2, /*!< Type 2 (PD extraction on sensor, statistics processing in IPU) */ + cmc_pd_sensor_type_3 /*!< Type 3 (All processing done in IPU) */ +} cmc_pd_sensor_type; + +/*! + * \brief PD technology type enumeration. + */ +typedef enum { + cmc_pd_technology_type_metal_shield = 0, /*!< Metal shield-based PD */ + cmc_pd_technology_type_dual_photodiode, /*!< Dual photodiode-based PD */ + cmc_pd_technology_type_wide_microlens /*!< Wide microlens-based PD */ +} cmc_pd_technology_type; + +/*! + * \brief CMC gdc mode type enumeration. + */ +typedef enum { + cmc_gdc_mode_grid, /*!< CMC GDC Grid mode */ + cmc_gdc_mode_lut, /*!< CMC GDC Look-up Table mode */ + cmc_gdc_mode_extlut /*!< CMC GDC Look-up Table from External Tool mode */ +} cmc_gdc_mode_type; + + +/*! +* \brief CMC segmentation network type enumeration. +*/ +typedef enum { + seg_net_type_no_segmentation, /*!< No segmentation */ + seg_net_type_test_pattern, /*!< Use test pattern segmentation */ + seg_net_type_RVM /*!< Use ONNX RVM network segmentation */ +} seg_net_type; + +/*! + * \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[VERSION_LEN]; /*!< 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 24UL + +/*! + * \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). For HDR sensor, this is the bit depth after stitching. */ + 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. */ + uint16_t single_exposure_bit_depth; /*!< Sensor native maximum bit depth for single (non-stitched) exposure. */ +} 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 +#define SIZEOF_CMC_GENERAL_DATA_V103_T 36 + +/*! + * \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 16U + +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 12U + +/*! +* \brief CMC for global black Level +* - Global black level compensation for 4x4 sensors. +*/ +typedef struct +{ + uint32_t exposure_time; /*!< Exposure time in microseconds. */ + float total_gain; /*!< Total gain (including both analog and digital gains). */ + float black_level[4][4]; /*!< Black level correction for given exposure time and total gain. */ +} cmc_black_level_values; + +typedef struct +{ + ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_black_level_global (See cmc_name_id). */ + uint32_t num_bl_luts; /*!< Number of black level lookup tables (number of analog gain * number of exposures). */ + uint32_t padding; /* Ensures that next 64 bit variable starts from 64 bit boundary. */ + union { + cmc_black_level_values *ptr; /*!< Array of global black level values as function of exposure time and gain. Array length is defined by num_bl_luts. */ + uint64_t dummy; /* Ensures that pointer is accessible in both 32 and 64 bit systems. */ + } bl_values; +} cmc_black_level_global; + +/*! + * \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 16U + +/*! + * \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 + */ +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_coefficients[5]; /*!< Noise model coefficients (c1..5) in equation y = c1*x^2 + Gain*c2*x + Gain^2*c3 + Gain*c4 + c5. + Gain is sum of gain applied to pixel (DG and AG), x is the normalized mean (pixel value), and y is the variance. */ + int reserved; /*!< Reserved for alignment. Always 0. */ +} cmc_noise; + +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 8U + +/*! + * \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 16U + +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 10U + +/*! + * \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 14U + +/*! + * \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 72U + +/*! + * \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 14U + +/*! + * \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 8U + +/*! + * \brief ACS Lightsource definition. + */ +typedef struct +{ + cie_coords_t cie_coords; /*!< Light source CIE xy coordinates As measured by external light meter. */ + chromaticity_t chromaticity_response; /*!< Avg Chromaticity response for R/G anf B/G.*/ + cie_coords_t acs_cie_coords; /*!< Light source CIE xy coordinates As measured by ACS sensor. */ + uint32_t acs_cct; /*!< CCT as measured by ACS sensor. */ +} cmc_lightsource_acs_extension_t; +#define SIZEOF_CMC_LIGHTSOURCE_ACS_EXTENSION_T 16U + +/*! + * \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 12U + +/*! + * \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 4U + +/*! + * \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 14U + +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 consecutive elements sum to 1. */ + int32_t matrix_preferred[9]; /*!< 3x3 preferred CCM, each 3 consecutive elements sum to 1. */ +} cmc_color_matrix_t; +#define SIZEOF_CMC_COLOR_MATRIX_T 84U + +/*! + * \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 10U +/*! + * \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 2U + +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 8U + +/*! + * \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 28U + +/*! + * \brief CMC Analog gain conversion types + * Enum defines 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 16U + +/*! + * \brief CMC Digital gain conversion types + * Enum defines 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 6U + +/*! + * \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 16U /*!< 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 +{ + uint8_t *key; /*!< Free C string text key (NULL terminated) */ + uint8_t *version; /*!< Free C string text version (NULL terminated) */ +} cmc_version_info_t; + +typedef struct +{ + cmc_comment_t *cmc_comment; + uint8_t *comment; + uint16_t num_version_infos; + cmc_version_info_t *version_infos; +} 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 12U + +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 2U + +/*! + * \brief extenstion to cmc_chromaticity_response_t to also include ACS data + */ +typedef struct +{ + uint8_t enable_acs; /*!< Is ACS data valid. */ + cmc_lightsource_acs_extension_t* cmc_lightsources_acs_avg; /*!< Average light sources with ACS data. */ +} cmc_chromaticity_response_v102_t; +#define SIZEOF_CMC_CHROMATICITY_RESPONSE_V102 1U + +/*! + * \brief Parametric model coefficients for the average chromaticity locus and CCT curve + */ +typedef struct +{ + float locus_model[4]; + float cct_model[3]; +} cmc_locus_t; + +typedef struct +{ + cmc_chromaticity_response_t *cmc_chromaticity_response; + cmc_chromaticity_response_v101_t* cmc_chromaticity_response_v101; + cmc_chromaticity_response_v102_t* cmc_chromaticity_response_with_acs; + cmc_locus_t *cmc_locus; + 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_cct, /*!< Return CCM matrix using cct */ +} 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; + +/*! + * \brief Gain to gain code mapping. + * Gains must be defined in ascending order. +*/ +typedef struct +{ + float gain; /*!< Gain in floating point format. */ + uint32_t code; /*!< Code corresponding to gain. */ +} cmc_gain_code_pair_t; + +/*! + * \brief Gain to gain code mapping of a segment. + * Segments contain SMIA gain parameters. When ranges is defined, beginning is always inclusive and end exclusive. + * For example gain 2.0 and ranges: [1.0, 2.0[; [2.0, 4.0[;. Gain 2.0 is not calculated from the first range parameters but from the second range. + */ +typedef struct +{ + float gain_begin; /*!< Begin of gain of the segment (inclusive) in floating point format. */ + float gain_end; /*!< End of gain of the segment (exclusive) in floating point format. */ + uint32_t code_min; /*!< The minimum recommended setting for the gain control. */ + uint32_t code_max; /*!< The maximum recommended setting for the gain control. */ + uint32_t code_step; /*!< The precision of the 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. */ + uint32_t padding; /*!< Padding to 64-bit boundary. */ +} cmc_gain_segment_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 enum +{ + cmc_gain_type_invalid = -1, /*!< Invalid gain. */ + cmc_gain_type_analog_gain = 0, /*!< Analog gain. */ + cmc_gain_type_digital_gain, /*!< Digital gain. */ + cmc_gain_type_conversion_gain, /*!< Conversion gain for HDR sensors. */ + cmc_gain_type_isp_gain, /*!< Gain applied in ISP. */ +} cmc_gain_type_t; + +#ifndef IA_CMC_GAINS_MAX_NUM +/* TODO: Use definition from ia_configuration.h */ +/* Windows driver and imaging system simulators don't include ia_configuration.h correctly. */ +#define IA_CMC_GAINS_MAX_NUM 4 +#endif + +typedef enum +{ + cmc_gain_conversion_type_none, /*!< No gain conversion should be done. */ + cmc_gain_conversion_type_segment, /*!< Segments contain SMIA compatible parameters for calculating register value for a certain range of gain. */ + cmc_gain_conversion_type_pair, /*!< Pairs contain gain value & corresponding register value. */ + cmc_gain_conversion_type_fixed_point, /*!< Gain is defined in fixed point format. */ +} cmc_gain_conversion_type_t; + +typedef struct +{ + uint16_t gain_min; /*!< The minimum valid limit of the gain control parameters in fixed point format (16bit integer part + 16bit fraction part). */ + uint16_t gain_max; /*!< The maximum valid limit of the gain control parameters in fixed point format (16bit integer part + 16bit fraction part). */ + uint16_t gain_step_size; /*!< Step size of gain code register value. */ + uint16_t fraction_bits; /*!< Number of bits used for the fraction part of the 16 bit register value. */ +} cmc_gain_fixed_t; + +typedef struct +{ + cmc_gain_type_t gain_type; /*!< Gain type. */ + cmc_gain_conversion_type_t conversion_type; /*!< Gain conversion type. */ + uint32_t num_segments; /*!< Number of gain/code segments which describe the gain. */ + uint32_t num_pairs; /*!< Number of gain/code pairs which describe the gain. */ + union + { + cmc_gain_segment_t *ptr; /*!< Array of gain segments. Array length is defined by num_segments. */ + uint64_t dummy; /* Ensures that pointer is accessible in both 32 and 64 bit systems. */ + } segments; + union + { + cmc_gain_code_pair_t *ptr; /*!< Array of gain code pairs. Array length is defined by num_pairs. */ + uint64_t dummy; /* Ensures that pointer is accessible in both 32 and 64 bit systems. */ + } pairs; + union + { + cmc_gain_fixed_t *ptr; /*!< A pointer to the fixed point format. */ + uint64_t dummy; /* Ensures that pointer is accessible in both 32 and 64 bit systems. */ + } fixed; +} cmc_gain_conversion_t; + +typedef struct +{ + ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_multi_gain_conversions (See cmc_name_id). */ + uint32_t num_gains; /*!< Number of gains configured. */ + uint32_t padding; + union + { + cmc_gain_conversion_t* ptr; /*!< Array of gain conversions. Array length defined in num_gains. */ + uint64_t dummy; /* Ensures that pointer is accessible in both 32 and 64 bit systems. */ + } gains; + uint64_t reserved; /* Reserved for record version updates. */ +} cmc_multi_gain_conversions_t; + +/*! +* \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; + +typedef struct +{ + int32_t focalLength; /*!< Focal length in terms of those used by the camera module.Range should be depicted from the CMC_OpticsAndMechanics section in the CPFF.*/ + int32_t ldc_r_lut[256]; /*!< LDC(R) LUT table*/ + int32_t ldc_r_x_center; /*!< X coordinate of LDC(R) correction center of symmetry */ + int32_t ldc_r_y_center; /*!< Y coordinate of LDC(R) correction center of symmetry */ + int32_t ldc_r_y_scale_factor; /*!< Y coordinate scaling factor for elliptical distortion of LDC(R) correction */ +} cmc_ldc_lut_t; + +/*! + * \brief LDC LUT mode + */ +typedef enum { + cmc_camera_ldc_lut_type_incident_angle_vs_distorted_radius = 0, /*!< incident angle vs Rd */ + cmc_camera_ldc_lut_type_undistorted_radius_vs_distorted_radius, /*!< 1-> Ru vs Rd */ +} cmc_camera_ldc_lut_mode_t; + + +/*! + * \brief CMC WFOV LDC parameters + */ + +typedef struct +{ + float focal_length; /*!< Focal length in terms of those used by the camera module.Range should be depicted from the CMC_OpticsAndMechanics section in the CPFF.*/ + float max_fov_lut; /*!< Max incident angle (in degrees) covered in the LUT.*/ + cmc_camera_ldc_lut_mode_t lut_mode; /*!< LDC LUT mode: 0 -> incident angle vs Rd, 1-> Ru vs Rd*/ + int32_t num_lut_elements; /*!< Number of LUT elements.*/ + float *ldc_r_lut; /*!< LDC(R) LUT table in pixels*/ +} cmc_wfov_ldc_lut_t; + + +/*! + * \brief CMC WFOV calibration parameters + */ +typedef struct +{ + float horizontal_shift; /*!< Horizontal shifts in pixels */ + float vertical_shift; /*!< Vertical shifts in pixels */ + float horizontal_foclen_fact; /*!< Horizontal focal length factor */ + float vertical_foclen_fact; /*!< Vertical focal length factor */ + float horizontal_shear; /*!< Horizontal shear factor */ + float vertical_shear; /*!< Vertical shear factor */ +} cmc_affine_params_t; +#define SIZEOF_CMC_AFFINE_PARAMS (24) + +typedef struct +{ + int16_t ldc_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 ldc_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 ldc_grid_width; /*!< Indicates number of grid vertices on the horizontal axis. */ + int16_t ldc_grid_height; /*!< Indicates number of grid vertices on the vertical axis. */ + int16_t ldc_block_width; /*!< Average width of the grid cell in pixel count. */ + int16_t ldc_block_height; /*!< Average height of the grid cell in pixel count. */ + uint16_t ldc_grid_count; /*!< Number of LDC grids (focus positions). */ + cmc_gdc_mode_type gdc_mode; /*!< GDC mode enum, 0=Grid based (old), 1=LUT, 2=ext-LUT. */ + int32_t ldc_lut_count; /*!< Number of LDC Luts (focal lengths) */ + int32_t spherical_r_lut[256]; /*!< R-spherical LUT table for spherical to Cartesian coordinate system transformation (dewarping) */ + int32_t spherical_r_lut_radius_start; /*!< R-spherical LUT table starting radius, 0-65535 */ + int32_t spherical_r_lut_radius_end; /*!< R-spherical LUT table ending radius, 0-65535 */ + int32_t spherical_to_cartesian_x_center; /*!< X coordinate of spherical to Cartesian coordinate system transformation (dewarping), 0-65535 */ + int32_t spherical_to_cartesian_y_center; /*!< Y coordinate of spherical to Cartesian coordinate system transformation (dewarping), 0-65535 */ + cmc_geometric_distortion2_grid_t* ldc_grid; /*!< LDC grids (legacy) */ + cmc_ldc_lut_t* ldc_lut; /*!< LDC LUTs */ + float max_fov_lens; /*!< Max field of view of the lens(degrees) */ + int32_t num_wfov_luts; /*!< Number of WFOV Luts (focal lengths) */ + cmc_wfov_ldc_lut_t *wfov_ldc_lut; /*!< WFOV LDC LUTs: Number of LUTs specified by num_wfov_luts */ + cmc_affine_params_t *affine_params; /*!< WFOV affine parameters: One for each LUT */ + int32_t ldc_grid_size; /*!< Grid size for ldc (32,64,128) */ + uint8_t interpolation_type; /*!< Interpolation Type for gdc (0=BiLinear, 1=BiCubic) */ + int32_t image_window_vertical_shift; /*!< Vertical Shift for window */ + int32_t image_window_horizontal_shift; /*!< Horizontal Shift for window */ + uint8_t use_ineffective_values; /*!< Use Ineffective Values for gdc (0=Regular, 1=Ineffective) */ + +} cmc_parsed_geometric_distortion2_t; + +#define SIZEOF_CMC_GEOMETRIC_DISTORTION_V100_T 22U +#define SIZEOF_CMC_GEOMETRIC_DISTORTION_SPHERICAL_R_LUT 1024U /* 256 * 4 */ +#define SIZEOF_CMC_GEOMETRIC_DISTORTION_SPHERICAL_CFG_PARAMS 16U + + + +/*! + * \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 12U + +/*! + * \brief CMC color matrix + */ +typedef struct +{ + float color_matrix[9]; /*!< 3x3 accurate CCM, each consecutive elements sum to 1. */ +} cmc_acm_color_matrix_t; +#define SIZEOF_CMC_ACM_COLOR_MATRIX_T 36U + +/*! + * \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. */ + uint32_t cct; /*!< Color temperature */ +} cmc_acm_color_matrices_info_t; + +#define SIZEOF_CMC_ACM_COLOR_MATRICES_INFO_T 20U +#define SIZEOF_CMC_ACM_COLOR_MATRICES_INFO_V101_T 24U + +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; + +typedef struct +{ + float min; /*!< The minimum allowed ratio for the parameter. */ + float max; /*!< The maximum allowed ratio for the parameter. */ +} cmc_hdr_param_ratio_limit_t; + +/*! + * CMC HDR ratio limits. + */ +typedef struct +{ + cmc_hdr_param_ratio_limit_t hdr_exposure_time_ratio_limits; /*!< Allowed ratio between exposure times. */ + cmc_hdr_param_ratio_limit_t hdr_analog_gain_ratio_limits; /*!< Allowed ratio between analog gains. */ + cmc_hdr_param_ratio_limit_t hdr_digital_gain_ratio_limits; /*!< Allowed ratio between digital gains. */ +} cmc_hdr_ratio_limits_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_hdr_ratio_limits_t overall_ratio_limits; /*!< v101. Ratio limits between the longest and shortest exposure. */ + cmc_hdr_ratio_limits_t pair_ratio_limits; /*!< v101. Ratio limits between exposure pairs. */ +} cmc_parsed_hdr_parameters_t; + +#define SIZEOF_CMC_HDR_T 16U +#define SIZEOF_CMC_HDR_V101_T (2U*(uint32_t)sizeof(cmc_hdr_ratio_limits_t)) + +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 32U + + +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 20U + +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 +{ + float ir_proportion; /*!< IR and green pixel proportion in sensor plane, */ + float reserved[3]; /*!< Reserved. */ +} +cmc_ir_proportion_t; +#define SIZEOF_CMC_IR_PROPORTION_V101_T ((uint32_t)sizeof(cmc_ir_proportion_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_ir_proportion_t *ir_proportion; /*!< v101. */ +} +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. */ + cmc_chromaticity chromaticity; /*!< Sensor R/G B/G ratios. */ + cmc_cie_coords cie_coords; /*!< CIE x and y coordinates. */ + unsigned short fraction_bits; /*!< Number of fraction bits in the shading table fix point representation. */ + unsigned short *grids[4][4]; /*!< LSC gain grid stored in fixed point format with variable number of fraction bits, (16-fraction_bits)Qfraction_bits. */ +} cmc_lsc_grid; +#define SIZEOF_CMC_LSC_GAIN_GRID_T 22U + +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; +#define SIZEOF_CMC_LENS_SHADING4x4_T 32U + +typedef struct +{ + cmc_lsc_grid lsc_grid; /* LSC gain grid. */ + uint16_t pair_index; /* Calibration light source pair index. Tells which NVM table number should be used (in case there are more than one, if there is only one the value is always 0). */ +} cmc_lsc_ratio_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_ratio_grid *ratio_grids; /*!< LSC grids for all light sources (as defined by num_light_srcs). */ +} cmc_lens_shading_ratio_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_blue_x; /*!< Amount of absolute lateral chromatic aberration in horizontal direction in each of the grid locations for blue 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_blue_y; /*!< Same as above but in vertical direction. */ + float *lca_grid_red_x; /*!< Same as above but for horizontal and red pixel. */ + float *lca_grid_red_y; /*!< Same as above but in vertical direction. */ +} cmc_lateral_chromatic_aberration_correction; +#define SIZEOF_CMC_LCA_HDR 20 + +typedef struct +{ + uint16_t pattern_horizontal_offsets; /*!< Buffer of horizontal offsets for repetitive PD pixels within the pattern */ + uint16_t pattern_vertical_offsets; /*!< Buffer of vertical offsets for repetitive PD pixels within the pattern */ + uint16_t pattern_labels; /*!< Buffer of labels for repetitive PD pixels within the pattern (0 - left pixel, 1 - right pixel) */ +} cmc_pd_pattern_t; + +typedef struct +{ + int32_t dlom; /*!< Default DLOM table for the reference golden sample */ +} cmc_pd_dlom_t; + +typedef struct +{ + uint16_t ps_gains_left; /*!< Default PS gains table for left pixels for the reference golden module */ + uint16_t ps_gains_right; /*!< Default PS gains table for right pixels for the reference golden module */ +} cmc_pd_ps_gains_t; + +typedef struct +{ + ia_mkn_record_header header; /*!< Record header with Format ID: Uint16 (See AIQB_DataID) Name ID: cmc_name_id_phase_difference */ + uint16_t sensor_type; /*!< PD sensor type (See cmc_pd_sensor_type)*/ + uint16_t technology_type; /*!< PD technology type (See cmc_pd_technology_type) */ + uint16_t pd_horizontal_offset; /*!< Number of pixel pairs skipped at the beginning of the frame before the start of the first PD pattern */ + uint16_t pd_vertical_offset; /*!< Number of line pairs skipped at the beginning of the frame before the start of the first PD pattern */ + uint16_t num_pd_pixels; /*!< Number of repetitive PD pixels within the pattern */ + uint16_t pattern_width; /*!< Pattern width (horizontal period for repetitive PD pixels) */ + uint16_t pattern_height; /*!< Pattern height (vertical period for repetitive PD pixels) */ + uint16_t dlom_width; /*!< Number of Disparity of Lens Offset Mapping (DLOM) knots in horizontal orientation */ + uint16_t dlom_height; /*!< Number of Disparity of Lens Offset Mapping (DLOM) knots in vertical orientation */ + uint16_t ps_gains_width; /*!< Number of pixel sensitivity (PS) knots in horizontal orientation */ + uint16_t ps_gains_height; /*!< Number of pixel sensitivity (PS) knots in vertical orientation */ + cmc_pd_pattern_t *cmc_pd_pattern; /*!< PD pattern characterization (num_pd_pixels) */ + cmc_pd_dlom_t *cmc_pd_dlom; /*!< Disparity of Lens Offset Mapping characterization (dlom_width*dlom_height) */ + cmc_pd_ps_gains_t *cmc_pd_ps_gains; /*!< Pixel sensitivity characterization (ps_gains_width*ps_gains_height) */ +} cmc_phase_difference_t; +#define SIZEOF_CMC_PHASE_DIFFERENCE_T 30 + +/*! + * \brief Structure defining run (count) and value pairs. + */ +typedef struct +{ + unsigned short run; /*!< Count of how many times the same 'value' is present. */ + unsigned short value; /*!< Value. */ +} cmc_run_value; + +/*! + * \brief Defines structure that describes valid image area. + * When using WFOV lens, for example fisheye lens, image coming through the optics is not covering the whole sensor area. + * For example corners of the captured image from sensor may be invalid and need to be excluded from 3A analysis and ISP processing. + * This structure defines generic form of describing areas that should be excluded from captured rectangular sensor image. + * 0 value indicates invalid area and 1 indicates valid area. + * { run, value } pairs are used to compress data. + * + * Example how following 2D table is described with { run, value } pairs: + * 0000000000000000 -> { 16, 0 }, + * 0000011111111111 -> { 5, 0 }, { 11, 1 }, + * 0111111111111110 -> { 1, 0 }, { 14, 1 }, { 1, 0 }, + * 0011111111111100 -> { 2, 0 }, { 12, 1 }, { 2, 0 }, + * 0000111111110000 -> { 4, 0 }, { 8, 1 }, { 4, 0 }, + * + * This 2D table can be further reduced by joining per row { run, value } pairs to 1D table: + * { 21, 0 }, { 11, 1 }, { 1, 0 }, { 14, 1 }, { 3, 0 }, { 12, 1 }, { 6, 0 }, { 8, 1 }, { 4, 0 } + * 'width' defines how to decode 1D array into 2D table. + * 'height' is given for reference, in order to calculate size of 2D table for decoding it into memory. + */ +typedef struct +{ + ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID), Name ID: cmc_name_id_valid_image_area (See cmc_name_id). */ + unsigned short width; /*!< Width of the map that indicates valid image area. */ + unsigned short height; /*!< Height of the map that indicates valid image area. */ + unsigned int num_run_values; /*!< Number of { run, value } pairs encoded. */ + union { + cmc_run_value *ptr; /*!< Pointer to { run, value} pairs. */ + uint64_t dummy; /* Ensures that pointer is accessible in both 32 and 64 bit systems. */ + } run_values; + + unsigned short center_x; /*!< v201+ only -- Horizontal center of radial approximation of valid image area in pixels. */ + unsigned short center_y; /*!< v201+ only -- Vertical center of radial approximation of valid image area in pixels. */ + unsigned int radius; /*!< v201+ only -- Radius of valid image area in pixels */ + uint64_t reserved_v202; /*!< v202+ only -- reserved for pointer to v202 data */ + uint64_t reserved_v203; /*!< v202+ only -- reserved for pointer to v203 data */ +} cmc_valid_image_area; + +/*! +* \brief CMC Sensor decompand +*/ +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). */ + uint8_t enable; + uint16_t companded_pedestal; + uint8_t companded_bpp; + uint8_t linear_bpp; + uint8_t number_of_points; + uint16_t *x_coords; /*Array of x coordinates for sensor decompand curve. Count of array is equal number_of_point*/ + uint32_t *y_coords; /*Array of y coordinates for sensor decompand curve. Count of array is equal number_of_point*/ +} cmc_parsed_sensor_decompand_t; + +/*! +* \brief CMC Pipe compand +*/ +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). */ + uint8_t enable; + uint32_t linear_pedestal; + uint8_t segments; + uint32_t *x_coords; /*Array of x coordinates for pipe compand curve. Count of array is equal segments + 1 */ + uint16_t *y_coords; /*Array of y coordinates for pipe compand curve. Count of array is equal segments*/ + uint16_t *slopes; /*Array of slopes for pipe compand curve. Count of array is equal segments*/ +} cmc_parsed_pipe_compand_t; + +/*! +* \brief CMC Pipe decompand +*/ +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). */ + uint8_t enable; + uint32_t linear_pedestal; + uint8_t segments; + uint16_t *x_coords; /*Array of x coordinates for pipe decompand curve. Count of array is equal segments + 1 */ + uint32_t *y_coords; /*Array of y coordinates for pipe decompand curve. Count of array is equal segments*/ + uint32_t *slopes; /*Array of slopes for pipe decompand curve. Count of array is equal segments*/ +} cmc_parsed_pipe_decompand_t; + +/*! + * \brief CMC Module media format + */ +typedef struct +{ + ia_mkn_record_header header; /*!< Record header with Format ID: cmc_media_format, Name ID: cmc_name_id_media_format (See cmc_name_id). */ + int32_t format; /*!< media format for video/preview/still. */ +} cmc_media_format_info_t; + +typedef struct +{ + float gain; + int32_t frame_count; +} trigger_info_t; + +#define MAX_TNR7US_TRIGGER_INFO_COUNT 16U +typedef struct +{ + float tnr7us_threshold_gain; + uint32_t num_gains; + uint32_t reorder_frame_tnr; + trigger_info_t trigger_infos[MAX_TNR7US_TRIGGER_INFO_COUNT]; +} tnr7us_trigger_info_t; + +/*! +* \brief CMC Sensor decompand +*/ +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). */ + uint8_t enable; + uint8_t number_of_points; + int32_t *x_coords; /*Array of x coordinates for sensor decompand curve. Count of array is equal number_of_point*/ + int32_t *y_coords; /*Array of y coordinates for sensor decompand curve. Count of array is equal number_of_point*/ +} cmc_parsed_cbd_t; + +#define SEG_NET_VERSION_SIZE 3U +#define SEG_NET_CRC_CODE_SIZE 128U + +typedef struct +{ + ia_mkn_record_header header; /*!< Record header with Format ID: UInt16 (See AIQB_DataID) Name ID: cmc_name_id_seg_net. (enum cmc_name_id). */ + seg_net_type seg_net_type; + uint16_t seg_net_file_version[SEG_NET_VERSION_SIZE]; + uint8_t seg_net_checksum[SEG_NET_CRC_CODE_SIZE]; + +} seg_net_info_t; + + +/*! + * \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; /* DEPRECATED. Use cmc_black_level_global instead. */ + 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 *cmc_noise_model; /* 40 */ + cmc_parsed_lens_shading_t cmc_parsed_lens_shading; /* 44 */ + 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; /* DEPRECATED. Use cmc_multi_gain_conversions instead. */ + cmc_parsed_digital_gain_t cmc_parsed_digital_gain; /* DEPRECATED. Use cmc_multi_gain_conversions instead. */ + 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; + cmc_phase_difference_t *cmc_phase_difference; + cmc_lateral_chromatic_aberration_correction *cmc_parsed_lca; + cmc_lens_shading_correction *cmc_lens_shading; + cmc_black_level_global *cmc_black_level_global; + cmc_valid_image_area *cmc_valid_image_area; + cmc_lens_shading_ratio_correction *cmc_lens_shading_ratio; + cmc_multi_gain_conversions_t *cmc_multi_gain_conversions; + cmc_parsed_pipe_compand_t *cmc_parsed_pipe_compand; + cmc_parsed_pipe_decompand_t *cmc_parsed_pipe_decompand; + cmc_parsed_sensor_decompand_t *cmc_parsed_sensor_decompand; + cmc_media_format_info_t *cmc_parsed_media_format; + cmc_media_format_info_t *cmc_parsed_media_format_stills; + cmc_parsed_cbd_t *cmc_parsed_cbd; + tnr7us_trigger_info_t *tnr7us_trigger_info; + seg_net_info_t* seg_net_info_t; + const ia_binary_data *a_aiqb_binary; +} ia_cmc_t; + +#ifdef __cplusplus +} +#endif + +#endif /* IA_CMC_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_configuration.h b/include/ipu8/ia_imaging/ia_configuration.h new file mode 100644 index 0000000..c604c7d --- /dev/null +++ b/include/ipu8/ia_imaging/ia_configuration.h @@ -0,0 +1,80 @@ +/* + * INTEL CONFIDENTIAL + * Copyright (c) 2020-2022 Intel Corporation + * All Rights Reserved. + * + * This file autogenerated. Do not edit directly! + */ + +#ifndef _IA_CONFIGURATION_H_ +#define _IA_CONFIGURATION_H_ + +#define IA_HISTOGRAM_SIZE 256 +#define IA_RGBS_GRID_WIDTH 100 +#define IA_RGBS_GRID_HEIGHT 100 +#define IA_FILTER_RESPONSE_GRID_WIDTH 100 +#define IA_FILTER_RESPONSE_GRID_HEIGHT 100 +#define IA_DEPTH_GRID_WIDTH 16 +#define IA_DEPTH_GRID_HEIGHT 12 +#define IA_CMC_GAINS_MAX_NUM 4 +#define IA_CCAT_STATISTICS_MAX_NUM 3 +#define IA_CCAT_EXTERNAL_RGB_HISTOGRAMS_ENABLED +#define IA_CCAT_EXTERNAL_LUMINANCE_HISTOGRAM_ENABLED +#define IA_CCAT_IR_GRID_ENABLED +#define IA_CCAT_DEPTH_GRID_ENABLED +#define IA_CCAT_RGBS_GRID_ENABLED +#define IA_CCAT_HSV_GRID_ENABLED +#define IA_CCAT_LIGHT_SOURCE_ESTIMATION_ENABLED +#define IA_CCAT_LUMINANCE_GRID_ENABLED +#define IA_CCAT_LUMINANCE_MOTION_ESTIMATE_ENABLED +#define IA_CCAT_FACE_ANALYSIS_ENABLED +#define IA_CCAT_FACES_MAX_NUM 10 +#define IA_CCAT_ROI_ANALYSIS_ENABLED +#define IA_CCAT_ROIS_MAX_NUM 1 +#define IA_CCAT_CONVOLUTION_FILTER_GRID_ENABLED +#define IA_CCAT_EXTERNAL_SENSORS_ENABLED +#define IA_CCAT_EXTERNAL_SEGMAP_ENABLED +#define ENABLE_RGB_IR_SENSOR +#define ENABLE_AIQD +#define ENABLE_AEC +#define IA_AEC_EXPOSURES_MAX_NUM 10 +#define IA_AEC_EXPOSURE_PLANS_NUM 4 +#define IA_AEC_FEATURE_WEIGHT_GRID +#define IA_AEC_WEIGHT_GRID_WIDTH 100 +#define IA_AEC_WEIGHT_GRID_HEIGHT 100 +#define IA_AEC_FEATURE_CALIBRATION_DATA +#define IA_AEC_FEATURE_FLASH +#define IA_AEC_FLASHES_NUM 2 +#define IA_AEC_FEATURE_FLICKER_DETECTION +#define IA_AEC_FEATURE_BACKLIGHT_DETECTION +#define IA_AEC_FEATURE_FACE_UTILIZATION +#define IA_AEC_FEATURE_ROI_ENABLED +#define IA_AEC_FEATURE_APERTURE_CONTROL +#define IA_AEC_FEATURE_DC_IRIS +#define IA_AEC_FEATURE_MULTIFRAME_HINT +#define IA_AEC_FEATURE_HDR +#define IA_AEC_FEATURE_MOTION_BLUR_REDUCTION +#define IA_AEC_FEATURE_SCENE_ANALYSIS +#define ENABLE_AF +#define ENABLE_AWB +#define IA_AWB_FEATURE_SKIN_TONE_CORRECTION +#define IA_AWB_FEATURE_CAM_ENABLED +#define IA_AWB_FEATURE_SENSOR_GAMUT_MAPPING_ENABLED +#define IA_AWB_FEATURE_RGB_MAX_ENABLED +#define IA_AWB_FEATURE_HO_GW_ENABLED +#define IA_AWB_FEATURE_OT_GW_ENABLED +#define ENABLE_GBCE +#define ENABLE_GTM +#define ENABLE_SA +#define IA_LSC_FEATURE_LSE_ENABLED +#define ENABLE_PA +#define IA_BRADFORD_ADAPTATION_ENABLED +#define IA_IR_WEIGHT_CALCULATION_ENABLED +#define ENABLE_TUNING +#define IA_DEFAULT_TUNING_ENABLED +#define ENABLE_DSD +#define ENABLE_LTM +#define ENABLE_DVS +/* #undef GMV_STATISTICS_1_0_PAC_ENABLED */ + +#endif /* _IA_CONFIGURATION_H_ */ diff --git a/include/ipu8/ia_imaging/ia_coordinate.h b/include/ipu8/ia_imaging/ia_coordinate.h new file mode 100644 index 0000000..af92e58 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_coordinate.h @@ -0,0 +1,149 @@ +/* + * Copyright 2012-2021 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) + +typedef enum +{ + ia_coordinate_rounding_mode_floor = 0, /* Coordinates are always floored down. This is the old behavior. */ + ia_coordinate_rounding_mode_ceil, /* Coordinates are always ceiled up. */ + ia_coordinate_rounding_mode_round /* Coordinates are rounded to the closest integer. */ +} ia_coordinate_rounding_mode; + +/*! + * \brief Coordinate system. + * Defines the coordinate space boundaries. + */ +typedef struct +{ + int32_t top; /*!< Top coordinate value in the coordinate system. */ + int32_t left; /*!< Left coordinate value in the coordinate system. */ + int32_t bottom; /*!< Bottom coordinate value in the coordinate system. */ + int32_t 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. + * \param[in] rounding_mode Coordinate rounding mode. + * \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, + const ia_coordinate_rounding_mode rounding_mode); + +/*! +* 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_atbx_faces( + ia_atbx_face_state *face_state, + const ia_coordinate_system *src_system, + const ia_coordinate_system *trg_system); + +#ifdef __cplusplus +} +#endif + + +#endif /* IA_COORDINATE_H_ */ + diff --git a/include/ipu8/ia_imaging/ia_dvs.h b/include/ipu8/ia_imaging/ia_dvs.h new file mode 100644 index 0000000..c365122 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_dvs.h @@ -0,0 +1,286 @@ +/* + * Copyright 2014-2021 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. + */ + +/*! + * \note IA DVS documentation + * + * \section 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 +#include "ia_dvs_types.h" +#include "ia_aiq_types.h" +#include "ia_aiq_types_deprecated.h" +#include "ia_cmc_types.h" +#include "ia_dvs_deprecated.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_v1(ia_dvs_state *dvs_state, + const ia_dvs_configuration_v1 *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_readout_start Frame readout 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_readout_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); + +/*! \brief Get the homography matrix for image stabilization. +* +* \param[in] dvs_state dvs state. +* This is a pointer to a module. +* \param[out] image_transformation Pointer to the transformation structure where results are saved. +* \return 0 for no error, others for error. +* +* This function calculates gets a set of homography matrices to perform video stabilization for one frame. +*/ +LIBEXPORT ia_err +ia_dvs_get_image_transformation(ia_dvs_state *dvs_state, + ia_dvs_image_transformation *image_transformation); + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_DVS_H_ */ diff --git a/include/ipu8/ia_imaging/ia_dvs_deprecated.h b/include/ipu8/ia_imaging/ia_dvs_deprecated.h new file mode 100644 index 0000000..1fe2fc7 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_dvs_deprecated.h @@ -0,0 +1,96 @@ +/* + * Copyright 2014-2025 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_DVS_DEPRECATED_H_ +#define _IA_DVS_DEPRECATED_H_ + +#include "ia_dvs_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** 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 parameters 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. */ + bool gdc_uses_floats; /**< False keeps dvs providing fixed point Y and UV morphing tables (legacy). True changes dvs to + provide only UV table in floating point format. */ + float quaternion_clip_max_angle; /**< Maximum allowed angle [degrees] of rotation for rotational motion compensation. The value is + used to clip the angle of rotation for shake motion or rolling shutter compensation. The clipping + value does not depend on the orientation of the axis of rotation. This should be non-negative + value and depends on the resolution and envelope and GDC HW limitations.*/ + float gyro_to_cam_orientation[9]; /**< Contains the orientation of gyro sensor in relation to camera sensor. */ +} ia_dvs_configuration; + +/*! \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); + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_DVS_DEPRECATED_H_ */ diff --git a/include/ipu8/ia_imaging/ia_dvs_types.h b/include/ipu8/ia_imaging/ia_dvs_types.h new file mode 100644 index 0000000..58d1a2a --- /dev/null +++ b/include/ipu8/ia_imaging/ia_dvs_types.h @@ -0,0 +1,306 @@ +/* + * Copyright 2014-2025 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 +#include "ia_types.h" + +#define DVS_HOMOGRAPHY_MATRIX_MAX_COUNT 16 + +typedef struct t_dvs_facade ia_dvs_state; + +/** DVS Algorithm. + * These settings specify the members of correction axes. + * ia_dvs_algorithm_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; + + + + + +/** GDC HW limits which are specific for particluar IPU + * version and need to be taken into account in the + * DVS algorithm side when preparing a correct morphing table + */ + + + + +/** This enum is a list of possible constraints on the DVS morphing + * table which need to be ensured during DVS algorithm execution. + */ +typedef enum +{ + ia_dvs_no_constraints = 0, /**< No additional constraints on the morphing table need to be performed */ + ia_dvs_woi_validation, /**< The morphing table is validated for access violation in FW duirng WOI pixel data fetch; + a violation results in no compensation for the current frame */ + ia_dvs_max_tetragon_size, /**< DVS ensures that the morph table tetragons fit inside pre-defined max width and height */ +} ia_dvs_morph_table_constraints; + +/** 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 parameters 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.*/ + ia_dvs_morph_table_constraints morph_table_constraints; + /**< Constraints defined on the DVS morphing table which need to be taken into account during + DVS algorithm execution for smoother video perception */ + bool gdc_uses_floats; /**< False keeps dvs providing fixed point Y and UV morphing tables (legacy). True changes dvs to + provide only UV table in floating point format. */ + float quaternion_clip_max_angle; /**< Maximum allowed angle [degrees] of rotation for rotational motion compensation. The value is + used to clip the angle of rotation for shake motion or rolling shutter compensation. The clipping + value does not depend on the orientation of the axis of rotation. This should be non-negative + value and depends on the resolution and envelope and GDC HW limitations.*/ + float gyro_to_cam_orientation[9]; /**< Contains the orientation of gyro sensor in relation to camera sensor. */ +} ia_dvs_configuration_v1; + +/** Distortion grid configuration. + * Structure defines lens distortion grid. + */ +typedef struct +{ + int16_t ldc_col_start; /*!< Table X offset in pixels from left corner of the sensor maximum visible area. + e.g. If ldc_col_start=ldc_block_width*(-1) + then ldc table offset is is one block left compared to the maximum visible sensor area. */ + int16_t ldc_row_start; /*!< Table Y offset in pixels from upper corner of the sensor maximum visible area. + e.g. If ldc_row_start=ldc_block_height*(-1) + then ldc table offset is is one block up compared to the maximum visible sensor area. */ + int16_t ldc_grid_width; /*!< Indicates number of grid vertices on the horizontal axis. */ + int16_t ldc_grid_height; /*!< Indicates number of grid vertices on the vertical axis. */ + int16_t ldc_block_width; /*!< Width of the original grid cell (without correction). */ + int16_t ldc_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 [ldc_grid_height x ldc_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 [ldc_grid_height x ldc_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; + float *xcoords_uv_float; /* uv x-coordinates in float format */ + float *ycoords_uv_float; /* uv y-coordinates in float format */ + bool disable_gdc; /* Info flag for GDC to indicate input resolution = output resolution and no warping is done. */ +} 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; + + +typedef struct +{ + int32_t start_row; /* Vertical offset in lines where matrix is applied. + Between two offsets corresponding matrices are linearly interpolated + element wise.*/ + float matrix[3][3]; /* Defines one 3x3 homography matrix which is ordered row wise. */ +} ia_dvs_homography_matrix; + +/** Image transformation parameters. +* This structure defines image transformation with a list of 3x3 homography matrices. +* Maximum number of homography matrices is 16 and for each matrix start offset +* should be defined. +*/ +typedef struct +{ + int32_t num_homography_matrices; /* Number of homography matrices */ + ia_dvs_homography_matrix matrices[DVS_HOMOGRAPHY_MATRIX_MAX_COUNT]; /* Homography matrices for image + transformation. Can be used e.g. + for image alignment or + video stabilization. */ + bool matrices_changed; + +} ia_dvs_image_transformation; + +#endif /* _IA_DVS_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_emd_decoder.h b/include/ipu8/ia_imaging/ia_emd_decoder.h new file mode 100644 index 0000000..5b5e00d --- /dev/null +++ b/include/ipu8/ia_imaging/ia_emd_decoder.h @@ -0,0 +1,103 @@ +/* +* INTEL CONFIDENTIAL +* Copyright (c) 2014-2021 Intel Corporation +* All Rights Reserved. +* +* The source code contained or described herein and all documents related to +* the source code ("Material") are owned by Intel Corporation or its +* suppliers or licensors. Title to the Material remains with Intel +* Corporation or its suppliers and licensors. The Material may contain trade +* secrets and proprietary and confidential information of Intel Corporation +* and its suppliers and licensors, and is protected by worldwide copyright +* and trade secret laws and treaty provisions. No part of the Material may be +* used, copied, reproduced, modified, published, uploaded, posted, +* transmitted, distributed, or disclosed in any way without Intel's prior +* express written permission. +* +* No license under any patent, copyright, trade secret or other intellectual +* property right is granted to or conferred upon you by disclosure or +* delivery of the Materials, either expressly, by implication, inducement, +* estoppel or otherwise. Any license under such intellectual property rights +* must be express and approved by Intel in writing. +* +* Unless otherwise agreed by Intel in writing, you may not remove or alter +* this notice or any other notice embedded in Materials by Intel or Intels +* suppliers or licensors in any way. +*/ + +/*! + * \file ia_emd_decoder.h + * \brief Definitions of functions in Embedded Data decoder. +*/ + +#ifndef IA_EMD_DECODER_H_ +#define IA_EMD_DECODER_H_ + +#include "ia_aiq_types.h" +#include "ia_emd_types.h" +#include "ia_types.h" +#include "ia_log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef LOG_EMD +#define IA_EMD_LOG(fmt, ...) IA_LOG(ia_log_debug, "IAEMD: " fmt, ## __VA_ARGS__) +#define IA_EMD_LOG_ERROR(fmt, ...) IA_LOG(ia_log_error, "IAEMD: " fmt, ## __VA_ARGS__) +#define IA_EMD_LOG_INFO(fmt, ...) IA_LOG(ia_log_info, "IAEMD: " fmt, ## __VA_ARGS__) +#else +#define IA_EMD_LOG(...) ((void)0) +#define IA_EMD_LOG_ERROR(...) ((void)0) +#define IA_EMD_LOG_INFO(...) ((void)0) +#endif + + +/*! + * \brief Creates Embedded Data Decoder. + * + * \param[in] ia_cmc Mandatory.\n + * Parsed camera module characterization structure. Internal copy of the structure will be taken. + * \return Pointer to Embedded Data Decoder handle. + */ +LIBEXPORT ia_emd_decoder_t * +ia_emd_decoder_init( + const ia_cmc_t * a_ia_cmc); + + +/*! + * \brief Deletes Sensor Data Decoder. + * + * \param[in] emd_decoder Mandatory. \n + * Pointer to decoder handle. + * \return None. + */ +LIBEXPORT void +ia_emd_decoder_deinit(ia_emd_decoder_t * a_emd_decoder_p); + + +/*! + * \brief Runs Sensor Data Decoder. + * + * \param[in] emd_bin Mandatory. \n + * Pointer to sensor embedded data binary blob. + * \param[in] emd_mode Mandatory. \n + * Pointer to sensor embedded data run-time configuration. + * \param[in] sensor_descriptor Mandatory. \n + * Pointer to sensor specific descriptor. + * \param[in/out] emd_decoder Mandatory. \n + Pointer to decoder handle. Contains decoded exposure data as well. + * \return Error code. + */ +LIBEXPORT ia_err +ia_emd_decoder_run( + const ia_binary_data * a_emd_bin_p, + const ia_emd_mode_t * a_emd_mode_p, + const ia_aiq_exposure_sensor_descriptor * a_sensor_descriptor, + ia_emd_decoder_t * a_emd_decoder_p); + +#ifdef __cplusplus +} +#endif + +#endif /* IA_EMD_DECODER_H_ */ diff --git a/include/ipu8/ia_imaging/ia_emd_types.h b/include/ipu8/ia_imaging/ia_emd_types.h new file mode 100644 index 0000000..50cb1e1 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_emd_types.h @@ -0,0 +1,205 @@ +/* +* INTEL CONFIDENTIAL +* Copyright (c) 2014-2022 Intel Corporation +* All Rights Reserved. +* +* The source code contained or described herein and all documents related to +* the source code ("Material") are owned by Intel Corporation or its +* suppliers or licensors. Title to the Material remains with Intel +* Corporation or its suppliers and licensors. The Material may contain trade +* secrets and proprietary and confidential information of Intel Corporation +* and its suppliers and licensors, and is protected by worldwide copyright +* and trade secret laws and treaty provisions. No part of the Material may be +* used, copied, reproduced, modified, published, uploaded, posted, +* transmitted, distributed, or disclosed in any way without Intel's prior +* express written permission. +* +* No license under any patent, copyright, trade secret or other intellectual +* property right is granted to or conferred upon you by disclosure or +* delivery of the Materials, either expressly, by implication, inducement, +* estoppel or otherwise. Any license under such intellectual property rights +* must be express and approved by Intel in writing. +* +* Unless otherwise agreed by Intel in writing, you may not remove or alter +* this notice or any other notice embedded in Materials by Intel or Intels +* suppliers or licensors in any way. +*/ + +/*! + * \file ia_emd_types.h + * \brief Enumerations, structures and definitions used in the Embedded Data decoder. +*/ + +#ifndef _EMD_TYPES_H_ +#define _EMD_TYPES_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * Revision of Sensor Data Decoder library, format 0xYYMMDDVV, where: + * - YY: year, + * - MM: month, + * - DD: day, + * - VV: version ('01': ver 0.1,'11': ver 1.1 etc.) + */ +#define IA_SENSOR_DATA_DECODER_REVISION 0x15080711U + +#define MAX_NUMBER_OF_BLOCK_IDS 0xF00 + +/* CMC Comment */ +#define AIQB_EMD_RECORD_1_ID 1 +#define AIQB_EMD_RECORD_1_VERSION 100 + +/* CMC Embedded Data */ +#define AIQB_EMD_RECORD_21_ID 21 +#define AIQB_EMD_RECORD_21_VERSION 100 +#define AIQB_EMD_RECORD_21_VERSION_101 101 + + +#define SIZEOF_CONFIG_DATA_BLOCK_T 16 /*!< Size of ia_emd_config_block_t structure in bytes. */ + +/*! + * \brief Elementary embedded data block IDs. + */ +typedef enum +{ + /* Parameters in sensor units */ + fine_int_time_sensor_units = 0, /*!< 0: Fine integration time in sensor units. */ + coarse_int_time_sensor_units, /*!< 1: Coarse integration time in sensor units. */ + a_gain_global_sensor_units, /*!< 2: Analog gain global in sensor units. */ + d_gain_global_sensor_units, /*!< 3: Digital gain global in sensor units. */ + d_gain_R_sensor_units, /*!< 4: Digital gain R in sensor units. */ + d_gain_GR_sensor_units, /*!< 5: Digital gain GR in sensor units. */ + d_gain_GB_sensor_units, /*!< 6: Digital gain GB in sensor units. */ + d_gain_B_sensor_units, /*!< 7: Digital gain B in sensor units. */ + + /* Parameters in generic units */ + fine_int_time_generic_units, /*!< 8: Fine integration time in generic_units. */ + coarse_int_time_generic_units, /*!< 9: Coarse integration time in generic_units. */ + a_gain_global_generic_units, /*!< 10: Analog gain global in generic_units. */ + d_gain_global_generic_units, /*!< 11: Digital gain global in generic_units. */ + d_gain_R_generic_units, /*!< 12: Digital gain R in generic_units. */ + d_gain_GR_generic_units, /*!< 13: Digital gain GR in generic_units. */ + d_gain_GB_generic_units, /*!< 14: Digital gain GB in generic_units. */ + d_gain_B_generic_units, /*!< 15: Digital gain GB in generic_units. */ + + /* Additional parameters */ + analog_gain_apex_format, /*!< 16: Analog gain in APEX format. */ + digital_gain_apex_format, /*!< 17: Digital gain in APEX format. */ + total_gain_apex_format, /*!< 18: Total gain in APEX format. */ + exposure_time_us, /*!< 19: Exposure time in us. */ + iso_speed, /*!< 20: ISO speed value. */ + f_number_apex, /*!< 21: F-number in APEX format. */ + face_count, /*!< 22: Number of faces recognized in the image. */ + face_largest_index, /*!< 23: Index of the largest face in a face array. */ + face_top_left_corner_x, /*!< 24: Top-left corner of face region, X coordinates of faces recognized in the image. */ + face_top_left_corner_y, /*!< 25: Top-left corner of face region, Y coordinates of faces recognized in the image. */ + face_bottom_right_x, /*!< 26: Bottom-right corner of face region, X coordinates of faces recognized in the image. */ + face_bottom_right_y, /*!< 27: Bottom-right corner of face region, Y coordinates of faces recognized in the image. */ + + /* Misc. parameters */ + frame_length, /*!< 28: Total line number per one frame. */ + line_length, /*!< 29: Total pixel number per one line. */ + frame_counter, /*!< 30: Frame counter. */ + x_output_size, /*!< 31: Horizontal output width. */ + y_output_size, /*!< 32: Vertical output height. */ + + /* Keep it as last one */ + num_of_embedded_data_block_ids /*!< Number of Embedded Data block IDs. */ +} ia_emd_block_id_t; + + +/*! + * \brief Elementary Embedded Data block. + * Each block describes the content of a single elementary data unit, which could be provided from different + * sources, e.g.: + * - RAW data embedded lines; + * - External ISP embedded data block; + * - Any other type of sources. + */ +typedef struct +{ + uint32_t offset; /*!< Offset from beginning of data source blob in bytes. */ + uint16_t total_blocks; /*!< Total number of Elementary Data blocks in a value. */ + uint16_t block_number; /*!< Number of the current block in a series. */ + uint8_t data_src; /*!< Value from emd_source_t enumeration. */ + uint8_t block_id; /*!< Value from emd_block_id_t enumeration. */ + uint8_t bit_mask; /*!< Bit mask, applyed to the byte (before applying the shift). */ + int8_t byte_shift_value; /*!< Shift value (bits) applyed to byte. E.g. -2 is (N >> 2), 3 is (N << 3). */ + uint8_t data_format; /*!< Format of the data (block describes), value from ia_mkn_dfid enumeration. */ + uint8_t msb_num; /*!< Most significant bit of the block (e.g 11 if [11:8]), if applicable. */ + uint8_t lsb_num; /*!< Least significant bit of the block (e.g 8 if [11:8]), if applicable. */ + uint8_t embedded_line; /*!< Embedded line #, where data block is located. */ +} ia_emd_config_block_t; + + +/*! + * \brief Describes a run-time configuration of sensor embedded data. + */ +typedef struct +{ + uint32_t exp_id; /*!< A unique exposure ID of the frame. */ + int32_t stride; /*!< Stride of embedded data lines. */ + int32_t height; /*!< Num of lines in sensor emb.data, e.g for imx227 it should '2'. */ + int32_t *effective_width; /*!< Effective data for each line, e.g for imx227 it should be {160, 62}. */ +} ia_emd_mode_t; + + +/*! + * \brief Decoded Embedded Data block. + * Each block contains one decoded embedded data parameter (e.g.: fine integration time, analog gain, etc.), copyied to int64 container. + */ +typedef struct +{ + int64_t data; /*!< Data of the block. */ + uint8_t data_src; /*!< Value from emd_source_t enumeration. */ + uint8_t block_id; /*!< Value from emd_block_id_t enumeration. */ + uint8_t data_format; /*!< Format of the data (block describes), value from ia_mkn_dfid enumeration. */ + uint8_t reserved; /*!< Reserved. */ +} ia_emd_decoded_block_t; + +/*! + * \brief Decoded Embedded Data block. + * Each block contains one decoded embedded data parameter (e.g.: fine integration time, analog gain, etc.), copyied to int64 container. + */ +typedef struct +{ + uint32_t frame_counter; /*!< Frame counter. */ + uint16_t x_output_size; /*!< Horizontal output width. */ + uint16_t y_output_size; /*!< Vertical output height. */ +} ia_emd_misc_parameters_t; + +/*! + * \brief Decoded Exposure parameters. + */ +typedef struct +{ + ia_aiq_exposure_sensor_parameters *sensor_units_p; /*!< Exposure parameters in terms of sensor units. */ + ia_aiq_exposure_parameters *generic_units_p; /*!< Exposure parameters in terms of generic units. */ + ia_emd_misc_parameters_t *misc_parameters_p; /*!< Misc decoded parameters. */ +} ia_emd_result_t; + + +/*! + * \brief Embedded Data Decoder handle. + */ +typedef struct +{ + uint32_t decoder_revision; /*!< Version of decoder: 0xMAjor.MInor. */ + const ia_cmc_t *ia_cmc_p; /*!< Pointer to internal copy of parsed camera module characterization structure. */ + uint16_t max_block_ID; /*!< Maximum block_id value from decoder_cfg_p. */ + uint16_t config_flags; /*!< Value from embedded_data_decoder_flags_t enumeration. */ + uint16_t *block_id_mapping; /*!< Array[max_block_ID + 1] for mapping of block_id to data blocks array index. */ + ia_emd_result_t decoded_data; /*!< Result of EMD decoding. */ + /* ia_emd_decoded_block_t blocks[];*/ /*!< Decoded data blocks array. */ +} ia_emd_decoder_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _EMD_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_isp_bxt_statistics_types.h b/include/ipu8/ia_imaging/ia_isp_bxt_statistics_types.h new file mode 100644 index 0000000..e6600b2 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_isp_bxt_statistics_types.h @@ -0,0 +1,195 @@ +/* + * Copyright 2021 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_statistics_types.h + * \brief BXT ISP specific statistics data types. +*/ +#ifndef IA_ISP_BXT_STATISTICS_TYPES_H_ +#define IA_ISP_BXT_STATISTICS_TYPES_H_ + +#include "ia_types.h" + +#define BXT_HISTOGRAM_BINS 256 +#define BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS 1024 /* Max grid size = [32, 32] */ + +#define BXT_RGBS_GRID_MAX_WIDTH 96 /* Max grid size = [96, 72] */ +#define BXT_RGBS_GRID_MAX_HEIGHT 72 +#define BXT_RGBS_GRID_MAX_NUM_ELEMENTS (BXT_RGBS_GRID_MAX_WIDTH*BXT_RGBS_GRID_MAX_HEIGHT) + +#define BXT_DVS_STATS_L0_MAX_NUM_ELEMENTS 154 +#define BXT_DVS_STATS_L1_MAX_NUM_ELEMENTS 120 +#define BXT_DVS_STATS_L2_MAX_NUM_ELEMENTS 85 + +#define BXT_PAF_STATS_MAX_STEPS 11 /*!< Max number of phase shifts in a block. */ +#define BXT_PAF_STATS_GRID_MAX_NUM_ELEMENTS (16*12*BXT_PAF_STATS_MAX_STEPS) /*!< Max grid size = [16, 12] */ + +#define BXT_HDR_RGBY_GRID_MAX_WIDTH 484 /*!< Maximum grid width for HDR-statisics.*/ +#define BXT_HDR_RGBY_GRID_MAX_HEIGHT 276 /*!< Maximum grid height for HDR-statisics.*/ +#define BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS (BXT_HDR_RGBY_GRID_MAX_WIDTH * BXT_HDR_RGBY_GRID_MAX_HEIGHT) /*!< Maximum grid size for HDR-statisics.484*276=133584.*/ + +typedef enum +{ + /* TODO: These should be calculated as a hash from the below data structures. */ + ia_isp_bxt_statistics_uuid_filter_response_grid = 101, + ia_isp_bxt_statistics_uuid_rgbs_grid = 102, + ia_isp_bxt_statistics_uuid_histograms = 103, + ia_isp_bxt_statistics_uuid_motion_vectors = 104, + ia_isp_bxt_statistics_uuid_paf_grid = 105, + ia_isp_bxt_statistics_uuid_hdr_rgbs_grid = 106, /*!< RGBS grid with higher than 8 bit precision. */ + ia_isp_bxt_statistics_uuid_hdr_rgby_grid = 107, /*!< RGBY grid with higher than 8 bit precision. Possibly compressed. */ + ia_isp_bxt_statistics_uuid_hdr_yv_grid = 108 /*!< Y (Luma) V (Value in HSV color space) grid with higher than 8 bit precision. Possibly compressed. */ +} ia_isp_bxt_statistics_uuid; + +typedef struct +{ + int32_t uuid; /*!< Unique identifier of the record. See ia_isp_bxt_statistics_uuid. */ + int32_t size; /*!< The size of the record (i.e., the size of this struct). */ +} ia_isp_bxt_statistics_header_t; + +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t hist_c0[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C0. */ + int32_t hist_c1[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C1. */ + int32_t hist_c2[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C2. */ + int32_t hist_c3[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C3. */ + int32_t hist_c4[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C4. */ + int32_t hist_c5[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C5. */ + int32_t hist_c6[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C6. */ + int32_t hist_c7[BXT_HISTOGRAM_BINS]; /*!< Histogram for color channel C7. */ +} ia_isp_bxt_histograms_t; + +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t grid_width; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + int32_t y00_avg[BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS]; /*!< Y00 filter responses for each grid block. */ + int32_t y01_avg[BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS]; /*!< Y01 filter responses for each grid block. */ + int32_t y10_avg[BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS]; /*!< Y10 filter responses for each grid block. */ + int32_t y11_avg[BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS]; /*!< Y11 filter responses for each grid block. */ + int32_t r_avg[BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS]; /*!< R filter responses for each grid block. */ + int32_t g_avg[BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS]; /*!< G filter responses for each grid block. */ + int32_t b_avg[BXT_FILTER_RESPONSE_GRID_MAX_NUM_ELEMENTS]; /*!< B filter responses for each grid block. */ +} ia_isp_bxt_filter_response_grid_t; + +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t grid_width; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + int32_t c0_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C0 color for each grid block. */ + int32_t c1_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C1 color for each grid block. */ + int32_t c2_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C2 color for each grid block. */ + int32_t c3_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C3 color for each grid block. */ + int32_t c4_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C4 color for each grid block. */ + int32_t c5_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C5 color for each grid block. */ + int32_t c6_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C6 color for each grid block. */ + int32_t c7_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< Average level of C7 color for each grid block. */ + int32_t sat_ratio_0[BXT_RGBS_GRID_MAX_NUM_ELEMENTS / 4]; /*!< Saturation ratios. 0 = 0% above saturation. 255 = 100% above saturation. */ + int32_t sat_ratio_1[BXT_RGBS_GRID_MAX_NUM_ELEMENTS / 4]; /*!< Saturation ratios. 0 = 0% above saturation. 255 = 100% above saturation. */ + int32_t sat_ratio_2[BXT_RGBS_GRID_MAX_NUM_ELEMENTS / 4]; /*!< Saturation ratios. 0 = 0% above saturation. 255 = 100% above saturation. */ + int32_t sat_ratio_3[BXT_RGBS_GRID_MAX_NUM_ELEMENTS / 4]; /*!< Saturation ratios. 0 = 0% above saturation. 255 = 100% above saturation. */ +} ia_isp_bxt_rgbs_grid_t; + +/*! + * \brief RGBS data collected from decompressed and merged (from multiple exposures) HDR image. + * Named as StatR/G/B/S in ISP Firmware. +*/ +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t grid_width; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + int32_t r_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< U20. Average level of red color for each grid block. */ + int32_t g_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< U20. Average level of (gr+gb)/2 color for each grid block. */ + int32_t b_avg[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< U20. Average level of blue color for each grid block. */ + uint8_t sat[BXT_RGBS_GRID_MAX_NUM_ELEMENTS]; /*!< U8. currently this is saturation count and it will be saturation percentage after a few weeks. All codes need to be updated accordingly.*/ +} ia_isp_bxt_hdr_rgbs_grid_t; + +/*! + * \brief RBGY grids of data which may be compressed or not based on sensor and ISP pipe type. + * Named as HistStatR/G/B/Y in ISP Firmware. + * If statistics are compressed, information for decompression is described in structure ia_isp_bxt_hdr_compression_property_t. +*/ +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t grid_width; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + uint16_t r_avg[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15. Average level of R color for each grid block with high resolution. */ + uint16_t b_avg[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15. Average level of B color for each grid block with high resolution. */ + uint16_t g_avg[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15. Average level of (GR+GB)/2 color for each grid block with high resolution. */ + uint16_t y_avg[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15. Average level of Y (luminance) for each grid block with high resolution. */ +} ia_isp_bxt_hdr_rgby_grid_t; + +/*! + * \brief Y (luminance) V (Value in HSV color space) grids of data which may be compressed or not based on sensor and ISP pipe type. + * Named as DRCStatY/V in ISP Firmware. + * If statistics are compressed, information for decompression is described in structure ia_isp_bxt_hdr_compression_property_t. +*/ +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t grid_width; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + uint16_t v_max[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15.v_max = max(R,G,B) in HSV color space. Compressed or not based on sensor type. */ + uint16_t y_avg[BXT_HDR_RGBY_GRID_MAX_NUM_ELEMENTS]; /*!< U15.y_avg is same data as the y_avg in ia_isp_bxt_hdr_rgby_grid_t, but sub-sampled by 2x. */ +} ia_isp_bxt_hdr_yv_grid_t; + +typedef struct +{ + int32_t vec_fe_x_pos; + int32_t vec_fe_y_pos; + int32_t vec_fm_x_pos; + int32_t vec_fm_y_pos; + int32_t harris_grade; + int32_t match_grade; + int32_t level; +} ia_isp_bxt_dvs_motion_vector_entry_t; + +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t grid_width_l0; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height_l0; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + int32_t grid_width_l1; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height_l1; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + int32_t grid_width_l2; /*!< The actual grid width. Specifies the amount of valid data in the below arrays. */ + int32_t grid_height_l2; /*!< The actual grid height. Specifies the amount of valid data in the below arrays. */ + ia_isp_bxt_dvs_motion_vector_entry_t mv_l0[BXT_DVS_STATS_L0_MAX_NUM_ELEMENTS]; /*!< Motion vectors for L0 grid. */ + ia_isp_bxt_dvs_motion_vector_entry_t mv_l1[BXT_DVS_STATS_L1_MAX_NUM_ELEMENTS]; /*!< Motion vectors for L1 grid. */ + ia_isp_bxt_dvs_motion_vector_entry_t mv_l2[BXT_DVS_STATS_L2_MAX_NUM_ELEMENTS]; /*!< Motion vectors for L2 grid. */ + int32_t reserved; /*! align to 8. */ +} ia_isp_bxt_motion_vectors_t; + +typedef struct +{ + ia_isp_bxt_statistics_header_t header; /*!< Header data. */ + int32_t sum_of_diff[BXT_PAF_STATS_GRID_MAX_NUM_ELEMENTS]; /*!< Sum of phase differences from blocks. */ +}ia_isp_bxt_paf_grid_t; + +typedef struct +{ + float32_t r; /*!< Compensation gain for R */ + float32_t gr; /*!< Compensation gain for Gr */ + float32_t gb; /*!< Compensation gain for Gb */ + float32_t b; /*!< Compensation gain for B */ + float32_t isp; /*!< Compensation gain to be used as ISP gain in the pipeline */ +} ia_isp_bxt_ir_compgain_t; + +#endif /* IA_ISP_BXT_STATISTICS_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_isp_bxt_types.h b/include/ipu8/ia_imaging/ia_isp_bxt_types.h new file mode 100644 index 0000000..2120ee9 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_isp_bxt_types.h @@ -0,0 +1,202 @@ +/* + * Copyright 2017-2020 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_types.h +*/ + +#ifndef IA_ISP_BXT_TYPES_H_ +#define IA_ISP_BXT_TYPES_H_ + +#include "ia_types.h" +#include /* defines fixed width integers */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ia_isp_bxt_t ia_isp_bxt; + +/*! + * \brief Input structure for resolution changing ISP block. + * + * If ISP block changes resolution as part of its processing, this structure defines + * resolutions and cropping parameters for one input and output pins. If ISP block has + * multiple outputs, structure needs to be passed for each output pin. Order of operations: + * + * -# Input image is cropped according to input_crop structure parameters. New cropped input resolution is calculated. + * -# Cropped input image is scaled from cropped input resolution to output resolution (output_width & output_height). + * -# Output image is cropped according to output_crop structure parameters. + * + * If ISP block doesn't change resolution of the image as part of its processing, this structure defines + * resolution changes done to the image from the beginning of the pipe until now. For example if some scaling or + * cropping was done before, they are combined. + * + * Example: + * + * -# Sensor outputs 6528 x 4896. Sensor crops 3264 x 2448 ROI from bottom right corner. + * -# ISP block downscales the image from 3264 x 2448 to 2176 x 1632 (scale 0.6667) and crops to 1920 x 1080 (RCB): + * - resolution_info { 6528, 4896, { 3264, 2448, 0, 0 }, 2176, 1632, { 128, 276, 128, 276 } } + * + * -# ISP block needs to know what resolution changes were done with respect to full sensor frame: + * - resolution_history { 6528, 4896, { 3264+(128/0.6667), 2448+(276/0.6667), (128/0.6667), (276/0.6667) }, 1920, 1080, { 0, 0, 0, 0 } } + * + * -# ISP block forther downscales the image to 1280 x 720 (RCB): + * - resolution_info { 1920, 1080, { 0, 0, 0, 0 }, 1280, 720, { 0, 0, 0, 0 } } + * + * -# ISP block needs to know what resolution changes were done: + * - resolution_history { 6528, 4896, { 3264+(128/0.6667), 2448+(276/0.6667), (128/0.6667), (276/0.6667) }, 1280, 720, { 0, 0, 0, 0 } } + * + */ + +/*! +* \brief Metadata buffer indices for ia_isp_bxt_run_kernels_t structure. +*/ +typedef enum +{ + kernel_metadata_paf_frame_width = 0, /*!< Widht of PDAF frame buffer (used by DPC and PAF Statistics). */ + kernel_metadata_paf_frame_height /*!< Height of PDAF frame buffer (used by DPC and PAF Statistics). */ +} run_kernels_metadata_t; + +#pragma pack(push, IA_RESOLUTION_STATIC_GRAPH_PACK) +typedef struct ia_isp_bxt_resolution_info +{ + /* + * IMPORTANT! do not do *ANY* change in this struct without coordinate with SW and Tools teams. + * This struct is being used by casting data from a binary file and hence cannot be changed. + */ + int input_width; /*!< Input image width. */ + int input_height; /*!< Input image height. */ + ia_rectangle input_crop; /*!< Crop offsets for input image. Cropping happens before processing the input image. */ + int output_width; /*!< Output image width. */ + int output_height; /*!< Output image height. */ + ia_rectangle output_crop; /*!< Crop offsets for output image. Cropping happens after scaling to output resolution. */ +} ia_isp_bxt_resolution_info_t; + +/*! +* \brief Defines how ISP kernel should modify bit depth of image passing through it. +* Note: Not all ISP kernels are able to change depth of image data which it's processing. +*/ +typedef struct ia_isp_bxt_bpp_info +{ + /* + * IMPORTANT! do not do *ANY* change in this struct without coordinate with SW and Tools teams. + * This struct is being used by casting data from a binary file and hence cannot be changed. + */ + int32_t input_bpp; /*!< Bit depth of image going in to a particular ISP kernel. */ + int32_t output_bpp; /*!< Bit depth of output going out from a particular ISP kernel. */ +} ia_isp_bxt_bpp_info_t; +#pragma pack(pop) + +/*! +* \brief Describes options for run-time kernel control. +*/ +typedef enum +{ + kernel_passthrough = 0, + kernel_enable, + kernel_disable +} ia_isp_bxt_enable_control_t; + +typedef struct ia_isp_bxt_run_kernels +{ + uint32_t stream_id; /*!< Used to identify, in which branch of the pipe the kernel is located. */ + uint32_t kernel_uuid; /*!< ia_pal_uuid. ISP API (output) UUID. */ + int32_t enable; /*!< Run-time control to passthrough, enable or disable kernel. */ + ia_isp_bxt_resolution_info_t *resolution_info; /*!< Resolution change to be done in this kernel. NULL, if kernel doesn't change resolution. */ + ia_isp_bxt_resolution_info_t *resolution_history; /*!< Resolution changes done before current kernel with respect to sensor output. NULL, if not available*/ + uint32_t metadata[4]; /*!< Kernel specific metadata. For example image data format etc. */ + ia_isp_bxt_bpp_info_t bpp_info; /*!< Kernel specific input and output bits per pixel values. */ + uint32_t output_count; /*!< Number of outputs this kernel has, this means that in this structure the pointer to resolution_info can + be interpreted as an array of this size */ + ia_binary_data system_api; /*!< Used by system devices to get system information from graph */ +} ia_isp_bxt_run_kernels_t; + +typedef struct +{ + uint32_t kernel_uuid; /*!< ia_pal_uuid */ + uint32_t flags; +#define IA_ISP_BXT_PIPE_LAST (1 << 0) /*!< this is the last kernel in the array */ +#define IA_ISP_BXT_PIPE_FIRST (1 << 1) /*!< this is the first kernel in a path */ +#define IA_ISP_BXT_PIPE_TERMINAL (1 << 2) /*!< this is not a kernel but a terminal. + In this case, kernel_uuid is the terminal id */ +#define IA_ISP_BXT_PIPE_RCB (1 << 3) /*!< this kernel is a resolution changing block */ +} ia_isp_bxt_pipe_t; + +typedef struct ia_isp_bxt_program_group +{ + unsigned int kernel_count; /*!< Number of kernels in the program group .*/ + ia_isp_bxt_run_kernels_t *run_kernels; /*!< Array of kernels in the program group. */ + unsigned int operation_mode; /*!< Operation mode for selecting proper tunings. Is usually associated to different resolutions. */ + ia_isp_bxt_pipe_t *pipe; /*!< The graph of kernels in the program group .*/ +} ia_isp_bxt_program_group; + +/*! +* \brief ia_isp_pal_status_t keeps track of PAL kernel status. +*/ +typedef struct ia_isp_pal_status_t +{ + int32_t uuid; + int32_t status_id; +} ia_isp_pal_status_t; + +typedef struct +{ + bool rgbs_grid; /*!< If true, RGBS grid is available. */ + bool af_grid; /*!< If true, AF grid is available. */ + bool histograms; /*!< If true, histograms are available. */ + bool dvs_stats; /*!< If true, DVS statistics are available. */ + bool rgbs_grids_hdr; /*!< If true, RGBS HDR grids are available. */ + bool rgby_grids_hdr; /*!< If true, RGBY stat for high precision histogram is available. */ + bool yv_grids_hdr; /*!< If true, YV HDR grids are available. */ + bool paf_grid; /*!< If true, PAF grid is available. */ +} ia_isp_bxt_statistics_query_results_t; + +/*! + * \brief Describes options to decompress Y (luma). + */ +typedef enum +{ + ia_isp_bxt_hdr_y_decompression_max_rgb, /*!< Use RGB max to calculate Y (luma). */ + ia_isp_bxt_hdr_y_decompression_avg_rgb /*!< Use RGB average to calculate Y (luma). */ +} ia_isp_bxt_hdr_y_compression_method_t; + +/*! + * \brief Describes the parameters used in HDR compression algorithm. + * Sensor/ISP may merge the HDR image and then compress the data to preserve data from different parts of the dynamic range. + * Compression is most often done to save memory. For example, merged 20 bit (input) image data could be compressed to fit into (output) 15 bits. + * Parameters in this structure are used to decompress HDR statistics back to linear space. + */ +typedef struct +{ + ia_isp_bxt_hdr_y_compression_method_t y_compression_method; /*!< Used decompression method. */ + ia_isp_bxt_bpp_info_t bpp_info; /*!< Input and output bits per pixel values. */ +} ia_isp_bxt_hdr_compression_t; + +/*! + * \brief Structure describes the parameters used in HDR statistics. + */ +typedef struct +{ + unsigned char num_exposures; /*!< Mandatory. Number of exposures the sensor supports/outputs. */ + float *hdr_ratios; /*!< Mandatory. HDR ratio of [L/S S/VS etc.] for stitching. The effective length is determined by num_exposures-1. */ + ia_isp_bxt_hdr_compression_t *ia_isp_bxt_hdr_compression; /*!< Optional. NULL, if HDR statistics are already in linear space (no compression). */ +} ia_isp_bxt_hdr_params_t; + +#ifdef __cplusplus +} +#endif +#endif /* IA_ISP_BXT_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_isp_types.h b/include/ipu8/ia_imaging/ia_isp_types.h new file mode 100644 index 0000000..60200e6 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_isp_types.h @@ -0,0 +1,115 @@ +/* + * Copyright 2014-2021 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_ + +#include "ia_aiq_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; + +typedef enum +{ + ia_isp_call_rate_always, /* Always execute whenever ia_isp_bxt_run is called */ + ia_isp_call_rate_reduce_on_converged, /* Reduce the call rate if the AIQ results keep converged */ + ia_isp_call_rate_never_on_converged /* Do not execute ia_isp_bxt_run if the AIQ results keep converged */ +} ia_isp_call_rate_mode; + +typedef struct +{ + ia_isp_call_rate_mode mode; + int execution_interval; /* Execution interval in us, when the mode is ia_isp_call_rate_reduce_on_converged. */ +} ia_isp_call_rate_control; + +typedef struct +{ + int32_t rgb2yuv_coef[9]; /* One 3x3 martix for RGB to YUV conversion, each value is normalized to 1000 */ +} ia_isp_bxt_csc; + +#ifdef __cplusplus +} +#endif + +#endif /* IA_ISP_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_lard.h b/include/ipu8/ia_imaging/ia_lard.h new file mode 100644 index 0000000..7cbd4be --- /dev/null +++ b/include/ipu8/ia_imaging/ia_lard.h @@ -0,0 +1,150 @@ +/* + * Copyright 2012 - 2021 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_lard.h + * \brief Lard PCF parser specific implementation. + */ + +#ifndef IA_LARD_H_ +#define IA_LARD_H_ + +#include "ia_types.h" +#include "ia_mkn_types.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \brief available group tags, each group contains all of the tuning modes, + * each mode, contains all of the records which are used for the different filters tunings. + */ +#define LCMC_TAG IA_MKN_CHTOUL('L','C','M','C') /*!< CMC group header tag. */ +#define LAIQ_TAG IA_MKN_CHTOUL('L','A','I','Q') /*!< 3A+ group header tag. */ +#define LISP_TAG IA_MKN_CHTOUL('L','I','S','P') /*!< ISP group header tag. */ +#define LTHR_TAG IA_MKN_CHTOUL('L','T','H','R') /*!< Others group header tag. */ + + +typedef struct ia_lard_t ia_lard; + +/*! + * \brief Initialize IA_LARD. + * This function must be called before any other function in the library. It allocates needed memory and + * parses given Lard CPF data. Initialization returns a handle to data of all parsed items, if given + * data is valid Lard CPF data. + * + * \param[in] lard_data_ptr Mandatory although function will not return error, if it not given.\n + * \return IA_LARD handle. Use the returned handle as input parameter for the consequent IA_LARD calls. + */ +LIBEXPORT ia_lard* +ia_lard_init(const ia_binary_data *lard_data_ptr); + +/*! + * \brief De-initialize IA_LARD. + * All memory allocated by LARD is freed. LARD handle can no longer be used. + * + * \param[in] ia_lard Mandatory.\n + * LARD instance handle. + */ +LIBEXPORT void +ia_lard_deinit(ia_lard *ia_lard_ptr); + +/*! + * \brief Input parameter structure for Lard run. + * Please NOTICE! + * the ISP group can use either index OR tag, the other groups are using tags to get + * the correct thing mode. + * for example + * cmc_mode_tag = 'D','F','L','T' + * aiq_mode_tag = 'L','O','W','L' (low light tunings which the user made up) + * isp_mode_index = 1 OR 'D', 'F', 'L', 'T' + * others_mode_tag = 'D','F','L','T' + * + * + */ +typedef struct +{ + uint32_t cmc_mode_tag; /*!< Mandatory. CMC mode tag (4 letters) to be used with ia_lard_run. */ + uint32_t aiq_mode_tag; /*!< Mandatory. AIQ mode tag (4 letters) to be used with ia_lard_run. */ + uint32_t isp_mode_index; /*!< Mandatory. ISP mode index (number) or tag (4 letters) to be used with ia_lard_run. */ + uint32_t others_mode_tag; /*!< Mandatory. Other mode tag (4 letters)to be used with ia_lard_run. */ +} ia_lard_input_params; + +/*! +* \brief Output parameter structure for ia_lard_run. +* Pointers to aiqb data of requested mode for each of the groups. +*/ +typedef struct +{ + ia_binary_data aiqb_cmc_data; /*!< Mandatory. Aiqb binary data struct for CMC data. */ + ia_binary_data aiqb_aiq_data; /*!< Mandatory. Aiqb binary data struct for AIQ data. */ + ia_binary_data aiqb_isp_data; /*!< Mandatory. Aiqb binary data struct for ISP data. */ + ia_binary_data aiqb_other_data; /*!< Mandatory. Aiqb binary data struct for Other data. */ +} ia_lard_results; + +/*! + * \brief Lard run will give pointers to aiqb data of the requested modes of each group. + * + * \param[in] ia_lard_ptr Mandatory.\n + * Lard instance handle. + * \param[in] lard_input_params_ptr Mandatory.\n + * Input parameters to tell modes that client is requesting. + * \param[in/out] lard_results_ptr Mandatory. \n + * Output pointer to aiqb data blocks of specific modes + * that client were requested with lard_input_params_ptr. NULL will + * be set if no modes are requested in some group or data for that + * mode can't be found. + * \return Error code. + */ +LIBEXPORT ia_err +ia_lard_run( + ia_lard *ia_lard_ptr, + ia_lard_input_params *lard_input_params_ptr, + ia_lard_results **lard_results_ptr); + +/*! + * \brief Get version. + * Get version from version header. + * + * \return Lard version string. + */ +LIBEXPORT const char* +ia_lard_get_version(void); + + +/*! + * \brief Get a list of all of the available tags for a given group + * \param[in] ia_lard_ptr Mandatory.\n + * Lard instance handle. + * \param[in] mode_tag Mandatory.\n + * Mode tag (LAIQ, LISP, LCMC, LTHR) + * \param[out] num_tags Mandatory.\n + * number of tunings available for given mode tag + * \param[out] tags Mandatory.\n + * tags of available tunings for given mode tag + * \return Error code. + */ +LIBEXPORT ia_err ia_lard_get_tag_list(ia_lard* ia_lard_ptr, const uint32_t mode_tag, uint32_t* num_tags, const uint32_t** tags); + + +#ifdef __cplusplus +} +#endif + +#endif /* IA_LARD_H_ */ diff --git a/include/ipu8/ia_imaging/ia_log.h b/include/ipu8/ia_imaging/ia_log.h new file mode 100644 index 0000000..3a01bb0 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_log.h @@ -0,0 +1,117 @@ +/* + * Copyright 2021-2024 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_LOG_H_ +#define IA_LOG_H_ + +#include "ia_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __func__ +/*LDRA_INSPECTED 219 S */ +/*LDRA_INSPECTED 86 S */ +/*LDRA_INSPECTED 626 S */ +#define __func__ __FUNCTION__ +#endif + +/*! + * \brief Macro for not logging. + */ +#define IA_NOLOG(...) (CAST_TO_TYPE(void, 0)) /* LDRA_INSPECTED 58 S */ +/*! + * \brief Macro wrapper for ia_log function. + */ +#define IA_LOG(level, fmt, ...) (CAST_TO_TYPE(void, ia_log((level), (fmt), ## __VA_ARGS__))) + +/*! + * \brief Macro wrapper for ia_log_with_tag function. + */ +#define IA_LOG_TAG(tag, level, fmt, ...) (CAST_TO_TYPE(void, ia_log_with_tag((tag), (level), (fmt), ## __VA_ARGS__))) + +/*! + * \brief Logging levels. + */ +typedef enum +{ + ia_log_error, + ia_log_debug, + ia_log_info, + ia_log_perf, +} 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. + */ + +/*LDRA_INSPECTED 306 S */ +LIBEXPORT void +ia_log(ia_log_level level, const char *fmt, ...); + +/*! + * \brief Prints formatted string with log tag + * + * + * \param[in] print_tag Log level. + * \param[in] level Log level. + * \param[in] fmt Format string. + * \param[in] ... Variables to be printed out as defined by the format string. + */ + +/*LDRA_INSPECTED 306 S */ +LIBEXPORT void +ia_log_with_tag(const char *print_tag, 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(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_LOG_H_ */ diff --git a/include/ipu8/ia_imaging/ia_ltm.h b/include/ipu8/ia_imaging/ia_ltm.h new file mode 100644 index 0000000..a0be0fa --- /dev/null +++ b/include/ipu8/ia_imaging/ia_ltm.h @@ -0,0 +1,147 @@ +/* + * Copyright 2016-2021 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. + */ + +/*! + * \note IA LTM API documentation + * + * Browse Files and Classes tabs for details. + * + * \section LTM General info + * + * \section LTM 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 + * + *


+ */ +/*! + * \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_isp_bxt_statistics_types.h" +#include "ia_mkn_types.h" +#include "ia_ltm_deprecated.h" +#include "ia_bcomp_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 Set tuning to an existing LTM instance. +* This function can be used to switch tunings on-the-fly in a way that LTM preserves its state and offers smooth transition from one tuning to another. +*/ +LIBEXPORT ia_err +ia_ltm_set_tuning(ia_ltm *ia_ltm, + const ia_binary_data *tuning_data_ptr); + +/*! + * \brief Input parameter structure for LTM/DRC algorithm. + * Note that, even though all the input statistics and image are optional (i.e. yv_grid, rgbs,grid_ptr, hdr_rgbs_grid_ptr and input_image_ptr), + * one of them is always needed. While certain LTM algorithms (selectable from tunings) can utilize different input, all algorithms can operate + * on input_image_ptr data. Some inputs may provide certain PnP or IQ advantages over others, so all inputs should still be set if available in + * order to allow the tuner make the appropriate choice (for instance rgbs_grid_ptr and hdr_rgbs_grid_ptr). Notice that input image or statistics + * may or may not contain WB gains and CCM applied. Parameters needed by Optibright algorithm are marked with '(ob)' and parameters needed by LBCE are + * marked with '(lb)'. + */ +typedef struct ia_ltm_input_params_v2 +{ + ia_ltm_level ltm_level; /*!< Mandatory. LTM level. -1 to use tuning defaults.*/ + float ev_shift; /*!< Optional. (ob) Exposure Value shift [-4,4]. */ + char ltm_strength_manual; /*!< Optional. (ob) 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. (ob) AEC output will be used by LTM.*/ + ia_isp_bxt_hdr_yv_grid_t *yv_grid; /*!< Optional. (ob) Statistics used to calculate LTMs. (available only in IPU4 using FW DRC). */ + 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. (lb) 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. (lb) 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. (ob)(lb) 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_gtm_input_params *gtm_input_params_ptr; /*!< Optional. (ob) GTM parameters of LTM if GTM should be applied inside LTM. */ + const ia_bcomp_results *bcomp_results; /*!< Optional. (lb) Compression curve for DOL sensors */ +} ia_ltm_input_params_v2; + +/*! + * \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. + * \param[out] ltm_results_drc ia_ltm_drc param.\n + * \return Error code. + */ +LIBEXPORT ia_err +ia_ltm_run_v2(ia_ltm *ia_ltm, + const ia_ltm_input_params_v2 *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/ipu8/ia_imaging/ia_ltm_deprecated.h b/include/ipu8/ia_imaging/ia_ltm_deprecated.h new file mode 100644 index 0000000..b8dabf3 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_ltm_deprecated.h @@ -0,0 +1,103 @@ +/* + * Copyright 2016-2020 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_deprecated.h + * \brief Definitions and declarations of Intel LTM library. + */ + + +#ifndef _IA_LTM__DEPRECATED_H_ +#define _IA_LTM__DEPRECATED_H_ + +#include "ia_ltm_types.h" +#include "ia_types.h" +#include "ia_aiq_types.h" +#include "ia_bcomp_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \brief Input parameter structure for LTM/DRC algorithm. + * Note that, even though all the input statistics and image are optional (i.e. yv_grid, rgbs,grid_ptr, hdr_rgbs_grid_ptr and input_image_ptr), + * one of them is always needed. While certain LTM algorithms (selectable from tunings) can utilize different input, all algorithms can operate + * on input_image_ptr data. Some inputs may provide certain PnP or IQ advantages over others, so all inputs should still be set if available in + * order to allow the tuner make the appropriate choice (for instance rgbs_grid_ptr and hdr_rgbs_grid_ptr). Notice that input image or statistics + * may or may not contain WB gains and CCM applied. Parameters needed by Optibright algorithm are marked with '(ob)' and parameters needed by LBCE are + * marked with '(lb)'. + */ +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. (ob) Exposure Value shift [-4,4]. */ + char ltm_strength_manual; /*!< Optional. (ob) 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. (ob) AEC output will be used by LTM.*/ + ia_isp_bxt_hdr_yv_grid_t *yv_grid; /*!< Optional. (ob) Statistics used to calculate LTMs. (available only in IPU4 using FW DRC). */ + 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. (lb) 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. (lb) 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. (ob)(lb) 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_gtm_input_params *gtm_input_params_ptr; /*!< Optional. (ob) GTM parameters of LTM if GTM should be applied inside LTM. */ +} ia_ltm_input_params; + +typedef struct ia_ltm_input_params_v1 +{ + ia_ltm_level ltm_level; /*!< Mandatory. LTM level. -1 to use tuning defaults.*/ + float ev_shift; /*!< Optional. (ob) Exposure Value shift [-4,4]. */ + char ltm_strength_manual; /*!< Optional. (ob) 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. (ob) AEC output will be used by LTM.*/ + ia_isp_bxt_hdr_yv_grid_t *yv_grid; /*!< Optional. (ob) Statistics used to calculate LTMs. (available only in IPU4 using FW DRC). */ + 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. (lb) 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. (lb) 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. (ob)(lb) 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_gtm_input_params *gtm_input_params_ptr; /*!< Optional. (ob) GTM parameters of LTM if GTM should be applied inside LTM. */ +} ia_ltm_input_params_v1; + +/*! + * \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); + +LIBEXPORT ia_err +ia_ltm_run_v1(ia_ltm *ia_ltm, + const ia_ltm_input_params_v1 *ltm_input_params, + ia_ltm_results **ltm_results, + ia_ltm_drc_params **ltm_results_drc); + + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_LTM__DEPRECATED_H_ */ diff --git a/include/ipu8/ia_imaging/ia_ltm_types.h b/include/ipu8/ia_imaging/ia_ltm_types.h new file mode 100644 index 0000000..5fc11ff --- /dev/null +++ b/include/ipu8/ia_imaging/ia_ltm_types.h @@ -0,0 +1,151 @@ +/* + * Copyright 2016-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. + */ + +/*! + * \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 +#include "ia_isp_bxt_statistics_types.h" + +#define GTM_LUT_SIZE 32 +#define GCE_DEFOG_LUT_SIZE 64 +#define NUM_TONE_MAP_PWL_SEGMENTS 7 /*!< Local curves in piece-wise-linear form (7 pieces)*/ +#define MAX_LUT_WIDTH 145 +#define MAX_LUT_HEIGHT 500 +#define MAX_NUM_LUT 500 /*!< Max. possible number of grids in GammaStar (25 x 20) */ + +#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. */ + float dynamic_range; /*!< Estimated scene's dynamic range from 0 to 100. Scene has wider dynamic range when this gets closer to 100. + Currently only Optibright outputs this value and this would be zero always for all other LTM algorithms. */ +} ia_ltm_results; + +/*! + * \brief GTM parameters for DRC. + */ + +typedef struct ia_ltm_gce_defog +{ + int32_t offset_vec[GCE_DEFOG_LUT_SIZE]; /* U15 */ + int32_t slope_vec[GCE_DEFOG_LUT_SIZE]; /* S15 */ + int32_t x_cord_vec[GCE_DEFOG_LUT_SIZE]; /* U15 */ + int32_t x_cord_max; /* U15 */ + int32_t exponent; /* U4 */ + int32_t resolution; /* U4 */ + int32_t A0; + int32_t A1; + int32_t ltm_bypass; + int32_t ltm_weight; /* U15 */ + int32_t defog_enable; + int32_t defog_enhance; +} ia_ltm_gce_defog; + +typedef struct ia_ltm_drc_gtm +{ + unsigned short gtm_bypass; + unsigned short xcu_gtm_offset_vec[GTM_LUT_SIZE]; + short xcu_gtm_slope_vec[GTM_LUT_SIZE]; + unsigned short xcu_gtm_x_cord_vec[GTM_LUT_SIZE]; + 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_gce_defog gce_defog; /*! GCE/DEFOG parameters. */ +} ia_ltm_drc_params; + +/*! + * \brief GTM parameters for GTM part of LTM. + * If GTM is applied inside LTM this structure is used for passing arguments to GTM. In case that GTM is applied + * inside LTM, GBCE and GammaTM ISP block should be disabled. + */ +typedef struct +{ + float manual_gain; /*!< Mandatory. Manual gain. -1.0 if NA */ + float manual_convergence_time; /*!< Mandatory. Manual brightness convergence speed in seconds. -1.0 if NA. */ + unsigned long long frame_timestamp; /*!< Mandatory. Current time stamp in micro seconds. */ +} ia_ltm_gtm_input_params; + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_LTM_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_misra_types.h b/include/ipu8/ia_imaging/ia_misra_types.h new file mode 100644 index 0000000..b10cca0 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_misra_types.h @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2021 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_misra_types.h + \brief MISRA typedefs +*/ +#ifndef _IA_MISRA_TYPES_H_ +#define _IA_MISRA_TYPES_H_ + +#ifndef BUILDIN_TYPE +#define BUILDIN_TYPE +typedef float float32_t; +typedef double float64_t; +#endif + + +#endif /* _IA_MISRA_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_mkn_encoder.h b/include/ipu8/ia_imaging/ia_mkn_encoder.h new file mode 100644 index 0000000..a102f60 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_mkn_encoder.h @@ -0,0 +1,168 @@ +/* + * Copyright 2012-2022, 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 +#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] a_mkn_config_bits Mandatory.\n + * Configuration flag bits. + * \param[in] a_mkn_section_1_size Mandatory.\n + * Size of Section 1 data buffer. + * \param[in] a_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 a_mkn_config_bits, + size_t a_mkn_section_1_size, + size_t a_mkn_section_2_size); + +/*! + * \brief Deletes Make Note system handle. + * + * \param[in] a_mkn_ptr Mandatory. \n + * Pointer to makernote handle. + * \par Returns + * Nothing. + */ +LIBEXPORT void +ia_mkn_uninit(ia_mkn *a_mkn_ptr); + +/*! + * \brief Reset Make Note system to default state. + * + * \param[in] a_mkn_data_ptr Mandatory. \n + * Pointer to makernote handle obtained from ia_mkn_init function call. + * \return Error code. + */ +LIBEXPORT ia_err +ia_mkn_reset(ia_mkn *a_mkn_data_ptr); + +/*! + * \brief Adds or updates a data record in the makernote. + * + * \param[in] a_mkn_data_ptr Mandatory. \n + * Pointer to makernote handle obtained from ia_mkn_init function call. + * \param[in] a_data_format_id Mandatory.\n + * Record data format ID. + * \param[in] a_data_name_id Mandatory.\n + * Record name ID. + * \param[in] a_data_ptr 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] a_num_elements Mandatory.\n + * Number of elements to store. + * \param[in] a_key Mandatory.\n + * Packing key (16 bytes). NULL means 'no packing'. + * \return Error code. +*/ +LIBEXPORT ia_err +ia_mkn_add_record(ia_mkn *a_mkn_data_ptr, + ia_mkn_dfid a_data_format_id, + ia_mkn_dnid a_data_name_id, + const void *a_data_ptr, + uint32_t a_num_elements, + const char *a_key); + +/*! + * \brief Deletes a data record from the makernote. + * + * \param[in] a_mkn_data_ptr Mandatory. \n + * Pointer to makernote handle obtained from ia_mkn_init function call. + * \param[in] a_data_format_id Mandatory.\n + * Record data format ID. + * \param[in] a_data_name_id Mandatory.\n + * Record name ID. + * \return Error code. +*/ +LIBEXPORT ia_err +ia_mkn_delete_record(ia_mkn *a_mkn_data_ptr, + ia_mkn_dfid a_data_format_id, + ia_mkn_dnid a_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] a_mkn_data_ptr Mandatory. \n + * Pointer to makernote handle obtained from ia_mkn_init function call. + * \param[in] a_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 *a_mkn_data_ptr, + ia_mkn_trg a_data_target); + +/*! + * \brief Enable/Disable makernote data collecting. + * + * \param[in] a_mkn_data_ptr Mandatory. \n + * Pointer to makernote handle obtained from ia_mkn_init function call. + * \param a_enable_data_collection Mandatory.\n + * Enable/disable data collection. + * \return Error code. +*/ +LIBEXPORT ia_err +ia_mkn_enable(ia_mkn *a_mkn_data_ptr, + bool a_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] a_mkn_trg_ptr Target makernote. Source makernote will be merged into this. + * \param[in] a_mkn_src_ptr Source makernote. + * \return Error code. + */ +LIBEXPORT ia_err +ia_mkn_merge(ia_mkn *a_mkn_trg_ptr, + const ia_mkn *a_mkn_src_ptr); + +/*! + * \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] a_mknt_data_ptr Pointer to the makernote (MKNT) binary data. + * \return Pointer to the makernote handle. + */ +LIBEXPORT ia_mkn* +ia_mknt_to_mkn(const ia_binary_data *a_mknt_data_ptr); + +#ifdef __cplusplus +} +#endif + +#endif /* IA_MKN_ENCODER_H_ */ diff --git a/include/ipu8/ia_imaging/ia_mkn_types.h b/include/ipu8/ia_imaging/ia_mkn_types.h new file mode 100644 index 0000000..4a91400 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_mkn_types.h @@ -0,0 +1,182 @@ +/* + * Copyright 2012-2025 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 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +#define CAST_TYPE(type, value) (static_cast(value)) +#else +#define CAST_TYPE(type, value) ((type)(value)) +#endif + +/*! + * \brief combines 4 chars into one unsigned long integer. + */ +#define IA_MKN_CHTOUL(a,b,c,d) \ + ( CAST_TYPE(uint32_t, a) | (CAST_TYPE(uint32_t, b)<<8) | (CAST_TYPE(uint32_t, c)<<16) | (CAST_TYPE(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 void ia_mkn; + +/*! + * Start of MKN System enumeration set. + * \brief Enumerations set for Maker Note System. + * This part contains 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 0x14012702U + +/*! + * \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 Data Name ID (DNID) enumeration for cca_flow library. + * Range is 245 - 255. Data Name ID less than 245 defined in ia_aiq_mkn_dnid enum in ia_aiq_mkn_records.h + * Data Name ID from 256 defined in ia_mkn_dnid enum in this file + */ +typedef enum +{ + ia_mkn_dnid_AWB_Results_Manual = 245, /*!< Used for saving Override AWB values */ + ia_mkn_dnid_cca_flow_records_last /*!< Total number of data names, keep this enum member as a last one!. */ +} ia_mkn_dnid_cca_flow_records; + + +/*! + * \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/ipu8/ia_imaging/ia_nvm.h b/include/ipu8/ia_imaging/ia_nvm.h new file mode 100644 index 0000000..e0f6670 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_nvm.h @@ -0,0 +1,183 @@ +/* + * INTEL CONFIDENTIAL + * Copyright (c) 2012-2025 Intel Corporation + * All Rights Reserved. + * + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Intel Corporation or its + * suppliers or licensors. Title to the Material remains with Intel + * Corporation or its suppliers and licensors. The Material may contain trade + * secrets and proprietary and confidential information of Intel Corporation + * and its suppliers and licensors, and is protected by worldwide copyright + * and trade secret laws and treaty provisions. No part of the Material may be + * used, copied, reproduced, modified, published, uploaded, posted, + * transmitted, distributed, or disclosed in any way without Intel's prior + * express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or + * delivery of the Materials, either expressly, by implication, inducement, + * estoppel or otherwise. Any license under such intellectual property rights + * must be express and approved by Intel in writing. + * + * Unless otherwise agreed by Intel in writing, you may not remove or alter + * this notice or any other notice embedded in Materials by Intel or Intels + * suppliers or licensors in any way. + */ + +/*! + * \file ia_nvm.h + * \brief Definitions of NVM (Non-Volatile Memory) data parser. +*/ + +#ifndef _IA_NVM_H_ +#define _IA_NVM_H_ + +#include +#include "ia_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define IA_NVM_NUM_CHANNELS 4 +#define IA_NVM_LSC_BIT_DEPTH_THRESHOLD 8U +#define IA_NVM_MIN_LSC_WIDTH 7 +#define IA_NVM_MIN_LSC_HEIGHT 5 +#define IA_NVM_SENSITIVITY_BIT_DEPTH 10U +#define IA_NVM_CIE_RANGE_MIN 0.270 +#define IA_NVM_CIE_RANGE_MAX 0.490 + +#define IA_NVM_INTERFACE_PDAF_MAJOR_VERSION 2 + +#define IA_NVM_STATIC_BUFFER_SIZE_V1 10U +#define IA_NVM_STATIC_BUFFER_SIZE_V2 12U /*new nvm format with PDAF fields added*/ + +/*! + * \brief NVM parsing status codes. + */ +typedef enum +{ + ia_nvm_error_none, /*!< No error. */ + ia_nvm_error_internal, /*!< Parser internal failure (not enough memory). */ + ia_nvm_error_no_data, /*!< NULL pointer as input or not enough input data. */ + ia_nvm_error_af, /*!< Error parsing AF parameters. */ + ia_nvm_error_lsc, /*!< Error parsing AF parameters. (lsc dimensions, lsc data) */ + ia_nvm_error_awb, /*!< Error parsing AWB parameters (sensitivities, n_lights). */ + ia_nvm_error_crc, /*!< CRC check error. */ + ia_nvm_error_not_used, /*!< No error in NVM data but NVM data is not used. */ + ia_nvm_error_not_implemented, /*!< Parser for given data type has not been implemented. */ + ia_nvm_error_version, /*!< invalid version. */ + ia_nvm_error_pdaf, /*!< Error parsing PDAF parameters */ + ia_nvm_error_vcm, /*!< Error parsing Closed loop vcm parameters*/ +} ia_nvm_error; + +/*! + * \brief PDAF PS Table data layout in NVM (Non-Volatile Memory) data. + */ +typedef struct +{ + uint16_t* pdaf_ps_left; /*!< PS Gain tables for Left Pixels */ + uint16_t* pdaf_ps_right; /*!< PS Gain tables for Right Pixels */ +} ia_nvm_pdaf_ps; + +/*! + * \brief PDAF data layout in NVM (Non-Volatile Memory) data. + */ +typedef struct +{ + uint8_t pdaf_ps_sensor_modes; /*!< number of sensor modes calibrated for PS */ + uint8_t pdaf_ps_knots_width; /*!< number of PS knots across width */ + uint8_t pdaf_ps_knots_height; /*!< number of PS knots across height */ + uint8_t pdaf_ps_frac_bits; /*!< PS Fractional Bit depth */ + ia_nvm_pdaf_ps *pdaf_ps_tables; /*!< PS tables for all the sensor modes */ + uint8_t pdaf_dlom_knots_width; /*!< number of DLOM knots across width */ + uint8_t pdaf_dlom_knots_height; /*!< number of DLOM knots across height */ + uint8_t pdaf_dlom_frac_bits; /*!< DLOM Fractional Bit Depth */ + int32_t* pdaf_dlom_tables; /*!< DLOM tables */ +} ia_nvm_pdaf_data; + +/*! + * \brief Closed loop vcm calibration data layout in NVM (Non-Volatile Memory) data. + */ +typedef struct +{ + uint8_t closed_loop_hall_offset_vert; /*!< vertical distance b/w Hall sensor and Magnet */ + uint8_t closed_loop_hall_bias_horz; /*!< horizontal distance b/w Hall sensor and Magnet */ + uint16_t closed_loop_hall_min; /*!< Hall sensor movement minimum limit */ + uint16_t closed_loop_hall_max; /*!< Hall sensor movement maximum limit */ +} ia_nvm_closed_loop_vcm; + +/*! + * \brief LSC table layout in NVM (Non-Volatile Memory) data. + * LSC tables are one after another for N amount of lights. One LSC table consists of tables for 4 channels in order: Ch1, Ch2, Ch3 and Ch4. + */ +typedef struct +{ + uint8_t lsc_frac_bits; /*!< LSC fractional bit depth range 4-8. */ + void *lsc_tables[IA_NVM_NUM_CHANNELS]; /*!< LSC table for Ch1, Ch2, Ch3 and Ch4. Type depends on lsc_fraq_bits. If <= IA_NVM_LSC_BIT_DEPTH_THRESHOLD, then uint8_t, else uint16_t. */ +} ia_nvm_lsc; + + +typedef struct +{ + uint8_t major_version; /*!< Calibration data major version. */ + uint8_t minor_version; /*!< Calibration data minor version. */ + uint8_t n_pos; /*!< Number of AF measurement orientations. */ + uint8_t vcm_lps_bits; /*!< VCM lens position sensor bit depth (0 if N/A). */ + uint8_t vcm_bits; /*!< VCM register bit depth (8 or 16). */ + int16_t *vcm_af_near; /*!< VCM register values for n_pos for AF at near calibration distance (supplier specific). */ + int16_t *vcm_af_far; /*!< VCM register values for n_pos for AF at far calibration distance (supplier specific). */ + int16_t *vcm_af_start; /*!< VCM register values for n_pos for AF at lens start.DEPRECATED.the parameter must not be used */ + int16_t *vcm_af_end; /*!< VCM register values for n_pos for AF at lens end.DEPRECATED the parameter must not be used */ + uint8_t n_lights; /*!< Number of light sources used for LSC and AWB. */ + uint8_t *cie_coords_x; /*!< CIE x coordinates for n_lights light sources. */ + uint8_t *cie_coords_y; /*!< CIE y coordinates for n_lights light sources. */ + uint8_t lsc_width; /*!< Width of all LSC tables. */ + uint8_t lsc_height; /*!< Height of all LSC tables. */ + ia_nvm_lsc *lsc; /*!< LSC tables for n_lights. */ + uint16_t *awb_sensitivities[IA_NVM_NUM_CHANNELS]; /*!< AWB sensitivities for n_lights in order: Ch1, Ch2, Ch3 and Ch4. */ + uint8_t pdaf_data_present; /*!< PDAF Calibration data present or not(0: no PDAF Data)*/ + ia_nvm_pdaf_data *pdaf_data; /*!< PDAF Calibration data */ + uint8_t closed_loop_data_present; /*!< closed loop vcm data present or not (0: no vcm data)*/ + ia_nvm_closed_loop_vcm *vcm; /*!< vcm data */ + uint16_t checksum; /*!< CRC-16 checksum calculated from all bytes before checksum. */ +} ia_nvm; + +/*! + * \brief Parses intel specified camera NVM data into ia_nvm structure. + * \param[in] a_nvm_ptr Camera NVM data in Intel specified format. + * \param[out] a_parsed_nvm_ptr Camera NVM in parsed (ia_nvm) structure. + * \return NVM parsing error code. + */ +LIBEXPORT ia_nvm_error +ia_nvm_parse(const ia_binary_data * a_nvm_ptr, + ia_nvm** a_parsed_nvm_ptr); + +/*! + * \brief Frees contents of ia_nvm structure. + * \param[in] parsed_nvm Camera NVM in parsed (ia_nvm) structure. + */ +LIBEXPORT void +ia_nvm_deinit(ia_nvm *a_nvm_ptr); + +/*! + * \brief Allocates memory and creates Intel specified camera NVM data from input structure. + * \param[in] parsed_nvm Structure containing values from which the binary will be created. + * \return Binary data containing the camera NVM in Intel specified format. + */ +LIBEXPORT ia_binary_data* +ia_nvm_binary_create(const ia_nvm *a_nvm_ptr); + +/*! + * \brief Deletes memory allocated by ia_nvm_binary_create() function. + * \param[in] nvm_binary Binary data created by function ia_nvm_binary_create. + */ +LIBEXPORT void +ia_nvm_binary_delete(ia_binary_data *a_nvm_binary_ptr); + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_NVM_H_ */ diff --git a/include/ipu8/ia_imaging/ia_ob.h b/include/ipu8/ia_imaging/ia_ob.h new file mode 100644 index 0000000..7f03d68 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_ob.h @@ -0,0 +1,92 @@ +/* + * Copyright 2017-2025 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 OB API documentation + * + * Browse Files and Classes tabs for details. + * + */ +/*! + * \file ia_ob.h + * \brief Definitions and declarations of IA OB library. + */ +#ifndef _IA_OB_H_ +#define _IA_OB_H_ + +#include "ia_types.h" + +#define IA_OB_DEBUG +#if defined IA_OB_DEBUG +#define IA_OB_LOG(fmt, ...) IA_LOG(ia_log_debug, "IAOB: " fmt, ## __VA_ARGS__) +#define IA_OB_LOG_ERROR(fmt, ...) IA_LOG(ia_log_error, "IAOB: ERROR: " fmt, ## __VA_ARGS__) +#define DEBUG_BUFFER_SIZE 1024*7 +#else +#define IA_OB_LOG IA_NOLOG +#define IA_OB_LOG_ERROR IA_NOLOG +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define IA_OB_VERSION "1.0.0.0" +typedef struct ia_ob_t ia_ob; + +typedef enum +{ + ia_ob_interleave_none, + ia_ob_interleave_two, +} ia_ob_interleave_mode; + +/*! + * \brief OB runtime input. + */ +typedef struct { + short *frame_data; /*!< fixed point image */ + unsigned int frame_width; /*!< current frame width (might be cropped) */ + unsigned int frame_height; /*!< current frame height (might be cropped) */ + unsigned int ob_top; + unsigned int ob_left; + unsigned int ob_width; + unsigned int ob_height; + ia_ob_interleave_mode interleave_step; +} ia_ob_input; + +/*! + * \brief OB per-run output. + */ +typedef struct { + float cc00; + float cc01; + float cc10; + float cc11; +} ia_ob_output; /*!< OB output for 4 color components */ + +LIBEXPORT ia_ob* +ia_ob_init(void); + +LIBEXPORT void +ia_ob_deinit(ia_ob *ia_ob); + +LIBEXPORT ia_err +ia_ob_run(ia_ob *ia_ob, + const ia_ob_input *ob_input, + ia_ob_output *ob_output); + +#ifdef __cplusplus +} +#endif +#endif /* _IA_OB_H_ */ diff --git a/include/ipu8/ia_imaging/ia_pal_types_isp_ids_autogen.h b/include/ipu8/ia_imaging/ia_pal_types_isp_ids_autogen.h new file mode 100644 index 0000000..00069b3 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_pal_types_isp_ids_autogen.h @@ -0,0 +1,168 @@ + +/* +* INTEL CONFIDENTIAL +* Copyright (c) 2023 Intel Corporation +* All Rights Reserved. +* +* The source code contained or described herein and all documents related to +* the source code (Material) are owned by Intel Corporation or its +* suppliers or licensors. Title to the Material remains with Intel +* Corporation or its suppliers and licensors. The Material may contain trade +* secrets and proprietary and confidential information of Intel Corporation +* and its suppliers and licensors, and is protected by worldwide copyright +* and trade secret laws and treaty provisions. No part of the Material may be +* used, copied, reproduced, modified, published, uploaded, posted, +* transmitted, distributed, or disclosed in any way without Intel's prior +* express written permission. +* +* No license under any patent, copyright, trade secret or other intellectual +* property right is granted to or conferred upon you by disclosure or +* delivery of the Materials, either expressly, by implication, inducement, +* estoppel or otherwise. Any license under such intellectual property rights +* must be express and approved by Intel in writing. +* +* Unless otherwise agreed by Intel in writing, you may not remove or alter +* this notice or any other notice embedded in Materials by Intel or Intel's +* suppliers or licensors in any way. +*/ + +#ifndef IA_PAL_TYPES_ISP_IDS_AUTOGEN_H +#define IA_PAL_TYPES_ISP_IDS_AUTOGEN_H + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + +typedef enum +{ + ia_pal_uuid_isp_acm_1_2 = 17531, + ia_pal_uuid_isp_aestatistics_2_1 = 55073, + ia_pal_uuid_isp_b2i_ds_1_1 = 40299, + ia_pal_uuid_isp_b2i_ds_output_1_1 = 50136, + ia_pal_uuid_isp_sw_scaler = 19706, + ia_pal_uuid_isp_bgb_1_0 = 45585, + ia_pal_uuid_isp_bnlm_3_4 = 45146, + ia_pal_uuid_isp_bxt_blc = 11700, + ia_pal_uuid_isp_bxt_demosaic = 48695, + ia_pal_uuid_isp_cas_1_1 = 9385, + ia_pal_uuid_isp_ccm_3a_2_0 = 62344, + ia_pal_uuid_isp_crop_bpp_adjust_1_0 = 36280, + ia_pal_uuid_isp_csc_1_1 = 62703, + ia_pal_uuid_isp_dol_lite_1_2 = 54871, + ia_pal_uuid_isp_dpc_2_2 = 33184, + ia_pal_uuid_isp_fr_grid_1_0 = 26958, + ia_pal_uuid_isp_gammatm_v4 = 5394, + ia_pal_uuid_isp_gd_2_2 = 13882, + ia_pal_uuid_isp_gd_dpc_2_1 = 22642, + ia_pal_uuid_isp_gdc7 = 21644, + ia_pal_uuid_isp_gdc_sp = 59334, + ia_pal_uuid_isp_gdc7_1 = 5637, + ia_pal_uuid_isp_glim_2_0 = 36029, + ia_pal_uuid_isp_gltm_2_0 = 54721, + ia_pal_uuid_isp_gmv_statistics_1_1 = 40280, + ia_pal_uuid_isp_is_odr_a = 11470, + ia_pal_uuid_isp_is_odr_b = 55449, + ia_pal_uuid_isp_is_odr_c = 50407, + ia_pal_uuid_isp_ifd_pipe_1_4 = 52446, + ia_pal_uuid_isp_ifd_pipe_long_1_4 = 24678, + ia_pal_uuid_isp_ifd_pipe_short_smth_1_4 = 4386, + ia_pal_uuid_isp_ifd_pdaf_1_4 = 22427, + ia_pal_uuid_isp_ifd_lsc_1_4 = 29313, + ia_pal_uuid_isp_odr_bnlm_1_4 = 53535, + ia_pal_uuid_isp_odr_pdaf_1_4 = 26892, + ia_pal_uuid_isp_odr_awb_sat_1_4 = 1248, + ia_pal_uuid_isp_odr_awb_sve_1_4 = 53430, + ia_pal_uuid_isp_odr_awb_std_1_4 = 38544, + ia_pal_uuid_isp_odr_ae_1_4 = 62556, + ia_pal_uuid_isp_odr_af_std_1_4 = 59136, + ia_pal_uuid_isp_odr_ir_1_4 = 60297, + ia_pal_uuid_isp_odr_burst_isp_1_4 = 28230, + ia_pal_uuid_isp_ifd_gmv_1_4 = 51073, + ia_pal_uuid_isp_odr_gmv_feature_1_4 = 7416, + ia_pal_uuid_isp_odr_gmv_match_1_4 = 41148, + ia_pal_uuid_isp_lbff_crop_espa_1_4 = 65466, + ia_pal_uuid_isp_ifd_segmap_bnlm_1_4 = 35263, + ia_pal_uuid_isp_ifd_segmap_xnr_1_4 = 9241, + ia_pal_uuid_isp_ifd_segmap_acm_1_4 = 51914, + ia_pal_uuid_isp_ifd_segmap_tnr_bc_1_4 = 47873, + ia_pal_uuid_isp_ifd_segmap_tnr_blend_1_4 = 14619, + ia_pal_uuid_isp_ifd_segmap_cas_1_4 = 20893, + ia_pal_uuid_isp_ifd_tnr_sp_bc_yuv4nm1_1_4 = 7357, + ia_pal_uuid_isp_ifd_tnr_sp_bc_rs4nm1_1_4 = 62054, + ia_pal_uuid_isp_odr_tnr_sp_bc_rs4n_1_4 = 63731, + ia_pal_uuid_isp_ifd_tnr_fp_blend_yuvnm1_1_4 = 16295, + ia_pal_uuid_isp_odr_tnr_fp_yuvn_1_4 = 5215, + ia_pal_uuid_isp_odr_tnr_scale_fp_yuv4n_1_4 = 65437, + ia_pal_uuid_isp_odr_ofs_mp_1_4 = 16460, + ia_pal_uuid_isp_odr_ofs_dp_1_4 = 37951, + ia_pal_uuid_isp_ifd_bgmap_1_4 = 40067, + ia_pal_uuid_isp_ifd_bg_yuv_1_4 = 15064, + ia_pal_uuid_isp_odr_dpc_pdaf_1_4 = 54812, + ia_pal_uuid_isp_isys_drainer_1_0 = 26150, + ia_pal_uuid_isp_linearization2_0 = 10326, + ia_pal_uuid_isp_lsc_1_2 = 2144, + ia_pal_uuid_isp_nntm_1_0 = 46539, + ia_pal_uuid_isp_pafstatistics_1_2 = 44308, + ia_pal_uuid_isp_pext_1_0 = 43213, + ia_pal_uuid_isp_rgb_ir_2_0 = 14488, + ia_pal_uuid_isp_rgbs_grid_1_1 = 15021, + ia_pal_uuid_isp_smurf_bnlm_1_0 = 54924, + ia_pal_uuid_isp_smurf_xnr_1_0 = 42329, + ia_pal_uuid_isp_smurf_acm_1_0 = 28366, + ia_pal_uuid_isp_smurf_tnr_bc_1_0 = 13101, + ia_pal_uuid_isp_smurf_tnr_blend_1_0 = 42749, + ia_pal_uuid_isp_smurf_cas_1_0 = 37468, + ia_pal_uuid_isp_tnr_scaler_lb_1_1 = 29996, + ia_pal_uuid_isp_tnr_scaler_fp_1_1 = 20623, + ia_pal_uuid_isp_tnr7_bc_1_2 = 1502, + ia_pal_uuid_isp_tnr7_blend_1_1 = 20119, + ia_pal_uuid_isp_tnr7_ims_1_2 = 23639, + ia_pal_uuid_isp_tnr7_mc_1_0 = 1886, + ia_pal_uuid_isp_tnr_sp_mc2 = 43550, + ia_pal_uuid_isp_tnr7_spatial_1_1 = 2495, + ia_pal_uuid_isp_upipe_1_0 = 5420, + ia_pal_uuid_isp_image_upscaler_1_1 = 28787, + ia_pal_uuid_isp_bgmap_upscaler_1_1 = 13074, + ia_pal_uuid_isp_vcr_3_1 = 36035, + ia_pal_uuid_isp_vcsc_2_0_b = 13708, + ia_pal_uuid_isp_wb_1_1 = 5144, + ia_pal_uuid_isp_xnr_5_4 = 30019, + +} ia_pal_uuid; + +typedef enum +{ + ia_pal_uuid_system_api_acm_1_2 = 36320, + ia_pal_uuid_system_api_aestatistics_2_1 = 6191, + ia_pal_uuid_system_api_b2i_ds_1_1 = 2102, + ia_pal_uuid_system_api_bnlm_3_4 = 10944, + ia_pal_uuid_system_api_bxt_blc = 12306, + ia_pal_uuid_system_api_cas_1_1 = 3917, + ia_pal_uuid_system_api_ccm_3a_2_0 = 37617, + ia_pal_uuid_system_api_dol_lite_1_2 = 8785, + ia_pal_uuid_system_api_dpc_2_2 = 40171, + ia_pal_uuid_system_api_fr_grid_1_0 = 11825, + ia_pal_uuid_system_api_gdc7 = 26430, + ia_pal_uuid_system_api_gmv_statistics_1_1 = 31661, + ia_pal_uuid_system_api_io_buffer_1_4 = 47417, + ia_pal_uuid_system_api_isys_drainer_1_0 = 3396, + ia_pal_uuid_system_api_linearization2_0 = 47321, + ia_pal_uuid_system_api_lsc_1_2 = 53704, + ia_pal_uuid_system_api_nntm_1_0 = 10286, + ia_pal_uuid_system_api_pafstatistics_1_2 = 53308, + ia_pal_uuid_system_api_pext_1_0 = 29899, + ia_pal_uuid_system_api_rgbs_grid_1_1 = 41868, + ia_pal_uuid_system_api_tnr7_bc_1_2 = 27934, + ia_pal_uuid_system_api_tnr7_blend_1_1 = 26244, + ia_pal_uuid_system_api_upipe_1_0 = 61460, + ia_pal_uuid_system_api_xnr_5_4 = 4645, + +} ia_system_api_uuid; + +#ifdef __cplusplus +} +#endif + +#endif // IA_PAL_TYPES_ISP_IDS_AUTOGEN_H diff --git a/include/ipu8/ia_imaging/ia_pal_types_isp_parameters_autogen.h b/include/ipu8/ia_imaging/ia_pal_types_isp_parameters_autogen.h new file mode 100644 index 0000000..0b5e520 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_pal_types_isp_parameters_autogen.h @@ -0,0 +1,3974 @@ + +/* +* INTEL CONFIDENTIAL +* Copyright (c) 2023 Intel Corporation +* All Rights Reserved. +* +* The source code contained or described herein and all documents related to +* the source code (Material) are owned by Intel Corporation or its +* suppliers or licensors. Title to the Material remains with Intel +* Corporation or its suppliers and licensors. The Material may contain trade +* secrets and proprietary and confidential information of Intel Corporation +* and its suppliers and licensors, and is protected by worldwide copyright +* and trade secret laws and treaty provisions. No part of the Material may be +* used, copied, reproduced, modified, published, uploaded, posted, +* transmitted, distributed, or disclosed in any way without Intel's prior +* express written permission. +* +* No license under any patent, copyright, trade secret or other intellectual +* property right is granted to or conferred upon you by disclosure or +* delivery of the Materials, either expressly, by implication, inducement, +* estoppel or otherwise. Any license under such intellectual property rights +* must be express and approved by Intel in writing. +* +* Unless otherwise agreed by Intel in writing, you may not remove or alter +* this notice or any other notice embedded in Materials by Intel or Intel's +* suppliers or licensors in any way. +*/ + +#ifndef IA_PAL_TYPES_ISP_PARAMETERS_AUTOGEN_H +#define IA_PAL_TYPES_ISP_PARAMETERS_AUTOGEN_H + +#include + +#ifdef __cplusplus +extern "C"{ +#endif + + +/*! \isp struct acm_1_2 + +*/ +typedef struct +{ + /*!< bypass Block bypass for HW use*/ + int32_t bypass; + /*!< enable_chroma_lut Enable Chroma adaptation by LUT*/ + int32_t enable_chroma_lut; + /*!< enable_luma_lut Enable Luma adaptation by LUT*/ + int32_t enable_luma_lut; + /*!< enable_negative_pixels enable negative pixels in output*/ + int32_t enable_negative_pixels; + /*!< enable_chroma_low_light_mode Enable Chroma adaptation in low light mode*/ + int32_t enable_chroma_low_light_mode; + /*!< enable_luma_low_light_mode Enable Luma adaptation in low light mode*/ + int32_t enable_luma_low_light_mode; + /*!< num_of_sectors number of sectors, U5.0*/ + int32_t num_of_sectors; + /*!< chromagrid2uniformlut_cu_x[9] U12.0*/ + int32_t chromagrid2uniformlut_cu_x[9]; + /*!< chromagrid2uniformlut_cu_a[8] S4.10*/ + int32_t chromagrid2uniformlut_cu_a[8]; + /*!< lumagrid2uniformlut_cu_x[9] U12.0*/ + int32_t lumagrid2uniformlut_cu_x[9]; + /*!< lumagrid2uniformlut_cu_a[8] S4.10*/ + int32_t lumagrid2uniformlut_cu_a[8]; + /*!< ccm_matrix_arr[216] CCM's table (one per sector), S3.11*/ + int32_t ccm_matrix_arr[216]; + /*!< hue_boundary_arr[24] Table of sectors boundaries, U11.0*/ + int32_t hue_boundary_arr[24]; + /*!< ccm_index_arr[25] Table of the sectors indices, U5.0*/ + int32_t ccm_index_arr[25]; + /*!< offr CCM bias for R, S13.0*/ + int32_t offr; + /*!< offg CCM bias for G, S13.0*/ + int32_t offg; + /*!< offb CCM bias for B, S13.0*/ + int32_t offb; + /*!< luma_coeff_arr[3] Luna coefficients (weights), U0.8*/ + int32_t luma_coeff_arr[3]; + /*!< adapt_chroma_lut[81] Chroma adaptation LUT, U2.7*/ + int32_t adapt_chroma_lut[81]; + /*!< adapt_luma_lut[81] Luma adaptation LUT, S13.0*/ + int32_t adapt_luma_lut[81]; + /*!< enable_low_light_mode Enable CC's adaptation low light mode*/ + int32_t enable_low_light_mode; + /*!< enable_compand enable for the (de)companding*/ + int32_t enable_compand; + /*!< cu_compression_x[13] U.24 linear, default log-limited*/ + int32_t cu_compression_x[13]; + /*!< cu_compression_y[12] U.15 companded output*/ + int32_t cu_compression_y[12]; + /*!< cu_compression_slope[12] U1.14 15bit slopes for companding*/ + int32_t cu_compression_slope[12]; + /*!< cu_decompression_x[13] U.15 companded input, default log-limited*/ + int32_t cu_decompression_x[13]; + /*!< cu_decompression_y[12] U.24 linear*/ + int32_t cu_decompression_y[12]; + /*!< cu_decompression_slope[12] U20.6 26bit slopes for decompanding*/ + int32_t cu_decompression_slope[12]; + /*!< linear_pedestal Pedestal subtracted (and added later) in linear domain, U.24*/ + int32_t linear_pedestal; + /*!< use_pedestal If true, pedestal is used and the companded signal should be U15. If false, linear_pedestal should be 0*/ + int32_t use_pedestal; + /*!< is_segmentation_aware enable for the segment aware processing*/ + int32_t is_segmentation_aware; + /*!< luts_input_mode input mode ofr chroma and luma LUTs*/ + int32_t luts_input_mode; + /*!< ccm_matrix_per_class[324] CCM's table (one per class), S3.11*/ + int32_t ccm_matrix_per_class[324]; + /*!< ccm_index_per_class[36] Table of the sectors indices per class, S6.0*/ + int32_t ccm_index_per_class[36]; + +} ia_pal_isp_acm_1_2_t; + +/*! \isp struct aestatistics_2_1 +AE Statistics (histogram) +*/ +typedef struct +{ + /*!< cell0[96] weighted histogram grid values*/ + int32_t cell0[96]; + /*!< cell1[96] weighted histogram grid values*/ + int32_t cell1[96]; + /*!< cell2[96] weighted histogram grid values*/ + int32_t cell2[96]; + /*!< cell3[96] weighted histogram grid values*/ + int32_t cell3[96]; + /*!< cell4[96] weighted histogram grid values*/ + int32_t cell4[96]; + /*!< cell5[96] weighted histogram grid values*/ + int32_t cell5[96]; + /*!< cell6[96] weighted histogram grid values*/ + int32_t cell6[96]; + /*!< cell7[96] weighted histogram grid values*/ + int32_t cell7[96]; + /*!< grid_width represents number of horizontal grid cells*/ + int32_t grid_width; + /*!< grid_height represents number of vertical grid cells*/ + int32_t grid_height; + /*!< block_width Log2 the width of each grid cell (8,16,32,64,128, 256)*/ + int32_t block_width; + /*!< block_height Log2 the height of each grid cell (8,16,32,64,128, 256)*/ + int32_t block_height; + /*!< ae_en 0: FF will not write to the AE array; 1: FF will write*/ + int32_t ae_en; + /*!< rst_hist_array 1: triggers the reset mechanism for the GLB_HIST*/ + int32_t rst_hist_array; + /*!< x_start X top left corner of the grid*/ + int32_t x_start; + /*!< y_start Y top left corner of the grid*/ + int32_t y_start; + /*!< x_end X bottom right corner of the grid*/ + int32_t x_end; + /*!< y_end Y bottom right corner of the grid*/ + int32_t y_end; + /*!< sensor_mode 0: 1x1 CFA (array sensor); 1: 2 x 2 CFA; 2: 4 x 4 CFA*/ + int32_t sensor_mode; + /*!< pat_00 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_00; + /*!< pat_01 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_01; + /*!< pat_02 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_02; + /*!< pat_03 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_03; + /*!< pat_10 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_10; + /*!< pat_11 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_11; + /*!< pat_12 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_12; + /*!< pat_13 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_13; + /*!< pat_20 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_20; + /*!< pat_21 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_21; + /*!< pat_22 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_22; + /*!< pat_23 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_23; + /*!< pat_30 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_30; + /*!< pat_31 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_31; + /*!< pat_32 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_32; + /*!< pat_33 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_33; + /*!< shift_id[8] shifter for the histograms per color channel*/ + int32_t shift_id[8]; + +} ia_pal_isp_aestatistics_2_1_t; + +/*! \isp struct b2i_ds_1_1 + +*/ +typedef struct +{ + /*!< enable enable scaling filter*/ + int32_t enable; + /*!< scaling_ratio Scaling factor, 16bit fixed point, greater than 1*/ + int32_t scaling_ratio; + /*!< horizontal_offset Position of first output pixel for scaler*/ + int32_t horizontal_offset; + /*!< vertical_offset Position of first output line for scaler*/ + int32_t vertical_offset; + /*!< output_height Output image height for scaler*/ + int32_t output_height; + /*!< output_width Output image width for scaler*/ + int32_t output_width; + /*!< vkernel_LUT[129] interpolation vertical kernel coefficients for scaler*/ + int32_t vkernel_LUT[129]; + /*!< hkernel_LUT[129] interpolation horizontal kernel coefficients for scaler*/ + int32_t hkernel_LUT[129]; + /*!< input_height input image height*/ + int32_t input_height; + +} ia_pal_isp_b2i_ds_1_1_t; + +/*! \isp struct bgb_1_0 + +*/ +typedef struct +{ + /*!< enable enables the filter, if disabled the output is identical to input*/ + int32_t enable; + +} ia_pal_isp_bgb_1_0_t; + +/*! \isp struct bnlm_3_4 +noise reduction +*/ +typedef struct +{ + /*!< bayer_fmt Bayer format*/ + int32_t bayer_fmt; + /*!< bypass bypass*/ + int32_t bypass; + /*!< run_on_y a flag that indicates if the block used on Y input*/ + int32_t run_on_y; + /*!< hv_edge_density_thr Edge density noise sigma thr*/ + int32_t hv_edge_density_thr; + /*!< minmax_hv_edge_density_thr Edge density delta max - min thr*/ + int32_t minmax_hv_edge_density_thr; + /*!< d_edge_density_thr Diagonal edge density noise sigma thr*/ + int32_t d_edge_density_thr; + /*!< minmax_d_edge_density_thr Diagonal edge density delta max - min thr*/ + int32_t minmax_d_edge_density_thr; + /*!< sigma_flat sigma flat*/ + int32_t sigma_flat; + /*!< sigma_slope sigma slope*/ + int32_t sigma_slope; + /*!< sigma_edge sigma edge*/ + int32_t sigma_edge; + /*!< sigma_texture sigma texture*/ + int32_t sigma_texture; + /*!< delta_flat delta flat*/ + int32_t delta_flat; + /*!< delta_slope delta slope*/ + int32_t delta_slope; + /*!< delta_edge delta edge*/ + int32_t delta_edge; + /*!< delta_texture delta texture*/ + int32_t delta_texture; + /*!< alpha_flat alpha flat*/ + int32_t alpha_flat; + /*!< alpha_slope alpha slope*/ + int32_t alpha_slope; + /*!< alpha_edge alpha edge*/ + int32_t alpha_edge; + /*!< alpha_texture alpha texture*/ + int32_t alpha_texture; + /*!< sigma_s spatial sigma of uniform filter*/ + int32_t sigma_s; + /*!< sigma_s_b narrow sigma of elliptical filter*/ + int32_t sigma_s_b; + /*!< sigma_s_a wide sigma of elliptical filter*/ + int32_t sigma_s_a; + /*!< rx_sqr_start initial value of Rx^2*/ + int32_t rx_sqr_start; + /*!< ry_sqr_start initial value of Ry^2*/ + int32_t ry_sqr_start; + /*!< coordinates_shift coordinates shift*/ + int32_t coordinates_shift; + /*!< color_penalty_weight color penalty weight*/ + int32_t color_penalty_weight; + /*!< alpha_i_max alpha I max*/ + int32_t alpha_i_max; + /*!< cu_ed_measure_x[4] edge density config unit - x values*/ + int32_t cu_ed_measure_x[4]; + /*!< cu_ed_measure_y[3] edge density config unit - y values*/ + int32_t cu_ed_measure_y[3]; + /*!< cu_ed_measure_slope[3] edge density config unit - slope values*/ + int32_t cu_ed_measure_slope[3]; + /*!< cu_ed_dir_measure_x[4] directional measure config unit - x values*/ + int32_t cu_ed_dir_measure_x[4]; + /*!< cu_ed_dir_measure_y[3] directional measure config unit - y values*/ + int32_t cu_ed_dir_measure_y[3]; + /*!< cu_ed_dir_measure_slope[3] directional measure config unit - slopes values*/ + int32_t cu_ed_dir_measure_slope[3]; + /*!< cu_alpha_i_x[4] alpha change with intensity config unit - x values*/ + int32_t cu_alpha_i_x[4]; + /*!< cu_alpha_i_y[3] alpha change with intensity config unit - y values*/ + int32_t cu_alpha_i_y[3]; + /*!< cu_alpha_i_slope[3] alpha change with intensity config unit - slopes values*/ + int32_t cu_alpha_i_slope[3]; + /*!< start_col The distance along the vertical axis of the first pixel of the frame*/ + int32_t start_col; + /*!< start_row The distance along the horizontal axis of the first pixel of the frame*/ + int32_t start_row; + /*!< delta_y_counter crop supporting register*/ + int32_t delta_y_counter; + /*!< delta_x_counter crop supporting register*/ + int32_t delta_x_counter; + /*!< cu_nm_patch_x[10] noise model config unit - x values*/ + int32_t cu_nm_patch_x[10]; + /*!< cu_nm_patch_y[9] noise model config unit - y values*/ + int32_t cu_nm_patch_y[9]; + /*!< cu_nm_patch_slope[9] noise model config unit - slope values*/ + int32_t cu_nm_patch_slope[9]; + /*!< cu_nm_block_x[10] content detectors noise model config unit - x values*/ + int32_t cu_nm_block_x[10]; + /*!< cu_nm_block_y[9] content detectors noise model config unit - y values*/ + int32_t cu_nm_block_y[9]; + /*!< cu_nm_block_slope[9] content detectors noise model config unit - slope values*/ + int32_t cu_nm_block_slope[9]; + /*!< cu_input_compression_x[16] input compression function (16 to 12 bits) - x values*/ + int32_t cu_input_compression_x[16]; + /*!< cu_input_compression_y[15] input compression function (16 to 12 bits) - y values*/ + int32_t cu_input_compression_y[15]; + /*!< cu_input_compression_slope[15] input compression function (16 to 12 bits) - slope values*/ + int32_t cu_input_compression_slope[15]; + /*!< cu_input_decompression_x[16] input decompression function (16 to 24 bits) - x values*/ + int32_t cu_input_decompression_x[16]; + /*!< cu_input_decompression_y[15] input decompression function (16 to 24 bits) - y values*/ + int32_t cu_input_decompression_y[15]; + /*!< cu_input_decompression_slope[15] input decompression function (16 to 24 bits) - slope values*/ + int32_t cu_input_decompression_slope[15]; + /*!< cu_output_compression_x[16] output compression function (24 to 16 bits) - x values*/ + int32_t cu_output_compression_x[16]; + /*!< cu_output_compression_y[15] output compression function (24 to 16 bits) - y values*/ + int32_t cu_output_compression_y[15]; + /*!< cu_output_compression_slope[15] output compression function (24 to 16 bits) - slope values*/ + int32_t cu_output_compression_slope[15]; + /*!< nm_norm_scale Amount of bits to normalize the noise model*/ + int32_t nm_norm_scale; + /*!< lsc_coeff_lut_gr[32] Shading coeffcients along the distance from the frame optical center*/ + int32_t lsc_coeff_lut_gr[32]; + /*!< lsc_coeff_lut_gb[32] Shading coeffcients along the distance from the frame optical center*/ + int32_t lsc_coeff_lut_gb[32]; + /*!< lsc_coeff_lut_r[32] Shading coeffcients along the distance from the frame optical center*/ + int32_t lsc_coeff_lut_r[32]; + /*!< lsc_coeff_lut_b[32] Shading coeffcients along the distance from the frame optical center*/ + int32_t lsc_coeff_lut_b[32]; + /*!< lin_slope_measure_slope_a slope measure based on linear eq - slope value*/ + int32_t lin_slope_measure_slope_a; + /*!< lin_slope_measure_x0 slope measure based on linear eq - x0 value*/ + int32_t lin_slope_measure_x0; + /*!< lin_slope_edge_measure_slope_a edge measure based on linear eq - slope value*/ + int32_t lin_slope_edge_measure_slope_a; + /*!< lin_slope_edge_measure_x0 edge measure based on linear eq - x0 value*/ + int32_t lin_slope_edge_measure_x0; + /*!< var_measure_slope_a variance measure based on linear eq - slope value*/ + int32_t var_measure_slope_a; + /*!< var_measure_x0 variance measure based on linear eq - x0 value*/ + int32_t var_measure_x0; + /*!< var_edge_measure_slope_a variance edge measure based on linear eq - slope value*/ + int32_t var_edge_measure_slope_a; + /*!< var_edge_measure_x0 variance edge measure based on linear eq - x0 value*/ + int32_t var_edge_measure_x0; + /*!< is_segmentation_aware If 1, the filter works in the segmentation-aware mode, if 0 the filter ignores the seg-map input completely and goes to non-segmentation-aware mode*/ + int32_t is_segmentation_aware; + /*!< sigma_flat_class[16] sigma flat for each class - SAP*/ + int32_t sigma_flat_class[16]; + /*!< sigma_slope_class[16] sigma slope for each class - SAP*/ + int32_t sigma_slope_class[16]; + /*!< sigma_edge_class[16] sigma edge for each class - SAP*/ + int32_t sigma_edge_class[16]; + /*!< sigma_texture_class[16] sigma texture for each class - SAP*/ + int32_t sigma_texture_class[16]; + /*!< delta_flat_class[16] delta flat for each class - SAP*/ + int32_t delta_flat_class[16]; + /*!< delta_slope_class[16] delta slope for each class - SAP*/ + int32_t delta_slope_class[16]; + /*!< delta_edge_class[16] delta edge for each class - SAP*/ + int32_t delta_edge_class[16]; + /*!< delta_texture_class[16] delta texture for each class - SAP*/ + int32_t delta_texture_class[16]; + /*!< alpha_flat_class[16] alpha flat for each class - SAP*/ + int32_t alpha_flat_class[16]; + /*!< alpha_slope_class[16] alpha slope for each class - SAP*/ + int32_t alpha_slope_class[16]; + /*!< alpha_edge_class[16] alpha edge for each class - SAP*/ + int32_t alpha_edge_class[16]; + /*!< alpha_texture_class[16] alpha texture for each class - SAP*/ + int32_t alpha_texture_class[16]; + /*!< lin_slope_measure_slope_a_class[16] slope measure based on linear eq - slope for each class - SAP*/ + int32_t lin_slope_measure_slope_a_class[16]; + /*!< lin_slope_measure_x0_class[16] slope measure based on linear eq - x0 for each class - SAP*/ + int32_t lin_slope_measure_x0_class[16]; + /*!< lin_slope_edge_measure_slope_a_class[16] edge measure based on linear eq - slope for each class - SAP*/ + int32_t lin_slope_edge_measure_slope_a_class[16]; + /*!< lin_slope_edge_measure_x0_class[16] edge measure based on linear eq - x0 for each class - SAP*/ + int32_t lin_slope_edge_measure_x0_class[16]; + /*!< var_measure_slope_a_class[16] variance measure based on linear eq - slope for each class - SAP*/ + int32_t var_measure_slope_a_class[16]; + /*!< var_measure_x0_class[16] variance measure based on linear eq - x0 for each class - SAP*/ + int32_t var_measure_x0_class[16]; + /*!< var_edge_measure_slope_a_class[16] variance edge measure based on linear eq - slope for each class - SAP*/ + int32_t var_edge_measure_slope_a_class[16]; + /*!< var_edge_measure_x0_class[16] variance edge measure based on linear eq - x0 for each class - SAP*/ + int32_t var_edge_measure_x0_class[16]; + +} ia_pal_isp_bnlm_3_4_t; + +/*! \isp struct bxt_blc + +*/ +typedef struct +{ + /*!< cfa_type cfa type 0=1x1 1=2x2 2=4x4*/ + int32_t cfa_type; + /*!< bypass bypass for the filter*/ + int32_t bypass; + /*!< dummy_bypass dumy bypass for the filter. Required to allign block API to RTL registers*/ + int32_t dummy_bypass; + /*!< fixobc00 black level value*/ + int32_t fixobc00; + /*!< fixobc01 black level value*/ + int32_t fixobc01; + /*!< fixobc02 black level value*/ + int32_t fixobc02; + /*!< fixobc03 black level value*/ + int32_t fixobc03; + /*!< fixobc10 black level value*/ + int32_t fixobc10; + /*!< fixobc11 black level value*/ + int32_t fixobc11; + /*!< fixobc12 black level value*/ + int32_t fixobc12; + /*!< fixobc13 black level value*/ + int32_t fixobc13; + /*!< fixobc20 black level value*/ + int32_t fixobc20; + /*!< fixobc21 black level value*/ + int32_t fixobc21; + /*!< fixobc22 black level value*/ + int32_t fixobc22; + /*!< fixobc23 black level value*/ + int32_t fixobc23; + /*!< fixobc30 black level value*/ + int32_t fixobc30; + /*!< fixobc31 black level value*/ + int32_t fixobc31; + /*!< fixobc32 black level value*/ + int32_t fixobc32; + /*!< fixobc33 black level value*/ + int32_t fixobc33; + +} ia_pal_isp_bxt_blc_t; + +/*! \isp struct bxt_demosaic + +*/ +typedef struct +{ + /*!< bypass Block bypass for HW use*/ + int32_t bypass; + /*!< frame_width Frame width*/ + int32_t frame_width; + /*!< gammasg Sharpening coefficient*/ + int32_t gammasg; + /*!< lcctrl Checkers removal control*/ + int32_t lcctrl; + /*!< crparam1 High frequency denoise param1*/ + int32_t crparam1; + /*!< crparam2 High frequency denoise param2*/ + int32_t crparam2; + /*!< coringparam False color correction gain*/ + int32_t coringparam; + /*!< char_en Checkers removal enable*/ + int32_t char_en; + /*!< fcc_en False color correction enable*/ + int32_t fcc_en; + /*!< car_en Chroam artifacts removal enable*/ + int32_t car_en; + /*!< hfar_en High frequency aliasing reduction correction enable*/ + int32_t hfar_en; + /*!< es_enable Edge smoothing enable*/ + int32_t es_enable; + /*!< es_pow Edge smoohing enable.*/ + int32_t es_pow; + /*!< diag_car_trade_off_th Diagonal regions protection param1*/ + int32_t diag_car_trade_off_th; + /*!< diag_car_trade_off_slope Diagonal regions protection param2*/ + int32_t diag_car_trade_off_slope; + /*!< stream_ylp_c Coefficient for the YLP for central element of 3x3 neighborhood*/ + int32_t stream_ylp_c; + /*!< stream_ylp_p Coefficient for the YLP for peripheral element of 3x3 neighborhood*/ + int32_t stream_ylp_p; + /*!< stream_ylp_d Coefficient for the YLP for diagonal element of 3x3 neighborhood*/ + int32_t stream_ylp_d; + /*!< stream_ylp_mul_norm Coefficient for multiplier in YLP stream*/ + int32_t stream_ylp_mul_norm; + /*!< stream_ylp_norm_shift Coefficient for YLP stream*/ + int32_t stream_ylp_norm_shift; + /*!< configunitdiag1_x[2] CU_DIAG1 - x input*/ + int32_t configunitdiag1_x[2]; + /*!< configunitdiag2_x[2] CU_DIAG2 - x input*/ + int32_t configunitdiag2_x[2]; + /*!< configunitdiag3_x[2] CU_DIAG3 - x input*/ + int32_t configunitdiag3_x[2]; + /*!< configunitcar_sat_x[2] CU_CAR_SAT - x input*/ + int32_t configunitcar_sat_x[2]; + /*!< configunitdiag1_y[1] CU_DIAG1 - y input*/ + int32_t configunitdiag1_y[1]; + /*!< configunitdiag1_slope[1] CU_DIAG1 - slope input*/ + int32_t configunitdiag1_slope[1]; + /*!< configunitdiag2_y[1] CU_DIAG2 - y input*/ + int32_t configunitdiag2_y[1]; + /*!< configunitdiag2_slope[1] CU_DIAG2 - slope input*/ + int32_t configunitdiag2_slope[1]; + /*!< configunitdiag3_y[1] CU_DIAG3 - y input*/ + int32_t configunitdiag3_y[1]; + /*!< configunitdiag3_slope[1] CU_DIAG3 - slope input*/ + int32_t configunitdiag3_slope[1]; + /*!< configunitcar_sat_y[1] CU_CAR_SAT - y input*/ + int32_t configunitcar_sat_y[1]; + /*!< configunitcar_sat_slope[1] CU_CAR_SAT - slope input*/ + int32_t configunitcar_sat_slope[1]; + +} ia_pal_isp_bxt_demosaic_t; + +/*! \isp struct cas_1_1 + +*/ +typedef struct +{ + /*!< enable block enable*/ + int32_t enable; + /*!< is_segmentation_aware SAP (Segmentation Aware Processing) enable*/ + int32_t is_segmentation_aware; + /*!< x_center Optical center x*/ + int32_t x_center; + /*!< y_center Optical center y*/ + int32_t y_center; + /*!< x_start Starting column of the fragment.*/ + int32_t x_start; + /*!< y_start Starting row of the fragment (Usualy will be 0)*/ + int32_t y_start; + /*!< stats_collection_boundaries[2] columns where statitcis collection takes place*/ + int32_t stats_collection_boundaries[2]; + /*!< is_first_stripe is first stripe in frame*/ + int32_t is_first_stripe; + /*!< is_last_stripe is last stripe in frame*/ + int32_t is_last_stripe; + /*!< inv_spatial_model[16] Describes the inverse spatial noise*/ + int32_t inv_spatial_model[16]; + /*!< spatial_step_log2 log2 of spatial lut step size (value is derived from x_center and y_center. See spec for more details)*/ + int32_t spatial_step_log2; + /*!< nm_lut[16] noise model for luma. Save&restore register (will be ovveride in video mode)*/ + int32_t nm_lut[16]; + /*!< apu_alpha_limit update mechanism in apu - as limit increases, we need more measurements for the histogram bins to be considered as reliable.*/ + int32_t apu_alpha_limit; + /*!< apu_alpha_power update mechanism in apu - as power increase, we count more on the new val calculated then the one from previous frame.*/ + int32_t apu_alpha_power; + /*!< hist_vals[256] histogram valuse of APU to flow between fragments. save and restore. 2D array of size 16*(2^(4))( HWP_APU_N_VALUES*(1<8b, 1=>10b, 2=>12b, 3=>16, 4=>32, 5=>2, 6=>4, 7..15=>reserved*/ + int32_t component_precision; + /*!< unpack_alignment Valid for unpacked vectors: 0-element located at LSB and MSB is zero; 1-element located at MSB and LSB is zero*/ + int32_t unpack_alignment; + /*!< vertical_ordering_enable If set, the walking order should be vertical using the sub_line value to indicate how many CL generate vertical movement*/ + int32_t vertical_ordering_enable; + /*!< vertical_ordering_sub_line valid when vertical_ordering is set, indicates the size of the sub line to generate vertical step in CL granularity*/ + int32_t vertical_ordering_sub_line; + /*!< num_of_queues Amount of total active queues (YUV FP - 4, YUV SP - 3 YUV SP Tile - 2. RGB - 1,1,1. Bayer -2). Must be up to amount of maximum queue supported. Can be changed per frame. At LBFF used dynamicly for PDAF*/ + int32_t num_of_queues; + /*!< vector_format Vector CL format: 0-unpacked using 2B container; 1-packed*/ + int32_t vector_format; + /*!< tile_mode Valid for IO that can provide tile format: 0-no tiling; 1-the IO should use tiling with the configured height, width, and tiling type (internal tiling or external Tile-4)*/ + int32_t tile_mode; + /*!< tiling_type Tiling Type: 0 - internal tiling; 1 - external tiling (Tile-4)*/ + int32_t tiling_type; + /*!< compression_mode Valid for streaming that are tiled: 1-the stream is written/fetched to/from DDR through compression engine; 0-not going through compression*/ + int32_t compression_mode; + /*!< buffer_1d_enable Valid only for 1 plane and 1 queue streams. 0-the buffer is described as 2D; 1-the buffer is described as 1D (continues from start to end w/o stride ignoring lines)*/ + int32_t buffer_1d_enable; + /*!< num_of_planes Amount of valid planes (supported 1, 2, 3, 4 - depends also on HW parameter of max planes and data type)*/ + int32_t num_of_planes; + /*!< plane_stride[3] Per plane: provides the difference between two horizontal pixels, in bytes, CL aligned, unsigned. At tile mode - provide the difference between two lines of tiles in bytes*/ + uint32_t plane_stride[3]; + /*!< plane_offset_start_address[3] Per plane: Start offset address of plane with regarding to the base_offset, in bytes, CL aligned, unsigned.*/ + uint32_t plane_offset_start_address[3]; + /*!< plane_offset_end_address[3] Per plane: End offset address of plane with regarding to the base_offset, in bytes, CL aligned, unsigned.*/ + uint32_t plane_offset_end_address[3]; + /*!< plane_tile_width[3] Per plane: buffer tile width configuration in bytes*/ + int32_t plane_tile_width[3]; + /*!< plane_tile_height[3] Per plane: buffer tile height configuration in lines*/ + int32_t plane_tile_height[3]; + /*!< chroma_planes_order Chroma planes ordering: 0 - U before V; 1 - V before U (valid for half planer configuration)*/ + int32_t chroma_planes_order; + /*!< chroma_duplication Valid when format 420 is configured to provide 422 (2P2Q with SIF count of 4 or 2). when reset - duplicate the chroma and provide the same value each two Y lines, when set - send the chroma components only with the even Y (at odd Y lines doesn’t send any chroma)*/ + int32_t chroma_duplication; + /*!< onep_pixel_order Set the ordering of the first plane (lines-N, pixels-M) 4PPC: 0-(N, M), (N, M+1), (N+1, M), (N+1, M+1), horizontal raster; 1-(N, M), (N+1, M), (N, M+1), (N+1, M+1), vertical raster 2PPC: 0-first cyc: (N, M), (N+1, M), second cyc: (N, M+1), (N+1, M+1); 1-first cyc: (N, M), (N, M+1),*/ + int32_t onep_pixel_order; + /*!< zlr_transaction_enable when set enable sending zlr request for prefetch address translation and compression status*/ + int32_t zlr_transaction_enable; + /*!< streaming_mode The streaming unified buffer protocol: 0-static offline (producer/consumer write/read from DDR after kick); 1-dynamic offline (producer/consumer send wr/rd EOF/SOF, producer write after kick, consumer read after full frame at DDR); 2-buffer chasing large memory (producer/consumer send wr/rd EOF/SOF, producer send wr update, consumer read according to wr update); 3-buffer chasing on small memory (producer/consumer send wr/rd EOF/SOF, producer write released buffers and sends wr pointers, consumer read valid buffer and sends rd pointer); 4-S&R like 3 with option to change the link (supporting modes 2 and 3 with dynamic change) 5-buffer chasing small memory - fix starting point, single buffer 6-buffer chasing small memory - float starting point 7-buffer chasing small memory - fix starting point, double buffer*/ + int32_t streaming_mode; + /*!< streaming_sw_managed When set - the SW verify the shared buffer is fully consumed by the producer and can be written immediately*/ + int32_t streaming_sw_managed; + /*!< local_link_id indicates the stream used at the current connectlon*/ + int32_t local_link_id; + /*!< stride_ratio provides the BCSM max_stride/stride ratio with possible values of 1-8, 16, 32, 64, 128*/ + int32_t stride_ratio; + /*!< granularity_pointer_update Valid according the streaming mode: number of lines (LB)/lines of blocks (BB) to be written/release before sending a pointer update (reporting always done with producer view)*/ + int32_t granularity_pointer_update; + /*!< max_stride provides the maximum stride value to be used at the connection*/ + uint32_t max_stride; + /*!< block_width buffer block width configuration in pixels*/ + int32_t block_width; + /*!< block_height buffer block height configuration in lines*/ + int32_t block_height; + /*!< first_row_blocks_height buffer block height configuration in lines of all the blocks in the first row of blocks. If zero - use streaming_buffer_blocks_height*/ + int32_t first_row_blocks_height; + /*!< last_row_blocks_height buffer block height configuration in lines of all the blocks in the last row of blocks. If zero - use streaming_buffer_blocks_height*/ + int32_t last_row_blocks_height; + /*!< plane_max_burst_size[3] Plane maximum burst size: used to specify the transfer size in CL granularity (Max limited to 16, possible values - 1, 2, 4, 8, 16)*/ + int32_t plane_max_burst_size[3]; + /*!< plane_horiz_subsample_config[3] Plane Horiz subsample (width>>N). Affect tile width and width resolution=>Bayer - 0, Y/UV at YUV SP - 0, Y at YUV FP -0, UV U/V at YUV FP-1)*/ + int32_t plane_horiz_subsample_config[3]; + /*!< plane_vert_subsample_config[3] Plane Vertical subsample (height>>N). Affect tile highet and highet resolution=>Bayer - 0, Y atYUV SP - 0, UV at YUV SP - 1, Y at YUV FP -0, U/V at YUV FP-1)*/ + int32_t plane_vert_subsample_config[3]; + /*!< plane_zlr_granularity[3] Plane ZLR page granularity: if 0 - 4KB, if 1 - 2KB. Valid only if ZLR is enalbe*/ + int32_t plane_zlr_granularity[3]; + /*!< progress_message_line Provides the line number that when is done generate progress message (IFD - last byte of the line arrive, ODR - last byte of the line acked by nbuf)*/ + int32_t progress_message_line; + /*!< pace_message_ref_line Provides the line number that when start indicating start measuring the pace and active (ODR - send first WR of the line, IFD send first RD of line)*/ + int32_t pace_message_ref_line; + /*!< pace_message_pace_line Provides the line number indicating to stop measuring the activity and pace and sending pace meesage (at IFD - get the last data of the line, at ODR - getnon-buf ack on last data of the line)*/ + int32_t pace_message_pace_line; + /*!< component_in_valid_pixel Provides amount of valid component per valid pixel*/ + int32_t component_in_valid_pixel; + /*!< pixels_in_valid_cycle Provides amount of valid pixels per valid cycle*/ + int32_t pixels_in_valid_cycle; + /*!< subsample_YUV444_to_YUV422 Used by ODR to convert YUV444 to YUV422: 0-use amount of element as written at components_in_valid_cycle, 1-drop the chroma components any odd cycle*/ + int32_t subsample_YUV444_to_YUV422; + /*!< middle_ack_line_number Valid if ack enable If enabled, the device should generate middle ack when delivers the EOL of the configured line (global number) assuming the first line delievered at SOF is zero. In case of multiple planes the counting is done using plane1 but only when all the planes are synced*/ + int32_t middle_ack_line_number; + /*!< middle_ack_enable If set, enable the mechansim to generate middle ack when consumed amount of configured lines*/ + int32_t middle_ack_enable; + /*!< middle_ack_mode_stall Valid only when ack_enable is set When set, the device should stall once sending the middle ack*/ + int32_t middle_ack_mode_stall; + /*!< stream_dt stream data type as need to be used by the MIPI*/ + int32_t stream_dt; + /*!< stream_vc stream virtual channel number as need to be used in MIPI*/ + int32_t stream_vc; + /*!< proc_ff_bypass when set indicates the FF in the pipe (FCVT & ESPA) need to be bypass*/ + int32_t proc_ff_bypass; + /*!< dpa_bypass When set indicate the end of MIPI frame (used for MIPI CSI sub frames)*/ + int32_t dpa_bypass; + /*!< stream_dt_for_mipi_packet stream data type as need to be used in the header of mipi packet - not affect the proc*/ + int32_t stream_dt_for_mipi_packet; + /*!< arbiter_pin MIPI CSI arbiter pin location of the stream*/ + int32_t arbiter_pin; + /*!< user_reserved user_reserved*/ + int32_t user_reserved; + /*!< aligner_data_size amount of valid bits per valid cycle to be accumulate and use the aligner (valid when dpa_bypass is set). LSB represent 2b resolution (meaning value can be 2, 4, 6, 8, … up to 72 which is the size bus)*/ + int32_t aligner_data_size; + /*!< mipi_csi_eof When set indicate the end of MIPI frame (used for MIPI CSI sub frames)*/ + int32_t mipi_csi_eof; + /*!< ppc provides the amount of pixel per cycle*/ + int32_t ppc; + /*!< stream_wc stream word count as need to be used by the MIPI*/ + int32_t stream_wc; + /*!< max_credits provides the maximum amount of credits for eliminating the need to calculate it in HW according the next formula: (end_address-start_address)/Max_Stride*/ + uint32_t max_credits; + /*!< reserved_0_0 Reserved for future use*/ + int32_t reserved_0_0; + /*!< reserved_0_1 Reserved for future use*/ + int32_t reserved_0_1; + /*!< reserved_0_2 Reserved for future use*/ + int32_t reserved_0_2; + /*!< reserved_0_3 Reserved for future use*/ + int32_t reserved_0_3; + /*!< reserved_1_0 Reserved for future use*/ + int32_t reserved_1_0; + /*!< reserved_1_1 Reserved for future use*/ + int32_t reserved_1_1; + /*!< reserved_1_2 Reserved for future use*/ + int32_t reserved_1_2; + /*!< reserved_1_3 Reserved for future use*/ + int32_t reserved_1_3; + /*!< chroma_non_duplication_location Valid when format 420 is configured to provide 422 (2P2Q with SIF count of 4 or 2) and chroma_duplication is disabled. when reset - add the chroma lines w/ the even luma lines, when set - add the chroma lines w/ the odd luma lines*/ + int32_t chroma_non_duplication_location; + /*!< input_width_msb provides bits [19:16] to the input width resolution*/ + int32_t input_width_msb; + /*!< output_width_msb provides bits [19:16] to the output width resolution*/ + int32_t output_width_msb; + /*!< snoop 0 - non-snoopable, 1 - snoopable*/ + int32_t snoop; + /*!< traffic_class Traffic class the request belongs to and be stored at the XFER queue ccordingly*/ + int32_t traffic_class; + /*!< allocate used for streaming cache: 0-don’t cache, 1-reserved, 2-cache only to non-reserved ways, 3-cache use reserved space for this device*/ + int32_t allocate; + /*!< wraparound_enable wraparound enable bit: 0 - disabled. 1 - enabled.*/ + uint32_t wraparound_enable; + /*!< horizontal_stride_enable horizontal stride enable bit: 0 - horizontal stride is disabled. 1 - horizontal stride is enabled.*/ + uint32_t horizontal_stride_enable; + /*!< variable_length_buffer_enable variable length buffer enable bit: 0 - disabled. 1 - enabled.*/ + uint32_t variable_length_buffer_enable; + /*!< variable_length_buffer_mode 0 - FW/SW manage. 1 - HW manage (relevant only to ODR)*/ + uint32_t variable_length_buffer_mode; + /*!< horizontal_sub_line valid when horizontal_stride_enable is set, indicates the size of the sub line to generate horizontal step in CL granularity .The horizontal stride occurs every number of horizontal_sub_line CLs.*/ + uint32_t horizontal_sub_line; + /*!< wraparound_offset_start_address[3] when wraparound_enable is 1, Start offset address of plane with regarding to the base_offset, in bytes, CL aligned, unsigned.*/ + uint32_t wraparound_offset_start_address[3]; + /*!< wraparound_offset_end_address[3] when wraparound_enable is 1, End offset address of plane in bytes, CL aligned, unsigned, Valid for streaming mode of small memory*/ + uint32_t wraparound_offset_end_address[3]; + /*!< horizontal_stride[3] provides the difference between two sub-lines, in CL granularity, unsigned.*/ + uint32_t horizontal_stride[3]; + /*!< mipi_unpacking_en mipi unpacking enable bit: 0 - disabled. 1 - enabled.*/ + uint32_t mipi_unpacking_en; + /*!< buffer_user_info_reserved_0 Reserved for future use*/ + int32_t buffer_user_info_reserved_0; + /*!< buffer_user_info_reserved_1 Reserved for future use*/ + int32_t buffer_user_info_reserved_1; + +} ia_pal_isp_io_buffer_1_4_t; + +/*! \isp struct isys_drainer_1_0 + +*/ +typedef struct +{ + /*!< output_format 0-7 - RGB formats (with A=0); 8-15 - YUV formats; 0 - Output is in 3-plane RGB format; 3 - Output is in ARGB format; 4 - Output is in RGBA format; 5 - Output is in BGRA format; 6 - Output is in ABGR format; 8 - Output is in 2-plane YUV420 (NV12) format; 9 - Output Y only and discard UV;*/ + int32_t output_format; + /*!< plane_offset_start_address[3] Per plane: Start offset address of plane with regarding to the base_offset, in bytes, CL aligned, unsigned.*/ + uint32_t plane_offset_start_address[3]; + +} ia_pal_isp_isys_drainer_1_0_t; + +/*! \isp struct linearization2_0 +Linearization +*/ +typedef struct +{ + /*!< Linearization2_0_enable Enable Linearization2_0*/ + int32_t Linearization2_0_enable; + /*!< glu_base_level0[5] GLU base level offset*/ + int32_t glu_base_level0[5]; + /*!< glu_base_level1[5] GLU1 base level offset*/ + int32_t glu_base_level1[5]; + /*!< glu_base_level2[5] GLU2 base level offset*/ + int32_t glu_base_level2[5]; + /*!< glu_base_level3[5] GLU3 base level offset*/ + int32_t glu_base_level3[5]; + /*!< glu_base_level4[5] GLU4 base level offset*/ + int32_t glu_base_level4[5]; + /*!< glu_base_level5[5] GLU5 base level offset*/ + int32_t glu_base_level5[5]; + /*!< glu_base_level6[5] GLU6 base level offset*/ + int32_t glu_base_level6[5]; + /*!< glu_base_level7[5] GLU7 base level offset*/ + int32_t glu_base_level7[5]; + /*!< glu_step0[5] GLU step amount per stage*/ + int32_t glu_step0[5]; + /*!< glu_step1[5] GLU1 step amount per stage*/ + int32_t glu_step1[5]; + /*!< glu_step2[5] GLU2 step amount per stage*/ + int32_t glu_step2[5]; + /*!< glu_step3[5] GLU3 step amount per stage*/ + int32_t glu_step3[5]; + /*!< glu_step4[5] GLU4 step amount per stage*/ + int32_t glu_step4[5]; + /*!< glu_step5[5] GLU5 step amount per stage*/ + int32_t glu_step5[5]; + /*!< glu_step6[5] GLU6 step amount per stage*/ + int32_t glu_step6[5]; + /*!< glu_step7[5] GLU7 step amount per stage*/ + int32_t glu_step7[5]; + /*!< glu_start_bin0[5] GLU stage start offset in LUT*/ + int32_t glu_start_bin0[5]; + /*!< glu_start_bin1[5] GLU stage start offset in LUT1*/ + int32_t glu_start_bin1[5]; + /*!< glu_start_bin2[5] GLU stage start offset in LUT2*/ + int32_t glu_start_bin2[5]; + /*!< glu_start_bin3[5] GLU stage start offset in LUT3*/ + int32_t glu_start_bin3[5]; + /*!< glu_start_bin4[5] GLU stage start offset in LUT4*/ + int32_t glu_start_bin4[5]; + /*!< glu_start_bin5[5] GLU stage start offset in LUT5*/ + int32_t glu_start_bin5[5]; + /*!< glu_start_bin6[5] GLU stage start offset in LUT6*/ + int32_t glu_start_bin6[5]; + /*!< glu_start_bin7[5] GLU stage start offset in LUT7*/ + int32_t glu_start_bin7[5]; + /*!< glu_gen_lut_size0 Utilized LUT size*/ + int32_t glu_gen_lut_size0; + /*!< glu_gen_lut_size1 Utilized LUT1 size*/ + int32_t glu_gen_lut_size1; + /*!< glu_gen_lut_size2 Utilized LUT2 size*/ + int32_t glu_gen_lut_size2; + /*!< glu_gen_lut_size3 Utilized LUT3 size*/ + int32_t glu_gen_lut_size3; + /*!< glu_gen_lut_size4 Utilized LUT4 size*/ + int32_t glu_gen_lut_size4; + /*!< glu_gen_lut_size5 Utilized LUT5 size*/ + int32_t glu_gen_lut_size5; + /*!< glu_gen_lut_size6 Utilized LUT6 size*/ + int32_t glu_gen_lut_size6; + /*!< glu_gen_lut_size7 Utilized LUT7 size*/ + int32_t glu_gen_lut_size7; + /*!< glu_gen_lut0[512] LUT samples*/ + int32_t glu_gen_lut0[512]; + /*!< glu_gen_lut1[512] LUT1 samples*/ + int32_t glu_gen_lut1[512]; + /*!< glu_gen_lut2[512] LUT2 samples*/ + int32_t glu_gen_lut2[512]; + /*!< glu_gen_lut3[512] LUT3 samples*/ + int32_t glu_gen_lut3[512]; + /*!< glu_gen_lut4[512] LUT4 samples*/ + int32_t glu_gen_lut4[512]; + /*!< glu_gen_lut5[512] LUT5 samples*/ + int32_t glu_gen_lut5[512]; + /*!< glu_gen_lut6[512] LUT6 samples*/ + int32_t glu_gen_lut6[512]; + /*!< glu_gen_lut7[512] LUT7 samples*/ + int32_t glu_gen_lut7[512]; + /*!< mask0[4] Mask of quad 0*/ + int32_t mask0[4]; + /*!< mask1[4] Mask of quad 1*/ + int32_t mask1[4]; + /*!< mask2[4] Mask of quad 2*/ + int32_t mask2[4]; + /*!< mask3[4] Mask of quad 3*/ + int32_t mask3[4]; + +} ia_pal_isp_linearization2_0_t; + +/*! \isp struct lsc_1_2 +Lens shading correction up to 24 bit +*/ +typedef struct +{ + /*!< cfa_type cfa type 0=1x1 1=2x2 2=4x4*/ + int32_t cfa_type; + /*!< lsclog2gridwidth log2 width of each subplane*/ + int32_t lsclog2gridwidth; + /*!< lsclog2gridheight log2 height of each subplane*/ + int32_t lsclog2gridheight; + /*!< lsc_col_start X value of top left corner of sensor relative to ROI*/ + int32_t lsc_col_start; + /*!< lsc_row_start Y value of top left corner of sensor relative to ROI*/ + int32_t lsc_row_start; + /*!< lsc_exp resolution modifier of the lsc tables*/ + int32_t lsc_exp; + /*!< lsc_grid_tablec00[4096] lsc grid table*/ + int32_t lsc_grid_tablec00[4096]; + /*!< lsc_grid_tablec01[4096] lsc grid table*/ + int32_t lsc_grid_tablec01[4096]; + /*!< lsc_grid_tablec02[4096] lsc grid table*/ + int32_t lsc_grid_tablec02[4096]; + /*!< lsc_grid_tablec03[4096] lsc grid table*/ + int32_t lsc_grid_tablec03[4096]; + /*!< lsc_grid_tablec10[4096] lsc grid table*/ + int32_t lsc_grid_tablec10[4096]; + /*!< lsc_grid_tablec11[4096] lsc grid table*/ + int32_t lsc_grid_tablec11[4096]; + /*!< lsc_grid_tablec12[4096] lsc grid table*/ + int32_t lsc_grid_tablec12[4096]; + /*!< lsc_grid_tablec13[4096] lsc grid table*/ + int32_t lsc_grid_tablec13[4096]; + /*!< lsc_grid_tablec20[4096] lsc grid table*/ + int32_t lsc_grid_tablec20[4096]; + /*!< lsc_grid_tablec21[4096] lsc grid table*/ + int32_t lsc_grid_tablec21[4096]; + /*!< lsc_grid_tablec22[4096] lsc grid table*/ + int32_t lsc_grid_tablec22[4096]; + /*!< lsc_grid_tablec23[4096] lsc grid table*/ + int32_t lsc_grid_tablec23[4096]; + /*!< lsc_grid_tablec30[4096] lsc grid table*/ + int32_t lsc_grid_tablec30[4096]; + /*!< lsc_grid_tablec31[4096] lsc grid table*/ + int32_t lsc_grid_tablec31[4096]; + /*!< lsc_grid_tablec32[4096] lsc grid table*/ + int32_t lsc_grid_tablec32[4096]; + /*!< lsc_grid_tablec33[4096] lsc grid table*/ + int32_t lsc_grid_tablec33[4096]; + /*!< lsc_table_width table width*/ + int32_t lsc_table_width; + /*!< lsc_table_height table height*/ + int32_t lsc_table_height; + /*!< bypass bypass for the filter*/ + int32_t bypass; + /*!< enable_compand enable for the (de)companding*/ + int32_t enable_compand; + /*!< cu_compression_x[13] U.24 linear, default log-limited*/ + int32_t cu_compression_x[13]; + /*!< cu_compression_y[12] U.15 companded output*/ + int32_t cu_compression_y[12]; + /*!< cu_compression_slope[12] U1.14 15bit slopes for companding*/ + int32_t cu_compression_slope[12]; + /*!< cu_decompression_x[13] U.15 companded input, default log-limited*/ + int32_t cu_decompression_x[13]; + /*!< cu_decompression_y[12] U.24 linear*/ + int32_t cu_decompression_y[12]; + /*!< cu_decompression_slope[12] U20.6 26bit slopes for decompanding*/ + int32_t cu_decompression_slope[12]; + /*!< linear_pedestal Pedestal subtracted (and added later) in linear domain, U.24*/ + int32_t linear_pedestal; + /*!< use_pedestal If true, pedestal is used and the companded signal should be U15. If false, linear_pedestal should be 0*/ + int32_t use_pedestal; + +} ia_pal_isp_lsc_1_2_t; + +/*! \isp struct nntm_1_0 + +*/ +typedef struct +{ + /*!< bypass bypass for the filter*/ + int32_t bypass; + /*!< mode NNTM modes [0,1]*/ + int32_t mode; + /*!< offset_yuv2rgb[3] yuv2rgb offset*/ + int32_t offset_yuv2rgb[3]; + /*!< yuv2rgb[9] yuv2rgb calibration*/ + int32_t yuv2rgb[9]; + /*!< rgb2yuv[9] rgb2yuv calibration*/ + int32_t rgb2yuv[9]; + /*!< input_range_restricted input range is restricted flag*/ + int32_t input_range_restricted; + /*!< output_range_restricted output range is restricted flag*/ + int32_t output_range_restricted; + /*!< blending_map[16384] blending map*/ + int32_t blending_map[16384]; + /*!< blending_width blending map width*/ + int32_t blending_width; + /*!< blending_height blending map height*/ + int32_t blending_height; + /*!< guidence_weight_bias[2] guidence conv weight & bias*/ + int32_t guidence_weight_bias[2]; + /*!< gtm_a polynomial chromaticity model degree*/ + int32_t gtm_a; + /*!< gtm_b color saturation in highlights*/ + int32_t gtm_b; + /*!< gtm_c overall color desaturation*/ + int32_t gtm_c; + /*!< tm_lut[2049] generalized lut for tone mapping lut*/ + int32_t tm_lut[2049]; + +} ia_pal_isp_nntm_1_0_t; + +/*! \isp struct pafstatistics_1_2 +PAF Statistics +*/ +typedef struct +{ + /*!< paf_en 0: FF will not write to the PAF array; 1: FF will write*/ + int32_t paf_en; + /*!< paf_frame_width width of PAF frame (in PAF pixels)*/ + int32_t paf_frame_width; + /*!< paf_frame_height height of PAF frame (in PAF lines)*/ + int32_t paf_frame_height; + /*!< skip_horizontal_start number of skipped PAF pixel pairs at the start of each line pair*/ + int32_t skip_horizontal_start; + /*!< skip_vertical_start number of skipped PAF line pairs at the start of the frame*/ + int32_t skip_vertical_start; + /*!< block_width number of PAF pixel pairs per block in horizontal direction*/ + int32_t block_width; + /*!< block_height number of PAF pixel pairs per block in vertical direction*/ + int32_t block_height; + /*!< accum_horizontal number of consecutive PAF pixel pairs accumulated in horizontal direction*/ + int32_t accum_horizontal; + /*!< skip_horizontal number of PAF pixel pairs skipped between accumulated pixel pairs in horizontal direction*/ + int32_t skip_horizontal; + /*!< accum_vertical number of consecutive PAF pixel pairs accumulated in vertical direction*/ + int32_t accum_vertical; + /*!< skip_vertical number of PAF line pairs skipped between accumulated pixel pairs in vertical direction*/ + int32_t skip_vertical; + /*!< min_shift minimum evaluation shift in steps*/ + int32_t min_shift; + /*!< shift_steps number of evaluation points, starting from m_paf_min_shift*/ + int32_t shift_steps; + /*!< paf_shift_step_size phase evaluation step size in pixels*/ + int32_t paf_shift_step_size; + /*!< paf_shifter configured so that the accumulated phase difference fits in the output register*/ + int32_t paf_shifter; + /*!< split_accross_multiple_lines 0: SOP = SOL, EOP = EOL; 1: SOF determined by the reset, EOL determined by pixels per line*/ + int32_t split_accross_multiple_lines; + /*!< pixels_per_line number of pixels per line; pixels_per_line <= paf_frame_width*/ + int32_t pixels_per_line; + /*!< input_modes 0: RRRR+LLLL; 1: LLLL+RRRR; 2: RLRL; 3: LRLR; 4: RRRR+LLLL_ALT; 5: LLLL+RRRR_ALT; 6: RLRL_ALT; 7: LRLR_ALT*/ + int32_t input_modes; + /*!< input_bpp 0: 8 bits; 1: 10 bits; 2: 12 bits; 3: 14 bits; 4: 16 bits; 5: 15 bits (for PDAF3type)*/ + int32_t input_bpp; + /*!< int_prec internal precision of PAF pixels*/ + int32_t int_prec; + /*!< paf_blacklevel Black level to be subtracted from raw PDAF pixel values*/ + int32_t paf_blacklevel; + /*!< shading_coeff_l[192] Shading correction coefficients for L PDAF values (arrangement is the same as PDAF grid: 16x12)*/ + int32_t shading_coeff_l[192]; + /*!< shading_coeff_r[192] Shading correction coefficients for R PDAF values (arrangement is the same as PDAF grid: 16x12)*/ + int32_t shading_coeff_r[192]; + /*!< paf_abs_shifter Bit right shift after abs-operation, to compensate for the shading gains*/ + int32_t paf_abs_shifter; + +} ia_pal_isp_pafstatistics_1_2_t; + +/*! \isp struct pext_1_0 + +*/ +typedef struct +{ + /*!< paf_output_mode 0)disables, do not pass anything\n 1) first line sent to memset0 second\n line sent to memset1\n 2)first line sent to memset0 second to memset 1 and afterward alternate every two lines 3) passthrough –send to memset0 everything*/ + int32_t paf_output_mode; + /*!< swapping1stbc Apply swapping of BC inputs for 1st/3rd/etc.\n0: no swapping\n1: swap B/C inputs*/ + int32_t swapping1stbc; + /*!< swapping1stcd Apply swapping of CD inputs for 1st/3rd/etc.\n0: no swapping\n1: swap C/D inputs*/ + int32_t swapping1stcd; + /*!< swapping2ndbc Apply swapping of BC inputs for 2nd/4th/etc. lines\n0: no swapping\n1: swap A/B inputs*/ + int32_t swapping2ndbc; + /*!< swapping2ndcd Apply swapping of CD inputs for 2nd/4th/etc. lines\n0: no swapping\n1: swap C/D inputs*/ + int32_t swapping2ndcd; + /*!< pdaf_width Width in units of PDAF pixels. After Width pixels – Pext knows there is a new line coming in. In Modes1..3 – max line length is as in the internal buffer size which is 1024 pixels.*/ + int32_t pdaf_width; + /*!< pdaf_height Height in units of pdaf lines*/ + int32_t pdaf_height; + /*!< drop_pattern[32] Drop pattern for AF pixels. 1=drop the lines\n0=use the line*/ + int32_t drop_pattern[32]; + /*!< drop_period Period of the drop pattern*/ + int32_t drop_period; + +} ia_pal_isp_pext_1_0_t; + +/*! \isp struct rgb_ir_2_0 +RGB-IR +*/ +typedef struct +{ + /*!< Bypass Bypass (0,1)*/ + int32_t Bypass; + /*!< CFArgbir[16] RGB-IR CFA descriptor for 4x4 repetitive pattern (0: R, 1: G, 2: B, 3: IR)*/ + int32_t CFArgbir[16]; + /*!< CFAbayer[4] Bayer CFA descriptor for 2x2 repetitive pattern (0: R, 1: G, 2: B)*/ + int32_t CFAbayer[4]; + /*!< SensorDim[2] Sensor dimensions (height,width) for IR contamination correction (optical center calculation)*/ + int32_t SensorDim[2]; + /*!< ImageDim[2] Image dimensions (height,width)*/ + int32_t ImageDim[2]; + /*!< IRimageDim[2] IR image dimensions (height,width)*/ + int32_t IRimageDim[2]; + /*!< IRtype Type of IR pixel layout (2: IRtype2, 1: IRtype1, 0: any other supported, -1: unsupported)*/ + int32_t IRtype; + /*!< IRrefloc Pixel location corresponding to the reference (first) IR pixel within a 4x4 repetitive pattern*/ + int32_t IRrefloc; + /*!< LumaWeights11[25] Filter mask for luminance calculations in CFA locations 11; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights11[25]; + /*!< LumaWeights12[25] Filter mask for luminance calculations in CFA locations 12; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights12[25]; + /*!< LumaWeights13[25] Filter mask for luminance calculations in CFA locations 13; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights13[25]; + /*!< LumaWeights14[25] Filter mask for luminance calculations in CFA locations 14; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights14[25]; + /*!< LumaWeights21[25] Filter mask for luminance calculations in CFA locations 21; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights21[25]; + /*!< LumaWeights22[25] Filter mask for luminance calculations in CFA locations 22; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights22[25]; + /*!< LumaWeights23[25] Filter mask for luminance calculations in CFA locations 23; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights23[25]; + /*!< LumaWeights24[25] Filter mask for luminance calculations in CFA locations 24; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights24[25]; + /*!< LumaWeights31[25] Filter mask for luminance calculations in CFA locations 31; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights31[25]; + /*!< LumaWeights32[25] Filter mask for luminance calculations in CFA locations 32; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights32[25]; + /*!< LumaWeights33[25] Filter mask for luminance calculations in CFA locations 33; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights33[25]; + /*!< LumaWeights34[25] Filter mask for luminance calculations in CFA locations 34; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights34[25]; + /*!< LumaWeights41[25] Filter mask for luminance calculations in CFA locations 41; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights41[25]; + /*!< LumaWeights42[25] Filter mask for luminance calculations in CFA locations 42; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights42[25]; + /*!< LumaWeights43[25] Filter mask for luminance calculations in CFA locations 43; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights43[25]; + /*!< LumaWeights44[25] Filter mask for luminance calculations in CFA locations 44; both the mask coefficients and their sum should be power of two values. A negative value excludes the corresponding sample from consideration.*/ + int32_t LumaWeights44[25]; + /*!< LumaWeightSums[16] Right bit shifts equivalent to the sum of the luminance filter mask coefficients for all 16 channels (11,12,44) within 4x4 repetitive pattern.*/ + int32_t LumaWeightSums[16]; + /*!< BayerRestNeighbors11[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 11; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors11[8]; + /*!< BayerRestNeighbors12[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 12; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors12[8]; + /*!< BayerRestNeighbors13[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations ; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors13[8]; + /*!< BayerRestNeighbors14[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 14; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors14[8]; + /*!< BayerRestNeighbors21[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 21; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors21[8]; + /*!< BayerRestNeighbors22[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 22; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors22[8]; + /*!< BayerRestNeighbors23[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 23; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors23[8]; + /*!< BayerRestNeighbors24[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 24; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors24[8]; + /*!< BayerRestNeighbors31[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 31; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors31[8]; + /*!< BayerRestNeighbors32[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 32; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors32[8]; + /*!< BayerRestNeighbors33[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 33; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors33[8]; + /*!< BayerRestNeighbors34[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 34; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors34[8]; + /*!< BayerRestNeighbors41[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 41; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors41[8]; + /*!< BayerRestNeighbors42[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 42; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors42[8]; + /*!< BayerRestNeighbors43[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 43; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors43[8]; + /*!< BayerRestNeighbors44[8] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) of up-to-four neighboring pixels chosen for restoration in CFA locations 44; (y=0,x=0) excludes the corresponding sample from consideration by setting its weight to 0*/ + int32_t BayerRestNeighbors44[8]; + /*!< BayerRestLuma Disable the use of the luminance in Bayer CFA restoration (0: disable, 1: enable)*/ + int32_t BayerRestLuma; + /*!< BayerRestWeights Disable the use of the weights in Bayer CFA restoration (0: disable, 1: enable)*/ + int32_t BayerRestWeights; + /*!< IRspatialOffset[2] Spatial shift (y,x) of pixel locations for IR contamination correction*/ + int32_t IRspatialOffset[2]; + /*!< IRbinningFactor[2] Binning factors (y,x) for IR contamination correction*/ + int32_t IRbinningFactor[2]; + /*!< IRcormode IR contamination correction mode (0: disable, 1: enable)*/ + int32_t IRcormode; + /*!< IRmodelSigma[3] IR contamination model sigma (R,G,B)*/ + int32_t IRmodelSigma[3]; + /*!< IRmodelOffset[3] IR contamination model offset (R,G,B)*/ + int32_t IRmodelOffset[3]; + /*!< IRmodelHeight[3] IR contamination model height (R,G,B)*/ + int32_t IRmodelHeight[3]; + /*!< IRmodelWidth[3] IR contamination model width (R,G,B)*/ + int32_t IRmodelWidth[3]; + /*!< IRmodelMax[3] IR contamination model maximum (R,G,B)*/ + int32_t IRmodelMax[3]; + /*!< IRmodelCUxR[12] IR contamination model configuration unit parameter set X for R channel*/ + int32_t IRmodelCUxR[12]; + /*!< IRmodelCUaR[11] IR contamination model configuration unit parameter set A for R channel*/ + int32_t IRmodelCUaR[11]; + /*!< IRmodelCUbR[11] IR contamination model configuration unit parameter set B for R channel*/ + int32_t IRmodelCUbR[11]; + /*!< IRmodelCUxG[12] IR contamination model configuration unit parameter set X for G channel*/ + int32_t IRmodelCUxG[12]; + /*!< IRmodelCUaG[11] IR contamination model configuration unit parameter set A for G channel*/ + int32_t IRmodelCUaG[11]; + /*!< IRmodelCUbG[11] IR contamination model configuration unit parameter set B for G channel*/ + int32_t IRmodelCUbG[11]; + /*!< IRmodelCUxB[12] IR contamination model configuration unit parameter set X for B channel*/ + int32_t IRmodelCUxB[12]; + /*!< IRmodelCUaB[11] IR contamination model configuration unit parameter set A for B channel*/ + int32_t IRmodelCUaB[11]; + /*!< IRmodelCUbB[11] IR contamination model configuration unit parameter set B for B channel*/ + int32_t IRmodelCUbB[11]; + /*!< IRinterpNeighbors11[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 11*/ + int32_t IRinterpNeighbors11[12]; + /*!< IRinterpNeighbors12[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 12*/ + int32_t IRinterpNeighbors12[12]; + /*!< IRinterpNeighbors13[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 13*/ + int32_t IRinterpNeighbors13[12]; + /*!< IRinterpNeighbors14[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 14*/ + int32_t IRinterpNeighbors14[12]; + /*!< IRinterpNeighbors21[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 21*/ + int32_t IRinterpNeighbors21[12]; + /*!< IRinterpNeighbors22[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 22*/ + int32_t IRinterpNeighbors22[12]; + /*!< IRinterpNeighbors23[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 23*/ + int32_t IRinterpNeighbors23[12]; + /*!< IRinterpNeighbors24[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 24*/ + int32_t IRinterpNeighbors24[12]; + /*!< IRinterpNeighbors31[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 31*/ + int32_t IRinterpNeighbors31[12]; + /*!< IRinterpNeighbors32[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 32*/ + int32_t IRinterpNeighbors32[12]; + /*!< IRinterpNeighbors33[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 33*/ + int32_t IRinterpNeighbors33[12]; + /*!< IRinterpNeighbors34[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 34*/ + int32_t IRinterpNeighbors34[12]; + /*!< IRinterpNeighbors41[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 41*/ + int32_t IRinterpNeighbors41[12]; + /*!< IRinterpNeighbors42[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 42*/ + int32_t IRinterpNeighbors42[12]; + /*!< IRinterpNeighbors43[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 43*/ + int32_t IRinterpNeighbors43[12]; + /*!< IRinterpNeighbors44[12] Spatial offsets (y1,x1,y2,x2,y3,x3,y4,x4) and corresponding weights (w1,w2,w3,w4) of four neighboring pixels for IR interpolation in CFA locations 44*/ + int32_t IRinterpNeighbors44[12]; + /*!< IRscaledSensorDim[2] Scaled sensor dimensions (height,width) for IR contamination correction (optical center calculation); (1 << SHVAL)/SensorDim, for SHVAL = 24. Maximum value assumes that sensor dimensions are larger than 256*/ + int32_t IRscaledSensorDim[2]; + /*!< IRscaledModelSigma[3] Scaled IR contamination model sigma (R,G,B); (1 << SMVAL)/IRmodelSigma, for SMVAL = 16*/ + int32_t IRscaledModelSigma[3]; + +} ia_pal_isp_rgb_ir_2_0_t; + +/*! \isp struct rgbs_grid_1_1 + +*/ +typedef struct +{ + /*!< grid_height represents number of vertical grid cells*/ + int32_t grid_height; + /*!< grid_width represents number of horizontal grid cells*/ + int32_t grid_width; + /*!< block_width Log2 the width of each grid cell (8,16,32,64,128)*/ + int32_t block_width; + /*!< block_height Log2 the height of each grid cell (8,16,32,64,128)*/ + int32_t block_height; + /*!< min_out_bytes_per_cell Minimum bytes per grid cell in output buffer (pad with '0's in MSB side if not met otherwise)*/ + int32_t min_out_bytes_per_cell; + /*!< rgbs_en 0: FF will not write to the RGBS array; 1: FF will write*/ + int32_t rgbs_en; + /*!< rgbs_incl_sat 0: do not include saturated quads in the average; 1: include saturated quads in the average*/ + int32_t rgbs_incl_sat; + /*!< x_start X top left corner of the grid. 0 <= x_start <= (frame_width - 1)*/ + int32_t x_start; + /*!< y_start Y top left corner of the grid. 0 <= y_start <= (frame_height - 1)*/ + int32_t y_start; + /*!< x_end X bottom right corner of the grid. x_end = x_start + (grid_width << block_width) - 1*/ + int32_t x_end; + /*!< y_end Y bottom right corner of the grid. y_end = y_start + (grid_height << block_height) - 1*/ + int32_t y_end; + /*!< sensor_mode 0: 1x1 CFA (array sensor); 1: 2 x 2 CFA; 2: 4 x 4 CFA*/ + int32_t sensor_mode; + /*!< pat_00 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_00; + /*!< pat_01 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_01; + /*!< pat_02 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_02; + /*!< pat_03 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_03; + /*!< pat_10 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_10; + /*!< pat_11 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_11; + /*!< pat_12 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_12; + /*!< pat_13 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_13; + /*!< pat_20 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_20; + /*!< pat_21 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_21; + /*!< pat_22 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_22; + /*!< pat_23 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_23; + /*!< pat_30 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_30; + /*!< pat_31 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_31; + /*!< pat_32 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_32; + /*!< pat_33 defines the color ID of the pixel in the CFA pattern; Pat_ij: i - row, j - column*/ + int32_t pat_33; + /*!< rgbs_thr_cx[8] RGBS threshold value (C0, C1, C2, C3, C4, C5, C6, C7)*/ + int32_t rgbs_thr_cx[8]; + /*!< shftr_val_cx[8] ShiftVal is derived from log2(number of pixels from C0-C7 color channel in a cell)*/ + int32_t shftr_val_cx[8]; + /*!< shftr_sat represents log2(num of pixels in cell)*/ + int32_t shftr_sat; + /*!< output_packed Enabling Output packing. Use 0 if ColorID [0 3] are used, Use 1 if all ColorIDs i.e. [0 7] are used (i.e. multi-exposure (e.g. SVE) use-cases)*/ + int32_t output_packed; + /*!< copy_out_components bit0: copy_enable_colorid0, bit1..3: copy_src_colorid, bit4: copy_enable_colorid1, bit5..7: copy_src_colorid, ... , bit28: copy_enable_colorid7, bit29..31: copy_src_colorid*/ + uint32_t copy_out_components; + +} ia_pal_isp_rgbs_grid_1_1_t; + +/*! \isp struct smurf_1_0 + +*/ +typedef struct +{ + /*!< enable enables the filter, if disabled the input is copied to the output*/ + int32_t enable; + /*!< downscale_factor U1.15, ws / wt, reciprocal of upscaling ratio*/ + int32_t downscale_factor; + /*!< x_start U13.15 location of the center of the top-left pixel*/ + int32_t x_start; + /*!< y_start U13.15 location of the center of the top-left pixel*/ + int32_t y_start; + /*!< in_width input image width*/ + int32_t in_width; + /*!< in_height input image height*/ + int32_t in_height; + /*!< out_width output image width*/ + int32_t out_width; + /*!< out_height output image height*/ + int32_t out_height; + +} ia_pal_isp_smurf_1_0_t; + +/*! \isp struct tnr_scaler_1_1 + +*/ +typedef struct +{ + /*!< enable enable TNR_SCALE_1_0 filter*/ + int32_t enable; + /*!< inWidth Number of pixels per row at output*/ + int32_t inWidth; + /*!< inHeight Number of rows at output*/ + int32_t inHeight; + /*!< bitReductionBypass bypass of bit reduction of input pixels*/ + int32_t bitReductionBypass; + /*!< inputShift shift on input pixels*/ + int32_t inputShift; + /*!< cu_bit_reduce_x[6] input bit reduction config unit - x values*/ + int32_t cu_bit_reduce_x[6]; + /*!< cu_bit_reduce_y[5] input bit reduction config unit - y values*/ + int32_t cu_bit_reduce_y[5]; + /*!< cu_bit_reduce_slope[5] input bit reduction config unit - slope values*/ + int32_t cu_bit_reduce_slope[5]; + +} ia_pal_isp_tnr_scaler_1_1_t; + +/*! \isp struct tnr7_bc_1_2 + +*/ +typedef struct +{ + /*!< enable block enable*/ + int32_t enable; + /*!< is_first_frame If first frame, ignore input rec-sim*/ + int32_t is_first_frame; + /*!< is_segmentation_aware SAP enable*/ + int32_t is_segmentation_aware; + /*!< do_update Limit of S&R parameter update mechanism*/ + int32_t do_update; + /*!< coeffs[3] Per-region mult-and-clamp coefficients*/ + int32_t coeffs[3]; + /*!< coeffs_user[3] Per-region mult-and-clamp coefficients (specified by user during offline calibration)*/ + int32_t coeffs_user[3]; + /*!< tune_sensitivity user tuning - alignment-conf sensitivity*/ + int32_t tune_sensitivity; + /*!< tune_sensitivity_class[16] user tuning - alignment-conf sensitivity*/ + int32_t tune_sensitivity_class[16]; + /*!< global_protection global protection enable*/ + int32_t global_protection; + /*!< global_protection_sensitivity_lut_values[3] global protection - LUT values*/ + int32_t global_protection_sensitivity_lut_values[3]; + /*!< global_protection_sensitivity_lut_slopes[2] global protection - LUT slopes*/ + int32_t global_protection_sensitivity_lut_slopes[2]; + /*!< global_protection_motion_level average alignment conf of previous frame*/ + int32_t global_protection_motion_level; + /*!< global_protection_motion_level_user average alignment conf of previous frame (specified by user during offline calibration)*/ + int32_t global_protection_motion_level_user; + /*!< global_protection_inv_num_pixels inverse of number of pixels in frame - prec is U0.20*/ + int32_t global_protection_inv_num_pixels; + /*!< stats_collection_boundaries[2] columns where statitcis collection takes place*/ + int32_t stats_collection_boundaries[2]; + /*!< acc_AC accumulator for sum of alignment confidence*/ + int32_t acc_AC; + /*!< acc_num_safe_pixels accumulator for num of safe pixels*/ + int32_t acc_num_safe_pixels; + /*!< acc_histogram[189] APU histogram*/ + int32_t acc_histogram[189]; + /*!< is_first_stripe is first stripe in frame*/ + int32_t is_first_stripe; + /*!< is_last_stripe is last stripe in frame*/ + int32_t is_last_stripe; + /*!< bgm_is_overlap[16] defines which segment is an overlap segment*/ + int32_t bgm_is_overlap[16]; + /*!< bgm_global_protection_th defines which segment is an overlap segment*/ + int32_t bgm_global_protection_th; + +} ia_pal_isp_tnr7_bc_1_2_t; + +/*! \isp struct tnr7_blend_1_1 + +*/ +typedef struct +{ + /*!< enable Enable TNR7 blend*/ + int32_t enable; + /*!< is_segmentation_aware SAP enable*/ + int32_t is_segmentation_aware; + /*!< denoise_power_class[16] Segmentation-aware denoise power*/ + int32_t denoise_power_class[16]; + /*!< single_output_mode Both outputs use the same blend*/ + int32_t single_output_mode; + /*!< spatial_weight_coeff Spatial weight coeff to be used in single_output_mode*/ + int32_t spatial_weight_coeff; + /*!< max_recursive_similarity Maximum value of recursive similarity*/ + int32_t max_recursive_similarity; + /*!< max_recursive_similarity_class[16] Maximum value of recursive similarity*/ + int32_t max_recursive_similarity_class[16]; + /*!< spatial_alpha Use of spatial filtering in the feedback output*/ + int32_t spatial_alpha; + /*!< w_out_prev_LUT[32] Weight of reference in the main output*/ + int32_t w_out_prev_LUT[32]; + /*!< w_out_spl_LUT[32] Weight of spatial in the main output*/ + int32_t w_out_spl_LUT[32]; + /*!< bgm_is_overlap[16] defines which segment is an overlap segment*/ + int32_t bgm_is_overlap[16]; + /*!< bgm_alpha_output[16] alpha value for blending the output image*/ + int32_t bgm_alpha_output[16]; + /*!< bgm_alpha_fb[16] alpha value for blending the feedback image*/ + int32_t bgm_alpha_fb[16]; + +} ia_pal_isp_tnr7_blend_1_1_t; + +/*! \isp struct tnr7_ims_1_2 + +*/ +typedef struct +{ + /*!< enable block enable*/ + int32_t enable; + /*!< update_limit Limit of S&R parameter update mechanism*/ + int32_t update_limit; + /*!< update_coeff S&R parameter update coefficient*/ + int32_t update_coeff; + /*!< do_update Enables S&R update mechanism for distance log-likelihood distribution*/ + int32_t do_update; + /*!< d_ml[16] Maximum-likelihood of distance distribution*/ + int32_t d_ml[16]; + /*!< d_slopes[16] Distance log-likelihood slopes*/ + int32_t d_slopes[16]; + /*!< d_top[16] Distance log-likelihood constants*/ + int32_t d_top[16]; + /*!< outofbounds[16] Is ml value out-of-hostogram-bounds?*/ + int32_t outofbounds[16]; + /*!< d_ml_user[16] Maximum-likelihood of distance distribution (specified by user during offline calibration)*/ + int32_t d_ml_user[16]; + /*!< d_slopes_user[16] Distance log-likelihood slopes (specified by user during offline calibration)*/ + int32_t d_slopes_user[16]; + /*!< d_top_user[16] Distance log-likelihood constants (specified by user during offline calibration)*/ + int32_t d_top_user[16]; + /*!< gpu_mode meta parameter for controlling convolution implementation: 0 - HW implementation 1 - GPU implementation*/ + int32_t gpu_mode; + /*!< stats_collection_boundaries[2] columns where statitcis collection takes place*/ + int32_t stats_collection_boundaries[2]; + /*!< acc_histogram[512] APU histogram*/ + int32_t acc_histogram[512]; + /*!< is_first_stripe is first stripe in frame*/ + int32_t is_first_stripe; + /*!< is_last_stripe is last stripe in frame*/ + int32_t is_last_stripe; + /*!< radial_start radial correction start (relative to frame size)*/ + int32_t radial_start; + /*!< radial_coeff radial correction power*/ + int32_t radial_coeff; + /*!< frame_center_y frame center vertical*/ + int32_t frame_center_y; + /*!< frame_center_x frame center horizontal*/ + int32_t frame_center_x; + /*!< r_coeff radius relative to frame size*/ + int32_t r_coeff; + +} ia_pal_isp_tnr7_ims_1_2_t; + +/*! \isp struct tnr7_mc_1_0 + +*/ +typedef struct +{ + /*!< passThrough Passthrough (set the motion vectors to zero when enabled)*/ + int32_t passThrough; + /*!< imageHeightFR Height (pixels) of the full-resolution image*/ + int32_t imageHeightFR; + /*!< imageWidthFR Width (pixels) of the full-resolution image*/ + int32_t imageWidthFR; + /*!< imageHeightDS Height (pixels) of the small-resoltion image*/ + int32_t imageHeightDS; + /*!< imageWidthDS Width (pixels) of the small-resoltion image*/ + int32_t imageWidthDS; + +} ia_pal_isp_tnr7_mc_1_0_t; + +/*! \isp struct tnr7_spatial_1_1 + +*/ +typedef struct +{ + /*!< enable Enable TNR7 spatial fallback filter*/ + int32_t enable; + /*!< noise_model_radius Controls noise model radius*/ + int32_t noise_model_radius; + /*!< iir_luma_power iir luma filtering strength (0-only fir, 64-only iir)*/ + int32_t iir_luma_power; + /*!< iir_chroma_power iir chroma filtering strength (0-only fir, 64-only iir)*/ + int32_t iir_chroma_power; + /*!< luma_strength blending coef for luma channel (blend with input)*/ + int32_t luma_strength; + /*!< chroma_strength blending coef for chroma channel (blend with input)*/ + int32_t chroma_strength; + /*!< lumaLUT_v[16] self calibrating noise model (NM) state variables, luma*/ + int32_t lumaLUT_v[16]; + /*!< lumaLUT_v_bins[16] self calibrating noise model (NM) state variables, luma*/ + int32_t lumaLUT_v_bins[16]; + /*!< lumaLUT_v_limits[2] vertical luma NM limnits*/ + int32_t lumaLUT_v_limits[2]; + /*!< nmGain_h_limits[2] horizontal luma NM limnits*/ + int32_t nmGain_h_limits[2]; + /*!< nmGain_iir_limits[2] iir luma NM limnits*/ + int32_t nmGain_iir_limits[2]; + /*!< nmGain_h horizontal NM gain*/ + int32_t nmGain_h; + /*!< nmGain_iir iir NM gain*/ + int32_t nmGain_iir; + /*!< update_limit update rate of N lut (0-no update, 256-current frame only)*/ + int32_t update_limit; + /*!< update_coeff slope of the update rate as a function of #samples*/ + int32_t update_coeff; + /*!< stats_collection_boundaries[2] columns where statitcis collection takes place*/ + int32_t stats_collection_boundaries[2]; + /*!< acc_histogram_v[256] APU histogram - vertical*/ + int32_t acc_histogram_v[256]; + /*!< acc_histogram_h[16] APU histogram - horizontal*/ + int32_t acc_histogram_h[16]; + /*!< acc_histogram_iir[16] APU histogram - IIR*/ + int32_t acc_histogram_iir[16]; + /*!< is_first_stripe is first stripe in frame*/ + int32_t is_first_stripe; + /*!< is_last_stripe is last stripe in frame*/ + int32_t is_last_stripe; + +} ia_pal_isp_tnr7_spatial_1_1_t; + +/*! \isp struct upipe_1_0 + +*/ +typedef struct +{ + /*!< enable enables the filter, if disabled the input is replicated to all three output channels*/ + int32_t enable; + /*!< input_pattern_0[3] 4x4 pattern to RGB, channels in R,G,B order; default- GRBG*/ + int32_t input_pattern_0[3]; + /*!< demosaic_mode_0 Demosaic mode, 0- 2x2, 1- 4x4. Note that binning interpretation depends on this*/ + int32_t demosaic_mode_0; + /*!< black_level_0[3] Sensor/ tuned black level, per channel. U10 value*/ + int32_t black_level_0[3]; + /*!< binning_factor_0 Log2 of the downscale to use. This is on top of x4 downscale is demosaic*/ + int32_t binning_factor_0; + /*!< color_adjust_matrix_0[9] Color correction matrix, S4.11; default- unity*/ + int32_t color_adjust_matrix_0[9]; + /*!< tone_adjust_lut_0[11] Exponential U10 to U8 gamma LUT; default- linear*/ + int32_t tone_adjust_lut_0[11]; + /*!< rgb_to_yuv_matrix_0[9] RGB to YUV matrix, S4.11; default- BT709*/ + int32_t rgb_to_yuv_matrix_0[9]; + /*!< rgb_to_yuv_en_0 0 - Output is in RGB format; 1 - Output is in YUV format*/ + int32_t rgb_to_yuv_en_0; + /*!< input_pattern_1[3] 4x4 pattern to RGB, channels in R,G,B order; default- GRBG*/ + int32_t input_pattern_1[3]; + /*!< demosaic_mode_1 Demosaic mode, 0- 2x2, 1- 4x4. Note that binning interpretation depends on this*/ + int32_t demosaic_mode_1; + /*!< black_level_1[3] Sensor/ tuned black level, per channel. U10 value*/ + int32_t black_level_1[3]; + /*!< binning_factor_1 Log2 of the downscale to use. This is on top of x4 downscale is demosaic*/ + int32_t binning_factor_1; + /*!< color_adjust_matrix_1[9] Color correction matrix, S4.11; default- unity*/ + int32_t color_adjust_matrix_1[9]; + /*!< tone_adjust_lut_1[11] Exponential U10 to U8 gamma LUT; default- linear*/ + int32_t tone_adjust_lut_1[11]; + /*!< rgb_to_yuv_matrix_1[9] RGB to YUV matrix, S4.11; default- BT709*/ + int32_t rgb_to_yuv_matrix_1[9]; + /*!< rgb_to_yuv_en_1 0 - Output is in RGB format; 1 - Output is in YUV format*/ + int32_t rgb_to_yuv_en_1; + +} ia_pal_isp_upipe_1_0_t; + +/*! \isp struct upscaler_1_1 + +*/ +typedef struct +{ + /*!< upscale_enable enable scaling filter*/ + int32_t upscale_enable; + /*!< scaling_ratio U1.16 , upscale - less than 1, equals to 1/uspcale_factor*/ + int32_t scaling_ratio; + /*!< output_height Output height counted in number of lines*/ + int32_t output_height; + /*!< output_width Output width counted in number of pixels components per line*/ + int32_t output_width; + /*!< upscale_x_offset S0.16 location of the center of the top-left pixel*/ + int32_t upscale_x_offset; + /*!< upscale_y_offset S0.16 location of the center of the top-left pixel*/ + int32_t upscale_y_offset; + /*!< kernel_LUT[129] S1.10 Y+UV channels Interpolation vertical kernel coefficients for scaler*/ + int32_t kernel_LUT[129]; + /*!< chroma_kernel_LUT[129] S1.10 Y+UV channels Interpolation vertical kernel coefficients for scaler*/ + int32_t chroma_kernel_LUT[129]; + /*!< cropper_input_width cropper Input width counted in number of pixels components per line*/ + int32_t cropper_input_width; + /*!< cropper_input_height cropper Input height counted in number of lines*/ + int32_t cropper_input_height; + /*!< cropper_x_output_offset Output horizontal offset from the input, counted in number of pixels components per line, 16b signed (if negative padding is required)*/ + int32_t cropper_x_output_offset; + /*!< cropper_y_output_offset cropper Output vertical offset from the input counted in number of lines, 16b signed*/ + int32_t cropper_y_output_offset; + /*!< cropper_output_width cropper output width, equals upscaler input height*/ + int32_t cropper_output_width; + /*!< cropper_output_height cropper output height, equals upscaler input height*/ + int32_t cropper_output_height; + /*!< upscale_input_height upscaler input height, equals to cropper_output_height*/ + int32_t upscale_input_height; + /*!< upscale_input_width upscaler input width, equals to cropper_output_width*/ + int32_t upscale_input_width; + +} ia_pal_isp_upscaler_1_1_t; + +/*! \isp struct vcr_3_1 + +*/ +typedef struct +{ + /*!< enable enables the filter (YUV420 --> RGB444)*/ + int32_t enable; + /*!< nb1 offset 1 yuv2rgb conversion, rgb = m * yuv + nb*/ + int32_t nb1; + /*!< nb2 offset 2 yuv2rgb conversion, rgb = m * yuv + nb*/ + int32_t nb2; + /*!< nb3 offset 3 yuv2rgb conversion, rgb = m * yuv + nb*/ + int32_t nb3; + /*!< yuv2rgb_matrix[9] yuv to rgb conversion matrix, S4.11*/ + int32_t yuv2rgb_matrix[9]; + +} ia_pal_isp_vcr_3_1_t; + +/*! \isp struct vcsc_2_0 + +*/ +typedef struct +{ + /*!< csc_c_matrix_arr[9] CSC Matrix components (S0.15)*/ + int32_t csc_c_matrix_arr[9]; + /*!< csc_b_vec_arr[3] CSC Vector components (S0.15)*/ + int32_t csc_b_vec_arr[3]; + /*!< chroma_ds_coeff_arr[8] Chroma downsample 4x2 filter coefficients (U2.0)*/ + int32_t chroma_ds_coeff_arr[8]; + /*!< chroma_ds_nf Chroma downsample 4x2 filter normalization factor*/ + int32_t chroma_ds_nf; + /*!< enable Bypassing CSC. Outputting RGB to the Chroma downscale*/ + int32_t enable; + /*!< uv_bin_output 0 = YUV4:2:0 output, 1 = YUV4:2:2 output*/ + int32_t uv_bin_output; + +} ia_pal_isp_vcsc_2_0_t; + +/*! \isp struct wb_1_1 + +*/ +typedef struct +{ + /*!< bypass Bypass {0,1}*/ + int32_t bypass; + /*!< gainch0 Gain Channel0 (Gr) (U8.12)*/ + int32_t gainch0; + /*!< gainch1 Gain Channel1 (Gb) (U8.12)*/ + int32_t gainch1; + /*!< gainch2 Gain Channel2 (G) (U8.12)*/ + int32_t gainch2; + /*!< gainch3 Gain Channel3 (B) (U8.12)*/ + int32_t gainch3; + /*!< gainch4 Gain Channel4 (R) (U8.12)*/ + int32_t gainch4; + /*!< gainch5 Gain Channel5 (W) (U8.12)*/ + int32_t gainch5; + /*!< gainch6 Gain Channel6 (U8.12)*/ + int32_t gainch6; + /*!< gainch7 Gain Channel7 (U8.12)*/ + int32_t gainch7; + /*!< sensormode Sensor CFA size: 1x1 (0), 2x2 (1), 4x4 (2)*/ + int32_t sensormode; + /*!< wbindmat[16] Vector WB matrix*/ + int32_t wbindmat[16]; + +} ia_pal_isp_wb_1_1_t; + +/*! \isp struct xnr_5_4 +Low Frequency Chroma Denoiser +*/ +typedef struct +{ + /*!< top_frame_width XNR5 input frame width*/ + int32_t top_frame_width; + /*!< top_frame_height XNR5 input frame height*/ + int32_t top_frame_height; + /*!< top_xnr_bypass Bypass entire xnr*/ + int32_t top_xnr_bypass; + /*!< vhf_frame_width XNR5 input frame width*/ + int32_t vhf_frame_width; + /*!< vhf_frame_height XNR5 input frame height*/ + int32_t vhf_frame_height; + /*!< vhf_low_band_disable Lower band is disabled and zero on inputs*/ + int32_t vhf_low_band_disable; + /*!< vhf_low_band_only Lower band directly goes to output and other inputs are zeroes*/ + int32_t vhf_low_band_only; + /*!< hf_frame_width XNR5 input frame width*/ + int32_t hf_frame_width; + /*!< hf_frame_height XNR5 input frame height*/ + int32_t hf_frame_height; + /*!< hf_low_band_disable Lower band is disabled and zero on inputs*/ + int32_t hf_low_band_disable; + /*!< hf_low_band_only Lower band directly goes to output and other inputs are zeroes*/ + int32_t hf_low_band_only; + /*!< hf_nr_bypass Input YUV goes directly to output after vertical delay*/ + int32_t hf_nr_bypass; + /*!< hf_se_bypass Replace all SE outputs with se_bypass_val*/ + int32_t hf_se_bypass; + /*!< hf_se_bypass_val SE bypass value*/ + int32_t hf_se_bypass_val; + /*!< mf_frame_width XNR5 input frame width*/ + int32_t mf_frame_width; + /*!< mf_frame_height XNR5 input frame height*/ + int32_t mf_frame_height; + /*!< mf_low_band_disable Lower band is disabled and zero on inputs*/ + int32_t mf_low_band_disable; + /*!< mf_low_band_only Lower band directly goes to output and other inputs are zeroes*/ + int32_t mf_low_band_only; + /*!< mf_nr_bypass Input YUV goes directly to output after vertical delay*/ + int32_t mf_nr_bypass; + /*!< mf_se_bypass Replace all SE outputs with se_bypass_val*/ + int32_t mf_se_bypass; + /*!< mf_se_bypass_val SE bypass value*/ + int32_t mf_se_bypass_val; + /*!< lf_frame_width XNR5 input frame width*/ + int32_t lf_frame_width; + /*!< lf_frame_height XNR5 input frame height*/ + int32_t lf_frame_height; + /*!< lf_low_band_disable Lower band is disabled and zero on inputs*/ + int32_t lf_low_band_disable; + /*!< lf_low_band_only Lower band directly goes to output and other inputs are zeroes*/ + int32_t lf_low_band_only; + /*!< lf_nr_bypass Input YUV goes directly to output after vertical delay*/ + int32_t lf_nr_bypass; + /*!< lf_se_bypass Replace all SE outputs with se_bypass_val*/ + int32_t lf_se_bypass; + /*!< lf_se_bypass_val SE bypass value*/ + int32_t lf_se_bypass_val; + /*!< vlf_frame_width XNR5 input frame width*/ + int32_t vlf_frame_width; + /*!< vlf_frame_height XNR5 input frame height*/ + int32_t vlf_frame_height; + /*!< vlf_low_band_disable Lower band is disabled and zero on inputs*/ + int32_t vlf_low_band_disable; + /*!< vlf_low_band_only Lower band directly goes to output and other inputs are zeroes*/ + int32_t vlf_low_band_only; + /*!< vlf_nr_bypass Input YUV goes directly to output after vertical delay*/ + int32_t vlf_nr_bypass; + /*!< vlf_se_bypass Replace all SE outputs with se_bypass_val*/ + int32_t vlf_se_bypass; + /*!< vlf_se_bypass_val SE bypass value*/ + int32_t vlf_se_bypass_val; + /*!< Bypass Deprecated bypass parameter - to be removed!*/ + int32_t Bypass; + /*!< top_viir_coefs_b[3] Param_Top_VIIR_b*/ + int32_t top_viir_coefs_b[3]; + /*!< top_viir_coefs_a[2] Param_Top_VIIR_a*/ + int32_t top_viir_coefs_a[2]; + /*!< top_viir_offset Param_Top_VIIR_offset*/ + int32_t top_viir_offset; + /*!< top_viir_alpha Param_Top_VIIR_alpha*/ + int32_t top_viir_alpha; + /*!< top_hus_vlf_image_coefs[9] Param_Top_HUS_VLF_Image_func*/ + int32_t top_hus_vlf_image_coefs[9]; + /*!< top_hus_vlf_delta_coefs[9] Param_Top_HUS_VLF_Delta_func*/ + int32_t top_hus_vlf_delta_coefs[9]; + /*!< top_hus_lf_image_coefs[5] Param_Top_HUS_LF_Image_func*/ + int32_t top_hus_lf_image_coefs[5]; + /*!< top_hus_lf_delta_coefs[5] Param_Top_HUS_LF_Delta_func*/ + int32_t top_hus_lf_delta_coefs[5]; + /*!< top_hus_mf_image_coefs[5] Param_Top_HUS_MF_Image_func*/ + int32_t top_hus_mf_image_coefs[5]; + /*!< top_hus_mf_delta_coefs[5] Param_Top_HUS_MF_Delta_func*/ + int32_t top_hus_mf_delta_coefs[5]; + /*!< hf_blf_2dfir_filter_length Param_HFC_BLF_FIR_BfLen*/ + int32_t hf_blf_2dfir_filter_length; + /*!< hf_blf_2dfir_dcdc_bypass_y Param_HFC_BLF_FIR_bypassDCDifferentialCompensationY*/ + int32_t hf_blf_2dfir_dcdc_bypass_y; + /*!< hf_blf_2dfir_dcdc_thresh_y_y Param_HFC_BLF_FIR_DCDiffThYy*/ + uint32_t hf_blf_2dfir_dcdc_thresh_y_y; + /*!< hf_blf_2dfir_dcdc_thresh_y_u Param_HFC_BLF_FIR_DCDiffThYu*/ + uint32_t hf_blf_2dfir_dcdc_thresh_y_u; + /*!< hf_blf_2dfir_dcdc_thresh_y_v Param_HFC_BLF_FIR_DCDiffThYv*/ + uint32_t hf_blf_2dfir_dcdc_thresh_y_v; + /*!< hf_blf_2dfir_dcdc_bypass_uv Param_HFC_BLF_FIR_bypassDCDifferentialCompensationUV*/ + int32_t hf_blf_2dfir_dcdc_bypass_uv; + /*!< hf_blf_2dfir_dcdc_thresh_uv_y Param_HFC_BLF_FIR_DCDiffThUVy*/ + uint32_t hf_blf_2dfir_dcdc_thresh_uv_y; + /*!< hf_blf_2dfir_dcdc_thresh_uv_u Param_HFC_BLF_FIR_DCDiffThUVu*/ + uint32_t hf_blf_2dfir_dcdc_thresh_uv_u; + /*!< hf_blf_2dfir_dcdc_thresh_uv_v Param_HFC_BLF_FIR_DCDiffThUVv*/ + uint32_t hf_blf_2dfir_dcdc_thresh_uv_v; + /*!< hf_blf_colorspace Param_HFC_BLF_colorspaceYRB*/ + int32_t hf_blf_colorspace; + /*!< hf_blf_noisemodel_basefunc_y_a_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacY_A_X*/ + int32_t hf_blf_noisemodel_basefunc_y_a_x[5]; + /*!< hf_blf_noisemodel_basefunc_y_a_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacY_A_Y*/ + int32_t hf_blf_noisemodel_basefunc_y_a_y[4]; + /*!< hf_blf_noisemodel_basefunc_y_a_slope[4] Param_HFC_BLF_NoiseModel_sigmaParafacY_A_Slope*/ + int32_t hf_blf_noisemodel_basefunc_y_a_slope[4]; + /*!< hf_blf_noisemodel_basefunc_y_b_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacY_B_X*/ + int32_t hf_blf_noisemodel_basefunc_y_b_x[5]; + /*!< hf_blf_noisemodel_basefunc_y_b_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacY_B Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_y_b_y[4]; + /*!< hf_blf_noisemodel_basefunc_y_b_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_y_b_slope[4]; + /*!< hf_blf_noisemodel_basefunc_y_c_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacY_C_X*/ + int32_t hf_blf_noisemodel_basefunc_y_c_x[5]; + /*!< hf_blf_noisemodel_basefunc_y_c_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacY_C Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_y_c_y[4]; + /*!< hf_blf_noisemodel_basefunc_y_c_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_y_c_slope[4]; + /*!< hf_blf_noisemodel_basefunc_y_wbg Param_HFC_BLF_NoiseModel_sigmaParafacY_DEF*/ + int32_t hf_blf_noisemodel_basefunc_y_wbg; + /*!< hf_blf_noisemodel_basefunc_u_a_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacU_A_X*/ + int32_t hf_blf_noisemodel_basefunc_u_a_x[5]; + /*!< hf_blf_noisemodel_basefunc_u_a_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacU_A Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_u_a_y[4]; + /*!< hf_blf_noisemodel_basefunc_u_a_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_u_a_slope[4]; + /*!< hf_blf_noisemodel_basefunc_u_b_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacU_B_X*/ + int32_t hf_blf_noisemodel_basefunc_u_b_x[5]; + /*!< hf_blf_noisemodel_basefunc_u_b_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacU_B Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_u_b_y[4]; + /*!< hf_blf_noisemodel_basefunc_u_b_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_u_b_slope[4]; + /*!< hf_blf_noisemodel_basefunc_u_c_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacU_C_X*/ + int32_t hf_blf_noisemodel_basefunc_u_c_x[5]; + /*!< hf_blf_noisemodel_basefunc_u_c_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacU_C Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_u_c_y[4]; + /*!< hf_blf_noisemodel_basefunc_u_c_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_u_c_slope[4]; + /*!< hf_blf_noisemodel_basefunc_u_wbg Param_HFC_BLF_NoiseModel_sigmaParafacU_DEF*/ + int32_t hf_blf_noisemodel_basefunc_u_wbg; + /*!< hf_blf_noisemodel_basefunc_v_a_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacV_A_X*/ + int32_t hf_blf_noisemodel_basefunc_v_a_x[5]; + /*!< hf_blf_noisemodel_basefunc_v_a_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacV_A Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_v_a_y[4]; + /*!< hf_blf_noisemodel_basefunc_v_a_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_v_a_slope[4]; + /*!< hf_blf_noisemodel_basefunc_v_b_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacV_B_X*/ + int32_t hf_blf_noisemodel_basefunc_v_b_x[5]; + /*!< hf_blf_noisemodel_basefunc_v_b_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacV_B Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_v_b_y[4]; + /*!< hf_blf_noisemodel_basefunc_v_b_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_v_b_slope[4]; + /*!< hf_blf_noisemodel_basefunc_v_c_x[5] Param_HFC_BLF_NoiseModel_sigmaParafacV_C_X*/ + int32_t hf_blf_noisemodel_basefunc_v_c_x[5]; + /*!< hf_blf_noisemodel_basefunc_v_c_y[4] Param_HFC_BLF_NoiseModel_sigmaParafacV_C Config Unit Value*/ + int32_t hf_blf_noisemodel_basefunc_v_c_y[4]; + /*!< hf_blf_noisemodel_basefunc_v_c_slope[4] Slope*/ + int32_t hf_blf_noisemodel_basefunc_v_c_slope[4]; + /*!< hf_blf_noisemodel_basefunc_v_wbg Param_HFC_BLF_NoiseModel_sigmaParafacV_DEF*/ + int32_t hf_blf_noisemodel_basefunc_v_wbg; + /*!< hf_blf_noisemodel_weight_uv_y Param_HFC_BLF_NoiseModel_sigmaWgtUVy*/ + int32_t hf_blf_noisemodel_weight_uv_y; + /*!< hf_blf_noisemodel_weight_uv_u Param_HFC_BLF_NoiseModel_sigmaWgtUVu*/ + int32_t hf_blf_noisemodel_weight_uv_u; + /*!< hf_blf_noisemodel_weight_uv_v Param_HFC_BLF_NoiseModel_sigmaWgtUVv*/ + int32_t hf_blf_noisemodel_weight_uv_v; + /*!< hf_blf_noisemodel_radialdependent_bypass Param_HFC_BLF_NoiseModel_bypassRadialCorrection*/ + int32_t hf_blf_noisemodel_radialdependent_bypass; + /*!< hf_blf_noisemodel_colordependent_bypass Param_HFC_BLF_NoiseModel_bypassColorDependent*/ + int32_t hf_blf_noisemodel_colordependent_bypass; + /*!< hf_blf_noisemodel_graydependent_bypass Param_HFC_BLF_NoiseModel_bypassGrayDependent*/ + int32_t hf_blf_noisemodel_graydependent_bypass; + /*!< hf_blf_noisemodel_radialdependent_x0 Param_HFC_BLF_NoiseModel_radialDependent_x0*/ + int32_t hf_blf_noisemodel_radialdependent_x0; + /*!< hf_blf_noisemodel_radialdependent_x0_square Param_HFC_BLF_NoiseModel_radialDependent_x0_square*/ + int32_t hf_blf_noisemodel_radialdependent_x0_square; + /*!< hf_blf_noisemodel_radialdependent_y0 Param_HFC_BLF_NoiseModel_radialDependent_y0*/ + int32_t hf_blf_noisemodel_radialdependent_y0; + /*!< hf_blf_noisemodel_radialdependent_y0_square Param_HFC_BLF_NoiseModel_radialDependent_y0_square*/ + int32_t hf_blf_noisemodel_radialdependent_y0_square; + /*!< hf_blf_noisemodel_radialdependent_rshift_norm_square_distance Param_HFC_BLF_NoiseModel_radialDependent_rshiftNormSquareDist*/ + int32_t hf_blf_noisemodel_radialdependent_rshift_norm_square_distance; + /*!< hf_blf_noisemodel_radialdependent_gain_x[4] Param_HFC_BLF_NoiseModel_radialDependent_radialLut_X*/ + int32_t hf_blf_noisemodel_radialdependent_gain_x[4]; + /*!< hf_blf_noisemodel_radialdependent_gain_y[3] Param_HFC_BLF_NoiseModel_radialDependent_radialLut Config Unit Value*/ + int32_t hf_blf_noisemodel_radialdependent_gain_y[3]; + /*!< hf_blf_noisemodel_radialdependent_gain_slope[3] Slope*/ + int32_t hf_blf_noisemodel_radialdependent_gain_slope[3]; + /*!< hf_blf_noisemodel_colordependent_a[32] Param_HFC_BLF_NoiseModel_colorDependent_A*/ + int32_t hf_blf_noisemodel_colordependent_a[32]; + /*!< hf_blf_noisemodel_colordependent_b[32] Param_HFC_BLF_NoiseModel_colorDependent_B*/ + int32_t hf_blf_noisemodel_colordependent_b[32]; + /*!< hf_blf_noisemodel_colordependent_c[32] Param_HFC_BLF_NoiseModel_colorDependent_C*/ + int32_t hf_blf_noisemodel_colordependent_c[32]; + /*!< hf_blf_noisemodel_colordependent_norm_offset Param_HFC_BLF_NoiseModel_colorDependent_normalization_offset*/ + int32_t hf_blf_noisemodel_colordependent_norm_offset; + /*!< hf_blf_noisemodel_colordependent_gain_x[6] Param_HFC_BLF_NoiseModel_colorDependent_Lut_X*/ + int32_t hf_blf_noisemodel_colordependent_gain_x[6]; + /*!< hf_blf_noisemodel_colordependent_gain_y[5] Param_HFC_BLF_NoiseModel_colorDependent_Lut Config Unit Value*/ + int32_t hf_blf_noisemodel_colordependent_gain_y[5]; + /*!< hf_blf_noisemodel_colordependent_gain_slope[5] Slope*/ + int32_t hf_blf_noisemodel_colordependent_gain_slope[5]; + /*!< hf_blf_noisemodel_graydependent_graylevel_thresh Param_HFC_BLF_NoiseModel_grayDependent_grayThrsh*/ + int32_t hf_blf_noisemodel_graydependent_graylevel_thresh; + /*!< hf_blf_noisemodel_graydependent_graylevel_slope Param_HFC_BLF_NoiseModel_grayDependent_graySlope*/ + int32_t hf_blf_noisemodel_graydependent_graylevel_slope; + /*!< hf_blf_noisemodel_graydependent_gain_x[6] Param_HFC_BLF_NoiseModel_grayDependent_transLut_X*/ + int32_t hf_blf_noisemodel_graydependent_gain_x[6]; + /*!< hf_blf_noisemodel_graydependent_gain_y[5] Param_HFC_BLF_NoiseModel_grayDependent_transLut Config Unit Value*/ + int32_t hf_blf_noisemodel_graydependent_gain_y[5]; + /*!< hf_blf_noisemodel_graydependent_gain_slope[5] Slope*/ + int32_t hf_blf_noisemodel_graydependent_gain_slope[5]; + /*!< hf_blf_noisemodel_normfactor_uv_y Param_HFC_BLF_NoiseModel_invSigmaUVy*/ + int32_t hf_blf_noisemodel_normfactor_uv_y; + /*!< hf_blf_noisemodel_normfactor_uv_u Param_HFC_BLF_NoiseModel_invSigmaUVu*/ + int32_t hf_blf_noisemodel_normfactor_uv_u; + /*!< hf_blf_noisemodel_normfactor_uv_v Param_HFC_BLF_NoiseModel_invSigmaUVv*/ + int32_t hf_blf_noisemodel_normfactor_uv_v; + /*!< hf_blf_snrm_bypass Param_HFC_BLF_SNRM_bypassSNRManagement*/ + int32_t hf_blf_snrm_bypass; + /*!< hf_blf_snrm_slope_uv Param_HFC_BLF_SNRM_slopeUV*/ + int32_t hf_blf_snrm_slope_uv; + /*!< hf_blf_snrm_xoffset_uv Param_HFC_BLF_SNRM_xoffsetUV*/ + int32_t hf_blf_snrm_xoffset_uv; + /*!< hf_blf_snrm_maxval_uv Param_HFC_BLF_SNRM_maxValUV*/ + int32_t hf_blf_snrm_maxval_uv; + /*!< hf_blf_snrm_minval_uv Param_HFC_BLF_SNRM_minValUV*/ + int32_t hf_blf_snrm_minval_uv; + /*!< hf_afc_bypass Param_HFC_AFC_bypassAntiFalseColor*/ + int32_t hf_afc_bypass; + /*!< hf_afc_weight_snr Param_HFC_AFC_wgtSnr*/ + int32_t hf_afc_weight_snr; + /*!< hf_afc_weight_chroma Param_HFC_AFC_wgtC*/ + int32_t hf_afc_weight_chroma; + /*!< hf_min_distance_clamp Param_HFC_min_distance_clamp*/ + int32_t hf_min_distance_clamp; + /*!< mf_blf_2dfir_filter_length Param_MF_BLF_FIR_BfLen*/ + int32_t mf_blf_2dfir_filter_length; + /*!< mf_blf_2dfir_luma_coefs[10] Param_MF_BLF_FIR_Kn_coef*/ + int32_t mf_blf_2dfir_luma_coefs[10]; + /*!< mf_blf_2dfir_luma_denom_bits Param_MF_BLF_FIR_Kn_denom_bits*/ + int32_t mf_blf_2dfir_luma_denom_bits; + /*!< mf_blf_2dfir_dcdc_bypass_y Param_MF_BLF_FIR_bypassDCDifferentialCompensationY*/ + int32_t mf_blf_2dfir_dcdc_bypass_y; + /*!< mf_blf_2dfir_dcdc_thresh_y_y Param_MF_BLF_FIR_DCDiffThYy*/ + uint32_t mf_blf_2dfir_dcdc_thresh_y_y; + /*!< mf_blf_2dfir_dcdc_thresh_y_u Param_MF_BLF_FIR_DCDiffThYu*/ + uint32_t mf_blf_2dfir_dcdc_thresh_y_u; + /*!< mf_blf_2dfir_dcdc_thresh_y_v Param_MF_BLF_FIR_DCDiffThYv*/ + uint32_t mf_blf_2dfir_dcdc_thresh_y_v; + /*!< mf_blf_2dfir_dcdc_bypass_uv Param_MF_BLF_FIR_bypassDCDifferentialCompensationUV*/ + int32_t mf_blf_2dfir_dcdc_bypass_uv; + /*!< mf_blf_2dfir_dcdc_thresh_uv_y Param_MF_BLF_FIR_DCDiffThUVy*/ + uint32_t mf_blf_2dfir_dcdc_thresh_uv_y; + /*!< mf_blf_2dfir_dcdc_thresh_uv_u Param_MF_BLF_FIR_DCDiffThUVu*/ + uint32_t mf_blf_2dfir_dcdc_thresh_uv_u; + /*!< mf_blf_2dfir_dcdc_thresh_uv_v Param_MF_BLF_FIR_DCDiffThUVv*/ + uint32_t mf_blf_2dfir_dcdc_thresh_uv_v; + /*!< mf_blf_2dfir_bypass_snr_y Param_MF_BLF_FIR_bypasssSnrY*/ + int32_t mf_blf_2dfir_bypass_snr_y; + /*!< mf_blf_colorspace Param_MF_BLF_colorspaceYRB*/ + int32_t mf_blf_colorspace; + /*!< mf_blf_noisemodel_basefunc_y_a_x[5] Param_MF_BLF_NoiseModel_sigmaParafacY_A_X*/ + int32_t mf_blf_noisemodel_basefunc_y_a_x[5]; + /*!< mf_blf_noisemodel_basefunc_y_a_y[4] Param_MF_BLF_NoiseModel_sigmaParafacY_A Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_y_a_y[4]; + /*!< mf_blf_noisemodel_basefunc_y_a_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_y_a_slope[4]; + /*!< mf_blf_noisemodel_basefunc_y_b_x[5] Param_MF_BLF_NoiseModel_sigmaParafacY_B_X*/ + int32_t mf_blf_noisemodel_basefunc_y_b_x[5]; + /*!< mf_blf_noisemodel_basefunc_y_b_y[4] Param_MF_BLF_NoiseModel_sigmaParafacY_B Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_y_b_y[4]; + /*!< mf_blf_noisemodel_basefunc_y_b_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_y_b_slope[4]; + /*!< mf_blf_noisemodel_basefunc_y_c_x[5] Param_MF_BLF_NoiseModel_sigmaParafacY_C_X*/ + int32_t mf_blf_noisemodel_basefunc_y_c_x[5]; + /*!< mf_blf_noisemodel_basefunc_y_c_y[4] Param_MF_BLF_NoiseModel_sigmaParafacY_C Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_y_c_y[4]; + /*!< mf_blf_noisemodel_basefunc_y_c_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_y_c_slope[4]; + /*!< mf_blf_noisemodel_basefunc_y_wbg Param_MF_BLF_NoiseModel_sigmaParafacY_DEF*/ + int32_t mf_blf_noisemodel_basefunc_y_wbg; + /*!< mf_blf_noisemodel_basefunc_u_a_x[5] Param_MF_BLF_NoiseModel_sigmaParafacU_A_X*/ + int32_t mf_blf_noisemodel_basefunc_u_a_x[5]; + /*!< mf_blf_noisemodel_basefunc_u_a_y[4] Param_MF_BLF_NoiseModel_sigmaParafacU_A Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_u_a_y[4]; + /*!< mf_blf_noisemodel_basefunc_u_a_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_u_a_slope[4]; + /*!< mf_blf_noisemodel_basefunc_u_b_x[5] Param_MF_BLF_NoiseModel_sigmaParafacU_B_X*/ + int32_t mf_blf_noisemodel_basefunc_u_b_x[5]; + /*!< mf_blf_noisemodel_basefunc_u_b_y[4] Param_MF_BLF_NoiseModel_sigmaParafacU_B Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_u_b_y[4]; + /*!< mf_blf_noisemodel_basefunc_u_b_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_u_b_slope[4]; + /*!< mf_blf_noisemodel_basefunc_u_c_x[5] Param_MF_BLF_NoiseModel_sigmaParafacU_C_X*/ + int32_t mf_blf_noisemodel_basefunc_u_c_x[5]; + /*!< mf_blf_noisemodel_basefunc_u_c_y[4] Param_MF_BLF_NoiseModel_sigmaParafacU_C Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_u_c_y[4]; + /*!< mf_blf_noisemodel_basefunc_u_c_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_u_c_slope[4]; + /*!< mf_blf_noisemodel_basefunc_u_wbg Param_MF_BLF_NoiseModel_sigmaParafacU_DEF*/ + int32_t mf_blf_noisemodel_basefunc_u_wbg; + /*!< mf_blf_noisemodel_basefunc_v_a_x[5] Param_MF_BLF_NoiseModel_sigmaParafacV_A_X*/ + int32_t mf_blf_noisemodel_basefunc_v_a_x[5]; + /*!< mf_blf_noisemodel_basefunc_v_a_y[4] Param_MF_BLF_NoiseModel_sigmaParafacV_A Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_v_a_y[4]; + /*!< mf_blf_noisemodel_basefunc_v_a_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_v_a_slope[4]; + /*!< mf_blf_noisemodel_basefunc_v_b_x[5] Param_MF_BLF_NoiseModel_sigmaParafacV_B_X*/ + int32_t mf_blf_noisemodel_basefunc_v_b_x[5]; + /*!< mf_blf_noisemodel_basefunc_v_b_y[4] Param_MF_BLF_NoiseModel_sigmaParafacV_B Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_v_b_y[4]; + /*!< mf_blf_noisemodel_basefunc_v_b_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_v_b_slope[4]; + /*!< mf_blf_noisemodel_basefunc_v_c_x[5] Param_MF_BLF_NoiseModel_sigmaParafacV_C_X*/ + int32_t mf_blf_noisemodel_basefunc_v_c_x[5]; + /*!< mf_blf_noisemodel_basefunc_v_c_y[4] Param_MF_BLF_NoiseModel_sigmaParafacV_C Config Unit Value*/ + int32_t mf_blf_noisemodel_basefunc_v_c_y[4]; + /*!< mf_blf_noisemodel_basefunc_v_c_slope[4] Slope*/ + int32_t mf_blf_noisemodel_basefunc_v_c_slope[4]; + /*!< mf_blf_noisemodel_basefunc_v_wbg Param_MF_BLF_NoiseModel_sigmaParafacV_DEF*/ + int32_t mf_blf_noisemodel_basefunc_v_wbg; + /*!< mf_blf_noisemodel_weight_y_y Param_MF_BLF_NoiseModel_sigmaWgtYy*/ + int32_t mf_blf_noisemodel_weight_y_y; + /*!< mf_blf_noisemodel_weight_y_u Param_MF_BLF_NoiseModel_sigmaWgtYu*/ + int32_t mf_blf_noisemodel_weight_y_u; + /*!< mf_blf_noisemodel_weight_y_v Param_MF_BLF_NoiseModel_sigmaWgtYv*/ + int32_t mf_blf_noisemodel_weight_y_v; + /*!< mf_blf_noisemodel_weight_uv_y Param_MF_BLF_NoiseModel_sigmaWgtUVy*/ + int32_t mf_blf_noisemodel_weight_uv_y; + /*!< mf_blf_noisemodel_weight_uv_u Param_MF_BLF_NoiseModel_sigmaWgtUVu*/ + int32_t mf_blf_noisemodel_weight_uv_u; + /*!< mf_blf_noisemodel_weight_uv_v Param_MF_BLF_NoiseModel_sigmaWgtUVv*/ + int32_t mf_blf_noisemodel_weight_uv_v; + /*!< mf_blf_noisemodel_radialdependent_bypass Param_MF_BLF_NoiseModel_bypassRadialCorrection*/ + int32_t mf_blf_noisemodel_radialdependent_bypass; + /*!< mf_blf_noisemodel_colordependent_bypass Param_MF_BLF_NoiseModel_bypassColorDependent*/ + int32_t mf_blf_noisemodel_colordependent_bypass; + /*!< mf_blf_noisemodel_graydependent_bypass Param_MF_BLF_NoiseModel_bypassGrayDependent*/ + int32_t mf_blf_noisemodel_graydependent_bypass; + /*!< lf_blf_noisemodel_radialdependent_x0 Param_LF_BLF_NoiseModel_radialDependent_x0*/ + int32_t lf_blf_noisemodel_radialdependent_x0; + /*!< lf_blf_noisemodel_radialdependent_x0_square Param_LF_BLF_NoiseModel_radialDependent_x0_square*/ + int32_t lf_blf_noisemodel_radialdependent_x0_square; + /*!< lf_blf_noisemodel_radialdependent_y0 Param_LF_BLF_NoiseModel_radialDependent_y0*/ + int32_t lf_blf_noisemodel_radialdependent_y0; + /*!< lf_blf_noisemodel_radialdependent_y0_square Param_LF_BLF_NoiseModel_radialDependent_y0_square*/ + int32_t lf_blf_noisemodel_radialdependent_y0_square; + /*!< mf_blf_noisemodel_radialdependent_rshift_norm_square_distance Param_MF_BLF_NoiseModel_radialDependent_rshiftNormSquareDist*/ + int32_t mf_blf_noisemodel_radialdependent_rshift_norm_square_distance; + /*!< mf_blf_noisemodel_radialdependent_gain_x[4] Param_MF_BLF_NoiseModel_radialDependent_radialLut_X*/ + int32_t mf_blf_noisemodel_radialdependent_gain_x[4]; + /*!< mf_blf_noisemodel_radialdependent_gain_y[3] Param_MF_BLF_NoiseModel_radialDependent_radialLut Config Unit Value*/ + int32_t mf_blf_noisemodel_radialdependent_gain_y[3]; + /*!< mf_blf_noisemodel_radialdependent_gain_slope[3] Slope*/ + int32_t mf_blf_noisemodel_radialdependent_gain_slope[3]; + /*!< mf_blf_noisemodel_colordependent_a[32] Param_MF_BLF_NoiseModel_colorDependent_A*/ + int32_t mf_blf_noisemodel_colordependent_a[32]; + /*!< mf_blf_noisemodel_colordependent_b[32] Param_MF_BLF_NoiseModel_colorDependent_B*/ + int32_t mf_blf_noisemodel_colordependent_b[32]; + /*!< mf_blf_noisemodel_colordependent_c[32] Param_MF_BLF_NoiseModel_colorDependent_C*/ + int32_t mf_blf_noisemodel_colordependent_c[32]; + /*!< mf_blf_noisemodel_colordependent_norm_offset Param_MF_BLF_NoiseModel_colorDependent_normalization_offset*/ + int32_t mf_blf_noisemodel_colordependent_norm_offset; + /*!< mf_blf_noisemodel_colordependent_gain_x[6] Param_MF_BLF_NoiseModel_colorDependent_Lut_X*/ + int32_t mf_blf_noisemodel_colordependent_gain_x[6]; + /*!< mf_blf_noisemodel_colordependent_gain_y[5] Param_MF_BLF_NoiseModel_colorDependent_Lut Config Unit Value*/ + int32_t mf_blf_noisemodel_colordependent_gain_y[5]; + /*!< mf_blf_noisemodel_colordependent_gain_slope[5] Slope*/ + int32_t mf_blf_noisemodel_colordependent_gain_slope[5]; + /*!< mf_blf_noisemodel_graydependent_graylevel_thresh Param_MF_BLF_NoiseModel_grayDependent_grayThrsh*/ + int32_t mf_blf_noisemodel_graydependent_graylevel_thresh; + /*!< mf_blf_noisemodel_graydependent_graylevel_slope Param_MF_BLF_NoiseModel_grayDependent_graySlope*/ + int32_t mf_blf_noisemodel_graydependent_graylevel_slope; + /*!< mf_blf_noisemodel_graydependent_gain_x[6] Param_MF_BLF_NoiseModel_grayDependent_transLut_X*/ + int32_t mf_blf_noisemodel_graydependent_gain_x[6]; + /*!< mf_blf_noisemodel_graydependent_gain_y[5] Param_MF_BLF_NoiseModel_grayDependent_transLut Config Unit Value*/ + int32_t mf_blf_noisemodel_graydependent_gain_y[5]; + /*!< mf_blf_noisemodel_graydependent_gain_slope[5] Slope*/ + int32_t mf_blf_noisemodel_graydependent_gain_slope[5]; + /*!< mf_blf_noisemodel_normfactor_y_y Param_MF_BLF_NoiseModel_invSigmaYy*/ + int32_t mf_blf_noisemodel_normfactor_y_y; + /*!< mf_blf_noisemodel_normfactor_y_u Param_MF_BLF_NoiseModel_invSigmaYu*/ + int32_t mf_blf_noisemodel_normfactor_y_u; + /*!< mf_blf_noisemodel_normfactor_y_v Param_MF_BLF_NoiseModel_invSigmaYv*/ + int32_t mf_blf_noisemodel_normfactor_y_v; + /*!< mf_blf_noisemodel_normfactor_uv_y Param_MF_BLF_NoiseModel_invSigmaUVy*/ + int32_t mf_blf_noisemodel_normfactor_uv_y; + /*!< mf_blf_noisemodel_normfactor_uv_u Param_MF_BLF_NoiseModel_invSigmaUVu*/ + int32_t mf_blf_noisemodel_normfactor_uv_u; + /*!< mf_blf_noisemodel_normfactor_uv_v Param_MF_BLF_NoiseModel_invSigmaUVv*/ + int32_t mf_blf_noisemodel_normfactor_uv_v; + /*!< mf_blf_snrm_bypass Param_MF_BLF_SNRM_bypassSNRManagement*/ + int32_t mf_blf_snrm_bypass; + /*!< mf_blf_snrm_bypass_y Param_MF_BLF_SNRM_bypassY*/ + int32_t mf_blf_snrm_bypass_y; + /*!< mf_blf_snrm_slope_y Param_MF_BLF_SNRM_slopeY*/ + int32_t mf_blf_snrm_slope_y; + /*!< mf_blf_snrm_xoffset_y Param_MF_BLF_SNRM_xoffsetY*/ + int32_t mf_blf_snrm_xoffset_y; + /*!< mf_blf_snrm_maxval_y Param_MF_BLF_SNRM_maxValY*/ + int32_t mf_blf_snrm_maxval_y; + /*!< mf_blf_snrm_minval_y Param_MF_BLF_SNRM_minValY*/ + int32_t mf_blf_snrm_minval_y; + /*!< mf_blf_snrm_slope_uv Param_MF_BLF_SNRM_slopeUV*/ + int32_t mf_blf_snrm_slope_uv; + /*!< mf_blf_snrm_xoffset_uv Param_MF_BLF_SNRM_xoffsetUV*/ + int32_t mf_blf_snrm_xoffset_uv; + /*!< mf_blf_snrm_maxval_uv Param_MF_BLF_SNRM_maxValUV*/ + int32_t mf_blf_snrm_maxval_uv; + /*!< mf_blf_snrm_minval_uv Param_MF_BLF_SNRM_minValUV*/ + int32_t mf_blf_snrm_minval_uv; + /*!< mf_afc_bypass Param_MF_AFC_bypassAntiFalseColor*/ + int32_t mf_afc_bypass; + /*!< mf_afc_weight_snr Param_MF_AFC_wgtSnr*/ + int32_t mf_afc_weight_snr; + /*!< mf_afc_weight_chroma Param_MF_AFC_wgtC*/ + int32_t mf_afc_weight_chroma; + /*!< mf_min_distance_clamp Param_MF_min_distance_clamp*/ + int32_t mf_min_distance_clamp; + /*!< lf_blf_fir_filter_length Param_LF_BLF_FIR_BfLen*/ + int32_t lf_blf_fir_filter_length; + /*!< lf_blf_fir_luma_coefs[6] Param_LF_BLF_FIR_Kn_coef*/ + int32_t lf_blf_fir_luma_coefs[6]; + /*!< lf_blf_fir_luma_denom_bits Param_LF_BLF_FIR_Kn_denom_bits*/ + int32_t lf_blf_fir_luma_denom_bits; + /*!< lf_blf_fir_bypass_snr_y Param_LF_BLF_FIR_bypasssSnrY*/ + int32_t lf_blf_fir_bypass_snr_y; + /*!< lf_blf_colorspace Param_LF_BLF_colorspaceYRB*/ + int32_t lf_blf_colorspace; + /*!< lf_blf_noisemodel_basefunc_y_a_x[5] Param_LF_BLF_NoiseModel_sigmaParafacY_A_X*/ + int32_t lf_blf_noisemodel_basefunc_y_a_x[5]; + /*!< lf_blf_noisemodel_basefunc_y_a_y[4] Param_LF_BLF_NoiseModel_sigmaParafacY_A Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_y_a_y[4]; + /*!< lf_blf_noisemodel_basefunc_y_a_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_y_a_slope[4]; + /*!< lf_blf_noisemodel_basefunc_y_b_x[5] Param_LF_BLF_NoiseModel_sigmaParafacY_B_X*/ + int32_t lf_blf_noisemodel_basefunc_y_b_x[5]; + /*!< lf_blf_noisemodel_basefunc_y_b_y[4] Param_LF_BLF_NoiseModel_sigmaParafacY_B Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_y_b_y[4]; + /*!< lf_blf_noisemodel_basefunc_y_b_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_y_b_slope[4]; + /*!< lf_blf_noisemodel_basefunc_y_c_x[5] Param_LF_BLF_NoiseModel_sigmaParafacY_C_X*/ + int32_t lf_blf_noisemodel_basefunc_y_c_x[5]; + /*!< lf_blf_noisemodel_basefunc_y_c_y[4] Param_LF_BLF_NoiseModel_sigmaParafacY_C Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_y_c_y[4]; + /*!< lf_blf_noisemodel_basefunc_y_c_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_y_c_slope[4]; + /*!< lf_blf_noisemodel_basefunc_y_wbg Param_LF_BLF_NoiseModel_sigmaParafacY_DEF*/ + int32_t lf_blf_noisemodel_basefunc_y_wbg; + /*!< lf_blf_noisemodel_basefunc_u_a_x[5] Param_LF_BLF_NoiseModel_sigmaParafacU_A_X*/ + int32_t lf_blf_noisemodel_basefunc_u_a_x[5]; + /*!< lf_blf_noisemodel_basefunc_u_a_y[4] Param_LF_BLF_NoiseModel_sigmaParafacU_A Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_u_a_y[4]; + /*!< lf_blf_noisemodel_basefunc_u_a_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_u_a_slope[4]; + /*!< lf_blf_noisemodel_basefunc_u_b_x[5] Param_LF_BLF_NoiseModel_sigmaParafacU_B_X*/ + int32_t lf_blf_noisemodel_basefunc_u_b_x[5]; + /*!< lf_blf_noisemodel_basefunc_u_b_y[4] Param_LF_BLF_NoiseModel_sigmaParafacU_B Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_u_b_y[4]; + /*!< lf_blf_noisemodel_basefunc_u_b_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_u_b_slope[4]; + /*!< lf_blf_noisemodel_basefunc_u_c_x[5] Param_LF_BLF_NoiseModel_sigmaParafacU_C_X*/ + int32_t lf_blf_noisemodel_basefunc_u_c_x[5]; + /*!< lf_blf_noisemodel_basefunc_u_c_y[4] Param_LF_BLF_NoiseModel_sigmaParafacU_C Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_u_c_y[4]; + /*!< lf_blf_noisemodel_basefunc_u_c_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_u_c_slope[4]; + /*!< lf_blf_noisemodel_basefunc_u_wbg Param_LF_BLF_NoiseModel_sigmaParafacU_DEF*/ + int32_t lf_blf_noisemodel_basefunc_u_wbg; + /*!< lf_blf_noisemodel_basefunc_v_a_x[5] Param_LF_BLF_NoiseModel_sigmaParafacV_A_X*/ + int32_t lf_blf_noisemodel_basefunc_v_a_x[5]; + /*!< lf_blf_noisemodel_basefunc_v_a_y[4] Param_LF_BLF_NoiseModel_sigmaParafacV_A Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_v_a_y[4]; + /*!< lf_blf_noisemodel_basefunc_v_a_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_v_a_slope[4]; + /*!< lf_blf_noisemodel_basefunc_v_b_x[5] Param_LF_BLF_NoiseModel_sigmaParafacV_B_X*/ + int32_t lf_blf_noisemodel_basefunc_v_b_x[5]; + /*!< lf_blf_noisemodel_basefunc_v_b_y[4] Param_LF_BLF_NoiseModel_sigmaParafacV_B Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_v_b_y[4]; + /*!< lf_blf_noisemodel_basefunc_v_b_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_v_b_slope[4]; + /*!< lf_blf_noisemodel_basefunc_v_c_x[5] Param_LF_BLF_NoiseModel_sigmaParafacV_C_X*/ + int32_t lf_blf_noisemodel_basefunc_v_c_x[5]; + /*!< lf_blf_noisemodel_basefunc_v_c_y[4] Param_LF_BLF_NoiseModel_sigmaParafacV_C Config Unit Value*/ + int32_t lf_blf_noisemodel_basefunc_v_c_y[4]; + /*!< lf_blf_noisemodel_basefunc_v_c_slope[4] Slope*/ + int32_t lf_blf_noisemodel_basefunc_v_c_slope[4]; + /*!< lf_blf_noisemodel_basefunc_v_wbg Param_LF_BLF_NoiseModel_sigmaParafacV_DEF*/ + int32_t lf_blf_noisemodel_basefunc_v_wbg; + /*!< lf_blf_noisemodel_weight_y_y Param_LF_BLF_NoiseModel_sigmaWgtYy*/ + int32_t lf_blf_noisemodel_weight_y_y; + /*!< lf_blf_noisemodel_weight_y_u Param_LF_BLF_NoiseModel_sigmaWgtYu*/ + int32_t lf_blf_noisemodel_weight_y_u; + /*!< lf_blf_noisemodel_weight_y_v Param_LF_BLF_NoiseModel_sigmaWgtYv*/ + int32_t lf_blf_noisemodel_weight_y_v; + /*!< lf_blf_noisemodel_weight_uv_y Param_LF_BLF_NoiseModel_sigmaWgtUVy*/ + int32_t lf_blf_noisemodel_weight_uv_y; + /*!< lf_blf_noisemodel_weight_uv_u Param_LF_BLF_NoiseModel_sigmaWgtUVu*/ + int32_t lf_blf_noisemodel_weight_uv_u; + /*!< lf_blf_noisemodel_weight_uv_v Param_LF_BLF_NoiseModel_sigmaWgtUVv*/ + int32_t lf_blf_noisemodel_weight_uv_v; + /*!< lf_blf_noisemodel_radialdependent_bypass Param_LF_BLF_NoiseModel_bypassRadialCorrection*/ + int32_t lf_blf_noisemodel_radialdependent_bypass; + /*!< lf_blf_noisemodel_colordependent_bypass Param_LF_BLF_NoiseModel_bypassColorDependent*/ + int32_t lf_blf_noisemodel_colordependent_bypass; + /*!< lf_blf_noisemodel_graydependent_bypass Param_LF_BLF_NoiseModel_bypassGrayDependent*/ + int32_t lf_blf_noisemodel_graydependent_bypass; + /*!< mf_blf_noisemodel_radialdependent_x0 Param_MF_BLF_NoiseModel_radialDependent_x0*/ + int32_t mf_blf_noisemodel_radialdependent_x0; + /*!< mf_blf_noisemodel_radialdependent_x0_square Param_MF_BLF_NoiseModel_radialDependent_x0_square*/ + int32_t mf_blf_noisemodel_radialdependent_x0_square; + /*!< mf_blf_noisemodel_radialdependent_y0 Param_MF_BLF_NoiseModel_radialDependent_y0*/ + int32_t mf_blf_noisemodel_radialdependent_y0; + /*!< mf_blf_noisemodel_radialdependent_y0_square Param_MF_BLF_NoiseModel_radialDependent_y0_square*/ + int32_t mf_blf_noisemodel_radialdependent_y0_square; + /*!< lf_blf_noisemodel_radialdependent_rshift_norm_square_distance Param_LF_BLF_NoiseModel_radialDependent_rshiftNormSquareDist*/ + int32_t lf_blf_noisemodel_radialdependent_rshift_norm_square_distance; + /*!< lf_blf_noisemodel_radialdependent_gain_x[4] Param_LF_BLF_NoiseModel_radialDependent_radialLut_X*/ + int32_t lf_blf_noisemodel_radialdependent_gain_x[4]; + /*!< lf_blf_noisemodel_radialdependent_gain_y[3] Param_LF_BLF_NoiseModel_radialDependent_radialLut Config Unit Value*/ + int32_t lf_blf_noisemodel_radialdependent_gain_y[3]; + /*!< lf_blf_noisemodel_radialdependent_gain_slope[3] Slope*/ + int32_t lf_blf_noisemodel_radialdependent_gain_slope[3]; + /*!< lf_blf_noisemodel_colordependent_a[32] Param_LF_BLF_NoiseModel_colorDependent_A*/ + int32_t lf_blf_noisemodel_colordependent_a[32]; + /*!< lf_blf_noisemodel_colordependent_b[32] Param_LF_BLF_NoiseModel_colorDependent_B*/ + int32_t lf_blf_noisemodel_colordependent_b[32]; + /*!< lf_blf_noisemodel_colordependent_c[32] Param_LF_BLF_NoiseModel_colorDependent_C*/ + int32_t lf_blf_noisemodel_colordependent_c[32]; + /*!< lf_blf_noisemodel_colordependent_norm_offset Param_LF_BLF_NoiseModel_colorDependent_normalization_offset*/ + int32_t lf_blf_noisemodel_colordependent_norm_offset; + /*!< lf_blf_noisemodel_colordependent_gain_x[6] Param_LF_BLF_NoiseModel_colorDependent_Lut_X*/ + int32_t lf_blf_noisemodel_colordependent_gain_x[6]; + /*!< lf_blf_noisemodel_colordependent_gain_y[5] Param_LF_BLF_NoiseModel_colorDependent_Lut Config Unit Value*/ + int32_t lf_blf_noisemodel_colordependent_gain_y[5]; + /*!< lf_blf_noisemodel_colordependent_gain_slope[5] Slope*/ + int32_t lf_blf_noisemodel_colordependent_gain_slope[5]; + /*!< lf_blf_noisemodel_graydependent_graylevel_thresh Param_LF_BLF_NoiseModel_grayDependent_grayThrsh*/ + int32_t lf_blf_noisemodel_graydependent_graylevel_thresh; + /*!< lf_blf_noisemodel_graydependent_graylevel_slope Param_LF_BLF_NoiseModel_grayDependent_graySlope*/ + int32_t lf_blf_noisemodel_graydependent_graylevel_slope; + /*!< lf_blf_noisemodel_graydependent_gain_x[6] Param_LF_BLF_NoiseModel_grayDependent_transLut_X*/ + int32_t lf_blf_noisemodel_graydependent_gain_x[6]; + /*!< lf_blf_noisemodel_graydependent_gain_y[5] Param_LF_BLF_NoiseModel_grayDependent_transLut Config Unit Value*/ + int32_t lf_blf_noisemodel_graydependent_gain_y[5]; + /*!< lf_blf_noisemodel_graydependent_gain_slope[5] Slope*/ + int32_t lf_blf_noisemodel_graydependent_gain_slope[5]; + /*!< lf_blf_noisemodel_normfactor_y_y Param_LF_BLF_NoiseModel_invSigmaYy*/ + int32_t lf_blf_noisemodel_normfactor_y_y; + /*!< lf_blf_noisemodel_normfactor_y_u Param_LF_BLF_NoiseModel_invSigmaYu*/ + int32_t lf_blf_noisemodel_normfactor_y_u; + /*!< lf_blf_noisemodel_normfactor_y_v Param_LF_BLF_NoiseModel_invSigmaYv*/ + int32_t lf_blf_noisemodel_normfactor_y_v; + /*!< lf_blf_noisemodel_normfactor_uv_y Param_LF_BLF_NoiseModel_invSigmaUVy*/ + int32_t lf_blf_noisemodel_normfactor_uv_y; + /*!< lf_blf_noisemodel_normfactor_uv_u Param_LF_BLF_NoiseModel_invSigmaUVu*/ + int32_t lf_blf_noisemodel_normfactor_uv_u; + /*!< lf_blf_noisemodel_normfactor_uv_v Param_LF_BLF_NoiseModel_invSigmaUVv*/ + int32_t lf_blf_noisemodel_normfactor_uv_v; + /*!< lf_blf_snrm_bypass Param_LF_BLF_SNRM_bypassSNRManagement*/ + int32_t lf_blf_snrm_bypass; + /*!< lf_blf_snrm_bypass_y Param_LF_BLF_SNRM_bypassY*/ + int32_t lf_blf_snrm_bypass_y; + /*!< lf_blf_snrm_slope_y Param_LF_BLF_SNRM_slopeY*/ + int32_t lf_blf_snrm_slope_y; + /*!< lf_blf_snrm_xoffset_y Param_LF_BLF_SNRM_xoffsetY*/ + int32_t lf_blf_snrm_xoffset_y; + /*!< lf_blf_snrm_maxval_y Param_LF_BLF_SNRM_maxValY*/ + int32_t lf_blf_snrm_maxval_y; + /*!< lf_blf_snrm_minval_y Param_LF_BLF_SNRM_minValY*/ + int32_t lf_blf_snrm_minval_y; + /*!< lf_blf_snrm_slope_uv Param_LF_BLF_SNRM_slopeUV*/ + int32_t lf_blf_snrm_slope_uv; + /*!< lf_blf_snrm_xoffset_uv Param_LF_BLF_SNRM_xoffsetUV*/ + int32_t lf_blf_snrm_xoffset_uv; + /*!< lf_blf_snrm_maxval_uv Param_LF_BLF_SNRM_maxValUV*/ + int32_t lf_blf_snrm_maxval_uv; + /*!< lf_blf_snrm_minval_uv Param_LF_BLF_SNRM_minValUV*/ + int32_t lf_blf_snrm_minval_uv; + /*!< lf_blf_iir_alpha_y Param_LF_BLF_IIR_alphaY*/ + int32_t lf_blf_iir_alpha_y; + /*!< lf_blf_iir_alpha_uv Param_LF_BLF_IIR_alphaUV*/ + int32_t lf_blf_iir_alpha_uv; + /*!< lf_cs_bypass Param_LF_CS_bypassChromaSuppression*/ + int32_t lf_cs_bypass; + /*!< lf_cs_coef Param_LF_CS_coef*/ + int32_t lf_cs_coef; + /*!< lf_min_distance_clamp Param_LF_min_distance_clamp*/ + int32_t lf_min_distance_clamp; + /*!< vlf_blf_fir_filter_length Param_VLF_BLF_FIR_BfLen*/ + int32_t vlf_blf_fir_filter_length; + /*!< vlf_blf_fir_luma_coefs[6] Param_VLF_BLF_FIR_Kn_coef*/ + int32_t vlf_blf_fir_luma_coefs[6]; + /*!< vlf_blf_fir_luma_denom_bits Param_VLF_BLF_FIR_Kn_denom_bits*/ + int32_t vlf_blf_fir_luma_denom_bits; + /*!< vlf_blf_fir_bypass_snr_y Param_VLF_BLF_FIR_bypasssSnrY*/ + int32_t vlf_blf_fir_bypass_snr_y; + /*!< vlf_blf_colorspace Param_VLF_BLF_colorspaceYRB*/ + int32_t vlf_blf_colorspace; + /*!< vlf_blf_noisemodel_basefunc_y_a_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacY_A_X*/ + int32_t vlf_blf_noisemodel_basefunc_y_a_x[5]; + /*!< vlf_blf_noisemodel_basefunc_y_a_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacY_A Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_y_a_y[4]; + /*!< vlf_blf_noisemodel_basefunc_y_a_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_y_a_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_y_b_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacY_B_X*/ + int32_t vlf_blf_noisemodel_basefunc_y_b_x[5]; + /*!< vlf_blf_noisemodel_basefunc_y_b_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacY_B Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_y_b_y[4]; + /*!< vlf_blf_noisemodel_basefunc_y_b_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_y_b_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_y_c_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacY_C_X*/ + int32_t vlf_blf_noisemodel_basefunc_y_c_x[5]; + /*!< vlf_blf_noisemodel_basefunc_y_c_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacY_C Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_y_c_y[4]; + /*!< vlf_blf_noisemodel_basefunc_y_c_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_y_c_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_y_wbg Param_VLF_BLF_NoiseModel_sigmaParafacY_DEF*/ + int32_t vlf_blf_noisemodel_basefunc_y_wbg; + /*!< vlf_blf_noisemodel_basefunc_u_a_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacU_A_X*/ + int32_t vlf_blf_noisemodel_basefunc_u_a_x[5]; + /*!< vlf_blf_noisemodel_basefunc_u_a_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacU_A Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_u_a_y[4]; + /*!< vlf_blf_noisemodel_basefunc_u_a_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_u_a_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_u_b_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacU_B_X*/ + int32_t vlf_blf_noisemodel_basefunc_u_b_x[5]; + /*!< vlf_blf_noisemodel_basefunc_u_b_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacU_B Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_u_b_y[4]; + /*!< vlf_blf_noisemodel_basefunc_u_b_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_u_b_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_u_c_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacU_C_X*/ + int32_t vlf_blf_noisemodel_basefunc_u_c_x[5]; + /*!< vlf_blf_noisemodel_basefunc_u_c_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacU_C Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_u_c_y[4]; + /*!< vlf_blf_noisemodel_basefunc_u_c_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_u_c_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_u_wbg Param_VLF_BLF_NoiseModel_sigmaParafacU_DEF*/ + int32_t vlf_blf_noisemodel_basefunc_u_wbg; + /*!< vlf_blf_noisemodel_basefunc_v_a_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacV_A_X*/ + int32_t vlf_blf_noisemodel_basefunc_v_a_x[5]; + /*!< vlf_blf_noisemodel_basefunc_v_a_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacV_A Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_v_a_y[4]; + /*!< vlf_blf_noisemodel_basefunc_v_a_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_v_a_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_v_b_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacV_B_X*/ + int32_t vlf_blf_noisemodel_basefunc_v_b_x[5]; + /*!< vlf_blf_noisemodel_basefunc_v_b_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacV_B Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_v_b_y[4]; + /*!< vlf_blf_noisemodel_basefunc_v_b_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_v_b_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_v_c_x[5] Param_VLF_BLF_NoiseModel_sigmaParafacV_C_X*/ + int32_t vlf_blf_noisemodel_basefunc_v_c_x[5]; + /*!< vlf_blf_noisemodel_basefunc_v_c_y[4] Param_VLF_BLF_NoiseModel_sigmaParafacV_C Config Unit Value*/ + int32_t vlf_blf_noisemodel_basefunc_v_c_y[4]; + /*!< vlf_blf_noisemodel_basefunc_v_c_slope[4] Slope*/ + int32_t vlf_blf_noisemodel_basefunc_v_c_slope[4]; + /*!< vlf_blf_noisemodel_basefunc_v_wbg Param_VLF_BLF_NoiseModel_sigmaParafacV_DEF*/ + int32_t vlf_blf_noisemodel_basefunc_v_wbg; + /*!< vlf_blf_noisemodel_weight_y_y Param_VLF_BLF_NoiseModel_sigmaWgtYy*/ + int32_t vlf_blf_noisemodel_weight_y_y; + /*!< vlf_blf_noisemodel_weight_y_u Param_VLF_BLF_NoiseModel_sigmaWgtYu*/ + int32_t vlf_blf_noisemodel_weight_y_u; + /*!< vlf_blf_noisemodel_weight_y_v Param_VLF_BLF_NoiseModel_sigmaWgtYv*/ + int32_t vlf_blf_noisemodel_weight_y_v; + /*!< vlf_blf_noisemodel_weight_uv_y Param_VLF_BLF_NoiseModel_sigmaWgtUVy*/ + int32_t vlf_blf_noisemodel_weight_uv_y; + /*!< vlf_blf_noisemodel_weight_uv_u Param_VLF_BLF_NoiseModel_sigmaWgtUVu*/ + int32_t vlf_blf_noisemodel_weight_uv_u; + /*!< vlf_blf_noisemodel_weight_uv_v Param_VLF_BLF_NoiseModel_sigmaWgtUVv*/ + int32_t vlf_blf_noisemodel_weight_uv_v; + /*!< vlf_blf_noisemodel_radialdependent_bypass Param_VLF_BLF_NoiseModel_bypassRadialCorrection*/ + int32_t vlf_blf_noisemodel_radialdependent_bypass; + /*!< vlf_blf_noisemodel_colordependent_bypass Param_VLF_BLF_NoiseModel_bypassColorDependent*/ + int32_t vlf_blf_noisemodel_colordependent_bypass; + /*!< vhf_blf_noisemodel_radialdependent_x0 Param_VHF_BLF_NoiseModel_radialDependent_x0*/ + int32_t vhf_blf_noisemodel_radialdependent_x0; + /*!< vhf_blf_noisemodel_radialdependent_x0_square Param_VHF_BLF_NoiseModel_radialDependent_x0_square*/ + int32_t vhf_blf_noisemodel_radialdependent_x0_square; + /*!< vhf_blf_noisemodel_radialdependent_y0 Param_VHF_BLF_NoiseModel_radialDependent_y0*/ + int32_t vhf_blf_noisemodel_radialdependent_y0; + /*!< vhf_blf_noisemodel_radialdependent_y0_square Param_VHF_BLF_NoiseModel_radialDependent_y0_square*/ + int32_t vhf_blf_noisemodel_radialdependent_y0_square; + /*!< vlf_blf_noisemodel_radialdependent_rshift_norm_square_distance Param_VLF_BLF_NoiseModel_radialDependent_rshiftNormSquareDist*/ + int32_t vlf_blf_noisemodel_radialdependent_rshift_norm_square_distance; + /*!< vlf_blf_noisemodel_radialdependent_gain_x[4] Param_VLF_BLF_NoiseModel_radialDependent_radialLut_X*/ + int32_t vlf_blf_noisemodel_radialdependent_gain_x[4]; + /*!< vlf_blf_noisemodel_radialdependent_gain_y[3] Param_VLF_BLF_NoiseModel_radialDependent_radialLut Config Unit Value*/ + int32_t vlf_blf_noisemodel_radialdependent_gain_y[3]; + /*!< vlf_blf_noisemodel_radialdependent_gain_slope[3] Slope*/ + int32_t vlf_blf_noisemodel_radialdependent_gain_slope[3]; + /*!< vlf_blf_noisemodel_colordependent_a[32] Param_VLF_BLF_NoiseModel_colorDependent_A*/ + int32_t vlf_blf_noisemodel_colordependent_a[32]; + /*!< vlf_blf_noisemodel_colordependent_b[32] Param_VLF_BLF_NoiseModel_colorDependent_B*/ + int32_t vlf_blf_noisemodel_colordependent_b[32]; + /*!< vlf_blf_noisemodel_colordependent_c[32] Param_VLF_BLF_NoiseModel_colorDependent_C*/ + int32_t vlf_blf_noisemodel_colordependent_c[32]; + /*!< vlf_blf_noisemodel_colordependent_norm_offset Param_VLF_BLF_NoiseModel_colorDependent_normalization_offset*/ + int32_t vlf_blf_noisemodel_colordependent_norm_offset; + /*!< vlf_blf_noisemodel_colordependent_gain_x[6] Param_VLF_BLF_NoiseModel_colorDependent_Lut_X*/ + int32_t vlf_blf_noisemodel_colordependent_gain_x[6]; + /*!< vlf_blf_noisemodel_colordependent_gain_y[5] Param_VLF_BLF_NoiseModel_colorDependent_Lut Config Unit Value*/ + int32_t vlf_blf_noisemodel_colordependent_gain_y[5]; + /*!< vlf_blf_noisemodel_colordependent_gain_slope[5] Slope*/ + int32_t vlf_blf_noisemodel_colordependent_gain_slope[5]; + /*!< vlf_blf_noisemodel_graydependent_gain_x[6] Param_VLF_BLF_NoiseModel_grayDependent_transLut_X*/ + int32_t vlf_blf_noisemodel_graydependent_gain_x[6]; + /*!< vlf_blf_noisemodel_graydependent_gain_y[5] Param_VLF_BLF_NoiseModel_grayDependent_transLut Config Unit Value*/ + int32_t vlf_blf_noisemodel_graydependent_gain_y[5]; + /*!< vlf_blf_noisemodel_graydependent_gain_slope[5] Slope*/ + int32_t vlf_blf_noisemodel_graydependent_gain_slope[5]; + /*!< vlf_blf_noisemodel_normfactor_y_y Param_VLF_BLF_NoiseModel_invSigmaYy*/ + int32_t vlf_blf_noisemodel_normfactor_y_y; + /*!< vlf_blf_noisemodel_normfactor_y_u Param_VLF_BLF_NoiseModel_invSigmaYu*/ + int32_t vlf_blf_noisemodel_normfactor_y_u; + /*!< vlf_blf_noisemodel_normfactor_y_v Param_VLF_BLF_NoiseModel_invSigmaYv*/ + int32_t vlf_blf_noisemodel_normfactor_y_v; + /*!< vlf_blf_noisemodel_normfactor_uv_y Param_VLF_BLF_NoiseModel_invSigmaUVy*/ + int32_t vlf_blf_noisemodel_normfactor_uv_y; + /*!< vlf_blf_noisemodel_normfactor_uv_u Param_VLF_BLF_NoiseModel_invSigmaUVu*/ + int32_t vlf_blf_noisemodel_normfactor_uv_u; + /*!< vlf_blf_noisemodel_normfactor_uv_v Param_VLF_BLF_NoiseModel_invSigmaUVv*/ + int32_t vlf_blf_noisemodel_normfactor_uv_v; + /*!< vlf_blf_iir_alpha_y Param_VLF_BLF_IIR_alphaY*/ + int32_t vlf_blf_iir_alpha_y; + /*!< vlf_blf_iir_alpha_uv Param_VLF_BLF_IIR_alphaUV*/ + int32_t vlf_blf_iir_alpha_uv; + /*!< vlf_cs_bypass Param_VLF_CS_bypassChromaSuppression*/ + int32_t vlf_cs_bypass; + /*!< vlf_cs_coef Param_VLF_CS_coef*/ + int32_t vlf_cs_coef; + /*!< vlf_min_distance_clamp Param_VLF_min_distance_clamp*/ + int32_t vlf_min_distance_clamp; + /*!< vhf_blf_noisemodel_basefunc_y_a_x[5] Param_VHF_BLF_NoiseModel_sigmaParafacY_A_X*/ + int32_t vhf_blf_noisemodel_basefunc_y_a_x[5]; + /*!< vhf_blf_noisemodel_basefunc_y_a_y[4] Param_VHF_BLF_NoiseModel_sigmaParafacY_A Config Unit Value*/ + int32_t vhf_blf_noisemodel_basefunc_y_a_y[4]; + /*!< vhf_blf_noisemodel_basefunc_y_a_slope[4] Slope*/ + int32_t vhf_blf_noisemodel_basefunc_y_a_slope[4]; + /*!< vhf_blf_noisemodel_basefunc_y_wbg Param_VHF_BLF_NoiseModel_sigmaParafacY_DEF*/ + int32_t vhf_blf_noisemodel_basefunc_y_wbg; + /*!< vhf_blf_noisemodel_weight_y_y Param_VHF_BLF_NoiseModel_sigmaWgtYy*/ + int32_t vhf_blf_noisemodel_weight_y_y; + /*!< vhf_blf_noisemodel_radialdependent_bypass Param_VHF_BLF_NoiseModel_bypassRadialCorrection*/ + int32_t vhf_blf_noisemodel_radialdependent_bypass; + /*!< vlf_blf_noisemodel_radialdependent_x0 Param_VLF_BLF_NoiseModel_radialDependent_x0*/ + int32_t vlf_blf_noisemodel_radialdependent_x0; + /*!< vlf_blf_noisemodel_radialdependent_x0_square Param_VLF_BLF_NoiseModel_radialDependent_x0_square*/ + int32_t vlf_blf_noisemodel_radialdependent_x0_square; + /*!< vlf_blf_noisemodel_radialdependent_y0 Param_VLF_BLF_NoiseModel_radialDependent_y0*/ + int32_t vlf_blf_noisemodel_radialdependent_y0; + /*!< vlf_blf_noisemodel_radialdependent_y0_square Param_VLF_BLF_NoiseModel_radialDependent_y0_square*/ + int32_t vlf_blf_noisemodel_radialdependent_y0_square; + /*!< vhf_blf_noisemodel_radialdependent_rshift_norm_square_distance Param_VHF_BLF_NoiseModel_radialDependent_rshiftNormSquareDist*/ + int32_t vhf_blf_noisemodel_radialdependent_rshift_norm_square_distance; + /*!< vhf_blf_noisemodel_radialdependent_gain_x[4] Param_VHF_BLF_NoiseModel_radialDependent_radialLut_X*/ + int32_t vhf_blf_noisemodel_radialdependent_gain_x[4]; + /*!< vhf_blf_noisemodel_radialdependent_gain_y[3] Param_VHF_BLF_NoiseModel_radialDependent_radialLut Config Unit Value*/ + int32_t vhf_blf_noisemodel_radialdependent_gain_y[3]; + /*!< vhf_blf_noisemodel_radialdependent_gain_slope[3] Slope*/ + int32_t vhf_blf_noisemodel_radialdependent_gain_slope[3]; + /*!< vhf_blf_noisemodel_normfactor_y_y Param_VHF_BLF_NoiseModel_invSigmaYy*/ + int32_t vhf_blf_noisemodel_normfactor_y_y; + /*!< vhf_blf_bypass Param_VHF_BLF_bypass*/ + int32_t vhf_blf_bypass; + /*!< vhf_min_distance_clamp Param_VHF_min_distance_clamp*/ + int32_t vhf_min_distance_clamp; + /*!< hf_lcs_cu_slope[5] PARAM_HFC_LCS_CU_SLOPE*/ + int32_t hf_lcs_cu_slope[5]; + /*!< hf_lcs_cu_x[6] PARAM_HFC_LCS_CU_X*/ + int32_t hf_lcs_cu_x[6]; + /*!< hf_lcs_cu_y[5] PARAM_HFC_LCS_CU_Y*/ + int32_t hf_lcs_cu_y[5]; + /*!< hf_lcs_bypass Param_HFC_LCS_bypass*/ + int32_t hf_lcs_bypass; + /*!< hf_lcs_thresh_high HFC_LCS_THRESHOLD_HIGH*/ + uint32_t hf_lcs_thresh_high; + /*!< hf_lcs_thresh_low PARAM_HFC_LCS_THRESH_LOW*/ + uint32_t hf_lcs_thresh_low; + /*!< hf_lcs_chm_gain PARAM_HFC_LCS_CHM_GAIN*/ + uint32_t hf_lcs_chm_gain; + /*!< hf_lcs_ylocal_size ylocal filter size 0 - 5x5, 1 - 7x7*/ + uint32_t hf_lcs_ylocal_size; + /*!< hf_lcs_chm_size chroma metric filter size 0 - 5x5, 1 - 7x7*/ + uint32_t hf_lcs_chm_size; + /*!< vlf_power_uv VLF denoise power chroma*/ + int32_t vlf_power_uv; + /*!< vlf_power_y VLF denoise power luma*/ + int32_t vlf_power_y; + /*!< lf_power_uv LF denoise power chroma*/ + int32_t lf_power_uv; + /*!< lf_power_y VLF denoise power luma*/ + int32_t lf_power_y; + /*!< mf_power_uv MF denoise power chroma*/ + int32_t mf_power_uv; + /*!< mf_power_y MF denoise power luma*/ + int32_t mf_power_y; + /*!< hf_power_uv HF denoise power chroma*/ + int32_t hf_power_uv; + /*!< vhf_power_y VHF denoise power luma*/ + int32_t vhf_power_y; + /*!< top_ds_2x_coefs[5] 1:2 downscaling filter coefficients*/ + int32_t top_ds_2x_coefs[5]; + /*!< top_ds_4x_coefs[7] 1:4 downscaling filter coefficients*/ + int32_t top_ds_4x_coefs[7]; + /*!< is_segmentation_aware enable for the segment aware processing*/ + int32_t is_segmentation_aware; + /*!< vhf_blf_noisemodel_modifier_y_class[16] VHF Y-filter noise model class threshold modifier*/ + int32_t vhf_blf_noisemodel_modifier_y_class[16]; + /*!< hf_blf_noisemodel_modifier_uv_class[16] HFC UV-filter noise model class threshold modifier*/ + int32_t hf_blf_noisemodel_modifier_uv_class[16]; + /*!< mf_blf_noisemodel_modifier_y_class[16] MF Y-filter noise model class threshold modifier*/ + int32_t mf_blf_noisemodel_modifier_y_class[16]; + /*!< mf_blf_noisemodel_modifier_uv_class[16] MF UV-filter noise model class threshold modifier*/ + int32_t mf_blf_noisemodel_modifier_uv_class[16]; + /*!< lf_blf_noisemodel_modifier_y_class[16] LF Y-filter noise model class threshold modifier*/ + int32_t lf_blf_noisemodel_modifier_y_class[16]; + /*!< lf_blf_noisemodel_modifier_uv_class[16] LF UV-filter noise model class threshold modifier*/ + int32_t lf_blf_noisemodel_modifier_uv_class[16]; + /*!< vlf_blf_noisemodel_modifier_y_class[16] VLF Y-filter noise model class threshold modifier*/ + int32_t vlf_blf_noisemodel_modifier_y_class[16]; + /*!< vlf_blf_noisemodel_modifier_uv_class[16] VLF UV-filter noise model class threshold modifier*/ + int32_t vlf_blf_noisemodel_modifier_uv_class[16]; + +} ia_pal_isp_xnr_5_4_t; + + + +/* System API Structs */ + +#pragma pack(push, 4) + +typedef struct +{ + uint16_t system_api_uuid; +} ia_pal_system_api_record_header_t; + +/*! \system api struct acm_1_2 + +*/ +typedef struct +{ + /*!< is_segmentation_aware SAP enable*/ + uint8_t is_segmentation_aware; + +} ia_pal_system_api_acm_1_2_t; + +/*! \system api struct aestatistics_2_1 +AE Statistics (histogram) +*/ +typedef struct +{ + /*!< is_dol_psve_processing 0- regular processing. 1 - ae input is a pseudo sve image from dol*/ + uint8_t is_dol_psve_processing; + /*!< stripe_blocks[4] Blocks per stripe*/ + uint32_t stripe_blocks[4]; + +} ia_pal_system_api_aestatistics_2_1_t; + +/*! \system api struct b2i_ds_1_1 + +*/ +typedef struct +{ + /*!< is_striping indicate if it is ipu8 and above*/ + uint8_t is_striping; + +} ia_pal_system_api_b2i_ds_1_1_t; + +/*! \system api struct bnlm_3_4 +noise reduction +*/ +typedef struct +{ + /*!< is_segmentation_aware SAP enable*/ + uint8_t is_segmentation_aware; + /*!< YUV_processing indicates if input is YUV, otherwise Bayer*/ + uint8_t YUV_processing; + +} ia_pal_system_api_bnlm_3_4_t; + +/*! \system api struct bxt_blc + +*/ +typedef struct +{ + /*!< dol_processing 0 - regular processing. 1 - dol processing*/ + uint8_t dol_processing; + +} ia_pal_system_api_bxt_blc_t; + +/*! \system api struct cas_1_1 + +*/ +typedef struct +{ + /*!< is_segmentation_aware SAP enable*/ + uint8_t is_segmentation_aware; + +} ia_pal_system_api_cas_1_1_t; + +/*! \system api struct ccm_3a_2_0 +AE color correction +*/ +typedef struct +{ + /*!< is_dol_psve_processing 0- regular processing. 1 - input is a pseudo sve image from dol*/ + uint8_t is_dol_psve_processing; + +} ia_pal_system_api_ccm_3a_2_0_t; + +/*! \system api struct dol_lite_1_2 + +*/ +typedef struct +{ + /*!< is_three_input_mode Indicates whether dol filter should work in 3 inputs mode or 2 inputs mode(1 - 3 inputs mode, 0 - 2 inputs mode)*/ + uint8_t is_three_input_mode; + +} ia_pal_system_api_dol_lite_1_2_t; + +/*! \system api struct dpc_2_2 + +*/ +typedef struct +{ + /*!< stripe_blocks[4] Blocks per stripe*/ + uint32_t stripe_blocks[4]; + +} ia_pal_system_api_dpc_2_2_t; + +/*! \system api struct fr_grid_1_0 +FR Statistics +*/ +typedef struct +{ + /*!< stripe_blocks[4] Blocks per stripe*/ + uint32_t stripe_blocks[4]; + +} ia_pal_system_api_fr_grid_1_0_t; + +/*! \system api struct gdc7 + +*/ +typedef struct +{ + /*!< gdc_sp_standalone indicated if gdc_sp is used in standalone mode ( 0: used with gdc_FP, 1: used in standalone)*/ + uint8_t gdc_sp_standalone; + /*!< max_distortion max_dostortion parameter. Valid only in case small_memory is set.*/ + uint32_t max_distortion; + /*!< small_memory Indicates whether we work with small memory or not, to enable/disable max_distortion mechanism (enabled only when working with small memory)*/ + uint8_t small_memory; + +} ia_pal_system_api_gdc7_t; + +/*! \system api struct gmv_statistics_1_1 + +*/ +typedef struct +{ + /*!< binning_factor binning factor*/ + int32_t binning_factor; + /*!< block_height block height*/ + int32_t block_height; + /*!< block_width block width*/ + int32_t block_width; + /*!< stripe_blocks[4] Blocks per stripe*/ + uint32_t stripe_blocks[4]; + +} ia_pal_system_api_gmv_statistics_1_1_t; + +/*! \system api struct io_buffer_1_4 + +*/ +typedef struct +{ + /*!< aligner_data_size amount of valid bits per valid cycle to be accumulate and use the aligner (valid when dpa_bypass is set). LSB represent 2b resolution (meaning value can be 2, 4, 6, 8, … up to 72 which is the size bus)*/ + int32_t aligner_data_size; + /*!< allocate used for streaming cache: 0-don’t cache, 1-reserved, 2-cache only to non-reserved ways, 3-cache use reserved space for this device*/ + uint8_t allocate; + /*!< arbiter_pin MIPI CSI arbiter pin location of the stream*/ + int32_t arbiter_pin; + /*!< block_height buffer block height configuration in lines*/ + uint16_t block_height; + /*!< block_width buffer block width configuration in pixels*/ + uint16_t block_width; + /*!< buffer_1d_enable Valid only for 1 plane and 1 queue streams. 0-the buffer is described as 2D; 1-the buffer is described as 1D (continues from start to end w/o stride ignoring lines)*/ + uint8_t buffer_1d_enable; + /*!< buffer_user_info_reserved_0 Reserved for future use*/ + uint8_t buffer_user_info_reserved_0; + /*!< buffer_user_info_reserved_1 Reserved for future use*/ + uint8_t buffer_user_info_reserved_1; + /*!< chip_location Indicate io_buffer location in the pipe. 0- not set (default), 1-BB_ODR_OFA*/ + uint8_t chip_location; + /*!< chroma_base_conversion chroma converted from zero-based to half-based or vice versa*/ + uint8_t chroma_base_conversion; + /*!< chroma_duplication Valid when format 420 is configured to provide 422 (2P2Q with SIF count of 4 or 2). when reset - duplicate the chroma and provide the same value each two Y lines, when set - send the chroma components only with the even Y (at odd Y lines doesn’t send any chroma)*/ + uint8_t chroma_duplication; + /*!< chroma_non_duplication_location Valid when format 420 is configured to provide 422 (2P2Q with SIF count of 4 or 2) and chroma_duplication is disabled. when reset - add the chroma lines w/ the even luma lines, when set - add the chroma lines w/ the odd luma lines*/ + uint8_t chroma_non_duplication_location; + /*!< chroma_planes_order Chroma planes ordering: 0 - U before V; 1 - V before U (valid for half planer configuration)*/ + uint8_t chroma_planes_order; + /*!< component_in_valid_pixel Provides amount of valid component per valid pixel*/ + uint8_t component_in_valid_pixel; + /*!< component_precision Pixel element precision in bits: 0=>8b, 1=>10b, 2=>12b, 3=>16, 4=>32, 5=>2, 6=>4, 7..15=>reserved*/ + uint8_t component_precision; + /*!< compression_mode Valid for streaming that are tiled: 1-the stream is written/fetched to/from DDR through compression engine; 0-not going through compression*/ + uint8_t compression_mode; + /*!< dpa_bypass When set indicate the end of MIPI frame (used for MIPI CSI sub frames)*/ + uint8_t dpa_bypass; + /*!< first_row_blocks_height buffer block height configuration in lines of all the blocks in the first row of blocks. If zero - use streaming_buffer_blocks_height*/ + uint16_t first_row_blocks_height; + /*!< granularity_pointer_update Valid according the streaming mode: number of lines (LB)/lines of blocks (BB) to be written/release before sending a pointer update (reporting always done with producer view)*/ + uint16_t granularity_pointer_update; + /*!< in_chroma_signed chroma in input is signed (1) or unsigned (0)*/ + uint8_t in_chroma_signed; + /*!< in_luma_signed luma in input is signed (1) or unsigned (0)*/ + uint8_t in_luma_signed; + /*!< last_row_blocks_height buffer block height configuration in lines of all the blocks in the last row of blocks. If zero - use streaming_buffer_blocks_height*/ + uint16_t last_row_blocks_height; + /*!< local_link_id indicates the stream used at the current connectlon*/ + uint8_t local_link_id; + /*!< luma_base_conversion luma converted from zero-based to half-based or vice versa*/ + uint8_t luma_base_conversion; + /*!< max_credits provides the maximum amount of credits for eliminating the need to calculate it in HW according the next formula: (end_address-start_address)/Max_Stride*/ + uint32_t max_credits; + /*!< max_stride provides the maximum stride value to be used at the connection*/ + uint32_t max_stride; + /*!< middle_ack_enable If set, enable the mechansim to generate middle ack when consumed amount of configured lines*/ + uint8_t middle_ack_enable; + /*!< middle_ack_line_number Valid if ack enable If enabled, the device should generate middle ack when delivers the EOL of the configured line (global number) assuming the first line delievered at SOF is zero. In case of multiple planes the counting is done using plane1 but only when all the planes are synced*/ + uint16_t middle_ack_line_number; + /*!< middle_ack_mode_stall Valid only when ack_enable is set When set, the device should stall once sending the middle ack*/ + uint8_t middle_ack_mode_stall; + /*!< mipi_csi_eof When set indicate the end of MIPI frame (used for MIPI CSI sub frames)*/ + uint8_t mipi_csi_eof; + /*!< mipi_enable when set indicates MIPI format is enabled*/ + uint8_t mipi_enable; + /*!< num_of_planes Amount of valid planes (supported 1, 2, 3, 4 - depends also on HW parameter of max planes and data type)*/ + uint8_t num_of_planes; + /*!< num_of_queues Amount of total active queues (YUV FP - 4, YUV SP - 3 YUV SP Tile - 2. RGB - 1,1,1. Bayer -2). Must be up to amount of maximum queue supported. Can be changed per frame. At LBFF used dynamicly for PDAF*/ + uint8_t num_of_queues; + /*!< onep_pixel_order Set the ordering of the first plane (lines-N, pixels-M) 4PPC: 0-(N, M), (N, M+1), (N+1, M), (N+1, M+1), horizontal raster; 1-(N, M), (N+1, M), (N, M+1), (N+1, M+1), vertical raster 2PPC: 0-first cyc: (N, M), (N+1, M), second cyc: (N, M+1), (N+1, M+1); 1-first cyc: (N, M), (N, M+1),*/ + uint8_t onep_pixel_order; + /*!< out_chroma_signed chroma in output is signed (1) or unsigned (0)*/ + uint8_t out_chroma_signed; + /*!< out_luma_signed luma in output is signed (1) or unsigned (0)*/ + uint8_t out_luma_signed; + /*!< pace_message_pace_line Provides the line number indicating to stop measuring the activity and pace and sending pace meesage (at IFD - get the last data of the line, at ODR - getnon-buf ack on last data of the line)*/ + uint16_t pace_message_pace_line; + /*!< pace_message_ref_line Provides the line number that when start indicating start measuring the pace and active (ODR - send first WR of the line, IFD send first RD of line)*/ + uint16_t pace_message_ref_line; + /*!< pixels_in_valid_cycle Provides amount of valid pixels per valid cycle*/ + uint8_t pixels_in_valid_cycle; + /*!< plane_horiz_subsample_config[3] Plane Horiz subsample (width>>N). Affect tile width and width resolution=>Bayer - 0, Y/UV at YUV SP - 0, Y at YUV FP -0, UV U/V at YUV FP-1)*/ + uint8_t plane_horiz_subsample_config[3]; + /*!< plane_max_burst_size[3] Plane maximum burst size: used to specify the transfer size in CL granularity (Max limited to 16, possible values - 1, 2, 4, 8, 16)*/ + uint8_t plane_max_burst_size[3]; + /*!< plane_offset_end_address[3] Per plane: End offset address of plane with regarding to the base_offset, in bytes, CL aligned, unsigned.*/ + uint32_t plane_offset_end_address[3]; + /*!< plane_offset_start_address[3] Per plane: Start offset address of plane with regarding to the base_offset, in bytes, CL aligned, unsigned.*/ + uint32_t plane_offset_start_address[3]; + /*!< plane_start_address_per_stripe[12] Per plane, per stripe: Start offset address of each plane per stripe with regarding to the full frame base_offset, in bytes, unsigned.*/ + uint32_t plane_start_address_per_stripe[12]; + /*!< plane_stride[3] Per plane: provides the difference between two horizontal pixels, in bytes, CL aligned, unsigned. At tile mode - provide the difference between two lines of tiles in bytes*/ + uint32_t plane_stride[3]; + /*!< plane_tile_height[3] Per plane: buffer tile height configuration in lines*/ + uint8_t plane_tile_height[3]; + /*!< plane_tile_width[3] Per plane: buffer tile width configuration in bytes*/ + uint8_t plane_tile_width[3]; + /*!< plane_vert_subsample_config[3] Plane Vertical subsample (height>>N). Affect tile highet and highet resolution=>Bayer - 0, Y atYUV SP - 0, UV at YUV SP - 1, Y at YUV FP -0, U/V at YUV FP-1)*/ + uint8_t plane_vert_subsample_config[3]; + /*!< plane_zlr_granularity[3] Plane ZLR page granularity: if 0 - 4KB, if 1 - 2KB. Valid only if ZLR is enalbe*/ + uint8_t plane_zlr_granularity[3]; + /*!< ppc provides the amount of pixel per cycle*/ + uint8_t ppc; + /*!< proc_ff_bypass when set indicates the FF in the pipe (FCVT & ESPA) need to be bypass*/ + uint8_t proc_ff_bypass; + /*!< progress_message_line Provides the line number that when is done generate progress message (IFD - last byte of the line arrive, ODR - last byte of the line acked by nbuf)*/ + uint16_t progress_message_line; + /*!< snoop 0 - non-snoopable, 1 - snoopable*/ + uint8_t snoop; + /*!< stream_dt stream data type as need to be used by the MIPI*/ + uint8_t stream_dt; + /*!< stream_dt_for_mipi_packet stream data type as need to be used in the header of mipi packet - not affect the proc*/ + int32_t stream_dt_for_mipi_packet; + /*!< stream_vc stream virtual channel number as need to be used in MIPI*/ + uint8_t stream_vc; + /*!< stream_wc stream word count as need to be used by the MIPI*/ + uint16_t stream_wc; + /*!< streaming_mode The streaming unified buffer protocol: 0-static offline (producer/consumer write/read from DDR after kick); 1-dynamic offline (producer/consumer send wr/rd EOF/SOF, producer write after kick, consumer read after full frame at DDR); 2-buffer chasing large memory (producer/consumer send wr/rd EOF/SOF, producer send wr update, consumer read according to wr update); 3-buffer chasing on small memory (producer/consumer send wr/rd EOF/SOF, producer write released buffers and sends wr pointers, consumer read valid buffer and sends rd pointer); 4-S&R like 3 with option to change the link (supporting modes 2 and 3 with dynamic change) 5-buffer chasing small memory - fix starting point, single buffer 6-buffer chasing small memory - float starting point 7-buffer chasing small memory - fix starting point, double buffer*/ + uint8_t streaming_mode; + /*!< streaming_sw_managed When set - the SW verify the shared buffer is fully consumed by the producer and can be written immediately*/ + uint8_t streaming_sw_managed; + /*!< stride_ratio provides the BCSM max_stride/stride ratio with possible values of 1-8, 16, 32, 64, 128*/ + uint8_t stride_ratio; + /*!< subsample_YUV444_to_YUV422 Used by ODR to convert YUV444 to YUV422: 0-use amount of element as written at components_in_valid_cycle, 1-drop the chroma components any odd cycle*/ + uint8_t subsample_YUV444_to_YUV422; + /*!< tile_mode Valid for IO that can provide tile format: 0-no tiling; 1-the IO should use tiling with the configured height, width, and tiling type (internal tiling or external Tile-4)*/ + uint8_t tile_mode; + /*!< tiling_type Tiling Type: 0 - internal tiling; 1 - external tiling (Tile-4)*/ + uint8_t tiling_type; + /*!< traffic_class Traffic class the request belongs to and be stored at the XFER queue ccordingly*/ + uint8_t traffic_class; + /*!< unpack_alignment Valid for unpacked vectors: 0-element located at LSB and MSB is zero; 1-element located at MSB and LSB is zero*/ + uint8_t unpack_alignment; + /*!< use_attributes This capability impact the ODR. When set, ODR should use the EOL/EOF attributes to detect frame dimensions. In general, this capability is used when the height or width or both are not known or cannot be expressed. Using this capability disable the option using crop/pad mechanism and force SW to provide the same dimension in input/output region (if known) and zero the offset values.*/ + uint8_t use_attributes; + /*!< vector_format Vector CL format: 0-unpacked using 2B container; 1-packed*/ + uint8_t vector_format; + /*!< vertical_ordering_enable If set, the walking order should be vertical using the sub_line value to indicate how many CL generate vertical movement*/ + uint8_t vertical_ordering_enable; + /*!< vertical_ordering_sub_line valid when vertical_ordering is set, indicates the size of the sub line to generate vertical step in CL granularity*/ + uint8_t vertical_ordering_sub_line; + /*!< x_output_offset_per_stripe[4] Per stripe: Output offset of each stripe with regarding to the base_offset, in pixels, unsigned.*/ + uint32_t x_output_offset_per_stripe[4]; + /*!< zlr_transaction_enable when set enable sending zlr request for prefetch address translation and compression status*/ + uint8_t zlr_transaction_enable; + +} ia_pal_system_api_io_buffer_1_4_t; + +/*! \system api struct isys_drainer_1_0 + +*/ +typedef struct +{ + /*!< output_format 0-7 - RGB formats (with A=0); 8-15 - YUV formats; 0 - Output is in 3-plane RGB format; 3 - Output is in ARGB format; 4 - Output is in RGBA format; 5 - Output is in BGRA format; 6 - Output is in ABGR format; 8 - Output is in 2-plane YUV420 (NV12) format; 9 - Output Y only and discard UV;*/ + uint32_t output_format; + /*!< plane_offset_start_address[3] Per plane: Start offset address of plane with regarding to the base_offset, in bytes, CL aligned, unsigned.*/ + uint32_t plane_offset_start_address[3]; + +} ia_pal_system_api_isys_drainer_1_0_t; + +/*! \system api struct linearization2_0 +Linearization +*/ +typedef struct +{ + /*!< dol_processing 0 - regular processing. 1 - dol processing*/ + uint8_t dol_processing; + +} ia_pal_system_api_linearization2_0_t; + +/*! \system api struct lsc_1_2 +Lens shading correction up to 24 bit +*/ +typedef struct +{ + /*!< ir_processing 0 - RGB processing or 1 - IR processing*/ + uint8_t ir_processing; + /*!< stripe_blocks[4] Blocks per stripe*/ + uint32_t stripe_blocks[4]; + /*!< stripe_start_block[4] Blocks per stripe*/ + uint32_t stripe_start_block[4]; + +} ia_pal_system_api_lsc_1_2_t; + +/*! \system api struct nntm_1_0 + +*/ +typedef struct +{ + /*!< dol_processing 0 - regular processing. 1 - dol processing*/ + uint8_t dol_processing; + +} ia_pal_system_api_nntm_1_0_t; + +/*! \system api struct pafstatistics_1_2 +PAF Statistics +*/ +typedef struct +{ + /*!< input_modes 0: RRRR+LLLL; 1: LLLL+RRRR; 2: RLRL; 3: LRLR; 4: RRRR+LLLL_ALT; 5: LLLL+RRRR_ALT; 6: RLRL_ALT; 7: LRLR_ALT*/ + int32_t input_modes; + +} ia_pal_system_api_pafstatistics_1_2_t; + +/*! \system api struct pext_1_0 + +*/ +typedef struct +{ + /*!< swapping1stbc Apply swapping of BC inputs for 1st/3rd/etc.\n0: no swapping\n1: swap B/C inputs*/ + int32_t swapping1stbc; + /*!< swapping1stcd Apply swapping of CD inputs for 1st/3rd/etc.\n0: no swapping\n1: swap C/D inputs*/ + int32_t swapping1stcd; + /*!< swapping2ndbc Apply swapping of BC inputs for 2nd/4th/etc. lines\n0: no swapping\n1: swap A/B inputs*/ + int32_t swapping2ndbc; + /*!< swapping2ndcd Apply swapping of CD inputs for 2nd/4th/etc. lines\n0: no swapping\n1: swap C/D inputs*/ + int32_t swapping2ndcd; + /*!< united_rows Define number of queues for pdaf for type 2 0-one queue 1 -two queues*/ + int32_t united_rows; + +} ia_pal_system_api_pext_1_0_t; + +/*! \system api struct rgbs_grid_1_1 + +*/ +typedef struct +{ + /*!< ir_processing 0 - RGB processing or 1 - IR processing*/ + uint8_t ir_processing; + /*!< is_dol_psve_processing 0- regular processing. 1 - rgbs input is a pseudo sve image from dol*/ + uint8_t is_dol_psve_processing; + /*!< is_fragmentation If no - min_out_bytes=0. Otherwise - calculate to fit grid to CL.*/ + uint8_t is_fragmentation; + /*!< stripe_blocks[4] Blocks per stripe*/ + uint32_t stripe_blocks[4]; + +} ia_pal_system_api_rgbs_grid_1_1_t; + +/*! \system api struct tnr7_bc_1_2 + +*/ +typedef struct +{ + /*!< is_segmentation_aware SAP enable*/ + uint8_t is_segmentation_aware; + +} ia_pal_system_api_tnr7_bc_1_2_t; + +/*! \system api struct tnr7_blend_1_1 + +*/ +typedef struct +{ + /*!< is_segmentation_aware SAP enable*/ + uint8_t is_segmentation_aware; + +} ia_pal_system_api_tnr7_blend_1_1_t; + +/*! \system api struct upipe_1_0 + +*/ +typedef struct +{ + /*!< binning_factor Log2 of the downscale to use. This is on top of x4 downscale is demosaic*/ + uint8_t binning_factor; + /*!< demosaic_mode Demosaic mode, 0- 2x2, 1- 4x4. Note that binning interpretation depends on this*/ + uint8_t demosaic_mode; + /*!< enable enables the filter, if disabled the input is replicated to all three output channels*/ + uint8_t enable; + /*!< input_pattern[3] 4x4 pattern to RGB, channels in R,G,B order; default- GRBG*/ + uint16_t input_pattern[3]; + /*!< rgb_to_yuv_en 0 - Output is in RGB format; 1 - Output is in YUV format*/ + uint8_t rgb_to_yuv_en; + /*!< rgb_to_yuv_matrix[9] RGB to YUV matrix, S4.11; default- BT709*/ + int16_t rgb_to_yuv_matrix[9]; + +} ia_pal_system_api_upipe_1_0_t; + +/*! \system api struct xnr_5_4 +Low Frequency Chroma Denoiser +*/ +typedef struct +{ + /*!< is_segmentation_aware SAP enable*/ + uint8_t is_segmentation_aware; + +} ia_pal_system_api_xnr_5_4_t; + + + +#pragma pack(pop) + +#ifdef __cplusplus +} +#endif + +#endif // IA_PAL_TYPES_ISP_PARAMETERS_AUTOGEN_H diff --git a/include/ipu8/ia_imaging/ia_statistics_types.h b/include/ipu8/ia_imaging/ia_statistics_types.h new file mode 100644 index 0000000..5436e3e --- /dev/null +++ b/include/ipu8/ia_imaging/ia_statistics_types.h @@ -0,0 +1,157 @@ +/* + * Copyright 2018-2026 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_STATISTICS_TYPES_H_ +#define __IA_STATISTICS_TYPES_H_ + +#include "ia_types.h" +#include "ia_configuration.h" + +#define IA_RGBS_GRID_SIZE ((IA_RGBS_GRID_WIDTH) * (IA_RGBS_GRID_HEIGHT)) + + /*! + * \brief Bayer color channels grouped into one structure. + */ +typedef struct +{ + unsigned char gr; + unsigned char r; + unsigned char b; + unsigned char gb; +} ia_color_channels; + +typedef struct +{ + unsigned char r; + unsigned char g; + unsigned char b; +} ia_color_3channels; + +/*! + * \brief Statistics grid with averaged RGBS color channels and saturation percentage. + * Total size of each color channel array is defined by width * height of the grid. + */ +typedef struct +{ + unsigned int grid_width; /*!< Mandatory. Width of RGBYS grids. */ + unsigned int grid_height; /*!< Mandatory. Height of RGBYS grids. */ + ia_color_channels avg[IA_RGBS_GRID_SIZE]; /*!< Mandatory. Averaged R, Gr, Gb and B channel data. */ + unsigned char sat[IA_RGBS_GRID_SIZE]; /*!< Mandatory. Saturation percentage of pixels within collected data. [0, 255] = [0, 100]%. */ +} ia_rgbs_grid; + +#define IA_FILTER_RESPONSE_GRID_SIZE (IA_FILTER_RESPONSE_GRID_WIDTH * IA_FILTER_RESPONSE_GRID_HEIGHT) + +/*! + * \brief Filter responses interleaved. + */ +typedef struct +{ + int filter_1; /*!< Filter response of filter 1 (e.g. low pass, used by auto focus). */ + int filter_2; /*!< Filter response of filter 2 (e.g. high pass, used by auto focus). */ +} ia_filter_response; + +/*! + * \brief Convolution filter response statistics + * As defined in the AIQ statistics specification. + */ +typedef struct +{ + unsigned int grid_width; /*!< Number of block elements horizontally in a grid. */ + unsigned int grid_height; /*!< Number of block elements vertically in a grid. */ + ia_filter_response responses[IA_FILTER_RESPONSE_GRID_SIZE]; /*!< Interleaved filter responses. */ +} ia_filter_response_grid; + +typedef struct +{ + unsigned int element_count; /*!< Number of elements in the histogram. */ + unsigned int bins[IA_HISTOGRAM_SIZE]; /*!< Histogram data. */ +} ia_histogram; + +typedef struct +{ + ia_rectangle face_area; /*!< Bounding box of the face in the coordination system where (0,0) indicates left-top position. */ + int32_t tracking_id; /*!< Tracking id of the face. */ + int32_t confidence; /*!< Confidence in face detection result. */ + ia_coordinate mouth; /*!< Mid-point of the mouth. */ + ia_coordinate left_eye; /*!< Left eye */ + ia_coordinate right_eye; /*!< Right eye */ + bool eye_validity; /*!< Indicates whether a face was processed to get eye positions */ + float skin_type_dark_likelihood; /*!< Likelihood of skin type being dark. Bright skin likelihood = 100 - dark_skin_type_likelihood */ + bool skin_type_validity; /*!< Validity of the Skin Likelihood */ + int32_t rip_angle; /**< RIP (rotation in plane) angle in degrees. */ + int32_t rop_angle; /**< ROP (rotation out of plane) angle in degrees. */ +} ia_face_roi; + +typedef struct +{ + uint32_t num_faces; /*!< Number of faces detected.*/ + ia_face_roi* faces; /*!< ROI array of all detected faces.*/ +}ia_faces_roi_results; + +#define IA_DEPTH_GRID_SIZE (IA_DEPTH_GRID_WIDTH * IA_DEPTH_GRID_HEIGHT) + +typedef enum +{ + ia_depth_data_type_vcm, /*!< VCM units */ + ia_depth_data_type_mm, /*!< Distance to the object in mm */ +} ia_depth_data_type; + +/*! + * Depth statistics grid. + */ +typedef struct +{ + unsigned int grid_width; /*!< Number of grid elements horizontally */ + unsigned int grid_height; /*!< Number of grid elements vertically */ + ia_depth_data_type type; /*!< Data type (VCM units/mm)*/ + ia_rectangle grid_rect; /*!< ROI for the grid */ + int depth_data[IA_DEPTH_GRID_SIZE]; /*!< Depth data (type of data is defined by ia_depth_data_type) */ + unsigned char confidence[IA_DEPTH_GRID_SIZE]; /*!< Confidence level */ +} ia_depth_grid; + +/*! + * \brief Statistics grid with Segmap including class and confidence level. + * Total size is defined by 2 * width * height of the grid. + */ +typedef struct +{ + unsigned int grid_width; /*!< Mandatory. Width of segmap grids. */ + unsigned int grid_height; /*!< Mandatory. Height of segmap grids. */ + unsigned char class_id_conf[IA_RGBS_GRID_SIZE]; /*!< Mandatory. Packed byte structure for efficient storage: + * ┌─────────────┬─────────────┐ + * │ High 4 bits │ Low 4 bits │ + * │ Class ID │ Confidence │ + * │ [0-15] │ [0-15] │ + * └─────────────┴─────────────┘ + * Extract class_id: (class_id_conf >> 4) + * Extract confidence: (class_id_conf & 0xF) */ + uint64_t frame_id; +} ia_segmap_grid; + +/*! + * \brief ACS (ambient light sensor) statistics + */ +typedef struct +{ + bool is_valid; /*!< is ACS data valid*/ + float32_t lux_level; /*!< lux levels as measured by ACS sensor*/ + float64_t cct; /*!< Color correlated temperature (CCT) as measured by ACS sensor*/ + float64_t chroma_x; /*!< CIE1931 x coordinate as measured by ACS sensor*/ + float64_t chroma_y; /*!< CIE1931 y coordinate as measured by ACS sensor*/ + uint64_t timestamp; /*!< timestamp of the ACS sensor read*/ +} ia_acs_stats; + +#endif /* __IA_STATISTICS_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_types.h b/include/ipu8/ia_imaging/ia_types.h new file mode 100644 index 0000000..1783c6b --- /dev/null +++ b/include/ipu8/ia_imaging/ia_types.h @@ -0,0 +1,360 @@ +/* + * Copyright 2012-2024 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 +#include +#include + +/* MISRA typedefs*/ +#ifndef BUILDIN_TYPE +#define BUILDIN_TYPE +typedef float float32_t; +typedef double float64_t; +#endif + +#if defined(_MSC_VER) + #if !defined(__BOOL_DEFINED) + #if _MSC_VER >= 1800 /* stdbool.h is available starting from VS2013. */ + #include + #else /* Fallback for older VS versions. */ + typedef unsigned char bool; + #define true 1 + #define false 0 + #endif + #endif +#else + #include +#endif + +#ifdef _WIN32 + #ifndef BUILD_SHARED_LIBS + #define LIBEXPORT + #else + #ifdef BUILD_SHARED_LIBS + #define LIBEXPORT __declspec(dllexport) + #else + #define LIBEXPORT __declspec(dllimport) + #endif + #endif +#else + #define LIBEXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Bundles binary data pointer with size. + */ +typedef struct +{ + void *data; + unsigned int size; +} ia_binary_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 */ + 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 containing 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_rawplain32, /*!< Data is 32 bits per pixel. */ + ia_image_data_format_rgb32, /*!< Data is in a buffer containing planes: R, G and B one after another. Data size is 32 bits per pixel. */ + ia_image_data_format_ov20bit /*!< Data is in as 2x10bit pixels [13 12 11 10 f e d c][x x x x x x b a] [9 8 7 6 5 4 3 2][x x x x x x 1 0]*/ +} 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. +* This structure is stored inside header of Intel raw (IRAW) image as a makernote record. If a raw capture consists of multiple sub-images +* (for example from multiple exposures or cameras), each sub-image needs to have own makernote record (with different name id). +* image_start_offset defines start location of particular sub-image in the IRAW buffer/file. +*/ +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 */ + unsigned short reserved; /*!< Reserved to padding for 32 bit boundary. */ + unsigned int image_start_offset; /*!< Offset to beginning of image buffer. 0 if one image is present in the RAW image buffer. */ +} 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_not_run = (1 << 7) /*!< No need to execute*/ +} ia_err; + +#define IA_RESOLUTION_STATIC_GRAPH_PACK 4 +#pragma pack(push, IA_RESOLUTION_STATIC_GRAPH_PACK) +typedef struct { + /* + * IMPORTANT! do not do *ANY* change in this struct without coordinate with SW and Tools teams. + * This struct is being used by casting data from a binary file and hence cannot be changed. + */ + int left; + int top; + int right; + int bottom; +} ia_rectangle; +#pragma pack(pop) + +/** 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, va_list ap); + void (*verror)(const char *fmt, va_list ap); + void (*vinfo)(const char *fmt, va_list ap); + void (*vperf)(const char *fmt, va_list ap); +} ia_env; + +typedef struct { + void *(*alloc) (void *isp, size_t size); + void (*free) (void *isp, void *usr_ptr, size_t size); +} ia_mem_env; + + +/*! +* \brief Structure describes the media formats which AIC supports +*/ +typedef enum +{ + media_format_legacy = 0x00, //ipu4 default + media_format_legacy_narrow = 0x02, + media_format_bt601_8b = 0x20, //bt601 + media_format_bt601_8b_narrow = 0x22, //bt601 + media_format_bt709_8b = 0x30, //bt709 + media_format_bt709_8b_narrow = 0x32, //bt709 + media_format_bt709_10b = 0x40, //bt709 + media_format_bt709_10b_narrow = 0x42, //bt709 + media_format_bt2020_10b = 0x50, //bt2020 + media_format_bt2020_10b_narrow = 0x52, //bt2020 + media_format_bt2020_12b = 0x51, //bt2020 + media_format_bt2020_12b_narrow = 0x53, //bt2020 + media_format_bt2100_10b = 0x60, //bt2100 + media_format_bt2100_10b_narrow = 0x62, //bt2100 + media_format_bt2100_12b = 0x61, //bt2100 + media_format_bt2100_12b_narrow = 0x63, //bt2100 + media_format_bt2100_10b_cl = 0x64, //bt2100 + media_format_bt2100_10b_cl_narrow = 0x66, //bt2100 + media_format_bt2100_12b_cl = 0x65, //bt2100 + media_format_bt2100_12b_cl_narrow = 0x67, //bt2100 + media_format_srgb_jpeg = 0x80, //srgb_jpeg + media_format_linear_mono = 0xE0, //linear gamma with "mono-srgb" space for e.g. IR mode. + media_format_linear_mono_narrow = 0xE2, //linear gamma with "mono-srgb" space for e.g. IR mode. + media_format_custom = 0xF0 //custom +} ia_media_format; + +/** @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_atbx_eye; + +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_atbx_eye left_eye; /**< Left eye */ + ia_atbx_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_atbx_face; + +/** @brief face detection algo type + * This structure is used for indicate face detection type and CCA will optimize face related algo accordingly + */ +typedef enum +{ + AUTO = 0, + VPG, + PVL, + BLAZE_FD, + SUBWAY_FD, + FACEBOXES_FD, + CENTERNET_FD, + OS_FD, + GOOGLE_FD, + UNKNOWN_FD +} FD_IMPL_TYPE; + +/** @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_atbx_face *faces; /**< Array of face information. */ + bool updated; /**< The update status of face. true is the real statistics, and false is the false statistics that have not been updated.*/ + bool is_video_conf; /**< video confenerce mode. */ + FD_IMPL_TYPE fd_algo; /**< face detection algo type. */ +} ia_atbx_face_state; + +typedef enum +{ + rgbs_std, + rgbs_sve, + rgbs_sat, + ae_histogram, + af_std, + af_sve, + pdaf_out, + gmv_match_out, + NUM_STATISTICS_BUFFER_TYPES +} ia_statistics_buffer_type; + +#ifdef __cplusplus +} +#endif + +#endif /* _IA_TYPES_H_ */ diff --git a/include/ipu8/ia_imaging/ia_view.h b/include/ipu8/ia_imaging/ia_view.h new file mode 100644 index 0000000..8cfe6f0 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_view.h @@ -0,0 +1,163 @@ +/* + * Copyright 2021 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_VIEW_H__ +#define IA_VIEW_H__ + + +#include "ia_view_types.h" +#include "ia_cmc_types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \brief Initialize the view module. + * + * \param[out] view_handle handle maintaining the view instance + * \param[in] cmc The CMC parameters + * \return 0 for no error, others for error. + * + * This function initializes the view module. This is expected to be called before any + * other ia_view* function. + */ +LIBEXPORT ia_err +ia_view_init(ia_view_handle *view_handle, const ia_cmc_t *cmc); + + +/*! \brief Deinitialize the view module. + * + * \param[in] ia_view_handle handle maintaining the view instance + * + * This function deinitilizes the view module and frees internal memory + */ +LIBEXPORT ia_err +ia_view_deinit(ia_view_handle *view_handle); + + +/*! \brief Set configuration parameters +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[in] config Sets the basic configuration for the view +* +* This function sets the basic configurations parameters +*/ +LIBEXPORT ia_err +ia_view_set_configuration(ia_view_handle view_handle, + const ia_view_config_t *config); + + +/*! \brief Get configuration parameters +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[out] config Sets the basic configuration for the view +* +* This function gets the basic configurations parameters +*/ +LIBEXPORT ia_err +ia_view_get_configuration(ia_view_handle view_handle, + ia_view_config_t *config); + +/*! \brief Run the view parameter calculation +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[in] camera_rotation camera rotation matrix from DVS +* +* This function does the calculation of parameters +*/ +LIBEXPORT ia_err +ia_view_run(ia_view_handle view_handle, + const float32_t dvs_rotation[3][3]); + +/*! \brief Get the last calculated view parameters +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[out] view_params Get calculated view parameters +* +* This function returns the view parameters +*/ +LIBEXPORT ia_err +ia_view_get_view_parameters(ia_view_handle view_handle, + ia_view_params_t *isp_params); + + +/*! \brief Set view rotation +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[in] view_rotation New rotation to apply +* +* This function sets the new view rotation +*/ +LIBEXPORT ia_err +ia_view_set_view_rotation(ia_view_handle view_handle, + const ia_view_rotation_t *view_rotation); + +/*! \brief Set camera rotation +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[in] view_rotation New rotation to apply +* +* This function sets the new camera rotation +*/ +LIBEXPORT ia_err +ia_view_set_camera_rotation(ia_view_handle view_handle, + const ia_view_rotation_t *camera_rotation); + +/*! \brief Get view rotation +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[out] view_rotation The current rotation settings +* +* This function get the current view rotation +*/ +LIBEXPORT ia_err +ia_view_get_view_rotation(ia_view_handle view_handle, + ia_view_rotation_t *view_rotation); + + +/*! \brief Set window adjustment parameters +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[in] fine_adjustments Set the window adjustment parameters +* +* This function sets the window adjustment +*/ +LIBEXPORT ia_err +ia_view_set_fine_adjustments(ia_view_handle view_handle, + const ia_view_fine_adjustments_t *fine_adjustments); + + +/*! \brief Get window adjustment parameters +* +* \param[in] ia_view_handle handle maintaining the view instance +* \param[out] fine_adjustments Get the window adjustment parameters +* +* This function gets the current window adjustment +*/ +LIBEXPORT ia_err +ia_view_get_fine_adjustments(ia_view_handle view_handle, + ia_view_fine_adjustments_t *fine_adjustments); + + +#ifdef __cplusplus +} +#endif + +#endif /* IA_VIEW_H__ */ + + diff --git a/include/ipu8/ia_imaging/ia_view_types.h b/include/ipu8/ia_imaging/ia_view_types.h new file mode 100644 index 0000000..7969ed1 --- /dev/null +++ b/include/ipu8/ia_imaging/ia_view_types.h @@ -0,0 +1,222 @@ +/* + * Copyright 2017-2025 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_VIEW_TYPES_H_ +#define __IA_VIEW_TYPES_H_ + +#include +#include "ia_types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*!< ia_view_status_t: ia_view enable/disable and configure status */ +typedef enum { + ia_view_bypass=0, + ia_view_user_input_configured, + ia_view_resolution_configured, +} ia_view_status_t; + +/*!< ia_view_proc_enabled_t: The processing blocks enabled in GDC. Used in PAL*/ +typedef enum { + ia_view_proc_enabled_none=0, + ia_view_proc_enabled_pre_affine=(1<<0), + ia_view_proc_enabled_rotation=(1<<1), + ia_view_proc_enabled_post_affine=(1<<2), +} ia_view_proc_enabled_t; + + +/*!< ia_view_resolution_params_t: The frame resolutions at various points in the pipe*/ +typedef enum { + ia_view_resolution_at_sensor_output=0, /*Resolution at sensor output */ + ia_view_resolution_at_gdc_input, /*Resolution at gdc input */ + ia_view_resolution_at_gdc_output, /*Resolution at gdc output */ + ia_view_resolution_at_pipe_output, /*Resolution at pipe output */ + ia_view_resolution_max, +} ia_view_resolution_params_t; + + +/*!< Invalid coordinate size: Number of color channels possible to be specified.*/ +#define IA_VIEW_INVALID_COORD_SIZE (4) + +/*!< ia_view_projection_type_t: User controllable projection type*/ +typedef enum { + ia_view_projection_rectilinear, + ia_view_projection_conical, + ia_view_projection_equirectangular, + ia_view_projection_2Dbowl, + ia_view_projection_cylindrical +} ia_view_projection_type_t; + +/*!< ia_view_camera_mount_type_t: User controllable camera mount type*/ +typedef enum { + ia_view_wall_mounted, + ia_view_ceiling_mounted, +} ia_view_camera_mount_type_t; + +/*!< ia_view_fine_adjustments_t: Control fine adjustments of the viewing window*/ +typedef struct +{ + float horizontal_shift; /*!< Horizontal shift in pixels*/ + float vertical_shift; /*!< Vertical shift in pixels*/ + float window_rotation; /*!< Rotate the window, angle in degrees*/ + float vertical_stretch; /*!< Vertical stretch factor*/ +} ia_view_fine_adjustments_t; + + +/*!< ia_view_rotation_t: Set view rotation in x, y, z axis*/ +typedef struct +{ + float pitch; /*!< pitch angle in degrees: rotation along X axis*/ + float yaw; /*!< yaw angle in degrees: rotation along Y axis*/ + float roll; /*!< roll angle in degrees: rotation along Z axis*/ +} ia_view_rotation_t; + + +/*!< ia_view_resolution_t: The resolution required for view*/ +typedef struct +{ + int width; /*!< Resolution width */ + int height; /*!< Resolution height */ + int horz_offset; /*!< Horizontal offset */ + int vert_offset; /*!< Vertical offset */ + float scale_factor; /*!< Scale factor */ +} ia_view_resolution_t; + +/*!< translation array size*/ +#define IA_VIEW_3D_TRANSLATION_SIZE (3) + +/*!< ia_view_config_t: Set view parameters*/ +typedef struct +{ + ia_view_projection_type_t type; /*!< type: The projection type desired*/ + float zoom; /*!< zoom: Zoom configuration*/ + float cone_angle; /*!< cone_angle used only for ia_view_projection_conical*/ + double bowl_radius_sqr; /*!< bowl_radius_sqr used only for ia_view_projection_2Dbowl*/ + double bowl_scale; /*!< bowl_scale used only for ia_view_projection_2Dbowl*/ + ia_view_camera_mount_type_t camera_mount_type; /*! camera mount type: The mounting position of the camera: wall, ceiling*/ + int32_t invalid_coordinate_mask[IA_VIEW_INVALID_COORD_SIZE]; /*!< Used to fill for each color channel when coordinates falls out of bounds */ + + ia_view_rotation_t camera_rotation; /*(< Camera rotation configuration */ + ia_view_rotation_t view_rotation; /*!< View rotation configuration */ + float translation[IA_VIEW_3D_TRANSLATION_SIZE]; /*!< Translation3D vector for Bowl projection*/ + ia_view_fine_adjustments_t fine_adjustments; /*!< Fine adjustment configuration */ +} ia_view_config_t, ia_isp_bxt_view_params_t; + +/*!< ia_view_mbr_limits_t: Set mbr limits for view parameters*/ +typedef struct +{ + /*!< Min Zooming on projection*/ + float zoom; + /*!< max pitch of view*/ + float pitch; + /*!< max yaw of view*/ + float yaw; + /*!< max roll view*/ + float roll; + /*!< max Window rotation*/ + float winrotation; + /*!< max vertical scale*/ + float vertical_stretch; + /*!< max horizontal shift*/ + float horizontal_shift; + /*!< max vertical shift*/ + float vertical_shift; +} ia_view_limits_t; + +typedef struct +{ + ia_view_limits_t cylindrical; + ia_view_limits_t equirectangular; + ia_view_limits_t rectilinear; + ia_view_limits_t conical_m40; + ia_view_limits_t conical_m20; + ia_view_limits_t conical_p20; + ia_view_limits_t conical_p40; +}ia_view_mbr_limits_t,ia_isp_bxt_gdc_limits; + + + +/*!< ia_view_projection_t: Calculated parameter used in PAL*/ +typedef struct +{ + ia_view_projection_type_t type; /*!< type: Projection type to be used*/ + double scale_factor_1[2]; /*!< scale_factor_1: Internal scale factor calculated*/ + double scale_factor_2[2]; /*!< scale_factor_2: Internal scale factor calculated*/ + double inv_f_pi; /*!< inv_f_pi is inverse focal length pi: Internal parameter*/ + double bowl_radius_sqr; + double bowl_scale; +} ia_view_projection_t; + + +/*!< ia_view_params_t: Calculated parameter to be used in PAL*/ +typedef struct +{ + /*!< Mask indicating what parameters are enabled*/ + int32_t enabled_mask; + + /*!< Projections the view */ + ia_view_projection_t projection; + + /*!< Pre Affine Matrix: Window rotation and scale*/ + float pre_affine_scale_matrix[2][2]; + + /*!< Pre Affine Matrix: Translation*/ + double pre_affine_translation_matrix[2]; + + /*!< Rotation Matrix combines camera and view rotations */ + float rotation_matrix[3][3]; + + /*!< Translation3D Matrix for Bowl Projection*/ + float translation_matrix[IA_VIEW_3D_TRANSLATION_SIZE]; + + /*!< Post Affine Matrix */ + float post_affine_scale_matrix[2][2]; + + /*!< Post Affine Matrix */ + double post_affine_translation_matrix[2]; + + /*!< Invalid coordinate mask for each color channel */ + int32_t invalid_coordinate_mask[IA_VIEW_INVALID_COORD_SIZE]; + +} ia_view_params_t; + +typedef struct +{ + ia_view_status_t is_configured; + ia_view_config_t config; + ia_view_resolution_t resolution[ia_view_resolution_max]; /*!< View resolution at different stages in the pipe */ + float cmc_affine_scale_matrix[2][2]; + double cmc_affine_translation_matrix[2]; + float cmc_focal_length; + int cmc_image_window_horizontal_shift; + int cmc_image_window_vertical_shift; + + ia_view_params_t isp_params; +} ia_view_t; + +typedef ia_view_t* ia_view_handle; + +#ifdef __cplusplus +} +#endif + +#endif /* __IA_VIEW_TYPES_H_ */ + diff --git a/lib/firmware/intel/ipu/ipu8_fw.bin b/lib/firmware/intel/ipu/ipu8_fw.bin new file mode 100644 index 0000000..8df08bb Binary files /dev/null and b/lib/firmware/intel/ipu/ipu8_fw.bin differ diff --git a/lib/firmware/intel/ipu/unsigned/ipu7ptl_fw.bin b/lib/firmware/intel/ipu/unsigned/ipu7ptl_fw.bin index 317b155..46608df 100644 Binary files a/lib/firmware/intel/ipu/unsigned/ipu7ptl_fw.bin and b/lib/firmware/intel/ipu/unsigned/ipu7ptl_fw.bin differ diff --git a/lib/firmware/intel/ipu/unsigned/ipu8_fw.bin b/lib/firmware/intel/ipu/unsigned/ipu8_fw.bin new file mode 100644 index 0000000..8df08bb Binary files /dev/null and b/lib/firmware/intel/ipu/unsigned/ipu8_fw.bin differ diff --git a/lib/libia_aic-ipu75xa.so.0 b/lib/libia_aic-ipu75xa.so.0 index 562df00..3465890 100644 Binary files a/lib/libia_aic-ipu75xa.so.0 and b/lib/libia_aic-ipu75xa.so.0 differ diff --git a/lib/libia_aic-ipu7x.so.0 b/lib/libia_aic-ipu7x.so.0 index 499c1b7..dea21f9 100644 Binary files a/lib/libia_aic-ipu7x.so.0 and b/lib/libia_aic-ipu7x.so.0 differ diff --git a/lib/libia_aic-ipu8.so b/lib/libia_aic-ipu8.so new file mode 120000 index 0000000..a956218 --- /dev/null +++ b/lib/libia_aic-ipu8.so @@ -0,0 +1 @@ +libia_aic-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_aic-ipu8.so.0 b/lib/libia_aic-ipu8.so.0 new file mode 100644 index 0000000..6cb6be4 Binary files /dev/null and b/lib/libia_aic-ipu8.so.0 differ diff --git a/lib/libia_aiq_v1-ipu75xa.so.0 b/lib/libia_aiq_v1-ipu75xa.so.0 index 80d8118..9fcf41c 100644 Binary files a/lib/libia_aiq_v1-ipu75xa.so.0 and b/lib/libia_aiq_v1-ipu75xa.so.0 differ diff --git a/lib/libia_aiq_v1-ipu7x.so.0 b/lib/libia_aiq_v1-ipu7x.so.0 index b4e2c14..bcd9a42 100644 Binary files a/lib/libia_aiq_v1-ipu7x.so.0 and b/lib/libia_aiq_v1-ipu7x.so.0 differ diff --git a/lib/libia_aiq_v1-ipu8.so b/lib/libia_aiq_v1-ipu8.so new file mode 120000 index 0000000..f77f11a --- /dev/null +++ b/lib/libia_aiq_v1-ipu8.so @@ -0,0 +1 @@ +libia_aiq_v1-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_aiq_v1-ipu8.so.0 b/lib/libia_aiq_v1-ipu8.so.0 new file mode 100644 index 0000000..c938396 Binary files /dev/null and b/lib/libia_aiq_v1-ipu8.so.0 differ diff --git a/lib/libia_aiq_v1_file_debug-ipu75xa.so.0 b/lib/libia_aiq_v1_file_debug-ipu75xa.so.0 index 0542fc4..e0ef003 100644 Binary files a/lib/libia_aiq_v1_file_debug-ipu75xa.so.0 and b/lib/libia_aiq_v1_file_debug-ipu75xa.so.0 differ diff --git a/lib/libia_aiq_v1_file_debug-ipu7x.so.0 b/lib/libia_aiq_v1_file_debug-ipu7x.so.0 index 7191557..90f17a5 100644 Binary files a/lib/libia_aiq_v1_file_debug-ipu7x.so.0 and b/lib/libia_aiq_v1_file_debug-ipu7x.so.0 differ diff --git a/lib/libia_aiq_v1_file_debug-ipu8.so b/lib/libia_aiq_v1_file_debug-ipu8.so new file mode 120000 index 0000000..cce705b --- /dev/null +++ b/lib/libia_aiq_v1_file_debug-ipu8.so @@ -0,0 +1 @@ +libia_aiq_v1_file_debug-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_aiq_v1_file_debug-ipu8.so.0 b/lib/libia_aiq_v1_file_debug-ipu8.so.0 new file mode 100644 index 0000000..6483c79 Binary files /dev/null and b/lib/libia_aiq_v1_file_debug-ipu8.so.0 differ diff --git a/lib/libia_aiqb_parser-ipu8.so b/lib/libia_aiqb_parser-ipu8.so new file mode 120000 index 0000000..61637e9 --- /dev/null +++ b/lib/libia_aiqb_parser-ipu8.so @@ -0,0 +1 @@ +libia_aiqb_parser-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_aiqb_parser-ipu8.so.0 b/lib/libia_aiqb_parser-ipu8.so.0 new file mode 100644 index 0000000..577d0c5 Binary files /dev/null and b/lib/libia_aiqb_parser-ipu8.so.0 differ diff --git a/lib/libia_bcomp-ipu8.so b/lib/libia_bcomp-ipu8.so new file mode 120000 index 0000000..a50cdcb --- /dev/null +++ b/lib/libia_bcomp-ipu8.so @@ -0,0 +1 @@ +libia_bcomp-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_bcomp-ipu8.so.0 b/lib/libia_bcomp-ipu8.so.0 new file mode 100644 index 0000000..e4d7b9e Binary files /dev/null and b/lib/libia_bcomp-ipu8.so.0 differ diff --git a/lib/libia_cca-ipu75xa.so.0 b/lib/libia_cca-ipu75xa.so.0 index 35ffab2..bb0e314 100644 Binary files a/lib/libia_cca-ipu75xa.so.0 and b/lib/libia_cca-ipu75xa.so.0 differ diff --git a/lib/libia_cca-ipu7x.so.0 b/lib/libia_cca-ipu7x.so.0 index 0a6aec8..6b56c27 100644 Binary files a/lib/libia_cca-ipu7x.so.0 and b/lib/libia_cca-ipu7x.so.0 differ diff --git a/lib/libia_cca-ipu8.so b/lib/libia_cca-ipu8.so new file mode 120000 index 0000000..62f49b8 --- /dev/null +++ b/lib/libia_cca-ipu8.so @@ -0,0 +1 @@ +libia_cca-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_cca-ipu8.so.0 b/lib/libia_cca-ipu8.so.0 new file mode 100644 index 0000000..963b993 Binary files /dev/null and b/lib/libia_cca-ipu8.so.0 differ diff --git a/lib/libia_ccat-ipu75xa.so.0 b/lib/libia_ccat-ipu75xa.so.0 index f2bafb7..65c50b4 100644 Binary files a/lib/libia_ccat-ipu75xa.so.0 and b/lib/libia_ccat-ipu75xa.so.0 differ diff --git a/lib/libia_ccat-ipu7x.so.0 b/lib/libia_ccat-ipu7x.so.0 index 6d18d7e..80a0173 100644 Binary files a/lib/libia_ccat-ipu7x.so.0 and b/lib/libia_ccat-ipu7x.so.0 differ diff --git a/lib/libia_ccat-ipu8.so b/lib/libia_ccat-ipu8.so new file mode 120000 index 0000000..b844fcf --- /dev/null +++ b/lib/libia_ccat-ipu8.so @@ -0,0 +1 @@ +libia_ccat-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_ccat-ipu8.so.0 b/lib/libia_ccat-ipu8.so.0 new file mode 100644 index 0000000..19e6eb2 Binary files /dev/null and b/lib/libia_ccat-ipu8.so.0 differ diff --git a/lib/libia_cmc_parser-ipu8.so b/lib/libia_cmc_parser-ipu8.so new file mode 120000 index 0000000..fdd1a4d --- /dev/null +++ b/lib/libia_cmc_parser-ipu8.so @@ -0,0 +1 @@ +libia_cmc_parser-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_cmc_parser-ipu8.so.0 b/lib/libia_cmc_parser-ipu8.so.0 new file mode 100644 index 0000000..d462c24 Binary files /dev/null and b/lib/libia_cmc_parser-ipu8.so.0 differ diff --git a/lib/libia_coordinate-ipu8.so b/lib/libia_coordinate-ipu8.so new file mode 120000 index 0000000..78d68e4 --- /dev/null +++ b/lib/libia_coordinate-ipu8.so @@ -0,0 +1 @@ +libia_coordinate-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_coordinate-ipu8.so.0 b/lib/libia_coordinate-ipu8.so.0 new file mode 100644 index 0000000..21e08aa Binary files /dev/null and b/lib/libia_coordinate-ipu8.so.0 differ diff --git a/lib/libia_dvs-ipu75xa.so.0 b/lib/libia_dvs-ipu75xa.so.0 index 0f0bde2..7d1775d 100644 Binary files a/lib/libia_dvs-ipu75xa.so.0 and b/lib/libia_dvs-ipu75xa.so.0 differ diff --git a/lib/libia_dvs-ipu7x.so.0 b/lib/libia_dvs-ipu7x.so.0 index bf956ec..93d13c4 100644 Binary files a/lib/libia_dvs-ipu7x.so.0 and b/lib/libia_dvs-ipu7x.so.0 differ diff --git a/lib/libia_dvs-ipu8.so b/lib/libia_dvs-ipu8.so new file mode 120000 index 0000000..f2cfa85 --- /dev/null +++ b/lib/libia_dvs-ipu8.so @@ -0,0 +1 @@ +libia_dvs-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_dvs-ipu8.so.0 b/lib/libia_dvs-ipu8.so.0 new file mode 100644 index 0000000..c551dbc Binary files /dev/null and b/lib/libia_dvs-ipu8.so.0 differ diff --git a/lib/libia_emd_decoder-ipu8.so b/lib/libia_emd_decoder-ipu8.so new file mode 120000 index 0000000..ee312ca --- /dev/null +++ b/lib/libia_emd_decoder-ipu8.so @@ -0,0 +1 @@ +libia_emd_decoder-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_emd_decoder-ipu8.so.0 b/lib/libia_emd_decoder-ipu8.so.0 new file mode 100644 index 0000000..eb735d6 Binary files /dev/null and b/lib/libia_emd_decoder-ipu8.so.0 differ diff --git a/lib/libia_exc-ipu8.so b/lib/libia_exc-ipu8.so new file mode 120000 index 0000000..fb6ac37 --- /dev/null +++ b/lib/libia_exc-ipu8.so @@ -0,0 +1 @@ +libia_exc-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_exc-ipu8.so.0 b/lib/libia_exc-ipu8.so.0 new file mode 100644 index 0000000..107c04e Binary files /dev/null and b/lib/libia_exc-ipu8.so.0 differ diff --git a/lib/libia_lard-ipu75xa.so.0 b/lib/libia_lard-ipu75xa.so.0 index 961f77f..381c402 100644 Binary files a/lib/libia_lard-ipu75xa.so.0 and b/lib/libia_lard-ipu75xa.so.0 differ diff --git a/lib/libia_lard-ipu7x.so.0 b/lib/libia_lard-ipu7x.so.0 index 052aee3..a49909b 100644 Binary files a/lib/libia_lard-ipu7x.so.0 and b/lib/libia_lard-ipu7x.so.0 differ diff --git a/lib/libia_lard-ipu8.so b/lib/libia_lard-ipu8.so new file mode 120000 index 0000000..48112c2 --- /dev/null +++ b/lib/libia_lard-ipu8.so @@ -0,0 +1 @@ +libia_lard-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_lard-ipu8.so.0 b/lib/libia_lard-ipu8.so.0 new file mode 100644 index 0000000..6d51da6 Binary files /dev/null and b/lib/libia_lard-ipu8.so.0 differ diff --git a/lib/libia_log-ipu8.so b/lib/libia_log-ipu8.so new file mode 120000 index 0000000..79a7010 --- /dev/null +++ b/lib/libia_log-ipu8.so @@ -0,0 +1 @@ +libia_log-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_log-ipu8.so.0 b/lib/libia_log-ipu8.so.0 new file mode 100644 index 0000000..42430bb Binary files /dev/null and b/lib/libia_log-ipu8.so.0 differ diff --git a/lib/libia_mkn-ipu8.so b/lib/libia_mkn-ipu8.so new file mode 120000 index 0000000..89254bf --- /dev/null +++ b/lib/libia_mkn-ipu8.so @@ -0,0 +1 @@ +libia_mkn-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_mkn-ipu8.so.0 b/lib/libia_mkn-ipu8.so.0 new file mode 100644 index 0000000..aa2eaa0 Binary files /dev/null and b/lib/libia_mkn-ipu8.so.0 differ diff --git a/lib/libia_nvm-ipu8.so b/lib/libia_nvm-ipu8.so new file mode 120000 index 0000000..e3e09dc --- /dev/null +++ b/lib/libia_nvm-ipu8.so @@ -0,0 +1 @@ +libia_nvm-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_nvm-ipu8.so.0 b/lib/libia_nvm-ipu8.so.0 new file mode 100644 index 0000000..3a8f05b Binary files /dev/null and b/lib/libia_nvm-ipu8.so.0 differ diff --git a/lib/libia_view-ipu8.so b/lib/libia_view-ipu8.so new file mode 120000 index 0000000..83643d7 --- /dev/null +++ b/lib/libia_view-ipu8.so @@ -0,0 +1 @@ +libia_view-ipu8.so.0 \ No newline at end of file diff --git a/lib/libia_view-ipu8.so.0 b/lib/libia_view-ipu8.so.0 new file mode 100644 index 0000000..1c7e317 Binary files /dev/null and b/lib/libia_view-ipu8.so.0 differ diff --git a/lib/pkgconfig/ia_imaging-ipu8.pc b/lib/pkgconfig/ia_imaging-ipu8.pc new file mode 100644 index 0000000..079a21a --- /dev/null +++ b/lib/pkgconfig/ia_imaging-ipu8.pc @@ -0,0 +1,11 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include/ipu8 + +Name: libia_imaging +Description: ia_imaging libraries +URL: http://www.intel.com +Version: +Libs: -L${libdir} +Cflags: -I${includedir}/ia_imaging