⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adjust.c

📁 GM5621原代码
💻 C
📖 第 1 页 / 共 4 页
字号:
		UserPrefAdcBlueOffset2 	= gm_ReadRegByte(BLU_OFFSET2);
		UserPrefAdcRedGain 		= gm_ReadRegWord(RED_GAIN);
		UserPrefAdcGreenGain 	= gm_ReadRegWord(GRN_GAIN);
		UserPrefAdcBlueGain 		= gm_ReadRegWord(BLU_GAIN);
	}
}
#endif // Action_UpdateUserPrefAdcSettings_WB_Used


//******************************************************************
// DESCRIPTION 	:	Vertical position adjuster function
// SYNTEX	:	void AdjustVPos(void)
// PARAMETERS	:	none
// RETURN	:	none
//******************************************************************
#ifdef Action_AdjustVPos_WB_Used
void AdjustVPos(void)
{
	gmvw_InputVStartMain = UserPrefVStart;
	msgx("Adjust VPos = %d", gmvw_InputVStartMain);
	gm_SetInputVPositionMain(gmvw_InputVStartMain);
}
#endif // #ifdef Action_AdjustVPos_WB_Used



//******************************************************************
// DESCRIPTION 	:	Horisontal position adjuster function
// SYNTEX	:
// PARAMETERS	:	none
// RETURN	:	none
//******************************************************************
#ifdef Action_AdjustHPos_WB_Used
void AdjustHPos (void)
{
	#if FLIP_HPOS_ADJUSTER
		gmvw_InputHStartMain = MAX_SRC_HSTART  - UserPrefHStart;
	#else
		gmvw_InputHStartMain = UserPrefHStart;
	#endif

	msgx("Adjust HPos()",0);
	msgx("MAX_SRC_HSTART = %d", MAX_SRC_HSTART);
	msgx("gmvw_InputHStartMain = %d", gmvw_InputHStartMain);
	msgx("UserPrefHStart = %d", UserPrefHStart);

	gm_SetInputHPositionMain(gmvw_InputHStartMain);
}
#endif // Action_AdjustHPos_WB_Used

//******************************************************************
// DESCRIPTION 	:	Horisontal size adjuster function
// SYNTEX		:
// PARAMETERS	:	none
// RETURN		:	none
//******************************************************************
#ifdef Action_AdjustHTotal_WB_Used
void AdjustHTotal(void)
{
   // Merlin 0824, add for adjust Clock repeat key the value still adjust when release key in mode over 1152x864
	StopGetKeyISR();
	gm_TimerStart(HTotalDelay_10ms_TMR, 12);

	gmvw_InputHTotalMain = UserPrefHTotal;

	msgx("Adjust HTotal = %d", gmvw_InputHTotalMain);

	gm_SetInputHTotalMain(gmvw_InputHTotalMain);

	// MAX_SRC_HSTART is based on UserPrefHTotal, if UserPrefHTotal changes
	// UserPrefHStart should be recalculated.
	#if FLIP_HPOS_ADJUSTER
		UserPrefHStart = MAX_SRC_HSTART - gmvw_InputHStartMain;
	#else
		UserPrefHStart = gmvw_InputHStartMain;
	#endif

   // Merlin 0824, add for adjust Clock repeat key the value still adjust when release key in mode over 1152x864
	while(gm_TimerCheck(HTotalDelay_10ms_TMR)!=gmd_TMR_TIMED_OUT);
	StartGetKeyISR();

}
#endif // Action_AdjustHTotal_WB_Used



//******************************************************************
// DESCRIPTION 	:	Set Auto Adjust Phase Skew from mode dependent data.
// SYNTEX	:
// PARAMETERS	:	none
// RETURN	:	none
//******************************************************************
void AdjustPhaseSkew(void)
{
	#ifdef	UserPrefPhaseSkew
	gm_SetPhaseSkew_S(UserPrefPhaseSkew);
	#endif
}
//******************************************************************
// DESCRIPTION 	:	Horisontal phase adjuster function
// SYNTEX	:
// PARAMETERS	:	none
// RETURN	:	none
//******************************************************************
#ifdef Action_AdjustHSyncPhase_WB_Used
void AdjustHSyncPhase(void)
{
	gmvb_InputPhase = UserPrefHSyncPhase;
	gm_SetAdcPhaseMain(gmvb_InputPhase);

	msgx("Adjust Phase = %d", gm_ReadRegByte(SAMPLING_PHASE_DELAY));

}
#endif // Action_AdjustHSyncPhase_WB_Used


//******************************************************************
// DESCRIPTION 	:	Minimum vertical position
// SYNTEX	:	WORD MinimumVPos(void)
// PARAMETERS	:	none
// RETURN	:	Minimum vertical position
//******************************************************************
WORD MinimumVPos(void)
{
	return IPVS_ActiveStart;
}


//******************************************************************
// DESCRIPTION 	:	Maxinmum vertical position
// SYNTEX	:	WORD MaximumVPos(void)
// PARAMETERS	:	none
// RETURN	:	Maxinmum vertical position
//******************************************************************
WORD MaximumVPos(void)
{
	return (gmvw_InputVTotalMain - gmvw_InputHeightMain);
}



//******************************************************************
// DESCRIPTION 	:	Minimum horisontal position
// SYNTEX	:	WORD MinimumHPos(void)
// PARAMETERS	:	none
// RETURN	:	Minimum horisontal position
//******************************************************************
WORD MinimumHPos(void)
{
	return MIN_SRC_HSTART;
}



//******************************************************************
// DESCRIPTION 	:	Maximum horisontal position
// SYNTEX	:	WORD MaximumHPos(void)
// PARAMETERS	:	none
// RETURN	:	Maximum horisontal position
//******************************************************************
WORD MaximumHPos(void)
{
	return MAX_SRC_HSTART - IPHS_ActiveStart;
}


//******************************************************************
// DESCRIPTION 	:	Minimum horisontal size
// SYNTEX	:	WORD MinimumHTotal(void)
// PARAMETERS	:	none
// RETURN	:	Minimum horisontal size
//******************************************************************
WORD MinimumHTotal(void)
{

	msgx("Min HTotal = %d", gmvw_StdHTotal - 50);

	return gmvw_StdHTotal - 50;
}



//******************************************************************
// DESCRIPTION 	:	Maximum horisontal size
// SYNTEX	:	WORD MaximumHTotal(void)
// PARAMETERS	:	none
// RETURN	:	Maximum horisontal size
//******************************************************************
WORD MaximumHTotal(void)
{
	msgx("Max HTotal = %d", gmvw_StdHTotal + 60);

	return gmvw_StdHTotal + 60;
}

//******************************************************************
// DESCRIPTION 	:	Sets UserPrefColor to CTEMP_USER.  DDCCI will try and
//							adjust colors, but AdjustColor won't allow it unless
//							UserPrefColor is CTEMP_USER, so this function is used
//							for DDCCI prior to RGB adjustments.
// SYNTEX		:	void SetUserPrefColorToUser(void)
// PARAMETERS	:	none
// RETURN		:	none
//******************************************************************
void SetUserPrefColorToUser(void)
{
	UserPrefColor = CTEMP_USER;
}

void AutoColor()
{
	msgx("Enter  AutoColor", 0);
	gm_AutoColorBalanceMain();
}

//******************************************************************
// DESCRIPTION 	:	Factory reset
// SYNTEX		:	void FactoryReset(void)
// PARAMETERS	:	none
// RETURN		:	none
//******************************************************************
void FactoryReset(void)
{
#ifdef Action_FactoryReset_WB_Used

	ColorTempType S_ColorTemp;
	msg("FactoryReset**",0);

	ModeIndependentUserPreferences = FactoryDefaultInROM;

	LoadColorTemp(CTEMP_USER, (BYTE *) &S_ColorTemp);
	UserPrefRedColor = S_ColorTemp.R;
	UserPrefGreenColor = S_ColorTemp.G;
	UserPrefBlueColor = S_ColorTemp.B;

	ResetFactoryDependentSettings();

	SaveModeIndependentSettings();

	AdjustAllModeIndependentSettings();
	#ifdef Action_AdjustOsdDirection_WB_Used
	AdjustOsdDirection();
	#endif

	FactoryPositionReset();
#endif // Action_FactoryReset_WB_Used
}



void FactoryPositionReset(void)
{
#ifdef Action_FactoryPositionReset_WB_Used
	gmvb_InputPhase = 0;

	// PDR#5333. reset InputSaveIndex to indicate unsaved mode.
	B_InputSaveIndex = NonSavedModeLookUpIndex;

	InitModeDependentLookUp();
	InitModeDependentDescr();
	InitializePresetModes(gmd_FALSE);


	// PDR#5333.
	// adjust H/V start for subsample modes & delay
	SetupHVStartVariables();

	if(!(gmvw_InputFlagsMain & gmd_VIDEO_SRC))
	{
		// Don't mess with Htotal if input is DVI, can cause blooming.
		if(InputPortArray[gmvb_CurrentPortMain].Port != IP_DVI)
			gmvw_InputHTotalMain = gmvw_StdHTotal;
		gm_SetInputHTotalMain(gmvw_InputHTotalMain);
	}

	// update UserPreferences
	UpdateModeDependentSettings();

	gm_SetInputHPositionMain(gmvw_InputHStartMain);
	gm_SetInputVPositionMain(gmvw_InputVStartMain);
	gm_SetAdcPhaseMain(gmvb_InputPhase);
	AdjustPhaseSkew();

#endif  //Action_FactoryPositionReset_WB_Used
}

void FactoryColorReset(void)
{
#ifdef Action_FactoryColorReset_WB_Used
	ColorTempType S_ColorTemp;

	UserPrefColor 			= CTEMP_SRGB;
	UserPrefBrightness 	= UserPrefFactorysRGBBrightnessValue ;
	UserPrefContrast 		= UserPrefFactorysRGBContrastValue;

	LoadColorTemp(CTEMP_USER, (BYTE *) &S_ColorTemp);
	UserPrefRedColor = S_ColorTemp.R;
	UserPrefGreenColor = S_ColorTemp.G;
	UserPrefBlueColor = S_ColorTemp.B;

	UserPrefHue 		 = FactoryDefaultInROM.Hue;
	UserPrefSaturation = FactoryDefaultInROM.Saturation;

	UserPrefACMFleshToneGain = FactoryDefaultInROM.ACMFleshToneGain;
	UserPrefACMColorGain 	 = FactoryDefaultInROM.ACMColorGain;
	UserPrefACMGreenGain 	 = FactoryDefaultInROM.ACMGreenGain;
	UserPrefW_OsdAccAcmFlag  = FactoryDefaultInROM.W_OsdAccAcmFlag;

	SaveModeIndependentSettings();

	AdjustColor();
#endif
}



#if USE_GAMMA
//******************************************************************
// DESCRIPTION 	:	Initialize gamma table
// 					load compressed R/G/B gamma tables from rom, then load
//					using Genesis decompress function.
// SYNTEX		:	void InitGamma(void) 
// PARAMETERS	:	none
// RETURN		:	none
//******************************************************************
void InitGamma(void)
{
	// gamma tables are in ROM. i.e., panel.h file
	msgx("Initializing Gamma tables from ROM", 0);
	gm_SetRegBitsByte(DISP_LUT_CTRL, 0x3);

	if(gm_DecompressLoadGammaTableMain(gmd_RED, RedOutputGamma)==gmd_FAIL)
		msg("Load RedGamma Table Failed!!!", 0);
	if(gm_DecompressLoadGammaTableMain(gmd_GREEN, GreenOutputGamma)==gmd_FAIL)
		msg("Load GreenGamma Table Failed!!!", 0);
	if(gm_DecompressLoadGammaTableMain(gmd_BLUE, BlueOutputGamma)==gmd_FAIL)
		msg("Load BlueGamma Table Failed!!!", 0);

	// enable OUTPUT gamma correction
	gm_SetRegBitsByte(DISP_LUT_CTRL, 0x3);
	gm_SetRegBitsByte(POST_LUT_DITHER_CTRL, (PanelDepth!=8?POST_LUT_OUT_SEL:0));
}
#endif	// #if USE_GAMMA


//******************************************************************
// DESCRIPTION 	:	Adjust sharpness by using different filter coefficient table
// SYNTEX		:	void AdjustSharpness(void) 
// PARAMETERS	:	none
// RETURN		:	none
//******************************************************************
//#ifdef Action_AdjustSharpness_WB_Used
void AdjustSharpness(void)
{
	msgx("AdjustSharpness = %d",UserPrefSharpness);
	gm_SetFilterCoeff(UserPrefSharpness);
}
//#endif // Action_AdjustSharpness_WB_Used


// PDR#5290. Moved from gSEL
//******************************************************************
// DESCRIPTION 	:	The subfunction called during the auto geometry.
//					This function can be used to terminate auto geometry
//					if the timing is changed during the auto,
//					or do something	else specified by customer.
// SYNTEX		:	gmt_RET_STAT gm_AutoPeriodicCall(void)
// PARAMETERS	:	none
// RETURN		:	error code
//******************************************************************
extern gmt_KEY_INDEX GetKey(void);
gmt_RET_STAT gm_AutoPeriodicCall(void)
{
	gmt_KEY_INDEX keyPressed;
	msgx("application gm_AutoPeriodicCall",0);

   if (gm_IsAfrSet() == gmd_TRUE)
       return gmd_ABORT;

   //Following code is an example to check whether power key is pressed
   //during auto adjust. If the power key is pressed, then do power down procedure.
	//NOTE: one needs to check which key is assigned to perform power on/off function,
   //the WB project keypad mapping and it's generated file osd_trtbl.h
	//"typedef enum Keys{...} KeysEnum" contain such information,
   //for example, in TabbedOsd project, Key1 is the PowerKey in LBWADC keypad, while Key2 is the
   //PowerKey in GPIO keypad.  After changing to appropriate power key, one can enable this code.
#if 0
   keyPressed = GetKey();
   msg("keyPressed = %d", keyPressed);

   if(keyPressed == Key1) //Here, change key1 to your power key.
   {
   	ClearPowerOnFlag();
  		SaveModeIndependentSettings();
   	RequestSoftPowerOff();

		return gmd_ABORT;
   }
#endif

	return gmd_TRUE;
}



//******************************************************************
// DESCRIPTION 	:	Maximum brightness size
// SYNTEX	:	WORD MaximumFactoryBrightness(void)
// PARAMETERS	:	none
// RETURN	:	Maximum Brightness
//******************************************************************
BYTE MaximumFactoryBrightness(void)
{
#ifdef Action_AdjustFactoryBrightness_WB_Used
	return UserPrefFactoryBrightnessMaxSetting ;
#else
	return  255 ; 
#endif
}

//******************************************************************
// DESCRIPTION 	:	Maximum brightness size
// SYNTEX	:	WORD MinimumFactoryBrightness(void)
// PARAMETERS	:	none
// RETURN	:	Maximum Brightness
//******************************************************************
BYTE MinimumFactoryBrightness(void)
{
#ifdef Action_AdjustFactoryBrightness_WB_Used
	return UserPrefFactoryBrightnessMinSetting ;
#else
	return  0 ; 
#endif
}

//******************************************************************
// DESCRIPTION 	:	Minimum Contrast size
// SYNTEX	:	WORD MaximumFactoryContrast(void)
// PARAMETERS	:	none
// RETURN	:	Minimum Contrast 
//******************************************************************
BYTE MaximumFactoryContrast(void)
{
#ifdef Action_AdjustFactoryContrast_WB_Used
	return UserPrefFactoryContrastMaxSetting ;
#else
	return  255 ; 
#endif
}

//******************************************************************
// DESCRIPTION 	:	Minimum Contrast size
// SYNTEX	:	WORD MinimumFactoryContrast(void)
// PARAMETERS	:	none
// RETURN	:	Minimum Contrast 
//******************************************************************
BYTE MinimumFactoryContrast(void)
{
#ifdef Action_AdjustFactoryContrast_WB_Used
	return UserPrefFactoryContrastMinSetting ;
#else
	return  0 ;
#endif
}

#ifdef Action_AdjustFactoryBrightness_WB_Used
//******************************************************************
// DESCRIPTION 	:	Minimum Contrast size
// SYNTEX	:	WORD CheckContrastValue(void)
// PARAMETERS	:	none
// RETURN	:	Minimum Contrast
//******************************************************************
void CheckContrastValue(void)
{
	if ( UserPrefContrast < UserPrefFactoryContrastMinSetting )
	{
		UserPrefContrast = UserPrefFactoryContrastMinSetting;
	} 
    if ( UserPrefContrast > UserPrefFactoryContrastMaxSetting )
	{
		UserPrefContrast = UserPrefFactoryContrastMaxSetting;
	}

	if ( UserPrefFactorysRGBContrastValue < UserPrefFactoryContrastMinSetting )
	{
		UserPrefFactorysRGBContrastValue = UserPrefFactoryContrastMinSetting;
	} 
    if ( UserPrefFactorysRGBContrastValue > UserPrefFactoryContrastMaxSetting )
	{
		UserPrefFactorysRGBContrastValue = UserPrefFactoryContrastMaxSetting;
	}
}

//******************************************************************
// DESCRIPTION 	:	Minimum Contrast size
// SYNTEX	:	WORD CheckContrastValue(void)
// PARAMETERS	:	none
// RETURN	:	Minimum Contrast
//******************************************************************
void CheckBrightnessValue(void)
{
	if ( UserPrefBrightness < UserPrefFactoryBrightnessMinSetting )
	{
		UserPrefBrightness = UserPrefFactoryBrightnessMinSetting;
	} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -