Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 8340 → Rev 8341

/programs/develop/libraries/libs-dev/libimg/Tupfile.lua
1,2 → 1,6
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("libimg.asm", "fasm -m 32768 %f %o " .. tup.getconfig("KPACK_CMD"), "libimg.obj")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
 
add_include(HELPERDIR .. "/develop/libraries/libs-dev/libio")
tup.rule("libimg.asm", FASM .. " -m 32768 %f %o " .. tup.getconfig("KPACK_CMD"), "%B.obj")
/programs/develop/libraries/libs-dev/libimg/blend.asm
0,0 → 1,76
match =MMX, COMPOSITE_MODE {include 'blend_mmx.asm'}
match =SSE, COMPOSITE_MODE {include 'blend_sse.asm'}
 
;;============================================================================;;
proc img.blend uses ebx esi edi, _bottom, _top, _xbottom, _ybottom, \ ;///////;;
_xtop, _ytop, _width, _height ;//////////////;;
;;----------------------------------------------------------------------------;;
;? Alpha blend _top image to _bottom one (both must be of type Image.bpp32) ;;
;;----------------------------------------------------------------------------;;
;> _bottom = pointer to bottom image (will be changed) ;;
;> _top = pointer to top image (unchanged) ;;
;> _xbottom = x coord inside _bottom image where to put _top image ;;
;> _ybottom = y coord inside _bottom image where to put _top image ;;
;> _xtop = x coord inside _top image to start from ;;
;> _ytop = y coord inside _top image to start from ;;
;> _width = width of _top image area to put to _bottom image ;;
;> _height = height of _top image area to put to _bottom image ;;
;;----------------------------------------------------------------------------;;
;< eax = 0 (fail) / _bottom (ok) ;;
;;============================================================================;;
mov esi, [_top]
mov edi, [_bottom]
 
mov eax, [esi+Image.Width]
sub eax, [_width]
shl eax, 2
push eax
 
mov eax, [edi+Image.Width]
sub eax, [_width]
shl eax, 2
push eax
 
mov eax, [_ytop]
imul eax, [esi+Image.Width]
add eax, [_xtop]
shl eax, 2
mov esi, [esi+Image.Data]
add esi, eax
 
mov eax, [_ybottom]
imul eax, [edi+Image.Width]
add eax, [_xbottom]
shl eax, 2
mov edi, [edi+Image.Data]
add edi, eax
stdcall xcf._.composite_rgb_00, [_width], [_height]
mov eax, [_bottom]
ret
endp
 
 
xcf._.composite_table.begin:
.p00 dd 00, xcf._.composite_rgb_00, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Normal
.p01 dd 01, xcf._.composite_rgb_01, xcf._.composite_gray_01, xcf._.composite_gray_01 ; Dissolve : random dithering to discrete alpha
; .p02 dd 02, xcf._.composite_rgb_02, 0, xcf._.composite_indexed_02 ; Behind : not selectable in the GIMP UI. not implemented
.p03 dd 03, xcf._.composite_rgb_03, xcf._.composite_rgb_03, xcf._.composite_indexed_00 ; Multiply
.p04 dd 04, xcf._.composite_rgb_04, xcf._.composite_rgb_04, xcf._.composite_indexed_00 ; Screen
.p05 dd 05, xcf._.composite_rgb_05, xcf._.composite_rgb_05, xcf._.composite_indexed_00 ; Overlay
.p06 dd 06, xcf._.composite_rgb_06, xcf._.composite_rgb_06, xcf._.composite_indexed_00 ; Difference
.p07 dd 07, xcf._.composite_rgb_07, xcf._.composite_rgb_07, xcf._.composite_indexed_00 ; Addition
.p08 dd 08, xcf._.composite_rgb_08, xcf._.composite_rgb_08, xcf._.composite_indexed_00 ; Subtract
.p09 dd 09, xcf._.composite_rgb_09, xcf._.composite_rgb_09, xcf._.composite_indexed_00 ; Darken Only
.p10 dd 10, xcf._.composite_rgb_10, xcf._.composite_rgb_10, xcf._.composite_indexed_00 ; Lighten Only
.p11 dd 11, xcf._.composite_rgb_11, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Hue (H of HSV)
.p12 dd 12, xcf._.composite_rgb_12, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Saturation (S of HSV)
.p13 dd 13, xcf._.composite_rgb_13, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Color (H and S of HSL)
.p14 dd 14, xcf._.composite_rgb_14, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Value (V of HSV)
.p15 dd 15, xcf._.composite_rgb_15, xcf._.composite_rgb_15, xcf._.composite_indexed_00 ; Divide
.p16 dd 16, xcf._.composite_rgb_16, xcf._.composite_rgb_16, xcf._.composite_indexed_00 ; Dodge
.p17 dd 17, xcf._.composite_rgb_17, xcf._.composite_rgb_17, xcf._.composite_indexed_00 ; Burn
.p18 dd 18, xcf._.composite_rgb_18, xcf._.composite_rgb_18, xcf._.composite_indexed_00 ; Hard Light
.p19 dd 19, xcf._.composite_rgb_05, xcf._.composite_rgb_05, xcf._.composite_indexed_00 ; Soft Light : XCF >= 2 only ('soft light' == 'overlay')
.p20 dd 20, xcf._.composite_rgb_20, xcf._.composite_rgb_20, xcf._.composite_indexed_00 ; Grain Extract : XCF >= 2 only
.p21 dd 21, xcf._.composite_rgb_21, xcf._.composite_rgb_21, xcf._.composite_indexed_00 ; Grain Merge : XCF >= 2 only
xcf._.composite_table.end:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/blend_mmx.asm
0,0 → 1,842
;;================================================================================================;;
;;//// blend_mmx.asm //// (c) dunkaist, 2011-2012 ////////////////////////////////////////////////;;
;;================================================================================================;;
;; ;;
;; This file is part of Common development libraries (Libs-Dev). ;;
;; ;;
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
;; of the License, or (at your option) any later version. ;;
;; ;;
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
;; Lesser General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev. ;;
;; If not, see <http://www.gnu.org/licenses/>. ;;
;; ;;
;;================================================================================================;;
 
proc xcf._.blend_rgb
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
 
mov ah, al
 
movd mm1, eax
punpcklbw mm1, mm1
punpcklbw mm1, mm0
 
movq mm7, mm1
psrlw mm7, 7
paddw mm1, mm7
 
psubw mm3, mm2
pmullw mm3, mm1
psllw mm2, 8
paddw mm3, mm2
pinsrw mm3, ebx, 3
psrlw mm3, 8
packuswb mm3, mm0
movd eax, mm3
 
ret
endp
 
 
proc xcf._.blend_gray
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
 
mov ah, al
 
movd mm1, eax
punpcklbw mm1, mm1
punpcklbw mm1, mm0
 
movq mm7, mm1
psrlw mm7, 7
paddw mm1, mm7
 
psubw mm3, mm2
pmullw mm3, mm1
psllw mm2, 8
paddw mm3, mm2
pinsrw mm3, ebx, 1
psrlw mm3, 8
packuswb mm3, mm0
movd eax, mm3
 
ret
endp
 
 
proc xcf._.merge_32 _copy_width, _copy_height, _img_total_bpl, _bottom_total_bpl
.rgb_line:
mov ecx, [_copy_width]
.rgb_pixel:
mov ebx, [edi]
lodsd
 
movd mm2, ebx
movd mm3, eax
shr eax, 24
shr ebx, 16
cmp al, bh
jna @f
mov al, bh
@@:
pxor mm0, mm0
call edx
call xcf._.blend_rgb
stosd
dec ecx
jnz .rgb_pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .rgb_line
emms
ret
endp
 
 
proc xcf._.merge_8a _copy_width, _copy_height, _img_total_bpl, _bottom_total_bpl
.gray_line:
mov ecx, [_copy_width]
.gray_pixel:
mov bx, word[edi]
lodsw
movd mm2, ebx
movd mm3, eax
shr eax, 8
cmp al, bh
jna @f
mov al, bh
@@:
pxor mm0, mm0
call edx
call xcf._.blend_gray
stosw
dec ecx
jnz .gray_pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .gray_line
emms
ret
endp
 
 
proc xcf._.composite_rgb_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
 
.line:
mov ecx, [_copy_width]
.pixel:
mov ebx, [edi]
lodsd
movd mm2, ebx
movd mm3, eax
 
shr eax, 24
shr ebx, 16
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
 
mov ah, al
 
movd mm1, eax
pxor mm0, mm0
punpcklbw mm1, mm1
punpcklbw mm1, mm0
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
psubsw mm3, mm2
pmullw mm3, mm1
psllw mm2, 8
paddw mm3, mm2
pinsrw mm3, ebx, 3
psrlw mm3, 8
packuswb mm3, mm0
movd eax, mm3
stosd
 
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
 
ret
endp
 
 
proc xcf._.composite_gray_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
 
.line:
mov ecx, [_copy_width]
.pixel:
mov bx, [edi]
lodsw
movd mm2, ebx
movd mm3, eax
 
shr eax, 8
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
 
mov ah, al
 
movd mm1, eax
pxor mm0, mm0
punpcklbw mm1, mm1
punpcklbw mm1, mm0
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
psubw mm3, mm2
pmullw mm3, mm1
psllw mm2, 8
paddw mm3, mm2
pinsrw mm3, ebx, 1
psrlw mm3, 8
packuswb mm3, mm0
movd eax, mm3
stosw
 
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
 
ret
endp
 
 
proc xcf._.composite_indexed_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
 
.line:
mov ecx, [_copy_width]
.pixel:
mov bx, [edi]
lodsw
 
or ah, 0x7f
test ah, 0x80
jnz @f
mov ax, bx
@@:
stosw
 
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
ret
endp
 
 
proc xcf._.composite_rgb_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
pushad
 
pxor mm4, mm4
movd mm4, [xcf._.random_b]
movd mm1, [xcf._.random_a]
movd mm2, [xcf._.random_c]
 
.line:
mov ecx, [_copy_width]
.pixel:
mov ebx, [edi]
lodsd
 
movq mm0, mm4
pmuludq mm0, mm1
paddq mm0, mm2
movd edx, mm0
movd mm4, edx
pxor mm0, mm0
 
rol eax, 8
test al, al
jz @f
shr edx, 17
cmp dl, al
ja @f
ror eax, 8
or eax, 0xff000000
jmp .done
@@:
mov eax, ebx
.done:
stosd
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
 
.quit:
popad
ret
endp
 
 
proc xcf._.composite_gray_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
pushad
 
pxor mm4, mm4
movd mm4, [xcf._.random_b]
movd mm1, [xcf._.random_a]
movd mm2, [xcf._.random_c]
 
.line:
mov ecx, [_copy_width]
.pixel:
mov ebx, [edi]
lodsw
 
movq mm0, mm4
pmuludq mm0, mm1
paddq mm0, mm2
movd edx, mm0
movd mm4, edx
pxor mm0, mm0
 
test ah, ah
jz @f
shr edx, 17
cmp dl, ah
ja @f
or ax, 0xff00
jmp .done
@@:
mov eax, ebx
.done:
stosw
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
 
.quit:
popad
ret
endp
 
 
proc xcf._.composite_rgb_03 ; Multiply
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
pmullw mm3, mm2
psrlw mm3, 8
 
ret
endp
 
 
proc xcf._.composite_rgb_04 ; Screen
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
movq mm4, [xcf._.mmx_00ff]
movq mm5, mm4
psubw mm5, mm3
movq mm3, mm4
psubw mm4, mm2
pmullw mm4, mm5
psrlw mm4, 8
psubw mm3, mm4
 
ret
endp
 
 
proc xcf._.composite_rgb_05 ; Overlay
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
movq mm4, [xcf._.mmx_00ff]
psubw mm4, mm2
pmullw mm3, mm4
psrlw mm3, 7
paddw mm3, mm2
pmullw mm3, mm2
psrlw mm3, 8
 
ret
endp
 
 
proc xcf._.composite_rgb_06 ; Difference
 
movq mm4, mm3
pminub mm4, mm2
pmaxub mm3, mm2
psubusb mm3, mm4
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
ret
endp
 
 
proc xcf._.composite_rgb_07 ; Addition
 
paddusb mm3, mm2
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
ret
endp
 
 
proc xcf._.composite_rgb_08 ; Subtract
 
movq mm4, mm2
psubusb mm4, mm3
movq mm3, mm4
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
ret
endp
 
 
proc xcf._.composite_rgb_09 ; Darken Only
 
pminub mm3, mm2
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
ret
endp
 
 
proc xcf._.composite_rgb_10 ; Lighten Only
 
pmaxub mm3, mm2
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
ret
endp
 
 
proc xcf._.composite_rgb_11 ; Hue (H of HSV)
push eax ebx ecx edx
 
movd eax, mm3
movd ebx, mm2
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
test ah, ah
jnz @f
ror eax, 8
ror ebx, 8
mov ah, bh
rol eax, 8
rol ebx, 8
@@:
mov ax, bx
 
call xcf._.hsv2rgb
 
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_12 ; Saturation (S of HSV)
push eax ebx ecx edx
 
movd eax, mm3
movd ebx, mm2
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
ror eax, 8
ror ebx, 8
mov ah, bh
rol eax, 8
rol ebx, 8
mov al, bl
 
call xcf._.hsv2rgb
 
 
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_13 ; Color (H and S of HSL)
push eax ebx ecx edx
 
movd eax, mm3
movd ebx, mm2
 
call xcf._.rgb2hsl
xchg eax, ebx
call xcf._.rgb2hsl
xchg eax, ebx
 
mov al, bl
 
call xcf._.hsl2rgb
 
 
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_14 ; Value (V of HSV)
push eax ebx ecx edx
 
movd eax, mm3
movd ebx, mm2
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
ror eax, 8
ror ebx, 8
mov ax, bx
rol eax, 8
rol ebx, 8
 
call xcf._.hsv2rgb
 
 
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_15 ; Divide
push eax ebx ecx
 
movd eax, mm3
movd ebx, mm2
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
shl ax, 8
test bl, bl
jz .clamp1
cmp ah, bl
jae .clamp2
div bl
jmp .done
.clamp1:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done
.clamp2:
mov al, 0xff
jmp .done
.done:
mov ah, al
loop .color
 
ror eax, 8
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_16 ; Dodge
push eax ebx ecx
 
movd eax, mm3
movd ebx, mm2
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
shl ax, 8
neg bl
add bl, 0xff
test bl, bl
jz .clamp1
cmp ah, bl
jae .clamp2
div bl
jmp .done
.clamp1:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done
.clamp2:
mov al, 0xff
jmp .done
.done:
mov ah, al
loop .color
 
ror eax, 8
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_17 ; Burn
push eax ebx ecx
 
movd eax, mm3
movd ebx, mm2
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
shl ax, 8
neg ah
add ah, 0xff
test bl, bl
jz .clamp1
cmp ah, bl
jae .clamp2
div bl
jmp .done
.clamp1:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done
.clamp2:
mov al, 0xff
jmp .done
.done:
mov ah, al
neg ah
add ah, 0xff
loop .color
 
ror eax, 8
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_18 ; Hard Light
push eax ebx ecx
 
movd eax, mm3
movd ebx, mm2
 
rol eax, 8
rol ebx, 8
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
cmp al, 127
jna .part1
mov ah, 0xff
sub ah, bl
neg al
add al, 0xff
mul ah
shl ax, 1
neg ah
add ah, 0xff
jmp .done
.part1:
mul bl
shl ax, 1
.done:
loop .color
 
ror eax, 8
movd mm3, eax
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_20 ; Grain Extract
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
movq mm4, mm2
psubw mm3, [xcf._.mmx_0080]
psubw mm4, mm3
movq mm3, mm4
packuswb mm3, mm0
punpcklbw mm3, mm0
ret
endp
 
 
proc xcf._.composite_rgb_21 ; Grain Merge
 
punpcklbw mm2, mm0
punpcklbw mm3, mm0
paddw mm3, mm2
psubusw mm3, [xcf._.mmx_0080]
packuswb mm3, mm0
punpcklbw mm3, mm0
ret
endp
 
 
; starting numbers for pseudo-random number generator
xcf._.random_a dd 1103515245
xcf._.random_b dd 777
xcf._.random_c dd 12345
 
xcf._.mmx_0080 dq 0x0080008000800080
xcf._.mmx_00ff dq 0x00ff00ff00ff00ff
xcf._.mmx_0100 dq 0x0100010001000100
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/blend_sse.asm
0,0 → 1,1335
;;================================================================================================;;
;;//// blend_sse.asm //// (c) dunkaist, 2011-2012 ////////////////////////////////////////////////;;
;;================================================================================================;;
;; ;;
;; This file is part of Common development libraries (Libs-Dev). ;;
;; ;;
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
;; of the License, or (at your option) any later version. ;;
;; ;;
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
;; Lesser General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev. ;;
;; If not, see <http://www.gnu.org/licenses/>. ;;
;; ;;
;;================================================================================================;;
 
proc xcf._.blend_rgb
 
push eax ebx
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
mov ah, al
movd xmm1, eax
 
pop ebx eax
push ebx
 
shr eax, 8
shr ebx, 8
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
mov ah, al
movd ebx, xmm1
ror ebx, 16
mov bx, ax
rol ebx, 16
movd xmm1, ebx
 
pop ebx
 
; movdqu xmm1, xword[xcf._.xmm_000000ff]
; movdqa xmm4, xmm1
; movdqa xmm5, xmm1
; movdqa xmm6, xmm2
; psrldq xmm6, 3
; pand xmm6, xmm1
; psubw xmm4, xmm6
; movdqa xmm6, xmm3
; psrldq xmm6, 3
; pand xmm6, xmm1
; psubw xmm5, xmm6
; pmullw xmm4, xmm5
; psrlw xmm4, 8
; psubw xmm1, xmm4
; movdqa xmm4, xmm1
; movdqa xmm1, xmm6
; divps xmm1, xmm4
; packuswb xmm1, xmm0
; packuswb xmm1, xmm0
; punpcklbw xmm1, xmm1
 
punpcklbw xmm1, xmm1
punpcklbw xmm1, xmm0
 
movdqa xmm7, xmm1
psrlw xmm7, 7
paddw xmm1, xmm7
 
psubw xmm3, xmm2
pmullw xmm3, xmm1
psllw xmm2, 8
paddw xmm3, xmm2
pinsrw xmm3, ebx, 3
shr ebx, 8
pinsrw xmm3, ebx, 7
psrlw xmm3, 8
packuswb xmm3, xmm0
 
ret
endp
 
 
proc xcf._.blend_gray
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
 
mov ah, al
 
movd xmm1, eax
punpcklbw xmm1, xmm1
punpcklbw xmm1, xmm0
 
movq xmm7, xmm1
psrlw xmm7, 7
paddw xmm1, xmm7
 
psubw xmm3, xmm2
pmullw xmm3, xmm1
psllw xmm2, 8
paddw xmm3, xmm2
pinsrw xmm3, ebx, 1
psrlw xmm3, 8
packuswb xmm3, xmm0
 
ret
endp
 
 
proc xcf._.merge_32 _copy_width, _copy_height, _img_total_bpl, _bottom_total_bpl
 
pxor xmm0, xmm0
 
.line:
mov ecx, [_copy_width]
bt ecx, 0
jnc .even
.odd:
movd xmm2, [edi]
movd xmm3, [esi]
add esi, 4
 
movdqa xmm4, xmm2
pminub xmm4, xmm3
pextrw eax, xmm4, 3
pextrw ebx, xmm4, 1
mov al, bh
 
push eax
pextrw eax, xmm2, 3
pextrw ebx, xmm2, 1
mov bl, ah
shl ebx, 8
pop eax
 
call edx
call xcf._.blend_rgb
movd [edi], xmm3
add edi, 4
 
cmp ecx, 1
je .done
 
.even:
sub ecx, 2
.pixel:
movq xmm2, [edi]
movq xmm3, [esi]
add esi, 8
 
movdqa xmm4, xmm2
pminub xmm4, xmm3
pextrw eax, xmm4, 3
pextrw ebx, xmm4, 1
mov al, bh
 
push eax
pextrw eax, xmm2, 3
pextrw ebx, xmm2, 1
mov bl, ah
shl ebx, 8
pop eax
 
call edx
call xcf._.blend_rgb
movq [edi], xmm3
add edi, 8
sub ecx, 2
jns .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
.done:
ret
endp
 
 
proc xcf._.merge_8a _copy_width, _copy_height, _img_total_bpl, _bottom_total_bpl
.gray_line:
mov ecx, [_copy_width]
.gray_pixel:
mov bx, word[edi]
lodsw
movd xmm2, ebx
movd xmm3, eax
shr eax, 8
cmp al, bh
jna @f
mov al, bh
@@:
pxor xmm0, xmm0
call edx
call xcf._.blend_gray
movd eax, xmm3
stosw
dec ecx
jnz .gray_pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .gray_line
ret
endp
 
 
proc xcf._.composite_rgb_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
 
pxor xmm0, xmm0
 
.line:
mov ecx, [_copy_width]
bt ecx, 0
jnc .even
.odd:
movlpd xmm2, [edi]
movlpd xmm3, [esi]
add esi, 4
 
pextrw eax, xmm3, 3
pextrw ebx, xmm3, 1
mov al, bh
 
push eax
pextrw eax, xmm2, 3
pextrw ebx, xmm2, 1
mov bl, ah
shl ebx, 8
pop eax
 
xchg al, bh
mov ah, bh
neg al
neg ah
dec al
dec ah
mul ah
neg ah
dec ah
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
inc al
div bh
@@:
mov ah, al
movd xmm1, eax
 
punpcklbw xmm1, xmm1
punpcklbw xmm1, xmm0
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
psubsw xmm3, xmm2
pmullw xmm3, xmm1
psllw xmm2, 8
paddw xmm3, xmm2
pinsrw xmm3, ebx, 3
shr ebx, 8
pinsrw xmm3, ebx, 7
psrlw xmm3, 8
packuswb xmm3, xmm0
 
movd [edi], xmm3
add edi, 4
 
cmp ecx, 1
je .done
 
.even:
sub ecx, 2
.pixel:
movlpd xmm2, [edi]
movlpd xmm3, [esi]
add esi, 8
 
pextrw eax, xmm3, 3
pextrw ebx, xmm3, 1
mov al, bh
 
push eax
pextrw eax, xmm2, 3
pextrw ebx, xmm2, 1
mov bl, ah
shl ebx, 8
pop eax
 
 
push eax ebx
 
xchg al, bh
mov ah, bh
neg al
neg ah
dec al
dec ah
mul ah
neg ah
dec ah
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
inc al
div bh
@@:
mov ah, al
movd xmm1, eax
 
pop ebx eax
push ebx
 
shr eax, 8
shr ebx, 8
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
mov ah, al
movd ebx, xmm1
ror ebx, 16
mov bx, ax
rol ebx, 16
movd xmm1, ebx
 
pop ebx
 
punpcklbw xmm1, xmm1
punpcklbw xmm1, xmm0
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
psubsw xmm3, xmm2
pmullw xmm3, xmm1
psllw xmm2, 8
paddw xmm3, xmm2
pinsrw xmm3, ebx, 3
shr ebx, 8
pinsrw xmm3, ebx, 7
psrlw xmm3, 8
packuswb xmm3, xmm0
 
movq [edi], xmm3
add edi, 8
sub ecx, 2
jns .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
.done:
ret
endp
 
 
proc xcf._.composite_gray_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
 
.line:
mov ecx, [_copy_width]
.pixel:
mov bx, [edi]
lodsw
movd xmm2, ebx
movd xmm3, eax
 
shr eax, 8
 
xchg al, bh
mov ah, bh
neg ax
add ax, 0xffff
mul ah
neg ah
add ah, 0xff
xchg ah, bh
 
mov al, 0xff
cmp ah, bh
je @f
not al
div bh
@@:
 
mov ah, al
 
movd xmm1, eax
pxor xmm0, xmm0
punpcklbw xmm1, xmm1
punpcklbw xmm1, xmm0
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
psubw xmm3, xmm2
pmullw xmm3, xmm1
psllw xmm2, 8
paddw xmm3, xmm2
pinsrw xmm3, ebx, 1
psrlw xmm3, 8
packuswb xmm3, xmm0
movd eax, xmm3
stosw
 
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
 
ret
endp
 
 
proc xcf._.composite_indexed_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
 
.line:
mov ecx, [_copy_width]
.pixel:
mov bx, [edi]
lodsw
 
or ah, 0x7f
test ah, 0x80
jnz @f
mov ax, bx
@@:
stosw
 
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
ret
endp
 
 
proc xcf._.composite_rgb_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
pushad
 
pxor xmm4, xmm4
movd xmm4, [xcf._.random_b]
movd xmm1, [xcf._.random_a]
movd xmm2, [xcf._.random_c]
 
.line:
mov ecx, [_copy_width]
.pixel:
mov ebx, [edi]
lodsd
 
movq xmm0, xmm4
pmuludq xmm0, xmm1
paddq xmm0, xmm2
movd edx, xmm0
movd xmm4, edx
pxor xmm0, xmm0
 
rol eax, 8
test al, al
jz @f
shr edx, 17
cmp dl, al
ja @f
ror eax, 8
or eax, 0xff000000
jmp .done
@@:
mov eax, ebx
.done:
stosd
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
 
.quit:
popad
ret
endp
 
 
proc xcf._.composite_gray_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
pushad
 
pxor xmm4, xmm4
movd xmm4, [xcf._.random_b]
movd xmm1, [xcf._.random_a]
movd xmm2, [xcf._.random_c]
 
.line:
mov ecx, [_copy_width]
.pixel:
mov ebx, [edi]
lodsw
 
movq xmm0, xmm4
pmuludq xmm0, xmm1
paddq xmm0, xmm2
movd edx, xmm0
movd xmm4, edx
pxor xmm0, xmm0
 
test ah, ah
jz @f
shr edx, 17
cmp dl, ah
ja @f
or ax, 0xff00
jmp .done
@@:
mov eax, ebx
.done:
stosw
dec ecx
jnz .pixel
add esi, [_img_total_bpl]
add edi, [_bottom_total_bpl]
dec [_copy_height]
jnz .line
 
.quit:
popad
ret
endp
 
 
proc xcf._.composite_rgb_03 ; Multiply
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
pmullw xmm3, xmm2
psrlw xmm3, 8
 
ret
endp
 
 
proc xcf._.composite_rgb_04 ; Screen
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
movdqu xmm4, xword[xcf._.xmm_00ff]
movdqa xmm5, xmm4
psubw xmm5, xmm3
movdqa xmm3, xmm4
psubw xmm4, xmm2
pmullw xmm4, xmm5
psrlw xmm4, 8
psubw xmm3, xmm4
ret
endp
 
 
proc xcf._.composite_rgb_05 ; Overlay
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
movdqu xmm4, xword[xcf._.xmm_00ff]
psubw xmm4, xmm2
pmullw xmm3, xmm4
psrlw xmm3, 7
paddw xmm3, xmm2
pmullw xmm3, xmm2
psrlw xmm3, 8
 
ret
endp
 
 
proc xcf._.composite_rgb_06 ; Difference
 
movdqa xmm4, xmm3
pminub xmm4, xmm2
pmaxub xmm3, xmm2
psubusb xmm3, xmm4
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
ret
endp
 
 
proc xcf._.composite_rgb_07 ; Addition
 
paddusb xmm3, xmm2
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
ret
endp
 
 
proc xcf._.composite_rgb_08 ; Subtract
 
movdqa xmm4, xmm2
psubusb xmm4, xmm3
movq xmm3, xmm4
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
ret
endp
 
 
proc xcf._.composite_rgb_09 ; Darken Only
 
pminub xmm3, xmm2
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
ret
endp
 
 
proc xcf._.composite_rgb_10 ; Lighten Only
 
pmaxub xmm3, xmm2
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
ret
endp
 
 
proc xcf._.composite_rgb_11 ; Hue (H of HSV)
push eax ebx ecx edx
 
movd eax, xmm3
movd ebx, xmm2
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
test ah, ah
jnz @f
ror eax, 8
ror ebx, 8
mov ah, bh
rol eax, 8
rol ebx, 8
@@:
mov ax, bx
 
call xcf._.hsv2rgb
 
push eax
 
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
test ah, ah
jnz @f
ror eax, 8
ror ebx, 8
mov ah, bh
rol eax, 8
rol ebx, 8
@@:
mov ax, bx
 
call xcf._.hsv2rgb
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_12 ; Saturation (S of HSV)
push eax ebx ecx edx
 
movd eax, xmm3
movd ebx, xmm2
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
ror eax, 8
ror ebx, 8
mov ah, bh
rol eax, 8
rol ebx, 8
mov al, bl
 
call xcf._.hsv2rgb
 
push eax
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
ror eax, 8
ror ebx, 8
mov ah, bh
rol eax, 8
rol ebx, 8
mov al, bl
 
call xcf._.hsv2rgb
 
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_13 ; Color (H and S of HSL)
push eax ebx ecx edx
 
movd eax, xmm3
movd ebx, xmm2
 
call xcf._.rgb2hsl
xchg eax, ebx
call xcf._.rgb2hsl
xchg eax, ebx
 
mov al, bl
 
call xcf._.hsl2rgb
 
push eax
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
call xcf._.rgb2hsl
xchg eax, ebx
call xcf._.rgb2hsl
xchg eax, ebx
 
mov al, bl
 
call xcf._.hsl2rgb
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_14 ; Value (V of HSV)
push eax ebx ecx edx
 
movd eax, xmm3
movd ebx, xmm2
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
ror eax, 8
ror ebx, 8
mov ax, bx
rol eax, 8
rol ebx, 8
 
call xcf._.hsv2rgb
 
push eax
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
call xcf._.rgb2hsv
xchg eax, ebx
call xcf._.rgb2hsv
xchg eax, ebx
 
ror eax, 8
ror ebx, 8
mov ax, bx
rol eax, 8
rol ebx, 8
 
call xcf._.hsv2rgb
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
.quit:
pop edx ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_15 ; Divide
push eax ebx ecx
 
movd eax, xmm3
movd ebx, xmm2
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
shl ax, 8
test bl, bl
jz .clamp1
cmp ah, bl
jae .clamp2
div bl
jmp .done
.clamp1:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done
.clamp2:
mov al, 0xff
jmp .done
.done:
mov ah, al
loop .color
 
ror eax, 8
 
 
push eax
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color2:
rol eax, 8
rol ebx, 8
shl ax, 8
test bl, bl
jz .clamp12
cmp ah, bl
jae .clamp22
div bl
jmp .done2
.clamp12:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done2
.clamp22:
mov al, 0xff
jmp .done2
.done2:
mov ah, al
loop .color2
 
ror eax, 8
 
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_16 ; Dodge
push eax ebx ecx
 
movd eax, xmm3
movd ebx, xmm2
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
shl ax, 8
neg bl
add bl, 0xff
test bl, bl
jz .clamp1
cmp ah, bl
jae .clamp2
div bl
jmp .done
.clamp1:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done
.clamp2:
mov al, 0xff
jmp .done
.done:
mov ah, al
loop .color
 
ror eax, 8
 
 
push eax
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color2:
rol eax, 8
rol ebx, 8
shl ax, 8
neg bl
add bl, 0xff
test bl, bl
jz .clamp12
cmp ah, bl
jae .clamp22
div bl
jmp .done2
.clamp12:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done2
.clamp22:
mov al, 0xff
jmp .done2
.done2:
mov ah, al
loop .color2
 
ror eax, 8
 
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_17 ; Burn
push eax ebx ecx
 
movd eax, xmm3
movd ebx, xmm2
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
shl ax, 8
neg ah
add ah, 0xff
test bl, bl
jz .clamp1
cmp ah, bl
jae .clamp2
div bl
jmp .done
.clamp1:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done
.clamp2:
mov al, 0xff
jmp .done
.done:
mov ah, al
neg ah
add ah, 0xff
loop .color
 
ror eax, 8
 
 
push eax
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
 
rol eax, 8
rol ebx, 8
 
xchg eax, ebx
 
mov ecx, 3
 
.color2:
rol eax, 8
rol ebx, 8
shl ax, 8
neg ah
add ah, 0xff
test bl, bl
jz .clamp12
cmp ah, bl
jae .clamp22
div bl
jmp .done2
.clamp12:
mov al, 0xff
test ah, ah
jnz @f
not al
@@:
jmp .done2
.clamp22:
mov al, 0xff
jmp .done2
.done2:
mov ah, al
neg ah
add ah, 0xff
loop .color2
 
ror eax, 8
 
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_18 ; Hard Light
push eax ebx ecx
 
movd eax, xmm3
movd ebx, xmm2
 
rol eax, 8
rol ebx, 8
 
mov ecx, 3
 
.color:
rol eax, 8
rol ebx, 8
cmp al, 127
jna .part1
mov ah, 0xff
sub ah, bl
neg al
add al, 0xff
mul ah
shl ax, 1
neg ah
add ah, 0xff
jmp .done
.part1:
mul bl
shl ax, 1
.done:
loop .color
 
ror eax, 8
 
 
push eax
movq xmm1, xmm3
psrldq xmm1, 4
movd eax, xmm1
movq xmm1, xmm2
psrldq xmm1, 4
movd ebx, xmm1
 
 
rol eax, 8
rol ebx, 8
 
mov ecx, 3
 
.color2:
rol eax, 8
rol ebx, 8
cmp al, 127
jna .part12
mov ah, 0xff
sub ah, bl
neg al
add al, 0xff
mul ah
shl ax, 1
neg ah
add ah, 0xff
jmp .done2
.part12:
mul bl
shl ax, 1
.done2:
loop .color2
 
ror eax, 8
 
 
movd xmm3, eax
pslldq xmm3, 4
pop eax
movd xmm1, eax
paddq xmm3, xmm1
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
 
pop ecx ebx eax
ret
endp
 
 
proc xcf._.composite_rgb_20 ; Grain Extract
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
movdqu xmm4, xmm2
psubw xmm3, xword[xcf._.xmm_0080]
psubw xmm4, xmm3
movdqa xmm3, xmm4
packuswb xmm3, xmm0
punpcklbw xmm3, xmm0
ret
endp
 
 
proc xcf._.composite_rgb_21 ; Grain Merge
 
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
paddw xmm3, xmm2
psubusw xmm3, xword[xcf._.xmm_0080]
packuswb xmm3, xmm0
punpcklbw xmm3, xmm0
ret
endp
 
 
; starting numbers for pseudo-random number generator
xcf._.random_a dd 1103515245
xcf._.random_b dd 777
xcf._.random_c dd 12345
 
xcf._.xmm_8080 dq 0x8080808080808080, 0x8080808080808080
xcf._.xmm_0080 dq 0x0080008000800080, 0x0080008000800080
xcf._.xmm_00ff dq 0x00ff00ff00ff00ff, 0x00ff00ff00ff00ff
xcf._.xmm_0100 dq 0x0100010001000100, 0x0100010001000100
xcf._.xmm_000000ff dq 0x000000ff000000ff, 0x0000000000000000
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/bmp/bmp.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/bmp/bmp.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/gif/gif.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/gif/gif.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/ico_cur/ico_cur.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/ico_cur/ico_cur.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/jpeg/jpeg.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/jpeg/jpeg.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/libimg.asm
22,14 → 22,14
 
public @EXPORT as 'EXPORTS'
 
include '../../../../struct.inc'
include '../../../../proc32.inc'
include '../../../../macros.inc'
include '../../../../config.inc'
include '../../../../debug-fdo.inc'
include 'struct.inc'
include 'proc32.inc'
include 'macros.inc'
include 'config.inc'
include 'debug-fdo.inc'
__DEBUG__ = 0
__DEBUG_LEVEL__ = 1
include '../../../../develop/libraries/libs-dev/libio/libio.inc'
include 'libio.inc'
purge section,mov,add,sub
 
include 'libimg.inc'
53,6 → 53,11
include 'scale.asm'
include 'convert.asm'
 
COMPOSITE_MODE equ MMX
; MMX | pretty fast and compatible
; SSE | a bit faster, but may be unsupported by some CPUs
include 'blend.asm'
 
;;================================================================================================;;
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
2743,6 → 2748,7
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
;;================================================================================================;;
 
section '.data' data readable writable align 16
;include_debug_strings
 
align 4
2807,6 → 2813,7
img.scale , 'img_scale' , \
img.get_scaled_size, 'img_get_scaled_size', \
img.convert , 'img_convert' , \
img.blend , 'img_blend' , \
img.formats_table , 'img_formats_table'
 
; import from deflate unpacker
2841,7 → 2848,6
db 0, 0, 0
db 0xFF, 0xFF, 0xFF
 
section '.data' data readable writable align 16
; uninitialized data - global constant tables
mem.alloc dd ?
mem.free dd ?
/programs/develop/libraries/libs-dev/libimg/pcx/pcx.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/pcx/pcx.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/png.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/png.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngerror.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngget.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pnginfo.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pnglibconf.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngmem.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngpriv.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngset.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngstruct.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngtokos.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngtrans.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngwio.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngwrite.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngwtran.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/libpng/pngwutil.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/png/png.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/pnm/pbm.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/pnm/pgm.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/pnm/pnm.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/pnm/pnm.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/pnm/ppm.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/tga/tga.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/tga/tga.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/tiff/huffman.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/tiff/tiff.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/tiff/tiff.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/wbmp/wbmp.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/xbm/xbm.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/xcf/composite_mmx.asm
File deleted
/programs/develop/libraries/libs-dev/libimg/xcf/composite_sse.asm
File deleted
/programs/develop/libraries/libs-dev/libimg/xcf/xcf.asm
29,10 → 29,6
include 'xcf.inc'
;include '../../../../../system/board/trunk/debug.inc'
 
COMPOSITE_MODE equ MMX
; MMX | pretty fast and compatible
; SSE | a bit faster, but may be unsupported by some CPUs
 
MAX_LAYERS = 255
 
;;================================================================================================;;
1616,10 → 1612,6
ret
endp
 
 
match =MMX, COMPOSITE_MODE{include 'composite_mmx.asm'}
match =SSE, COMPOSITE_MODE{include 'composite_sse.asm'}
 
;;================================================================================================;;
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
;;================================================================================================;;
1636,28 → 1628,3
dd 11, xcf._.parse_properties.11
dd 15, xcf._.parse_properties.15
xcf._.prop_table_end:
 
xcf._.composite_table.begin:
.p00 dd 00, xcf._.composite_rgb_00, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Normal
.p01 dd 01, xcf._.composite_rgb_01, xcf._.composite_gray_01, xcf._.composite_gray_01 ; Dissolve : random dithering to discrete alpha
; .p02 dd 02, xcf._.composite_rgb_02, 0, xcf._.composite_indexed_02 ; Behind : not selectable in the GIMP UI. not implemented
.p03 dd 03, xcf._.composite_rgb_03, xcf._.composite_rgb_03, xcf._.composite_indexed_00 ; Multiply
.p04 dd 04, xcf._.composite_rgb_04, xcf._.composite_rgb_04, xcf._.composite_indexed_00 ; Screen
.p05 dd 05, xcf._.composite_rgb_05, xcf._.composite_rgb_05, xcf._.composite_indexed_00 ; Overlay
.p06 dd 06, xcf._.composite_rgb_06, xcf._.composite_rgb_06, xcf._.composite_indexed_00 ; Difference
.p07 dd 07, xcf._.composite_rgb_07, xcf._.composite_rgb_07, xcf._.composite_indexed_00 ; Addition
.p08 dd 08, xcf._.composite_rgb_08, xcf._.composite_rgb_08, xcf._.composite_indexed_00 ; Subtract
.p09 dd 09, xcf._.composite_rgb_09, xcf._.composite_rgb_09, xcf._.composite_indexed_00 ; Darken Only
.p10 dd 10, xcf._.composite_rgb_10, xcf._.composite_rgb_10, xcf._.composite_indexed_00 ; Lighten Only
.p11 dd 11, xcf._.composite_rgb_11, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Hue (H of HSV)
.p12 dd 12, xcf._.composite_rgb_12, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Saturation (S of HSV)
.p13 dd 13, xcf._.composite_rgb_13, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Color (H and S of HSL)
.p14 dd 14, xcf._.composite_rgb_14, xcf._.composite_gray_00, xcf._.composite_indexed_00 ; Value (V of HSV)
.p15 dd 15, xcf._.composite_rgb_15, xcf._.composite_rgb_15, xcf._.composite_indexed_00 ; Divide
.p16 dd 16, xcf._.composite_rgb_16, xcf._.composite_rgb_16, xcf._.composite_indexed_00 ; Dodge
.p17 dd 17, xcf._.composite_rgb_17, xcf._.composite_rgb_17, xcf._.composite_indexed_00 ; Burn
.p18 dd 18, xcf._.composite_rgb_18, xcf._.composite_rgb_18, xcf._.composite_indexed_00 ; Hard Light
.p19 dd 19, xcf._.composite_rgb_05, xcf._.composite_rgb_05, xcf._.composite_indexed_00 ; Soft Light : XCF >= 2 only ('soft light' == 'overlay')
.p20 dd 20, xcf._.composite_rgb_20, xcf._.composite_rgb_20, xcf._.composite_indexed_00 ; Grain Extract : XCF >= 2 only
.p21 dd 21, xcf._.composite_rgb_21, xcf._.composite_rgb_21, xcf._.composite_indexed_00 ; Grain Merge : XCF >= 2 only
xcf._.composite_table.end:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/xcf/xcf.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/z80/z80.asm
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/develop/libraries/libs-dev/libimg/z80/z80.inc
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property