📄 theatre.c
字号:
static CARD32 ReadRT_fld1 (TheatrePtr t,CARD32 dwReg){ CARD32 dwResult=0; if (RT_regr (RT_RegMap[dwReg].dwRegAddrLSBs, &dwResult) == TRUE) { RT_RegMap[dwReg].dwCurrValue = ((dwResult & ~RT_RegMap[dwReg].dwMaskLSBs) >> RT_RegMap[dwReg].dwFldOffsetLSBs); return (RT_RegMap[dwReg].dwCurrValue); } else { return (0xFFFFFFFF); }} /* ReadRT_fld ()... */#define WriteRT_fld(a,b) WriteRT_fld1(t, (a), (b))#define ReadRT_fld(a) ReadRT_fld1(t,(a))/**************************************************************************** * RT_SetVINClock (CARD16 wStandard) * * Function: to set the VIN clock for the selected standard * * Inputs: CARD16 wStandard - input standard (NTSC, PAL, SECAM) * * Outputs: NONE * ****************************************************************************/static void RT_SetVINClock(TheatrePtr t, CARD16 wStandard){ CARD32 dwM0=0, dwN0=0, dwP=0; CARD8 ref_freq; /* Determine the reference frequency first. This can be obtained from the MMTABLE.video_decoder_type field (bits 4:7) The Rage Theatre currently only supports reference frequencies of 27 or 29.49 MHz. */ /* R128ReadBIOS(0x48, (CARD8 *)&bios_header, sizeof(bios_header)); R128ReadBIOS(bios_header + 0x30, (CARD8 *)&pll_info_block, sizeof(pll_info_block)); R128ReadBIOS(pll_info_block+0x07, &video_decoder_type, sizeof(video_decoder_type)); */ ref_freq = (t->video_decoder_type & 0xF0) >> 4; switch (wStandard & 0x00FF) { case (DEC_NTSC): /* NTSC GROUP - 480 lines */ switch (wStandard & 0xFF00) { case (extNONE): case (extNTSC): case (extNTSC_J): if (ref_freq == RT_FREF_2950) { dwM0 = 0x39; dwN0 = 0x14C; dwP = 0x6; } else { dwM0 = 0x0B; dwN0 = 0x46; dwP = 0x6; } break; case (extNTSC_443): if (ref_freq == RT_FREF_2950) { dwM0 = 0x23; dwN0 = 0x88; dwP = 0x7; } else { dwM0 = 0x2C; dwN0 = 0x121; dwP = 0x5; } break; case (extPAL_M): if (ref_freq == RT_FREF_2950) { dwM0 = 0x2C; dwN0 = 0x12B; dwP = 0x7; } else { dwM0 = 0x0B; dwN0 = 0x46; dwP = 0x6; } break; default: return; } break; case (DEC_PAL): switch (wStandard & 0xFF00) { case (extPAL): case (extPAL_N): case (extPAL_BGHI): case (extPAL_60): if (ref_freq == RT_FREF_2950) { dwM0 = 0x0E; dwN0 = 0x65; dwP = 0x6; } else { dwM0 = 0x2C; dwN0 = 0x0121; dwP = 0x5; } break; case (extPAL_NCOMB): if (ref_freq == RT_FREF_2950) { dwM0 = 0x23; dwN0 = 0x88; dwP = 0x7; } else { dwM0 = 0x37; dwN0 = 0x1D3; dwP = 0x8; } break; default: return; } break; case (DEC_SECAM): if (ref_freq == RT_FREF_2950) { dwM0 = 0xE; dwN0 = 0x65; dwP = 0x6; } else { dwM0 = 0x2C; dwN0 = 0x121; dwP = 0x5; } break; } /* VIN_PLL_CNTL */ WriteRT_fld (fld_VIN_M0, dwM0); WriteRT_fld (fld_VIN_N0, dwN0); WriteRT_fld (fld_VIN_P, dwP); return;} /* RT_SetVINClock ()... *//**************************************************************************** * RT_SetTint (int hue) * * Function: sets the tint (hue) for the Rage Theatre video in * * Inputs: int hue - the hue value to be set. * * Outputs: NONE * ****************************************************************************/void RT_SetTint (TheatrePtr t, int hue){ CARD32 nhue = 0; t->iHue=hue; /* Scale hue value from -1000<->1000 to -180<->180 */ hue = (double)(hue+1000) * 0.18 - 180; /* Validate Hue level */ if (hue < -180) { hue = -180; } else if (hue > 180) { hue = 180; } /* save the "validated" hue, but scale it back up to -1000<->1000 */ t->iHue = (double)hue/0.18; switch (t->wStandard & 0x00FF) { case (DEC_NTSC): /* original ATI code had _empty_ section for PAL/SECAM... which did not work, obviously */ case (DEC_PAL): case (DEC_SECAM): if (hue >= 0) { nhue = (CARD32) (256 * hue)/360; } else { nhue = (CARD32) (256 * (hue + 360))/360; } break; default: break; } WriteRT_fld(fld_CP_HUE_CNTL, nhue); return;} /* RT_SetTint ()... *//**************************************************************************** * RT_SetSaturation (int Saturation) * * Function: sets the saturation level for the Rage Theatre video in * * Inputs: int Saturation - the saturation value to be set. * * Outputs: NONE * ****************************************************************************/void RT_SetSaturation (TheatrePtr t, int Saturation){ CARD16 wSaturation_V, wSaturation_U; double dbSaturation = 0, dbCrGain = 0, dbCbGain = 0; /* VALIDATE SATURATION LEVEL */ if (Saturation < -1000L) { Saturation = -1000; } else if (Saturation > 1000L) { Saturation = 1000; } t->iSaturation = Saturation; if (Saturation > 0) { /* Scale saturation up, to use full allowable register width */ Saturation = (double)(Saturation) * 4.9; } dbSaturation = (double) (Saturation+1000.0) / 1000.0; CalculateCrCbGain (t, &dbCrGain, &dbCbGain, t->wStandard); wSaturation_U = (CARD16) ((dbCrGain * dbSaturation * 128.0) + 0.5); wSaturation_V = (CARD16) ((dbCbGain * dbSaturation * 128.0) + 0.5); /* SET SATURATION LEVEL */ WriteRT_fld (fld_CRDR_ACTIVE_GAIN, wSaturation_U); WriteRT_fld (fld_CBDB_ACTIVE_GAIN, wSaturation_V); t->wSaturation_U = wSaturation_U; t->wSaturation_V = wSaturation_V; return;} /* RT_SetSaturation ()...*//**************************************************************************** * RT_SetBrightness (int Brightness) * * Function: sets the brightness level for the Rage Theatre video in * * Inputs: int Brightness - the brightness value to be set. * * Outputs: NONE * ****************************************************************************/void RT_SetBrightness (TheatrePtr t, int Brightness){ double dbSynctipRef0=0, dbContrast=1; double dbYgain=0; double dbBrightness=0; double dbSetup=0; CARD16 wBrightness=0; /* VALIDATE BRIGHTNESS LEVEL */ if (Brightness < -1000) { Brightness = -1000; } else if (Brightness > 1000) { Brightness = 1000; } /* Save value */ t->iBrightness = Brightness; t->dbBrightnessRatio = (double) (Brightness+1000.0) / 10.0; dbBrightness = (double) (Brightness)/10.0; dbSynctipRef0 = ReadRT_fld (fld_SYNCTIP_REF0); if(t->dbContrast == 0) { t->dbContrast = 1.0; /*NTSC default; */ } dbContrast = (double) t->dbContrast; /* Use the following formula to determine the brightness level */ switch (t->wStandard & 0x00FF) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -