📄 osdoper.c
字号:
// Printf("\n fw id erro!!!\n");
// Printf("\n mode---0x%02x\r \n", mode);
mode = 0;
SetVideoModeEE ( mode );
}
DefaultPanelAttributeForVideo();
if( mode != USER_VIDEOMODE ){
for (i=0 ;i<5 ; i++)
WriteTW88( VideoModeTable[0][i], VideoModeTable[mode+1][i] );
regv = VideoModeTable[mode+1][5]; // Sharpness
SetPanelPeakingReg( (BYTE)regv );
SetPanelSharpnessReg( (BYTE)regv );
SetVideoVPeakingReg( (BYTE)regv );
// SetVideoHfilterReg( (BYTE)regv );
}
else // USERMODE
{
#ifndef SUPPORT_USERCOLORFROMTXT
{
int userv;
// Load from EEPROM
SetVideoContrast( GetVideoDatawithOffset(contrast) );
SetVideoBrightness( GetVideoDatawithOffset(bright) );
SetVideoSaturation(U_SAT, GetVideoDatawithOffset(staturation_U) );
SetVideoSaturation(V_SAT, GetVideoDatawithOffset(staturation_V) );
SetVideoHue(GetVideoDatawithOffset( hue) );
userv = GetVideoDatawithOffset(sharpness);
Mapping1( userv, &UserRange, ®v, &VideoSharpnessRange );
}
SetPanelPeakingReg( (BYTE)regv );
SetPanelSharpnessReg( (BYTE)regv );
SetVideoVPeakingReg( (BYTE)regv );
// SetVideoHfilterReg( (BYTE)regv );
#endif
}
SetVideoBacklight(GetVideoDatawithOffset(backlight)); // Hans
}
/*
BYTE IsInputAnalogRGB()
{
#if defined SUPPORT_COMPONENT
if( InputSelection==COMPONENT ) return TRUE;
#elif defined SUPPORT_SCART
if( InputSelection==SCART ) return TRUE;
#endif
return FALSE;
}
*/
BYTE GetVideoDatawithOffset(BYTE offset)
{
OSDItemValue = GetVideoDatafromEE(offset);
return OSDItemValue;
}
BYTE ChangeVideoData(BYTE offset, BYTE flag)
{
int newv, inc;
inc = ( flag==UP ? 1 : -1 );
newv = OSDItemValue + inc;
if( newv< UserRange.Min || newv> UserRange.Max )
return OSDItemValue;
switch (offset)
{
case contrast: SetVideoContrast(newv);
break;
case bright: SetVideoBrightness(newv);
break;
case staturation_U:
case staturation_V:
SetVideoSaturation(offset-staturation_U,newv);
break;
case hue: SetVideoHue(newv);
break;
case backlight: SetVideoBacklight(newv);
break;
}
SaveVideoDatatoEE(offset, newv);
OSDItemValue = newv;
return newv;
}
void SetVideoContrast(BYTE newv)
{
int regv;
Mapping1( newv, &UserRange , ®v, &VideoContrastRange);
if( InputSelection == DTV ){
SetDTVContrastReg(regv);
}
else {
SetVideoContrastReg(regv);
}
}
void SetVideoBrightness(BYTE newv)
{
int regv;
if( InputSelection == DTV ){
Mapping1( newv, &UserRange , ®v, &PanelBrightnessRange);
SelectPanelAttrRegGroup(GROUP_YCbCr);// Need to refresh "INDX_CB" bit // Hans
SetDTVBrightnessReg( (BYTE)regv);
}
else {
Mapping1( newv, &UserRange , ®v, &VideoBrightnessRange);
// if( IsInputAnalogRGB() )
// SetDigitalVideoBrightnessReg( regv ); // don't have such registers // Hans
// else
SetVideoBrightnessReg( (BYTE)regv);
}
}
void SetVideoBacklight(BYTE newv)
{
int regv;
BYTE page;
Mapping1( newv, &UserRange , ®v, &PanelBacklightRange);
#ifdef DEBUG
dPrintf("\r\nPanelBacklight: %d", (WORD)regv);
#endif
#ifdef BACKLIGHT_CCFL
page = ReadTW88( 0xff );
WriteTW88( 0xff, 0x01 ); // set page 1
WriteTW88( 0x35, regv); // only 5 bit using // adjust rang has been changed
WriteTW88( 0xff, page );
#endif
#ifdef BACKLIGHT_LED
page = ReadTW88( 0xff );
WriteTW88( 0xff, 0x01 ); // set page 1
WriteTW88( 0x35, (regv>>3) ); // only 5 bit using
WriteTW88( 0xff, page );
#endif
#ifdef BACKLIGHT_PWM //
page = ReadTW88( 0xff );
WriteTW88( 0xff, 0x00 ); // set page 0
WriteTW88( 0xbe, ((ReadTW88(0xbe) & 0xcf) | 0x10) ); // set active Low control, if want active high clear
WriteTW88( 0xc4, ((ReadTW88(0xc4) & 0x80)|(regv>>1)) ); // set pwm number
WriteTW88( 0xff, page );
#endif
}
void SetVideoHue(BYTE newv)
{
int regv;
if( InputSelection == DTV ){
Mapping1( newv, &UserRange , ®v, &PanelHueRange);
SetPanelHueReg( (BYTE)regv);
}
else {
Mapping1( newv, &UserRange , ®v, &VideoHueRange);
// if( IsInputAnalogRGB() )
// SetDigitalVideoHueReg( regv ); // don't have such registers // Hans
// else
SetVideoHueReg( (BYTE)regv);
}
}
void SetVideoSaturation(BYTE svtype, BYTE newv)
{
int regv;
// if( IsInputAnalogRGB() ) {
// Mapping1( newv, &UserRange , ®v, &DigitalVideoSaturationRange);
// SetDigitalVideoSaturationReg(svtype, (BYTE)regv); // don't have such registers // Hans
// }
// else {
Mapping1( newv, &UserRange , ®v, &VideoSaturationRange);
if( InputSelection == DTV ){
SelectPanelAttrRegGroup(GROUP_YCbCr);// Need to refresh "INDX_CB" bit // Hans
SetPanelSaturationReg( svtype, regv );
}
else {
SetVideoSaturationReg( svtype, (BYTE)regv);
}
// }
}
BYTE SetVideoSharpness(BYTE flag)
{
BYTE orgv;
char inc;
int newv, regv;
orgv = ReadTW88( PNLSHARPNESS )&0x07;
regv = orgv & 0x0f;
inc = ( flag==UP ? 1 : -1 );
regv += inc;
if( regv < VideoSharpnessRange.Min ||
regv > VideoSharpnessRange.Max )
return OSDItemValue;
Mapping1( (BYTE)regv, &VideoSharpnessRange, &newv, &UserRange );
SetPanelSharpnessReg( (BYTE)regv );
SetVideoVPeakingReg( (BYTE)regv );
// SetVideoHfilterReg( (BYTE)regv );
SaveVideoDatatoEE( sharpness, newv );
OSDItemValue = newv;
return newv;
}
/*
BYTE SetOSDDurationValue(BYTE flag)
{
int val;
val = ( flag==UP ? OSDItemValue+1 : OSDItemValue-1 );
if( val< OSDDurationRange.Min || val > OSDDurationRange.Max )
return OSDItemValue;
OSDItemValue = val;
SaveOSDDurationEE(val);
SetOSDDuration( val );
return OSDItemValue;
}
*/
#ifdef WQVGA
CODE BYTE Init_Video_Data[]={
37, 52, 50, 50, 50, 50 }; // Contrast,Bright,Staturation_U,Staturation_V,Hue,Sharpness
#else
CODE BYTE Init_Video_Data[]={
38, 50, 62, 62, 50, 50 }; // Contrast,Bright,Staturation_U,Staturation_V,Hue,Sharpness
#endif
#ifdef ADD_ANALOGPANEL
CODE BYTE Init_Video_Data_A[]={
37, 52, 50, 50, 50, 50 }; // Contrast,Bright,Staturation_U,Staturation_V,Hue,Sharpness
#endif
CODE BYTE Init_DTV_Data[]={
50, 50, 50, 50, 50, 50 }; // Contrast,Bright,Staturation_U,Staturation_V,Hue,Sharpness
void ResetVideoValue(void)
{
BYTE i, CurInput;
#ifdef DEBUG
dPrintf("\r\n---- ResetVideoValue -----");
#endif
CurInput = InputSelection;
for (InputSelection=COMPOSITE; InputSelection<PC ; InputSelection++ ) {
if( InputSelection == DTV )
{
for( i=0; i<6; i++){
SaveVideoDatatoEE(i, Init_DTV_Data[i]); // All 50%
}
}
else {
for( i=0; i<6; i++){
#ifdef ADD_ANALOGPANEL
if(IsAnalogOn())
SaveVideoDatatoEE(i, Init_Video_Data_A[i]);
else
#endif
SaveVideoDatatoEE(i, Init_Video_Data[i]);
}
}
}
InputSelection = CurInput;
SetVideoMode(USER_VIDEOMODE);
}
#ifdef WIDE_SCREEN
void SetHDelay( WORD delay)
{
BYTE high;
#ifdef WIDE_SCREEN
Printf("\n SetHDelay: %4x ", delay);
#endif
WriteDecoder( HDELAY_LO, (BYTE)delay );
high = ReadDecoder( CROP_HI ) & 0xf3;
high |= (BYTE)((delay & 0x300) >> 6);
WriteDecoder( CROP_HI, high );
}
/*
void SetVideoOverScan(BYTE overscan) //in 1/20
{
if(GetInputSelection() == PC) return;
VideoOverScan = overscan;
SetHDelay( DEF_HDELAY + 720 * overscan / 20 / 2 ); // Video H Active : 720 pixels
}
*/
void EnablePanoramaScale(BYTE cEnable)
{
BYTE cTemp;
cTemp = ReadTW88(0x63);
if (cEnable)
{
cTemp |= 0x80; // set bit7 of 0x063
WriteTW88(0x68, 0x40);
}
else
{
cTemp &= 0x7F; // clear bit7 of 0x063
WriteTW88(0x68, 0x00);
}
WriteTW88(0x63, cTemp);
}
void SetScale4_3X(WORD wHAN, WORD wVAN) // 16:9 --> 4:3 // Normal
{
extern CODE struct _PCMDATA PCMDATA[];
extern IDATA BYTE PcMode;
DWORD outv, scale;
// Vertical
scale = (DWORD)wVAN ;
outv = (DWORD)PVR_;
scale = 0x10000L * scale / outv;
YScale2( scale );
// Horizontal
if (PcMode >= EE_XGA_60 && PcMode >= EE_XGA_75)
scale = (DWORD)wHAN-4; //just 1024 for focus issue(1:1).
else
scale = (DWORD)wHAN;
scale = scale * 0x10000L * 4 / PHR_ /3;
XScale2( scale );
}
void SetScale(WORD wHAN, WORD wVAN)
{
DWORD scale, outv;
// Vertical
scale = (DWORD)wVAN;
outv = (DWORD)PVR_ ;
scale = 0x10000L * scale / outv;
YScale2( scale );
#ifdef DEBUG_PC
Printf("\n PCMode[%d] %ld YScale: %ld", (WORD)PcMode, outv, scale);
#endif
// Horizontal
scale = wHAN;
outv = PHR_ ;
// scale = scale * 0x100L / outv;
scale = (scale*0x10000L+outv-1) / outv;
XScale2( scale );
}
void SetLRBlank(WORD bl)
{
BYTE cTemp;
cTemp = bl & 0xff;
WriteTW88(0x66, cTemp);
cTemp = (bl & 0x300) >> 8;
WriteTW88(0x67, cTemp);
}
void Set4WideScreen( BYTE id )
{
WORD wHAN, wVAN;
BYTE cIndex;
#if (defined SUPPORT_PC) || (defined SUPPORT_DTV)
if( (GetInputSelection()== PC) || (GetInputSelection()== DTV) )
{
wHAN = PCMDATA[PcMode].HAN;
wVAN = PCMDATA[PcMode].VAN;
}
else
#endif
{
cIndex = FindDecodeSettingIndex(PcMode);
wHAN = DecoderFormat[cIndex].ScaleWidth;
wVAN = DecoderFormat[cIndex].ScaleHeight;
}
if( id > WIDESCREEN_FULL ){
id = WIDESCREEN_WIDE;
}
WideScreenMode = id;
switch( id )
{
case WIDESCREEN_NORMAL:
SetHDelay(DecoderFormat[cIndex].HDelay);
EnablePanoramaScale(FALSE);
SetScale4_3X(wHAN, wVAN);
SetLRBlank((PHR_- (PHR_*3/4 ))/2);
break;
case WIDESCREEN_WIDE:
#if (defined SUPPORT_PC) || (defined SUPPORT_DTV)
if( (GetInputSelection() == PC) || (GetInputSelection() == DTV) )
{
SetScale(wHAN, wVAN);
}
else
#endif
{
SetHDelay(DecoderFormat[cIndex].HDelay + 20);
SetScale((wHAN - 40), wVAN);
}
EnablePanoramaScale(FALSE);
SetLRBlank(0);
break;
case WIDESCREEN_PANO:
#if (defined SUPPORT_PC) || (defined SUPPORT_DTV)
if( (GetInputSelection() == PC) || (GetInputSelection() == DTV) )
{
EnablePanoramaScale(FALSE);
SetScale(wHAN, wVAN);
SetLRBlank(0);
}
else
#endif
{
EnablePanoramaScale(TRUE);
SetHDelay(DecoderFormat[cIndex].HDelay);
#ifdef WQVGA
if (cIndex < 2) // 480i/576i signal
SetScale((wHAN + 116), wVAN);
else
SetScale((wHAN + 100), wVAN);
#else
if (cIndex < 2) // 480i/576i signal
SetScale((wHAN + 162), wVAN);
else
SetScale((wHAN + 146), wVAN);
#endif
SetLRBlank(200);
}
break;
case WIDESCREEN_FULL:
SetHDelay(DecoderFormat[cIndex].HDelay);
EnablePanoramaScale(FALSE);
SetScale(wHAN, wVAN);
SetLRBlank(0);
break;
}
SaveWideModeEE(WideScreenMode);
}
#endif // WIDE_SCREEN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -