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.

682 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\cx5128a1.asv
  15. ;//
  16. ;// $Log: S:\h26x\src\dec\cx5128a1.asv $
  17. ;//
  18. ;// Rev 1.6 18 Mar 1996 09:58:26 bnickers
  19. ;// Make color convertors non-destructive.
  20. ;//
  21. ;// Rev 1.5 05 Feb 1996 13:35:30 BNICKERS
  22. ;// Fix RGB16 color flash problem, by allowing different RGB16 formats at oce.
  23. ;//
  24. ;// Rev 1.4 16 Jan 1996 11:22:06 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:58:38 KMILLS
  29. ;//
  30. ;// added new copyright notice
  31. ;//
  32. ;// Rev 1.2 20 Nov 1995 10:33:40 BNICKERS
  33. ;// Implement YUV12 to CLUT8AP.
  34. ;//
  35. ;// Rev 1.1 26 Oct 1995 09:46:14 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:22 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 one, i.e. non-zoom.
  50. ; cx5128a1 -- This function performs YUV12 to CLUT8 color conversion for H26x.
  51. ; It converts the input to the clut8 index dyncamically computed
  52. ; 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_cx5128a1>
  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 YUV12ToCLUT8AP (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 YUV12ToCLUT8AP
  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. YUV12ToCLUT8AP 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. lea ebp,[esi+edi*2] ; Compute end-of-line luma address.
  341. Lesi YPlane ; Reload luma cursor.
  342. Ledx AspectCount
  343. Ledi CCOCursor ; Re-load color converted output cursor.
  344. sub edi,esi
  345. dec edx
  346. Sebp EndOfLine
  347. Lebp YPitch
  348. Sedx AspectCount
  349. jne KeepLine0
  350. Ledx AspectAdjustmentCount
  351. add edi,esi
  352. Sedx AspectCount
  353. jmp SkipLine0
  354. KeepLine0:
  355. ; ebp -- not used.
  356. ; esi -- Cursor over line 0 of row of luma blocks.
  357. ; edi -- Cursor over output line, minus esi.
  358. ; edx -- Area in which to build 4 pels of active-palette clut8 output.
  359. ; ecx, ebx, eax -- Index of Active palette entry for a pel.
  360. mov ah,PB [esi-768*2-8+0] ; 03 -- Fetch UV contrib to Active Pal addr
  361. mov bl,PB [esi+2] ; 02 -- Fetch luma for Pel02
  362. shr bl,1 ; 02 -- Reduce luma to 7 bits
  363. mov al,PB [esi+3] ; 03 -- Fetch luma for Pel03
  364. shr al,1 ; 03 -- Reduce luma to 7 bits
  365. mov ch,PB [esi-768*1-4+2] ; 01 -- Fetch UV contrib to Active Pal addr
  366. Line0Loop:
  367. mov bh,PB [esi-768*2-8+1] ; 02 -- Fetch UV contrib to Active Pal addr
  368. mov cl,PB [esi+1] ; 01 -- Fetch luma for Pel01
  369. shr cl,1 ; 01 -- Reduce luma to 7 bits
  370. mov dh,PB ActivePaletteIdxTable[eax+Ydither03 -8] ; 03 -- Pel03 clut index
  371. mov al,PB [esi+0] ; 00 -- Fetch luma for Pel00
  372. mov dl,PB ActivePaletteIdxTable[ebx+Ydither02 -8] ; 02 -- Pel02 clut index
  373. shl edx,16 ; 03 & 02 -- Position high order pels
  374. mov ah,PB [esi-768*1-4+3] ; 00 -- Fetch UV contrib to Active Pal addr
  375. shr al,1 ; 00 -- Reduce luma to 7 bits
  376. mov bl,PB [esi+2+4] ; 02 -- Fetch luma for next Pel02
  377. mov dh,PB ActivePaletteIdxTable[ecx+Ydither01 -8] ; 01 -- Pel01 clut index
  378. mov ch,PB [esi-768*1-4+2+4] ; 01 -- Fetch next UV contrib
  379. mov dl,PB ActivePaletteIdxTable[eax+Ydither00 -8] ; 00 -- Pel00 clut index
  380. mov ah,PB [esi-768*2-8+0+4] ; 03 -- Fetch next UV contrib
  381. mov PD es:[edi+esi],edx ; Write 4 pels to display adapter.
  382. mov al,PB [esi+3+4] ; 03 -- Fetch luma for next Pel03
  383. shr bl,1 ; 02 -- Reduce luma to 7 bits
  384. Ledx EndOfLine
  385. shr al,1 ; 03 -- Reduce luma to 7 bits
  386. add esi,4 ; Advance to next 4 pels
  387. cmp esi,edx
  388. jne Line0Loop
  389. Ledi CCOCursor
  390. Ledx CCOPitch
  391. add edi,edx
  392. Sedi CCOCursor
  393. SkipLine0:
  394. Lesi YPlane ; Reload luma cursor.
  395. Ledx AspectCount
  396. sub edi,esi
  397. dec edx
  398. Sedx AspectCount
  399. jne KeepLine1
  400. Ledx AspectAdjustmentCount
  401. add edi,esi
  402. Sedx AspectCount
  403. jmp SkipLine1
  404. KeepLine1:
  405. mov ah,PB [esi-768*2-8+2] ; 13 -- Fetch UV contrib to Active Pal addr
  406. mov bl,PB [esi+ebp*1+2] ; 12 -- Fetch luma for Pel12
  407. shr bl,1 ; 02 -- Reduce luma to 7 bits
  408. mov al,PB [esi+ebp*1+3] ; 13 -- Fetch luma for Pel13
  409. shr al,1 ; 03 -- Reduce luma to 7 bits
  410. mov ch,PB [esi-768*1-4+0] ; 11 -- Fetch UV contrib to Active Pal addr
  411. Line1Loop:
  412. mov bh,PB [esi-768*2-8+3] ; 12 -- Fetch UV contrib to Active Pal addr
  413. mov cl,PB [esi+ebp*1+1] ; 11 -- Fetch luma for Pel11
  414. shr cl,1 ; 01 -- Reduce luma to 7 bits
  415. mov dh,PB ActivePaletteIdxTable[eax+Ydither13 -8] ; 13 -- Pel13 clut index
  416. mov al,PB [esi+ebp*1+0] ; 10 -- Fetch luma for Pel10
  417. mov dl,PB ActivePaletteIdxTable[ebx+Ydither12 -8] ; 12 -- Pel12 clut index
  418. shl edx,16 ; 13 & 12 -- Position high order pels
  419. mov ah,PB [esi-768*1-4+1] ; 10 -- Fetch UV contrib to Active Pal addr
  420. shr al,1 ; 00 -- Reduce luma to 7 bits
  421. mov bl,PB [esi+ebp*1+2+4] ; 12 -- Fetch luma for next Pel12
  422. mov dh,PB ActivePaletteIdxTable[ecx+Ydither11 -8] ; 11 -- Pel11 clut index
  423. mov ch,PB [esi-768*1-4+0+4] ; 11 -- Fetch next UV contrib
  424. mov dl,PB ActivePaletteIdxTable[eax+Ydither10 -8] ; 10 -- Pel10 clut index
  425. mov ah,PB [esi-768*2-8+2+4] ; 13 -- Fetch next UV contrib
  426. mov PD es:[edi+esi],edx ; Write 4 pels to display adapter.
  427. mov al,PB [esi+ebp*1+3+4] ; 13 -- Fetch luma for next Pel13
  428. shr bl,1 ; 02 -- Reduce luma to 7 bits
  429. Ledx EndOfLine
  430. shr al,1 ; 03 -- Reduce luma to 7 bits
  431. add esi,4 ; Advance to next 4 pels
  432. cmp esi,edx
  433. jne Line1Loop
  434. Ledi CCOCursor
  435. Ledx CCOPitch
  436. add edi,edx
  437. Sedi CCOCursor
  438. SkipLine1:
  439. Lesi YPlane ; Reload luma cursor.
  440. lea edx,[ebp*2]
  441. add esi,edx
  442. Ledi VPlane
  443. Sesi YPlane
  444. Lecx ChromaLineLen
  445. add ecx,edi
  446. sub esi,edi
  447. Lebp DistanceFromVToU
  448. sub esi,edi
  449. xor eax,eax
  450. Ledx ChromaPitch
  451. mov al,PB [edi] ; Fetch V pel.
  452. xor ebx,ebx
  453. mov bl,PB [edi+ebp*1] ; Fetch U pel.
  454. add edx,edi
  455. Secx EndOfLine
  456. Sedx VPlane
  457. @@:
  458. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  459. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  460. add ecx,edx ; Chroma contrib to active palette address.
  461. mov al,PB [edi+1] ; Fetch next V pel.
  462. mov PD [esi+edi*2-768*1-4],ecx ; Store chroma contrib.
  463. mov bl,PB [edi+ebp*1+1] ; Fetch U pel.
  464. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  465. mov al,PB [edi+2] ; Fetch next V pel.
  466. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  467. mov bl,PB [edi+ebp*1+2] ; Fetch U pel.
  468. add edx,ecx ; Chroma contrib to active palette address.
  469. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  470. mov PD [esi+edi*2-768*2-8],edx ; Store chroma contrib.
  471. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  472. add ecx,edx ; Chroma contrib to active palette address.
  473. mov al,PB [edi+3] ; Fetch next V pel.
  474. mov PD [esi+edi*2-768*1+4-4],ecx ; Store chroma contrib.
  475. mov bl,PB [edi+ebp*1+3] ; Fetch U pel.
  476. mov ecx,PD VContribToAPIdx[eax*4]; V contrib actv pal addr, dithered 4 ways.
  477. mov al,PB [edi+4] ; Fetch next V pel.
  478. mov edx,PD UContribToAPIdx[ebx*4]; U contrib actv pal addr, dithered 4 ways.
  479. mov bl,PB [edi+ebp*1+4] ; Fetch U pel.
  480. add edx,ecx ; Chroma contrib to active palette address.
  481. Lecx EndOfLine
  482. mov PD [esi+edi*2-768*2+4-8],edx ; Store chroma contrib.
  483. add edi,4
  484. sub ecx,edi
  485. jne @b
  486. lea ebp,[esi+edi*2] ; Compute end-of-line luma address.
  487. Lesi YPlane ; Reload luma cursor.
  488. Ledx AspectCount
  489. Ledi CCOCursor ; Re-load color converted output cursor.
  490. sub edi,esi
  491. dec edx
  492. Sebp EndOfLine
  493. Lebp YPitch
  494. Sedx AspectCount
  495. jne KeepLine2
  496. Ledx AspectAdjustmentCount
  497. add edi,esi
  498. Sedx AspectCount
  499. jmp SkipLine2
  500. KeepLine2:
  501. mov ah,PB [esi-768*2-8+1]
  502. mov bl,PB [esi+2]
  503. shr bl,1
  504. mov al,PB [esi+3]
  505. shr al,1
  506. mov ch,PB [esi-768*1-4+3]
  507. Line2Loop:
  508. mov bh,PB [esi-768*2-8+0]
  509. mov cl,PB [esi+1]
  510. shr cl,1
  511. mov dh,PB ActivePaletteIdxTable[eax+Ydither23 -8]
  512. mov al,PB [esi+0]
  513. mov dl,PB ActivePaletteIdxTable[ebx+Ydither22 -8]
  514. shl edx,16
  515. mov ah,PB [esi-768*1-4+2]
  516. shr al,1
  517. mov bl,PB [esi+2+4]
  518. mov dh,PB ActivePaletteIdxTable[ecx+Ydither21 -8]
  519. mov ch,PB [esi-768*1-4+3+4]
  520. mov dl,PB ActivePaletteIdxTable[eax+Ydither20 -8]
  521. mov ah,PB [esi-768*2-8+1+4]
  522. mov PD es:[edi+esi],edx
  523. mov al,PB [esi+3+4]
  524. shr bl,1
  525. Ledx EndOfLine
  526. shr al,1
  527. add esi,4
  528. cmp esi,edx
  529. jne Line2Loop
  530. Ledi CCOCursor
  531. Ledx CCOPitch
  532. add edi,edx
  533. Sedi CCOCursor
  534. SkipLine2:
  535. Lesi YPlane
  536. Ledx AspectCount
  537. sub edi,esi
  538. dec edx
  539. Sedx AspectCount
  540. jne KeepLine3
  541. Ledx AspectAdjustmentCount
  542. add edi,esi
  543. Sedx AspectCount
  544. jmp SkipLine3
  545. KeepLine3:
  546. mov ah,PB [esi-768*2-8+3]
  547. mov bl,PB [esi+ebp*1+2]
  548. shr bl,1
  549. mov al,PB [esi+ebp*1+3]
  550. shr al,1
  551. mov ch,PB [esi-768*1-4+1]
  552. Line3Loop:
  553. mov bh,PB [esi-768*2-8+2]
  554. mov cl,PB [esi+ebp*1+1]
  555. shr cl,1
  556. mov dh,PB ActivePaletteIdxTable[eax+Ydither33 -8]
  557. mov al,PB [esi+ebp*1+0]
  558. mov dl,PB ActivePaletteIdxTable[ebx+Ydither32 -8]
  559. shl edx,16
  560. mov ah,PB [esi-768*1-4+0]
  561. shr al,1
  562. mov bl,PB [esi+ebp*1+2+4]
  563. mov dh,PB ActivePaletteIdxTable[ecx+Ydither31 -8]
  564. mov ch,PB [esi-768*1-4+1+4]
  565. mov dl,PB ActivePaletteIdxTable[eax+Ydither30 -8]
  566. mov ah,PB [esi-768*2-8+3+4]
  567. mov PD es:[edi+esi],edx
  568. mov al,PB [esi+ebp*1+3+4]
  569. shr bl,1
  570. Ledx EndOfLine
  571. shr al,1
  572. add esi,4
  573. cmp esi,edx
  574. jne Line3Loop
  575. Ledi CCOCursor
  576. Ledx CCOPitch
  577. add edi,edx
  578. Sedi CCOCursor
  579. SkipLine3:
  580. Lesi YPlane
  581. lea edx,[ebp*2]
  582. add esi,edx
  583. Ledx YLimit
  584. Sesi YPlane
  585. cmp esi,edx
  586. jne NextFourLines
  587. IFDEF WIN32
  588. add esp,LocalFrameSize
  589. ELSE
  590. pop ebx
  591. mov ds,ebx
  592. ENDIF
  593. pop ebx
  594. pop ebp
  595. pop edi
  596. pop esi
  597. rturn
  598. YUV12ToCLUT8AP endp
  599. IFNDEF WIN32
  600. SEGNAME ENDS
  601. ENDIF
  602. END