#ifndef __SDK_COMMON_PQDEF__
#define __SDK_COMMON_PQDEF__

#include "hv_comm_DataType.h"
#include "hv_comm_Event.h"

#define CHANNEL_MAIN    (0)
#define CHANNEL_SUB     (1)
#define CHANNEL_NUM     (2)

#define SDR_TYPE    0
#define HDR10_TYPE  2
#define HLG_TYPE    3

//MAX value of Driver APIs
#define PQ_DRV_CONTRAST_MAX        (0xff)

#define PQ_DRV_BLACKLEVEL_MAX      (0x1ff)
#define PQ_DRV_RGBGAIN_MAX         (0x2000)




#define PQ_DRV_DARKSTABILIZER_MAX  (0xff)
#define PQ_DRV_HUE_MAX             (0xff)

#define PQ_BRIGHTNESS_OSD_START    (0)
#define PQ_BRIGHTNESS_OSD_MIDDLE   (75)
#define PQ_BRIGHTNESS_OSD_END      (100)

#define PQ_BRIGHTNESS_DRV_FOR_OSD_SET_START    (29)
#define PQ_BRIGHTNESS_DRV_FOR_OSD_SET_MIDDLE   (1016)
#define PQ_BRIGHTNESS_DRV_FOR_OSD_SET_END      (2105)
#define PQ_BRIGHTNESS_DRV_FOR_HDR_MAX          (2105)
#define PQ_BRIGHTNESS_FOR_PAT1     (1691)
#define PQ_BRIGHTNESS_FOR_PAT2     (237)
#define PQ_BRIGHTNESS_FOR_PAT3     (237)

#define PQ_SHARPNESS_OSD_START    (0)
#define PQ_SHARPNESS_OSD_MIDDLE   (10)
#define PQ_SHARPNESS_OSD_END      (20)

#define PQ_SHARPNESS_DRV_FOR_OSD_SET_START    (0)
#define PQ_SHARPNESS_DRV_FOR_OSD_SET_MIDDLE   (50)
#define PQ_SHARPNESS_DRV_FOR_OSD_SET_END      (128)


#define PQ_CONTRAST_OSD_START    (0)
#define PQ_CONTRAST_OSD_MIDDLE   (50)
#define PQ_CONTRAST_OSD_END      (100)

#define PQ_CONTRAST_DRV_FOR_OSD_SET_START    (1800)
#define PQ_CONTRAST_DRV_FOR_OSD_SET_MIDDLE   (4095)
#define PQ_CONTRAST_DRV_FOR_OSD_SET_END      (6000)

#define PQ_SATURATION_OSD_START    (0)
#define PQ_SATURATION_OSD_MIDDLE   (50)
#define PQ_SATURATION_OSD_END      (100)

#define PQ_SATURATION_DRV_FOR_OSD_SET_START    (0)
#define PQ_SATURATION_DRV_FOR_OSD_SET_MIDDLE   (128)
#define PQ_SATURATION_DRV_FOR_OSD_SET_END      (255)

#define PQ_HUE_OSD_START    (0)
#define PQ_HUE_OSD_MIDDLE   (50)
#define PQ_HUE_OSD_END      (100)

#define PQ_HUE_DRV_FOR_OSD_SET_START    (0)
#define PQ_HUE_DRV_FOR_OSD_SET_MIDDLE   (128)
#define PQ_HUE_DRV_FOR_OSD_SET_END      (255)

#define PQ_RGBGAIN_OSD_START    (0)
#define PQ_RGBGAIN_OSD_MIDDLE   (50)
#define PQ_RGBGAIN_OSD_END      (100)

#define PQ_RGBGAIN_DRV_FOR_OSD_SET_START    (0x800)
#define PQ_RGBGAIN_DRV_FOR_OSD_SET_MIDDLE   (0xC00)
#define PQ_RGBGAIN_DRV_FOR_OSD_SET_END      (0x1000)

#define PQ_RGBGAIN_FAC_OSD_START    (0)
#define PQ_RGBGAIN_FAC_OSD_MIDDLE   (128)
#define PQ_RGBGAIN_FAC_OSD_END      (255)

#define PQ_RGBGAIN_FAC_DRV_FOR_OSD_SET_START    (0x800)
#define PQ_RGBGAIN_FAC_DRV_FOR_OSD_SET_MIDDLE   (0x1000)
#define PQ_RGBGAIN_FAC_DRV_FOR_OSD_SET_END      (0x1800)

#define PQ_RGBOFFSET_OSD_START    (0)
#define PQ_RGBOFFSET_OSD_MIDDLE   (50)
#define PQ_RGBOFFSET_OSD_END      (100)

#define PQ_RGBOFFSET_DRV_FOR_OSD_SET_START    (0)
#define PQ_RGBOFFSET_DRV_FOR_OSD_SET_MIDDLE   (256)
#define PQ_RGBOFFSET_DRV_FOR_OSD_SET_END      (511)

#define PQ_DCR_PIXEL_MIN       (0)
#define PQ_DCR_PIXEL_MAX       (1023)

#define PQ_DCR_PWM_MIN         (PQ_BRIGHTNESS_DRV_FOR_OSD_SET_START)
#define PQ_DCR_PWM_MAX         (PQ_BRIGHTNESS_DRV_FOR_OSD_SET_END)



//Function ID
typedef enum _PQFunc
{
    PQ_CONTRAST = 0x80,
    PQ_BRIGHTNESS,
    PQ_SHARPNESS,
    PQ_SATURATION,
    PQ_BLACKLEVEL,
    PQ_BACKLIGHT,
    PQ_RGBGAIN,
    PQ_CUSTOM_HUE,
    PQ_CUSTOM_SAT,
    PQ_CUSTOM_LUM,
    PQ_COLORTEMP,
    PQ_EYEPROTECT,
    PQ_LOWBLUE,
    PQ_PICMODE,
    PQ_ASPECT_RATIO,
    PQ_HDR,
    PQ_DLC,
    PQ_COLORSPACE,
    PQ_BRIGHTRANGE,
    PQ_GAMMA,
    PQ_GAMUT,
    PQ_BLACKSTABLIZER,
    PQ_DYNAMICCONTRAST,
    PQ_RGBGAIN_FAC,
    PQ_HUE,
    PQ_BRIGHTNESS_HDR,
    PQ_RGBOFFSET,
}PQFunc;



#define CHECK_MAX_RANGE(a,b) {if(a > b) a = b;}
#define CHECK_CHANNEL_RANGE(a) {if(a > CHANNEL_SUB){HV_LOG_WARN(DEFAULT, "Channel input out of Range = %u",ucCh); a = CHANNEL_MAIN;}}

#if (HV_PROJECT_CONFIG_AMBILIGHT == HV_CONFIG_ON)
typedef struct _CrosshairArea
{
    USHORT16   usX;
    USHORT16   usY;
    USHORT16   usWidth;
    USHORT16   usHeight;
}CrosshairArea;

typedef struct _CrosshairRGBY
{
    UCHAR8   ucR;
    UCHAR8   ucG;
    UCHAR8   ucB;
    UCHAR8   ucY;
}CrosshairRGBY;
#endif


#endif
