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

📄 57xx_adjust.c

📁 GM5621原代码
💻 C
📖 第 1 页 / 共 5 页
字号:
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;
}

#else
//******************************************************************
// DESCRIPTION 	:	Minimum Phase phase
// SYNTEX	:	WORD MinimumPhase(void)
// PARAMETERS	:	none
// RETURN	:	Minimum Phase phase
//******************************************************************
WORD MinimumPhase(void)
{
	return 0;
}


//******************************************************************
// DESCRIPTION 	:	Maximum Phase
// SYNTEX	:	WORD MaximumPhase(void)
// PARAMETERS	:	none
// RETURN	:	Maximum Phase
//******************************************************************
WORD MaximumPhase(void)
{
	return 0x3F;
}

//******************************************************************
// 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 (2*UserPrefVStartBestValue-MinimumVPos());
}



//******************************************************************
// DESCRIPTION 	:	Minimum horisontal position
// SYNTEX	:	WORD MinimumHPos(void)
// PARAMETERS	:	none
// RETURN	:	Minimum horisontal position
//******************************************************************
WORD MinimumHPos(void)
{
	WORD	tmp;
	if(gmvw_InputFlagsMain & gmd_ESTIMATED)
		tmp = (gmvw_StdHTotal / 6) - 50;
	else
		tmp=(StandardModeTable[ModeTableIndex].StdHBackPorch + StandardModeTable[ModeTableIndex].StdHSyncWidth + 5) / 10;	
	if(tmp<50 || tmp > 1000)
			tmp=50;

   if((StandardModeTable[ModeTableIndex].StdWidth == 720)&&(StandardModeTable[ModeTableIndex].StdHeight == 400))
		return 8;
	else
      return tmp>UserPrefHStartBestValue? 8: UserPrefHStartBestValue-tmp;
}



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


//******************************************************************
// 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 50>UserPrefHTotalBestValue? 0 : UserPrefHTotalBestValue-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 (2*UserPrefHTotalBestValue  - MinimumHTotal());
}

#endif
//******************************************************************
// 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()
{

	WORD HP_Temp, VP_Temp;
   
   msgx("Enter  AutoColor", 0);
//   gm_Print("Enter  AutoColor", 0);
   	
	HP_Temp = UserPrefHStart;
	VP_Temp = UserPrefVStart;

	// Louis 0622
	#if Enable_AOC
		DisableAOCMain();
	#endif

	StopADCCalibrationISR();

	#if Enable_AOC
	//Before doing auto color to adjust Offset2 and Gain, offset1 must be set to a fixed default value.
	//Otherwise, Offset2 will be shiftting over when doing auto color every time.
	gm_WriteRegByte(RED_OFFSET1, 0x1f);
	gm_WriteRegByte(GRN_OFFSET1, 0x1f);	
	gm_WriteRegByte(BLU_OFFSET1, 0x1f);			
	#endif 	

    // gm_WriteRegByte(ADC_FAS1, 0x06);
	gm_AutoColorBalanceMain();
    // gm_WriteRegByte(ADC_FAS1, 0x04);

#if UPDATE_BW_BY_MODE	
	gm_ClearAndSetBitsByte(ADC_B_PHASE, ADC_BW, gmvb_Input_ADC_BW<<4);
#endif
	
	InitCalValues(); // phyang 09/08/05: Need to update calibration reference values.
	ADCQuickCalibrate();
	StartADCCalibrationISR();

	// Louis 0622
	#if Enable_AOC
		EnableAOCMain();
	#endif

	UserPrefHStart = HP_Temp;
	UserPrefVStart = VP_Temp;

	AdjustHPos();
	AdjustVPos();
	
	UpdateUserPrefAdcSettings();
	SaveModeIndependentSettings();
}

//******************************************************************
// 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;

	// Louis 1104
	DisableACM3D();
	gm_WriteRegByte(ACM_CTRL, 0x00);
	UserPrefACMMode = 0;	

	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;
			// when adjusting HTotal, check that ADC clock hasn't been exceeded.
			CheckAdcClock();
		}
		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;

	// Louis 1104
	DisableACM3D();
	gm_WriteRegByte(ACM_CTRL, 0x00);
	UserPrefACMMode = 0;	

	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);
#if LINE_BUFFER_OVERRUN_CHECK
	if(gmvb_ExtCusFlags & gmd_FORCE_VERTICAL_2TAPS)
		gm_SetFilterCoeff(TWO_TAPS_COEFF);
	else
		gm_SetFilterCoeff(UserPrefSharpness);
#else
	gm_SetFilterCoeff(UserPrefSharpness);
#endif
}
//#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
//******************************************************************

⌨️ 快捷键说明

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