/**
 * @file hv_app_Function.c
 * @brief osd app function c file.
 * @details This file provides the following functions: \n
 *          (1) Osd operation functions \n
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-09-01
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author                       <th>Date            <th>Change Description
 * <tr><td>HiView SoC Software Team     <td>2022-09-01      <td>create
 * </table>
 */

#include "hv_app_Osd.h"
#include "hv_app_OsdDialog.h"
#include "hv_app_OsdMenu.h"
#include "hv_app_Function.h"
#include "hv_app_PQ.h"

#include "hv_comm_DataBase.h"
#include "PanelConfig.h"

#include "hv_mw_AppInterface.h"
#include "hv_mw_OsdLog.h"
#include "hv_mw_OsdComm.h"
#include "hv_mw_OsdOperation.h"
#include "hv_drv_OsdTypes.h"
#include "hv_comm_DataType.h"

USHORT16 Hv_App_GetDisplayMode(VOID)
{
    return HV_COMMON_DATABASE_GET(UserData, ucOsdDisplayMode);
}

VOID Hv_App_SetDisplayMode(USHORT16 usMode, UCHAR8 ucSetFlag)
{
    HV_ASSERT_TRUE_VOID(usMode <= USERDATA_DISPLAY_MODE_MAX);
    UCHAR8 ucBrightness = HV_COMMON_DATABASE_GET_STARRAY(UserData, stDisplayMode, usMode, ucBrightness);
    UCHAR8 ucContrast = HV_COMMON_DATABASE_GET_STARRAY(UserData, stDisplayMode, usMode, ucContrast);

    HV_COMMON_DATABASE_SET(UserData, ucOsdDisplayMode, usMode);

    if (ucSetFlag & SET_RELATED)
    {
        Hv_App_OsdSetUserdata(E_USERDATA_BRIGHTNESS, GET_OSD_MAP_VALUE(E_USERDATA_BRIGHTNESS, ucBrightness));
        Hv_App_OsdSetUserdata(E_USERDATA_CONTRAST, GET_OSD_MAP_VALUE(E_USERDATA_CONTRAST, ucContrast));
    }
    if (ucSetFlag & SET_INTERFACE)
    {
        Hv_App_PQ_SetBrightness(ucBrightness);
        Hv_App_PQ_SetContrast(ucContrast);
    }
}

VOID Hv_App_SetFuncInterface(UserdataId enWhichData, SHORT16 sOsdValue, UCHAR8 ucFlag)
{
    OSD_LOG_DEBUG("Set userdata[%d] %s = %d, flag = 0x%x", enWhichData, Hv_App_GetUserdataName(enWhichData), sOsdValue, ucFlag);

    if (ucFlag & SET_OSDDATA)
    {
        Hv_App_OsdSetUserdata(enWhichData, sOsdValue);
    }

    if (0 == (ucFlag & (SET_INTERFACE | SET_RELATED)))
    {
        return;
    }

    SHORT16 sRealValue = GET_REAL_MAP_VALUE(enWhichData, sOsdValue);

    switch (enWhichData)
    {
        case E_USERDATA_VIDEO_SOURCE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                HV_COMMON_DATABASE_SET(UserData, ucVideoSource, sRealValue);
                Hv_Mw_Video_SetMainVideoSource(sRealValue);
            }
            break;
        }

        case E_USERDATA_BRIGHTNESS:
        {
            if (ucFlag & SET_RELATED)
            {
                USHORT16 usMode = Hv_App_GetOsdDataValue(E_USERDATA_DISPLAY_MODE);
                HV_COMMON_DATABASE_SET_STARRAY(UserData, stDisplayMode, usMode, ucBrightness, sRealValue);
            }
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetBrightness(sRealValue);
            }
            break;
        }

        case E_USERDATA_BLACK_LEVEL:
        {
            if (ucFlag & SET_RELATED)
            {
                HV_COMMON_DATABASE_SET(UserData, ucBlackLevelBackup, sRealValue);
                if (0 != sOsdValue)
                {
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_VARIABLEBACKLIGHT)
                    SHORT16 sRealVariableBackLight = GET_REAL_MAP_VALUE(E_USERDATA_VARIABLE_BACK_LIGHT, UD_VARIABLE_BACK_LIGHT_V_OFF);
                    Hv_App_OsdSetUserdata(E_USERDATA_VARIABLE_BACK_LIGHT, UD_VARIABLE_BACK_LIGHT_V_OFF);
                    HV_COMMON_DATABASE_SET(UserData, bVariableBackLight, sRealVariableBackLight);
                    #if (HV_CONFIG_ON == HV_PROJECT_CONFIG_FULL_LOCALDIMMING)
                    Hv_App_PQ_LdcSetMode(sRealVariableBackLight);
                    #else
                    Hv_App_PQ_SetDCR(sRealVariableBackLight);
                    #endif
#endif
                }
            }
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetBlackLevel(sRealValue);
            }
            break;
        }

        case E_USERDATA_CONTRAST:
        {
            if (ucFlag & SET_RELATED)
            {
                USHORT16 usMode = Hv_App_GetOsdDataValue(E_USERDATA_DISPLAY_MODE);
                HV_COMMON_DATABASE_SET_STARRAY(UserData, stDisplayMode, usMode, ucContrast, sRealValue);
            }
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetContrast(sRealValue);
            }
            break;
        }

#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_VARIABLEBACKLIGHT)
        case E_USERDATA_VARIABLE_BACK_LIGHT:
        {

            if (ucFlag & SET_RELATED)
            {
                if (UD_VARIABLE_BACK_LIGHT_V_OFF != sOsdValue)
                {
                    Hv_App_OsdSetUserdata(E_USERDATA_BLACK_LEVEL, 0);
                    Hv_App_PQ_SetBlackLevel(0);
                    Hv_App_OsdSetUserdata(E_USERDATA_CONTRAST, 50);
                    Hv_App_PQ_SetContrast(50);
                }
                else
                {
                    SHORT16 sBlackLevelValue = HV_COMMON_DATABASE_GET(UserData, ucBlackLevelBackup);
                    Hv_App_OsdSetUserdata(E_USERDATA_BLACK_LEVEL, GET_OSD_MAP_VALUE(E_USERDATA_BLACK_LEVEL, sBlackLevelValue));
                    Hv_App_PQ_SetBlackLevel(sBlackLevelValue);

                    USHORT16 usMode = Hv_App_GetOsdDataValue(E_USERDATA_DISPLAY_MODE);
                    SHORT16 sContrastRealValue = HV_COMMON_DATABASE_GET_STARRAY(UserData, stDisplayMode, usMode, ucContrast);
                    Hv_App_OsdSetUserdata(E_USERDATA_CONTRAST, GET_OSD_MAP_VALUE(E_USERDATA_CONTRAST, sContrastRealValue));
                    Hv_App_PQ_SetContrast(sContrastRealValue);
                }
            }
            if (ucFlag & SET_INTERFACE)
            {
                //Hv_App_PQ_DynamicBacklight(sRealValue);
                #if (HV_CONFIG_ON == HV_PROJECT_CONFIG_FULL_LOCALDIMMING)
                Hv_App_PQ_LdcSetMode(sRealValue);
                #else
                Hv_App_PQ_SetDCR(sRealValue);
                #endif
            }
            break;
        }
#endif

        case E_USERDATA_GAMMA:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetGamma(sRealValue);
            }
            break;
        }

        case E_USERDATA_DISPLAY_MODE:
        {
            Hv_App_SetDisplayMode(sRealValue, ucFlag);
            break;
        }

        case E_USERDATA_COLOR_TEMP:
        {
            if (ucFlag & SET_INTERFACE)
            {
                UCHAR8 ucLowBlueLight = Hv_App_GetOsdDataValue(E_USERDATA_LOW_BLUE_LIGHT);
                Hv_App_PQ_SetColorTemp(sRealValue, GET_REAL_MAP_VALUE(E_USERDATA_LOW_BLUE_LIGHT, ucLowBlueLight));
            }
            break;
        }

        case E_USERDATA_RED:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetRGain(sRealValue);
            }
            break;
        }

        case E_USERDATA_GREEN:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetGGain(sRealValue);
            }
            break;
        }

        case E_USERDATA_BLUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetBGain(sRealValue);
            }
            break;
        }

        case E_USERDATA_LOW_BLUE_LIGHT:
        {
            if (ucFlag & SET_INTERFACE)
            {
                UCHAR8 ucColorTemp = Hv_App_GetOsdDataValue(E_USERDATA_COLOR_TEMP);
                Hv_App_PQ_SetColorTemp(GET_REAL_MAP_VALUE(E_USERDATA_COLOR_TEMP, ucColorTemp), sRealValue);
            }
            break;
        }

        case E_USERDATA_HUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetHue(sRealValue);
            }
            break;
        }

        case E_USERDATA_SATURATION:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetSaturation(sRealValue);
            }
            break;
        }

        case E_USERDATA_COLOR_SPACE:
        {
            if (ucFlag & SET_RELATED)
            {
#if (HV_PROJECT_CONFIG_COLOR_FILTER == HV_CONFIG_ON)
                Hv_App_OsdSetUserdata(E_USERDATA_COLOR_FILTER, UD_COLOR_FILTER_V_NONE);
                HV_COMMON_DATABASE_SET(UserData, ucColorFilter, GET_REAL_MAP_VALUE(E_USERDATA_COLOR_FILTER, UD_COLOR_FILTER_V_NONE));
                Hv_App_PQ_SetColorFilterType(GET_REAL_MAP_VALUE(E_USERDATA_COLOR_FILTER, UD_COLOR_FILTER_V_NONE));
#endif
            }
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetGamut(sRealValue);
            }
            break;
        }

        case E_USERDATA_SHARPNESS:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetSharpness(sRealValue);
            }
            break;
        }

        case E_USERDATA_RESPONSE_TIME:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetODLevel(sRealValue);
            }
            break;
        }

        case E_USERDATA_DISPLAY_SIZE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                HV_COMMON_DATABASE_SET(UserData, ucProportion, sRealValue);
                Hv_Mw_Video_SetAspectRatio(sRealValue);
            }
            break;
        }

        case E_USERDATA_MUTE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                HV_COMMON_DATABASE_SET(UserData, bMute, sRealValue);
                if (UD_MUTE_V_OFF == sOsdValue)
                {
                    Hv_Mw_Audio_UIUnMute();
                }
                else
                {
                    Hv_Mw_Audio_UIMute();
                }
            }
            break;
        }

        case E_USERDATA_VOLUME:
        {
            if (ucFlag & SET_RELATED)
            {
                Hv_App_OsdSetUserdata(E_USERDATA_MUTE, UD_MUTE_V_OFF);
            }
            if (ucFlag & SET_INTERFACE)
            {
                HV_COMMON_DATABASE_SET(UserData, bMute, GET_REAL_MAP_VALUE(E_USERDATA_MUTE, UD_MUTE_V_OFF));
                Hv_Mw_Audio_UIUnMute();
                HV_COMMON_DATABASE_SET(UserData, ucVolume, sRealValue);
                Hv_Mw_Audio_SetVolume(sRealValue);
            }
            break;
        }

#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_MPRT)
        case E_USERDATA_MPRT:
        {
            if (ucFlag & SET_INTERFACE)
            {
                //Hv_Mw_Video_SetOutMprtPwmEnable(sRealValue);
                HV_COMMON_DATABASE_SET(UserData, ucMprt, sRealValue);
                Hv_Drv_MPRT_SetOutMprtPwmEnable(sRealValue);
            }
            break;
        }
#endif

        case E_USERDATA_LANGUAGE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetLanguage(sRealValue);
            }
            break;
        }

        case E_USERDATA_MENU_HPOS:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetMenuPostion(HV_TRUE, sRealValue);
            }
            break;
        }

        case E_USERDATA_MENU_VPOS:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetMenuPostion(HV_FALSE, sRealValue);
            }
            break;
        }

        case E_USERDATA_OSD_TRANS:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetTrans(sRealValue);
            }
            break;
        }

        case E_USERDATA_OSD_TIME:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetMenuTime(sRealValue);
            }
            break;
        }

        case E_USERDATA_ROTATION:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetRotateType(sRealValue);
            }
            break;
        }

#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_FREESYNC)
        case E_USERDATA_FREESYNC:
        {
            if (ucFlag & SET_RELATED)
            {
                if (UD_FREESYNC_V_OFF != sOsdValue)
                {
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_MPRT)
                    Hv_App_OsdSetUserdata(E_USERDATA_MPRT, UD_MPRT_V_OFF);
                    HV_COMMON_DATABASE_SET(UserData, ucMprt, GET_REAL_MAP_VALUE(E_USERDATA_MPRT, UD_MPRT_V_OFF));
                    Hv_Drv_MPRT_SetOutMprtPwmEnable(GET_REAL_MAP_VALUE(E_USERDATA_MPRT, UD_MPRT_V_OFF));
                    //Hv_Mw_Video_SetOutMprtPwmEnable(GET_REAL_MAP_VALUE(E_USERDATA_MPRT, UD_MPRT_V_OFF));
#endif
                }
            }
            if (ucFlag & SET_INTERFACE)
            {
                HV_COMMON_DATABASE_SET(UserData, ucFreeSync, sRealValue);
                Hv_Mw_Video_SetFreeSyncSwitch(sRealValue);
            }
            break;
        }
#endif
        
        case E_USERDATA_CROSSHAIR:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetCrosshair(sRealValue);
            }
            break;
        }
        
        case E_USERDATA_REFRESH_RATE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetFrameRateShow(sRealValue);
            }
            break;
        }
        
        case E_USERDATA_TIMER_COUNTER:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetTimerCounterShow(sRealValue);
            }
            break;
        }
        
        case E_USERDATA_POWER_LED:
        {
            if (ucFlag & SET_INTERFACE)
            {
                HV_COMMON_DATABASE_SET(UserData, ucLedMode, sRealValue);
                Hv_Mw_Led_SetRedLed(sRealValue);
            }
            break;
        }
        
        case E_USERDATA_CUSTOM_KEY1:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetCustomKey(1, sRealValue);
            }
            break;
        }
        
        case E_USERDATA_CUSTOM_KEY2:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetCustomKey(2, sRealValue);
            }
            break;
        }
        
        case E_USERDATA_CUSTOM_KEY3:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetCustomKey(3, sRealValue);
            }
            break;
        }

        case E_USERDATA_LIGHT_MODE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetLightMode(sRealValue);
            }
            break;
        }

        case E_USERDATA_STEADY_COLOR:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetLightColorSelect(sRealValue);
            }
            break;
        }

        case E_USERDATA_BREATHE_COLOR:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetLightColorSelect(sRealValue);
            }
            break;
        }

        case E_USERDATA_MARQUEEIN_COLOR:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetLightColorSelect(sRealValue);
            }
            break;
        }

        case E_USERDATA_MARQUEEOUT_COLOR:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_OsdSetLightColorSelect(sRealValue);
            }
            break;
        }
        
        case E_USERDATA_R_HUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMHue(PQ_CM_R, sRealValue);
            }
            break;
        }
        case E_USERDATA_G_HUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMHue(PQ_CM_G, sRealValue);
            }
            break;
        }
        case E_USERDATA_B_HUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMHue(PQ_CM_B, sRealValue);
            }
            break;
        }
        case E_USERDATA_Y_HUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMHue(PQ_CM_Y, sRealValue);
            }
            break;
        }
        case E_USERDATA_M_HUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMHue(PQ_CM_M, sRealValue);
            }
            break;
        }
        case E_USERDATA_C_HUE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMHue(PQ_CM_C, sRealValue);
            }
            break;
        }

        case E_USERDATA_R_SATURATE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMSat(PQ_CM_R, sRealValue);
            }
            break;
        }
        case E_USERDATA_G_SATURATE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMSat(PQ_CM_G, sRealValue);
            }
            break;
        }
        case E_USERDATA_B_SATURATE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMSat(PQ_CM_B, sRealValue);
            }
            break;
        }
        case E_USERDATA_Y_SATURATE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMSat(PQ_CM_Y, sRealValue);
            }
            break;
        }
        case E_USERDATA_M_SATURATE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMSat(PQ_CM_M, sRealValue);
            }
            break;
        }
        case E_USERDATA_C_SATURATE:
        {
            if (ucFlag & SET_INTERFACE)
            {
                Hv_App_PQ_SetCMSat(PQ_CM_C, sRealValue);
            }
            break;
        }


#if 0
        case E_USERDATA_VARIABLE_BACKLIGHT:
        {
            if (ucFlag & SET_RELATED)
            {
                if (UD_VARIABLE_BACKLIGHT_OFF == sOsdValue)
                {
                    UCHAR8 ucDisplayMode = Hv_App_GetOsdDataValue(E_USERDATA_DISPLAY_MODE);
                    Hv_App_SetDisplayMode(ucDisplayMode, ucFlag);
                }
            }
            if (ucFlag & SET_INTERFACE)
            {
                //Hv_App_PQ_SetDCR(sRealValue);
            }
            break;
        }
#endif

        default:
        {
            break;
        }
    }
}

VOID Hv_App_GetRealValue(UserdataId enWhichData, SHORT16 *psRealValue, SHORT16 *psRealDefaultValue)
{
    const UserDataDBRegion *pstDefaultData = Hv_Mw_DataBase_GetDefaultUserDataPtr();

    switch (enWhichData)
    {
        case E_USERDATA_VIDEO_SOURCE:
        {
            *psRealValue = HV_COMMON_DATABASE_GET(UserData, ucVideoSource); //Hv_Mw_Video_GetMainVideoSource();
            *psRealDefaultValue = pstDefaultData->ucVideoSource;
            break;
        }

        case E_USERDATA_BRIGHTNESS:
        {
            *psRealValue = Hv_App_PQ_GetBrightness();
            *psRealDefaultValue = pstDefaultData->ucBrightness;
            break;
        }

        case E_USERDATA_BLACK_LEVEL:
        {
            *psRealValue = Hv_App_PQ_GetBlackLevel();
            *psRealDefaultValue = pstDefaultData->ucBlackLevel;
            break;
        }

        case E_USERDATA_CONTRAST:
        {
            *psRealValue = Hv_App_PQ_GetContrast();
            *psRealDefaultValue = pstDefaultData->ucContrast;
            break;
        }

#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_VARIABLEBACKLIGHT)
        case E_USERDATA_VARIABLE_BACK_LIGHT:
        {
            *psRealValue = Hv_App_PQ_GetDCR();
            *psRealDefaultValue = pstDefaultData->bVariableBackLight;
            break;
        }
#endif

        case E_USERDATA_GAMMA:
        {
            *psRealValue = Hv_App_PQ_GetGamma();
            *psRealDefaultValue = pstDefaultData->ucGamma;
            break;
        }

        case E_USERDATA_DISPLAY_MODE:
        {
            *psRealValue = Hv_App_GetDisplayMode();
            *psRealDefaultValue = pstDefaultData->ucOsdDisplayMode;
            break;
        }

        case E_USERDATA_COLOR_TEMP:
        {
            *psRealValue = Hv_App_PQ_GetColorTemp();
            *psRealDefaultValue = pstDefaultData->ucColorTemperature;
            break;
        }

        case E_USERDATA_RED:
        {
            *psRealValue = Hv_App_PQ_GetRGain();
            *psRealDefaultValue = pstDefaultData->ucRed;
            break;
        }

        case E_USERDATA_GREEN:
        {
            *psRealValue = Hv_App_PQ_GetGGain();
            *psRealDefaultValue = pstDefaultData->ucGreen;
            break;
        }

        case E_USERDATA_BLUE:
        {
            *psRealValue = Hv_App_PQ_GetBGain();
            *psRealDefaultValue = pstDefaultData->ucBlue;
            break;
        }

        case E_USERDATA_LOW_BLUE_LIGHT:
        {
            *psRealValue = Hv_App_PQ_GetLowBlueLight();
            *psRealDefaultValue = pstDefaultData->ucLowBlueLight;
            break;
        }

        case E_USERDATA_HUE:
        {
            *psRealValue = Hv_App_PQ_GetHue();
            *psRealDefaultValue = pstDefaultData->ucHue;
            break;
        }

        case E_USERDATA_SATURATION:
        {
            *psRealValue = Hv_App_PQ_GetSaturation();
            *psRealDefaultValue = pstDefaultData->ucSaturation;
            break;
        }

        case E_USERDATA_COLOR_SPACE:
        {
            *psRealValue = Hv_App_PQ_GetGamut();
            *psRealDefaultValue = pstDefaultData->ucColorSpace;
            break;
        }

        case E_USERDATA_SHARPNESS:
        {
            *psRealValue = Hv_App_PQ_GetSharpness();
            *psRealDefaultValue = pstDefaultData->ucSharpness;
            break;
        }

        case E_USERDATA_RESPONSE_TIME:
        {
            *psRealValue = Hv_App_PQ_GetODLevel();
            *psRealDefaultValue = pstDefaultData->ucResponseTime;
            break;
        }

        case E_USERDATA_DISPLAY_SIZE:
        {
            *psRealValue = HV_COMMON_DATABASE_GET(UserData, ucProportion); //Hv_Mw_Video_GetAspectRatio();
            *psRealDefaultValue = pstDefaultData->ucProportion;
            break;
        }

        case E_USERDATA_MUTE:
        {
            *psRealValue = HV_COMMON_DATABASE_GET(UserData, bMute);
            *psRealDefaultValue = pstDefaultData->bMute;
            break;
        }

        case E_USERDATA_VOLUME:
        {
            *psRealValue = HV_COMMON_DATABASE_GET(UserData, ucVolume);
            *psRealDefaultValue = pstDefaultData->ucVolume;
            break;
        }

        case E_USERDATA_LANGUAGE:
        {
            *psRealValue = Hv_App_OsdGetLanguage();
            *psRealDefaultValue = pstDefaultData->ucOsdLanguage;
            break;
        }

        case E_USERDATA_MENU_HPOS:
        {
            *psRealValue = Hv_App_OsdGetMenuPostion(HV_TRUE);
            *psRealDefaultValue = pstDefaultData->ucOsdMenuHPos;
            break;
        }

        case E_USERDATA_MENU_VPOS:
        {
            *psRealValue = Hv_App_OsdGetMenuPostion(HV_FALSE);
            *psRealDefaultValue = pstDefaultData->ucOsdMenuVPos;
            break;
        }

        case E_USERDATA_OSD_TRANS:
        {
            *psRealValue = Hv_App_OsdGetTrans();
            *psRealDefaultValue = pstDefaultData->ucOsdTrans;
            break;
        }

        case E_USERDATA_OSD_TIME:
        {
            *psRealValue = Hv_App_OsdGetMenuTime();
            *psRealDefaultValue = pstDefaultData->ucOsdTime;
            break;
        }

        case E_USERDATA_ROTATION:
        {
            *psRealValue = Hv_App_OsdGetRotateType();
            *psRealDefaultValue = pstDefaultData->ucOsdRotation;
            break;
        }

        case E_USERDATA_MPRT:
        {
            *psRealValue = HV_COMMON_DATABASE_GET(UserData, ucMprt); //Hv_Mw_Video_GetOutMprtPwmEnable();
            *psRealDefaultValue = pstDefaultData->ucMprt;
            break;
        }
        
        case E_USERDATA_FREESYNC:
        {
            *psRealValue = HV_COMMON_DATABASE_GET(UserData, ucFreeSync); //Hv_Mw_Video_GetFreeSyncSwitch();
            *psRealDefaultValue = pstDefaultData->ucFreeSync;
            break;
        }
        
        case E_USERDATA_CROSSHAIR:
        {
            *psRealValue = Hv_App_OsdGetCrosshair();
            *psRealDefaultValue = pstDefaultData->ucOsdCrosshair;
            break;
        }

        case E_USERDATA_REFRESH_RATE:
        {
            *psRealValue = Hv_App_OsdGetFrameRateShow();
            *psRealDefaultValue = pstDefaultData->ucOsdRefreshRate;
            break;
        }

        case E_USERDATA_TIMER_COUNTER:
        {
            *psRealValue = Hv_App_OsdGetTimerCounterShow();
            *psRealDefaultValue = pstDefaultData->ucOsdTimerCounter;
            break;
        }

        case E_USERDATA_POWER_LED:
        {
            *psRealValue = HV_COMMON_DATABASE_GET(UserData, ucLedMode); //Hv_Mw_System_GetLedPowerMode();
            *psRealDefaultValue = pstDefaultData->ucLedMode;
            break;
        }

        case E_USERDATA_CUSTOM_KEY1:
        {
            *psRealValue = Hv_App_OsdGetCustomKey(1);
            *psRealDefaultValue = pstDefaultData->ucOsdCustomKey1;
            break;
        }

        case E_USERDATA_CUSTOM_KEY2:
        {
            *psRealValue = Hv_App_OsdGetCustomKey(2);
            *psRealDefaultValue = pstDefaultData->ucOsdCustomKey2;
            break;
        }

        case E_USERDATA_CUSTOM_KEY3:
        {
            *psRealValue = Hv_App_OsdGetCustomKey(3);
            *psRealDefaultValue = pstDefaultData->ucOsdCustomKey3;
            break;
        }
        
        case E_USERDATA_LIGHT_MODE:
        {
            *psRealValue = Hv_App_OsdGetLightMode();
            *psRealDefaultValue = pstDefaultData->ucLightMode;
            break;
        }

        case E_USERDATA_STEADY_COLOR:
        {
            *psRealValue = Hv_App_OsdGetLightColorSelect();
            *psRealDefaultValue = pstDefaultData->ucSteadyColor;
            break;
        }

        case E_USERDATA_BREATHE_COLOR:
        {
            *psRealValue = Hv_App_OsdGetLightColorSelect();
            *psRealDefaultValue = pstDefaultData->ucBreatheColor;
            break;
        }

        case E_USERDATA_MARQUEEIN_COLOR:
        {
            *psRealValue = Hv_App_OsdGetLightColorSelect();
            *psRealDefaultValue = pstDefaultData->ucMarqueeInColor;
            break;
        }

        case E_USERDATA_MARQUEEOUT_COLOR:
        {
            *psRealValue = Hv_App_OsdGetLightColorSelect();
            *psRealDefaultValue = pstDefaultData->ucMarqueeOutColor;
            break;
        }

        case E_USERDATA_R_HUE:
        {
            *psRealValue = Hv_App_PQ_GetCMHue(PQ_CM_R);
            *psRealDefaultValue = pstDefaultData->ucHueByR;
            break;
        }
        case E_USERDATA_G_HUE:
        {
            *psRealValue = Hv_App_PQ_GetCMHue(PQ_CM_G);
            *psRealDefaultValue = pstDefaultData->ucHueByG;
            break;
        }
        case E_USERDATA_B_HUE:
        {
            *psRealValue = Hv_App_PQ_GetCMHue(PQ_CM_B);
            *psRealDefaultValue = pstDefaultData->ucHueByB;
            break;
        }
        case E_USERDATA_Y_HUE:
        {
            *psRealValue = Hv_App_PQ_GetCMHue(PQ_CM_Y);
            *psRealDefaultValue = pstDefaultData->ucHueByY;
            break;
        }
        case E_USERDATA_M_HUE:
        {
            *psRealValue = Hv_App_PQ_GetCMHue(PQ_CM_M);
            *psRealDefaultValue = pstDefaultData->ucHueByM;
            break;
        }
        case E_USERDATA_C_HUE:
        {
            *psRealValue = Hv_App_PQ_GetCMHue(PQ_CM_C);
            *psRealDefaultValue = pstDefaultData->ucHueByC;
            break;
        }

        case E_USERDATA_R_SATURATE:
        {
            *psRealValue = Hv_App_PQ_GetCMSat(PQ_CM_R);
            *psRealDefaultValue = pstDefaultData->ucSatByR;
            break;
        }
        case E_USERDATA_G_SATURATE:
        {
            *psRealValue = Hv_App_PQ_GetCMSat(PQ_CM_G);
            *psRealDefaultValue = pstDefaultData->ucSatByG;
            break;
        }
        case E_USERDATA_B_SATURATE:
        {
            *psRealValue = Hv_App_PQ_GetCMSat(PQ_CM_B);
            *psRealDefaultValue = pstDefaultData->ucSatByB;
            break;
        }
        case E_USERDATA_Y_SATURATE:
        {
            *psRealValue = Hv_App_PQ_GetCMSat(PQ_CM_Y);
            *psRealDefaultValue = pstDefaultData->ucSatByY;
            break;
        }
        case E_USERDATA_M_SATURATE:
        {
            *psRealValue = Hv_App_PQ_GetCMSat(PQ_CM_M);
            *psRealDefaultValue = pstDefaultData->ucSatByM;
            break;
        }
        case E_USERDATA_C_SATURATE:
        {
            *psRealValue = Hv_App_PQ_GetCMSat(PQ_CM_C);
            *psRealDefaultValue = pstDefaultData->ucSatByC;
            break;
        }


        default:
        {
            break;
        }
    }
}

VOID Hv_App_GetOsdUserdataProp(UserdataId enWhichData, UserdataProp* pstProp)
{
    HV_ASSERT_VALID_PTR_VOID(pstProp);
    Hv_App_OsdGetUserdata(enWhichData, pstProp);

    /* Do something special */
    switch (enWhichData)
    {
        case E_USERDATA_RED:
        {
            ColorTemperature stColTemp = {0};
            if (UD_COLOR_TEMP_V_COOL == Hv_App_GetOsdDataValue(E_USERDATA_COLOR_TEMP))
            {
                stColTemp = HV_COMMON_DATABASE_GET(FactoryData, stColTempCool);
            }
            else if (UD_COLOR_TEMP_V_WARM == Hv_App_GetOsdDataValue(E_USERDATA_COLOR_TEMP))
            {
                stColTemp = HV_COMMON_DATABASE_GET(FactoryData, stColTempWarm);
            }
            else
            {
                break;
            }
            pstProp->sOsdValue = LINEAR_MAPPING_VALUE(stColTemp.ucColorTempRGain,
                                                      PQ_RGBGAIN_FAC_OSD_START, PQ_RGBGAIN_FAC_OSD_END,
                                                      USERDATA_RED_MIN, USERDATA_RED_MAX);
            break;
        }

        case E_USERDATA_GREEN:
        {
            ColorTemperature stColTemp = {0};
            if (UD_COLOR_TEMP_V_COOL == Hv_App_GetOsdDataValue(E_USERDATA_COLOR_TEMP))
            {
                stColTemp = HV_COMMON_DATABASE_GET(FactoryData, stColTempCool);
            }
            else if (UD_COLOR_TEMP_V_WARM == Hv_App_GetOsdDataValue(E_USERDATA_COLOR_TEMP))
            {
                stColTemp = HV_COMMON_DATABASE_GET(FactoryData, stColTempWarm);
            }
            else
            {
                break;
            }
            pstProp->sOsdValue = LINEAR_MAPPING_VALUE(stColTemp.ucColorTempGGain,
                                                      PQ_RGBGAIN_FAC_OSD_START, PQ_RGBGAIN_FAC_OSD_END,
                                                      USERDATA_GREEN_MIN, USERDATA_GREEN_MAX);
            break;
        }

        case E_USERDATA_BLUE:
        {
            ColorTemperature stColTemp = {0};
            if (UD_COLOR_TEMP_V_COOL == Hv_App_GetOsdDataValue(E_USERDATA_COLOR_TEMP))
            {
                stColTemp = HV_COMMON_DATABASE_GET(FactoryData, stColTempCool);
            }
            else if (UD_COLOR_TEMP_V_WARM == Hv_App_GetOsdDataValue(E_USERDATA_COLOR_TEMP))
            {
                stColTemp = HV_COMMON_DATABASE_GET(FactoryData, stColTempWarm);
            }
            else
            {
                break;
            }
            pstProp->sOsdValue = LINEAR_MAPPING_VALUE(stColTemp.ucColorTempBGain,
                                                      PQ_RGBGAIN_FAC_OSD_START, PQ_RGBGAIN_FAC_OSD_END,
                                                      USERDATA_BLUE_MIN, USERDATA_BLUE_MAX);
            break;
        }

        default:
        {
            break;
        }
    }
}

SHORT16 Hv_App_GetOsdDataValue(UserdataId enWhichData)
{
    UserdataProp stUserDataProp = { 0 };
    Hv_App_GetOsdUserdataProp(enWhichData, &stUserDataProp);
    return stUserDataProp.sOsdValue;
}

BOOL Hv_App_Cb_ItemCheckDisable(USHORT16 usItemId)
{
    BOOL bNeedDisable = HV_FALSE;

    switch (usItemId)
    {
        case ITEM_BRIGHTNESS_SCENE_BRIGHTNESS:
        case MENU1_BRI_ITEM_SCENE_MAIN:
        case ITEM_NUMBER_BRI_SCENE_MAIN:
        case ITEM_CONTRAST_SCENE_CONTRAST:
        case MENU1_CON_ITEM_SCENE_MAIN:
        case ITEM_NUMBER_CON_SCENE_MAIN:
        {
            /* 1、颜色模式不为Native时；2、动态对比度（动态背光）开启时 3、HDR ON */
            bNeedDisable = (
                                (UD_COLOR_SPACE_V_NATIVE != Hv_App_GetOsdDataValue(E_USERDATA_COLOR_SPACE))
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_VARIABLEBACKLIGHT)
                                || (UD_VARIABLE_BACK_LIGHT_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_VARIABLE_BACK_LIGHT))
#endif
                                || CUR_TIMING_INFO(bIsHdr)
                           );
            break;
        }
        case MENU1_DCR_ITEM_SCENE_MAIN:
        case ITEM_TEXTLIST_DCR_SCENE_MAIN:
        case MENU1_GAMMA_ITEM_SCENE_MAIN:
        case MENU2_GAMMA_ITEM_SCENE_MAIN:
        case MENU1_SHARPNESS_ITEM_SCENE_MAIN:
        case MENU2_SHARPNESS_ITEM_SCENE_MAIN:
        case MENU1_COL_SPACE_ITEM_SCENE_MAIN:
        case MENU2_COL_SPACE_ITEM_SCENE_MAIN:
        {
            /* 1、HDR ON */
            bNeedDisable = (
                                CUR_TIMING_INFO(bIsHdr)
                           );
            break;
        }
        case MENU1_ECO_ITEM_SCENE_MAIN:
        case MENU2_ECO_ITEM_SCENE_MAIN:
        case ITEM_MODE_SCENE_MODE:
        case MENU1_BKL_ITEM_SCENE_MAIN:
        case ITEM_NUMBER_BKL_SCENE_MAIN:
        {
            /* 1、HDR ON  2、动态对比度（动态背光）开启时 */
            bNeedDisable = (
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_VARIABLEBACKLIGHT)
                                (UD_VARIABLE_BACK_LIGHT_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_VARIABLE_BACK_LIGHT))
#endif
                                || CUR_TIMING_INFO(bIsHdr)
                           );
            break;
        }
        case MENU1_COL_TP_ITEM_SCENE_MAIN:
        case MENU2_COL_TP_ITEM_SCENE_MAIN:
        case MENU1_SATURATION_ITEM_SCENE_MAIN:
        case MENU2_SATURATION_ITEM_SCENE_MAIN:
        case MENU1_HUE_ITEM_SCENE_MAIN:
        case MENU2_HUE_ITEM_SCENE_MAIN:
        case MENU1_LBLUE_ITEM_SCENE_MAIN:
        case MENU2_LBLUE_ITEM_SCENE_MAIN:
        {
            /* 1、颜色模式不为Native时；2、HDR ON */
            bNeedDisable = (
                                (UD_COLOR_SPACE_V_NATIVE != Hv_App_GetOsdDataValue(E_USERDATA_COLOR_SPACE))
                                || CUR_TIMING_INFO(bIsHdr)
                           );
            break;
        }
        case MENU1_OSDROT_ITEM_SCENE_MAIN:
        case MENU2_OSDROT_ITEM_SCENE_MAIN:
        {
#if (HV_CONFIG_OFF == HV_PROJECT_CONFIG_OSD_ROTATION)
            bNeedDisable = HV_TRUE;
#endif
            break;
        }
        case MENU1_MPRT_ITEM_SCENE_MAIN:
        case MENU2_MPRT_ITEM_SCENE_MAIN:
        {
            /* 1、刷新率 < 85Hz, 2、freesync功能开启; 3、HDR ON；4、输入信号为Frc模式 */
            bNeedDisable = (
                                (CUR_TIMING_INFO(usFrameRate) < 85)
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_FREESYNC)
                                || (UD_FREESYNC_V_OFF != Hv_App_GetOsdDataValue(E_USERDATA_FREESYNC))
#endif
                                || CUR_TIMING_INFO(bIsHdr)
                                || CUR_TIMING_INFO(bIsFrc)
                           );
            break;
        }
        case MENU1_ADAPTIVE_SYNC_ITEM_SCENE_MAIN:
        case MENU2_ADAPTIVE_SYNC_ITEM_SCENE_MAIN:
        {
            /* 1、timing 大于 主分辨率 */
            bNeedDisable = (
                                (CUR_TIMING_INFO(usHActive) > PANEL_H_ACTIVE) && (CUR_TIMING_INFO(usVActive) > PANEL_V_ACTIVE)
                           );
            break;
        }
        case MENU1_KEY3_ITEM_SCENE_MAIN:
        case MENU2_KEY3_ITEM_SCENE_MAIN:
        {
            /* 暂不支持 */
            bNeedDisable = HV_TRUE;
            break;
        }
        case MENU1_OTA_SCENE_MAIN:
        {
#ifndef CONFIG_USER_USB_OTA_ON
            bNeedDisable = HV_TRUE;
#else
            bNeedDisable = HV_FALSE;
#endif
            break;
        }
        case MENU1_HUE_6AXIS_ITEM_SCENE_MAIN:
        case MENU1_SATURATION_6AXIS_ITEM_SCENE_MAIN:
        {
            /* color space非native模式 */
            bNeedDisable = (
                                (UD_COLOR_SPACE_V_NATIVE != Hv_App_GetOsdDataValue(E_USERDATA_COLOR_SPACE))
                           );
            break;
        }
        case MAIN_F_ITEM_SCENE_MAIN:
        {
            /* 非工厂模式 */
            bNeedDisable = (
                               !HV_COMMON_DATABASE_GET(SystemData, bFactoryMode)
                           );
            break;
        }
#ifdef HV_SCALER_DEBUG_VERSION
        case MAIN_INPUT_ITEM_SCENE_MAIN:
        case ITEM_YES_SCENE_RESET_ALL:
        {
            /* Monkey 测试 */
            bNeedDisable = Hv_Mw_OsdIsMonkeyRunning();
            break;
        }
#endif
        default:
        {
            break;
        }
    }

    return bNeedDisable;
}

BOOL Hv_App_Cb_ItemCheckDisableHide(USHORT16 usItemId)
{
    BOOL bNeedDisableHide = HV_FALSE;

    switch (usItemId)
    {
        case MAIN_F_ITEM_SCENE_MAIN:
        {
            break;
        }
        default:
        {
            break;
        }
    }

    return bNeedDisableHide;
}

VOID Hv_App_InitToUserSetting(VOID)
{
    OSD_LOG_DEBUG("Init all settings");

    Hv_Mw_OsdUserdataUpdateAll();

    //TODO: Delete
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_MUTE);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_VOLUME);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_POWER_LED);

    /* OSD setting */
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_DISPLAY_MODE);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_LANGUAGE);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_MENU_HPOS);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_MENU_VPOS);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_OSD_TIME);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_OSD_TRANS);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_ROTATION);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_CUSTOM_KEY1);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_CUSTOM_KEY2);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_CUSTOM_KEY3);
    //Hv_Mw_SetFromOsdUserdata(E_USERDATA_REFRESH_RATE);
    Hv_Mw_OsdAdjustFunction(E_USERDATA_TIMER_COUNTER, ACT_SET,
                               UD_TIMER_COUNTER_V_OFF,
                               SET_ALL);
                               
    Hv_App_PQ_SetDefaultValue();

    Hv_Mw_SetFromOsdUserdata(E_USERDATA_MPRT);
    Hv_Mw_SetFromOsdUserdata(E_USERDATA_DISPLAY_SIZE);
}


VOID Hv_App_ResetToFactorySetting(VOID)
{
    UCHAR8 ucLanguageBackup = Hv_App_GetOsdDataValue(E_USERDATA_LANGUAGE);
    OSD_LOG_INFO("Reset all settings");

    /* Resume all userdataDB */
    Hv_Mw_DataBase_ResumeUserData();

    /* Update all osd userdata for show */
    Hv_Mw_OsdUserdataUpdateAll();

    /* Recover userdata no need resume */
    Hv_App_OsdSetUserdata(E_USERDATA_LANGUAGE, ucLanguageBackup);

    /* Call all function from userdata */
    for (USHORT16 usId = 1; usId < E_USERDATA_MAX; usId++)
    {
        /* skip call funition */
        if ((usId == E_USERDATA_DISPLAY_MODE)
            || (usId == E_USERDATA_DISPLAY_SIZE)
            //|| (usId == E_USERDATA_LDR)
            //|| (usId == E_USERDATA_COLOR_FILTER)
            //|| (usId == E_USERDATA_RED)
            //|| (usId == E_USERDATA_GREEN)
            //|| (usId == E_USERDATA_BLUE)
            || (usId == E_USERDATA_VIDEO_SOURCE)
            //|| (usId == E_USERDATA_AUTO_SELECT)
            || (usId == E_USERDATA_FREESYNC)
            || (usId == E_USERDATA_MPRT))
        {
            continue;
        }
        Hv_Mw_SetFromOsdUserdata(usId);
    }

    /* Disable Factory mode */
    HV_COMMON_DATABASE_SET(SystemData, bFactoryMode, HV_FALSE);
}

static VOID Hv_App_HdrPqSetting(BOOL bIsHdr)
{
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_COLOR_FILTER)
    if (UD_COLOR_FILTER_V_NONE != Hv_App_GetOsdDataValue(E_USERDATA_COLOR_FILTER))
    {
        /* 色盲模式打开，不设置HDR PQ相关 */
        return;
    }
#endif
    if (bIsHdr)
    {
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_VARIABLEBACKLIGHT)
        /* 关闭动态背光 */
        Hv_Mw_OsdAdjustFunction(E_USERDATA_VARIABLE_BACK_LIGHT, ACT_SET, UD_VARIABLE_BACK_LIGHT_V_OFF, SET_ALL);
#endif
        /* 关闭运动清晰度 */
        Hv_Mw_OsdAdjustFunction(E_USERDATA_MPRT, ACT_SET, UD_MPRT_V_OFF, SET_ALL);
        /* 亮度设为最大 */
        Hv_Mw_OsdAdjustFunction(E_USERDATA_BRIGHTNESS, ACT_SET, USERDATA_BRIGHTNESS_MAX, SET_INTERFACE | SET_OSDDATA);
        /* 使用HDR专用色彩空间 */
        //Hv_App_PQ_SetGamut(PQ_GAMUT_2020);
    }
    else
    {
        /* 恢复当前图像模式 */
        UCHAR8 ucDisplayMode = Hv_App_GetOsdDataValue(E_USERDATA_DISPLAY_MODE);
        Hv_App_SetDisplayMode(ucDisplayMode, SET_ALL);
        /* 恢复色彩空间 */
        Hv_Mw_SetFromOsdUserdata(E_USERDATA_COLOR_SPACE);
    }
}

VOID Hv_App_UpdateSettingByCurrentTiming(VOID)
{
    OSD_LOG_INFO("Update settings by current timing");

    if (CUR_TIMING_INFO(bIsFreesync) || (CUR_TIMING_INFO(usFrameRate) < 85))
    {
        /* 关闭运动清晰度 */
        Hv_Mw_OsdAdjustFunction(E_USERDATA_MPRT, ACT_SET, UD_MPRT_V_OFF, SET_ALL);
    }

    if (!CUR_TIMING_INFO(bIsHdr))
    {
#if (HV_CONFIG_ON == HV_PROJECT_CONFIG_COLOR_FILTER)
        /* 设置色盲模式 */
        Hv_Mw_OsdAdjustFunction(E_USERDATA_COLOR_FILTER, ACT_SET, Hv_App_GetOsdDataValue(E_USERDATA_COLOR_FILTER), SET_RELATED | SET_INTERFACE);
#endif
    }

    Hv_App_HdrPqSetting(CUR_TIMING_INFO(bIsHdr));
}
