/**
 * @file hv_mw_PQ.h
 * @brief Header file of dpu module.
 * 
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use hv_mw_PQ(...) as a function handle. 
 * 
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-10
 */

#ifndef __SDK_MIDDLEWARE_VIDEO_INC_PQ_H__
#define __SDK_MIDDLEWARE_VIDEO_INC_PQ_H__

#include "Common/hv_comm_DataType.h"
#include "hv_comm_Define.h"
#include "hv_comm_PqDef.h"

#if (HV_PROJECT_CONFIG_PQ_DATABASEWREN == HV_CONFIG_ON)
    #define HV_PQ_DATABASE_SET(module, param, value)    HV_COMMON_DATABASE_SET(module, param, value)
#else
    #define HV_PQ_DATABASE_SET(module, param, value) \
    ({\
        \
    })
#endif
    #define HV_PQ_DATABASE_GET(module, param)           HV_COMMON_DATABASE_GET(module, param)
    




typedef struct _DispCtrlCfg
{
    const UINT32 *puiFrameDetThd;
    const UINT32 *puiGammaVrrLut;
    const UINT32 *puiODLut0;
    const UINT32 *puiODLut1;
    const UINT32 *puiDemuraLut;
    UINT32 uiDemuraLutLen;
}DispCtrlCfg;

/**
 * @brief bypass all PQ Module.
 * @param[in] bBypass, status of PQ bypass
 * @return VOID
 */
VOID Hv_Mw_PQ_PQBypass(BOOL bBypass);
/**
 * @brief PQ common reg Init.
 * @param[in] puiBaseRegAddr:address of Init bin;
 * @param[in] uiLen:address of Init bin;
 * @return None.
 */
VOID Hv_Mw_PQ_DpuPQ_CommonRegInit(const UINT32 *puiBaseRegAddr, UINT32 uiLen);
/**
 * @brief CM reg Init.
 * @param[in] puiCmAddr:address of CM Init bin;
 * @param[in] uiLen:address of Init bin;
 * @return Stauts, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_CMInit(const UINT32 *puiCmAddr, UINT32 uiLen);
/**
 * @brief CM Lut Init.
 * @param[in] puiCmLutAddr:default address of CM lut;
 * @param[in] puiCmLutAddr2:current address of CM lut;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_CMLutInit(const UINT32 *puiCmLutAddr, UINT32 *puiCmLutAddr2);
/**
 * @brief CM Enable.
 * @param[in] bEn:status of CM enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_CMEnable(BOOL bEn);
/**
 * @brief CM setting hue.
 * @param[in] ucCmMod:module of CM(R,G,B,C,M,Y);
 * @param[in] ucCmHue:value of hue setting;
 * @return VOID
 */
VOID Hv_Mw_PQ_CMSetHue(CmColorType enCmMod, UCHAR8 ucCmHue);
/**
 * @brief CM setting saturation.
 * @param[in] ucCmMod:module of CM(R,G,B,C,M,Y);
 * @param[in] ucSat:value of sat setting;
 * @return VOID
 */
VOID Hv_Mw_PQ_CMSetSat(CmColorType enCmMod, UCHAR8 ucSat);
/**
 * @brief CM setting luminance.
 * @param[in] ucCmMod:module of CM(R,G,B,C,M,Y);
 * @param[in] ucLum:value of lum setting;
 * @return VOID
 */
VOID Hv_Mw_PQ_CMSetLum(CmColorType enCmdMod, UCHAR8 ucLum);
/**
 * @brief CM getting hue.
 * @param[in] ucCmMod:module of CM(R,G,B,C,M,Y);
 * @return value of hue.
 */
UCHAR8 Hv_Mw_PQ_CMGetHue(CmColorType enCmMod);
/**
 * @brief CM getting saturation.
 * @param[in] ucCmMod:module of CM(R,G,B,C,M,Y);
 * @return value of saturation.
 */
UCHAR8 Hv_Mw_PQ_CMGetSat(CmColorType enCmMod);
/**
 * @brief CM getting luminance.
 * @param[in] ucCmMod:module of CM(R,G,B,C,M,Y);
 * @return value of luminance.
 */
UCHAR8 Hv_Mw_PQ_CMGetLum(CmColorType enCmMod);
/**
 * @brief CM64��for CM debug by tool�� setting all parameters.
 * @param[in] None;
 * @return VOID
 */
VOID Hv_Mw_PQ_CM64SetAll(VOID);
/**
 * @brief CM64��for CM debug by tool��setting hue.
 * @param[in] ucIndex:index of hue(0-63);
 * @return VOID
 */
VOID Hv_Mw_PQ_CM64AxisSetHue(UCHAR8 ucIndex);
/**
 * @brief CM64��for CM debug by tool��setting luminance.
 * @param[in] ucIndex:index of lum(0-63);
 * @return VOID
 */
VOID Hv_Mw_PQ_CM64AxisSetLum(UCHAR8 ucIndex);
/**
 * @brief CM64��for CM debug by tool��setting saturation.
 * @param[in] ucIndex:index of sat(0-63);
 * @return VOID
 */
VOID Hv_Mw_PQ_CM64AxisSetSat(UCHAR8 ucIndex);
/**
 * @brief CM64��for CM debug by tool��getting saturation.
 * @param[in] ucIndex:index of sat(0-63);
 * @return value of sat.
 */

UCHAR8 Hv_Mw_PQ_Cm64AxisGetSat(UCHAR8 ucIndex);
/**
 * @brief CM64��for CM debug by tool��getting luminance.
 * @param[in] ucIndex:index of lum(0-63);
 * @return value of lum.
 */
UCHAR8 Hv_Mw_PQ_Cm64AxisGetLum(UCHAR8 ucIndex);
/**
 * @brief CM64��for CM debug by tool��getting hue.
 * @param[in] ucIndex:index of hue(0-63);
 * @return value of hue.
 */
UCHAR8 Hv_Mw_PQ_Cm64AxisGetHue(UCHAR8 ucIndex);
/**
 * @brief CSC Init.
 * @param[in] puiCscAddr:address of Csc Init bin;
 * @param[in] uiLen:address of Init bin;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_CscInit(const UINT32 *puiCscAddr, UINT32 uiLen);
/**
 * @brief CSC config address.
 * @param[in] puiMainCscHdb:address of Csc main config;
 * @param[in] puiSubCscHdb:address of Csc sub config;
 * @return Stauts, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_CscConfigAddr(const UINT32 *puiMainCscHdb, const UINT32 *puiSubCscHdb);
/**
 * @brief gamma Init.
 * @param[in] auiGammabin:address of gamma Init bin;
 * @param[in] uiLen:address of Init bin;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_GammaInit(const UINT32 *puiGammabin, UINT32 uiLen);
/**
 * @brief gamma Lut Init.
 * @param[in] auiGammalut:default address of gamma lut;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_GammaLutInit(const UINT32 *puiGammalut);
/**
 * @brief osd gamma Lut Init.
 * @param[in] puiOsdGmiAddr:default address of gamma lut;
 * @param[in] puiOsdGmdAddr:default address of gamma lut;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_OsdGammaLutInit(const UINT32 *puiOsdGmiAddr, const UINT32 *puiOsdGmdAddr);
/**
 * @brief Set different Gamma 
 * @param[in] ucGammaIndex: index of Gamma lut to be set
 * @return VOID
 */
VOID Hv_Mw_PQ_SetGamma(UCHAR8 ucGammaIndex);
/**
 * @brief Set gamma lut.
 * @param[in] pucGamma:address of gamma lut;
 * @param[in] usTableSize:size of gamma lut;
 * @return, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetGammaLut(UCHAR8 *pucGamma, USHORT16 usTableSize);
/**
 * @brief sharpness Init.
 * @param[in] puiSharpnessbin:address of sharpness Init bin;
 * @param[in] uiLen:address of Init bin;
 * @param[in] puiSharpnessParam:address of sharpness cfg bin;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SharpnessInit(const UINT32 *puiSharpnessbin, UINT32 uiLen, const UINT32 *puiSharpnessParam);
/**
 * @brief Sharpness Setting
 * @param[in] value of Sharpness
 * @return VOID
 */
VOID Hv_Mw_PQ_SetSharpness(UCHAR8 ucSharpness);
/**
 * @brief sharpness Enable.
 * @param[in] bEn:status of sharpness enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_SharpnessEnable(BOOL bEn);
/**
 * @brief local dimming Init.
 * @param[in] puiLdcAddr:address of ldc Init bin;
 * @param[in] uiLen:address of Init bin;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_LdcInit(const UINT32 *puiLdcAddr, UINT32 uiLen);
/**
 * @brief local dimming Lut Init.
 * @param[in] puiLdcLutAddr:default address of ldc lut;
 * @param[in] puiBlAddr:address backlight;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_LdcLutInit(const UINT32 *puiLdcLutAddr, UINT32 *puiBlAddr);
/**
 * @brief LocalDimming bypass
 * @param[in] bypass:status of ldc bypass
 * @return VOID
 */
VOID Hv_Mw_PQ_SetLdBypass(BOOL bLdBypass);
/**
 * @brief LocalDimming blend pwm
 * @param[in] uiPwm:value of pwm
 * @return VOID
 */
VOID Hv_Mw_PQ_LdcPwmBlend(UINT32 uiPwm);
/**
 * @brief set address of three mode lut
 * @param[in] pusLdcModeLutBaseAddr:default address of ldc mode lut;
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_LdcSetModeLutAddr(const USHORT16 *pusLdcModeLutBaseAddr);
/**
 * @brief LocalDimming setting mode
 * @param[in] ucLdcModeIndx:value of mode
 * @param[in] usMaxWeightVal max weight value
 * @return VOID
 */
VOID Hv_Mw_PQ_LdcSetMode(UCHAR8 ucLdcModeIndex, USHORT16 usMaxWeightVal);
/**
 * @brief get global average brightness 
 * @param[in] None 
 * @return value of average brightness
 */
UINT32 Hv_Mw_PQ_LDCGetGlobalAvgBright(VOID);
/**
 * @brief get global max brightness 
 * @param[in] None 
 * @return value of max brightness
 */
UINT32 Hv_Mw_PQ_LDCGetGlobalMaxBright(VOID);
/**
 * @brief Max Backlight setting
 * @param[in] value of Backlight
 * @return VOID
 */
VOID Hv_Mw_PQ_SetMaxBl(UCHAR8 ucMaxBl);
/**
 * @brief get ldim address of wdma
 * @param[in] ucBlBufId id of dma buffer
 * @return address of wdma.
 */
UINT32 Hv_Mw_PQ_GetLdimBlBufAddr(UCHAR8 ucBlBufId);
/**
 * @brief get Kspi address of rdma
 * @param[in] None
 * @return address of rdma.
 */
UINT32 Hv_Mw_PQ_GetKspiRdmaAddr(VOID);
/**
 * @brief set Kspi demo mode
 * @param[in] ucDemoMode demo mode of Kspi
 * @return VOID
 */
VOID Hv_Mw_PQ_SetKspiDemoMode(UCHAR8 ucDemoMode);
/**
 * @brief set Kspi demo data
 * @param[in] usDemoData demo data of Kspi
 * @return VOID
 */
VOID Hv_Mw_PQ_SetKspiDemoData(USHORT16 usDemoData);
/**
 * @brief set Kspi data length
 * @param[in] usDataLen length of Kspi data
 * @return VOID
 */
VOID Hv_Mw_PQ_SetKspiDataLen(USHORT16 usDataLen);
/**
 * @brief set Kspi header
 * @param[in] ucCh channel of spi
 * @param[in] ucHeaderNum number of header
 * @param[in] pusHeadrData point of head data
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetKspiHeader(UCHAR8 ucCh, UCHAR8 ucHeaderNum, USHORT16 *pusHeadrData);
/**
 * @brief set Kspi tail
 * @param[in] ucCh channel of spi
 * @param[in] ucTailNum number of tail
 * @param[in] pusTailData point of tail data
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetKspiTail(UCHAR8 ucCh, UCHAR8 ucTailNum, USHORT16 *pusTailData);
/**
 * @brief Kspi hard crc enable
 * @param[in] ucHardCrcEn enable of hard crc
 * @return VOID
 */
VOID Hv_Mw_PQ_KspiHardCrcEn(UCHAR8 ucHardCrcEn);
/**
 * @brief Kspi software mode enable
 * @param[in] ucSwModeEn enable of software mode
 * @return VOID
 */
VOID Hv_Mw_PQ_KspiSwModeEn(UCHAR8 ucSwModeEn);
/**
 * @brief global contrast Init.
 * @param[in] puiGcAddr:address of ldc init bin;
 * @param[in] uiLen:length of ldc init bin;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_GcInit(const UINT32 *puiGcAddr, UINT32 uiLen);
/**
 * @brief global contrast Lut Init.
 * @param[in] puiGcLutAddr:default address of gc lut;
 * @param[in] puiGcLutAddr1:current address of gc lut;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_GcLutInit(const UINT32 *puiGcLutAddr, UINT32 *puiGcLutAddr1);
/**
 * @brief global contrast mode setting.
 * @param[in] ucGcMode:gc mode;
 * @param[in] ucCurBlkSta:;
 * @return VOID
 */
VOID Hv_Mw_PQ_GcModeSwitch(UCHAR8 ucGcMode, UCHAR8 ucCurBlkSta);
/**
 * @brief GC Enable.
 * @param[in] bEn:status of GC enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_GCEnable(BOOL bEn);
/**
 * @brief set gc DarkStabilizer direction.
 * @param[in] ucDir:direction of DarkStabilizer;
 * @return VOID
 */
VOID Hv_Mw_PQ_GCSetDarkStaDir(UCHAR8 ucDir);
/**
 * @brief HDR Init.
 * @param[in] puiHdrAddr1:address of ldc init bin;
 * @param[in] ucHdrIdx:channel of HDR;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_HdrInit(const UINT32 *puiHdrAddr1, UCHAR8 ucHdrIdx);


/**
 * @brief Get HDR Enable Flag
 * @param[in] ucCh:channel of HDR;
 * @return Hdr Enable Status
 */
VOID Hv_Mw_PQ_SetHDREnableFlag(UCHAR8 ucCh, UCHAR8 ucHDREn);
/**
 * @brief Get HDR Enable.
 * @param[in] ucCh:channel of HDR;
 * @return Hdr Enable Status
 */
UCHAR8 Hv_Mw_PQ_GetHDREnable(UCHAR8 ucCh);
/**
 * @brief HDR Enable.
 * @param[in] ucCh:channel of HDR;
 * @param[in] ucHDREn:status of HDR enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_HDREnable(UCHAR8 ucCh, UCHAR8 ucHDREn);
/**
 * @brief set HDR mode.
 * @param[in] ucCh:id of channel;
 * @param[in] ucHdrModel:HDR mode;
 * @param[in] pstHdrParam:HdrParam;
 * @return Stauts, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetHdrMode(UCHAR8 ucCh, UCHAR8 ucHdrModel, const HDRParam* pstHdrParam);
/**
 * @brief Hdr Tonemapping Init
 * @param[in] ucMapType:Mapping Type
 * @param[in] uiMapLutAddr:Lut Addr if Type is Lut
 * @return VOID
 */
VOID Hv_Mw_PQ_HdrSetMappingInit(UCHAR8 ucMapType, UINT32 uiMapLutAddr);
/**
 * @brief set GetRGB
 * @param[in] ucPstX:position x;
 * @param[in] ucPstY:position x;
 * @param[in] pucRed:red info;
 * @param[in] pucGreen:green info;
 * @param[in] pucBlue:blue info;
 * @return VOID
 */
VOID Hv_Mw_PQ_GetBlkAvg(USHORT16 ucPstX, USHORT16 ucPstY, UCHAR8 *pucRed, UCHAR8 *pucGreen, UCHAR8 *pucBlue);
/**
 * @brief wcg Init.
 * @param[in] puiWcgAddr:address of wcg init bin;
 * @param[in] uiLen:length of wcg init bin;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_WcgInit(const UINT32 *puiWcgAddr, UINT32 uiLen);
/**
 * @brief wcg Enable.
 * @param[in] ucWcgEn:status of wcg enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_WcgEnable(UCHAR8 ucWcgEn);
/**
 * @brief wcg Lut Init.
 * @param[in] puiGmiAddr:default address of gmi lut;
 * @param[in] puiRgbAddr:current address of rgb lut;
 * @param[in] puiGmdAddr:default address of gmd lut;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_WcgLutInit(const UINT32 *puiGmiAddr, const UINT32 *puiRgbAddr, const UINT32 *puiGmdAddr);
/**
 * @brief load wcg rgb Lut.
 * @param[in] puiRgbAddr:address of wcg rgb lut;
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_LoadWCGLUT(const UINT32 *puiRgbAddr);
/**
 * @brief Enable WCG cm func.
 * @param[in] None;
 * @return None.
 */
VOID Hv_Mw_PQ_SetWCGLutEnable(VOID);
/**
 * @brief Enable Gamut setting
 * @param[in] Index of Gamut
 * @return None
 */
VOID Hv_Mw_PQ_SetGamutEnable(VOID);
/**
 * @brief Gamut settting
 * @param[in] psGamut paras of Gamut
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetGamutParam(const GamutSet *psGamut);
/**
 * @brief Gamut offset settting
 * @param[in] psGamut paras of Gamut
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetGamutOffset(const GamutOffset *pstOffset);
/**
 * @brief setting native Gamut 
 * @param[in] psGamut paras of Gamut
 * @return VOID
 */
VOID Hv_Mw_PQ_SetGamutNative();
/**
 * @brief setting Gamut in factory mode
 * @param[in] stGamut paras of Gamut
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetGamutFac(GamutSet *stGamut);
/**
 * @brief Contrast set
 * @param[in] ucCh:id of channel
 * @param[in] uiContrast:value of contrast
 * @return VOID
 */
VOID Hv_Mw_PQ_SetContrast(UCHAR8 ucCh, UINT32 uiContrast);
/**
 * @brief RGB Gain settting in factory mode
 * @param[in] ucCh id of channel
 * @param[in] Value of R,G,B Gain
 * @return VOID
 */
VOID Hv_Mw_PQ_SetRGBGainFac(UCHAR8 ucCh, USHORT16 usRed, USHORT16 usGreen, USHORT16 usBlue);
/**
 * @brief RGB Gain settting
 * @param[in] ucCh id of channel
 * @param[in] Value of R,G,B Gain
 * @return VOID
 */
VOID Hv_Mw_PQ_SetRGBGain(UCHAR8 ucCh, USHORT16 usRed, USHORT16 usGreen, USHORT16 usBlue);
/**
 * @brief RGB offset settting
 * @param[in] ucCh id of channel
 * @param[in] Value of R,G,B offset
 * @return VOID
 */
VOID Hv_Mw_PQ_SetRGBOffset(UCHAR8 ucCh, USHORT16 usRed, USHORT16 usGreen, USHORT16 usBlue);
/**
 * @brief get R Gain 
 * @param[in] None
 * @return value of R Gain.
 */
UCHAR8 Hv_Mw_PQ_GetRGain(VOID);
/**
 * @brief get Green Gain 
 * @param[in] None
 * @return value of Green Gain.
 */
UCHAR8 Hv_Mw_PQ_GetGGain(VOID);
/**
 * @brief get blue Gain 
 * @param[in] None
 * @return value of blue Gain.
 */
UCHAR8 Hv_Mw_PQ_GetBGain(VOID);
/**
 * @brief Black Level set
 * @param[in] ucCh id of channel
 * @param[in] ucBlackLevel value of BlackLevel 
 * @return VOID
 */
VOID Hv_Mw_PQ_SetBlackLevel(UCHAR8 ucCh, USHORT16 usBlackLevel);
/**
 * @brief Saturation set
 * @param[in] ucCh id of channel
 * @param[in] ucSaturation value of ucSaturation  
 * @return VOID
 */
VOID Hv_Mw_PQ_SetSaturation(UCHAR8 ucCh, UCHAR8 ucSaturation);
/**
 * @brief Hue set
 * @param[in] ucCh id of channel  
 * @param[in] ucHue value of ucHue  
 * @return VOID
 */
VOID Hv_Mw_PQ_SetHue(UCHAR8 ucCh, UCHAR8 ucHue);
/**
 * @brief BrightRange set
 *  @param[in] ucCh id of channel 
 * @param[in] enRange value of BrightRange
 * @return VOID
 */
VOID Hv_Mw_PQ_SetBrightRange(UCHAR8 ucCh, PQBrightRange enRange);
/**
 * @brief ColorSpace set
 * @param[in] ucCh id of channel 
 * @param[in] enColorSpace value of colorSpace
 * @return VOID
 */
VOID Hv_Mw_PQ_SetColorSpace(UCHAR8 ucCh, PQColorSpace enColorSpace);
/**
 * @brief get Saturation 
 * @param[in] None  
 * @return value of saturation.
 */
UCHAR8 Hv_Mw_PQ_GetSaturation(VOID);
/**
 * @brief get Contrast from Database
 * @param[in] None  
 * @return value of contrast.
 */
UCHAR8 Hv_Mw_PQ_GetContrastDB(VOID);
/**
 * @brief get Hue 
 * @param[in] None  
 * @return value of hue.
 */
UCHAR8 Hv_Mw_PQ_GetHue(VOID);
/**
 * @brief scaler Lut Init.
 * @param[in] puiScalerAddr:address of scaler lut;
 * @return Status , 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_ScalerUpLutInit(const UINT32 *puiScalerAddr);
/**
 * @brief dither Init.
 * @param[in] puiDitherAddr:address of dither init bin;
 * @param[in] uiLen:length of puiDitherAddr;
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_DitherInit(const UINT32 *puiDitherAddr, UINT32 uiLen);
/**
 * @brief Brightness set
 * @param[in] usBrightness value of Brightness
 * @return VOID
 */
VOID Hv_Mw_PQ_SetBrightness(USHORT16 usBrightness);
/**
 * @brief switch HDR and SDR
 * @param[in] uiValue status of HDR
 * @return VOID
 */
VOID Hv_Mw_PQ_SetHdrSwitch(UINT32 uiValue);
/**
 * @brief set PQ dma latch mode (active when vsync isr)
 * @param[in] None
 * @return None.
 */
VOID Hv_Mw_PQ_DmaSetlatch(VOID);
/**
 * @brief PQ dma workaround
 * @param[in] None
 * @return None.
 */
VOID Hv_Mw_PQ_DmaWorkaround(VOID);
/**
 * @brief set PWM duty
 * @param[in] usHigh value of PWM 
 * @return VOID
 */
VOID Hv_Mw_PQ_SetPwmDuty(USHORT16 usHigh);
/**
 * @brief Get dynamic backlight PWM
 * @param[in] None 
 * @return value of PWM
 */
UCHAR8 Hv_Mw_PQ_GetPicPWM(VOID);
/**
 * @brief Display Control module init, includes od,gamma,framerate det,...
 * @param[in] pstDispCtlCfg - config display ctrl lut addr
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_DispCtrlInit(const DispCtrlCfg *pstDispCtlCfg);

/**
 * @brief Set display control od level.
 * @param[in] ucODLevel, 0 always is off.
 * @return VOID
 */
VOID Hv_Mw_PQ_SetODLevel(UCHAR8 ucODLevel);

/**
 * @brief Only write OD table
 * @param[in] pucOdTable Pointer of od lut table.
 * @param[in] usTableSize Length of od lut table.
 * @param[in] ucWhichLut Indicates lut0 or lut1.
 * @return Status, 0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_SetODTable(UCHAR8 *pucOdTable, USHORT16 usTableSize, UCHAR8 ucWhichLut);


/**
 * @brief 给OSD使用的接口，由OSD自行决定是否要关闭OD。
 * @detail因为OSD Rotation与OD公用DDR，所以在打开OSD时需要关闭OD。
 *        OSD开----需要关闭OD----Y---->置标志&关OD(此时调整OD选项并不能立即看到效果)------>退出OSD时根据菜单中选项来恢复OD
 *                      |--------N---->无需控制OD(此时调整OD选项能立即看到效果，在调整OD菜单选项时要判断OD是否受OSD控制了)
 * @param[in] bControl, HV_TRUE-OSD关闭OD, HV_FALSE-OSD恢复OD
 * @return None
 */
VOID Hv_Mw_PQ_OsdControlOdOff(BOOL bControl);

/**
 * @brief set Gamma level
 * @param[in] ucGammaLevel
 * @return VOID
 */
VOID Hv_Mw_PQ_SetGammaLevel(UCHAR8 ucGammaLevel);

/**
 * @brief set OSD gamma level
 * @param[in] ucGammaLevel
 * @return VOID
 */
VOID Hv_Mw_PQ_SetOsdGammaLevel(UCHAR8 ucGammaLevel);

/**
 * @brief set Demura level
 * @param[in] ucDemuraLevel
 * @return VOID
 */
VOID Hv_Mw_PQ_SetDemuraLevel(UCHAR8 ucDemuraLevel);

UCHAR8 Hv_Mw_PQ_GetDemuraCrcFlag(void);

/**
 * @brief Get dynamic backlight
 * @param[in] None
 * @return Status of DynamicBL
 */
UCHAR8 Hv_Mw_PQ_GetDynamicBLEn();

/**
 * @brief enable dynamic backlight
 * @param[in] ucEn:status of enable
 * @return VOID
 */
VOID Hv_Mw_PQ_DynamicBLEn(UCHAR8 ucEn);

/**
 * @brief get HDR pattern information
 * @param[in] None
 * @return info of HDR pattern.
 */
UCHAR8 Hv_Mw_PQ_GetPattern();

#if (HV_PROJECT_CONFIG_AMBILIGHT == HV_CONFIG_ON)
/**
 * @brief init of crosshair
 * @param[in] None
 * @return None.
 */
VOID Hv_Mw_PQ_CrosshairInit(VOID);
/**
 * @brief Enable crosshair
 * @param[in] bEnable:enable status of crosshair
 * @return None.
 */
VOID Hv_Mw_PQ_CrosshairEnable(BOOL bEnable);
/**
 * @brief set crosshair area
 * @param[in] pstArea:position info of crosshair
 * @return  0-HV_SUCCESS, 1-HV_FAILURE.
 */
Status Hv_Mw_PQ_CrosshairSetArea(CrosshairArea *pstArea);
/**
 * @brief get crosshair color info
 * @param[in] pstValue:color info of crosshair
 * @return None. 
 */
VOID Hv_Mw_PQ_CrosshairGetRGBY(CrosshairRGBY *pstValue);
#endif
/**
 * @brief CM change Lut
 * @param[in] uiLutAddr: addr of lut
 * @return VOID
 */
VOID Hv_Mw_PQ_CMChangeLut(UINT32 uiLutAddr);

VOID Hv_Mw_PQ_SetInpColor(USHORT16 usRed, USHORT16 usGreen, USHORT16 usBlue);
VOID Hv_Mw_PQ_SetInpPattEn(UCHAR8 ucEn);
VOID Hv_Mw_PQ_SetInpPatt(UCHAR8 ucPattSwitch, UCHAR8 ucPatternMode);


#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_AMBIENT_LIGHT)
VOID Hv_Mw_PQ_UpdateFollowingPQ(VOID* pvArgument, USHORT16 usTimerId);
VOID Hv_Mw_PQ_StartFollowingPQ(VOID);
VOID Hv_Mw_PQ_StopFollowingPQ(VOID);
VOID Hv_Mw_PQ_UpdateSingleColor(UCHAR8 ucColorType);
VOID Hv_Mw_PQ_UpdateAutoColor(VOID* pvArgument, USHORT16 usTimerId);
VOID Hv_Mw_PQ_StartAutoColor(VOID);
VOID Hv_Mw_PQ_StopAutoColor(VOID);
VOID Hv_Mw_PQ_UpdateMarqueeColor(VOID* pvArgument, USHORT16 usTimerId);
VOID Hv_Mw_PQ_StartMarqueeColor(VOID);
VOID Hv_Mw_PQ_StopMarqueeColor(VOID);

VOID Hv_Mw_PQ_BulbInit(VOID);
VOID Hv_Mw_PQ_BulbDeInit(VOID);
VOID Hv_Mw_PQ_StartAmbilightTimer(UINT32 uiTimeoutMs);
VOID Hv_Mw_PQ_StopAmbilightTimer(VOID);
VOID Hv_Mw_PQ_StartAutoTimer(UINT32 uiTimeoutMs);
VOID Hv_Mw_PQ_StopAutoTimer(VOID);
VOID Hv_Mw_PQ_StartMarqueeTimer(UINT32 uiTimeoutMs);
VOID Hv_Mw_PQ_StopMarqueeTimer(VOID);
#endif
/**
 * @brief Kspi send data in software mode
 * @param[in] ucCh channel of spi
 * @param[in] puiData point of data
 * @param[in] uiLength length of 32bit data
 * @param[in] ucLastChFlag flag of last channel
 * @return None.
 */
Status Hv_Mw_PQ_KspiSwSendData(UCHAR8 ucCh, UINT32* puiData, UINT32 uiLength, UCHAR8 ucLastChFlag);
/**
 * @brief Kspi send data init before copying data to sram
 * @param[in] None
 * @return None.
 */
VOID Hv_Mw_PQ_KspiSwSendDataInit(VOID);
/**
 * @brief start Kspi sending in software mode
 * @param[in] none
 * @return None.
 */
VOID Hv_Mw_PQ_KspiSwSendDataStart(VOID);
/**
 * @brief Set ldc spf curve
 * @param[in] ucY0 value of y0
 * @param[in] ucY1 value of y1
 * @return None.
 */
VOID Hv_Mw_PQ_LdcSetCurveY(UCHAR8 ucY0, UCHAR8 ucY1);
/**
 * @brief ldc Enable.
 * @param[in] ucEn:status of enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_LDC_LdcEn(UCHAR8 ucEn);
/**
 * @brief space filter Enable.
 * @param[in] ucEn:status of enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_LDC_SpaceFilterEn(UCHAR8 ucEn);
/**
 * @brief time filter Enable.
 * @param[in] ucEn:status of enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_LDC_TimeFilterEn(UCHAR8 ucEn);
/**
 * @brief blgamma Enable.
 * @param[in] ucEn:status of enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_LDC_BlgammaEn(UCHAR8 ucEn);
/**
 * @brief pixelgain Enable.
 * @param[in] ucEn:status of enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_LDC_PixelgainEn(UCHAR8 ucEn);
/**
 * @brief blgamma1 Enable.
 * @param[in] ucEn:status of enable;
 * @return VOID
 */
VOID Hv_Mw_PQ_LDC_Blgamma1En(UCHAR8 ucEn);
Status Hv_Mw_PQ_PatDetInit(USHORT16 ** puiArray, UCHAR8 ucPatNum, UCHAR8 ucPatW, UCHAR8 ucPatH);

VOID Hv_Mw_PQ_GammaEnable(BOOL bEn);
VOID Hv_Mw_PQ_ColorEnable(BOOL bEn);

USHORT16 Hv_Mw_PQ_GetBlackLevel(UCHAR8 ucCh);
USHORT16 Hv_Mw_PQ_GetContrast(UCHAR8 ucCh);
VOID Hv_Mw_PQ_LDCPrintPattern();
VOID Hv_Hv_Mw_Video_SetBrightFrameBrightness(USHORT16 usBrightness);
USHORT16 Hv_Mw_Video_GetBrightFrameBrightness(VOID);
VOID Hv_Mw_Video_SetBrightFrameContrast(USHORT16 usContrast);
USHORT16 Hv_Mw_Video_GetBrightFrameContrast(VOID);
VOID Hv_Mw_PQ_SetSharpnessReverse(UCHAR8 ucSharpness);
VOID Hv_Mw_PQ_SetHdrGmiLut(UCHAR8 ucHdrIdx, UINT32 uiHdrGmiLutAddr);
VOID Hv_Mw_PQ_LDCPrintSumDiff();
VOID Hv_Mw_PQ_LDCSetPatThr(UINT32 usThr);
VOID Hv_Mw_PQ_MhiInit();
VOID Hv_Mw_MhiSetPos(USHORT16 usStartX, USHORT16 usStartY, USHORT16 usWidth, USHORT16 usHeight);
UINT32* Hv_Mw_PQ_GetMhi16();

VOID Hv_Mw_PQ_PWM(VOID);
VOID Hv_Mw_PQ_GCLutExpand(USHORT16 *pusInput, UCHAR8 ucCnt);
VOID Hv_Mw_PQ_SetBrightRangeY(UCHAR8 ucCh, UCHAR8 ucRange);

#endif
