Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
5.9 KiB

  1. //***************************************************************************
  2. // Decoder process
  3. //
  4. //***************************************************************************
  5. #include "common.h"
  6. #include "regs.h"
  7. void decStopData( PHW_DEVICE_EXTENSION pHwDevExt, BOOL bKeep )
  8. {
  9. DebugPrint(( DebugLevelTrace, "TOSDVD:decStopData()\r\n" ));
  10. pHwDevExt->ADec.AUDIO_ZR38521_STOPF();
  11. pHwDevExt->ADec.AUDIO_ZR38521_MUTE_ON();
  12. if( !bKeep ) {
  13. pHwDevExt->VPro.VPRO_VIDEO_MUTE_ON();
  14. pHwDevExt->CPgd.CPGD_VIDEO_MUTE_ON();
  15. }
  16. pHwDevExt->VDec.VIDEO_DECODE_STOP();
  17. pHwDevExt->VDec.VIDEO_SYSTEM_STOP();
  18. pHwDevExt->VPro.SUBP_STC_OFF();
  19. // pHwDevExt->DAck.PCIF_DMA_ABORT();
  20. pHwDevExt->VDec.VIDEO_STD_CLEAR();
  21. pHwDevExt->VPro.SUBP_BUFF_CLEAR();
  22. pHwDevExt->VDec.VIDEO_SYSTEM_STOP();
  23. pHwDevExt->VDec.VIDEO_DECODE_INT_OFF();
  24. if( pHwDevExt->AudioMode == AUDIO_TYPE_AC3 )
  25. pHwDevExt->ADec.AUDIO_TC6800_INIT_AC3();
  26. else if( pHwDevExt->AudioMode == AUDIO_TYPE_PCM )
  27. pHwDevExt->ADec.AUDIO_TC6800_INIT_PCM();
  28. else
  29. TRAP;
  30. }
  31. void decHighlight( PHW_DEVICE_EXTENSION pHwDevExt, PKSPROPERTY_SPHLI phli )
  32. {
  33. //h DebugPrint(( DebugLevelTrace, "TOSDVD:decHighlight\r\n" ));
  34. UCHAR ln_ctli[4];
  35. UCHAR px_ctlis[6];
  36. UCHAR px_ctlie[6];
  37. if( phli->StartX == phli->StopX && phli->StartY == phli->StopY ) {
  38. DebugPrint(( DebugLevelTrace, "TOSDVD: Highlight Off\r\n" ));
  39. pHwDevExt->VPro.SUBP_HLITE_OFF();
  40. }
  41. else {
  42. pHwDevExt->VPro.SUBP_HLITE_ON();
  43. ln_ctli[3] = (UCHAR)(( phli->StartY >> 8 ) & 0x03);
  44. ln_ctli[2] = (UCHAR)(phli->StartY & 0xff);
  45. ln_ctli[1] = (UCHAR)(( phli->StopY >> 8 ) & 0x03 | 0x20);
  46. ln_ctli[0] = (UCHAR)(phli->StopY & 0xff);
  47. px_ctlis[5] = (UCHAR)(( phli->StartX >> 8 ) & 0x03);
  48. px_ctlis[4] = (UCHAR)(phli->StartX & 0xff);
  49. px_ctlis[3] = (UCHAR)(phli->ColCon.emph2col << 4 | phli->ColCon.emph1col);
  50. px_ctlis[2] = (UCHAR)(phli->ColCon.patcol << 4 | phli->ColCon.backcol);
  51. px_ctlis[1] = (UCHAR)(phli->ColCon.emph2con << 4 | phli->ColCon.emph1con);
  52. px_ctlis[0] = (UCHAR)(phli->ColCon.patcon << 4 | phli->ColCon.backcon);
  53. px_ctlie[5] = (UCHAR)(( phli->StopX >> 8 ) & 0x03 | 0x08);
  54. px_ctlie[4] = (UCHAR)(phli->StopX & 0xff);
  55. px_ctlie[3] = 0;
  56. px_ctlie[2] = 0;
  57. px_ctlie[1] = 0;
  58. px_ctlie[0] = 0;
  59. //h DebugPrint( (DebugLevelTrace, "TOSDVD: %d, %d - %d, %d : %02x%02x%02x%02x\r\n",
  60. //h phli->StartX, phli->StartY, phli->StopX, phli->StopY,
  61. //h px_ctlis[3], px_ctlis[2], px_ctlis[1], px_ctlis[0]
  62. //h ) );
  63. pHwDevExt->VPro.SUBP_SET_PXCTLIE( px_ctlie );
  64. pHwDevExt->VPro.SUBP_SET_PXCTLIS( px_ctlis );
  65. pHwDevExt->VPro.SUBP_SET_LNCTLI( ln_ctli );
  66. }
  67. }
  68. void decDisableInt( PHW_DEVICE_EXTENSION pHwDevExt )
  69. {
  70. pHwDevExt->VDec.VIDEO_ALL_INT_OFF();
  71. pHwDevExt->DAck.PCIF_VSYNC_OFF();
  72. }
  73. void decGenericNormal( PHW_DEVICE_EXTENSION pHwDevExt )
  74. {
  75. DebugPrint( (DebugLevelTrace, "TOSDVD: decGenericNormal\r\n") );
  76. ULONG TrickMode;
  77. ULONG dwSTC;
  78. if( pHwDevExt->AudioMode == AUDIO_TYPE_AC3 )
  79. pHwDevExt->ADec.AUDIO_TC6800_INIT_AC3();
  80. else if( pHwDevExt->AudioMode == AUDIO_TYPE_PCM )
  81. pHwDevExt->ADec.AUDIO_TC6800_INIT_PCM();
  82. else
  83. TRAP;
  84. pHwDevExt->ADec.AUDIO_ZR38521_STOPF();
  85. pHwDevExt->VDec.VIDEO_PRSO_PS1();
  86. pHwDevExt->VDec.VIDEO_PLAY_NORMAL();
  87. // Bad loop !!
  88. DWORD st, et;
  89. st = GetCurrentTime_ms();
  90. for( ; ; ) {
  91. KeStallExecutionProcessor( 1 );
  92. et = GetCurrentTime_ms();
  93. TrickMode = pHwDevExt->VDec.VIDEO_GET_TRICK_MODE();
  94. if( TrickMode == 0x07 )
  95. break;
  96. if( st + 2000 < et ) {
  97. TRAP;
  98. break;
  99. }
  100. }
  101. DebugPrint( (DebugLevelTrace, "TOSDVD: wait %dms\r\n", et - st ) );
  102. dwSTC = pHwDevExt->VDec.VIDEO_GET_STCA();
  103. pHwDevExt->ADec.AUDIO_ZR38521_VDSCR_ON( dwSTC );
  104. pHwDevExt->ADec.AUDIO_ZR38521_PLAY();
  105. pHwDevExt->VDec.VIDEO_UFLOW_INT_ON();
  106. DebugPrint(( DebugLevelTrace, "TOSDVD: STC 0x%x( %d )\r\n", dwSTC, dwSTC ));
  107. }
  108. void decGenericFreeze( PHW_DEVICE_EXTENSION pHwDevExt )
  109. {
  110. DebugPrint(( DebugLevelTrace, "TOSDVD: decGenericFreeze\r\n" ));
  111. pHwDevExt->VDec.VIDEO_PLAY_FREEZE();
  112. pHwDevExt->ADec.AUDIO_ZR38521_MUTE_ON();
  113. pHwDevExt->ADec.AUDIO_ZR38521_STOP();
  114. }
  115. void decGenericSlow( PHW_DEVICE_EXTENSION pHwDevExt )
  116. {
  117. DebugPrint( (DebugLevelTrace, "TOSDVD: decGenericSlow\r\n") );
  118. pHwDevExt->VDec.VIDEO_PRSO_PS1();
  119. pHwDevExt->VPro.SUBP_SET_AUDIO_NON();
  120. pHwDevExt->VDec.VIDEO_PLAY_SLOW( (UCHAR)(pHwDevExt->Rate/10000) );
  121. pHwDevExt->ADec.AUDIO_ZR38521_STOP();
  122. pHwDevExt->ADec.AUDIO_ZR38521_MUTE_ON();
  123. pHwDevExt->VDec.VIDEO_UFLOW_INT_ON();
  124. }
  125. void decStopForFast( PHW_DEVICE_EXTENSION pHwDevExt )
  126. {
  127. DebugPrint(( DebugLevelTrace, "TOSDVD: decGenericFast\r\n" ));
  128. pHwDevExt->VDec.VIDEO_UFLOW_INT_OFF();
  129. pHwDevExt->VDec.VIDEO_SET_STCA( (ULONG)(pHwDevExt->StartTime / 1000 * 9) );
  130. pHwDevExt->VDec.VIDEO_PRSO_NON();
  131. pHwDevExt->VDec.VIDEO_PLAY_FAST( FAST_ONLYI );
  132. pHwDevExt->ADec.AUDIO_ZR38521_MUTE_ON();
  133. pHwDevExt->ADec.AUDIO_ZR38521_STOP();
  134. pHwDevExt->VPro.SUBP_MUTE_ON();
  135. pHwDevExt->VPro.SUBP_STC_OFF();
  136. pHwDevExt->VDec.VIDEO_DECODE_STOP();
  137. }
  138. void decResumeForFast( PHW_DEVICE_EXTENSION pHwDevExt )
  139. {
  140. pHwDevExt->VDec.VIDEO_STD_CLEAR();
  141. pHwDevExt->ADec.AUDIO_ZR38521_STOPF();
  142. pHwDevExt->VPro.SUBP_BUFF_CLEAR();
  143. pHwDevExt->VDec.VIDEO_DECODE_START();
  144. }
  145. void decFastNormal( PHW_DEVICE_EXTENSION pHwDevExt )
  146. {
  147. DebugPrint( (DebugLevelTrace, "TOSDVD: decFastNormal\r\n") );
  148. pHwDevExt->VDec.VIDEO_PRSO_PS1();
  149. pHwDevExt->dwSTCtemp = pHwDevExt->VDec.VIDEO_GET_STCA();
  150. }
  151. void decFastSlow( PHW_DEVICE_EXTENSION pHwDevExt )
  152. {
  153. DebugPrint( (DebugLevelTrace, "TOSDVD: decFastSlow\r\n") );
  154. pHwDevExt->VDec.VIDEO_PRSO_PS1();
  155. pHwDevExt->VPro.SUBP_SET_AUDIO_NON();
  156. pHwDevExt->dwSTCtemp = pHwDevExt->VDec.VIDEO_GET_STCA();
  157. }
  158. void decFastFreeze( PHW_DEVICE_EXTENSION pHwDevExt )
  159. {
  160. DebugPrint(( DebugLevelTrace, "TOSDVD: decFastFreeze\r\n" ));
  161. pHwDevExt->dwSTCinPause = pHwDevExt->VDec.VIDEO_GET_STCA();
  162. pHwDevExt->VDec.VIDEO_PLAY_FREEZE();
  163. }
  164. void decFreezeFast( PHW_DEVICE_EXTENSION pHwDevExt )
  165. {
  166. DebugPrint(( DebugLevelTrace, "TOSDVD: decFreezeFast\r\n" ));
  167. pHwDevExt->VDec.VIDEO_SET_STCA( pHwDevExt->dwSTCinPause );
  168. pHwDevExt->VDec.VIDEO_PLAY_FAST( FAST_ONLYI );
  169. }