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.

644 lines
22 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\cx5128a2.asv
  15. ;//
  16. ;// $Log: S:\h26x\src\dec\cx5128a2.asv $
  17. ;//
  18. ;// Rev 1.6 18 Mar 1996 09:57:48 bnickers
  19. ;// Make color convertors non-destructive.
  20. ;//
  21. ;// Rev 1.5 05 Feb 1996 13:35:32 BNICKERS
  22. ;// Fix RGB16 color flash problem, by allowing different RGB16 formats at oce.
  23. ;//
  24. ;// Rev 1.4 16 Jan 1996 11:23:02 BNICKERS
  25. ;// Fix starting point in output stream, so we don't start at line two and
  26. ;// write off the end of the output frame.
  27. ;//
  28. ;// Rev 1.3 22 Dec 1995 15:59:12 KMILLS
  29. ;//
  30. ;// added new copyright notice
  31. ;//
  32. ;// Rev 1.2 20 Nov 1995 10:33:52 BNICKERS
  33. ;// Implement YUV12 to CLUT8AP.
  34. ;//
  35. ;// Rev 1.1 26 Oct 1995 09:45:24 BNICKERS
  36. ;// Reduce the number of blanks in the "proc" statement because the assembler
  37. ;// sometimes has problems with statements longer than 512 characters long.
  38. ;//
  39. ;// Rev 1.0 25 Oct 1995 17:59:24 BNICKERS
  40. ;// Initial revision.
  41. ;//
  42. ;////////////////////////////////////////////////////////////////////////////
  43. ; +--------- Color convertor.
  44. ; |+-------- For both H261 and H263.
  45. ; ||+------- Version for the Pentium Microprocessor.
  46. ; |||++----- Convert from YUV12.
  47. ; |||||+---- Convert to CLUT8.
  48. ; ||||||+--- Active palette.
  49. ; |||||||+-- Zoom by two
  50. ; cx5128a2 -- This function performs YUV12 to CLUT8, zoom by two color
  51. ; conversion for H26x. It converts the input to the clut8
  52. ; index dyncamically computed for a given active palette.
  53. OPTION PROLOGUE:None
  54. OPTION EPILOGUE:ReturnAndRelieveEpilogueMacro
  55. include locals.inc
  56. include ccinst.inc
  57. include decconst.inc
  58. IFNDEF DSEGNAME
  59. IFNDEF WIN32
  60. DSEGNAME TEXTEQU <Data_cx5128a2>
  61. ENDIF
  62. ENDIF
  63. IFDEF WIN32
  64. .xlist
  65. include memmodel.inc
  66. .list
  67. .DATA
  68. ELSE
  69. DSEGNAME SEGMENT WORD PUBLIC 'DATA'
  70. ENDIF
  71. ; any data would go here
  72. IFNDEF WIN32
  73. DSEGNAME ENDS
  74. .xlist
  75. include memmodel.inc
  76. .list
  77. ENDIF
  78. IFNDEF SEGNAME
  79. IFNDEF WIN32
  80. SEGNAME TEXTEQU <_CODE32>
  81. ENDIF
  82. ENDIF
  83. ifdef WIN32
  84. .CODE
  85. else
  86. SEGNAME SEGMENT PARA PUBLIC USE32 'CODE'
  87. endif
  88. ifdef WIN32
  89. ASSUME cs : FLAT
  90. ASSUME ds : FLAT
  91. ASSUME es : FLAT
  92. ASSUME fs : FLAT
  93. ASSUME gs : FLAT
  94. ASSUME ss : FLAT
  95. else
  96. ASSUME CS : SEGNAME
  97. ASSUME DS : Nothing
  98. ASSUME ES : Nothing
  99. ASSUME FS : Nothing
  100. ASSUME GS : Nothing
  101. endif
  102. ; void FAR ASM_CALLTYPE YUV12ToCLUT8APZoomBy2 (U8 * YPlane,
  103. ; U8 * VPlane,
  104. ; U8 * UPlane,
  105. ; UN FrameWidth,
  106. ; UN FrameHeight,
  107. ; UN YPitch,
  108. ; UN VPitch,
  109. ; UN AspectAdjustmentCount,
  110. ; U8 FAR * ColorConvertedFrame,
  111. ; U32 DCIOffset,
  112. ; U32 CCOffsetToLine0,
  113. ; IN CCOPitch,
  114. ; IN CCType)
  115. ;
  116. ; CCOffsetToLine0 is relative to ColorConvertedFrame.
  117. ;
  118. PUBLIC YUV12ToCLUT8APZoomBy2
  119. ; due to the need for the ebp reg, these parameter declarations aren't used,
  120. ; they are here so the assembler knows how many bytes to relieve from the stack
  121. YUV12ToCLUT8APZoomBy2 proc DIST LANG AYPlane: DWORD,
  122. AVPlane: DWORD,
  123. AUPlane: DWORD,
  124. AFrameWidth: DWORD,
  125. AFrameHeight: DWORD,
  126. AYPitch: DWORD,
  127. AVPitch: DWORD,
  128. AAspectAdjustmentCount: DWORD,
  129. AColorConvertedFrame: DWORD,
  130. ADCIOffset: DWORD,
  131. ACCOffsetToLine0: DWORD,
  132. ACCOPitch: DWORD,
  133. ACCType: DWORD
  134. IFDEF WIN32
  135. LocalFrameSize = 24
  136. RegisterStorageSize = 16
  137. ; Arguments:
  138. YPlane = LocalFrameSize + RegisterStorageSize + 4
  139. VPlane = LocalFrameSize + RegisterStorageSize + 8
  140. UPlane = LocalFrameSize + RegisterStorageSize + 12
  141. FrameWidth = LocalFrameSize + RegisterStorageSize + 16
  142. FrameHeight = LocalFrameSize + RegisterStorageSize + 20
  143. YPitch = LocalFrameSize + RegisterStorageSize + 24
  144. ChromaPitch = LocalFrameSize + RegisterStorageSize + 28
  145. AspectAdjustmentCount = LocalFrameSize + RegisterStorageSize + 32
  146. ColorConvertedFrame = LocalFrameSize + RegisterStorageSize + 36
  147. DCIOffset = LocalFrameSize + RegisterStorageSize + 40
  148. CCOffsetToLine0 = LocalFrameSize + RegisterStorageSize + 44
  149. CCOPitch = LocalFrameSize + RegisterStorageSize + 48
  150. CCType = LocalFrameSize + RegisterStorageSize + 52
  151. EndOfArgList = LocalFrameSize + RegisterStorageSize + 56
  152. ; Locals (on local stack frame)
  153. CCOCursor = 0
  154. ChromaLineLen = 4
  155. YLimit = 8
  156. DistanceFromVToU = 12
  157. EndOfLine = 16
  158. AspectCount = 20
  159. LCL EQU <esp+>
  160. ELSE
  161. ; Arguments:
  162. RegisterStorageSize = 20 ; Put local variables on stack.
  163. InstanceBase_zero = RegisterStorageSize + 4
  164. InstanceBase_SegNum = RegisterStorageSize + 6
  165. YPlane_arg = RegisterStorageSize + 8
  166. VPlane_arg = RegisterStorageSize + 12
  167. UPlane_arg = RegisterStorageSize + 16
  168. FrameWidth_arg = RegisterStorageSize + 20
  169. FrameHeight_arg = RegisterStorageSize + 22
  170. YPitch_arg = RegisterStorageSize + 24
  171. VPitch_arg = RegisterStorageSize + 26
  172. AspectAdjustmentCount_arg = RegisterStorageSize + 28
  173. ColorConvertedFrame = RegisterStorageSize + 30
  174. ColorConvertedFrame_SegNum = RegisterStorageSize + 32
  175. DCIOffset = RegisterStorageSize + 34
  176. CCOffsetToLine0 = RegisterStorageSize + 38
  177. CCOPitch_arg = RegisterStorageSize + 42
  178. EndOfArgList = RegisterStorageSize + 44
  179. ; Locals (in per-instance data segment)
  180. CCOCursor = LocalStorageCC + 0
  181. ChromaLineLen = LocalStorageCC + 4
  182. YLimit = LocalStorageCC + 8
  183. YPlane = LocalStorageCC + 12
  184. VPlane = LocalStorageCC + 16
  185. FrameWidth = LocalStorageCC + 20
  186. FrameHeight = LocalStorageCC + 24
  187. YPitch = LocalStorageCC + 28
  188. ChromaPitch = LocalStorageCC + 32
  189. DistanceFromVToU = LocalStorageCC + 36
  190. CCOPitch = LocalStorageCC + 40
  191. EndOfLine = LocalStorageCC + 44
  192. AspectAdjustmentCount = LocalStorageCC + 48
  193. AspectCount = LocalStorageCC + 52
  194. LCL EQU <>
  195. ENDIF
  196. ; UV dither pattern:
  197. ; 2 3 2 3
  198. ; 0 1 0 1
  199. ; 2 3 2 3
  200. ; 0 1 0 1
  201. ;
  202. ; Y dither pattern:
  203. ; 0 4 1 5
  204. ; 6 2 7 3
  205. ; 1 5 0 4
  206. ; 7 3 6 2
  207. ; DS:ESI points to the beginning of the Y input block
  208. ; ES:EBP points to the output location
  209. ; EBX is available (and clear except for low 8 bits)
  210. Ydither00 = 0
  211. Ydither01 = 4
  212. Ydither02 = 1
  213. Ydither03 = 5
  214. Ydither10 = 6
  215. Ydither11 = 2
  216. Ydither12 = 7
  217. Ydither13 = 3
  218. Ydither20 = 1
  219. Ydither21 = 5
  220. Ydither22 = 0
  221. Ydither23 = 4
  222. Ydither30 = 7
  223. Ydither31 = 3
  224. Ydither32 = 6
  225. Ydither33 = 2
  226. push esi
  227. push edi
  228. push ebp
  229. push ebx
  230. IFDEF WIN32
  231. sub esp,LocalFrameSize
  232. mov ebx,PD [esp+VPlane]
  233. mov ecx,PD [esp+UPlane]
  234. sub ecx,ebx
  235. mov PD [esp+DistanceFromVToU],ecx
  236. mov eax,PD [esp+ColorConvertedFrame]
  237. add eax,PD [esp+DCIOffset]
  238. add eax,PD [esp+CCOffsetToLine0]
  239. mov PD [esp+CCOCursor],eax
  240. ELSE
  241. xor eax,eax
  242. mov eax,ds
  243. push eax
  244. mov ebp,esp
  245. and ebp,00000FFFFH
  246. mov ds, PW [ebp+InstanceBase_SegNum]
  247. mov es, PW [ebp+ColorConvertedFrame_SegNum]
  248. mov ebx,PD [ebp+YPlane_arg] ; Make YPlane accessible
  249. mov ds:PD YPlane,ebx
  250. mov ebx,PD [ebp+VPlane_arg] ; Make VPlane accessible. Pre-dec.
  251. mov ds:PD VPlane,ebx
  252. mov ecx,PD [ebp+UPlane_arg]
  253. sub ecx,ebx
  254. mov ds:PD DistanceFromVToU,ecx
  255. mov ax,PW [ebp+FrameWidth_arg] ; Make FrameWidth accessible
  256. mov ds:PD FrameWidth,eax
  257. mov ax,PW [ebp+FrameHeight_arg] ; Make FrameHeight accessible
  258. mov ds:PD FrameHeight,eax
  259. mov ax,PW [ebp+YPitch_arg] ; Make YPitch accessible
  260. mov ds:PD YPitch,eax
  261. mov ax,PW [ebp+VPitch_arg] ; Make ChromaPitch accessible
  262. mov ds:PD ChromaPitch,eax
  263. mov ax,PW [ebp+AspectAdjustmentCount_arg]; Make count accessible
  264. mov ds:PD AspectAdjustmentCount,eax
  265. mov ax,PW [ebp+ColorConvertedFrame] ; Init CCOCursor
  266. add eax,PD [ebp+DCIOffset]
  267. mov ebx,PD [ebp+CCOffsetToLine0]
  268. add eax,ebx
  269. mov ds:PD CCOCursor,eax
  270. movsx ebx,PW [ebp+CCOPitch_arg] ; Make CCOPitch accessible
  271. mov ds:PD CCOPitch,ebx
  272. ENDIF
  273. Ledx FrameHeight
  274. Lecx YPitch
  275. imul edx,ecx
  276. Lebx FrameWidth
  277. sar ebx,1
  278. Lesi YPlane ; Fetch cursor over luma plane.
  279. add edx,esi
  280. Sedx YLimit
  281. Ledx AspectAdjustmentCOunt
  282. Sedx AspectCount
  283. Sebx ChromaLineLen
  284. NextFourLines:
  285. ; Convert line of U and V pels to the corresponding UVDitherPattern Indices.
  286. ;
  287. ; Register Usage
  288. ;
  289. ; edi -- Cursor over V line
  290. ; esi -- Y line cursor minus 2 times V line cursor.
  291. ; ebp -- Distance from V line to U line.
  292. ; edx -- UVDitherPattern index: ((V:{0:8}*9) + U:{0:8}) * 2 + 1
  293. ; bl -- U pel value
  294. ; al -- V pel value
  295. ; edx -- U contribution to active palette addresses (dithered 4 ways).
  296. ; ecx -- V contribution to active palette addresses (dithered 4 ways).
  297. Ledi VPlane
  298. Lecx ChromaLineLen
  299. add ecx,edi
  300. sub esi,edi
  301. Lebp DistanceFromVToU
  302. sub esi,edi
  303. xor eax,eax
  304. Ledx ChromaPitch
  305. mov al,PB [edi] ; Fetch V pel.
  306. xor ebx,ebx
  307. mov bl,PB [edi+ebp*1] ; Fetch U pel.
  308. add edx,edi
  309. Secx EndOfLine
  310. Sedx VPlane
  311. @@:
  312. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  313. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  314. add ecx,edx ; Chroma contrib to active palette address.
  315. mov al,PB [edi+1] ; Fetch next V pel.
  316. mov PD [esi+edi*2-768*1-4],ecx ; Store chroma contrib.
  317. mov bl,PB [edi+ebp*1+1] ; Fetch U pel.
  318. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  319. mov al,PB [edi+2] ; Fetch next V pel.
  320. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  321. mov bl,PB [edi+ebp*1+2] ; Fetch U pel.
  322. add edx,ecx ; Chroma contrib to active palette address.
  323. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  324. mov PD [esi+edi*2-768*2-8],edx ; Store chroma contrib.
  325. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  326. add ecx,edx ; Chroma contrib to active palette address.
  327. mov al,PB [edi+3] ; Fetch next V pel.
  328. mov PD [esi+edi*2-768*1+4-4],ecx ; Store chroma contrib.
  329. mov bl,PB [edi+ebp*1+3] ; Fetch U pel.
  330. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  331. mov al,PB [edi+4] ; Fetch next V pel.
  332. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  333. mov bl,PB [edi+ebp*1+4] ; Fetch U pel.
  334. add edx,ecx ; Chroma contrib to active palette address.
  335. Lecx EndOfLine
  336. mov PD [esi+edi*2-768*2+4-8],edx ; Store chroma contrib.
  337. add edi,4
  338. sub ecx,edi
  339. jne @b
  340. xor eax,eax
  341. xor ebx,ebx
  342. lea ebp,[esi+edi*2] ; Compute end-of-line luma address.
  343. Lesi YPlane ; Reload luma cursor.
  344. Ledi CCOCursor ; Re-load color converted output cursor.
  345. Sebp EndOfLine
  346. sub edi,esi
  347. Lebp YPitch
  348. ; ebp -- not used.
  349. ; esi -- Cursor over line 0 of row of luma blocks.
  350. ; edi -- Cursor over output line, minus twice esi.
  351. ; edx -- Area in which to build 4 pels of active-palette clut8 output.
  352. ; ecx, ebx, eax -- Index of Active palette entry for a pel.
  353. mov ah,PB [esi-768*1-4+0] ; 01UL Fetch UV contrib to Active Pal addr
  354. mov cl,PB [esi+1] ; 01 Fetch luma for Pel01
  355. shr cl,1 ; 01 Reduce luma to 7 bits
  356. mov bh,PB [esi-768*1-4+1] ; 01UR Fetch UV contrib to Active Pal addr
  357. sub edi,esi
  358. mov PB [esi+1],cl ; 01 Stash 7 bit luma for next line
  359. @@:
  360. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither03 -8] ; 01UL clut index
  361. mov ah,PB [esi-768*1-4+2] ; 00UL Fetch UV contrib to Active Pal addr
  362. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither02 -8] ; 01UR clut index
  363. mov cl,PB [esi+0] ; 00 Fetch luma for Pel00
  364. shr cl,1 ; 00 Reduce luma to 7 bits
  365. mov bh,PB [esi-768*1-4+3] ; 00UR Fetch UV contrib to Active Pal addr
  366. shl edx,16 ; 01 Position high order pels
  367. mov PB [esi+0],cl ; 00 Stash 7 bit luma for next line
  368. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither01 -8] ; 00UL clut index
  369. mov ah,PB [esi-768*2-8+0] ; 03UL Fetch UV contrib to Active Pal addr
  370. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither00 -8] ; 00UR clut index
  371. mov cl,PB [esi+3] ; 03 Fetch luma for Pel03
  372. shr cl,1 ; 03 Reduce luma to 7 bits
  373. mov bh,PB [esi-768*2-8+1] ; 03UR Fetch UV contrib to Active Pal addr
  374. mov PD es:[edi+esi*2],edx ; Write 4 pels to display adapter.
  375. mov PB [esi+3],cl ; 03 Stash 7 bit luma for next line
  376. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither03 -8] ; 03UL clut index
  377. mov ah,PB [esi-768*2-8+2] ; 02UL Fetch UV contrib to Active Pal addr
  378. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither02 -8] ; 03UR clut index
  379. mov cl,PB [esi+2] ; 02 Fetch luma for Pel02
  380. shr cl,1 ; 02 Reduce luma to 7 bits
  381. mov bh,PB [esi-768*2-8+3] ; 02UR Fetch UV contrib to Active Pal addr
  382. shl edx,16 ; 03 Position high order pels
  383. mov PB [esi+2],cl ; 02 Stash 7 bit luma for next line
  384. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither01 -8] ; 02UL clut index
  385. mov ah,PB [esi-768*1-4+0+4] ; 01UL Fetch UV contrib to Active Pal addr
  386. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither00 -8] ; 02UR clut index
  387. mov cl,PB [esi+1+4] ; 01 Fetch luma for Pel01
  388. shr cl,1 ; 01 Reduce luma to 7 bits
  389. mov bh,PB [esi-768*1-4+1+4] ; 01UR Fetch UV contrib to Active Pal addr
  390. mov PD es:[edi+esi*2+4],edx ; Write 4 pels to display adapter.
  391. mov PB [esi+1+4],cl ; 01 Stash 7 bit luma for next line
  392. add esi,4 ; Advance cursor.
  393. Ledx EndOfLine
  394. sub edx,esi
  395. jne @b
  396. Ledx CCOPitch
  397. Ledi CCOCursor ; Re-load color converted output cursor.
  398. Lesi YPlane ; Reload luma cursor.
  399. add edi,edx
  400. Sedi CCOCursor
  401. Ledx AspectCount
  402. sub edi,esi
  403. sub edx,2
  404. Sedx AspectCount
  405. jg KeepLine1
  406. ADDedx AspectAdjustmentCount
  407. Sedx AspectCount
  408. jmp SkipLine1
  409. KeepLine1:
  410. mov ah,PB [esi-768*1-4+2] ; 01LL Fetch UV contrib to Active Pal addr
  411. mov cl,PB [esi+1] ; 01 Fetch luma for Pel01
  412. mov bh,PB [esi-768*1-4+3] ; 01LR Fetch UV contrib to Active Pal addr
  413. sub edi,esi
  414. @@:
  415. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither13 -8] ; 01UL clut index
  416. mov ah,PB [esi-768*1-4+0] ; 00LL Fetch UV contrib to Active Pal addr
  417. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither12 -8] ; 01UR clut index
  418. mov cl,PB [esi+0] ; 00 Fetch luma for Pel00
  419. shl edx,16 ; 01 Position high order pels
  420. mov bh,PB [esi-768*1-4+1] ; 00LR Fetch UV contrib to Active Pal addr
  421. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither11 -8] ; 00UL clut index
  422. mov ah,PB [esi-768*2-8+2] ; 03LL Fetch UV contrib to Active Pal addr
  423. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither10 -8] ; 00UR clut index
  424. mov cl,PB [esi+3] ; 03 Fetch luma for Pel03
  425. mov PD es:[edi+esi*2],edx ; Write 4 pels to display adapter.
  426. mov bh,PB [esi-768*2-8+3] ; 03LR Fetch UV contrib to Active Pal addr
  427. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither13 -8] ; 03UL clut index
  428. mov ah,PB [esi-768*2-8+0] ; 02LL Fetch UV contrib to Active Pal addr
  429. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither12 -8] ; 03UR clut index
  430. mov cl,PB [esi+2] ; 02 Fetch luma for Pel02
  431. shl edx,16 ; 03 Position high order pels
  432. mov bh,PB [esi-768*2-8+1] ; 02LR Fetch UV contrib to Active Pal addr
  433. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither11 -8] ; 02UL clut index
  434. mov ah,PB [esi-768*1-4+2+4] ; 01LL Fetch UV contrib to Active Pal addr
  435. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither10 -8] ; 02UR clut index
  436. mov cl,PB [esi+1+4] ; 01 Fetch luma for Pel01
  437. mov PD es:[edi+esi*2+4],edx ; Write 4 pels to display adapter.
  438. mov bh,PB [esi-768*1-4+3+4] ; 01LR Fetch UV contrib to Active Pal addr
  439. add esi,4 ; Advance cursor.
  440. Ledx EndOfLine
  441. sub edx,esi
  442. jne @b
  443. Ledi CCOCursor
  444. Ledx CCOPitch
  445. add edi,edx
  446. SkipLine1:
  447. Sedi CCOCursor
  448. Lesi YPlane ; Reload luma cursor.
  449. sub edi,esi
  450. xor eax,eax
  451. ; ebp -- Luma pitch
  452. ; esi -- Cursor over line 0 of row of luma blocks.
  453. ; edi -- Cursor over output line, minus twice esi.
  454. ; edx -- Area in which to build 4 pels of active-palette clut8 output.
  455. ; ecx, ebx, eax -- Index of Active palette entry for a pel.
  456. mov ah,PB [esi-768*1-4+1]
  457. mov cl,PB [esi+ebp*1+1]
  458. sub edi,esi
  459. mov bh,PB [esi-768*1-4+0]
  460. @@:
  461. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither23 -8]
  462. mov ah,PB [esi-768*1-4+3]
  463. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither22 -8]
  464. mov cl,PB [esi+ebp*1+0]
  465. shl edx,16
  466. mov bh,PB [esi-768*1-4+2]
  467. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither21 -8]
  468. mov ah,PB [esi-768*2-8+1]
  469. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither20 -8]
  470. mov cl,PB [esi+ebp*1+3]
  471. mov PD es:[edi+esi*2],edx
  472. mov bh,PB [esi-768*2-8+0]
  473. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither23 -8]
  474. mov ah,PB [esi-768*2-8+3]
  475. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither22 -8]
  476. mov cl,PB [esi+ebp*1+2]
  477. shl edx,16
  478. mov bh,PB [esi-768*2-8+2]
  479. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither21 -8]
  480. mov ah,PB [esi-768*1-4+1+4]
  481. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither20 -8]
  482. mov cl,PB [esi+ebp*1+1+4]
  483. mov PD es:[edi+esi*2+4],edx
  484. mov bh,PB [esi-768*1-4+0+4]
  485. add esi,4
  486. Ledx EndOfLine
  487. sub edx,esi
  488. jne @b
  489. Ledx CCOPitch
  490. Ledi CCOCursor
  491. Lesi YPlane
  492. add edi,edx
  493. Sedi CCOCursor
  494. Ledx AspectCount
  495. sub edi,esi
  496. sub edx,2
  497. Sedx AspectCount
  498. jg KeepLine3
  499. ADDedx AspectAdjustmentCount
  500. Sedx AspectCount
  501. jmp SkipLine3
  502. KeepLine3:
  503. mov ah,PB [esi-768*1-4+1]
  504. mov cl,PB [esi+ebp*1+1]
  505. shr cl,1
  506. mov bh,PB [esi-768*1-4+0]
  507. sub edi,esi
  508. mov PB [esi+ebp*1+1],cl
  509. @@:
  510. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither33 -8]
  511. mov ah,PB [esi-768*1-4+3]
  512. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither32 -8]
  513. mov cl,PB [esi+ebp*1+0]
  514. shr cl,1
  515. mov bh,PB [esi-768*1-4+2]
  516. shl edx,16
  517. mov PB [esi+ebp*1+0],cl
  518. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither31 -8]
  519. mov ah,PB [esi-768*2-8+1]
  520. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither30 -8]
  521. mov cl,PB [esi+ebp*1+3]
  522. shr cl,1
  523. mov bh,PB [esi-768*2-8+0]
  524. mov PD es:[edi+esi*2],edx
  525. mov PB [esi+ebp*1+3],cl
  526. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither33 -8]
  527. mov ah,PB [esi-768*2-8+3]
  528. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither32 -8]
  529. mov cl,PB [esi+ebp*1+2]
  530. shr cl,1
  531. mov bh,PB [esi-768*2-8+2]
  532. shl edx,16
  533. mov PB [esi+ebp*1+2],cl
  534. mov dh,PB ActivePaletteIdxTable[eax+ecx+Ydither31 -8]
  535. mov ah,PB [esi-768*1-4+1+4]
  536. mov dl,PB ActivePaletteIdxTable[ebx+ecx+Ydither30 -8]
  537. mov cl,PB [esi+ebp*1+1+4]
  538. shr cl,1
  539. mov bh,PB [esi-768*1-4+0+4]
  540. mov PD es:[edi+esi*2+4],edx
  541. mov PB [esi+ebp*1+1+4],cl
  542. add esi,4
  543. Ledx EndOfLine
  544. sub edx,esi
  545. jne @b
  546. Ledi CCOCursor
  547. Ledx CCOPitch
  548. add edi,edx
  549. SkipLine3:
  550. add ebp,ebp
  551. Lesi YPlane
  552. Sedi CCOCursor
  553. add esi,ebp
  554. Sesi YPlane
  555. Ledx YLimit
  556. cmp esi,edx
  557. jne NextFourLines
  558. IFDEF WIN32
  559. add esp,LocalFrameSize
  560. ELSE
  561. pop ebx
  562. mov ds,ebx
  563. ENDIF
  564. pop ebx
  565. pop ebp
  566. pop edi
  567. pop esi
  568. rturn
  569. YUV12ToCLUT8APZoomBy2 endp
  570. IFNDEF WIN32
  571. SEGNAME ENDS
  572. ENDIF
  573. END