///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017-2023 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  chiaecinterface.h
/// @brief Auto Exposure Control Algorithm interface definitions
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// NOWHINE FILE GR016: Typedefs must not be used for structs, classes, and enumerations
#ifndef CHIAECINTERFACE_H
#define CHIAECINTERFACE_H

#include "chistatsinterfacedefs.h"
#include "chistatsproperty.h"

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

// Data structures that are exposed to OEM must be packed to have the expected layout.
#pragma pack(push, CDK_PACK_SIZE)

/** @addtogroup chi_stats_aec
@{ */

static const INT    MaxSensorRegisterControlSize = 32;     ///< Maximum size of the sensor control registers.

/// Exposure counts for the sensor.
enum AECAlgoHDRExposureCount
{
    InvalidExposureCount = -1,  ///< Invalid number of exposures.
    ExposureCount1       = 1,   ///< Single exposure.
    ExposureCount2,             ///< Two exposures.
    ExposureCount3,             ///< Three exposures.
    ExposureMax = 0xFFFF,       ///< Indicates the last item in the definition.
};


// Rules of input/output/setparam structures
// 1. Every new variable has to be added to the end of the structure once the interface is published
// 2. No change to the sub-structures inside of the structures once published, if has to be changed, add the new variables to
//    the end of the master structure


/// @brief Running modes for the AEC algorithm.
typedef enum
{
    AECAlgoModeAuto,
    AECAlgoModeManualISO,
    AECAlgoModeManualGain,
    AECAlgoModeManualExpTime,
    AECAlgoModeManualFull,
    AECAlgoModeManualAperture,
    AECAlgoModeMax             = 0x7FFFFFFF
} AECAlgoModeType;

/// @brief Lock modes for the AEC algorithm.
typedef enum
{
    AECAlgoLockOFF,
    AECAlgoLockOn,
    AECAlgoLockMax              = 0x7FFFFFFF
} AECAlgoLockType;

/// @brief Flash states for the AEC algorithm.
typedef enum
{
    AECAlgoFlashStateOff,
    AECAlgoFlashStatePre,
    AECAlgoFlashStateMain,
    AECAlgoFlashStateCalibaration,
    AECAlgoFlashStateMax =   0x7FFFFFFF
} AECAlgoFlashStateType;

/// @brief Flash measurement states for the AEC algorithm.
typedef enum
{
    AECAlgoFlashMeasKindOff,                ///< Measurement is not ongoing.
    AECAlgoFlashMeasKindCalib,              ///< Calibration with an individual module.
    AECAlgoFlashMeasKindTuning,             ///< Tuning with a golden module.
    AECAlgoFlashMeasKindMax = 0x7FFFFFFF    ///< Indicates the last item in the definition.
} AECAlgoFlashMeasKindType;

/// @brief Flash measurement results for the AEC algorithm.
typedef enum
{
    AECAlgoFlashMeasStatusOngoing,          ///< Measurements are still ongoing.
    AECAlgoFlashMeasStatusPass,             ///< Completed measurements were successful.
    AECAlgoFlashMeasStatusFail,             ///< Completed measurements failed.
    AECAlgoFlashMeasStatusBreak,            ///< Completed measurements have a tuning break.
    AECAlgoFlashMeasStatusMax = 0x7FFFFFFF  ///< Indicates the last item in the definition.
} AECAlgoFlashMeasStatusType;

/// @brief Types of snapshot modes.
typedef enum
{
    AECAlgoSnapshotNormal,                  ///< Regular snapshot.
    AECAlgoSnapshotFlash,                   ///< Flash snapshot.
    AECAlgoSnapshotLLS,                     ///< For LLS: no flash; longer exposure time.
    AECAlgoSnapshotQLL,                     ///< For QLL: no flash; longer exposure time.
    AECAlgoSnapshotCount,                   ///< Maximum number of modes.
    AECAlgoSnapshotMax     = 0x7FFFFFFF     ///< Indicates the last item in the definition.
} AECAlgoSnapshotType;

/// @brief Touch exposure value (EV) states for the AEC algorithm.
typedef enum
{
    AECAlgoTouchEVInactive,                     ///< Touch EV feature is inactive.
    AECAlgoTouchEVConverging,                   ///< Touch EV in searching state.
    AECAlgoTouchEVSettled,                      ///< AEC is settled on touching EV.
    AECAlgoTouchEVSceneChange,                  ///< Indicate the scene is changed after AEC is settled on touching.
    AECAlgoTouchEVMax          = 0x7FFFFFFF     ///< Indicates the last item in the definition.
} AECAlgoTouchEVType;

/// @brief Operation modes for the AEC algorithm.
typedef enum
{
    AECAlgoOperationModeInit,                           ///< AEC is in the initial state.
    AECAlgoOperationModeStreaming,                      ///< AEC is in the streaming/preview state.
    AECAlgoOperationModePreflash,                       ///< AEC is in the preflash state.
    AECAlgoOperationModeFastAEC,                        ///< AEC is in the fast AEC state.
    AECAlgoOperationModeAggressiveAEC,                  ///< AEC is in the aggressive state.
    AECAlgoOperationModeFlashMeasurement,               ///< AEC is measuring the flash for tuning or calibration.
    AECAlgoOperationModeCount,                          ///< Maximum number of operation modes.
    AECAlgoOperationModeMax            = 0x7FFFFFFF     ///< Indicates the last item in the definition.
} AECAlgoOperationModeType;

/// @brief Metering modes for the AEC algorithm.
typedef enum
{
    AECAlgoMeteringModeFrameAverage,
    AECAlgoMeteringModeCenterWeighted,
    AECAlgoMeteringModeSpot,
    AECAlgoMeteringModeCustom,
    AECAlgoMeteringModeMax             = 0x7FFFFFFF
} AECAlgoMeteringModeType;

/// @brief LED modes for an AEC capture request.
typedef enum
{
    AECAlgoLEDModeOff,                  ///< No LED for the snapshot under any circumstances.
    AECAlgoLEDModeAuto,                 ///< Allow the algorithm determine if it requires an LED for the snapshot.
    AECAlgoLEDModeOn,                   ///< Turn on the LED for the snapshot under any circumstances.
    AECAlgoLEDModeMax  = 0x7FFFFFFF     ///< Indicates the last item in the definition.
} AECAlgoLEDModeType;

/// @brief Diagnostic test cases.
typedef enum
{
    AECAlgoTestCaseTimeSweep,
    AECAlgoTestCaseGainSweep,
    AECAlgoTestCaseToggleTest,
    AECAlgoTestCaseExpTimeSweepDelay,
    AECAlgoTestCaseGainSweepDelay,
    AECAlgoTestCaseToggleTestDelay,
    AECAlgoTestCaseCount,
    AECAlgoTestCaseMax,
} AECAlgoDiagnosticTestCase;

/// @brief Modes for an on-the-fly sensor switch between the QCFA HDR and binning.
typedef enum
{
    AECAlgoSeamlessBinning,     ///< Sensor must be set to binning mode.
    AECAlgoSeamless3HDR         ///< Sensor must be set to 3 HDR mode.
} AECAlgoSeamlessMode;

/// @brief Contains manual override settings that can be set to the AEC algorithm.
typedef struct
{
    // All the override flags will be added here
    // These setting will be used to override tuning settings
    BOOL   disableSpeckleDetection;            ///< Indicates whether the Speckle Detection feature is disabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    BOOL   disablePreviewManualISO;            ///< Indicates whether Manual mode for the ISO priority is disabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    BOOL   disablePreviewManualExpTime;        ///< Indicates whether Manual mode for the exposure time priority is disabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    BOOL   disablePreviewManualFull;           ///< Indicates whether complete Manual mode is disabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    BOOL   enableForceSeamlessIHDRSnapshot;    ///< Indicates whether forcing the seamless IHDR Snapshot mode is enabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    UINT32 profile3A;                          ///< Bit mask to control 3A profiling traces.

    BOOL   enable3ADebugData;                  ///< Indicates whether 3A debug data is enabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    BOOL   enableConcise3ADebugData;           ///< Indicates whether Concise 3A debug data is enabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    BOOL   enable3ADebugDataCustomFilter;     ///< Indicates whether customized tag filter is enabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

    BOOL   enable3ADebugDataDump;              ///< Indicates whether 3A debug dumping is enabled.
                                               ///
                                               ///  @valuesbul
                                               ///  - 0 -- FALSE
                                               ///  - 1 -- TRUE @tablebulletend

} AECAlgoOverrideSettingParam;

/// @brief Capabilities of AEC module EV settings.
typedef struct
{
    INT8    minEV;       ///< Minimum value of EV range of capabilities.
    INT8    maxEV;       ///< Maximum value of EV range of capabilities.
    INT8    stepsPerEV;  ///< Steps per EV to be configured in Chromatix and reported to the HAL.
} AECAlgoEVCapabilities;

/// @brief Manual settings for the AEC algorithm: ISO or exposure time priority and full Manual mode.
typedef struct
{
    AECAlgoModeType manualMode;     ///< Specify the Manual mode.
                                    ///
                                    ///  @valuesbul
                                    ///  - #AECAlgoModeManualISO
                                    ///  - #AECAlgoModeManualGain
                                    ///  - #AECAlgoModeManualExpTime
                                    ///  - #AECAlgoModeManualFull
                                    ///  - #AECAlgoModeManualAperture @tablebulletend

    UINT32          ISOValue;       ///< Specify the ISO value used for Manual mode.
    UINT64          exposureTime;   ///< Specify the exposure time (in nanoseconds) used for Manual mode.
    FLOAT           gain;           ///< Specify the gain. This parameter has a priority then ISO.
    FLOAT           FNumber;        ///< Specify the aperture value used for Manual mode.
} AECAlgoManualSetting;

/// @brief Range of FPS for the AEC algorithm.
typedef struct
{
    FLOAT  maximumFPS;  ///< Maximum FPS at which the AEC operates.
    FLOAT  minimumFPS;  ///< Minimum FPS at which the AEC operates.
} AECAlgoFPSRange;

/// @brief Defines the AWB information as input to the AEC algorithm.
typedef struct
{
    BOOL                 isAuto;             ///< Indicates whether the AWB runs in Automatic or Manual mode.
                                             ///
                                             ///  @valuesbul
                                             ///  - 0 -- Manual
                                             ///  - 1 -- Automatic @tablebulletend

    FLOAT   redGain;                         ///< Indicates the red gain.
    FLOAT   greenGain;                       ///< Indicates the green gain.
    FLOAT   blueGain;                        ///< Indicates the blue gain.
    UINT32  CCT;                             ///< Color correction temperature of AWB.
    AWBFaceSAAdjustedROI faceSAAdjustedROI;  ///< Face ROI when a blocking case is detected.
    AWBFaceToneInfo faceToneInfo;            ///< AWB face tone information.
} AECAlgoWhiteBalanceState;

/// @brief Defines the absolute dual camera OTP calibration data (new format).
typedef struct
{
    FLOAT  gain;            ///< Current camera gain.
    UINT16 averageLuma;     ///< Average Luma of current camera.
    UINT16 exposureTimeUs;  ///< Current camera time or line count.
    UINT32 CCT;             ///< Current camera (master) calibration light CCT.
} AECAlgoAbsoluteDCCalibrationInfo;

/// @brief Defines the relative dual camera OTP calibration data (old format).
typedef struct
{
    FLOAT   brightnessRatio;        ///< Brightness compensation ratio.
    FLOAT   slaveGain;              ///< Other camera gain.
    FLOAT   slaveTimeUnit;          ///< Other camera time or line count.
    FLOAT   masterGain;             ///< Current camera gain.
    FLOAT   masterTimeUnit;         ///< Current camera time or line count.
    UINT32  CCT;                    ///< Current camera calibration light for the correlated color temperature.
} AECAlgoRelativeDCCalibrationInfo;

/// @brief Dual camera OTP calibration data.
typedef struct
{
    UINT32 version;                                 ///< Version information for the OTP data.

    /// @brief Union of calibration data for old and new OTP formats.
    union {
        AECAlgoRelativeDCCalibrationInfo relative;  ///< Relative calibration data for the old OTP format.
        AECAlgoAbsoluteDCCalibrationInfo absolute;  ///< Absolute calibration data for the new OTP format.
    };
} AECAlgoDCCalibrationInfo;

/// @brief Calibration data as input to the AEC aperture control feature.
typedef enum
{
    AECAlgoApertureCalib1       = 0,            ///< Default aperture calibration.
    AECAlgoApertureCalib2       = 1,            ///< Second aperture (typically a smaller aperture).
    AECAlgoApertureCalibCount   = 2,            ///< Maximum number of possible apertures.
    AECAlgoApertureCalibMax     = 0x7FFFFFFF    ///< Indicates the last item in the definition.
} AECAlgoApertureCalibrationType;

/// @brief Calibration of multiple F numbers. The principle is like AEC synchronization, but here there is only one camera and
///        multiple apertures.
typedef struct
{
    UINT32  lineCount;             ///< Sensor line count for exposure control.
    FLOAT   gain;                  ///< Sensor gain for exposure control.
} AECAlgoApertureCalibrationInfo;

/// @brief Array of calibration data for an aperture. Typically, there are at least two calibration elements in the array.
typedef struct
{
    AECAlgoApertureCalibrationInfo  calibrations[AECAlgoApertureCalibCount];    ///< Array of aperture calibration elements.
    UINT32                          count;                                      ///< Number of actual elements.
} AECAlgoMultiApertureCalibration;

/// @brief Exposure parameters used to control the frame exposure setting for the sensor and ISP.
typedef struct
{
    UINT64  exposureTime;       ///< Exposure time that is applied to the frame (in nanoseconds).
    FLOAT   linearGain;         ///< Total gain that is applied to the frame.
                                ///  The sensor should apply as much of this gain as possible. The remaining residual gain
                                ///  should be applied to the ISP.
    FLOAT   sensitivity;        ///< Overall exposure calculated as exposure time * linear gain * sensitivity correction
                                ///  factor (binning).
    FLOAT   deltaEVFromTarget;  ///< Current exposure delta compared with a specified target.
    FLOAT   compenADRCGain;     ///< ADRC compensation gain that must be applied at the wide balance module.
    FLOAT   predictiveGain;     ///< Amount of digital gain from the predictive convergence algorithm.
                                ///  This value is to be applied to the ISP module.
    FLOAT   predictiveGainSFE;  ///< Amount of digital gain from the predictive convergence algorithm.
                                ///  This value is to be applied to the SFE module.
} AECAlgoExposureData;

/// @brief Information about the type of exposure and the exposure data.
typedef struct
{
    AlgoOutputExposureType exposureType;    ///< Current type of exposure.
                                            ///
                                            ///  @valuesbul
                                            ///  - AECAlgoExposureShort
                                            ///  - AECAlgoExposureLong
                                            ///  - AECAlgoExposureSafe @tablebulletend

    AECAlgoExposureData     exposureData;   ///< Data for controlling the frame exposure setting.
} AECAlgoExposureInfo;

/// @brief Defines the input and output structures for exposure parameters.
typedef struct
{
    AECAlgoExposureInfo*    pExposureInfo;              ///< Pointer to the array of exposure information structures.
    UINT32                  exposureInfoCount;          ///< Number of exposure information structures in pExposureInfo.
                                                        ///  This value is input to the algorithm.
    UINT32                  exposureInfoSize;           ///< Size of each exposure information structure in pExposureInfo.
                                                        ///  This value is input to the algorithm.
    UINT32                  exposureInfoOutputCount;    ///< Number of output exposure structures in pExposureInfo.
                                                        ///  The algorithm uses this field to indicate how many structures were
                                                        ///  written.
    UINT32                  exposureInfoOutputSize;     ///< Size of each output structure in pExposureInfo. The algorithm uses
                                                        ///  this field to indicate the memory size for each item.
} AECAlgoExposureSet;

/// @brief Sensor information used by the AEC algorithm.
typedef struct
{
    FLOAT   fNumber;                 ///< F-number of the  Sensor  module.
    FLOAT   statsWindowAspectRatio;  ///< Aspect ratio (width and height) of the configured statistics window.
    FLOAT   minimumStreamGain;       ///< Minimum total gain for Preview mode.
    FLOAT   maximumStreamGain;       ///< Maximum total gain for Preview mode.
    FLOAT   minimumStillGain;        ///< Minimum total gain for Snapshot mode.
    FLOAT   maximumStillGain;        ///< Maximum total gain for Snapshot mode.
    UINT64  minimumStreamExpTime;    ///< Minimum exposure time (in nanoseconds) for Preview mode.
    UINT64  maximumStreamExpTime;    ///< Maximum exposure time (in nanoseconds) for Preview mode.
    UINT64  minimumStillExpTime;     ///< Minimum exposure time (in nanoseconds) for Snapshot mode.
    UINT64  maximumStillExpTime;     ///< Maximum exposure time (in nanoseconds) for Snapshot mode.
    UINT32  sensorResWidth;          ///< Resolution width of the sensor.
    UINT32  sensorResHeight;         ///< Resolution height of the sensor.
    UINT64  rollingShutterSkew;      ///< Rolling shutter skew in nanoseconds.
    UINT64  flashDelay;              ///< Flash delay in nanoseconds.
    FLOAT   focalLength;             ///< Focal length of the sensor.
    UINT32  hBin;                    ///< Horizontal binning factor.
    UINT32  vBin;                    ///< Vertical binning factor.
} AECAlgoSensorInfo;

/// @brief Diagnostic configuration parameters used by the AEC algorithm.
typedef struct
{
    BOOL    enable;                                  ///< Indicates whether the flag to conduct diagnostics is enabled.
                                                     ///
                                                     ///  @valuesbul
                                                     ///  - 0 -- FALSE
                                                     ///  - 1 -- TRUE @tablebulletend

    BOOL    testCaseEnable[AECAlgoTestCaseCount];    ///< Indicates whether the test case is enabled.
                                                     ///
                                                     ///  @valuesbul
                                                     ///  - 0 -- FALSE
                                                     ///  - 1 -- TRUE @tablebulletend
} AECAlgoDiagConfig;

/// @brief Aperture exposure values for providing basic parameters in logarithmic form.
typedef struct
{
    FLOAT   brightnessValue;    ///< Indicates the darkness or brightness of a scene.
    FLOAT   apertureValue;      ///< Aperture value that is calculated from the aperture or f-number.
    FLOAT   speedValue;         ///< Sensitivity value in ISO units.
    FLOAT   timeValue;          ///< Exposure time (in nanoseconds).
    FLOAT   exposureValue;      ///< Exposure value used when calculating speedValue and timeValue.
} AECAlgoAPEXData;

/// @brief Configuration parameters for flash measurement.
typedef struct
{
    INT32   measurementsCount;      ///< Number of required measurements.
    INT32   allowedReTriesCount;    ///< Number of additional tries.
    INT32   flashOnFrameCount;      ///< Number of good frames required for measurement.
} AECAlgoFlashMeasurementConfig;

/// @brief Information about flash calibration.
typedef struct
{
    UINT32 count;       ///< Number of calibration data points.
    FLOAT* pRGRatios;   ///< Pointer to the RG ratios.
    FLOAT* pBGRatios;   ///< Pointer to the Bayer grid ratios.
} AECAlgoFlashCalibrationData;

/// @brief Output values from flash measurement during a flash calibration sequence.
typedef struct
{
    FLOAT                       RGRatio;            ///< Red-over-green channel ratio.
    FLOAT                       BGRatio;            ///< Blue-over-green channel ratio.
    FLOAT                       flux;               ///< Light intensity.

    AECAlgoFlashMeasStatusType  status;             ///< Status of this particular point.
                                                    ///
                                                    ///  @valuesbul
                                                    ///  - #AECAlgoFlashMeasStatusOngoing
                                                    ///  - #AECAlgoFlashMeasStatusPass
                                                    ///  - #AECAlgoFlashMeasStatusFail @tablebulletend
} FlashMeasurement;

/// @brief Flash measurement status.
typedef struct
{
    AECAlgoFlashMeasStatusType  status;             ///< Status of the flash measurement.
                                                    ///
                                                    /// @valuesbul
                                                    ///  - #AECAlgoFlashMeasStatusOngoing
                                                    ///  - #AECAlgoFlashMeasStatusPass
                                                    ///  - #AECAlgoFlashMeasStatusFail @tablebulletend

    INT32                       measurementCount;   ///< Number of measurements that were successfully performed.
    FlashMeasurement*           pFlashPoints;       ///< Pointer to the measurements: R/G and B/G ratios as well as flux.
} AECAlgoFlashMeasurementResult;


/// @brief Frame control information after processing flash statistics.
typedef struct
{
    AECAlgoFlashStateType       flashState;                     ///< Type of flash state.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - #AECAlgoFlashStateOff
                                                                ///  - #AECAlgoFlashStatePre
                                                                ///  - #AECAlgoFlashStateMain
                                                                ///  - #AECAlgoFlashStateCalibaration @tablebulletend

    FLOAT                       LEDInfluenceRatio;              ///< Sensitivity ratio that is calculated as sensitivity with
                                                                ///  no flash or as sensitivity with preflash.
    FLOAT                       LEDRGRatio;                     ///< RG ratio when flash is ON.
    FLOAT                       LEDBGRatio;                     ///< Bayer grid ratio when flash is ON.
    FLOAT                       luxIndex;                       ///< Indicates the scene brightness.
    UINT32                      ISOValue;                       ///< Exposure time in ISO standard format.
    AECYHistStretchData         stretchControl;                 ///< Stretch factor and offset for an IHistogram.
    FLOAT                       LEDFirstEntryRatio;             ///< Ratio of the current LED setting vs. the first color mix
                                                                ///  ratio in the LED table.
    FLOAT                       LEDLastEntryRatio;              ///< Ratio of the current LED setting vs. the last color mix
                                                                ///  ratio in the LED table.
    FLOAT                       predictiveGain;                 ///< Amount of digital gain from the predictive convergence
                                                                ///  algorithm. This value is to be applied to the ISP
                                                                ///  module (AWB).
    FLOAT                       digitalGainForSimulation;       ///< Digital gain for an AEC simulation.
    FLOAT                       compenADRCGain;                 ///< Gain that must be applied in the white balance module
                                                                ///  when the ADRC is enabled.

    BOOL                        isInSensorHDR3ExpSnapshot;      ///< Indicates the sensor mode for the CFA sensor.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - 0 -- FALSE
                                                                ///  - 1 -- TRUE @tablebulletend

    AECAlgoApertureData         apertureSwitchInfo;             ///< Information about the aperture switch feature.
    InSensorHDR3ExpTriggerInfo  inSensorHDR3ExpTriggerOutput;   ///< Information about the in-sensor HDR 3 exposure
                                                                ///  trigger output.
    AECAlgoSnapshotType         snapshotIndicator;              ///< Indicate the snapshot type
    UINT64                      snapshotFlashDuration;          ///< Precision flash duration: 0 indicates the feature is OFF.
    FLOAT                       compensationDarkBoostGain;      ///< Compensation for dark boost gain.
    AECAlgoSeamlessMode         seamlessMode;                   ///< Hybrid HDR: seamless switch between binning and 3 HDR.
    FLOAT                       shortBlendRatio;                ///< Indicates whether to fully blend (1) or discard(0)
                                                                ///  short-exposure pixels.
    FLOAT                       faceLuma;                       ///< Face luma CDF for the frame.
    FLOAT                       faceLumaTarget;                 ///< Face luma target.
    FLOAT                       faceConfidence;                 ///< Face confidence for the frame.
    AECAlgoHDRExposureCount     autoHDRExposureCount;           ///< Number of exposures automatic HDR should be picking.
    FLOAT                       inSensorADRCGain;               ///< Amount of tone mapping already applied by the sensor.
    FLOAT                       qllLongUnderExposureFactor;     ///< Factor by which a long exposure is actually reduced by
                                                                ///  QLL.

    BOOL                        bIsTorchHDRRequired;            ///< Indicates whether trigger torch is required for an
                                                                ///  HDR snapshot.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - 0 -- FALSE
                                                                ///  - 1 -- TRUE @tablebulletend
    BOOL                        bNeedAdjFPS;                    ///< Flag to ask sensor node adjust FPS
    BOOL                        bIsLumaAlertEvent;              ///< Indicates whether is luma alert event triggered
                                                                ///< from Adaptive luma control feature
} AECAlgoFrameControl;

/// @brief Defines the ROI to be used by the algorithm. The coordinates are normalized in the range of [0..1].
typedef struct
{
    FLOAT   x;          ///< X coordinate of the ROI.
    FLOAT   y;          ///< Y coordinate of the ROI.
    FLOAT   dx;         ///< Width of the ROI.
    FLOAT   dy;         ///< Height of the ROI.
    FLOAT   weight;     ///< Weight of this ROI, with multiple ROIs set to the algorithm. A larger weight value has more impact
                        ///  on the metering result.
} AECAlgoROI;

/// @brief Frame information output by the AEC algorithm after processing the statistics.
typedef struct
{
    BOOL                    brightnessSettled;                  ///< Indicates whether the brightness is settled.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - 0 -- FALSE
                                                                ///  - 1 -- TRUE @tablebulletend

    BOOL                    aecSettled;                         ///< Indicates whether the AEC is settled.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - 0 -- FALSE
                                                                ///  - 1 -- TRUE @tablebulletend

    FLOAT                   asdExtremeGreenRatio;               ///< Extreme green color ratio.
    FLOAT                   asdExtremeBlueRatio;                ///< Extreme blue color ratio.

    AECAlgoSnapshotType     snapshotIndicator;                  ///< Indicates the type of snapshot.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - #AECAlgoSnapshotNormal
                                                                ///  - #AECAlgoSnapshotFlash
                                                                ///  - #AECAlgoSnapshotLLS @tablebulletend

    AECAlgoTouchEVType      touchEVIndicator;                   ///< Indicates the status of the touch exposure value.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - #AECAlgoTouchEVInactive
                                                                ///  - #AECAlgoTouchEVConverging
                                                                ///  - #AECAlgoTouchEVSettled
                                                                ///  - #AECAlgoTouchEVSceneChange @tablebulletend

    BOOL                    LEDAFRequired;                      ///< Indicates whether the LED is required to assist autofocus.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - 0 -- FALSE
                                                                ///  - 1 -- TRUE @tablebulletend

    FLOAT                   legacyYStats[StatisticsYStatsNum];  ///< Array of Y (luma) statistics of the current frame.

    BOOL                    LEDFDDelayRequired;                 ///< Indicates whether a delay is required when running
                                                                ///  face detection during preflash.
                                                                ///
                                                                ///  @valuesbul
                                                                ///  - 0 -- FALSE
                                                                ///  - 1 -- TRUE @tablebulletend

    SIZE_T                  DebugDataSizeWritten;                    ///< Number of bytes written to the debug data.
    FLOAT                   frameLuma;                               ///< Indicates the average brightness.
    AECAlgoROI              processedROI;                            ///< Normalized ROI used for the luma calculation.
    AECSAConfInfo           SAOutputConf[AECAlgoSAOutputCount];      ///< Array of scene analyzer confidence outputs.
    FLOAT                   BETemplateMatrix[BETemplateMatrixSize];  ///< BE template matching matrix
} AECAlgoFrameInfo;

/// @brief Defines the input array of ROIs used by the algorithm, including touch and face ROIs.
typedef struct
{
    AECAlgoROI* ROIs;       ///< Pointer to the array of ROIs.
    UINT32      ROICount;   ///< Number of ROIs in the array.
} AECAlgoROIList;

/// @brief Contains saliency data used by the AEC algorithm.
typedef struct
{
    UINT64              requestId;                            ///< Identifier for the processed frame request.
    UINT8               width;                                ///< Width of the map.
    UINT8               height;                               ///< Height of the map.
    UINT8               numROI;                               ///< Number of salient ROIs.
    UINT8               saliencyMap[StatsNNSaliencyOut];      ///< Array of saliency map data.
    UINT32              weightROI[StatsNNSalientROIMAX];      ///< Array of priority weights for the ROIs.
    AECAlgoROI          saliencyROI[StatsNNSalientROIMAX];    ///< Array of saliency ROIs.
} AECAlgoSaliencyInfo;

/// @brief Information associated with the statistics sent to the AEC algorithm for processing.
typedef struct
{
    UINT64          requestId;              ///< Identifier for the processed frame request.

    BOOL            prepareBeforePreflash;  ///< Indicates whether preflash is prepared.
                                            ///
                                            ///  @valuesbul
                                            ///  - 0 -- FALSE
                                            ///  - 1 -- TRUE @tablebulletend

    StatsDimension  statsWindowsSize;       ///< Size (width and height) of the statistics windows.

    BOOL            bIsTorchAEC;            ///< Indicates whether torch + capture is enabled.
                                            ///
                                            ///  @valuesbul
                                            ///  - 0 -- FALSE
                                            ///  - 1 -- TRUE @tablebulletend
} AECAlgoInputStatsInfo;

/// @brief Types of Process output parameters for the AEC algorithm.
typedef enum
{
    AECAlgoOutputInvalid       = -1,         ///< Type is unknown or invalid.
    AECAlgoOutputFrameInfo     = 0,          ///< Payload: #AECAlgoFrameInfo
    AECAlgoOutputFrameControl,               ///< Payload: #AECAlgoFrameControl
    AECAlgoOutputEXIFApex,                   ///< APEX information for the current frame. \n
                                             ///  Payload: #AECAlgoAPEXData
    AECAlgoOutputLEDCurrents,                ///< LED current setting for preflash. \n
                                             ///  Payload: Array of #StatisticsMaxNumOfLED
    AECAlgoOutputExposureSets,               ///< Exposure setting to the sensor and ISP. \n
                                             ///  Payload: #AECAlgoExposureSet
    AECAlgoOutputBGConfig,                   ///< Payload: #StatsBayerGridBayerExposureConfig
    AECAlgoOutputAdditionalInfo,             ///< Additional output information from the algorithm. \n
                                             ///  Payload: #AECAlgoAdditionalInfo
    AECAlgoOutputVendorTag,                  ///< Vendor tags the algorithm is to publish. \n
                                             ///  Payload: #StatsVendorTagList
    AECAlgoOutputStretchControl,             ///< Payload: #AECYHistStretchData
    AECAlgoOutputBHistConfig,                ///< Payload: #StatsBayerHistogramConfig
    AECAlgoOutputSkipStatsParse,             ///< Flag for skipping statistics parsing. \n
                                             ///  Payload: #AECSkipStatsParser
    AECAlgoOutputSFEBHistConfig,             ///< Payload: StatsBayerHistogramConfig
    AECAlgoOutputSFEBEStatsConfig,           ///< Payload: StatsBayerGridBayerExposureConfig
    AECAlgoOutputBFWConfig,                  ///< Payload: StatsBayerFloatingWindowConfig
    AECAlgoOutputGTMBHistConfig,             ///< Payload: #StatsBayerHistogramConfig
    AECAlgoOutputCount,                      ///< Maximum number of algorithm outputs.
    AECAlgoOutputMax           = 0x7FFFFFFF  ///< Indicates the last item in the definition.
} AECAlgoOutputType;

/// @brief Control parameter for the sensor register.
typedef struct
{
    INT32    registerControl[MaxSensorRegisterControlSize];   ///< Array of registers to control.
} SensorRegisterControl;

/// @brief Additional control information that is output from the algorithm.
typedef struct
{
    SensorRegisterControl    sensorControl;       ///< Control information for the sensor register.
} AECAlgoAdditionalInfo;

/// @brief Base structure of a Process output parameter for an AEC algorithm instance. This structure is used with
///        #AECAlgoOutputList.
typedef struct
{
    VOID*               pAECOutput;               ///< Pointer to the payload that is the result of the query. The type of
                                                  ///  data depends on the value of outputType.
                                                  ///  The algorithm implementer must do a deep copy to the given memory.
    UINT32              sizeOfAECOutput;          ///< Size of the payload data (in bytes).
    UINT32              sizeOfWrittenAECOutput;   ///< Size of the payload (in bytes) that is written back.
                                                  ///  If there is no output, set this parameter to 0. The algorithm fills
                                                  ///  this value when filling the value to pAECOutput.
    AECAlgoOutputType   outputType;               ///< Type of output payload.
} AECAlgoOutput;

/// @brief List of Process output parameters that are passed to AECProcess().
typedef struct
{
    AECAlgoOutput*  pAECOutputList;      ///< Pointer to the array of parameters.
    UINT32          numberOfAECOutputs;  ///< Number of elements in the array.
} AECAlgoOutputList;


/// @brief Types of Process input parameters for the AEC algorithm.
typedef enum
{
    AECAlgoInputInvalid        = -1,            ///< Type is unknown or invalid.
    AECAlgoInputStatisticInfo  = 0,             ///< Payload: #AECAlgoInputStatsInfo
    AECAlgoInputBayerGrid,                      ///< Payload: #StatsBayerGrid
    AECAlgoInputBayerHist,                      ///< Payload: #StatsBayerHist
    AECAlgoInputIHist,                          ///< Payload: #StatsIHist
    AECAlgoInputVendorTag,                      ///< Payload: #StatsVendorTagList
    AECAlgoInputDebugData,                      ///< Debug data information. This value is optional and can be NULL. \n
                                                ///  Payload: #StatsDataPointer.
    AECAlgoInputStatsChiHandle,                 ///< Algorithm must use this handle when querying vendor tags. \n
                                                ///  See #CHISTATSHANDLE.
    AECAlgoInputHDRBHist,                       ///< Payload: #StatsBayerHist
    AECAlgoInputCameraInfo,                     ///< Set camera information regarding the algorithm role (master or slave) and
                                                ///  camera ID. \n
                                                ///  Payload: #StatsCameraInfo
    AECAlgoInputBayerGridROI,                   ///< Payload: #StatsRectangle.
    AECAlgoInputRDIStats,                       ///< Raw Dump Interface statistics for the sensor. \n
                                                ///  Payload: #HDR3ExposureStats
    AECAlgoInputZoomState,                      ///< Payload: #InSensorZoomState
    AECAlgoInputSensorModeSwitched,             ///< Indicates whether the sensor mode is Switched.
    AECAlgoInputTintlessBGStats,                ///< Payload: #StatsBayerGrid.
    AECAlgoInputLensShadingInfo,                ///< Payload: #StatsLensShadingInfo.
    AECAlgoInputBFWStats,                       ///< Bayer floating window statistics. \n
                                                ///  Payload: #StatsBayerFloatingWindow
    AECAlgoInputBayerExposure,                  ///< Payload: #StatsBayerGrid
    AECAlgoInputAECBayerHist,                   ///< Bayer histogram statistics from the AEC Bayer Histogram module in the
                                                ///  ISP. \n
                                                ///  Payload: #StatsBayerHist
    AECAlgoInputMotionInfo,                     ///< Motion detection results.
    AECAlgoInput4ChannelBayerHist,              ///< Bayer histogram statistics for four channels from the AEC+GTM Bayer
                                                ///  Histogram module. \n
                                                ///  Payload: #StatsBayerHist
    AECAlgoInputAFLumaAlert,                    ///< Payload type: #AFLumaAlert
    AECAlgoInputCount,                          ///< Maximum number of algorithm inputs.
    AECAlgoInputMax            = 0x7FFFFFFF     ///< Indicates the last item in the definition.
} AECAlgoInputType;

/// @brief Base structure of a Process input parameter for an AEC algorithm instance. This structure is used with
///        #AECAlgoInputList.
typedef struct
{
    VOID*               pAECInput;       ///< Pointer to the parameter payload.
    UINT32              sizeOfAECInput;  ///< Size of the payload data (in bytes).
    AECAlgoInputType    inputType;       ///< Type of input payload.
} AECAlgoInput;

/// @brief List of Process input parameters that are passed to AECProcess().
typedef struct
{
    AECAlgoInput*   pAECInputList;      ///< Pointer to the array of parameters.
    UINT32          numberOfAECInputs;  ///< Number of elements in in the array.
} AECAlgoInputList;

#ifndef DOXYGEN_SHOULD_SKIP_THIS
/*
/// @brief Identifies the type of configuration to AEC algorithm
    AECAlgoSetParamInvalid,                             ///< Invalid type
    AECAlgoSetParamOperationMode,                       ///< The AEC algorithm operation mode
                                                        ///  Payload type: AECAlgoOperationModeType
    AECAlgoSetParamChromatixData,                       ///< The chromatix tuning header for AEC
                                                        ///  Payload type: StatsTuningData
    AECAlgoSetParamMeteringMode,                        ///< The metering mode
                                                        ///  Payload type: AECAlgoMeteringModeType
    AECAlgoSetParamExposureCompensation,                ///< Exposure compensation value
                                                        ///  Payload type: INT32
    AECAlgoSetParamFlickerCompensation,                 ///< The flicker compensation value
                                                        ///  Payload type: StatisticsAntibanding
    AECAlgoSetParamManualSetting,                       ///< The manual AEC setting
                                                        ///  Payload type: AECAlgoManualSetting
    AECAlgoSetParamAECLock,                             ///< The Exposure control lock setting
                                                        ///  Payload type: AECAlgoLockType
    AECAlgoSetParamFPSRange,                            ///< The FPS range
                                                        ///  Payload type: AECAlgoFPSRange
    AECAlgoSetParamLEDMode,                             ///< AEC LED mode
                                                        ///  Payload type: AECAlgoLEDModeType
    AECAlgoSetParamTouchROI,                            ///< The touch ROI set from hal/app
                                                        ///  Payload type: AECAlgoROIList
    AECAlgoSetParamFaceROI,                             ///< The face ROI from face detect module
                                                        ///  Payload type: AECAlgoROIList (deprecated)
    AECAlgoSetParamAWBState,                            ///< Current AWB state
                                                        ///  Payload type: AECAlgoWhiteBalanceState
    AECAlgoSetParamGyroInfo,                            ///< Current gyro information
                                                        ///  Payload type: StatsGyroInfo
    AECAlgoSetParamOverrideSetting,                     ///< Override Settings
                                                        ///  Payload type: AECAlgoOverrideSettingParam
    AECAlgoSetParamFlashMeasurement,                    ///< To Enable LED tuning or calibration mode
                                                        ///  Payload type: AECAlgoFlashMeasKindType
    AECAlgoSetParamFlashCalibrationData,                ///< Pass AEC Flash calibration data to AEC core
                                                        ///  Payload type: AECAlgoFlashCalibrationData
    AECAlgoSetParamDebugDataEnable,                     ///< To Enable the debug data
                                                        ///  Payload type: BOOL
    AECAlgoSetParamConciseDebugDataEnable,              ///< To Enable the Concise debug data
                                                        ///  Payload type: BOOL
    AECAlgoSetParamDebugDataDumpEnable,                 ///< To Enable the Debug data dump
                                                        ///  Payload type: BOOL
    AECAlgoSetParamSensorInfo,                          ///< The sensor information
                                                        ///  Payload type: StatsSensorInfo
    AECAlgoSetParamCameraInfo,                          ///< Camera id, role and type Infomation
                                                        ///  Payload Type: StatsCameraInfo
    AECAlgoSetParamFlashMaximumCurrent,                 ///< The maximum available current could be used for flash shot
                                                        ///  Payload type: INT32
    AECAlgoSetParamSetDiagTestConfig,                   ///< The Diagnostic Configuration
                                                        ///  Payload type: AECAlgoDiagConfig
    AECAlgoSetParamStartUpExpSensitivity,               ///< The Sensitivity info for start up exposure override
                                                        ///  Payload Type : FLOAT[3]
    AECAlgoSetParamStatsCapability,                     ///< Sets the stats capabilities at initialization time
                                                        ///  Payload Type: StatsCapability
    AECAlgoSetParamCropWindow,                          ///< Sets the stats Crop window
                                                        ///  Payload Type: StatsRectangle
    AECAlgoSetParamPipelineDelay,                       ///< Set the pipeline delay
                                                        ///  Payload Type: UINT8
    AECAlgoSetParamPeerInfo,                            ///< Multi Camera Peer Information
                                                        ///  Payload Type: VOID Pointer
    AECAlgoSetParamDualcamCalibrationInfo,              ///< Dualcam calibration info
                                                        ///  Payload Type: AECAlgoDCCalibrationInfo
    AECAlgoSetParamMultiExpSensorMode,                  ///< AEC algorithm multi exposure sensor mode
                                                        ///  Payload Type: SensorHDRConfig
    AECAlgoSetParamIsDualCamera,                        ///< Is dual camera or single
                                                        ///  Payload type: BOOL
    AECAlgoSetParamUnstabilizedFaceROI,                 ///< The unstabilized face ROI from face detect module
                                                        ///  Payload type: StatsROIInformation
    AECAlgoSetParamControlPostRawSensitivityBoost,      ///< Control Post  RawSensitivity Boost value
                                                        ///  Payload type: INT32
    AECAlgoSetParamCustomExposureTable,                 ///< Custom exposure table read from vendor tag
                                                        ///  Payload type: AECCustomExposureTable
    AECAlgoSetParamCustomMeteringTable,                 ///< Custom metering table read from vendor tag
                                                        ///  Payload type: AECCustomMeteringTable
    AECAlgoSetParamDisableADRC,                          ///< Flag to enable ADRC
                                                        ///  Payload type: BOOL
    AECAlgoSetParamFlashInlineCalibrationData           ///< Dynamic Inline Calibration Data
                                                        ///  Payload type: VOID *
    AECAlgoSetParamIsFlashInfluencedStats               ///< Flash info flag for the stats of capture frame influenced by main flash
    AECAlgoSetParamSaliencyMapData                      ///< Saliency Map data
                                                        ///  Payload type: saliencyMapData
                                                        ///  Payload type: BOOL
    AECAlgoSetParamQLLData                              ///< QLL Data
                                                        ///  Payload type: QLLData
    AECAlgoSetParamMagnetometerInfo,                    ///< Current Magnetometer information
                                                        ///  Payload type: StatsMagnetometerInfo
    AECAlgoSetParamLightInfo,                           ///< Current light information
                                                        ///  Payload type: StatsLightInfo
    AECAlgoSetParamAFDFrameInfo,                        ///< Complete AFD frame info
                                                        ///  Payload type: AFDFrameInfo
    AECAlgoSetParamSATData,                             ///< SAT Matrix used for camera transformations
                                                        ///  Payload type: SATData
    AECAlgoSetParamTrackerROI,                          ///< The track ROI from touch to track module
                                                        ///  Payload type: AECAlgoROIList
    AECAlgoSetParamVendorTagInputList,                  ///< VendorTag Input List to algorithm
                                                        ///  Payload type: StatsVendorTagList
    AECAlgoSetParamDebugDataPointer,                    ///< DebugData Pointer to algorithm
                                                        ///  Payload type: StatsDataPointer
    AECAlgoSetParamIsSnapshotExposureQueryFrame,        ///< Snapshot Exposure Query on the given frame
    AECAlgoSetParamStabilizedFaceROI,                   ///< The stabilized face ROI from face detect module
                                                        ///  Payload type: StatsROIInformation
    AECAlgoSetParamALSLightInfo,                        ///< Current light information from ALS sensor
                                                        ///  Payload type: StatsALSLightInfo
    AECAlgoSetParamAONInfoData                          ///< AON info data
                                                        ///  Payload type: AONInfo
    AECAlgoSetParamCustomizedTagListEnable              ///< To Enable the custom debug data
                                                        ///  Payload type: BOOL
    AECAlgoSetParamCount,                               ///< Indicate the total number of set param to algorithm
    AECAlgoSetParamCATMapData,                          ///< Current catMap information
                                                        ///  Payload type: CHIIMAGELIST
    AECAlgoSetParamMax                                  ///< Anchor to indicate the last item in the defines
*/

// To generate enum from macros
#define AEC_GENERATE_ENUM(ENUM) ENUM,

// To generate string for enum from macros
#define AEC_GENERATE_STRING(STRING) #STRING,

// Defines the Set parameters for the AEC algorithm.
#define AEC_SET_ENUM_LIST(ADD_ENTRY)                            \
    ADD_ENTRY(AECAlgoSetParamExpTableRange)                     \
    ADD_ENTRY(AECAlgoSetParamOperationMode)                     \
    ADD_ENTRY(AECAlgoSetParamChromatixData)                     \
    ADD_ENTRY(AECAlgoSetParamMeteringMode)                      \
    ADD_ENTRY(AECAlgoSetParamExposureCompensation)              \
    ADD_ENTRY(AECAlgoSetParamFlickerCompensation)               \
    ADD_ENTRY(AECAlgoSetParamManualSetting)                     \
    ADD_ENTRY(AECAlgoSetParamAECLock)                           \
    ADD_ENTRY(AECAlgoSetParamFPSRange)                          \
    ADD_ENTRY(AECAlgoSetParamLEDMode)                           \
    ADD_ENTRY(AECAlgoSetParamTouchROI)                          \
    ADD_ENTRY(AECAlgoSetParamFaceROI)                           \
    ADD_ENTRY(AECAlgoSetParamStabilizedFaceROI)                 \
    ADD_ENTRY(AECAlgoSetParamAWBState)                          \
    ADD_ENTRY(AECAlgoSetParamGyroInfo)                          \
    ADD_ENTRY(AECAlgoSetParamOverrideSetting)                   \
    ADD_ENTRY(AECAlgoSetParamFlashMeasurement)                  \
    ADD_ENTRY(AECAlgoSetParamFlashCalibrationData)              \
    ADD_ENTRY(AECAlgoSetParamDebugDataEnable)                   \
    ADD_ENTRY(AECAlgoSetParamSensorInfo)                        \
    ADD_ENTRY(AECAlgoSetParamCameraInfo)                        \
    ADD_ENTRY(AECAlgoSetParamFlashMaximumCurrent)               \
    ADD_ENTRY(AECAlgoSetParamSetDiagTestConfig)                 \
    ADD_ENTRY(AECAlgoSetParamStartUpExpSensitivity)             \
    ADD_ENTRY(AECAlgoSetParamStatsCapability)                   \
    ADD_ENTRY(AECAlgoSetParamCropWindow)                        \
    ADD_ENTRY(AECAlgoSetParamPipelineDelay)                     \
    ADD_ENTRY(AECAlgoSetParamPeerInfo)                          \
    ADD_ENTRY(AECAlgoSetParamDualcamCalibrationInfo)            \
    ADD_ENTRY(AECAlgoSetParamMultiExpSensorMode)                \
    ADD_ENTRY(AECAlgoSetParamIsDualCamera)                      \
    ADD_ENTRY(AECAlgoSetParamUnstabilizedFaceROI)               \
    ADD_ENTRY(AECAlgoSetParamControlPostRawSensitivityBoost)    \
    ADD_ENTRY(AECAlgoSetParamCustomExposureTable)               \
    ADD_ENTRY(AECAlgoSetParamCustomMeteringTable)               \
    ADD_ENTRY(AECAlgoSetParamDisableADRC)                       \
    ADD_ENTRY(AECAlgoSetParamConvergenceSpeed)                  \
    ADD_ENTRY(AECAlgoSetParamFlashInlineCalibrationData)        \
    ADD_ENTRY(AECAlgoSetParamIsFlashInfluencedStats)            \
    ADD_ENTRY(AECAlgoSetParamFlashInlineCalibrationMode)        \
    ADD_ENTRY(AECAlgoSetParamTrackerROI)                        \
    ADD_ENTRY(AECAlgoSetParamframeID)                           \
    ADD_ENTRY(AECAlgoSetParamApertureCalibrationInfo)           \
    ADD_ENTRY(AECAlgoSetParamAmbientRaw)                        \
    ADD_ENTRY(AECAlgoSetParamSaliencyMapData)                   \
    ADD_ENTRY(AECAlgoSetParamQLLData)                           \
    ADD_ENTRY(AECAlgoSetParamMagnetometerInfo)                  \
    ADD_ENTRY(AECAlgoSetParamLightInfo)                         \
    ADD_ENTRY(AECAlgoSetParamAFDFrameInfo)                      \
    ADD_ENTRY(AECAlgoSetParamAFState)                           \
    ADD_ENTRY(AECAlgoSetParamSATData)                           \
    ADD_ENTRY(AECAlgoSetParamIlluminanceValue)                  \
    ADD_ENTRY(AECAlgoSetParamConciseDebugDataEnable)            \
    ADD_ENTRY(AECAlgoSetParamDebugDataDumpEnable)               \
    ADD_ENTRY(AECAlgoSetParamVendorTagInputList)                \
    ADD_ENTRY(AECAlgoSetParamDebugDataPointer)                  \
    ADD_ENTRY(AECAlgoSetParamIsSnapshotExposureQueryFrame)      \
    ADD_ENTRY(AECAlgoSetParamSinglePointTOFData)                \
    ADD_ENTRY(AECAlgoSetParamDepth16Data)                       \
    ADD_ENTRY(AECAlgoSetParamALSLightInfo)                      \
    ADD_ENTRY(AECAlgoSetParamAONInfoData)                       \
    ADD_ENTRY(AECAlgoSetParamCustomizedTagListEnable)           \
    ADD_ENTRY(AECAlgoSetParamCount)                             \
    ADD_ENTRY(AECAlgoSetParamCATMapData)                        \
    ADD_ENTRY(AECAlgoSetParamMax)                               \

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

/// @brief Types of Set parameters used to configure the AEC algorithm.
typedef enum
{
    AEC_SET_ENUM_LIST(AEC_GENERATE_ENUM)  ///< List of configuration parameters. \n
                                          ///  AECAlgoSetParamInvalid \n
                                          ///  AECAlgoSetParamExpTableRange \n
                                          ///  AECAlgoSetParamOperationMode          (Payload: #AECAlgoOperationModeType) \n
                                          ///  AECAlgoSetParamChromatixData          (Payload: #StatsTuningData) \n
                                          ///  AECAlgoSetParamMeteringMode           (Payload: #AECAlgoMeteringModeType) \n
                                          ///  AECAlgoSetParamExposureCompensation \n
                                          ///  AECAlgoSetParamFlickerCompensation    (Payload: #StatisticsAntibanding) \n
                                          ///  AECAlgoSetParamManualSetting          (Payload: #AECAlgoManualSetting) \n
                                          ///  AECAlgoSetParamAECLock                (Payload: #AECAlgoLockType) \n
                                          ///  AECAlgoSetParamFPSRange               (Payload: #AECAlgoFPSRange) \n
                                          ///  AECAlgoSetParamLEDMode                (Payload: #AECAlgoLEDModeType) \n
                                          ///  AECAlgoSetParamTouchROI               (Payload: #AECAlgoROIList) \n
                                          ///  AECAlgoSetParamFaceROI                (Payload: #AECAlgoROIList) \n
                                          ///  AECAlgoSetParamStabilizedFaceROI      (Payload: #StatsROIInformation) \n
                                          ///  AECAlgoSetParamAWBState               (Payload: #AECAlgoWhiteBalanceState) \n
                                          ///  AECAlgoSetParamGyroInfo               (Payload: #StatsGyroInfo) \n
                                          ///  AECAlgoSetParamOverrideSetting        (Payload: #AECAlgoOverrideSettingParam) \n
                                          ///  AECAlgoSetParamFlashMeasurement       (Payload: #AECAlgoFlashMeasKindType) \n
                                          ///  AECAlgoSetParamFlashCalibrationData   (Payload: #AECAlgoFlashCalibrationData) \n
                                          ///  AECAlgoSetParamDebugDataEnable \n
                                          ///  AECAlgoSetParamSensorInfo             (Payload: #StatsSensorInfo) \n
                                          ///  AECAlgoSetParamCameraInfo             (Payload: #StatsCameraInfo) \n
                                          ///  AECAlgoSetParamFlashMaximumCurrent \n
                                          ///  AECAlgoSetParamSetDiagTestConfig      (Payload: #AECAlgoDiagConfig) \n
                                          ///  AECAlgoSetParamStartUpExpSensitivity \n
                                          ///  AECAlgoSetParamStatsCapability        (Payload: #StatsCapability) \n
                                          ///  AECAlgoSetParamCropWindow             (Payload: #StatsRectangle) \n
                                          ///  AECAlgoSetParamPipelineDelay \n
                                          ///  AECAlgoSetParamPeerInfo \n
                                          ///  AECAlgoSetParamDualcamCalibrationInfo (Payload: #AECAlgoDCCalibrationInfo) \n
                                          ///  AECAlgoSetParamMultiExpSensorMode     (Payload: #SensorHDRConfig) \n
                                          ///  AECAlgoSetParamIsDualCamera \n
                                          ///  AECAlgoSetParamUnstabilizedFaceROI    (Payload: #StatsROIInformation) \n
                                          ///  AECAlgoSetParamControlPostRawSensitivityBoost \n
                                          ///  AECAlgoSetParamCustomExposureTable    (Payload: #AECCustomExposureTable) \n
                                          ///  AECAlgoSetParamCustomMeteringTable    (Payload: #AECCustomMeteringTable) \n
                                          ///  AECAlgoSetParamDisableADRC \n
                                          ///  AECAlgoSetParamConvergenceSpeed \n
                                          ///  AECAlgoSetParamFlashInlineCalibrationData \n
                                          ///  AECAlgoSetParamIsFlashInfluencedStats \n
                                          ///  AECAlgoSetParamFlashInlineCalibrationMode \n
                                          ///  AECAlgoSetParamTrackerROI              (Payload: #AECAlgoROIList) \n
                                          ///  AECAlgoSetParamframeID \n
                                          ///  AECAlgoSetParamApertureCalibrationInfo \n
                                          ///  AECAlgoSetParamAmbientRaw \n
                                          ///  AECAlgoSetParamSaliencyMapData         (Payload: #SaliencyMapData) \n
                                          ///  AECAlgoSetParamQLLData                 (Payload: #QLLData) \n
                                          ///  AECAlgoSetParamMagnetometerInfo        (Payload: #StatsMagnetometerInfo) \n
                                          ///  AECAlgoSetParamLightInfo               (Payload: #StatsLightInfo) \n
                                          ///  AECAlgoSetParamAFDFrameInfo            (Payload: #AFDFrameInfo) \n
                                          ///  AECAlgoSetParamAFState                 (Payload: #AFLumaAlert) \n
                                          ///  AECAlgoSetParamSATData,                (Payload: #SATData) \n
                                          ///  AECAlgoSetParamIlluminanceValue \n
                                          ///  AECAlgoSetParamConciseDebugDataEnable \n
                                          ///  AECAlgoSetParamDebugDataDumpEnable \n
                                          ///  AECAlgoSetParamVendorTagInputList      (Payload: #VendorTagInputList) \n
                                          ///  AECAlgoSetParamDebugDataPointer        (Payload: #DebugData) \n
                                          ///  AECAlgoSetParamIsSnapshotExposureQueryFrame (Payload: BOOL) \n
                                          ///  AECAlgoSetParamSinglePointTOFData      (Payload: #SinglePointTOFData) \n
                                          ///  AECAlgoSetParamDepth16Data             (Payload: #StatsDepth16Data) \n
                                          ///  AECAlgoSetParamALSLightInfo            (Payload: #StatsALSLightInfo) \n
                                          ///  AECAlgoSetParamAONInfoData             (Payload: #AONInfo) \n
                                          ///  AECAlgoSetParamCount \n
                                          ///  AECAlgoSetParamCATMapData             (Payload: #CHIIMAGELIST) \n
                                          ///  AECAlgoSetParamMax
} AECAlgoSetParamType;

/// @brief Base structure of a Set parameter for an AEC algorithm instance. This structure is used with #AECAlgoSetParamList.
typedef struct
{
    VOID*                   pAECSetParam;       ///< Pointer to the parameter payload.
    UINT32                  sizeOfAECSetParam;  ///< Size of the payload data (in bytes).
    AECAlgoSetParamType     setParamType;       ///< Type of parameter that is passed to the algorithm.
} AECAlgoSetParam;

/// @brief List of Set parameters that are passed to AECSetParam().
typedef struct
{
    AECAlgoSetParam*    pAECSetParamList;       ///< Pointer to the array of parameters.
    UINT32              numberOfAECSetParams;   ///< Number of elements in the array.
} AECAlgoSetParamList;

#ifndef DOXYGEN_SHOULD_SKIP_THIS
/*
/// @brief Identifies the type of query to AEC algorithm
    AECAlgoGetParamInvalid             ,             ///< The invalid type
    AECAlgoGetParamStartExposure,                   ///< The exposure parameter on starting streaming
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputFrameControl,
                                                    ///    AECAlgoGetParamOutputExposureSet,
                                                    ///    AECAlgoGetParamOutputLEDCurrents,
                                                    ///    AECAlgoGetParamOutputEXIFApex
    AECAlgoGetParamSnapshotExposure,                ///< The exposure parameter for snapshot
                                                    ///  Input payload:  AECAlgoSnapshotConfig
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputFrameControl,
                                                    ///    AECAlgoGetParamOutputExposureSet,
                                                    ///    AECAlgoGetParamOutputLEDCurrents,
                                                    ///    AECAlgoGetParamOutputEXIFApex
    AECAlgoGetParamGainFromISOPreview,              ///< Calculate AEC gain from a given ISO for PREVIEW.
                                                    ///  Input payload: UINT32 ISOValue
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputGain
    AECAlgoGetParamGainFromISOSnapshot,             ///< Calculate AEC gain from a given ISO for SNAPSHOT.
                                                    ///  Input payload: UINT32 ISOValue
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputGain
    AECAlgoGetParamEVCapabilities,                  ///< Query EV capabilities from algorithm
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoEVCapabilities
    AECAlgoGetParamDebugData,                       ///< Queries the AEC debug data.
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputDebugData
    AECAlgoGetParamSWVersion,                       ///< Queries the SW version
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputSWVersion
    AECAlgoGetParamFlashMeasurementConfig,          ///< Queries flash measurement configuration for either tuning or calib
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputFlashMeasurementConfig
    AECAlgoGetParamFlashMeasurementResult,          ///< Queries flash measurement results for either tuning or calib
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputFlashMeasurementResult
    AECAlgoGetParamPublishingVendorTagsInfo,        ///< The vendor tags published by the algorithm
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputVendorTagInfoList
    AECAlgoGetParamDependentVendorTags,             ///< The vendor tags the algorithm depends on
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///    AECAlgoGetParamOutputVendorTagInfoList
    AECAlgoGetParamBGStatsConfig,                   ///< Bayer Grid statistics configuration
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///     AECAlgoGetParamOutputBGStatsConfig
    AECAlgoGetParamPeerInfo,                        ///< Multi Camera Peer Information
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///     AECAlgoGetParamOutputPeerInfo AECAlgoGetParamPeerInfo
    AECAlgoGetParamBHistStatsConfig,                ///< Bayer Histogram statistics configuration
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputList include following type
                                                    ///  AECAlgoGetParamOutputBHistStatsConfig
    AECAlgoGetParamDynamicCalibrationData           ///< Dynamic inline calibration data
                                                    ///  Input payload: NULL
                                                    ///  Output payload: InlineCalibrationData
    AECAlgoGetParamSFEBHistStatsConfig              ///< SFE Bhist Stats configuration
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputSFEBHistStatsConfig
    AECAlgoGetParamBFWStatsConfig                   ///< BFW Bhist Stats configuration
                                                    ///  Input payload: NULL
                                                    ///  Output payload: AECAlgoGetParamOutputBFWStatsConfig
    AECAlgoGetParamCount,                           ///< Indicate the total number of get param to algorithm
    AECAlgoGetParamMax                              ///< Anchor to indicate the last item in the defines
*/

/** AECAlgoGetParamType:
*   type of parameters that can be get for AEC.
**/

// Defines the list of Get parameters for AEC algorithm queries.
#define AEC_GET_ENUM_LIST(ADD_ENTRY)                        \
    ADD_ENTRY(AECAlgoGetParamInvalid)                       \
    ADD_ENTRY(AECAlgoGetParamStartExposure)                 \
    ADD_ENTRY(AECAlgoGetParamSnapshotExposure)              \
    ADD_ENTRY(AECAlgoGetParamGainFromISOPreview)            \
    ADD_ENTRY(AECAlgoGetParamGainFromISOSnapshot)           \
    ADD_ENTRY(AECAlgoGetParamEVCapabilities)                \
    ADD_ENTRY(AECAlgoGetParamDebugData)                     \
    ADD_ENTRY(AECAlgoGetParamSWVersion)                     \
    ADD_ENTRY(AECAlgoGetParamFlashMeasurementConfig)        \
    ADD_ENTRY(AECAlgoGetParamFlashMeasurementResult)        \
    ADD_ENTRY(AECAlgoGetParamPublishingVendorTagsInfo)      \
    ADD_ENTRY(AECAlgoGetParamDependentVendorTags)           \
    ADD_ENTRY(AECAlgoGetParamBGStatsConfig)                 \
    ADD_ENTRY(AECAlgoGetParamPeerInfo)                      \
    ADD_ENTRY(AECAlgoGetParamBHistStatsConfig)              \
    ADD_ENTRY(AECAlgoGetParamDynamicCalibrationData)        \
    ADD_ENTRY(AECAlgoGetParamSnapshotType)                  \
    ADD_ENTRY(AECAlgoGetParamSFEBHistStatsConfig)           \
    ADD_ENTRY(AECAlgoGetParamBFWStatsConfig)                \
    ADD_ENTRY(AECAlgoGetParamSFEBGConfig)                   \
    ADD_ENTRY(AECAlgoGetParamBEStatsConfig)                 \
    ADD_ENTRY(AECAlgoGetParamSFEBEStatsConfig)              \
    ADD_ENTRY(AECAlgoGetParamCount)                         \
    ADD_ENTRY(AECAlgoGetParamMax)                           \

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

/// @brief Types of Get parameters for the AEC algorithm.
typedef enum
{
    AEC_GET_ENUM_LIST(AEC_GENERATE_ENUM)
                     ///< List of query parameters.
                     ///  AECAlgoGetParamInvalid \n
                     ///  AECAlgoGetParamStartExposure    (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                   AECAlgoGetParamOutputFrameControl, AECAlgoGetParamOutputExposureSet,
                     ///                                   AECAlgoGetParamOutputLEDCurrents, AECAlgoGetParamOutputEXIFApex) \n
                     ///  AECAlgoGetParamSnapshotExposure (Input payload: #AECAlgoSnapshotConfig \n
                     ///                                   Output payload: #AECAlgoGetParamOutputList,
                     ///                                   AECAlgoGetParamOutputFrameControl, AECAlgoGetParamOutputExposureSet,
                     ///                                   AECAlgoGetParamOutputLEDCurrents, AECAlgoGetParamOutputEXIFApex) \n
                     ///  AECAlgoGetParamGainFromISOPreview       (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputGain) \n
                     ///  AECAlgoGetParamGainFromISOSnapshot      (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputGain) \n
                     ///  AECAlgoGetParamEVCapabilities,          (Payload: #AECAlgoEVCapabilities) \n
                     ///  AECAlgoGetParamDebugData,               (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputDebugData) \n
                     ///  AECAlgoGetParamSWVersion,               (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputSWVersion) \n
                     ///  AECAlgoGetParamFlashMeasurementConfig,  (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputFlashMeasurementConfig) \n
                     ///  AECAlgoGetParamFlashMeasurementResult,  (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputFlashMeasurementResult) \n
                     ///  AECAlgoGetParamPublishingVendorTagsInfo (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputVendorTagInfoList) \n
                     ///  AECAlgoGetParamDependentVendorTags,     (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputVendorTagInfoList) \n
                     ///  AECAlgoGetParamBGStatsConfig,           (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputBGStatsConfig) \n
                     ///  AECAlgoGetParamPeerInfo,                (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputPeerInfo,
                     ///                                           AECAlgoGetParamPeerInfo) \n
                     ///  AECAlgoGetParamBHistStatsConfig,        (Payload: #AECAlgoGetParamOutputList, including:
                     ///                                           AECAlgoGetParamOutputBHistStatsConfig) \n
                     ///  AECAlgoGetParamDynamicCalibrationData   (Payload: InlineCalibrationData) \n
                     ///  AECAlgoGetParamSnapshotType \n
                     ///  AECAlgoGetParamSFEBHistStatsConfig      (Payload: #AECAlgoGetParamOutputSFEBHistStatsConfig) \n
                     ///  AECAlgoGetParamBFWStatsConfig           (Payload: #AECAlgoGetParamOutputBFWStatsConfig) \n
                     ///  AECAlgoGetParamSFEBGConfig \n
                     ///  AECAlgoGetParamBEStatsConfig \n
                     ///  AECAlgoGetParamSFEBEStatsConfig \n
                     ///  AECAlgoGetParamCount \n
                     ///  AECAlgoGetParamMax
} AECAlgoGetParamType;

/// @brief Types of Get input parameters for the AEC algorithm.
typedef enum
{
    AECAlgoGetParamInputInvalid             = -1,         ///< Type is unknown or invalid.
    AECAlgoGetParamInputCameraInfo,                       ///< Camera ID, role, and type information passed to a singleton
                                                          ///  algorithm. \n
                                                          ///  Payload: #StatsCameraInfo
    AECAlgoGetParamInputSnapshotType,                     ///< Different types of snapshots.
    AECAlgoGetParamInputISOValue,                         ///< ISO value used to brighten or darken a snapshot.
    AECAlgoGetParamInputDebugDataPointer,                 ///< Pointer to the debug data.
    AECAlgoGetParamInputCount,                            ///< Maximum number of input parameters.
    AECAlgoGetParamInputIsFixedFocus,                     ///< Indicate if the focus is fixed.
    AECAlgoGetParamInputMax                 = 0x7FFFFFFF  ///< Indicates the last item in the definition.
} AECAlgoGetParamInputType;

/// @brief Types of Get output parameters for the AEC algorithm.
typedef enum
{
    AECAlgoGetParamOutputInvalid       = -1,            ///< Type is unknown or invalid.
    AECAlgoGetParamOutputFrameControl,                  ///< Payload: #AECAlgoFrameControl
    AECAlgoGetParamOutputExposureSets,                  ///< Payload: #AECAlgoExposureSet
    AECAlgoGetParamOutputLEDCurrents,                   ///< Payload: Array of #StatisticsMaxNumOfLED
    AECAlgoGetParamOutputEXIFApex,                      ///< Payload: #AECAlgoAPEXData
    AECAlgoGetParamOutputGain,                          ///< Flash calibration or tuning configuration. \n
                                                        ///  Payload: #AECAlgoFlashMeasurementConfig
    AECAlgoGetParamOutputFlashMeasurementConfig,        ///< Get flash calibration or tuning configuration
                                                        ///  Payload: #AECAlgoFlashMeasurementConfig
    AECAlgoGetParamOutputFlashMeasurementResult,        ///< Payload: #AECAlgoFlashMeasurementResult
    AECAlgoGetParamOutputDebugData,                     ///< Payload: #StatsDataPointer
    AECAlgoGetParamOutputSWVersion,                     ///< Payload: #StatsAlgorithmVersion
    AECAlgoGetParamOutputVendorTagInfoList,             ///< Payload: #StatsVendorTagInfoList
    AECAlgoGetParamOutputBGStatsConfig,                 ///< Payload: #StatsBayerGridBayerExposureConfig
    AECAlgoGetParamOutputEVCapabilities,                ///< Payload: #AECAlgoEVCapabilities
    AECGetParamOutputTypeDependentVendorTags,           ///< Vendor tags the algorithm depends on. \n
                                                        ///  Payload: #StatsVendorTagInfoList
    AECAlgoGetParamOutputPeerInfo,                      ///< Multi-camera peer information. \n
                                                        ///  Payload: Pointer to the dual camera information
    AECAlgoGetParamOutputBHistStatsConfig,              ///< Payload: #StatsBayerGridBayerExposureConfig
    AECAlgoGetParamOutputDynamicCalibrationData,        ///< Payload: Binary data buffer that contains the inline calibration
                                                        ///  data.
    AECAlgoGetParamOutputAdditionalInfo,                ///< Payload: #AECAlgoAdditionalInfo
    AECAlgoGetParamOutputSnapshotType,                  ///< Payload: #AECAlgoSnapshotType
    AECAlgoGetParamOutputSFEBHistStatsConfig,           ///< Payload: #StatsBayerGridBayerExposureConfig
    AECAlgoGetParamOutputBFWStatsConfig,                ///< Payload: #StatsBayerFloatingWindowConfig
    AECAlgoGetParamOutputSFEBEStatsConfig,              ///< Payload: #StatsBayerGridBayerExposureConfig
    AECAlgoGetParamOutputBEStatsConfig,                 ///< Payload: #StatsBayerGridBayerExposureConfig
    AECAlgoGetParamOutputGTMBHistStatsConfig,           ///< Payload: #StatsBayerGridBayerExposureConfig
    AECAlgoGetParamOutputCount,                         ///< Maximum number of output parameters.
    AECAlgoGetParamOutputMax           = 0x7FFFFFFF     ///< Indicates the last item in the definition.
} AECAlgoGetParamOutputType;

/// @brief Base structure of a Get input parameter for an AEC algorithm instance. This structure is used with
///        #AECAlgoGetParamInputList.
typedef struct
{
    AECAlgoGetParamInputType inputType;                 ///< Type of input payload, which depends on the type of query.
    VOID*                    pInputData;                ///< Pointer to the parameter payload, which contains input metadata
                                                        ///  and supporting information required for generating the output.
    UINT32                   sizeOfInputData;           ///< Size of the payload data (in bytes).
} AECAlgoGetParamInput;

/// @brief List of Get input parameters for a query from an AEC algorithm instance. This list is passed to #AECAlgoGetParam.
typedef struct
{
    AECAlgoGetParamInput*    pAECGetParamList;             ///< Pointer to the array of parameters.
    UINT32                   numberOfAECGetInputParams;    ///< Number of elements in the array.
} AECAlgoGetParamInputList;

/// @brief Base structure of a Get output parameter for an AEC algorithm instance. This structure is used with
///        #AECAlgoGetParamOutputList.
typedef struct
{
    VOID*                       pOutputData;                ///< Pointer to the payload that is the result of the query. The
                                                            ///  type of data depends on the value of outputType.
    UINT32                      sizeOfOutputData;           ///< Size of the payload data (in bytes).
    UINT32                      sizeOfWrittenOutputData;    ///< Size of the data (in bytes) that is written to the output.
                                                            ///  If there is no output, set this parameter to 0.
    AECAlgoGetParamOutputType   outputType;                 ///< Type of output payload.
} AECAlgoGetParamOutput;

/// @brief List of Get output parameters for a query from an AEC algorithm instance. This list is passed to #AECAlgoGetParam.
typedef struct
{
    AECAlgoGetParamOutput*  pAECOutputList;      ///< Pointer to the array of outputs that are returned as a result
                                                 ///  of the query.
    UINT32                  numberOfAECOutputs;  ///< Number of elements in the array.
} AECAlgoGetParamOutputList;

/// @brief List of Get parameters that are passed to AECGetParam().
typedef struct
{
    AECAlgoGetParamType        type;        ///< Type of information to get from the algorithm. This type
                                            ///  describes the metadata for the caller.
    AECAlgoGetParamInputList   inputList;   ///< Input data that is necessary to support the query.
    AECAlgoGetParamOutputList  outputList;  ///< Output metadata that is returned as a result of the query.
} AECAlgoGetParam;

/// @brief Types of Create parameters for the AEC algorithm.
typedef enum
{
    AECAlgoCreateParamsInvalid                   = -1,          ///< Type is unknown or invalid.
    AECAlgoCreateParamsLoggerFunctionPtr,                       ///< Pointer to the statistics logger function. \n
                                                                ///  Payload: Statistics logger function
    AECAlgoCreateParamTypeSessionHandle,                        ///< Handle of the create session. \n
                                                                ///  Payload: #CHISTATSHANDLE.
    AECAlgoCreateParamTypeCameraOpenIndicator,                  ///< Indicates whether the camera is open (1).
    AECAlgoCreateParamTypeCameraInfo,                           ///< Payload: #StatsCameraInfo
    AECCreateParamsTypeTuningData,                              ///< Tuning data manager.
    AECAlgoCreateParamTypeCount,                                ///< Total number of parameters.
    AECAlgoCreateParamsMax                      = 0x7FFFFFFF    ///< Indicates the last item in the definition.
} AECAlgoCreateParamsType;

/// @brief Base structure of a Create parameter for an AEC algorithm instance. This structure is used with
///        #AECAlgoCreateParamList.
typedef struct
{
    VOID*                   pCreateParam;       ///< Pointer to the parameter payload.
    UINT32                  sizeOfCreateParam;  ///< Size of the payload data (in bytes).
    AECAlgoCreateParamsType createParamType;    ///< Type of parameter that is passed to the algorithm.
} AECAlgoCreateParam;

/// @brief List of Create parameters that are passed to CREATEAEC().
typedef struct
{
    AECAlgoCreateParam* pCreateParamList;      ///< Pointer to the array of parameters.
    UINT32              numberOfCreateParams;  ///< Number of elements in the array.
} AECAlgoCreateParamList;

/// @brief Identifies the type of Destroy parameter.
typedef enum
{
    AECDestroyParamTypeInvalid = -1,             ///< Type is unknown or invalid.
    AECDestroyParamTypeCameraCloseIndicator,     ///< Indicates whether the camera is closed (1).
    AECDestroyParamTypeCameraInfo,               ///< Payload: #StatsCameraInfo
    AECDestroyParamTypeCount,                    ///< Total number of parameters.
    AECDestroyParamTypeMax     = 0x7FFFFFFF      ///< Indicates the last item in the definition.
} AECAlgoDestroyParamType;

/// @brief Base structure of a Destroy parameter for an AEC algorithm instance. This structure is used with
///        #AECAlgoDestroyParamList.
typedef struct
{
    AECAlgoDestroyParamType destroyParamType;    ///< Type of parameter that is passed to the algorithm.
    VOID*                   pParam;              ///< Pointer to the parameter payload.
    UINT32                  sizeOfParam;         ///< Size of the payload data (in bytes).
} AECAlgoDestroyParam;

/// @brief List of Destroy parameters that are passed to AECDestroy().
typedef struct
{
    AECAlgoDestroyParam* pParamList;    ///< Pointer to the array of parameters.
    UINT32               paramCount;    ///< Number of elements in the array.
} AECAlgoDestroyParamList;

/// @brief Defines the features supported by the AEC algorithm.
typedef enum
{
    AECAlgoFeatureBasic        = 1 << 0,     ///< Basic AEC features: basic functionalities, convergence, flash, manual
                                             ///  AEC, and so on.
    AECAlgoFeatureLLS          = 1 << 1,     ///< Low-light non-flash snapshot or capture.
    AECAlgoFeatureADRC         = 1 << 2,     ///< Audio Dynamic Range Compensation feature support.
    AECAlgoFeatureZZHDR        = 1 << 3,     ///< Zigzag High Dynamic Range feature support.
    AECAlgoFeatureIHDR         = 1 << 4,     ///< Interlaced High Dynamic Range feature support.
    AECAlgoFeatureStaggeredHDR = 1 << 5,     ///< Staggered high dynamic range feature support.
    AECAlgoFeatureFastAEC      = 1 << 6,     ///< Fast AEC required for initial faster AE convergence.
    AECAlgoFeatureInstantAEC   = 1 << 7,     ///< Instant capture without a preview.
    AECAlgoFeatureTouchEV      = 1 << 8,     ///< Touch EV feature.
    AECAlgoFeatureMultiCamera  = 1 << 9,     ///< Dual or multi-camera feature.
    AECAlgoFeatureMax          = 1UL << 31,  ///< Indicates the last item in the definition.
} AECAlgoFeatureType;

/// @brief Configuration parameters for a snapshot request.
typedef struct
{
    AECAlgoSnapshotType         snapshotType;               ///< Indicates the type of snapshot.
                                                            ///
                                                            ///  @valuesbul
                                                            ///  - #AECAlgoSnapshotNormal
                                                            ///  - #AECAlgoSnapshotFlash
                                                            ///  - #AECAlgoSnapshotLLS @tablebulletend

    BOOL                        bUseAEBracketing;           ///< Indicates whether AE bracketing is used.
                                                            ///
                                                            ///  @valuesbul
                                                            ///  - 0 -- FALSE
                                                            ///  - 1 -- TRUE @tablebulletend

    INT8                   EVVal[AlgoOutputExposureCount];  ///< Array of EV values (offset values) from the normal exposure
                                                            ///  determined for the snapshot.
    AlgoInputExposureType  snapshotExposureType;            ///< Current type of exposure for the snapshot frame.
} AECAlgoSnapshotConfig;

/// @brief Configuration parameters for the debug data pointer.
typedef struct
{
    StatsDebugDataInfo         debugDataInfo;           ///< Memory buffer that holds the 3A debug information.
    SIZE_T                     sizeofDebugDataWritten;  ///< Number of bytes written within the debug data buffer.
} AECAlgoDebugDataConfig;

/// @brief AEC Startup modes.
typedef enum
{
    AECAlgoStartupModeInvalid         = -1,
    AECAlgoStartupModeNormal          = 0,
    AECAlgoStartupModeFastConvergence = 1,
    AECAlgoStartupModeWarmStart       = 2
} AECAlgoStartupMode;

/// @brief Contains exposure table information for vendor tags.
typedef struct
{
    BOOL                  isValid;                                     ///< Indicates whether the exposure table is valid.
                                                                       ///
                                                                       ///  @valuesbul
                                                                       ///  - 0 -- FALSE
                                                                       ///  - 1 -- TRUE @tablebulletend

    FLOAT                 sensitivityCorrectionFactor;                 ///< Specifies the sensitivity correction factor for
                                                                       ///  normalization between exposure tables.
    UINT32                kneeCount;                                   ///< Number of knee entries in the exposure table.
    FLOAT                 gain[MaxTableKnees];                         ///< Gain for each knee point.
    UINT64                expTime[MaxTableKnees];                      ///< Exposure time for each knee point.
    INT32                 incrementPriority[MaxTableKnees];            ///< Exposure increment method for each knee point.
    FLOAT                 expIndex[MaxTableKnees];                     ///< Exposure index for each knee point.
    FLOAT                 antiBandingMinimumTimePercentageThreshold;   ///< Percentage of the minimum exposure time when
                                                                       ///  antibanding is performed.
} AECCustomExposureTable;

/// @brief Defines a custom metering table for vendor tags.
typedef struct
{
    FLOAT                 meteringTable[MaxMeteringTableSize];  ///< Array of metering elements, where each element
                                                                ///  specifies the weight of a pixel.
    UINT32                meteringTableSize;                    ///< Size of the metering table.
                                                                ///  @newpagetable
} AECCustomMeteringTable;


/// @brief Function wrapper for the AEC algorithm.
typedef struct /** @cond */ CHIAECAlgorithm /** @endcond */
{
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// @cond AECProcess @endcond
    ///
    /// @brief Runs the statistic algorithm on the given inputs. This core method must be called only after the algorithm is
    ///        initialized.
    ///
    /// @datatypes
    /// #AECAlgoInputList \n
    /// #AECAlgoOutputList
    ///
    /// @param[in]  pCHIAECAlgorithm   Pointer to the algorithm instance.
    /// @param[in]  pInput             Pointer to the statistics data and other data used by the algorithm to calculate
    ///                                the exposure parameter.
    /// @param[in]  pOutput            Pointer to the output data populated by the algorithm to control the camera system's
    ///                                exposure and other information to reflect the current state of the algorithm.
    ///
    /// @detdesc
    /// This function sends the statistics data populated per frame to the algorithm. The algorithm adjusts the exposure
    /// parameter for the camera system per the input statistics data and sends out the new exposure parameter.
    ///
    /// @return #CDKResultSuccess or an error code (see Section @xref{hdr:resultMessages}). @newpage
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CDKResult (*AECProcess)(
        CHIAECAlgorithm*        pCHIAECAlgorithm,
        const AECAlgoInputList* pInput,
        AECAlgoOutputList*      pOutput);

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// @cond AECGetParam @endcond
    ///
    /// @brief Retrieves the most up to date AEC algorithm metadata. Typically, the metadata is updated after calling
    ///        AECProcess().
    ///
    /// @datatypes
    /// #AECAlgoGetParam
    ///
    /// @param[in]  pCHIAECAlgorithm  Pointer to the algorithm instance.
    /// @param[out] pGetParam         Pointer to the metadata and associated data that is necessary to support the query.
    ///
    /// @return #CDKResultSuccess or an error code (see Section @xref{hdr:resultMessages}).
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CDKResult (*AECGetParam)(
        CHIAECAlgorithm*       pCHIAECAlgorithm,
        AECAlgoGetParam*       pGetParam);

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// @cond AECSetParam @endcond
    ///
    /// @brief Sets configuration parameters to the AEC algorithm.
    ///
    /// @datatypes
    /// #AECAlgoSetParamList
    ///
    /// @param[in] pCHIAECAlgorithm  Pointer to the algorithm instance.
    /// @param[in] pSetParam         List of the statistics configuration parameters that are set inside the AEC algorithm.
    ///                              Each element in the list is of type #AECAlgoSetParam.
    ///
    /// @return #CDKResultSuccess or an error code (see Section @xref{hdr:resultMessages}). @newpage
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CDKResult (*AECSetParam)(
        CHIAECAlgorithm*               pCHIAECAlgorithm,
        const AECAlgoSetParamList*     pSetParam);

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// @cond AECGetFeatureCapability @endcond
    ///
    /// @brief Gets the supported algorithm features. This function can be invoked after the algorithm is created.
    ///
    /// @param[in] pCHIAECAlgorithm  Pointer to the algorithm instance.
    /// @param[in] pFeatures         Pointer to the bitmask of supported features returned from the
    ///                              algorithm (#AECAlgoFeatureType).
    ///
    /// @return #CDKResultSuccess or an error code (see Section @xref{hdr:resultMessages}).
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CDKResult (*AECGetFeatureCapability)(
        CHIAECAlgorithm*   pCHIAECAlgorithm,
        UINT64*            pFeatures);

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// @cond AECDestroy @endcond
    ///
    /// @brief Destroys a derived instance of the AEC algorithm interface.
    ///
    /// @datatypes
    /// #AECAlgoDestroyParamList
    ///
    /// @param[in] pCHIAECAlgorithm  Pointer to the algorithm instance.
    /// @param[in] pDestroyParams    Pointer to list of parameters.
    ///
    /// @detdesc
    /// After the algorithm is destroyed, the client does not store any data or state associated with the current session.
    /// In this function, the algorithm cannot retain data from a previous session.
    ///
    /// @return None. @newpage
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    VOID (*AECDestroy)(
        CHIAECAlgorithm*                pCHIAECAlgorithm,
        const AECAlgoDestroyParamList*   pDestroyParams);

} CHIAECAlgorithm; // CHIAECAlgorithm interface

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @cond CreateAEC @endcond
///
/// @brief Function pointer to the method for creating a handle for the AEC algorithm.
///
/// @datatypes
/// #AECAlgoCreateParamList \n
/// #CHIAECAlgorithm
///
/// @param[in] pCreateParam       Pointer to the list of Create parameters.
/// @param[in] ppCHIAECAlgorithm  Double pointer to the created algorithm instance.
///
/// @return #CDKResultSuccess or an error code (see Section @xref{hdr:resultMessages}). @newpage
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef CDKResult (*CREATEAEC)(
    const AECAlgoCreateParamList*      pCreateParam,
    CHIAECAlgorithm**                  ppCHIAECAlgorithm);

/** @} */ /* end_addtogroup chi_stats_aec */

#pragma pack(pop)

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // CHIAECINTERFACE_H
