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.

473 lines
26 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 Intel Corporation.
  10. ;** All Rights Reserved.
  11. ;**
  12. ;*************************************************************************
  13. ;//
  14. ;// $Header: S:\h26x\src\dec\cx512242.asv
  15. ;//
  16. ;// $Log: S:\h26x\src\dec\cx512242.asv $
  17. ;//
  18. ;// Rev 1.8 20 Mar 1996 10:57:22 bnickers
  19. ;// Fix numerous bugs.
  20. ;//
  21. ;// Rev 1.7 19 Mar 1996 11:50:22 bnickers
  22. ;// Fix error regarding commitment of pages to stack.
  23. ;//
  24. ;// Rev 1.6 18 Mar 1996 09:58:36 bnickers
  25. ;// Make color convertors non-destructive.
  26. ;//
  27. ;// Rev 1.5 05 Feb 1996 13:35:36 BNICKERS
  28. ;// Fix RGB16 color flash problem, by allowing different RGB16 formats at oce.
  29. ;//
  30. ;// Rev 1.4 22 Dec 1995 15:42:18 KMILLS
  31. ;// added new copyright notice
  32. ;//
  33. ;// Rev 1.3 30 Oct 1995 17:15:32 BNICKERS
  34. ;// Fix color shift in RGB24 color convertors.
  35. ;//
  36. ;// Rev 1.2 26 Oct 1995 17:49:36 CZHU
  37. ;// Fix a whole bunch of bugs.
  38. ;//
  39. ;// Rev 1.1 26 Oct 1995 09:46:22 BNICKERS
  40. ;// Reduce the number of blanks in the "proc" statement because the assembler
  41. ;// sometimes has problems with statements longer than 512 characters long.
  42. ;//
  43. ;// Rev 1.0 25 Oct 1995 17:59:28 BNICKERS
  44. ;// Initial revision.
  45. ;//
  46. ;////////////////////////////////////////////////////////////////////////////
  47. ;
  48. ; +---------- Color convertor.
  49. ; |+--------- For both H261 and H263.
  50. ; ||+-------- Version for the Pentium(r) Microprocessor.
  51. ; |||++------ Convert from YUV12.
  52. ; |||||++---- Convert to RGB24.
  53. ; |||||||+--- Zoom by two.
  54. ; ||||||||
  55. ; cx512242 -- This function performs YUV12-to-RGB24 zoom-by-two color conversion
  56. ; for H26x. It is tuned for best performance on the Pentium(r)
  57. ; Microprocessor. It handles the format in which the low order
  58. ; byte is B, the second byte is G, and the high order byte is R.
  59. ;
  60. ; The YUV12 input is planar, 8 bits per pel. The Y plane may have
  61. ; a pitch of up to 768. It may have a width less than or equal
  62. ; to the pitch. It must be DWORD aligned, and preferably QWORD
  63. ; aligned. Pitch and Width must be a multiple of four. For best
  64. ; performance, Pitch should not be 4 more than a multiple of 32.
  65. ; Height may be any amount, but must be a multiple of two. The U
  66. ; and V planes may have a different pitch than the Y plane, subject
  67. ; to the same limitations.
  68. ;
  69. ; The color convertor is non-destructive; the input Y, U, and V
  70. ; planes will not be clobbered.
  71. OPTION PROLOGUE:None
  72. OPTION EPILOGUE:ReturnAndRelieveEpilogueMacro
  73. include locals.inc
  74. include ccinst.inc
  75. include decconst.inc
  76. .xlist
  77. include memmodel.inc
  78. .list
  79. .DATA
  80. ; any data would go here
  81. .CODE
  82. ASSUME cs : FLAT
  83. ASSUME ds : FLAT
  84. ASSUME es : FLAT
  85. ASSUME fs : FLAT
  86. ASSUME gs : FLAT
  87. ASSUME ss : FLAT
  88. ; void FAR ASM_CALLTYPE YUV12ToRGB24ZoomBy2 (U8 * YPlane,
  89. ; U8 * VPlane,
  90. ; U8 * UPlane,
  91. ; UN FrameWidth,
  92. ; UN FrameHeight,
  93. ; UN YPitch,
  94. ; UN VPitch,
  95. ; UN AspectAdjustmentCount,
  96. ; U8 FAR * ColorConvertedFrame,
  97. ; U32 DCIOffset,
  98. ; U32 CCOffsetToLine0,
  99. ; IN CCOPitch,
  100. ; IN CCType)
  101. ;
  102. ; CCOffsetToLine0 is relative to ColorConvertedFrame.
  103. ;
  104. PUBLIC YUV12ToRGB24ZoomBy2
  105. ; due to the need for the ebp reg, these parameter declarations aren't used,
  106. ; they are here so the assembler knows how many bytes to relieve from the stack
  107. YUV12ToRGB24ZoomBy2 proc DIST LANG AYPlane: DWORD,
  108. AVPlane: DWORD,
  109. AUPlane: DWORD,
  110. AFrameWidth: DWORD,
  111. AFrameHeight: DWORD,
  112. AYPitch: DWORD,
  113. AVPitch: DWORD,
  114. AAspectAdjustmentCnt: DWORD,
  115. AColorConvertedFrame: DWORD,
  116. ADCIOffset: DWORD,
  117. ACCOffsetToLine0: DWORD,
  118. ACCOPitch: DWORD,
  119. ACCType: DWORD
  120. LocalFrameSize = 64+768*8+32
  121. RegisterStorageSize = 16
  122. ; Arguments:
  123. YPlane_arg = RegisterStorageSize + 4
  124. VPlane_arg = RegisterStorageSize + 8
  125. UPlane_arg = RegisterStorageSize + 12
  126. FrameWidth_arg = RegisterStorageSize + 16
  127. FrameHeight = RegisterStorageSize + 20
  128. YPitch_arg = RegisterStorageSize + 24
  129. ChromaPitch_arg = RegisterStorageSize + 28
  130. AspectAdjustmentCount_arg = RegisterStorageSize + 32
  131. ColorConvertedFrame = RegisterStorageSize + 36
  132. DCIOffset = RegisterStorageSize + 40
  133. CCOffsetToLine0 = RegisterStorageSize + 44
  134. CCOPitch = RegisterStorageSize + 48
  135. CCType_arg = RegisterStorageSize + 52
  136. EndOfArgList = RegisterStorageSize + 56
  137. ; Locals (on local stack frame)
  138. CCOCursor EQU [esp+ 0]
  139. CCOSkipDistance EQU [esp+ 4]
  140. ChromaLineLen EQU [esp+ 8]
  141. YSkipDistance EQU [esp+12]
  142. YLimit EQU [esp+16]
  143. YCursor EQU [esp+20]
  144. VCursor EQU [esp+24]
  145. DistanceFromVToU EQU [esp+28]
  146. EndOfChromaLine EQU [esp+32]
  147. AspectCount EQU [esp+36]
  148. ChromaPitch EQU [esp+40]
  149. AspectAdjustmentCount EQU [esp+44]
  150. LineParity EQU [esp+48]
  151. LumaPitch EQU [esp+52]
  152. FrameWidth EQU [esp+56]
  153. StashESP EQU [esp+60]
  154. ChromaContribution EQU [esp+64]
  155. B0R0G0B0 EQU [esp+72]
  156. G1B1R0G0 EQU [esp+76]
  157. R1G1B1R1 EQU [esp+80]
  158. B2R2G2B2 EQU [esp+84]
  159. G3B3R2G2 EQU [esp+88]
  160. R3G3B3R3 EQU [esp+92]
  161. push esi
  162. push edi
  163. push ebp
  164. push ebx
  165. mov edi,esp
  166. sub esp,4096
  167. mov eax,[esp]
  168. sub esp,LocalFrameSize-4096
  169. and esp,0FFFFF000H
  170. mov eax,[esp]
  171. and esp,0FFFFE000H
  172. mov eax,[esp]
  173. sub esp,1000H
  174. mov eax,[esp]
  175. sub esp,1000H
  176. mov eax,[esp]
  177. add esp,2000H
  178. mov eax,[edi+YPitch_arg]
  179. mov ebx,[edi+ChromaPitch_arg]
  180. mov ecx,[edi+AspectAdjustmentCount_arg]
  181. mov edx,[edi+FrameWidth_arg]
  182. mov LumaPitch,eax
  183. mov ChromaPitch,ebx
  184. mov AspectAdjustmentCount,ecx
  185. mov AspectCount,ecx
  186. mov FrameWidth,edx
  187. mov ebx,[edi+VPlane_arg]
  188. mov ecx,[edi+UPlane_arg]
  189. mov eax,[edi+YPlane_arg]
  190. sub ecx,ebx
  191. mov DistanceFromVToU,ecx
  192. mov VCursor,ebx
  193. mov YCursor,eax
  194. mov eax,[edi+ColorConvertedFrame]
  195. add eax,[edi+DCIOffset]
  196. add eax,[edi+CCOffsetToLine0]
  197. mov CCOCursor,eax
  198. mov StashESP,edi
  199. mov edx,[edi+FrameHeight]
  200. mov ecx,LumaPitch
  201. imul edx,ecx
  202. mov ebx,FrameWidth
  203. mov eax,[edi+CCOPitch]
  204. sub ecx,ebx
  205. mov esi,YCursor ; Fetch cursor over luma plane.
  206. lea ebp,[ebx+ebx*4]
  207. add edx,esi
  208. add ebp,ebx
  209. mov YSkipDistance,ecx
  210. sub eax,ebp
  211. mov YLimit,edx
  212. shr ebx,1
  213. mov CCOSkipDistance,eax
  214. mov ChromaLineLen,ebx
  215. mov ecx,AspectAdjustmentCount
  216. mov esi,VCursor
  217. mov AspectCount,ecx
  218. ; Register Usage:
  219. ;
  220. ; edi -- Y Line cursor. Chroma contribs go in lines above current Y line.
  221. ; esi -- Chroma Line cursor.
  222. ; ebp -- Y Pitch
  223. ; edx -- Distance from V pel to U pel.
  224. ; ecx -- V contribution to RGB; sum of U and V contributions.
  225. ; ebx -- U contribution to RGB.
  226. ; eax -- Alternately a U and a V pel.
  227. PrepareChromaLine:
  228. mov edi,ChromaLineLen
  229. xor eax,eax
  230. mov edx,DistanceFromVToU
  231. mov al,[esi] ; Fetch V.
  232. add edi,esi ; Compute EOL address.
  233. xor ecx,ecx
  234. mov ebp,PD V24Contrib[eax*8] ; ebp[ 0: 7] -- Zero
  235. ; ; ebp[ 8:15] -- V contrib to G.
  236. ; ; ebp[16:23] -- V contrib to R.
  237. ; ; ebp[24:31] -- Zero.
  238. mov cl,[esi+edx] ; Fetch U.
  239. mov EndOfChromaLine,edi
  240. xor ebx,ebx ; Keep pairing happy.
  241. mov ebx,PD U24Contrib[ecx*8] ; ebx[ 0: 7] -- U contrib to B.
  242. ; ; ebx[ 8:15] -- U contrib to G.
  243. ; ; ebx[16:23] -- Zero.
  244. mov cl,[esi+edx+1] ; Fetch next U.
  245. lea edi,ChromaContribution
  246. add ebp,ebx ; Chroma contributions to RGB.
  247. NextChromaPel:
  248. mov ebx,PD U24Contrib[ecx*8] ; See above.
  249. mov al,[esi+1] ; Fetch V.
  250. mov [edi],ebp ; Store contribs to use for even chroma pel.
  251. mov cl,[esi+edx+2] ; Fetch next U.
  252. mov ebp,PD V24Contrib[eax*8] ; See above.
  253. add edi,32
  254. add ebp,ebx ; Chroma contributions to RGB.
  255. mov al,[esi+2] ; Fetch V.
  256. mov [edi-28],ebp ; Store contribs to use for odd chroma pel.
  257. mov ebx,PD U24Contrib[ecx*8] ; See above.
  258. mov ebp,PD V24Contrib[eax*8] ; See above.
  259. mov cl,[esi+edx+3] ; Fetch next U.
  260. add ebp,ebx ; Chroma contributions to RGB.
  261. add esi,2 ; Inc Chroma cursor.
  262. cmp esi,EndOfChromaLine
  263. jne NextChromaPel
  264. xor eax,eax
  265. mov esi,YCursor
  266. mov [edi+4],eax ; Store EOL indicator.
  267. mov LineParity,eax
  268. DoLine1:
  269. ; EAX EBX ECX EDX EBP
  270. xor ebx,ebx ; -- -- -- -- >-- -- -- -- ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
  271. xor ecx,ecx ; -- -- -- -- -- -- -- -- >-- -- -- -- ?? ?? ?? ?? ?? ?? ?? ??
  272. mov ebp,ChromaContribution ; Fetch preprocessed chroma contribs. -- -- -- -- -- -- -- -- -- -- -- -- ?? ?? ?? ?? AA AA AA AA
  273. xor edx,edx ; -- -- -- -- -- -- -- -- -- -- -- -- >-- -- -- -- AA AA AA AA
  274. mov cl,[esi] ; Fetch Y0. -- -- -- -- -- -- -- -- m>-- -- -- y0 -- -- -- -- AA AA AA AA
  275. mov bl,ChromaContribution+3 ; Fetch U contrib to B value. -- -- -- -- m>-- -- -- uB01 -- -- -- y0 -- -- -- -- AA AA AA AA
  276. mov dl,ChromaContribution+2 ; Fetch UV contrib to G value. -- -- -- -- -- -- -- uB01 -- -- -- y0 m>-- -- -- uvG01 AA AA AA AA
  277. and ebp,0000001FFH ; Extract V contrib to R. -- -- -- -- -- -- -- uB01 -- -- -- y0 -- -- -- uvG01 >-- -- -1 AA
  278. mov edi,CCOCursor ; -- -- -- -- -- -- -- uB01 -- -- -- y0 -- -- -- uvG01 -- -- -1 AA
  279. sub esp,6144 ; -- -- -- -- -- -- -- uB01 -- -- -- y0 -- -- -- uvG01 -- -- -1 AA
  280. xor eax,eax ; >-- -- -- -- -- -- -- uB01 -- -- -- y0 -- -- -- uvG01 -- -- -1 AA
  281. ; Register Usage:
  282. ;
  283. ; esi -- Cursor over a line of the Y Plane.
  284. ; edi -- Cursor over the color conv output.
  285. ; ebp -- V contribution to R field of RGB value.
  286. ; edx -- UV contrib to G field; U contrib to B field of RGB value.
  287. ; ecx -- Y value (i.e. Y contribution to R, G, and B);
  288. ; ebx -- Construction of one and a third pels of RGB24.
  289. ; eax -- Construction of one and a third pels of RGB24.
  290. Next4YPelsLine0:
  291. ; EAX EBX ECX EDX EBP
  292. mov al,PB B24Value[ecx+ebx*2] ; Fetch Pel0 B m>-- -- -- B0 <-- -- -- uB01 <-- -- -- y0 -- -- -- uvG01 -- -- -1 AA
  293. mov bh,PB R24Value[ecx+ebp*1] ; Fetch Pel0 R. -- -- -- B0 m>-- -- R0 uB01 <-- -- -- y0 -- -- -- uvG01 <-- -- -1 AA
  294. mov bl,PB G24Value[ecx+edx] ; Fetch Pel0 G. -- -- -- B0 m>-- -- R0 G0 <-- -- -- y0 <-- -- -- uvG01 -- -- -1 AA
  295. mov cl,[esi+1] ; Fetch Y1. -- -- -- B0 -- -- R0 G0 m>-- -- -- y1 -- -- -- uvG01 -- -- -1 AA
  296. shl ebx,8 ; -- -- -- B0 >-- R0 G0 -- -- -- -- y1 -- -- -- uvG01 -- -- -1 AA
  297. shl ebx,8 ; -- -- -- B0 >R0 G0 -- -- -- -- -- y1 -- -- -- uvG01 -- -- -1 AA
  298. mov bh,PB G24Value[ecx+edx] ; Fetch Pel1 G. -- -- -- B0 m>R0 G0 G1 -- <-- -- -- y1 <-- -- -- uvG01 -- -- -1 AA
  299. mov dl,ChromaContribution+6144+3 ; Refetch U contrib to B value. -- -- -- B0 R0 G0 G1 -- -- -- -- y1 m>-- -- -- uB01 -- -- -1 AA
  300. mov bl,PB B24Value[ecx+edx*2] ; Fetch Pel1 B. -- -- -- B0 m>R0 G0 G1 B1 <-- -- -- y1 <-- -- -- uB01 -- -- -1 AA
  301. add al,bl ; Fetch Pel1 B. r>-- -- -- B0+B1 R0 G0 G1 B1 -- -- -- y1 -- -- -- uB01 -- -- -1 AA
  302. shr al,1 ; Fetch Pel1 B. >-- -- -- B01 R0 G0 G1 B1 -- -- -- y1 -- -- -- uB01 -- -- -1 AA
  303. or eax,ebx ; r>-- R0 G0 B0 <-- R0 G0 -- -- -- -- y1 -- -- -- uvG01 -- -- -1 AA
  304. mov bh,PB G24Value[ecx+edx] ; Fetch Pel1 G. -- R0 G0 B0 m>-- R0 G1 -- <-- -- -- y1 <-- -- -- uvG01 -- -- -1 AA
  305. mov dl,ChromaContribution+6144+3 ; Refetch U contrib to B value. -- R0 G0 B0 -- R0 G1 -- -- -- -- y1 m>-- -- -- uB01 -- -- -1 AA
  306. mov bl,PB B24Value[ecx+edx*2] ; Fetch Pel1 B. -- R0 G0 B0 m>-- R0 G1 B1 <-- -- -- y1 <-- -- -- uB01 -- -- -1 AA
  307. rol ebx,16 ; Make room for R1 -- R0 G0 B0 >G1 B1 -- R0 -- -- -- y1 -- -- -- uB01 -- -- -1 AA
  308. mov dl,bl ; Save R0. -- R0 G0 B0 G1 B1 -- R0 -- -- -- y1 >-- -- -- R0 -- -- -1 AA
  309. mov bl,PB R24Value[ecx+ebp*1] ; Fetch Pel1 R1. -- R0 G0 B0 >G1 B1 -- R1 <-- -- -- y1 -- -- -- R0 <-- -- -1 AA
  310. add dl,bl ; Add R1 to R0. -- R0 G0 B0 G1 B1 -- R1 -- -- -- y1 >-- -- -- R0+R1 -- -- -1 AA
  311. shr edx,1 ; Compute (R1+R0)/2. -- R0 G0 B0 G1 B1 -- R1 -- -- -- y1 >-- -- -- R01 -- -- -1 AA
  312. mov bh,dl ; Save R01. -- R0 G0 B0 >G1 B1 R01R1 -- -- -- y1 <-- -- -- R01 -- -- -1 AA
  313. rol ebx,16 ; Reorder components. -- R0 G0 B0 >R01R1 G1 B1 -- -- -- y1 -- -- -- R01 -- -- -1 AA
  314. mov dl,al ; Copy B0. <-- R0 G0 B0 R01R1 G1 B1 -- -- -- y1 r>-- -- -- B0 -- -- -1 AA
  315. mov cl,bh ; Copy G1. -- R0 G0 B0 <R01R1 G1 B1 r>-- -- -- G1 -- -- -- B0 -- -- -1 AA
  316. add dl,bl ; Add B1 to B0. -- R0 G0 B0 <R01R1 G1 B1 -- -- -- G1 r>-- -- -- B0+B1 -- -- -1 AA
  317. add cl,ah ; Add G0 to G1. <-- R0 G0 B0 R01R1 G1 B1 r>-- -- -- G1+G0 -- -- -- B0+B1 -- -- -1 AA
  318. shr edx,1 ; Compute (B1+B0)/2. -- R0 G0 B0 R01R1 G1 B1 -- -- -- G1+G0 >-- -- -- B01 -- -- -1 AA
  319. shr ecx,1 ; Compute (G1+G0)/2. -- R0 G0 B0 R01R1 G1 B1 >-- -- -- G01 -- -- -- B01 -- -- -1 AA
  320. shl ecx,24 ; Reorder nibbles. -- R0 G0 B0 R01R1 G1 B1 -- -- -- G01 >B01-- -- -- -- -- -1 AA
  321. or eax,edx ; Reorder nibbles. r>B01R0 G0 B0 R01R1 G1 B1 -- -- -- G01 <B01-- -- -- -- -- -1 AA
  322. mov Ze [edi],eax ; Save B01R0G0B0. m<B01R0 G0 B0 R01R1 G1 B1 -- -- -- G01 B01-- -- -- -- -- -1 AA
  323. mov edx,ebx ; B01R0 G0 B0 <R01R1 G1 B1 -- -- -- G01 >R01R1 G1 B1 -- -- -1 AA
  324. rol edx,16 ; B01R0 G0 B0 R01R1 G1 B1 -- -- -- G01 >G1 B1 R01R1 -- -- -1 AA
  325. mov dl,cl ; B01R0 G0 B0 R01R1 G1 B1 <-- -- -- G01 >R1 B1 R01G01 -- -- -1 AA
  326. mov Ze [edi+4],edx ; Save R1B1R01G01. B01R0 G0 B0 R01R1 G1 B1 -- -- -- G01 m<R1 B1 R01G01 -- -- -1 AA
  327. mov ebp,ChromaContribution+6144+4 ; Fetch preprocessed chroma contribs. B0 R0 G0 B0 G1 B1 R0 R1 -- -- -- y1 -- -- -- uB01 BB BB BB BB
  328. mov bh,bl ; Copy Pel1 R. B0 R0 G0 B0 >G1 B1 R1 R1 -- -- -- y1 -- -- -- uB01 BB BB BB BB
  329. mov cl,[esi+2] ; Fetch Y2. B0 R0 G0 B0 G1 B1 R1 R1 m>-- -- -- y2 -- -- -- uB01 BB BB BB BB
  330. ror ebx,8 ; Third output: B0 R0 G0 B0 >R1 G1 B1 R1 -- -- -- y2 -- -- -- uB01 BB BB BB BB
  331. and ebp,0000001FFH ; Extract V contrib to R. B0 R0 G0 B0 >R1 G1 B1 R1 -- -- -- y2 -- -- -- uB01 -- -- -1 BB
  332. mov dl,ChromaContribution+6144+6 ; Fetch UV contrib to G value. B0 R0 G0 B0 R1 G1 B1 R1 -- -- -- y2 >-- -- -- uvG23 -- -- -1 BB
  333. xor eax,eax ; >-- -- -- -- R1 G1 B1 R1 -- -- -- y2 -- -- -- uvG23 -- -- -1 BB
  334. mov al,ChromaContribution+6144+7 ; Fetch U contrib to B value. >-- -- -- uB23 R1 G1 B1 R1 -- -- -- y2 -- -- -- uvG23 -- -- -1 BB
  335. mov R1G1B1R1+6144,ebx ; Stash for saving to second line. -- -- -- uB23 m<R1 G1 B1 R1 -- -- -- y2 -- -- -- uvG23 -- -- -1 BB
  336. mov Ze [edi+8],ebx ; Save R1G1B1R1. -- -- -- uB23 m<R1 G1 B1 R1 -- -- -- y2 -- -- -- uvG23 -- -- -1 BB
  337. xor ebx,ebx ; -- -- -- uB23 >-- -- -- -- -- -- -- y2 -- -- -- uvG23 -- -- -1 BB
  338. mov bh,PB B24Value[ecx+eax*2] ; Fetch Pel2 B. <-- -- -- uB23 >-- -- B2 -- <-- -- -- y2 -- -- -- uvG23 -- -- -1 BB
  339. mov ah,PB R24Value[ecx+ebp*1] ; Fetch Pel2 R. >-- -- R2 uB23 -- -- B2 -- <-- -- -- y2 -- -- -- uvG23 <-- -- -1 BB
  340. mov al,PB G24Value[ecx+edx] ; Fetch Pel2 G. >-- -- R2 G2 -- -- B2 -- <-- -- -- y2 <-- -- -- uvG23 -- -- -1 BB
  341. mov cl,[esi+3] ; Fetch Y3. -- -- R2 G2 -- -- B2 -- >-- -- -- y3 -- -- -- uvG23 -- -- -1 BB
  342. shl eax,16 ; R2 G2 -- -- >R2 G2 -- -- -- -- B2 -- -- -- -- y3 -- -- -- uvG23 -- -- -1 BB
  343. mov bl,bh ; Copy Pel2 B. -- -- B2 B2 R2 G2 -- -- >-- -- B2 B2 -- -- -- y3 -- -- -- uvG23 -- -- -1 BB
  344. or ebx,eax ; R2 G2 B2 B2 R2 G2 -- -- >R2 G2 B2 B2 -- -- -- y3 -- -- -- uvG23 -- -- -1 BB
  345. mov ah,PB G24Value[ecx+edx] ; Fetch Pel1 G. R2 G2 G3 -- >R2 G2 G3 -- R2 G2 B2 B2 <-- -- -- y3 <-- -- -- uvG23 -- -- -1 BB
  346. ror ebx,8 ; Fourth output: B2 R2 G2 B2 R2 G2 G3 -- >B2 R2 G2 B2 -- -- -- y3 -- -- -- uvG23 -- -- -1 BB
  347. mov dl,ChromaContribution+6144+7 ; Refetch U contrib to B value. R2 G2 G3 -- B2 R2 G2 B2 -- -- -- y3 >-- -- -- uB23 -- -- -1 BB
  348. mov Ze [edi+12],ebx ; Save B2R2G2B2. R2 G2 G3 -- m<B2 R2 G2 B2 -- -- -- y3 -- -- -- uB23 -- -- -1 BB
  349. mov al,PB B24Value[ecx+edx*2] ; Fetch Pel3 B. R2 G2 G3 B3 m>R2 G2 G3 B3 B2 R2 G2 B2 <-- -- -- y3 <-- -- -- uB23 -- -- -1 BB
  350. rol eax,16 ; Fifth output: G3 B3 R2 G2 >G3 B3 R2 G2 B2 R2 G2 B2 -- -- -- y3 -- -- -- uB23 -- -- -1 BB
  351. mov B2R2G2B2+6144,ebx ; Stash for saving to second line. G3 B3 R2 G2 m<B2 R2 G2 B2 -- -- -- y3 -- -- -- uB23 -- -- -1 BB
  352. mov Ze [edi+16],eax ; Save G3B3R2G2. m<G3 B3 R2 G2 B2 R2 G2 B2 -- -- -- y3 -- -- -- uB23 -- -- -1 BB
  353. mov G3B3R2G2+6144,eax ; Stash for saving to second line. m<G3 B3 R2 G2 B2 R2 G2 B2 -- -- -- y3 -- -- -- uB23 -- -- -1 BB
  354. mov al,PB R24Value[ecx+ebp*1] ; Fetch Pel3 R. G3 B3 -- R3 m>G3 B3 R2 R3 B2 R2 G2 B2 <-- -- -- y3 -- -- -- uB23 <-- -- -1 BB
  355. mov ebp,ChromaContribution+6144+32; Fetch preprocessed chroma contribs. G3 B3 R2 R3 B2 R2 G2 B2 -- -- -- y3 -- -- -- uB23 m>CC CC CC CC
  356. mov ah,al ; Copy Pel3 R. G3 B3 R3 R3 >G3 B3 R3 R3 B2 R2 G2 B2 -- -- -- y3 -- -- -- uB23 CC CC CC CC
  357. mov cl,[esi+4] ; Fetch Y4. G3 B3 R3 R3 B2 R2 G2 B2 >-- -- -- y4 -- -- -- uB23 CC CC CC CC
  358. ror eax,8 ; Sixth output: R3 G3 B3 R3 >R3 G3 B3 R3 B2 R2 G2 B2 -- -- -- y4 -- -- -- uB23 CC CC CC CC
  359. xor ebx,ebx ; R3 G3 B3 R3 >-- -- -- -- -- -- -- y4 -- -- -- uB23 CC CC CC CC
  360. mov dl,ChromaContribution+6144+34 ; Fetch UV contrib to G value. R3 G3 B3 R3 -- -- -- -- -- -- -- y4 m>-- -- -- uvG45 CC CC CC CC
  361. and ebp,0000001FFH ; Extract U contrib to B. R3 G3 B3 R3 -- -- -- -- -- -- -- y4 -- -- -- uvG45 >-- -- -1 CC
  362. mov bl,ChromaContribution+6144+35 ; Fetch U contrib to B value. R3 G3 B3 R3 >-- -- -- uB45 -- -- -- y4 -- -- -- uvG45 -- -- -1 CC
  363. lea esi,[esi+4] ; Advance input cursor. R3 G3 B3 R3 -- -- -- uB45 -- -- -- y4 -- -- -- uvG45 -- -- -1 CC
  364. mov Ze [edi+20],eax ; Save R3G3B3R3. m<R3 G3 B3 R3 -- -- -- uB45 -- -- -- y4 -- -- -- uvG45 -- -- -1 CC
  365. mov R3G3B3R3+6144,eax ; Stash for saving to second line. m<R3 G3 B3 R3 -- -- -- uB45 -- -- -- y4 -- -- -- uvG45 -- -- -1 CC
  366. mov eax,ebx ; r>-- -- -- uB45 <-- -- -- uB45 -- -- -- y4 -- -- -- uvG45 -- -- -1 C
  367. lea esp,[esp+32]
  368. lea edi,[edi+24] ; Advance output cursor.
  369. jne Next4YPelsLine0
  370. and esp,0FFFFE000H
  371. add esp,02000H
  372. mov ebx,CCOSkipDistance
  373. mov ebp,AspectCount
  374. add edi,ebx
  375. sub ebp,2 ; If count is non-zero, we keep the line.
  376. mov AspectCount,ebp
  377. lea ecx,B0R0G0B0
  378. mov eax,FrameWidth
  379. jg Keep2ndLineOfLine0
  380. add ebp,AspectAdjustmentCount
  381. mov AspectCount,ebp
  382. jmp Skip2ndLineOfLine0
  383. Keep2ndLineOfLine0:
  384. Keep2ndLineOfLine0_Loop:
  385. mov ebp,[ecx]
  386. sub eax,4
  387. mov Ze PD [edi],ebp
  388. mov ebp,[ecx+4]
  389. mov Ze PD [edi+4],ebp
  390. mov ebp,[ecx+8]
  391. mov Ze PD [edi+8],ebp
  392. mov ebp,[ecx+12]
  393. mov Ze PD [edi+12],ebp
  394. mov ebp,[ecx+16]
  395. mov Ze PD [edi+16],ebp
  396. mov ebp,[ecx+20]
  397. mov Ze PD [edi+20],ebp
  398. lea ecx,[ecx+32]
  399. lea edi,[edi+24]
  400. jne Keep2ndLineOfLine0_Loop
  401. add edi,ebx
  402. Skip2ndLineOfLine0:
  403. mov bl,LineParity
  404. add esi,YSkipDistance
  405. xor bl,1
  406. mov CCOCursor,edi
  407. mov YCursor,esi
  408. mov LineParity,bl
  409. jne DoLine1
  410. mov eax,esi
  411. mov esi,VCursor ; Inc VPlane cursor to next line.
  412. mov ebp,ChromaPitch
  413. mov ebx,YLimit ; Done with last line?
  414. add esi,ebp
  415. cmp eax,ebx
  416. mov VCursor,esi
  417. jb PrepareChromaLine
  418. Done:
  419. mov esp,StashESP
  420. pop ebx
  421. pop ebp
  422. pop edi
  423. pop esi
  424. rturn
  425. YUV12ToRGB24ZoomBy2 endp
  426. END