Leaked source code of windows server 2003
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.

317 lines
8.6 KiB

  1. ;/* *************************************************************************
  2. ;** INTEL Corporation Proprietary Information
  3. ;**
  4. ;** This listing is supplied under the terms of a license
  5. ;** agreement with INTEL Corporation and may not be copied
  6. ;** nor disclosed except in accordance with the terms of
  7. ;** that agreement.
  8. ;**
  9. ;** Copyright (c) 1995, 1996 Intel Corporation.
  10. ;** All Rights Reserved.
  11. ;**
  12. ;** *************************************************************************
  13. ;*/
  14. ;--------------------------------------------------------------------------;
  15. ;
  16. ; d3xpand.asm
  17. ;
  18. ; Description:
  19. ; This routine expands a picture frame by 16 or 8 bytes in all
  20. ; directions for unrestricted motion vector mode. It assumes
  21. ; that there is space in memory around the existing frame
  22. ; and simply writes to there (i.e., clobbers it), and that
  23. ; the pitch is 384 (distance in bytes between vertically
  24. ; adjacent pels). See Below.
  25. ;
  26. ; Routines: prototypes in:
  27. ; ExpandPlane d3dec.cpp
  28. ;
  29. ; Data:
  30. ; This routine assumes that the PITCH is 384.
  31. ;
  32. ; Inputs (dwords pushed onto stack by caller):
  33. ; StartPtr flat pointer to the first byte of the
  34. ; original frame.
  35. ; FrameWidth Width (in bytes) of the original frame.
  36. ; THIS MUST BE AT LEAST 32 & A MULTIPLE OF 4.
  37. ; FrameHeight Height (in rows) of the original frame.
  38. ; Pels Number of pels to expand the plane.
  39. ; 16 for lumina, 8 for chroma. This MUST
  40. ; BE A MULTIPLE OF 8.
  41. ;
  42. ;--------------------------------------------------------------------------;
  43. ;--------------------------------------------------------------------------;
  44. ;
  45. ; $Header: S:\h26x\src\dec\d35xpand.asv 1.2 08 Mar 1996 16:48:16 AGUPTA2 $
  46. ; $Log: S:\h26x\src\dec\d35xpand.asv $
  47. ;//
  48. ;// Rev 1.2 08 Mar 1996 16:48:16 AGUPTA2
  49. ;// Changed the meaning of last parameter. New and faster way to expand planes.
  50. ;//
  51. ;//
  52. ;// Rev 1.0 27 Nov 1995 11:28:30 RMCKENZX
  53. ;// Initial revision.
  54. ;
  55. ;--------------------------------------------------------------------------;
  56. .586
  57. .MODEL FLAT
  58. ; make all symbols case sensitive
  59. OPTION CASEMAP:NONE
  60. .CODE
  61. ;--------------------------------------------------------------------------;
  62. ;
  63. ; The algorithm fills in (1) the bottom (not including corners),
  64. ; then (2) the sides (including the bottom corners, but not the
  65. ; top corners), then (3) the top (including the top
  66. ; corners) as shown below, replicating the outermost bytes
  67. ; of the original frame outward:
  68. ;
  69. ; ----------------------------
  70. ; | |
  71. ; | (3) |
  72. ; | |
  73. ; |----------------------------|
  74. ; | | | |
  75. ; | | | |
  76. ; | | | |
  77. ; | | original | |
  78. ; | | frame | |
  79. ; | | | |
  80. ; | (2) | | (2) |
  81. ; | | | |
  82. ; | | | |
  83. ; | |----------------| |
  84. ; | | | |
  85. ; | | (1) | |
  86. ; | | | |
  87. ; ----------------------------
  88. ;
  89. ; Register Usage:
  90. ;
  91. ; esi pointer for stages (1) and (2).
  92. ; edi pointer for stages (2) and (3).
  93. ; ecx loop control.
  94. ; eax, ebx dword to be written. In stage (2), it is formed
  95. ; from 4 (shifted) copies of the border byte. (i.e.,
  96. ; byte 0d2h replicates to 0d2d2d2d2h.)
  97. ; edx, ebp pointers.
  98. ;
  99. ;--------------------------------------------------------------------------;
  100. ;
  101. ; Version: 5.0
  102. ; Date: 4 March 1996
  103. ; Author: R. McKenzie
  104. ;
  105. ; Notes: The essential features of this version are:
  106. ; 1. Re-organized to fill bottom first, then sides,
  107. ; finally top
  108. ; 2. Code is optimized for the case that the expanded
  109. ; plane is 32-byte aligned. No checking is performed
  110. ; to verify this assumption and this routine will run
  111. ; significantly SLOWER (though correctly) if this
  112. ; assumption is not true.
  113. ;
  114. ;--------------------------------------------------------------------------;
  115. ;-------------------;
  116. ; Stack Usage ;
  117. ;-------------------;
  118. ; register storage
  119. ; edi esp+00
  120. ; esi esp+04
  121. ; ebx esp+08
  122. ; ebp esp+12
  123. ; return address esp+16
  124. ; C input parameters
  125. StartPtr EQU esp+20
  126. FrameWidth EQU esp+24
  127. FrameHeight EQU esp+28
  128. Pels EQU esp+32
  129. PITCH = 384
  130. PUBLIC C ExpandPlane
  131. ExpandPlane:
  132. push ebp
  133. push ebx
  134. push esi
  135. push edi
  136. ;--------------------------------------;
  137. ; fill the bottom ;
  138. ;--------------------------------------;
  139. mov esi, [StartPtr] ; ptr1 = StartPtr
  140. mov edi, [FrameHeight]
  141. shl edi, 7
  142. mov ebp, PITCH
  143. lea edi, [edi+2*edi-PITCH] ; PITCH * (FrameHeight-1)
  144. mov edx, [FrameWidth] ; column bound
  145. add esi, edi ; esi = bottom left corner
  146. nop
  147. ;-------Start Outer Bottom Loop--------;
  148. OuterBottomLoop:
  149. mov edi, esi ; destination pointer
  150. mov ecx, [Pels] ; row bound
  151. mov eax, 0[esi]
  152. mov ebx, 4[esi]
  153. ;-------Start Inner Bottom Loop--------;
  154. InnerBottomLoop:
  155. mov 0[edi+ebp], eax
  156. mov 4[edi+ebp], ebx
  157. add edi, ebp
  158. dec ecx
  159. jne InnerBottomLoop
  160. ;--------End Inner Bottom Loop---------;
  161. add esi, 8
  162. sub edx, 8
  163. jne OuterBottomLoop
  164. ;--------End Outer Bottom Loop---------;
  165. ;--------------------------------------;
  166. ; Fill both sides from bottom up ;
  167. ;--------------------------------------;
  168. mov ecx, [FrameHeight]
  169. mov edx, [Pels]
  170. add ecx, edx ; ecx = row count
  171. add edi, 8 ; edi = Right pointer
  172. mov eax, [FrameWidth]
  173. mov esi, edi
  174. sub esi, eax ; esi = Left pointer
  175. nop
  176. ;--------Start Outer Sides Loop--------;
  177. OuterSidesLoop:
  178. xor eax, eax
  179. xor ebx, ebx
  180. mov al, [esi]
  181. push ecx ; save row counter
  182. mov bl, [edi-1]
  183. mov ah, [esi]
  184. mov bh, [edi-1]
  185. mov ebp, eax
  186. shl eax, 16
  187. mov edx, ebx
  188. shl ebx, 16
  189. or eax, ebp
  190. or ebx, edx
  191. mov ebp, esi ; Left Pointer
  192. mov edx, edi ; Right Pointer
  193. mov ecx, [Pels+4] ; column counter
  194. ;--------Start Inner Sides Loop--------;
  195. InnerSidesLoop:
  196. mov [ebp-4], eax
  197. mov [ebp-8], eax
  198. mov [edx], ebx
  199. mov [edx+4], ebx
  200. sub ebp, 8
  201. add edx, 8
  202. sub ecx, 8
  203. jne InnerSidesLoop
  204. ;---------End Inner Sides Loop---------;
  205. pop ecx
  206. sub esi, PITCH
  207. sub edi, PITCH
  208. dec ecx
  209. jne OuterSidesLoop
  210. ;---------End Outer Sides Loop---------;
  211. ;--------------------------------------;
  212. ; Fill the Top ;
  213. ;--------------------------------------;
  214. mov ecx, [Pels] ; ptr1 = StartPtr
  215. mov edx, [FrameWidth] ; column bound
  216. add esi, PITCH
  217. mov ebp, -PITCH
  218. sub esi, ecx
  219. lea edx, [edx+2*ecx] ; FrameWidth + 2 * Pels
  220. ;---------Start Outer Top Loop---------;
  221. OuterTopLoop:
  222. mov edi, esi ; destination pointer
  223. mov ecx, [Pels] ; row bound
  224. mov eax, 0[esi]
  225. mov ebx, 4[esi]
  226. ;---------Start Inner Top Loop---------;
  227. InnerTopLoop:
  228. mov 0[edi+ebp], eax
  229. mov 4[edi+ebp], ebx
  230. add edi, ebp
  231. dec ecx
  232. jne InnerTopLoop
  233. ;----------End Inner Top Loop----------;
  234. add esi, 8
  235. sub edx, 8
  236. jne OuterTopLoop
  237. ;----------End Outer Top Loop----------;
  238. ;--------------------------------------;
  239. ; Wrap up and go home ;
  240. ;--------------------------------------;
  241. pop edi
  242. pop esi
  243. pop ebx
  244. pop ebp
  245. ret
  246. END