////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// All rights reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file camxpropertyblob.h
/// @brief Define Qualcomm Technologies, Inc. proprietary blob for holding internal properties/events
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef CAMXPROPERTYBLOB_H
#define CAMXPROPERTYBLOB_H

#include "chicommon.h"
#include "chiispstatsdefs.h"
#include "chistatsproperty.h"
#include "chiifedefs.h"
#include "chiipedefs.h"
#include "chituningmodeparam.h"
#include "chieisdefs.h"
#include "camxcmdbuffermanager.h"
#include "camxdefs.h"
#include "camxifeproperty.h"
#include "camxsensorproperty.h"
#include "camxstatsinternalproperty.h"
#include "camxjpegproperty.h"
#include "camxfdproperty.h"
#include "camxlrmeproperty.h"
#include "camxcvpproperty.h"
#include "camxtypes.h"

CAMX_NAMESPACE_BEGIN

/// @brief Property type
typedef UINT32 PropertyID;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Definition of QTI. internal properties.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/// @brief Additional classification of tags/properties
enum class PropertyGroup : UINT32
{
    Result    = 0x3000, ///< Properties found in the result pool
    Internal  = 0x4000, ///< Properties found in the internal pool
    Usecase   = 0x5000, ///< Properties found in the usecase pool
    DebugData = 0x6000, ///< Properties found in the debug data pool
};

static const PropertyID PropertyIDPerFrameResultBegin    = static_cast<UINT32>(PropertyGroup::Result)    << 16;
static const PropertyID PropertyIDPerFrameInternalBegin  = static_cast<UINT32>(PropertyGroup::Internal)  << 16;
static const PropertyID PropertyIDUsecaseBegin           = static_cast<UINT32>(PropertyGroup::Usecase)   << 16;
static const PropertyID PropertyIDPerFrameDebugDataBegin = static_cast<UINT32>(PropertyGroup::DebugData) << 16;

static const PropertyID PropertyIDInvalid                = 0xFFFFFFFF;
static const PropertyID TypeIDInvalid                    = 0xFFFFFFFF;

static const UINT32 MaxLTMDCLUTSize                      = 130 * 3; ///< Avg curve LUT (130 entires of 3 Dwords each)

static const UINT32 MaxLTMDCLUTWidth                     = 13  * 3;
static const UINT32 MaxLTMHistLUTWidth                   = 25;      ///< Histogram stats width
static const UINT32 MaxLTMHistLUTHeight                  = 19;      ///< Histogram stats Height
static const UINT32 MaxLTMHistLUTSize                    = MaxLTMHistLUTWidth * MaxLTMHistLUTHeight; ///< Hist Smoothed LUT


/// @brief Structure describing top-level TintlessBG property
struct PropertyISPTintlessBG
{
    ISPTintlessBGStatsConfig    statsConfig;                                    ///< Tintless BG stats frame level configuration
    ISPTintlessBGStatsConfig    stripeConfig[2];                                ///< if dual IFE mode is enabled, the array is
                                                                                ///<  filled strip configuration - 0 for left &
                                                                                ///< 1 for right
    BOOL                        dualIFEMode;                                    ///< Flag to indicate if it's a dual IFE mode
    UINT32                      titanVersion;                                   ///< Titan version
};

/// @brief Structure describing top-level ALSCBG property
struct PropertyISPALSCBG
{
    ISPALSCBGStatsConfig  statsConfig;       ///< ALSC BG stats frame level configuration
    ISPALSCBGStatsConfig  stripeConfig[2];   ///< if dual IFE mode is enabled, the array is
                                             ///< filled strip configuration - 0 for left &
                                             ///< 1 for right
    BOOL                  dualIFEMode;       ///< Flag to indicate if it's a dual IFE mode
    UINT32                titanVersion;      ///< Titan version
};

/// @brief Structure describing top level Bayer Histogram property data.
struct PropertyISPBHistStats
{
    ISPBHistStatsConfig     statsConfig;                                ///< BHist stats frame level configuration
    ISPBHistStatsConfig     stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                        ///<  filled strip configuration - 0 for left and
                                                                        ///< 1 for right
    BOOL                    dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
};

/// @brief Structure describing top level Bayer Histogram property data.
struct PropertyISPAECBHistStats
{
    ISPAECBHistStatsConfig     statsConfig;                                ///< BHist stats frame level configuration
    ISPAECBHistStatsConfig     stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                           ///<  filled strip configuration - 0 for left and
                                                                           ///< 1 for right
    BOOL                       dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
};

/// @brief Structure describing top level Image Histogram property data.
struct PropertyISPIHistStats
{
    ISPIHistStatsConfig     statsConfig;                                ///< BHist stats frame level configuration
    ISPIHistStatsConfig     stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                        ///< filled strip configuration - 0 for left and
                                                                        ///< 1 for right
    BOOL                    dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
};

/// @brief Structure describing top level Bayer Focus property data.
struct PropertyISPBFStats
{
    ISPBFStatsConfig            statsConfig;                                ///< BF stats frame level configuration
    ISPBFStatsConfig            stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                            ///< filled strip configuration - 0 for left and
                                                                            ///< 1 for right
    BOOL                        dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
    UINT32                      titanVersion;                               ///< Titan version
    UINT32                      titanChipVersion;                           ///< Titan chip version
};

/// @brief Structure describing top level Contrast Focus property data.
struct PropertyISPCAFStats
{
    ISPCAFStatsConfig           statsConfig;                                ///< CAF stats frame level configuration
    ISPCAFStatsConfig           stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                            ///< filled strip configuration - 0 for left and
                                                                            ///< 1 for right
    BOOL                        dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
};

/// @brief Structure describing top level Bayer Floating Window property data.
struct PropertyISPBFWStats
{
    ISPBFWStatsConfig           statsConfig;                                ///< BFW stats frame level configuration
    ISPBFWStatsConfig           stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                            ///< filled strip configuration - 0 for left and
                                                                            ///< 1 for right
    BOOL                        dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
};

/// @Brief Structure describing top level LTM DC Out property data.
struct PropertyISPLTMDCStats
{
    UINT16 LTMDCStats[MaxLTMDCLUTSize];  ///< LTM DC Stats
};

/// @Brief Structure describing top level LTM DC configuration property data.
struct PropertyISPLTMDCStatsCFG
{
    ISPLTMDCStatsConfig  stripeConfig[2];  ///< if dual IFE mode is enabled, the array is filled strip
                                           ///< configuration - 0 for left and 1 for right
    BOOL                 dualIFEMode;      ///< Flag to indicate if it's a dual IFE mode
};


/// @brief Structure describing top level AWB BG configuration property data.
struct PropertyISPAWBBGStats
{
    ISPAWBBGStatsConfig     statsConfig;                                ///< AWB BG stats frame level configuration
    ISPAWBBGStatsConfig     stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                        ///< filled strip configuration - 0 for left and
                                                                        ///< 1 for right
    BOOL                    dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
    UINT32                  titanVersion;                               ///< Titan version
};

/// @brief Structure describing top level GS stats configuration property data.
struct PropertyISPGSStatsConfig
{
    GSStatsConfig     statsConfig;                                      ///< GS stats frame level configuration
};

/// @brief Structure describing top level IR BG configuration property data.
struct PropertyISPIRBGStats
{
    ISPIRBGStatsConfig      statsConfig;                                ///< IR BG stats frame level configuration
    UINT32                  titanVersion;                               ///< Titan version
};

/// @brief Structure describing top level IR BHist configuration property data.
struct PropertyISPIRBHistStats
{
    ISPIRBHistStatsConfig   statsConfig;                                ///< IR BHist stats frame level configuration
};


/// @brief Structure describing top level HDR BE configuration property data.
struct PropertyISPHDRBEStats
{
    ISPHDRBEStatsConfig     statsConfig;                                ///< HDR BE stats frame level configuration
    ISPHDRBEStatsConfig     stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                        ///< filled strip configuration - 0 for left and
                                                                        ///< 1 for right
    BOOL                    dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
    UINT32                  titanVersion;                               ///< Titan version
};

/// @brief Structure describing top level AEC BE configuration property data.
struct PropertyISPAECBEStats
{
    ISPAECBEStatsConfig     statsConfig;                                ///< AEC BE stats frame level configuration
    ISPAECBEStatsConfig     stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                        ///< filled strip configuration - 0 for left and
                                                                        ///< 1 for right
    BOOL                    dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
};


/// @brief Structure describing top level HDR BHist configuration property data.
struct PropertyISPHDRBHistStats
{
    ISPHDRBHistStatsConfig  statsConfig;                                    ///< HDR BHist stats frame level configuration
    ISPHDRBHistStatsConfig  stripeConfig[2];                                ///< if dual IFE mode is enabled, the array is
                                                                            ///< filled strip configuration - 0 for left and
                                                                            ///< 1 for right
    BOOL                    dualIFEMode;                                    ///< Flag to indicate if it's a dual IFE mode
};

/// @brief Structure describing top level CS Stats configuration property data.
struct PropertyISPCSStats
{
    ISPCSStatsConfig        statsConfig;                                ///< CS stats frame level configuration
    ISPCSStatsConfig        stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                        ///< filled strip configuration - 0 for left and
                                                                        ///< 1 for right
    BOOL                    dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
};

/// @brief Structure describing top level RS stats configuration property data.
struct PropertyISPRSStats
{
    ISPRSStatsConfig        statsConfig;                                ///< RS stats frame level configuration
    ISPRSStatsConfig        stripeConfig[2];                            ///< if dual IFE mode is enabled, the array is
                                                                        ///< filled strip configuration - 0 for left and
                                                                        ///< 1 for right
    BOOL                    dualIFEMode;                                ///< Flag to indicate if it's a dual IFE mode
    UINT32                  titanVersion;                               ///< Titan version
};

struct PropertyOPELTMDCStats
{
    BOOL   isValid;                                                     ///< Flag to indicate if DC Stats is valid or not
    UINT32 LTMDCStats[MaxLTMDCLUTSize];                                 ///< LTM DC Stats for RT/NRT pipeline
};

/// @brief Structure for per pipeline output dimensions
struct PropertyPipelineOutputDimensions
{
    CHIPIPELINEOUTPUTDIMENSION dimensions[MaxPipelineOutputs];          ///< Pipeline output dimensions
    UINT                       numberOutputs;                           ///< number of outputs
};

/// @brief Structure for ISP ADRC parameters
struct PropertyISPADRCParams
{
    BOOL  bIsADRCEnabled;                                      ///< Whether ADRC is enabled or not.
    FLOAT GTMPercentage;                                       ///< GTM percentage
    FLOAT DRCGain;                                             ///< DRC gain
    FLOAT DRCDarkGain;                                         ///< DRC dark gain
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Structure for Preference config data
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct PreferenceConfigData
{
    FLOAT   bad_pixel_correction;
    FLOAT   Luma_noise_correction;
    FLOAT   chroma_noise_correction;
    FLOAT   multiframe_denoising;
    FLOAT   ghost_reduction;
    FLOAT   brightness;
    FLOAT   contrast;
    FLOAT   color;
    FLOAT   sharpness;
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Structure for Preference Configurations
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct PropertyISPPreferenceConfigs
{
    BOOL                   preferenceModuleEnable;
    BOOL                   preferenceDataChanged;
    PreferenceConfigData   preferenceCfgData;
};


/// @brief Structure for ISP intermediate size dimension
struct PropertyISPIntermediateDimension
{
    UINT32  intermediateWidth;   ///< intermediate width
    UINT32  intermediateHeight;  ///< intermediate height
    FLOAT   intermediateRatio;   ///< intermediate ratio
};

CAMX_NAMESPACE_END

#include "g_camxproperties.h"

#endif // CAMXPROPERTYBLOB_H
