Rev 1921 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2388 | dunkaist | 1 | proc xcf._.blend_rgb |
1921 | dunkaist | 2 | |
2388 | dunkaist | 3 | xchg al, bh |
4 | mov ah, bh |
||
5 | neg ax |
||
6 | add ax, 0xffff |
||
7 | mul ah |
||
8 | neg ah |
||
9 | add ah, 0xff |
||
10 | xchg ah, bh |
||
1921 | dunkaist | 11 | |
2388 | dunkaist | 12 | mov al, 0xff |
13 | cmp ah, bh |
||
14 | je @f |
||
15 | not al |
||
16 | div bh |
||
17 | @@: |
||
1921 | dunkaist | 18 | |
2388 | dunkaist | 19 | mov ah, al |
1921 | dunkaist | 20 | |
2388 | dunkaist | 21 | movd mm1, eax |
22 | punpcklbw mm1, mm1 |
||
23 | punpcklbw mm1, mm0 |
||
1921 | dunkaist | 24 | |
2388 | dunkaist | 25 | movq mm7, mm1 |
26 | psrlw mm7, 7 |
||
27 | paddw mm1, mm7 |
||
1921 | dunkaist | 28 | |
2388 | dunkaist | 29 | psubw mm3, mm2 |
30 | pmullw mm3, mm1 |
||
31 | psllw mm2, 8 |
||
32 | paddw mm3, mm2 |
||
33 | pinsrw mm3, ebx, 3 |
||
34 | psrlw mm3, 8 |
||
35 | packuswb mm3, mm0 |
||
36 | movd eax, mm3 |
||
37 | |||
38 | ret |
||
1921 | dunkaist | 39 | endp |
40 | |||
41 | |||
2388 | dunkaist | 42 | proc xcf._.blend_gray |
1921 | dunkaist | 43 | |
2388 | dunkaist | 44 | xchg al, bh |
45 | mov ah, bh |
||
46 | neg ax |
||
47 | add ax, 0xffff |
||
48 | mul ah |
||
49 | neg ah |
||
50 | add ah, 0xff |
||
51 | xchg ah, bh |
||
1921 | dunkaist | 52 | |
2388 | dunkaist | 53 | mov al, 0xff |
54 | cmp ah, bh |
||
55 | je @f |
||
56 | not al |
||
57 | div bh |
||
58 | @@: |
||
1921 | dunkaist | 59 | |
2388 | dunkaist | 60 | mov ah, al |
1921 | dunkaist | 61 | |
2388 | dunkaist | 62 | movd mm1, eax |
63 | punpcklbw mm1, mm1 |
||
64 | punpcklbw mm1, mm0 |
||
1921 | dunkaist | 65 | |
2388 | dunkaist | 66 | movq mm7, mm1 |
67 | psrlw mm7, 7 |
||
68 | paddw mm1, mm7 |
||
1921 | dunkaist | 69 | |
2388 | dunkaist | 70 | psubw mm3, mm2 |
71 | pmullw mm3, mm1 |
||
72 | psllw mm2, 8 |
||
73 | paddw mm3, mm2 |
||
74 | pinsrw mm3, ebx, 1 |
||
75 | psrlw mm3, 8 |
||
76 | packuswb mm3, mm0 |
||
77 | movd eax, mm3 |
||
78 | |||
79 | ret |
||
1921 | dunkaist | 80 | endp |
81 | |||
82 | |||
2388 | dunkaist | 83 | proc xcf._.merge_32 _copy_width, _copy_height, _img_total_bpl, _bottom_total_bpl |
84 | .rgb_line: |
||
85 | mov ecx, [_copy_width] |
||
86 | .rgb_pixel: |
||
87 | mov ebx, [edi] |
||
88 | lodsd |
||
89 | |||
90 | movd mm2, ebx |
||
91 | movd mm3, eax |
||
92 | shr eax, 24 |
||
93 | shr ebx, 16 |
||
94 | cmp al, bh |
||
95 | jna @f |
||
96 | mov al, bh |
||
97 | @@: |
||
98 | pxor mm0, mm0 |
||
99 | call edx |
||
100 | call xcf._.blend_rgb |
||
101 | stosd |
||
102 | dec ecx |
||
103 | jnz .rgb_pixel |
||
104 | add esi, [_img_total_bpl] |
||
105 | add edi, [_bottom_total_bpl] |
||
106 | dec [_copy_height] |
||
107 | jnz .rgb_line |
||
108 | emms |
||
109 | ret |
||
1921 | dunkaist | 110 | endp |
111 | |||
112 | |||
2388 | dunkaist | 113 | proc xcf._.merge_8a _copy_width, _copy_height, _img_total_bpl, _bottom_total_bpl |
114 | .gray_line: |
||
115 | mov ecx, [_copy_width] |
||
116 | .gray_pixel: |
||
117 | mov bx, word[edi] |
||
118 | lodsw |
||
119 | movd mm2, ebx |
||
120 | movd mm3, eax |
||
121 | shr eax, 8 |
||
122 | cmp al, bh |
||
123 | jna @f |
||
124 | mov al, bh |
||
125 | @@: |
||
126 | pxor mm0, mm0 |
||
127 | call edx |
||
128 | call xcf._.blend_gray |
||
129 | stosw |
||
130 | dec ecx |
||
131 | jnz .gray_pixel |
||
132 | add esi, [_img_total_bpl] |
||
133 | add edi, [_bottom_total_bpl] |
||
134 | dec [_copy_height] |
||
135 | jnz .gray_line |
||
136 | emms |
||
137 | ret |
||
1921 | dunkaist | 138 | endp |
139 | |||
140 | |||
2388 | dunkaist | 141 | proc xcf._.composite_rgb_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl |
1921 | dunkaist | 142 | |
2388 | dunkaist | 143 | .line: |
144 | mov ecx, [_copy_width] |
||
145 | .pixel: |
||
146 | mov ebx, [edi] |
||
147 | lodsd |
||
148 | movd mm2, ebx |
||
149 | movd mm3, eax |
||
1921 | dunkaist | 150 | |
2388 | dunkaist | 151 | shr eax, 24 |
152 | shr ebx, 16 |
||
1921 | dunkaist | 153 | |
2388 | dunkaist | 154 | xchg al, bh |
155 | mov ah, bh |
||
156 | neg ax |
||
157 | add ax, 0xffff |
||
158 | mul ah |
||
159 | neg ah |
||
160 | add ah, 0xff |
||
161 | xchg ah, bh |
||
1921 | dunkaist | 162 | |
2388 | dunkaist | 163 | mov al, 0xff |
164 | cmp ah, bh |
||
165 | je @f |
||
166 | not al |
||
167 | div bh |
||
168 | @@: |
||
1921 | dunkaist | 169 | |
2388 | dunkaist | 170 | mov ah, al |
1921 | dunkaist | 171 | |
2388 | dunkaist | 172 | movd mm1, eax |
173 | pxor mm0, mm0 |
||
174 | punpcklbw mm1, mm1 |
||
175 | punpcklbw mm1, mm0 |
||
176 | punpcklbw mm2, mm0 |
||
177 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 178 | |
2388 | dunkaist | 179 | psubsw mm3, mm2 |
180 | pmullw mm3, mm1 |
||
181 | psllw mm2, 8 |
||
182 | paddw mm3, mm2 |
||
183 | pinsrw mm3, ebx, 3 |
||
184 | psrlw mm3, 8 |
||
185 | packuswb mm3, mm0 |
||
186 | movd eax, mm3 |
||
187 | stosd |
||
188 | |||
189 | dec ecx |
||
190 | jnz .pixel |
||
191 | add esi, [_img_total_bpl] |
||
192 | add edi, [_bottom_total_bpl] |
||
193 | dec [_copy_height] |
||
194 | jnz .line |
||
195 | |||
196 | ret |
||
1921 | dunkaist | 197 | endp |
198 | |||
199 | |||
2388 | dunkaist | 200 | proc xcf._.composite_gray_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl |
1921 | dunkaist | 201 | |
2388 | dunkaist | 202 | .line: |
203 | mov ecx, [_copy_width] |
||
204 | .pixel: |
||
205 | mov bx, [edi] |
||
206 | lodsw |
||
207 | movd mm2, ebx |
||
208 | movd mm3, eax |
||
1921 | dunkaist | 209 | |
2388 | dunkaist | 210 | shr eax, 8 |
1921 | dunkaist | 211 | |
2388 | dunkaist | 212 | xchg al, bh |
213 | mov ah, bh |
||
214 | neg ax |
||
215 | add ax, 0xffff |
||
216 | mul ah |
||
217 | neg ah |
||
218 | add ah, 0xff |
||
219 | xchg ah, bh |
||
1921 | dunkaist | 220 | |
2388 | dunkaist | 221 | mov al, 0xff |
222 | cmp ah, bh |
||
223 | je @f |
||
224 | not al |
||
225 | div bh |
||
226 | @@: |
||
1921 | dunkaist | 227 | |
2388 | dunkaist | 228 | mov ah, al |
1921 | dunkaist | 229 | |
2388 | dunkaist | 230 | movd mm1, eax |
231 | pxor mm0, mm0 |
||
232 | punpcklbw mm1, mm1 |
||
233 | punpcklbw mm1, mm0 |
||
234 | punpcklbw mm2, mm0 |
||
235 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 236 | |
2388 | dunkaist | 237 | psubw mm3, mm2 |
238 | pmullw mm3, mm1 |
||
239 | psllw mm2, 8 |
||
240 | paddw mm3, mm2 |
||
241 | pinsrw mm3, ebx, 1 |
||
242 | psrlw mm3, 8 |
||
243 | packuswb mm3, mm0 |
||
244 | movd eax, mm3 |
||
245 | stosw |
||
246 | |||
247 | dec ecx |
||
248 | jnz .pixel |
||
249 | add esi, [_img_total_bpl] |
||
250 | add edi, [_bottom_total_bpl] |
||
251 | dec [_copy_height] |
||
252 | jnz .line |
||
253 | |||
254 | ret |
||
1921 | dunkaist | 255 | endp |
256 | |||
257 | |||
2388 | dunkaist | 258 | proc xcf._.composite_indexed_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl |
1921 | dunkaist | 259 | |
2388 | dunkaist | 260 | .line: |
261 | mov ecx, [_copy_width] |
||
262 | .pixel: |
||
263 | mov bx, [edi] |
||
264 | lodsw |
||
1921 | dunkaist | 265 | |
2388 | dunkaist | 266 | or ah, 0x7f |
267 | test ah, 0x80 |
||
268 | jnz @f |
||
269 | mov ax, bx |
||
270 | @@: |
||
271 | stosw |
||
1921 | dunkaist | 272 | |
2388 | dunkaist | 273 | dec ecx |
274 | jnz .pixel |
||
275 | add esi, [_img_total_bpl] |
||
276 | add edi, [_bottom_total_bpl] |
||
277 | dec [_copy_height] |
||
278 | jnz .line |
||
279 | ret |
||
1921 | dunkaist | 280 | endp |
281 | |||
282 | |||
2388 | dunkaist | 283 | proc xcf._.composite_rgb_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl |
284 | pushad |
||
1921 | dunkaist | 285 | |
2388 | dunkaist | 286 | pxor mm4, mm4 |
287 | movd mm4, [xcf._.random_b] |
||
288 | movd mm1, [xcf._.random_a] |
||
289 | movd mm2, [xcf._.random_c] |
||
1921 | dunkaist | 290 | |
2388 | dunkaist | 291 | .line: |
292 | mov ecx, [_copy_width] |
||
293 | .pixel: |
||
294 | mov ebx, [edi] |
||
295 | lodsd |
||
1921 | dunkaist | 296 | |
2388 | dunkaist | 297 | movq mm0, mm4 |
298 | pmuludq mm0, mm1 |
||
299 | paddq mm0, mm2 |
||
300 | movd edx, mm0 |
||
301 | movd mm4, edx |
||
302 | pxor mm0, mm0 |
||
303 | |||
304 | rol eax, 8 |
||
305 | test al, al |
||
306 | jz @f |
||
307 | shr edx, 17 |
||
308 | cmp dl, al |
||
309 | ja @f |
||
310 | ror eax, 8 |
||
311 | or eax, 0xff000000 |
||
312 | jmp .done |
||
313 | @@: |
||
314 | mov eax, ebx |
||
315 | .done: |
||
316 | stosd |
||
317 | dec ecx |
||
318 | jnz .pixel |
||
319 | add esi, [_img_total_bpl] |
||
320 | add edi, [_bottom_total_bpl] |
||
321 | dec [_copy_height] |
||
322 | jnz .line |
||
323 | |||
324 | .quit: |
||
325 | popad |
||
326 | ret |
||
1921 | dunkaist | 327 | endp |
328 | |||
329 | |||
2388 | dunkaist | 330 | proc xcf._.composite_gray_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl |
331 | pushad |
||
1921 | dunkaist | 332 | |
2388 | dunkaist | 333 | pxor mm4, mm4 |
334 | movd mm4, [xcf._.random_b] |
||
335 | movd mm1, [xcf._.random_a] |
||
336 | movd mm2, [xcf._.random_c] |
||
1921 | dunkaist | 337 | |
2388 | dunkaist | 338 | .line: |
339 | mov ecx, [_copy_width] |
||
340 | .pixel: |
||
341 | mov ebx, [edi] |
||
342 | lodsw |
||
343 | |||
344 | movq mm0, mm4 |
||
345 | pmuludq mm0, mm1 |
||
346 | paddq mm0, mm2 |
||
347 | movd edx, mm0 |
||
348 | movd mm4, edx |
||
349 | pxor mm0, mm0 |
||
350 | |||
351 | test ah, ah |
||
352 | jz @f |
||
353 | shr edx, 17 |
||
354 | cmp dl, ah |
||
355 | ja @f |
||
356 | or ax, 0xff00 |
||
357 | jmp .done |
||
358 | @@: |
||
359 | mov eax, ebx |
||
360 | .done: |
||
361 | stosw |
||
362 | dec ecx |
||
363 | jnz .pixel |
||
364 | add esi, [_img_total_bpl] |
||
365 | add edi, [_bottom_total_bpl] |
||
366 | dec [_copy_height] |
||
367 | jnz .line |
||
368 | |||
369 | .quit: |
||
370 | popad |
||
371 | ret |
||
1921 | dunkaist | 372 | endp |
373 | |||
374 | |||
2388 | dunkaist | 375 | proc xcf._.composite_rgb_03 ; Multiply |
1921 | dunkaist | 376 | |
2388 | dunkaist | 377 | punpcklbw mm2, mm0 |
378 | punpcklbw mm3, mm0 |
||
379 | pmullw mm3, mm2 |
||
380 | psrlw mm3, 8 |
||
1921 | dunkaist | 381 | |
2388 | dunkaist | 382 | ret |
1921 | dunkaist | 383 | endp |
384 | |||
385 | |||
2388 | dunkaist | 386 | proc xcf._.composite_rgb_04 ; Screen |
1921 | dunkaist | 387 | |
2388 | dunkaist | 388 | punpcklbw mm2, mm0 |
389 | punpcklbw mm3, mm0 |
||
390 | movq mm5, [xcf._.mmx_00ff] |
||
391 | movq mm4, mm5 |
||
392 | psubw mm4, mm2 |
||
393 | psubw mm3, mm5 |
||
394 | pmullw mm3, mm4 |
||
395 | psrlw mm3, 8 |
||
396 | paddw mm3, mm5 |
||
397 | ret |
||
1921 | dunkaist | 398 | endp |
399 | |||
400 | |||
2388 | dunkaist | 401 | proc xcf._.composite_rgb_05 ; Overlay |
1921 | dunkaist | 402 | |
2388 | dunkaist | 403 | punpcklbw mm2, mm0 |
404 | punpcklbw mm3, mm0 |
||
405 | movq mm4, [xcf._.mmx_00ff] |
||
406 | psubw mm4, mm2 |
||
407 | pmullw mm3, mm4 |
||
408 | psrlw mm3, 7 |
||
409 | paddw mm3, mm2 |
||
410 | pmullw mm3, mm2 |
||
411 | psrlw mm3, 8 |
||
412 | |||
413 | ret |
||
1921 | dunkaist | 414 | endp |
415 | |||
416 | |||
2388 | dunkaist | 417 | proc xcf._.composite_rgb_06 ; Difference |
1921 | dunkaist | 418 | |
2388 | dunkaist | 419 | movq mm4, mm3 |
420 | pminub mm4, mm2 |
||
421 | pmaxub mm3, mm2 |
||
422 | psubusb mm3, mm4 |
||
423 | punpcklbw mm2, mm0 |
||
424 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 425 | |
2388 | dunkaist | 426 | ret |
1921 | dunkaist | 427 | endp |
428 | |||
429 | |||
2388 | dunkaist | 430 | proc xcf._.composite_rgb_07 ; Addition |
1921 | dunkaist | 431 | |
2388 | dunkaist | 432 | paddusb mm3, mm2 |
433 | punpcklbw mm2, mm0 |
||
434 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 435 | |
2388 | dunkaist | 436 | ret |
1921 | dunkaist | 437 | endp |
438 | |||
439 | |||
2388 | dunkaist | 440 | proc xcf._.composite_rgb_08 ; Subtract |
1921 | dunkaist | 441 | |
2388 | dunkaist | 442 | movq mm4, mm2 |
443 | psubusb mm4, mm3 |
||
444 | movq mm3, mm4 |
||
445 | punpcklbw mm2, mm0 |
||
446 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 447 | |
2388 | dunkaist | 448 | ret |
1921 | dunkaist | 449 | endp |
450 | |||
451 | |||
2388 | dunkaist | 452 | proc xcf._.composite_rgb_09 ; Darken Only |
1921 | dunkaist | 453 | |
2388 | dunkaist | 454 | pminub mm3, mm2 |
455 | punpcklbw mm2, mm0 |
||
456 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 457 | |
2388 | dunkaist | 458 | ret |
1921 | dunkaist | 459 | endp |
460 | |||
461 | |||
2388 | dunkaist | 462 | proc xcf._.composite_rgb_10 ; Lighten Only |
1921 | dunkaist | 463 | |
2388 | dunkaist | 464 | pmaxub mm3, mm2 |
465 | punpcklbw mm2, mm0 |
||
466 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 467 | |
2388 | dunkaist | 468 | ret |
1921 | dunkaist | 469 | endp |
470 | |||
471 | |||
2388 | dunkaist | 472 | proc xcf._.composite_rgb_11 ; Hue (H of HSV) |
473 | push eax ebx ecx edx |
||
1921 | dunkaist | 474 | |
2388 | dunkaist | 475 | movd eax, mm3 |
476 | movd ebx, mm2 |
||
1921 | dunkaist | 477 | |
2388 | dunkaist | 478 | call xcf._.rgb2hsv |
479 | xchg eax, ebx |
||
480 | call xcf._.rgb2hsv |
||
481 | xchg eax, ebx |
||
1921 | dunkaist | 482 | |
2388 | dunkaist | 483 | test ah, ah |
484 | jnz @f |
||
485 | ror eax, 8 |
||
486 | ror ebx, 8 |
||
487 | mov ah, bh |
||
488 | rol eax, 8 |
||
489 | rol ebx, 8 |
||
490 | @@: |
||
491 | mov ax, bx |
||
492 | |||
493 | call xcf._.hsv2rgb |
||
494 | |||
495 | movd mm3, eax |
||
496 | |||
497 | punpcklbw mm2, mm0 |
||
498 | punpcklbw mm3, mm0 |
||
499 | |||
500 | .quit: |
||
501 | pop edx ecx ebx eax |
||
502 | ret |
||
1921 | dunkaist | 503 | endp |
504 | |||
505 | |||
2388 | dunkaist | 506 | proc xcf._.composite_rgb_12 ; Saturation (S of HSV) |
507 | push eax ebx ecx edx |
||
1921 | dunkaist | 508 | |
2388 | dunkaist | 509 | movd eax, mm3 |
510 | movd ebx, mm2 |
||
1921 | dunkaist | 511 | |
2388 | dunkaist | 512 | call xcf._.rgb2hsv |
513 | xchg eax, ebx |
||
514 | call xcf._.rgb2hsv |
||
515 | xchg eax, ebx |
||
1921 | dunkaist | 516 | |
2388 | dunkaist | 517 | ror eax, 8 |
518 | ror ebx, 8 |
||
519 | mov ah, bh |
||
520 | rol eax, 8 |
||
521 | rol ebx, 8 |
||
522 | mov al, bl |
||
1921 | dunkaist | 523 | |
2388 | dunkaist | 524 | call xcf._.hsv2rgb |
1921 | dunkaist | 525 | |
526 | |||
2388 | dunkaist | 527 | movd mm3, eax |
1921 | dunkaist | 528 | |
2388 | dunkaist | 529 | punpcklbw mm2, mm0 |
530 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 531 | |
2388 | dunkaist | 532 | .quit: |
533 | pop edx ecx ebx eax |
||
534 | ret |
||
1921 | dunkaist | 535 | endp |
536 | |||
537 | |||
2388 | dunkaist | 538 | proc xcf._.composite_rgb_13 ; Color (H and S of HSL) |
539 | push eax ebx ecx edx |
||
1921 | dunkaist | 540 | |
2388 | dunkaist | 541 | movd eax, mm3 |
542 | movd ebx, mm2 |
||
1921 | dunkaist | 543 | |
2388 | dunkaist | 544 | call xcf._.rgb2hsl |
545 | xchg eax, ebx |
||
546 | call xcf._.rgb2hsl |
||
547 | xchg eax, ebx |
||
1921 | dunkaist | 548 | |
2388 | dunkaist | 549 | mov al, bl |
550 | |||
551 | call xcf._.hsl2rgb |
||
552 | |||
553 | |||
554 | movd mm3, eax |
||
555 | |||
556 | punpcklbw mm2, mm0 |
||
557 | punpcklbw mm3, mm0 |
||
558 | |||
559 | .quit: |
||
560 | pop edx ecx ebx eax |
||
561 | ret |
||
1921 | dunkaist | 562 | endp |
563 | |||
564 | |||
2388 | dunkaist | 565 | proc xcf._.composite_rgb_14 ; Value (V of HSV) |
566 | push eax ebx ecx edx |
||
1921 | dunkaist | 567 | |
2388 | dunkaist | 568 | movd eax, mm3 |
569 | movd ebx, mm2 |
||
1921 | dunkaist | 570 | |
2388 | dunkaist | 571 | call xcf._.rgb2hsv |
572 | xchg eax, ebx |
||
573 | call xcf._.rgb2hsv |
||
574 | xchg eax, ebx |
||
1921 | dunkaist | 575 | |
2388 | dunkaist | 576 | ror eax, 8 |
577 | ror ebx, 8 |
||
578 | mov ax, bx |
||
579 | rol eax, 8 |
||
580 | rol ebx, 8 |
||
1921 | dunkaist | 581 | |
2388 | dunkaist | 582 | call xcf._.hsv2rgb |
1921 | dunkaist | 583 | |
584 | |||
2388 | dunkaist | 585 | movd mm3, eax |
1921 | dunkaist | 586 | |
2388 | dunkaist | 587 | punpcklbw mm2, mm0 |
588 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 589 | |
2388 | dunkaist | 590 | .quit: |
591 | pop edx ecx ebx eax |
||
592 | ret |
||
1921 | dunkaist | 593 | endp |
594 | |||
595 | |||
2388 | dunkaist | 596 | proc xcf._.composite_rgb_15 ; Divide |
597 | push eax ebx ecx |
||
1921 | dunkaist | 598 | |
2388 | dunkaist | 599 | movd eax, mm3 |
600 | movd ebx, mm2 |
||
1921 | dunkaist | 601 | |
2388 | dunkaist | 602 | rol eax, 8 |
603 | rol ebx, 8 |
||
1921 | dunkaist | 604 | |
2388 | dunkaist | 605 | xchg eax, ebx |
1921 | dunkaist | 606 | |
2388 | dunkaist | 607 | mov ecx, 3 |
1921 | dunkaist | 608 | |
2388 | dunkaist | 609 | .color: |
610 | rol eax, 8 |
||
611 | rol ebx, 8 |
||
612 | shl ax, 8 |
||
613 | test bl, bl |
||
614 | jz .clamp1 |
||
615 | cmp ah, bl |
||
616 | jae .clamp2 |
||
617 | div bl |
||
618 | jmp .done |
||
619 | .clamp1: |
||
620 | mov al, 0xff |
||
621 | test ah, ah |
||
622 | jnz @f |
||
623 | not al |
||
624 | @@: |
||
625 | jmp .done |
||
626 | .clamp2: |
||
627 | mov al, 0xff |
||
628 | jmp .done |
||
629 | .done: |
||
630 | mov ah, al |
||
631 | loop .color |
||
1921 | dunkaist | 632 | |
2388 | dunkaist | 633 | ror eax, 8 |
634 | movd mm3, eax |
||
1921 | dunkaist | 635 | |
2388 | dunkaist | 636 | punpcklbw mm2, mm0 |
637 | punpcklbw mm3, mm0 |
||
638 | |||
639 | pop ecx ebx eax |
||
640 | ret |
||
1921 | dunkaist | 641 | endp |
642 | |||
643 | |||
2388 | dunkaist | 644 | proc xcf._.composite_rgb_16 ; Dodge |
645 | push eax ebx ecx |
||
1921 | dunkaist | 646 | |
2388 | dunkaist | 647 | movd eax, mm3 |
648 | movd ebx, mm2 |
||
1921 | dunkaist | 649 | |
2388 | dunkaist | 650 | rol eax, 8 |
651 | rol ebx, 8 |
||
1921 | dunkaist | 652 | |
2388 | dunkaist | 653 | xchg eax, ebx |
1921 | dunkaist | 654 | |
2388 | dunkaist | 655 | mov ecx, 3 |
1921 | dunkaist | 656 | |
2388 | dunkaist | 657 | .color: |
658 | rol eax, 8 |
||
659 | rol ebx, 8 |
||
660 | shl ax, 8 |
||
661 | neg bl |
||
662 | add bl, 0xff |
||
663 | test bl, bl |
||
664 | jz .clamp1 |
||
665 | cmp ah, bl |
||
666 | jae .clamp2 |
||
667 | div bl |
||
668 | jmp .done |
||
669 | .clamp1: |
||
670 | mov al, 0xff |
||
671 | test ah, ah |
||
672 | jnz @f |
||
673 | not al |
||
674 | @@: |
||
675 | jmp .done |
||
676 | .clamp2: |
||
677 | mov al, 0xff |
||
678 | jmp .done |
||
679 | .done: |
||
680 | mov ah, al |
||
681 | loop .color |
||
1921 | dunkaist | 682 | |
2388 | dunkaist | 683 | ror eax, 8 |
684 | movd mm3, eax |
||
1921 | dunkaist | 685 | |
2388 | dunkaist | 686 | punpcklbw mm2, mm0 |
687 | punpcklbw mm3, mm0 |
||
688 | |||
689 | pop ecx ebx eax |
||
690 | ret |
||
1921 | dunkaist | 691 | endp |
692 | |||
693 | |||
2388 | dunkaist | 694 | proc xcf._.composite_rgb_17 ; Burn |
695 | push eax ebx ecx |
||
1921 | dunkaist | 696 | |
2388 | dunkaist | 697 | movd eax, mm3 |
698 | movd ebx, mm2 |
||
1921 | dunkaist | 699 | |
2388 | dunkaist | 700 | rol eax, 8 |
701 | rol ebx, 8 |
||
1921 | dunkaist | 702 | |
2388 | dunkaist | 703 | xchg eax, ebx |
1921 | dunkaist | 704 | |
2388 | dunkaist | 705 | mov ecx, 3 |
1921 | dunkaist | 706 | |
2388 | dunkaist | 707 | .color: |
708 | rol eax, 8 |
||
709 | rol ebx, 8 |
||
710 | shl ax, 8 |
||
711 | neg ah |
||
712 | add ah, 0xff |
||
713 | test bl, bl |
||
714 | jz .clamp1 |
||
715 | cmp ah, bl |
||
716 | jae .clamp2 |
||
717 | div bl |
||
718 | jmp .done |
||
719 | .clamp1: |
||
720 | mov al, 0xff |
||
721 | test ah, ah |
||
722 | jnz @f |
||
723 | not al |
||
724 | @@: |
||
725 | jmp .done |
||
726 | .clamp2: |
||
727 | mov al, 0xff |
||
728 | jmp .done |
||
729 | .done: |
||
730 | mov ah, al |
||
731 | neg ah |
||
732 | add ah, 0xff |
||
733 | loop .color |
||
1921 | dunkaist | 734 | |
2388 | dunkaist | 735 | ror eax, 8 |
736 | movd mm3, eax |
||
1921 | dunkaist | 737 | |
2388 | dunkaist | 738 | punpcklbw mm2, mm0 |
739 | punpcklbw mm3, mm0 |
||
740 | |||
741 | pop ecx ebx eax |
||
742 | ret |
||
1921 | dunkaist | 743 | endp |
744 | |||
745 | |||
2388 | dunkaist | 746 | proc xcf._.composite_rgb_18 ; Hard Light |
747 | push eax ebx ecx |
||
1921 | dunkaist | 748 | |
2388 | dunkaist | 749 | movd eax, mm3 |
750 | movd ebx, mm2 |
||
1921 | dunkaist | 751 | |
2388 | dunkaist | 752 | rol eax, 8 |
753 | rol ebx, 8 |
||
754 | |||
755 | mov ecx, 3 |
||
756 | |||
757 | .color: |
||
758 | rol eax, 8 |
||
759 | rol ebx, 8 |
||
760 | cmp al, 127 |
||
761 | jna .part1 |
||
762 | mov ah, 0xff |
||
763 | sub ah, bl |
||
764 | neg al |
||
765 | add al, 0xff |
||
766 | mul ah |
||
767 | shl ax, 1 |
||
768 | neg ah |
||
769 | add ah, 0xff |
||
770 | jmp .done |
||
771 | .part1: |
||
772 | mul bl |
||
773 | shl ax, 1 |
||
774 | .done: |
||
775 | loop .color |
||
776 | |||
777 | ror eax, 8 |
||
778 | movd mm3, eax |
||
779 | |||
780 | punpcklbw mm2, mm0 |
||
781 | punpcklbw mm3, mm0 |
||
782 | |||
783 | pop ecx ebx eax |
||
784 | ret |
||
1921 | dunkaist | 785 | endp |
786 | |||
787 | |||
2388 | dunkaist | 788 | proc xcf._.composite_rgb_20 ; Grain Extract |
1921 | dunkaist | 789 | |
2388 | dunkaist | 790 | punpcklbw mm2, mm0 |
791 | punpcklbw mm3, mm0 |
||
792 | movq mm4, mm2 |
||
793 | psubw mm3, [xcf._.mmx_0080] |
||
794 | psubw mm4, mm3 |
||
795 | movq mm3, mm4 |
||
796 | packuswb mm3, mm0 |
||
797 | punpcklbw mm3, mm0 |
||
798 | ret |
||
799 | endp |
||
1921 | dunkaist | 800 | |
2388 | dunkaist | 801 | |
802 | proc xcf._.composite_rgb_21 ; Grain Merge |
||
803 | |||
804 | punpcklbw mm2, mm0 |
||
805 | punpcklbw mm3, mm0 |
||
806 | paddw mm3, mm2 |
||
807 | psubusw mm3, [xcf._.mmx_0080] |
||
808 | packuswb mm3, mm0 |
||
809 | punpcklbw mm3, mm0 |
||
810 | ret |
||
1921 | dunkaist | 811 | endp |
812 | |||
813 | |||
2388 | dunkaist | 814 | ; starting numbers for pseudo-random number generator |
815 | xcf._.random_a dd 1103515245 |
||
816 | xcf._.random_b dd 777 |
||
817 | xcf._.random_c dd 12345 |
||
818 | |||
819 | xcf._.mmx_0080 dq 0x0080008000800080 |
||
820 | xcf._.mmx_00ff dq 0x00ff00ff00ff00ff |
||
821 | xcf._.mmx_0100 dq 0x0100010001000100 |