Rev 2388 | 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 |
||
2733 | dunkaist | 390 | movq mm4, [xcf._.mmx_00ff] |
391 | movq mm5, mm4 |
||
392 | psubw mm5, mm3 |
||
393 | movq mm3, mm4 |
||
2388 | dunkaist | 394 | psubw mm4, mm2 |
2733 | dunkaist | 395 | pmullw mm4, mm5 |
396 | psrlw mm4, 8 |
||
397 | psubw mm3, mm4 |
||
398 | |||
2388 | dunkaist | 399 | ret |
1921 | dunkaist | 400 | endp |
401 | |||
402 | |||
2388 | dunkaist | 403 | proc xcf._.composite_rgb_05 ; Overlay |
1921 | dunkaist | 404 | |
2388 | dunkaist | 405 | punpcklbw mm2, mm0 |
406 | punpcklbw mm3, mm0 |
||
407 | movq mm4, [xcf._.mmx_00ff] |
||
408 | psubw mm4, mm2 |
||
409 | pmullw mm3, mm4 |
||
410 | psrlw mm3, 7 |
||
411 | paddw mm3, mm2 |
||
412 | pmullw mm3, mm2 |
||
413 | psrlw mm3, 8 |
||
414 | |||
415 | ret |
||
1921 | dunkaist | 416 | endp |
417 | |||
418 | |||
2388 | dunkaist | 419 | proc xcf._.composite_rgb_06 ; Difference |
1921 | dunkaist | 420 | |
2388 | dunkaist | 421 | movq mm4, mm3 |
422 | pminub mm4, mm2 |
||
423 | pmaxub mm3, mm2 |
||
424 | psubusb mm3, mm4 |
||
425 | punpcklbw mm2, mm0 |
||
426 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 427 | |
2388 | dunkaist | 428 | ret |
1921 | dunkaist | 429 | endp |
430 | |||
431 | |||
2388 | dunkaist | 432 | proc xcf._.composite_rgb_07 ; Addition |
1921 | dunkaist | 433 | |
2388 | dunkaist | 434 | paddusb mm3, mm2 |
435 | punpcklbw mm2, mm0 |
||
436 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 437 | |
2388 | dunkaist | 438 | ret |
1921 | dunkaist | 439 | endp |
440 | |||
441 | |||
2388 | dunkaist | 442 | proc xcf._.composite_rgb_08 ; Subtract |
1921 | dunkaist | 443 | |
2388 | dunkaist | 444 | movq mm4, mm2 |
445 | psubusb mm4, mm3 |
||
446 | movq mm3, mm4 |
||
447 | punpcklbw mm2, mm0 |
||
448 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 449 | |
2388 | dunkaist | 450 | ret |
1921 | dunkaist | 451 | endp |
452 | |||
453 | |||
2388 | dunkaist | 454 | proc xcf._.composite_rgb_09 ; Darken Only |
1921 | dunkaist | 455 | |
2388 | dunkaist | 456 | pminub mm3, mm2 |
457 | punpcklbw mm2, mm0 |
||
458 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 459 | |
2388 | dunkaist | 460 | ret |
1921 | dunkaist | 461 | endp |
462 | |||
463 | |||
2388 | dunkaist | 464 | proc xcf._.composite_rgb_10 ; Lighten Only |
1921 | dunkaist | 465 | |
2388 | dunkaist | 466 | pmaxub mm3, mm2 |
467 | punpcklbw mm2, mm0 |
||
468 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 469 | |
2388 | dunkaist | 470 | ret |
1921 | dunkaist | 471 | endp |
472 | |||
473 | |||
2388 | dunkaist | 474 | proc xcf._.composite_rgb_11 ; Hue (H of HSV) |
475 | push eax ebx ecx edx |
||
1921 | dunkaist | 476 | |
2388 | dunkaist | 477 | movd eax, mm3 |
478 | movd ebx, mm2 |
||
1921 | dunkaist | 479 | |
2388 | dunkaist | 480 | call xcf._.rgb2hsv |
481 | xchg eax, ebx |
||
482 | call xcf._.rgb2hsv |
||
483 | xchg eax, ebx |
||
1921 | dunkaist | 484 | |
2388 | dunkaist | 485 | test ah, ah |
486 | jnz @f |
||
487 | ror eax, 8 |
||
488 | ror ebx, 8 |
||
489 | mov ah, bh |
||
490 | rol eax, 8 |
||
491 | rol ebx, 8 |
||
492 | @@: |
||
493 | mov ax, bx |
||
494 | |||
495 | call xcf._.hsv2rgb |
||
496 | |||
497 | movd mm3, eax |
||
498 | |||
499 | punpcklbw mm2, mm0 |
||
500 | punpcklbw mm3, mm0 |
||
501 | |||
502 | .quit: |
||
503 | pop edx ecx ebx eax |
||
504 | ret |
||
1921 | dunkaist | 505 | endp |
506 | |||
507 | |||
2388 | dunkaist | 508 | proc xcf._.composite_rgb_12 ; Saturation (S of HSV) |
509 | push eax ebx ecx edx |
||
1921 | dunkaist | 510 | |
2388 | dunkaist | 511 | movd eax, mm3 |
512 | movd ebx, mm2 |
||
1921 | dunkaist | 513 | |
2388 | dunkaist | 514 | call xcf._.rgb2hsv |
515 | xchg eax, ebx |
||
516 | call xcf._.rgb2hsv |
||
517 | xchg eax, ebx |
||
1921 | dunkaist | 518 | |
2388 | dunkaist | 519 | ror eax, 8 |
520 | ror ebx, 8 |
||
521 | mov ah, bh |
||
522 | rol eax, 8 |
||
523 | rol ebx, 8 |
||
524 | mov al, bl |
||
1921 | dunkaist | 525 | |
2388 | dunkaist | 526 | call xcf._.hsv2rgb |
1921 | dunkaist | 527 | |
528 | |||
2388 | dunkaist | 529 | movd mm3, eax |
1921 | dunkaist | 530 | |
2388 | dunkaist | 531 | punpcklbw mm2, mm0 |
532 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 533 | |
2388 | dunkaist | 534 | .quit: |
535 | pop edx ecx ebx eax |
||
536 | ret |
||
1921 | dunkaist | 537 | endp |
538 | |||
539 | |||
2388 | dunkaist | 540 | proc xcf._.composite_rgb_13 ; Color (H and S of HSL) |
541 | push eax ebx ecx edx |
||
1921 | dunkaist | 542 | |
2388 | dunkaist | 543 | movd eax, mm3 |
544 | movd ebx, mm2 |
||
1921 | dunkaist | 545 | |
2388 | dunkaist | 546 | call xcf._.rgb2hsl |
547 | xchg eax, ebx |
||
548 | call xcf._.rgb2hsl |
||
549 | xchg eax, ebx |
||
1921 | dunkaist | 550 | |
2388 | dunkaist | 551 | mov al, bl |
552 | |||
553 | call xcf._.hsl2rgb |
||
554 | |||
555 | |||
556 | movd mm3, eax |
||
557 | |||
558 | punpcklbw mm2, mm0 |
||
559 | punpcklbw mm3, mm0 |
||
560 | |||
561 | .quit: |
||
562 | pop edx ecx ebx eax |
||
563 | ret |
||
1921 | dunkaist | 564 | endp |
565 | |||
566 | |||
2388 | dunkaist | 567 | proc xcf._.composite_rgb_14 ; Value (V of HSV) |
568 | push eax ebx ecx edx |
||
1921 | dunkaist | 569 | |
2388 | dunkaist | 570 | movd eax, mm3 |
571 | movd ebx, mm2 |
||
1921 | dunkaist | 572 | |
2388 | dunkaist | 573 | call xcf._.rgb2hsv |
574 | xchg eax, ebx |
||
575 | call xcf._.rgb2hsv |
||
576 | xchg eax, ebx |
||
1921 | dunkaist | 577 | |
2388 | dunkaist | 578 | ror eax, 8 |
579 | ror ebx, 8 |
||
580 | mov ax, bx |
||
581 | rol eax, 8 |
||
582 | rol ebx, 8 |
||
1921 | dunkaist | 583 | |
2388 | dunkaist | 584 | call xcf._.hsv2rgb |
1921 | dunkaist | 585 | |
586 | |||
2388 | dunkaist | 587 | movd mm3, eax |
1921 | dunkaist | 588 | |
2388 | dunkaist | 589 | punpcklbw mm2, mm0 |
590 | punpcklbw mm3, mm0 |
||
1921 | dunkaist | 591 | |
2388 | dunkaist | 592 | .quit: |
593 | pop edx ecx ebx eax |
||
594 | ret |
||
1921 | dunkaist | 595 | endp |
596 | |||
597 | |||
2388 | dunkaist | 598 | proc xcf._.composite_rgb_15 ; Divide |
599 | push eax ebx ecx |
||
1921 | dunkaist | 600 | |
2388 | dunkaist | 601 | movd eax, mm3 |
602 | movd ebx, mm2 |
||
1921 | dunkaist | 603 | |
2388 | dunkaist | 604 | rol eax, 8 |
605 | rol ebx, 8 |
||
1921 | dunkaist | 606 | |
2388 | dunkaist | 607 | xchg eax, ebx |
1921 | dunkaist | 608 | |
2388 | dunkaist | 609 | mov ecx, 3 |
1921 | dunkaist | 610 | |
2388 | dunkaist | 611 | .color: |
612 | rol eax, 8 |
||
613 | rol ebx, 8 |
||
614 | shl ax, 8 |
||
615 | test bl, bl |
||
616 | jz .clamp1 |
||
617 | cmp ah, bl |
||
618 | jae .clamp2 |
||
619 | div bl |
||
620 | jmp .done |
||
621 | .clamp1: |
||
622 | mov al, 0xff |
||
623 | test ah, ah |
||
624 | jnz @f |
||
625 | not al |
||
626 | @@: |
||
627 | jmp .done |
||
628 | .clamp2: |
||
629 | mov al, 0xff |
||
630 | jmp .done |
||
631 | .done: |
||
632 | mov ah, al |
||
633 | loop .color |
||
1921 | dunkaist | 634 | |
2388 | dunkaist | 635 | ror eax, 8 |
636 | movd mm3, eax |
||
1921 | dunkaist | 637 | |
2388 | dunkaist | 638 | punpcklbw mm2, mm0 |
639 | punpcklbw mm3, mm0 |
||
640 | |||
641 | pop ecx ebx eax |
||
642 | ret |
||
1921 | dunkaist | 643 | endp |
644 | |||
645 | |||
2388 | dunkaist | 646 | proc xcf._.composite_rgb_16 ; Dodge |
647 | push eax ebx ecx |
||
1921 | dunkaist | 648 | |
2388 | dunkaist | 649 | movd eax, mm3 |
650 | movd ebx, mm2 |
||
1921 | dunkaist | 651 | |
2388 | dunkaist | 652 | rol eax, 8 |
653 | rol ebx, 8 |
||
1921 | dunkaist | 654 | |
2388 | dunkaist | 655 | xchg eax, ebx |
1921 | dunkaist | 656 | |
2388 | dunkaist | 657 | mov ecx, 3 |
1921 | dunkaist | 658 | |
2388 | dunkaist | 659 | .color: |
660 | rol eax, 8 |
||
661 | rol ebx, 8 |
||
662 | shl ax, 8 |
||
663 | neg bl |
||
664 | add bl, 0xff |
||
665 | test bl, bl |
||
666 | jz .clamp1 |
||
667 | cmp ah, bl |
||
668 | jae .clamp2 |
||
669 | div bl |
||
670 | jmp .done |
||
671 | .clamp1: |
||
672 | mov al, 0xff |
||
673 | test ah, ah |
||
674 | jnz @f |
||
675 | not al |
||
676 | @@: |
||
677 | jmp .done |
||
678 | .clamp2: |
||
679 | mov al, 0xff |
||
680 | jmp .done |
||
681 | .done: |
||
682 | mov ah, al |
||
683 | loop .color |
||
1921 | dunkaist | 684 | |
2388 | dunkaist | 685 | ror eax, 8 |
686 | movd mm3, eax |
||
1921 | dunkaist | 687 | |
2388 | dunkaist | 688 | punpcklbw mm2, mm0 |
689 | punpcklbw mm3, mm0 |
||
690 | |||
691 | pop ecx ebx eax |
||
692 | ret |
||
1921 | dunkaist | 693 | endp |
694 | |||
695 | |||
2388 | dunkaist | 696 | proc xcf._.composite_rgb_17 ; Burn |
697 | push eax ebx ecx |
||
1921 | dunkaist | 698 | |
2388 | dunkaist | 699 | movd eax, mm3 |
700 | movd ebx, mm2 |
||
1921 | dunkaist | 701 | |
2388 | dunkaist | 702 | rol eax, 8 |
703 | rol ebx, 8 |
||
1921 | dunkaist | 704 | |
2388 | dunkaist | 705 | xchg eax, ebx |
1921 | dunkaist | 706 | |
2388 | dunkaist | 707 | mov ecx, 3 |
1921 | dunkaist | 708 | |
2388 | dunkaist | 709 | .color: |
710 | rol eax, 8 |
||
711 | rol ebx, 8 |
||
712 | shl ax, 8 |
||
713 | neg ah |
||
714 | add ah, 0xff |
||
715 | test bl, bl |
||
716 | jz .clamp1 |
||
717 | cmp ah, bl |
||
718 | jae .clamp2 |
||
719 | div bl |
||
720 | jmp .done |
||
721 | .clamp1: |
||
722 | mov al, 0xff |
||
723 | test ah, ah |
||
724 | jnz @f |
||
725 | not al |
||
726 | @@: |
||
727 | jmp .done |
||
728 | .clamp2: |
||
729 | mov al, 0xff |
||
730 | jmp .done |
||
731 | .done: |
||
732 | mov ah, al |
||
733 | neg ah |
||
734 | add ah, 0xff |
||
735 | loop .color |
||
1921 | dunkaist | 736 | |
2388 | dunkaist | 737 | ror eax, 8 |
738 | movd mm3, eax |
||
1921 | dunkaist | 739 | |
2388 | dunkaist | 740 | punpcklbw mm2, mm0 |
741 | punpcklbw mm3, mm0 |
||
742 | |||
743 | pop ecx ebx eax |
||
744 | ret |
||
1921 | dunkaist | 745 | endp |
746 | |||
747 | |||
2388 | dunkaist | 748 | proc xcf._.composite_rgb_18 ; Hard Light |
749 | push eax ebx ecx |
||
1921 | dunkaist | 750 | |
2388 | dunkaist | 751 | movd eax, mm3 |
752 | movd ebx, mm2 |
||
1921 | dunkaist | 753 | |
2388 | dunkaist | 754 | rol eax, 8 |
755 | rol ebx, 8 |
||
756 | |||
757 | mov ecx, 3 |
||
758 | |||
759 | .color: |
||
760 | rol eax, 8 |
||
761 | rol ebx, 8 |
||
762 | cmp al, 127 |
||
763 | jna .part1 |
||
764 | mov ah, 0xff |
||
765 | sub ah, bl |
||
766 | neg al |
||
767 | add al, 0xff |
||
768 | mul ah |
||
769 | shl ax, 1 |
||
770 | neg ah |
||
771 | add ah, 0xff |
||
772 | jmp .done |
||
773 | .part1: |
||
774 | mul bl |
||
775 | shl ax, 1 |
||
776 | .done: |
||
777 | loop .color |
||
778 | |||
779 | ror eax, 8 |
||
780 | movd mm3, eax |
||
781 | |||
782 | punpcklbw mm2, mm0 |
||
783 | punpcklbw mm3, mm0 |
||
784 | |||
785 | pop ecx ebx eax |
||
786 | ret |
||
1921 | dunkaist | 787 | endp |
788 | |||
789 | |||
2388 | dunkaist | 790 | proc xcf._.composite_rgb_20 ; Grain Extract |
1921 | dunkaist | 791 | |
2388 | dunkaist | 792 | punpcklbw mm2, mm0 |
793 | punpcklbw mm3, mm0 |
||
794 | movq mm4, mm2 |
||
795 | psubw mm3, [xcf._.mmx_0080] |
||
796 | psubw mm4, mm3 |
||
797 | movq mm3, mm4 |
||
798 | packuswb mm3, mm0 |
||
799 | punpcklbw mm3, mm0 |
||
800 | ret |
||
801 | endp |
||
1921 | dunkaist | 802 | |
2388 | dunkaist | 803 | |
804 | proc xcf._.composite_rgb_21 ; Grain Merge |
||
805 | |||
806 | punpcklbw mm2, mm0 |
||
807 | punpcklbw mm3, mm0 |
||
808 | paddw mm3, mm2 |
||
809 | psubusw mm3, [xcf._.mmx_0080] |
||
810 | packuswb mm3, mm0 |
||
811 | punpcklbw mm3, mm0 |
||
812 | ret |
||
1921 | dunkaist | 813 | endp |
814 | |||
815 | |||
2388 | dunkaist | 816 | ; starting numbers for pseudo-random number generator |
817 | xcf._.random_a dd 1103515245 |
||
818 | xcf._.random_b dd 777 |
||
819 | xcf._.random_c dd 12345 |
||
820 | |||
821 | xcf._.mmx_0080 dq 0x0080008000800080 |
||
822 | xcf._.mmx_00ff dq 0x00ff00ff00ff00ff |
||
823 | xcf._.mmx_0100 dq 0x0100010001000100 |