/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 *
 * $Author: robin.zhang $
 * $Date: 2015/12/04 $
 * $RCSfile: pe_if.h,v $
 * $Revision: #10 $
 *
 *---------------------------------------------------------------------------*/

/** @file nptv_if.h
 *  NPTV video path control, include  input source select ,
 *  timing information, and video quality control
 */

#ifndef _PE_IF_H_
#define _PE_IF_H_

#include "drv_hdmi2.h"
#include "util.h"
#include "drv_vga.h"
#include "drv_tvd.h"
#include "api_notify.h"
#include "u_drv_cust.h"
#include "drv_ycproc.h"
// Quality Item and Enumation
#include "pe_table.h"

#define PQ_OK                   0  ///< Success
#define PQ_NOT_OK              -1  ///< Not ok
#define PQ_NOT_SUPPORTED       -2  ///< Not support
#define PQ_PARAMETER_ERROR     -3  ///< Parameter error
#define PQ_DONT_CARE           -4  ///< Don't care
#define PQ_ERR_INV             -5  ///< Invalid argument passed
#define PQ_ERR_TIMEDOUT        -6  ///< Timeout occured
#define PQ_PARAMETER_NOCHANGE  -7  /// Paramenter no change

#define MJC_CTRL_EFCT_OFF		0x00            // MJC 1W1R (bypass)
#define MJC_CTRL_EFCT_LOW		0x40
#define MJC_CTRL_EFCT_MID		0x80
#define MJC_CTRL_EFCT_HIGH		0xff
#define MJC_CTRL_EFCT_MSK		0xff

#define HDR_TYPE                0x3
enum
{
    MJC_CTRL_INTP_OFF,
    MJC_CTRL_INTP_HFBK,
    MJC_CTRL_INTP_NORM
};
typedef enum
{
    VDP_ARG_MJC_EFFECT_OFF,
    VDP_ARG_MJC_EFFECT_LOW,
    VDP_ARG_MJC_EFFECT_MIDDLE,
    VDP_ARG_MJC_EFFECT_HIGH
} MJC_EFFECT_MODE;

typedef enum
{
    VDP_ARG_MJC_MODE_NORM,
    VDP_ARG_MJC_MODE_NO_DEBLUR,
    VDP_ARG_MJC_MODE_NO_FILM
} MJC_DEJUDDER_MODE;

typedef enum
{
    VDP_ARG_MJC_DEMO_ALL,
    VDP_ARG_MJC_DEMO_RIGHT,     // Enable Right, disable left
    VDP_ARG_MJC_DEMO_LEFT       // Enable left, disable right
} MJC_DEMO_MODE;

enum
{
    SV_COLOR_HDMI_sRGB,
	SV_COLOR_HDMI_Adobe_RGB,
	SV_COLOR_HDMI_sYCC,
    SV_COLOR_HDMI_xvYCC,
    SV_COLOR_HDMI_BT2020,
    SV_COLOR_HDMI_BT2020c,
    SV_COLOR_HDMI_Normal,
};

enum
{
    SV_COLOR_HDMI_Colorimetry_RGB,
    SV_COLOR_HDMI_Colorimetry_601,
    SV_COLOR_HDMI_Colorimetry_709,
    SV_COLOR_HDMI_Colorimetry_XVYCC601,
    SV_COLOR_HDMI_Colorimetry_XVYCC709,
    SV_COLOR_HDMI_Colorimetry_sYCC601,
	SV_COLOR_HDMI_Colorimetry_AdobeYCC601,
	SV_COLOR_HDMI_Colorimetry_AdobeRGB,
	SV_COLOR_HDMI_Colorimetry_BT2020,
	SV_COLOR_HDMI_Colorimetry_UnKnown
};

enum
{
    SV_HDR_TYPE_SDR,
    SV_HDR_TYPE_HDR1,
    SV_HDR_TYPE_HDR2,
    SV_HDR_TYPE_HDR3,
    SV_HDR_TYPE_UNKNOWN
};

typedef enum
{
	SV_VP9_HDR_TYPE_NONE,
	SV_VP9_HDR_TYPE_HDR1,	
	SV_VP9_HDR_TYPE_HDR2,
	SV_VP9_HDR_TYPE_HDR3,
}VP9_HDR_TYPE_E;

typedef enum
{
    SV_HDRTYPE_SDR,
    SV_HDRTYPE_HDR,
    SV_HDRTYPE_ST2084,
    SV_HDRTYPE_Future_EOTF,
    SV_HDRTYPE_UNKNOWN
}HDR_ETOF_MODE;

typedef struct _SV_HDR_INFO_T
{
    HDR_ETOF_MODE   eEOTF;
    UINT16          au2Primaries_x[3];
    UINT16          au2Primaries_y[3];
    UINT16          u2White_Point_x;
    UINT16          u2White_Point_y;
    UINT16          u2MinLuminance;
    UINT16          u2MaxLuminance;
    UINT16          u2ContentLevel;
    UINT16          u2FrameAverageLevel;
}SV_HDR_INFO_T;

#ifdef DRV_SUPPORT_EXTMJC

EXTERN INT32 d_custom_extmjc_set_ui(UINT8  ui2_level,
                                          UINT8  ui2_mode,
                                          UINT8  ui2_demo,
                                          UINT8* pui1_msg_error);

#define vMJCSetDemoMode(A, B, C)        d_custom_extmjc_set_ui(A, B, C, NULL)

#endif

enum
{
    PEQTY_APPLY_TIME_OUTPUT_VSYNC_ISR,
    PEQTY_APPLY_TIME_INPUT_VSYNC_ISR,        
    PEQTY_APPLY_TIME_MJC_INPUT_VSYNC_ISR,        
    PEQTY_APPLY_TIME_MJC_OUTPUT_VSYNC_ISR,
    PEQTY_APPLY_TIME_OD_VSYNC_ISR,
};

typedef enum {
    E_CUST_NO_EVEMT                 = 0,
    E_CUST_SOURCE_CHANGE            = (1<<0),
    E_CUST_SIGNAL_FMT_CHANGE        = (1<<1),
    E_CUST_PLANE_MUTE_CHANGE        = (1<<2),
    E_CUST_OUT_MUTE_CHANGE      	= (1<<3),
    E_CUST_OUT_POSI_CHANGE          = (1<<4),
    E_CUST_SRC_AREA_CHANGE          = (1<<5),
    E_CUST_SCALING_REQ_CHANGE       = (1<<6),
    E_CUST_BLUR_REQ_CHANGE          = (1<<7),
    E_CUST_MJC_FREQ_CHANGE          = (1<<8),
    E_CUST_OUT_FMT_CHANGE           = (1<<9),
    E_CUST_BORDER_PLN_REQ_CHANGE    = (1<<10),
    E_CUST_BL_POWER_LIMIT_CHANGE    = (1<<11),
    E_CUST_VDO_DELAY_CHANGE         = (1<<12),
    E_CUST_POWER_STATE_CHANGE       = (1<<13),
    E_CUST_SCREEN_SAVER_CHANGE      = (1<<14),
    E_CUST_AGING_MODE_CHANGE        = (1<<15),
    E_CUST_MUFFIN_SCALING_CHANGE    = (1<<16),
    E_CUST_TV_OUT_FMT_CHANGE        = (1<<17),
    E_CUST_OUT_SCALING_CHANGE       = (1<<18),
    E_CUST_OSD_STATE_CHANGE         = (1<<19),
    E_CUST_PIC_SETTING_CHANGE       = (1<<20),
    E_CUST_SCR_SETTING_CHANGE       = (1<<21),
    E_CUST_3D_SETTING_CHANGE        = (1<<22),
    E_CUST_ECO_SETTING_CHANGE       = (1<<23),
    E_CUST_PHOTO_SETTING_CHANGE     = (1<<24),
    E_CUST_DEMO_SETTING_CHANGE      = (1<<25),
    E_CUST_DEMO_OSD_MASK_CHANGE     = (1<<26),
    E_CUST_SERVICE_SETTING_CHANGE   = (1<<27),
    E_CUST_SERVICE_TRANS_START     	= (1<<28),
    E_CUST_SERVICE_VCOM_CHANGE      = (1<<28) + 1,
    E_CUST_UI_INPUT_TARGET_CHANGE   = (1<<28) + 2,
    E_CUST_WB_OFFSET_CHANGE         = (1<<28) + 3,
    E_CUST_SCR_MIRROR_CONFIG_CHANGE = (1<<28) + 4,
    E_CUST_BT_SETTING_CHANGE		= (1<<28) + 5,    
    E_CUST_LETTER_BOX_CHANGE		= (1<<28) + 6,
    E_CUST_PIC_CONTROL_STATE_CHANGE = (1<<28) + 7,
    #ifdef CC_SUPPORT_DOLBY_VISION
    E_CUST_RPU_NALU_UPDATE			= (1<<28) + 8,
    #endif
} E_CUST_EVENT;

#ifdef CC_MAPLE_CUST_DRV
extern UINT8 bIsMetaData;
#endif

//-----------------------------------------------------------------------------
//function Declare
//-----------------------------------------------------------------------------
/*****************************************************************************************/
/********************************   SYSTEM & DEBUG     ***********************************/
/*****************************************************************************************/
void vApiVideoPeInit(void);
void vApiApplyPQSetting(UINT8 bPath);
void vApiApplyVideoEvent(UINT8 bApplyTime);
void vApiRegisterVideoEvent(UINT8 bVdpArg, UINT8 bPath, UINT8 bOnOff);
void vApiRegisterVideoEventByApplyTime(UINT8 bVdpArg, UINT8 bPath, UINT8 bOnOff, UINT8 bApplyTime);
void vApiVideoDemoMode(UINT8 bmode, Region DemoRec, UINT8 bDEMOModules);
UINT8 bApiVideoProc(UINT8 u1VidPath, PE_ARG_TYPE u1UiItem);
UINT32 PE_SetArg(UCHAR ucVdpId, PE_ARG_TYPE ucArg, INT16 i2Value);
UINT32 PE_GetArg(UCHAR ucVdpId, PE_ARG_TYPE ucArg, INT16* pi2Value);
INT32 PE_SetPqInfo(UCHAR ucVdpId, UINT32 u4PqType, const void* pkvPqSetInfo, UINT32 u4Size);
INT32 PE_GetPqInfo(UCHAR ucVdpId, UINT32 u4PqType, void* pkvPqGetInfo, UINT32 u4Size);
UINT8 bApiGetPeUiDebugMode(void);
void vApiSetPeUiDebugMode(UINT8 bOnOff);
void DRVCUST_GetLcdimPanelOrder(UINT8 *u1PanelOrder, UINT8 u1BlockNum);
void DRVCUST_GetLcdimPanelDimGain(UINT8 *u1PanelDimGain, UINT8 u1BlockNum);

/*****************************************************************************************/
/********************************   QUALITY TABLE    ***********************************/
/*****************************************************************************************/
void PE_InitUiRange(void);
void PE_SetUiPicMode(UINT8 u1PicMode);
void PE_SetUiRange(UINT8 u1VdpVisType, PE_ARG_TYPE ucArgType, PE_UI_RANGE_T *prUiRange);
UINT32 PE_GetUiRange(UINT8 u1VidPath, PE_ARG_TYPE ucArgType, PE_UI_RANGE_T *prUiRange);

void bApiSetPWMDft(void);
void bApiParseCustomQtyItem(void);
UINT8 bApiSetQtyDft(UINT8 u1SrcTypTmg, UINT32 u4UiItem, UINT16 u2Value);
UINT8 bApiGetCustomSourceTypeTiming(UINT8 bSrcTypTmg);
UINT8 u1ApiVidInSrcType2VisType(UINT8 u1SrcTypTmg);
UINT8 bApiGetQtyDft(UINT16 wSearchItem, UINT8 bQtyIdx);
UINT8 bApiGetQtyMin(UINT16 u2QtyItem);
UINT8 bApiGetQtyMax(UINT16 u2QtyItem);
UINT16 bApiQtyMapping(UINT8 u1QtyIndex, UINT16 u2QtyItem,
                     INT16 const i2Min, INT16 const i2Max,
                     INT16 const i2Dft, INT16 const i2Cur);

/*****************************************************************************************/
/************************************   FLASHPQ    *************************************/
/*****************************************************************************************/
void vApiFlashPqReadFlash(UINT8 bIndex, UINT64 u8Offset, UINT32 u4MemPtr, UINT32 u4MemLen);
void vApiFlashPqSetGammaId(UINT8 bIndex);
void vApiFlashPqSetSmartPicId(UINT8 bIndex);
void vApiFlashPqSetSceId(UINT8 bIndex);
void vApiFlashPqSetOdId(UINT8 bIndex);
UINT8 * bApiFlashPqGetVersion(UINT8 bIndex, UINT8 bType);
UINT8 bApiFlashPqGetVersionLength(UINT8 bIndex, UINT8 bType);
UINT8 bApiFlashPqVerifyHeader(UINT8 bIndex);
UINT8 vApiFlashPqGetSmartPicId(void);
UINT8 bApiFlashPqUpdateGamma(void);
UINT8 bApiFlashPqUpdateSCE(void);
UINT8 bApiFlashPqUpdateQtyDft(UINT8 bIndex);
UINT8 bApiFlashPqUpdateQtyMinMax(UINT8 u1VidPath, UINT8 bIndex);
UINT8 bApiFlashPqUpdateOD(void);
UINT8 bApiFlashPqUpdatePanelTable(void);
UINT16 vApiFlashPqGetGammaId(void);
UINT16 vApiFlashPqGetSceId(void);
UINT8 bApiFlashPqRawDataInit(void);
UINT16 u2ApiFlashPqGetRawDataTblId(void);
UINT16 u2ApiFlashPqGetRawDataCaseId(void);
void vApiFlashPqSetRawDataTblId(UINT16 u2Index);
void vApiFlashPqSetRawDataCaseId(UINT16 u2Index);
UINT8 bApiFlashPqUpdateRawDataEx(UINT16 u2TblId, UINT16 u2CaseId);
UINT8 bApiFlashPqGetRawDataInfo(RAWDATA_INFO* pstInfo);
UINT8 bApiFlashPqGetRawDataInfo_SMT(UINT16 u2TblId, UINT16 u2CaseId, RAWDATA_INFO* pstInfo);
UINT8 bApiFlashPqUpdateRawData(void);
UINT8 bApiFlashPqUpdateRawData_SMT(UINT16 u2TblId, UINT16 u2CaseId, UINT32 **pRegTbl, UINT8 **pDataTbl);
UINT8 bApiFlashPqSetRawData(UINT16 u2RegNum, UINT32 *pRegTbl, UINT8* pDataTbl);
UINT8 bApiFlashPqIsSupportSCEbySource(UINT8 index);
UINT16 wApiFlashPqGetSceIndexBySrcTiming(UINT16 u1SrcTypTmg);
UINT8 uApiFlashPqGetSceSrcNum(UINT8 index);
//void vApiFlashPqSetTiming(UINT8 u1TypeTiming);
UINT16 vApiFlashPqGetMinSceId(void);
UINT16 vApiFlashPqGetQtyId(UINT8 bIndex) ;
UINT16 vApiFlashPqGetOdId(void);
UINT16 wApiFlashPqGetPanelId(void);
UINT8 bApiFlashPqSystemInfo(void);
#ifdef CC_ENABLE_MTK_MODEL_INDEX
UINT16 vApiFlashaqGetQtyId(UINT8 bIndex);
#endif

/*****************************************************************************************/
/*****************************    CUSTOMER DRIVER    *************************************/
/*****************************************************************************************/
void DRVCUST_AutoColorTempUpdate(AUTO_COLORTEMP_SETS_INFO_T *aCTInfo);
void DRVCUST_PANEL_GAMMA_REMAP(UINT32 u4GammaSel);
void DRVCUST_PanelGammaRemapProc(void);
void DRVCUST_SET_GAMMA(void);
void DRVCUST_SetGammaRemapForceLoad(UINT8 bForceLoadGamma);
UINT8 DRVCUST_EepromReadByte(UINT16 waddr);
BOOL DRVCUST_EepromWriteByte(UINT16 waddr, UINT8 u1Data);
#ifdef CC_S_PLATFORM
UINT8 DRVCUST_DoubleEepromWrite(UINT64 u8Offset, UINT32 u4MemPtr, UINT32 u4MemLen);
#endif
UINT8 DRVCUST_AutoNRDefSet(void);
UINT8 DRVCUST_NoiseLevel(void);
UINT32 DRVCUST_RGBOfstRemap(UINT32 u4Value);
void DRVCUST_SetODTable(void);
BOOL DRVCUST_GetDVMMPInputFlag(void);
void DRVCUST_SET_MAUNAL_GAMMA(INT32 i4GammaCtrlPts[3][11]);
void DRVCUST_SendEvent(E_CUST_EVENT eCustEvent, UINT8 u1Option);
void DRVCUST_SendEcsCommand(UINT8* pData, UINT32 u4Size);
void DRVCUST_SetBEGeneralData(UINT8* pData, UINT8 u1Size);
void DRVCUST_PanelPowerStateToBe(BOOL bOnOff);
UINT8 DRVCUST_GET_CTMode(void);
UINT8 DRVCUST_GetPathByBeHandle(UINT8 u4BeHandle);
UINT8 DRVCUST_BE_Connect(UINT8 u1TxPath, UINT8 u1BeSclType , UINT8 u1PlaneOrder, UINT8 bPath);
UINT8 DRVCUST_BE_Disconnect(UINT8 u1TxPath, UINT8 bPath);
void DRVCUST_PQ_Associate(UINT8 bPqPath, UINT8 bPath);
void DRVCUST_PQ_Disassociate(UINT8 bPqPath);

BOOL DRVCUST_HDMIWithValidAviInfo(void);
BOOL DRVCUST_HDMIIsPhotoMode(void);
UINT8 DRVCUST_HDMIGetVideoColorSpace(void);
UINT8 DRVCUST_HDMIGetPhotoColorSpace(void);
UINT8 DRVCUST_HDMIGetColorimetry(void);
UINT8 DRVCUST_HDMIGetAspectRatio(void);
UINT8 DRVCUST_HDMIGetSDHDRange(UINT8 u1Type);
void DRVCUST_SharpnessEnhanceEn(UINT8 u1Onoff);
#ifdef CC_MAPLE_CUST_DRV
UINT8 DRVCUST_GetSrsStatus(void);
void DRVCUST_SRSOnOff(UINT8 u1Onoff);
void DRVCUST_SetVideoRange(UINT8 bMode);
UINT8 DRVCUST_GetVideoRange(UINT8 bPath);
UINT8 DRVCUST_HDMIGetHDRType(UINT8 bPath);
UINT8 DRVCUST_MMGetHDRType(UINT8 bPath);
UINT8 DRVCUST_GetIsPIP(void);
UINT8 DRVCUST_GetIsSmallWindow(void);

UINT8 DRVCUST_GetVP9HDRType(void);
UINT8 DRVCUST_HDMIGetVideoColorSpace(void);
UINT8 DRVCUST_MMGetColorSpace(UINT8 bPath);
void DRVCUST_SetOSDHDRMatrixCoeff(void);
void DRVCUST_Resume(void);
#endif
void DRVCUST_SharpnessEnhanceCFGInit(void);
UINT16 DRVCUST_QtyUIMapping(UINT8 u1SrcTypTmg, UINT16 u2QtyItem, INT32 i4UiRangeMin, INT32 i4UiRangeDft,INT32 i4UiRangeMax,INT16 i2Min, INT16 i2Max, INT16 i2Dft, INT16 i2Cur);
UINT8 DRVCUST_GetCustomSourceTypeTiming(UINT8 bCustomSrcTypTmg);
#ifdef CC_S_PLATFORM
UINT8 DRVCUST_GetUISmartPicId(void);
#endif

#ifdef PHILIPS_D_INTERFACE_SUPPORT
void DRVCUST_PQBBeforeSocOutputChang(void);
void DRVCUST_PQBAfterSocOutputChanged(UINT32 u4OutputHeigt,UINT32 u4OutputWidth,UINT8 u4OutputFrameRate);
#endif

void DRVCUST_SetMacbethOnOff(UINT8 bOnoff, UINT16 u2Ylvl, UINT16 u2Ulvl, UINT16 u2Vlvl);
void DRVCUST_SetPGAM_EN(UINT8 bOnoff);
void DRVCUST_SetUWBFLAT(UINT8 bOnoff);
UINT8 DRVCUST_EepromReadByte(UINT16 waddr);


// Dynamic Backlight / Customer Backlight Driver
void DRVCUST_AutoBacklightUpdate(AUTO_BACKLIGHT_SETS_INFO_T *aBLight);
void DRVCUST_UpdateBacklightState(UINT8 u1State, UINT16 u2Duty);
void DRVCUST_SetBacklightDuty(UINT8 u1RefIndex, UINT16 u2Duty);
void DRVCUST_AdaptiveBacklightParam(UINT8 bMode);
void DRVCUST_AdaptiveBacklightInit(void);
void DRVCUST_AdaptiveBacklightProc(void);

/*****************************************************************************************/
/*********************************      NR     *****************************************/
/*****************************************************************************************/
void vApiVideo3DNROnOff(UINT8 bOnOff);
void vApiVideoNRTIIROnOff(UINT8 bOnOff);
void vApiVideoSRMNRYCOnOff(UINT8 bYOnOff, UINT8 bCOnOff);
void vApiVideo2DNROnOff(UINT8 bOnOff);
void vApiVideoMPEGNROnOff(UINT8 bOnOff);

/*****************************************************************************************/
/************************************  SHARPNESS  *****************************************/
/*****************************************************************************************/
void vHalVideoSharpnessOnOff(UINT8 bPath, UINT8 bOnOff);
void vHalVideoSharpnessHorizontalOnOff(UINT8 bPath, UINT8 bOnOff);
void vHalVideoSharpnessVerticalOnOff(UINT8 bPath, UINT8 bOnOff);
void vHalVideoSharpnessDiagonalOnOff(UINT8 bPath, UINT8 bOnOff);
void vHalVideoLTIOnOff(UINT8 u1VidPath, UINT8 bOnOff);
void vHalVideoLTIParam(UINT8 u1VidPath);
void vHalVideoSharpnessParam(UINT8 bPath);
void vHalVideoSharpnessParamHorizontal(UINT8 bPath);
void vHalVideoSharpnessParamVertical(UINT8 bPath);
void vHalVideoSharpnessParamDiagonal(UINT8 bPath);
void vHalVideoLTIParam(UINT8 u1VidPath);
void vHalVideoSuperResolutionOnOff(UINT8 bPath, UINT8 bOnOff);
void vHalVideoIRRParam(void);
void vHalVideoFreqAnalyzeParam(void);
/*****************************************************************************************/
/********************************  ADAPTIVE LUMA    **************************************/
/*****************************************************************************************/
void vHalVideoAdaptiveLumaOnOff(UINT8 bPath, UINT8 bOnOff);
void vHalVideoAdaptiveLumaParam(void);

/*****************************************************************************************/
/********************************  LOCAL DIMMING    **************************************/
/*****************************************************************************************/
void vHalVideoLcDimOnOff(UINT8 bPath, UINT8 bOnOff);

/*****************************************************************************************/
/******************   CONTRAST BRIGHTNESS SATURATION HUE**********************************/
/*****************************************************************************************/
void vHalVideoContrast(UINT8 bPath, UINT16 u2Value);
void vHalVideoBrightness(UINT8 bPath, UINT8 bValue);
void vHalVideoSaturation(UINT8 bPath, UINT16 u2Value);
void vHalVideoHue(UINT8 bPath, UINT8 bValue);

/*****************************************************************************************/
/*************************************   SCE   *******************************************/
/*****************************************************************************************/
void vHalVideoSCEOnOff(UINT8 bPath);
void vHalSetSCEPat(UINT8 bOnOff, UINT16 wYdata);
void vHalSetSCEAngular(UINT8 bmodule, UINT8 bColor, UINT8 bValue);
void vHalSetColorFilter(UINT8 bPath, UINT8 bColor, UINT8 bOnOff);

/*****************************************************************************************/
/************************************   CTI  *******************************************/
/*****************************************************************************************/
void vHalVideoCTIOnOff(UINT8 bPath, UINT8 bOnOff);
void vHalVideoCTIParam(UINT8 bPath);

/*****************************************************************************************/
/*******************************   RGB GAIN  & OFFSET ************************************/
/*****************************************************************************************/
void vHalVideoRGBGain(UINT8 bPath, UINT8 bRGB, UINT16 wValue);
void vHalVideoRGBOffset(UINT8 bPath, UINT8 bRGB, UINT16 wValue);
void vHalVideoRGBOffset2(UINT8 bPath, UINT8 bRGB, UINT16 wValue);

/**************************************************************************************/
/***********************************Bypass All PQ Item****************************************/
/**************************************************************************************/
void vApiVideoAllPQItemOnOff(UINT8 bOnOff);

/*****************************************************************************************/
/************************************  Gamma  ********************************************/
/*****************************************************************************************/
void vHalVideoGammaLoadTable(void);
void vHalVideoGammaLoadTableEX(void);
void vHalVideoGammaTblUpdate(UINT8 u1Mode);
void vHalVideoExternalGammaInit(void);
void vApiGammaInit(void);

/*****************************************************************************************/
/************************************  Noise Reduction  **********************************/
/*****************************************************************************************/
void vHalVideo2DAutoNROnOff(UINT8 bOnOff);
void vHalVideo3DAutoNROnOff(UINT8 bOnOff);
void vHalVideo2DNRParam(UINT8 bCurUI);
void vHalVideo3DNRParam(UINT8 bCurUI);
void vHalVideo3DNRStrength(UINT8 u1CurUI);
void vHalVideoMPEGNRParam(UINT8 bCurUI);

/*****************************************************************************************/
/***************************************  White Peak  ************************************/
/*****************************************************************************************/
void vHalVideoWhitePeakLimit(UINT8 bOnOff);

/*****************************************************************************************/
/************************************  Adaptive Backlight  *******************************/
/*****************************************************************************************/
void vHalSetAdpBacklight(UINT8 u1Level, UINT8 u1Value);
UINT8 bHalGetAdpBacklight(UINT8 u1Level);

void vHalOutRGBColorOnOff(UINT8 bOnOff);
void vHalOutRGBColor(UINT8 RValue, UINT8 GValue, UINT8 BValue);

/*****************************************************************************************/
/********************************** BLUE STRETCH  ****************************************/
/*****************************************************************************************/
void vHalVideoBlueStretchOnOff(UINT8 bPath, UINT8 bOnOff);
/******************************************************************************************/
/****************************************  LED Motion  **************************************/
/******************************************************************************************/
void vHalVideoLEDMotion(UINT8 OnOff);
BOOL DRVCUST_GetLEDMotionFlag(void);

/*****************************************************************************************/
/********************************** Demo Mode Region  ****************************************/
/*****************************************************************************************/
UINT32 DRVCUST_DemoRegion(void);
UINT32 DRVCUST_DemoModule(void);
INT32 PE_SetIMTFlag(UINT32 ucVdpId,UINT32 prData);

BOOL vDrvGetHDRCapabilities(UINT32* u4OutNumTypes, UINT32* u4Types, UINT32* u4maxLuminance, UINT32* u4maxAverageLuminance, UINT32* u4minLuminance );
#endif /* _PE_IF_H_ */

