/programs/develop/libraries/libs-dev/libimg/libimg.asm |
---|
40,6 → 40,8 |
include 'ico_cur/ico_cur.asm' |
include 'pcx/pcx.asm' |
include 'xcf/xcf.asm' |
include 'tiff/tiff.asm' |
include 'pnm/pnm.asm' |
;;================================================================================================;; |
proc lib_init ;///////////////////////////////////////////////////////////////////////////////////;; |
1999,6 → 2001,8 |
.tga dd img.is.tga, img.decode.tga, img.encode.tga |
.pcx dd img.is.pcx, img.decode.pcx, img.encode.pcx |
.xcf dd img.is.xcf, img.decode.xcf, img.encode.xcf |
.tiff dd img.is.tiff, img.decode.tiff, img.encode.tiff |
.pnm dd img.is.pnm, img.decode.pnm, img.encode.pnm |
.z80 dd img.is.z80, img.decode.z80, img.encode.z80 ;this must be the last entry as there are no |
;signatures in z80 screens at all |
dd 0 |
/programs/develop/libraries/libs-dev/libimg/libimg.inc |
---|
46,6 → 46,7 |
Image.bpp15 = 4 |
Image.bpp16 = 5 |
Image.bpp1 = 6 |
Image.bpp4 = 7 |
; bits in Image.Flags |
Image.IsAnimated = 1 |
/programs/develop/libraries/libs-dev/libimg/pcx/pcx.asm |
---|
1,5 → 1,5 |
;;================================================================================================;; |
;;//// pcx.asm //// (c) dunkaist, 2010 ///////////////////////////////////////////////////////////;; |
;;//// pcx.asm //// (c) dunkaist, 2010,2012 //////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;; ;; |
;; This file is part of Common development libraries (Libs-Dev). ;; |
59,9 → 59,9 |
.is_not_pcx: |
pop edi ecx |
ret |
endp |
;;================================================================================================;; |
proc img.decode.pcx _data, _length, _options ;////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
140,7 → 140,7 |
._24bit.begin: |
mov ax, word[bpl] |
._24bit.decode: |
call get_byte |
call pcx._.get_byte |
._24bit.write_sequence: |
mov [edi], dl |
dec ax |
207,7 → 207,7 |
.indexed.begin: |
mov ax, word[bpl] |
.indexed.decode: |
call get_byte |
call pcx._.get_byte |
.indexed.write_sequence: |
mov [edi], dl |
inc edi |
256,7 → 256,7 |
mov ax, [xsize] |
.monochrome.decode: |
call get_byte |
call pcx._.get_byte |
.monochrome.write_sequence: |
mov [edi], dl |
inc edi |
270,7 → 270,7 |
.monochrome.is_last_byte_in_line: |
test ebx, ebx |
jng @f |
call get_byte |
call pcx._.get_byte |
jmp .monochrome.is_last_byte_in_line |
@@: |
dec word[ysize] |
282,11 → 282,9 |
popa |
mov eax, [retvalue] |
ret |
endp |
;;================================================================================================;; |
proc img.encode.pcx _img, _p_length, _options ;///////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
309,7 → 307,7 |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
proc get_byte |
proc pcx._.get_byte |
mov dh, byte[esi] |
inc esi |
325,9 → 323,10 |
.exit1: |
movzx ecx, dh |
sub ebx, ecx |
ret |
endp |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
335,5 → 334,3 |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
; |
/programs/develop/libraries/libs-dev/libimg/pcx/pcx.inc |
---|
1,5 → 1,5 |
;;================================================================================================;; |
;;//// pcx.inc //// (c) dunkaist, 2010 ///////////////////////////////////////////////////////////;; |
;;//// pcx.inc //// (c) dunkaist, 2010,2012 //////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;; ;; |
;; This file is part of Common development libraries (Libs-Dev). ;; |
/programs/develop/libraries/libs-dev/libimg/pnm/pbm.asm |
---|
0,0 → 1,54 |
.pbm: |
stdcall img.create, [width], [height], Image.bpp1 |
test eax, eax |
jz .quit |
mov [retvalue], eax |
mov ebx, eax |
mov edi, [ebx+Image.Palette] |
mov [edi], dword 0x00ffffff |
mov [edi + 4], dword 0x00000000 |
cmp [data_type], PNM_ASCII |
je .pbm.ascii |
.pbm.raw: |
mov ecx, [ebx+Image.Width] |
add ecx, 7 |
shr ecx, 3 |
imul ecx, [ebx+Image.Height] |
mov edi, [ebx+Image.Data] |
rep movsb |
jmp .quit |
.pbm.ascii: |
mov edi, [ebx+Image.Data] |
.pbm.next_line: |
mov edx, [width] |
mov ecx, 7 |
xor eax, eax |
.pbm.next_char: |
lodsb |
cmp al, ' ' |
jna .pbm.next_char |
.pbm.get_number: |
cmp al, '1' |
sete bl |
shl bl, cl |
or ah, bl |
dec ecx |
jns @f |
shr eax, 8 |
stosb |
mov ecx, 7 |
@@: |
dec edx |
jnz .pbm.next_char |
test byte[width], 0x07 |
jz @f |
shr eax, 8 |
stosb |
@@: |
dec [height] |
jnz .pbm.next_line |
jmp .quit |
/programs/develop/libraries/libs-dev/libimg/pnm/pgm.asm |
---|
0,0 → 1,72 |
.pgm: |
stdcall img.create, [width], [height], Image.bpp8 |
test eax, eax |
jz .quit |
mov [retvalue], eax |
mov ebx, eax |
mov edi, [ebx+Image.Palette] |
mov eax, 0xff000000 |
@@: |
stosd |
add eax, 0x00010101 |
jnc @b |
mov edi, [ebx+Image.Data] |
mov ecx, [ebx+Image.Width] |
imul ecx, [ebx+Image.Height] |
cmp [data_type], PNM_ASCII |
je .pgm.ascii |
.pgm.raw: |
cmp [maxval], 0xff |
jne .pgm.raw.scale |
rep movsb |
jmp .quit |
.pgm.raw.scale: |
mov edx, [maxval] |
mov eax, 0 |
@@: |
lodsb |
mov ebx, eax |
shl eax, 8 |
sub eax, ebx |
div dl |
stosb |
dec ecx |
jnz @b |
jmp .quit |
.pgm.ascii: |
xor eax, eax |
cmp [maxval], 0xff |
jne .pgm.ascii.scale |
.pgm.ascii.next_char: |
lodsb |
cmp al, ' ' |
jna .pgm.ascii.next_char |
call pnm._.get_number |
mov eax, ebx |
stosb |
dec ecx |
jnz .pgm.ascii.next_char |
jmp .quit |
.pgm.ascii.scale: |
mov edx, [maxval] |
.pgm.ascii.scale.next_char: |
lodsb |
cmp al, ' ' |
jna .pgm.ascii.scale.next_char |
call pnm._.get_number |
mov eax, ebx |
shl eax, 8 |
sub eax, ebx |
div dl |
stosb |
dec ecx |
jnz .pgm.ascii.scale.next_char |
jmp .quit |
/programs/develop/libraries/libs-dev/libimg/pnm/pnm.asm |
---|
0,0 → 1,230 |
;;================================================================================================;; |
;;//// pnm.asm //// (c) dunkaist, 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/>. ;; |
;; ;; |
;;================================================================================================;; |
include 'pnm.inc' |
;;================================================================================================;; |
proc img.is.pnm _data, _length ;//////////////////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? Determine if raw data could be decoded (is in pnm format) ;; |
;;------------------------------------------------------------------------------------------------;; |
;> _data = raw data as read from file/stream ;; |
;> _length = data length ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = false / true ;; |
;;================================================================================================;; |
xor eax, eax |
mov ecx, [_data] |
mov cx, word[ecx] |
xchg cl, ch |
cmp cx, '1P' |
jb .is_not_pnm |
cmp cx, '6P' |
ja .is_not_pnm |
.is_pnm: |
inc eax |
.is_not_pnm: |
ret |
endp |
;;================================================================================================;; |
proc img.decode.pnm _data, _length, _options ;////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? Decode data into image if it contains correctly formed raw data in pnm format ;; |
;;------------------------------------------------------------------------------------------------;; |
;> _data = raw data as read from file/stream ;; |
;> _length = data length ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = 0 (error) or pointer to image ;; |
;;================================================================================================;; |
locals |
width rd 1 |
height rd 1 |
pnm_type rd 1 |
data_type rd 1 ; raw or ascii |
maxval rd 1 |
retvalue rd 1 |
endl |
pusha |
mov esi, [_data] |
lodsw |
cmp ax, 'P1' |
jne @f |
mov [pnm_type], PNM_PBM |
mov [data_type], PNM_ASCII |
jmp .parse_header |
@@: |
cmp ax, 'P2' |
jne @f |
mov [pnm_type], PNM_PGM |
mov [data_type], PNM_ASCII |
jmp .parse_header |
@@: |
cmp ax, 'P3' |
jne @f |
mov [pnm_type], PNM_PPM |
mov [data_type], PNM_ASCII |
jmp .parse_header |
@@: |
cmp ax, 'P4' |
jne @f |
mov [pnm_type], PNM_PBM |
mov [data_type], PNM_RAW |
jmp .parse_header |
@@: |
cmp ax, 'P5' |
jne @f |
mov [pnm_type], PNM_PGM |
mov [data_type], PNM_RAW |
jmp .parse_header |
@@: |
cmp ax, 'P6' |
jne @f |
mov [pnm_type], PNM_PPM |
mov [data_type], PNM_RAW |
jmp .parse_header |
@@: |
.parse_header: |
xor eax, eax |
mov [width], eax |
mov [height], eax |
mov [maxval], eax |
.next_char: |
lodsb |
cmp al, '#' |
jb .next_char |
ja .read_number |
.comment: |
mov edi, esi |
mov al, 0x0A |
mov ecx, edi |
sub ecx, [_data] |
neg ecx |
add ecx, [_length] |
repne scasb |
mov esi, edi |
jmp .next_char |
.read_number: |
sub eax, 0x30 |
mov ebx, eax |
@@: |
lodsb |
cmp al, '0' |
jb .number_done |
sub eax, 0x30 |
imul ebx, 10 |
add ebx, eax |
jmp @b |
.number_done: |
cmp [width], 0 |
jne @f |
mov [width], ebx |
jmp .next_char |
@@: |
cmp [height], 0 |
jne @f |
mov [height], ebx |
cmp [pnm_type], PNM_PBM |
je .header_parsed |
jmp .next_char |
@@: |
mov [maxval], ebx |
.header_parsed: |
mov eax, [pnm_type] |
cmp eax, PNM_PBM |
je .pbm |
cmp eax, PNM_PGM |
je .pgm |
cmp eax, PNM_PPM |
je .ppm |
jmp .quit |
include 'pbm.asm' |
include 'pgm.asm' |
include 'ppm.asm' |
.quit: |
popa |
mov eax, [retvalue] |
ret |
endp |
;;================================================================================================;; |
proc img.encode.pnm _img, _p_length, _options ;///////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? Encode image into raw data in pnm format ;; |
;;------------------------------------------------------------------------------------------------;; |
;> _img = pointer to image ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = 0 (error) or pointer to encoded data ;; |
;< _p_length = encoded data length ;; |
;;================================================================================================;; |
xor eax, eax |
ret |
endp |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;! Below are private procs you should never call directly from your code ;; |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
proc pnm._.get_number |
sub eax, '0' |
mov ebx, eax |
@@: |
lodsb |
cmp al, '0' |
jb .quit |
sub eax, '0' |
lea eax, [ebx*8 + eax] |
lea ebx, [ebx*2 + eax] |
; imul ebx, 10 |
; add ebx, eax |
jmp @b |
.quit: |
ret |
endp |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;! Below is private data you should never use directly from your code ;; |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
/programs/develop/libraries/libs-dev/libimg/pnm/pnm.inc |
---|
0,0 → 1,26 |
;;================================================================================================;; |
;;//// pnm.inc //// (c) dunkaist, 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/>. ;; |
;; ;; |
;;================================================================================================;; |
PNM_RAW = 0 |
PNM_ASCII = 1 |
PNM_PBM = 0 |
PNM_PGM = 1 |
PNM_PPM = 2 |
/programs/develop/libraries/libs-dev/libimg/pnm/ppm.asm |
---|
0,0 → 1,117 |
.ppm: |
stdcall img.create, [width], [height], Image.bpp24 |
test eax, eax |
jz .quit |
mov [retvalue], eax |
mov ebx, eax |
mov edi, [ebx + Image.Data] |
mov ecx, [ebx + Image.Width] |
imul ecx, [ebx + Image.Height] |
cmp [data_type], PNM_ASCII |
je .ppm.ascii |
.ppm.raw: |
cmp [maxval], 0xff |
jne .ppm.raw.scale |
@@: |
lodsw |
xchg al, ah |
movsb |
stosw |
dec ecx |
jnz @b |
jmp .quit |
.ppm.raw.scale: |
mov edx, [maxval] |
xor eax, eax |
@@: |
lodsb |
mov ebx, eax |
shl eax, 8 |
sub eax, ebx |
div dl |
stosb |
lodsb |
mov ebx, eax |
shl eax, 8 |
sub eax, ebx |
div dl |
stosb |
lodsb |
mov ebx, eax |
shl eax, 8 |
sub eax, ebx |
div dl |
stosb |
dec ecx |
jnz @b |
jmp .quit |
.ppm.ascii: |
xor eax, eax |
cmp [maxval], 0xff |
jne .ppm.ascii.scale |
.ppm.ascii.next_char: |
@@: |
lodsb |
cmp al, ' ' |
jna @b |
call pnm._.get_number |
mov [edi + 2], bl |
@@: |
lodsb |
cmp al, ' ' |
jna @b |
call pnm._.get_number |
mov [edi + 1], bl |
@@: |
lodsb |
cmp al, ' ' |
jna @b |
call pnm._.get_number |
mov [edi + 0], bl |
add edi, 3 |
dec ecx |
jnz .ppm.ascii.next_char |
jmp .quit |
.ppm.ascii.scale: |
mov edx, [maxval] |
.ppm.ascii.scale.next_char: |
@@: |
lodsb |
cmp al, ' ' |
jna @b |
call pnm._.get_number |
mov eax, ebx |
shl eax, 8 |
sub eax, ebx |
div dl |
mov [edi + 2], al |
@@: |
lodsb |
cmp al, ' ' |
jna @b |
call pnm._.get_number |
mov eax, ebx |
shl eax, 8 |
sub eax, ebx |
div dl |
mov [edi + 1], al |
@@: |
lodsb |
cmp al, ' ' |
jna @b |
call pnm._.get_number |
mov eax, ebx |
shl eax, 8 |
sub eax, ebx |
div dl |
mov [edi + 0], al |
add edi, 3 |
dec ecx |
jnz .ppm.ascii.next_char |
jmp .quit |
/programs/develop/libraries/libs-dev/libimg/tiff/huffman.asm |
---|
0,0 → 1,430 |
tiff._.huffman_tree_white.begin: |
dd 0x00000000, .0 |
.1 dd 0x00000000, .10 |
.11 dd 0x00000000, .110 |
.111 dd 0x00000000, .1110 |
.1111 dd 0x80000000 + 7 |
.1110 dd 0x80000000 + 6 |
.110 dd 0x00000000, .1100 |
.1101 dd 0x00000000, .11010 |
.11011 dd 0x80000000 + 64 |
.11010 dd 0x00000000, .110100 |
.110101 dd 0x80000000 + 15 |
.110100 dd 0x80000000 + 14 |
.1100 dd 0x80000000 + 5 |
.10 dd 0x00000000, .100 |
.101 dd 0x00000000, .1010 |
.1011 dd 0x80000000 + 4 |
.1010 dd 0x00000000, .10100 |
.10101 dd 0x00000000, .101010 |
.101011 dd 0x80000000 + 17 |
.101010 dd 0x80000000 + 16 |
.10100 dd 0x80000000 + 9 |
.100 dd 0x00000000, .1000 |
.1001 dd 0x00000000, .10010 |
.10011 dd 0x80000000 + 8 |
.10010 dd 0x80000000 + 128 |
.1000 dd 0x80000000 + 3 |
.0 dd 0x00000000, .00 |
.01 dd 0x00000000, .010 |
.011 dd 0x00000000, .0110 |
.0111 dd 0x80000000 + 2 |
.0110 dd 0x00000000, .01100 |
.01101 dd 0x00000000, .011010 |
.011011 dd 0x00000000, .0110110 |
.0110111 dd 0x80000000 + 256 |
.0110110 dd 0x00000000, .01101100 |
.01101101 dd 0x00000000, .011011010 |
.011011011 dd 0x80000000 + 1408 |
.011011010 dd 0x80000000 + 1344 |
.01101100 dd 0x00000000, .011011000 |
.011011001 dd 0x80000000 + 1280 |
.011011000 dd 0x80000000 + 1216 |
.011010 dd 0x00000000, .0110100 |
.0110101 dd 0x00000000, .01101010 |
.01101011 dd 0x00000000, .011010110 |
.011010111 dd 0x80000000 + 1152 |
.011010110 dd 0x80000000 + 1088 |
.01101010 dd 0x00000000, .011010100 |
.011010101 dd 0x80000000 + 1024 |
.011010100 dd 0x80000000 + 960 |
.0110100 dd 0x00000000, .01101000 |
.01101001 dd 0x00000000, .011010010 |
.011010011 dd 0x80000000 + 896 |
.011010010 dd 0x80000000 + 832 |
.01101000 dd 0x80000000 + 576 |
.01100 dd 0x00000000, .011000 |
.011001 dd 0x00000000, .0110010 |
.0110011 dd 0x00000000, .01100110 |
.01100111 dd 0x80000000 + 640 |
.01100110 dd 0x00000000, .011001100 |
.011001101 dd 0x80000000 + 768 |
.011001100 dd 0x80000000 + 704 |
.0110010 dd 0x00000000, .01100100 |
.01100101 dd 0x80000000 + 512 |
.01100100 dd 0x80000000 + 448 |
.011000 dd 0x80000000 + 1664 |
.010 dd 0x00000000, .0100 |
.0101 dd 0x00000000, .01010 |
.01011 dd 0x00000000, .010110 |
.010111 dd 0x80000000 + 192 |
.010110 dd 0x00000000, .0101100 |
.0101101 dd 0x00000000, .01011010 |
.01011011 dd 0x80000000 + 58 |
.01011010 dd 0x80000000 + 57 |
.0101100 dd 0x00000000, .01011000 |
.01011001 dd 0x80000000 + 56 |
.01011000 dd 0x80000000 + 55 |
.01010 dd 0x00000000, .010100 |
.010101 dd 0x00000000, .0101010 |
.0101011 dd 0x80000000 + 25 |
.0101010 dd 0x00000000, .01010100 |
.01010101 dd 0x80000000 + 52 |
.01010100 dd 0x80000000 + 51 |
.010100 dd 0x00000000, .0101000 |
.0101001 dd 0x00000000, .01010010 |
.01010011 dd 0x80000000 + 50 |
.01010010 dd 0x80000000 + 49 |
.0101000 dd 0x80000000 + 24 |
.0100 dd 0x00000000, .01000 |
.01001 dd 0x00000000, .010010 |
.010011 dd 0x00000000, .0100110 |
.0100111 dd 0x80000000 + 18 |
.0100110 dd 0x00000000, .01001100 |
.01001101 dd 0x00000000, .010011010 |
.010011011 dd 0x80000000 + 1728 |
.010011010 dd 0x80000000 + 1600 |
.01001100 dd 0x00000000, .010011000 |
.010011001 dd 0x80000000 + 1536 |
.010011000 dd 0x80000000 + 1472 |
.010010 dd 0x00000000, .0100100 |
.0100101 dd 0x00000000, .01001010 |
.01001011 dd 0x80000000 + 60 |
.01001010 dd 0x80000000 + 59 |
.0100100 dd 0x80000000 + 27 |
.01000 dd 0x80000000 + 11 |
.00 dd 0x00000000, .000 |
.001 dd 0x00000000, .0010 |
.0011 dd 0x00000000, .00110 |
.00111 dd 0x80000000 + 10 |
.00110 dd 0x00000000, .001100 |
.001101 dd 0x00000000, .0011010 |
.0011011 dd 0x00000000, .00110110 |
.00110111 dd 0x80000000 + 384 |
.00110110 dd 0x80000000 + 320 |
.0011010 dd 0x00000000, .00110100 |
.00110101 dd 0x80000000 + 0 |
.00110100 dd 0x80000000 + 63 |
.001100 dd 0x00000000, .0011000 |
.0011001 dd 0x00000000, .00110010 |
.00110011 dd 0x80000000 + 62 |
.00110010 dd 0x80000000 + 61 |
.0011000 dd 0x80000000 + 28 |
.0010 dd 0x00000000, .00100 |
.00101 dd 0x00000000, .001010 |
.001011 dd 0x00000000, .0010110 |
.0010111 dd 0x80000000 + 21 |
.0010110 dd 0x00000000, .00101100 |
.00101101 dd 0x80000000 + 44 |
.00101100 dd 0x80000000 + 43 |
.001010 dd 0x00000000, .0010100 |
.0010101 dd 0x00000000, .00101010 |
.00101011 dd 0x80000000 + 42 |
.00101010 dd 0x80000000 + 41 |
.0010100 dd 0x00000000, .00101000 |
.00101001 dd 0x80000000 + 40 |
.00101000 dd 0x80000000 + 39 |
.00100 dd 0x00000000, .001000 |
.001001 dd 0x00000000, .0010010 |
.0010011 dd 0x80000000 + 26 |
.0010010 dd 0x00000000, .00100100 |
.00100101 dd 0x80000000 + 54 |
.00100100 dd 0x80000000 + 53 |
.001000 dd 0x80000000 + 12 |
.000 dd 0x00000000, .0000 |
.0001 dd 0x00000000, .00010 |
.00011 dd 0x00000000, .000110 |
.000111 dd 0x80000000 + 1 |
.000110 dd 0x00000000, .0001100 |
.0001101 dd 0x00000000, .00011010 |
.00011011 dd 0x80000000 + 32 |
.00011010 dd 0x80000000 + 31 |
.0001100 dd 0x80000000 + 19 |
.00010 dd 0x00000000, .000100 |
.000101 dd 0x00000000, .0001010 |
.0001011 dd 0x00000000, .00010110 |
.00010111 dd 0x80000000 + 38 |
.00010110 dd 0x80000000 + 37 |
.0001010 dd 0x00000000, .00010100 |
.00010101 dd 0x80000000 + 36 |
.00010100 dd 0x80000000 + 35 |
.000100 dd 0x00000000, .0001000 |
.0001001 dd 0x00000000, .00010010 |
.00010011 dd 0x80000000 + 34 |
.00010010 dd 0x80000000 + 33 |
.0001000 dd 0x80000000 + 20 |
.0000 dd 0x00000000, .00000 |
.00001 dd 0x00000000, .000010 |
.000011 dd 0x80000000 + 13 |
.000010 dd 0x00000000, .0000100 |
.0000101 dd 0x00000000, .00001010 |
.00001011 dd 0x80000000 + 48 |
.00001010 dd 0x80000000 + 47 |
.0000100 dd 0x80000000 + 23 |
.00000 dd 0x00000000, .000000 |
.000001 dd 0x00000000, .0000010 |
.0000011 dd 0x80000000 + 22 |
.0000010 dd 0x00000000, .00000100 |
.00000101 dd 0x80000000 + 46 |
.00000100 dd 0x80000000 + 45 |
.000000 dd 0x00000000, .0000000 |
.0000001 dd 0x00000000, .00000010 |
.00000011 dd 0x80000000 + 30 |
.00000010 dd 0x80000000 + 29 |
.0000000 dd 0x00000000, .00000000 |
.00000001 dd 0x00000000, .000000010 |
.000000011 dd 0x00000000, .0000000110 |
.0000000111 dd 0x00000000, .00000001110 |
.00000001111 dd 0x00000000, .000000011110 |
.000000011111 dd 0x80000000 + 2560 |
.000000011110 dd 0x80000000 + 2496 |
.00000001110 dd 0x00000000, .000000011100 |
.000000011101 dd 0x80000000 + 2432 |
.000000011100 dd 0x80000000 + 2368 |
.0000000110 dd 0x00000000, .00000001100 |
.00000001101 dd 0x80000000 + 1920 |
.00000001100 dd 0x80000000 + 1856 |
.000000010 dd 0x00000000, .0000000100 |
.0000000101 dd 0x00000000, .00000001010 |
.00000001011 dd 0x00000000, .000000010110 |
.000000010111 dd 0x80000000 + 2304 |
.000000010110 dd 0x80000000 + 2240 |
.00000001010 dd 0x00000000, .000000010100 |
.000000010101 dd 0x80000000 + 2176 |
.000000010100 dd 0x80000000 + 2112 |
.0000000100 dd 0x00000000, .00000001000 |
.00000001001 dd 0x00000000, .000000010010 |
.000000010011 dd 0x80000000 + 2048 |
.000000010010 dd 0x80000000 + 1984 |
.00000001000 dd 0x80000000 + 1792 |
.00000000 dd 0x00000010, .000000000 |
.000000000 dd 0x00000010, .0000000000 |
.0000000000 dd 0x00000010, .00000000000 |
.00000000000 dd 0x00000011, .000000000001 |
.000000000001 dd 0x80000000 + 0xffff |
tiff._.huffman_tree_white.end: |
tiff._.huffman_tree_black.begin: |
dd 0x00000000, .0 |
.1 dd 0x00000000, .10 |
.11 dd 0x80000000 + 2 |
.10 dd 0x80000000 + 3 |
.0 dd 0x00000000, .00 |
.01 dd 0x00000000, .010 |
.011 dd 0x80000000 + 4 |
.010 dd 0x80000000 + 1 |
.00 dd 0x00000000, .000 |
.001 dd 0x00000000, .0010 |
.0011 dd 0x80000000 + 5 |
.0010 dd 0x80000000 + 6 |
.000 dd 0x00000000, .0000 |
.0001 dd 0x00000000, .00010 |
.00011 dd 0x80000000 + 7 |
.00010 dd 0x00000000, .000100 |
.000101 dd 0x80000000 + 8 |
.000100 dd 0x80000000 + 9 |
.0000 dd 0x00000000, .00000 |
.00001 dd 0x00000000, .000010 |
.000011 dd 0x00000000, .0000110 |
.0000111 dd 0x80000000 + 12 |
.0000110 dd 0x00000000, .00001100 |
.00001101 dd 0x00000000, .000011010 |
.000011011 dd 0x00000000, .0000110110 |
.0000110111 dd 0x80000000 + 0 |
.0000110110 dd 0x00000000, .00001101100 |
.00001101101 dd 0x00000000, .000011011010 |
.000011011011 dd 0x80000000 + 43 |
.000011011010 dd 0x80000000 + 42 |
.00001101100 dd 0x80000000 + 21 |
.000011010 dd 0x00000000, .0000110100 |
.0000110101 dd 0x00000000, .00001101010 |
.00001101011 dd 0x00000000, .000011010110 |
.000011010111 dd 0x80000000 + 39 |
.000011010110 dd 0x80000000 + 38 |
.00001101010 dd 0x00000000, .000011010100 |
.000011010101 dd 0x80000000 + 37 |
.000011010100 dd 0x80000000 + 36 |
.0000110100 dd 0x00000000, .00001101000 |
.00001101001 dd 0x00000000, .000011010010 |
.000011010011 dd 0x80000000 + 35 |
.000011010010 dd 0x80000000 + 34 |
.00001101000 dd 0x80000000 + 20 |
.00001100 dd 0x00000000, .000011000 |
.000011001 dd 0x00000000, .0000110010 |
.0000110011 dd 0x00000000, .00001100110 |
.00001100111 dd 0x80000000 + 19 |
.00001100110 dd 0x00000000, .000011001100 |
.000011001101 dd 0x80000000 + 29 |
.000011001100 dd 0x80000000 + 28 |
.0000110010 dd 0x00000000, .00001100100 |
.00001100101 dd 0x00000000, .000011001010 |
.000011001011 dd 0x80000000 + 27 |
.000011001010 dd 0x80000000 + 26 |
.00001100100 dd 0x00000000, .000011001000 |
.000011001001 dd 0x80000000 + 192 |
.000011001000 dd 0x80000000 + 128 |
.000011000 dd 0x80000000 + 15 |
.000010 dd 0x00000000, .0000100 |
.0000101 dd 0x80000000 + 11 |
.0000100 dd 0x80000000 + 10 |
.00000 dd 0x00000000, .000000 |
.000001 dd 0x00000000, .0000010 |
.0000011 dd 0x00000000, .00000110 |
.00000111 dd 0x80000000 + 14 |
.00000110 dd 0x00000000, .000001100 |
.000001101 dd 0x00000000, .0000011010 |
.0000011011 dd 0x00000000, .00000110110 |
.00000110111 dd 0x80000000 + 22 |
.00000110110 dd 0x00000000, .000001101100 |
.000001101101 dd 0x80000000 + 41 |
.000001101100 dd 0x80000000 + 40 |
.0000011010 dd 0x00000000, .00000110100 |
.00000110101 dd 0x00000000, .000001101010 |
.000001101011 dd 0x80000000 + 33 |
.000001101010 dd 0x80000000 + 32 |
.00000110100 dd 0x00000000, .000001101000 |
.000001101001 dd 0x80000000 + 31 |
.000001101000 dd 0x80000000 + 30 |
.000001100 dd 0x00000000, .0000011000 |
.0000011001 dd 0x00000000, .00000110010 |
.00000110011 dd 0x00000000, .000001100110 |
.000001100111 dd 0x80000000 + 63 |
.000001100110 dd 0x80000000 + 62 |
.00000110010 dd 0x00000000, .000001100100 |
.000001100101 dd 0x80000000 + 49 |
.000001100100 dd 0x80000000 + 48 |
.0000011000 dd 0x80000000 + 17 |
.0000010 dd 0x00000000, .00000100 |
.00000101 dd 0x00000000, .000001010 |
.000001011 dd 0x00000000, .0000010110 |
.0000010111 dd 0x80000000 + 16 |
.0000010110 dd 0x00000000, .00000101100 |
.00000101101 dd 0x00000000, .000001011010 |
.000001011011 dd 0x80000000 + 256 |
.000001011010 dd 0x80000000 + 61 |
.00000101100 dd 0x00000000, .000001011000 |
.000001011001 dd 0x80000000 + 58 |
.000001011000 dd 0x80000000 + 57 |
.000001010 dd 0x00000000, .0000010100 |
.0000010101 dd 0x00000000, .00000101010 |
.00000101011 dd 0x00000000, .000001010110 |
.000001010111 dd 0x80000000 + 47 |
.000001010110 dd 0x80000000 + 46 |
.00000101010 dd 0x00000000, .000001010100 |
.000001010101 dd 0x80000000 + 45 |
.000001010100 dd 0x80000000 + 44 |
.0000010100 dd 0x00000000, .00000101000 |
.00000101001 dd 0x00000000, .000001010010 |
.000001010011 dd 0x80000000 + 51 |
.000001010010 dd 0x80000000 + 50 |
.00000101000 dd 0x80000000 + 23 |
.00000100 dd 0x80000000 + 13 |
.000000 dd 0x00000000, .0000000 |
.0000001 dd 0x00000000, .00000010 |
.00000011 dd 0x00000000, .000000110 |
.000000111 dd 0x00000000, .0000001110 |
.0000001111 dd 0x80000000 + 64 |
.0000001110 dd 0x00000000, .00000011100 |
.00000011101 dd 0x00000000, .000000111010 |
.000000111011 dd 0x00000000, .0000001110110 |
.0000001110111 dd 0x80000000 + 1216 |
.0000001110110 dd 0x80000000 + 1152 |
.000000111010 dd 0x00000000, .0000001110100 |
.0000001110101 dd 0x80000000 + 1088 |
.0000001110100 dd 0x80000000 + 1024 |
.00000011100 dd 0x00000000, .000000111000 |
.000000111001 dd 0x00000000, .0000001110010 |
.0000001110011 dd 0x80000000 + 960 |
.0000001110010 dd 0x80000000 + 896 |
.000000111000 dd 0x80000000 + 54 |
.000000110 dd 0x00000000, .0000001100 |
.0000001101 dd 0x00000000, .00000011010 |
.00000011011 dd 0x00000000, .000000110110 |
.000000110111 dd 0x80000000 + 53 |
.000000110110 dd 0x00000000, .0000001101100 |
.0000001101101 dd 0x80000000 + 576 |
.0000001101100 dd 0x80000000 + 512 |
.00000011010 dd 0x00000000, .000000110100 |
.000000110101 dd 0x80000000 + 448 |
.000000110100 dd 0x80000000 + 384 |
.0000001100 dd 0x00000000, .00000011000 |
.00000011001 dd 0x00000000, .000000110010 |
.000000110011 dd 0x80000000 + 320 |
.000000110010 dd 0x00000000, .0000001100100 |
.0000001100101 dd 0x80000000 + 1728 |
.0000001100100 dd 0x80000000 + 1664 |
.00000011000 dd 0x80000000 + 25 |
.00000010 dd 0x00000000, .000000100 |
.000000101 dd 0x00000000, .0000001010 |
.0000001011 dd 0x00000000, .00000010110 |
.00000010111 dd 0x80000000 + 24 |
.00000010110 dd 0x00000000, .000000101100 |
.000000101101 dd 0x00000000, .0000001011010 |
.0000001011011 dd 0x80000000 + 1600 |
.0000001011010 dd 0x80000000 + 1536 |
.000000101100 dd 0x80000000 + 60 |
.0000001010 dd 0x00000000, .00000010100 |
.00000010101 dd 0x00000000, .000000101010 |
.000000101011 dd 0x80000000 + 59 |
.000000101010 dd 0x00000000, .0000001010100 |
.0000001010101 dd 0x80000000 + 1472 |
.0000001010100 dd 0x80000000 + 1408 |
.00000010100 dd 0x00000000, .000000101000 |
.000000101001 dd 0x00000000, .0000001010010 |
.0000001010011 dd 0x80000000 + 1344 |
.0000001010010 dd 0x80000000 + 1280 |
.000000101000 dd 0x80000000 + 56 |
.000000100 dd 0x00000000, .0000001000 |
.0000001001 dd 0x00000000, .00000010010 |
.00000010011 dd 0x00000000, .000000100110 |
.000000100111 dd 0x80000000 + 55 |
.000000100110 dd 0x00000000, .0000001001100 |
.0000001001101 dd 0x80000000 + 832 |
.0000001001100 dd 0x80000000 + 768 |
.00000010010 dd 0x00000000, .000000100100 |
.000000100101 dd 0x00000000, .0000001001010 |
.0000001001011 dd 0x80000000 + 704 |
.0000001001010 dd 0x80000000 + 640 |
.000000100100 dd 0x80000000 + 52 |
.0000001000 dd 0x80000000 + 18 |
.0000000 dd 0x00000000, .00000000 |
.00000001 dd 0x00000000, .000000010 |
.000000011 dd 0x00000000, .0000000110 |
.0000000111 dd 0x00000000, .00000001110 |
.00000001111 dd 0x00000000, .000000011110 |
.000000011111 dd 0x80000000 + 2560 |
.000000011110 dd 0x80000000 + 2496 |
.00000001110 dd 0x00000000, .000000011100 |
.000000011101 dd 0x80000000 + 2432 |
.000000011100 dd 0x80000000 + 2368 |
.0000000110 dd 0x00000000, .00000001100 |
.00000001101 dd 0x80000000 + 1920 |
.00000001100 dd 0x80000000 + 1856 |
.000000010 dd 0x00000000, .0000000100 |
.0000000101 dd 0x00000000, .00000001010 |
.00000001011 dd 0x00000000, .000000010110 |
.000000010111 dd 0x80000000 + 2304 |
.000000010110 dd 0x80000000 + 2240 |
.00000001010 dd 0x00000000, .000000010100 |
.000000010101 dd 0x80000000 + 2176 |
.000000010100 dd 0x80000000 + 2112 |
.0000000100 dd 0x00000000, .00000001000 |
.00000001001 dd 0x00000000, .000000010010 |
.000000010011 dd 0x80000000 + 2048 |
.000000010010 dd 0x80000000 + 1984 |
.00000001000 dd 0x80000000 + 1792 |
.00000000 dd 0x00000010, .000000000 |
.000000000 dd 0x00000010, .0000000000 |
.0000000000 dd 0x00000010, .00000000000 |
.00000000000 dd 0x80000000 + 0xffff |
tiff._.huffman_tree_black.end: |
/programs/develop/libraries/libs-dev/libimg/tiff/tiff.asm |
---|
0,0 → 1,853 |
;;================================================================================================;; |
;;//// tiff.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/>. ;; |
;; ;; |
;;================================================================================================;; |
include 'tiff.inc' |
;include '../../../../../system/board/trunk/debug.inc' |
;;================================================================================================;; |
proc img.is.tiff _data, _length ;/////////////////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? Determine if raw data could be decoded (is in tiff format) ;; |
;;------------------------------------------------------------------------------------------------;; |
;> _data = raw data as read from file/stream ;; |
;> _length = data length ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = false / true ;; |
;;================================================================================================;; |
push esi |
mov esi, [_data] |
lodsw |
cmp ax, word 'II' |
je .little_endian |
cmp ax, word 'MM' |
je .big_endian |
jmp .is_not_tiff |
.little_endian: |
lodsw |
cmp ax, 0x002A |
je .is_tiff |
jmp .is_not_tiff |
.big_endian: |
lodsw |
cmp ax, 0x2A00 |
je .is_tiff |
.is_not_tiff: |
pop esi |
xor eax, eax |
ret |
.is_tiff: |
pop esi |
xor eax, eax |
inc eax |
ret |
endp |
;;================================================================================================;; |
proc img.decode.tiff _data, _length, _options ;///////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? Decode data into image if it contains correctly formed raw data in tiff format ;; |
;;------------------------------------------------------------------------------------------------;; |
;> _data = raw data as read from file/stream ;; |
;> _length = data length ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = 0 (error) or pointer to image ;; |
;;================================================================================================;; |
locals |
_endianness rd 1 ; 0 stands for LE, otherwise BE |
retvalue rd 1 ; 0 (error) or pointer to image |
endl |
push ebx edx esi edi |
mov esi, [_data] |
lodsw |
mov [_endianness], 0 |
cmp ax, word 'II' |
seta byte[_endianness] |
lodsw_ |
lodsd_ |
@@: |
stdcall tiff._.parse_IFD, [_data], eax, [_endianness] |
mov ebx, eax |
mov [retvalue], eax |
lodsd_ |
test eax, eax |
; jnz @b |
.quit: |
mov eax, [retvalue] |
pop edi esi edx ebx |
ret |
endp |
;;================================================================================================;; |
proc img.encode.tiff _img, _p_length, _options ;//////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? Encode image into raw data in tiff format ;; |
;;------------------------------------------------------------------------------------------------;; |
;> _img = pointer to image ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = 0 (error) or pointer to encoded data ;; |
;< _p_length = encoded data length ;; |
;;================================================================================================;; |
xor eax, eax |
ret |
endp |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;! Below are private procs you should never call directly from your code ;; |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
proc tiff._.parse_IFD _data, _IFD, _endianness |
locals |
extended rd 1 |
retvalue rd 1 |
decompress rd 1 |
endl |
push ebx edx edi |
mov [retvalue], 0 |
invoke mem.alloc, sizeof.tiff_extra |
test eax, eax |
jz .quit |
mov [extended], eax |
mov ebx, eax |
mov edi, eax |
mov ecx, sizeof.tiff_extra/4 |
xor eax, eax |
rep stosd |
mov esi, [_IFD] |
add esi, [_data] |
lodsw_ |
movzx ecx, ax |
@@: |
push ecx |
stdcall tiff._.parse_IFDE, [_data], [_endianness] |
pop ecx |
dec ecx |
jnz @b |
call tiff._.define_image_type |
stdcall img.create, [ebx + tiff_extra.image_width], [ebx + tiff_extra.image_height], eax |
test eax, eax |
jz .quit |
mov [retvalue], eax |
mov edx, eax |
mov [edx + Image.Extended], ebx |
cmp [ebx+tiff_extra.compression], TIFF.COMPRESSION.UNCOMPRESSED |
jne @f |
mov [decompress], tiff._.decompress.uncompressed |
jmp .decompressor_defined |
@@: |
cmp [ebx + tiff_extra.compression], TIFF.COMPRESSION.PACKBITS |
jne @f |
mov [decompress], tiff._.decompress.packbits |
jmp .decompressor_defined |
@@: |
mov [decompress], tiff._.decompress.ccitt1d |
jmp .decompressor_defined |
jmp .quit |
.decompressor_defined: |
push esi ; fixme!! |
mov ecx, [edx + Image.Type] |
dec ecx |
jz .bpp8 |
dec ecx |
jz .bpp24 |
dec ecx |
jz .bpp32 |
dec ecx |
dec ecx ; tiff doesn't handle 15bpp images |
jz .bpp16 |
dec ecx |
jz .bpp1 |
dec ecx |
jz .bpp4 |
;error report!! |
.bpp1: |
.bpp1.palette: |
mov edi, [edx+Image.Palette] |
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.BLACK_IS_ZERO |
jne .bpp1.white_is_zero |
.bpp1.black_is_zero: |
mov [edi], dword 0x00000000 |
mov [edi + 4], dword 0x00ffffff |
jmp .common |
.bpp1.white_is_zero: |
mov [edi], dword 0x00ffffff |
mov [edi + 4], dword 0x00000000 |
jmp .common |
.bpp4: |
jmp .common |
.bpp8: |
cmp [ebx + tiff_extra.palette], 0 |
je .bpp8.grayscale |
mov esi, [ebx + tiff_extra.palette] |
mov ah, 2 |
.bpp8.channel: |
mov edi, eax |
and edi, 0x0000ff00 |
shr edi, 8 |
add edi, [edx + Image.Palette] |
mov ecx, 256 |
@@: |
lodsb |
stosb |
lodsb |
add edi, 3 |
dec ecx |
jnz @b |
dec ah |
jns .bpp8.channel |
jmp .common |
.bpp8.grayscale: |
mov edi, [edx + Image.Palette] |
mov eax, 0xff000000 |
@@: |
stosd |
add eax, 0x00010101 |
jnc @b |
jmp .common |
.bpp16: |
jmp .common |
.bpp24: |
jmp .common |
.bpp32: |
jmp .common |
.common: |
mov edi, [edx+Image.Data] |
mov esi, [ebx+tiff_extra.strip_offsets] |
mov edx, [ebx+tiff_extra.strip_byte_counts] |
cmp [ebx + tiff_extra.strip_offsets_length], TIFF.IFDE_TYPE_LENGTH.SHORT |
jne .l_x |
cmp [ebx + tiff_extra.strip_byte_counts_length], TIFF.IFDE_TYPE_LENGTH.SHORT |
jne .s_l |
jmp .s_s |
.l_x: cmp [ebx + tiff_extra.strip_byte_counts_length], TIFF.IFDE_TYPE_LENGTH.SHORT |
jne .l_l |
jmp .l_s |
.s_s: |
xor eax, eax |
lodsw_ |
push esi |
mov esi, eax |
add esi, [_data] |
xor ecx, ecx |
mov cx, word[edx] |
test [_endianness], 1 |
jz @f |
xchg cl, ch |
@@: |
add edx, 2 |
stdcall [decompress], [retvalue] |
pop esi |
dec [ebx + tiff_extra.offsets_number] |
jnz .s_s |
jmp .decoded |
.s_l: |
xor eax, eax |
lodsw_ |
push esi |
mov esi, eax |
add esi, [_data] |
mov ecx, [edx] |
test [_endianness], 1 |
jz @f |
bswap ecx |
@@: |
add edx, 4 |
stdcall [decompress], [retvalue] |
pop esi |
dec [ebx + tiff_extra.offsets_number] |
jnz .s_l |
jmp .decoded |
.l_s: |
lodsd_ |
push esi |
mov esi, eax |
add esi, [_data] |
xor ecx, ecx |
mov cx, word[edx] |
test [_endianness], 1 |
jz @f |
xchg cl, ch |
@@: |
add edx, 2 |
stdcall [decompress], [retvalue] |
pop esi |
dec [ebx + tiff_extra.offsets_number] |
jnz .l_s |
jmp .decoded |
.l_l: |
lodsd_ |
push esi |
mov esi, eax |
add esi, [_data] |
mov ecx, [edx] |
test [_endianness], 1 |
jz @f |
bswap ecx |
@@: |
add edx, 4 |
stdcall [decompress], [retvalue] |
pop esi |
dec [ebx + tiff_extra.offsets_number] |
jnz .l_l |
jmp .decoded |
.decoded: |
cmp [ebx + tiff_extra.samples_per_pixel], 3 |
jne .pop_quit |
mov eax, [retvalue] |
mov esi, [eax + Image.Data] |
mov edi, [eax + Image.Data] |
mov ecx, [eax + Image.Width] |
imul ecx, [eax + Image.Height] |
@@: |
lodsw |
movsb |
mov byte[esi - 1], al |
add edi, 2 |
dec ecx |
jnz @b |
.pop_quit: |
pop esi |
.quit: |
pop edi edx ebx |
mov eax, [retvalue] |
ret |
endp |
proc tiff._.parse_IFDE _data, _endianness |
push ebx edx edi |
lodsw_ |
mov edx, tiff.IFDE_tag_table.begin |
mov ecx, (tiff.IFDE_tag_table.end-tiff.IFDE_tag_table.begin)/8 |
.tag: |
cmp ax, word[edx] |
jne @f |
lodsw_ |
jmp dword[edx + 4] |
@@: |
add edx, 8 |
dec ecx |
jnz .tag |
.tag_default: ; unknown/unsupported/uninteresting/unimportant |
lodsw |
lodsd |
lodsd |
jmp .quit ; just skip it |
.tag_100: |
cmp ax, TIFF.IFDE_TYPE.SHORT |
jne @f |
lodsd |
xor eax, eax |
lodsw_ |
mov [ebx + tiff_extra.image_width], eax |
lodsw |
jmp .quit |
@@: |
cmp ax, TIFF.IFDE_TYPE.LONG |
jne @f |
lodsd |
lodsd_ |
mov [ebx + tiff_extra.image_width], eax |
jmp .quit |
@@: |
jmp .quit |
.tag_101: |
cmp ax, TIFF.IFDE_TYPE.SHORT |
jne @f |
lodsd |
xor eax, eax |
lodsw_ |
mov [ebx + tiff_extra.image_height], eax |
lodsw |
jmp .quit |
@@: |
cmp ax, TIFF.IFDE_TYPE.LONG |
jne @f |
lodsd |
lodsd_ |
mov [ebx + tiff_extra.image_height], eax |
jmp .quit |
@@: |
jmp .quit |
.tag_102: |
lodsd_ |
imul eax, TIFF.IFDE_TYPE_LENGTH.SHORT |
cmp eax, 4 |
ja @f |
xor eax, eax |
lodsw_ |
mov [ebx + tiff_extra.bits_per_sample], eax |
lodsw |
jmp .quit |
@@: |
lodsd_ |
add eax, [_data] |
push esi |
mov esi, eax |
xor eax, eax |
lodsw_ |
pop esi |
mov [ebx + tiff_extra.bits_per_sample], eax |
jmp .quit |
.tag_103: |
cmp ax, TIFF.IFDE_TYPE.SHORT |
jne @f |
lodsd |
xor eax, eax |
lodsw_ |
mov [ebx + tiff_extra.compression], eax |
lodsw |
jmp .quit |
@@: |
jmp .quit |
.tag_106: |
cmp ax, TIFF.IFDE_TYPE.SHORT |
jne @f |
lodsd |
xor eax, eax |
lodsw_ |
mov [ebx + tiff_extra.photometric], eax |
lodsw |
jmp .quit |
@@: |
jmp .quit |
.tag_111: |
cmp ax, TIFF.IFDE_TYPE.SHORT |
jne @f |
mov [ebx + tiff_extra.strip_offsets_length], TIFF.IFDE_TYPE_LENGTH.SHORT |
jmp .tag_111.common |
@@: |
mov [ebx + tiff_extra.strip_offsets_length], TIFF.IFDE_TYPE_LENGTH.LONG |
.tag_111.common: |
lodsd_ |
mov [ebx + tiff_extra.offsets_number], eax |
imul eax, [ebx+tiff_extra.strip_offsets_length] |
cmp eax, 4 |
ja @f |
mov [ebx + tiff_extra.strip_offsets], esi |
lodsd |
jmp .quit |
@@: |
lodsd_ |
add eax, [_data] |
mov [ebx + tiff_extra.strip_offsets], eax |
jmp .quit |
.tag_115: |
lodsd_ |
imul eax, TIFF.IFDE_TYPE_LENGTH.SHORT |
cmp eax, 4 |
ja @f |
xor eax, eax |
lodsw_ |
mov [ebx + tiff_extra.samples_per_pixel], eax |
lodsw |
jmp .quit |
@@: |
lodsd_ |
add eax, [_data] |
movzx eax, word[eax] |
jmp .quit |
.tag_116: |
cmp ax, TIFF.IFDE_TYPE.SHORT |
jne @f |
lodsd |
xor eax, eax |
lodsw_ |
mov [ebx + tiff_extra.rows_per_strip], eax |
lodsw |
jmp .quit |
@@: |
lodsd |
lodsd_ |
mov [ebx + tiff_extra.rows_per_strip], eax |
jmp .quit |
.tag_117: |
cmp ax, TIFF.IFDE_TYPE.SHORT |
jne @f |
mov [ebx + tiff_extra.strip_byte_counts_length], TIFF.IFDE_TYPE_LENGTH.SHORT |
jmp .tag_117.common |
@@: |
mov [ebx + tiff_extra.strip_byte_counts_length], TIFF.IFDE_TYPE_LENGTH.LONG |
.tag_117.common: |
lodsd_ |
imul eax, [ebx + tiff_extra.strip_byte_counts_length] |
cmp eax, 4 |
ja @f |
mov [ebx + tiff_extra.strip_byte_counts], esi |
lodsd |
jmp .quit |
@@: |
lodsd_ |
add eax, [_data] |
mov [ebx + tiff_extra.strip_byte_counts], eax |
jmp .quit |
.tag_140: |
lodsd |
lodsd_ |
add eax, [_data] |
mov [ebx + tiff_extra.palette], eax |
jmp .quit |
.quit: |
pop edi edx ebx |
ret |
endp |
proc tiff._.define_image_type |
xor eax, eax |
cmp [ebx + tiff_extra.bits_per_sample], 1 |
jg .not_bilevel |
mov eax, Image.bpp1 |
jmp .quit |
.not_bilevel: |
cmp [ebx + tiff_extra.palette], 0 |
je .without_palette |
cmp [ebx + tiff_extra.bits_per_sample], 4 |
jne @f |
mov eax, Image.bpp4 |
jmp .quit |
@@: |
cmp [ebx + tiff_extra.bits_per_sample], 8 |
jne @f |
mov eax, Image.bpp8 |
jmp .quit |
@@: |
jmp .quit |
.without_palette: |
cmp [ebx + tiff_extra.samples_per_pixel], 1 |
jg .not_grayscale |
cmp [ebx + tiff_extra.bits_per_sample], 4 |
jne @f |
mov eax, Image.bpp4 |
jmp .quit |
@@: |
cmp [ebx + tiff_extra.bits_per_sample], 8 |
jne @f |
mov eax, Image.bpp8 |
jmp .quit |
.not_grayscale: |
cmp [ebx + tiff_extra.samples_per_pixel], 3 |
jne @f |
mov eax, Image.bpp24 |
jmp .quit |
@@: |
jmp .quit |
.quit: |
ret |
endp |
proc tiff._.decompress.uncompressed _image |
rep movsb |
ret |
endp |
proc tiff._.decompress.packbits _image |
push ebx ecx edx esi |
mov edx, ecx |
.decode: |
lodsb |
dec edx |
cmp al, 0xff |
jbe .different |
cmp al, 0x80 |
jne .identical |
test edx, edx |
jz .quit |
jmp .decode |
.identical: |
neg al |
inc al |
movzx ecx, al |
dec edx |
lodsb |
rep stosb |
test edx, edx |
jnz .decode |
jmp .quit |
.different: |
movzx ecx, al |
inc ecx |
sub edx, ecx |
rep movsb |
test edx, edx |
jnz .decode |
.quit: |
pop esi edx ecx ebx |
ret |
endp |
proc tiff._.decompress.ccitt1d _image |
locals |
current_tree rd 1 |
old_tree rd 1 |
width rd 1 |
height rd 1 |
width_left rd 1 |
is_makeup rd 1 |
endl |
push ebx ecx edx esi |
mov [is_makeup], 0 |
mov ebx, [_image] |
push [ebx + Image.Height] |
pop [height] |
push [ebx + Image.Width] |
pop [width] |
mov edx, esi |
.next_scanline: |
push [width] |
pop [width_left] |
dec [height] |
js .error |
mov [current_tree], tiff._.huffman_tree_white.begin |
mov [old_tree], tiff._.huffman_tree_black.begin |
mov ebx, 0 |
mov ecx, 8 |
.next_run: |
mov esi, [current_tree] |
.branch: |
lodsd |
btr eax, 31 |
jnc .not_a_leaf |
cmp eax, 63 |
seta byte[is_makeup] |
ja @f |
push [current_tree] |
push [old_tree] |
pop [current_tree] |
pop [old_tree] |
@@: |
stdcall tiff._.write_run, [width_left], [current_tree] |
mov [width_left], eax |
test byte[is_makeup], 0x01 |
jnz .next_run |
test eax, eax |
jnz .next_run |
jmp .next_scanline |
.not_a_leaf: |
test bh, bh |
jnz @f |
mov bl, byte[edx] |
inc edx |
mov bh, 8 |
@@: |
test al, 0x02 |
jz .not_a_corner |
dec bh |
sal bl, 1 |
lahf |
and ah, 0x03 |
cmp al, ah |
jne .error |
mov esi, [esi] |
jmp .branch |
.not_a_corner: |
lodsd |
dec bh |
sal bl, 1 |
jc .branch |
mov esi, eax |
jmp .branch |
.error: |
.quit: |
pop esi edx ecx ebx |
ret |
endp |
proc tiff._.write_run _width_left, _current_tree |
push ebx |
test eax, eax |
jz .done |
sub [_width_left], eax |
js .error |
cmp esi, tiff._.huffman_tree_black.begin |
seta bh |
cmp ecx, eax |
ja .one_byte |
.many_bytes: |
mov bl, [edi] |
@@: |
shl bl, 1 |
or bl, bh |
dec eax |
dec ecx |
jnz @b |
mov [edi], bl |
inc edi |
mov ecx, eax |
and eax, 0x07 |
shr ecx, 3 |
push eax |
xor eax, eax |
test bh, bh |
jz @f |
dec al |
@@: |
rep stosb |
pop eax |
mov ecx, 8 |
test eax, eax |
jz .done |
.one_byte: |
mov bl, [edi] |
@@: |
shl bl, 1 |
or bl, bh |
dec ecx |
dec eax |
jnz @b |
mov byte[edi], bl |
cmp [_width_left], 0 |
jne .done |
mov bl, [edi] |
shl bl, cl |
mov byte[edi], bl |
inc edi |
.done: |
mov eax, [_width_left] |
jmp .quit |
.error: |
.quit: |
pop ebx |
ret |
endp |
proc tiff._.get_word _endianness |
lodsw |
test [_endianness], 1 |
jnz @f |
ret |
@@: |
xchg al, ah |
ret |
endp |
proc tiff._.get_dword _endianness |
lodsd |
test [_endianness], 1 |
jnz @f |
ret |
@@: |
bswap eax |
ret |
ret |
endp |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;! Below is private data you should never use directly from your code ;; |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
tiff.IFDE_tag_table.begin: |
.tag_100: dd 0x0100, tiff._.parse_IFDE.tag_100 ; image width |
.tag_101: dd 0x0101, tiff._.parse_IFDE.tag_101 ; image height (this is called 'length' in spec) |
.tag_102: dd 0x0102, tiff._.parse_IFDE.tag_102 ; bits per sample |
.tag_103: dd 0x0103, tiff._.parse_IFDE.tag_103 ; compression |
.tag_106: dd 0x0106, tiff._.parse_IFDE.tag_106 ; photometric interpretation |
.tag_111: dd 0x0111, tiff._.parse_IFDE.tag_111 ; strip offsets |
.tag_115: dd 0x0115, tiff._.parse_IFDE.tag_115 ; samples per pixel |
.tag_116: dd 0x0116, tiff._.parse_IFDE.tag_116 ; rows per strip |
.tag_117: dd 0x0117, tiff._.parse_IFDE.tag_117 ; strip byte counts |
.tag_140: dd 0x0140, tiff._.parse_IFDE.tag_140 ; color map |
tiff.IFDE_tag_table.end: |
include 'huffman.asm' ; huffman trees for ccitt1d compression method |
/programs/develop/libraries/libs-dev/libimg/tiff/tiff.inc |
---|
0,0 → 1,97 |
;;================================================================================================;; |
;;//// tiff.inc //// (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/>. ;; |
;; ;; |
;;================================================================================================;; |
struct tiff_header |
magic_1 rw 1 |
magic_2 rw 1 |
first_IFD rd 1 |
ends |
struct tiff_extra |
image_width rd 1 ; SHORT or LONG |
image_height rd 1 ; SHORT or LONG |
bits_per_sample rd 1 ; SHORT |
samples_per_pixel rd 1 ; SHORT |
compression rd 1 ; SHORT |
photometric rd 1 ; SHORT |
offsets_number rd 1 |
strip_offsets rd 1 ; SHORT or LONG |
strip_offsets_length rd 1 |
rows_per_strip rd 1 ; SHORT or LONG |
strip_byte_counts rd 1 ; LONG or SHORT |
strip_byte_counts_length rd 1 |
palette rd 1 ; SHORT |
palette_size rd 1 ; in colors, not samples |
ends |
TIFF.IFDE_TYPE.BYTE = 1 |
TIFF.IFDE_TYPE.ASCII = 2 |
TIFF.IFDE_TYPE.SHORT = 3 |
TIFF.IFDE_TYPE.LONG = 4 |
TIFF.IFDE_TYPE.RATIONAL = 5 |
TIFF.IFDE_TYPE.SBYTE = 6 |
TIFF.IFDE_TYPE.UNDEFINED = 7 |
TIFF.IFDE_TYPE.SSHORT = 8 |
TIFF.IFDE_TYPE.SLONG = 9 |
TIFF.IFDE_TYPE.SRATIONAL = 10 |
TIFF.IFDE_TYPE.FLOAT = 11 |
TIFF.IFDE_TYPE.DOUBLE = 12 |
TIFF.IFDE_TYPE_LENGTH.BYTE = 1 |
TIFF.IFDE_TYPE_LENGTH.ASCII = 1 |
TIFF.IFDE_TYPE_LENGTH.SHORT = 2 |
TIFF.IFDE_TYPE_LENGTH.LONG = 4 |
TIFF.IFDE_TYPE_LENGTH.RATIONAL = 8 |
TIFF.IFDE_TYPE_LENGTH.SBYTE = 1 |
TIFF.IFDE_TYPE_LENGTH.UNDEFINED = 1 |
TIFF.IFDE_TYPE_LENGTH.SSHORT = 2 |
TIFF.IFDE_TYPE_LENGTH.SLONG = 4 |
TIFF.IFDE_TYPE_LENGTH.SRATIONAL = 8 |
TIFF.IFDE_TYPE_LENGTH.FLOAT = 4 |
TIFF.IFDE_TYPE_LENGTH.DOUBLE = 8 |
TIFF.COMPRESSION.UNCOMPRESSED = 1 |
TIFF.COMPRESSION.CCITT1D = 2 |
TIFF.COMPRESSION.GROUP3FAX = 3 |
TIFF.COMPRESSION.GROUP4FAX = 4 |
TIFF.COMPRESSION.LZW = 5 |
TIFF.COMPRESSION.JPEG = 6 |
TIFF.COMPRESSION.PACKBITS = 32773 |
TIFF.PHOTOMETRIC.WHITE_IS_ZERO = 0 |
TIFF.PHOTOMETRIC.BLACK_IS_ZERO = 1 |
TIFF.PHOTOMETRIC.RGB = 2 |
TIFF.PHOTOMETRIC.RGB_PALETTE = 3 |
TIFF.PHOTOMETRIC.MASK = 4 |
TIFF.PHOTOMETRIC.CMYK = 5 |
TIFF.PHOTOMETRIC.YCbCr = 6 |
TIFF.PHOTOMETRIC.CIELAB = 8 |
macro lodsw_ |
{ |
stdcall tiff._.get_word, [_endianness] |
} |
macro lodsd_ |
{ |
stdcall tiff._.get_dword, [_endianness] |
} |
/programs/develop/libraries/libs-dev/libimg/xcf/composite_mmx.inc |
---|
File deleted |
\ No newline at end of file |
/programs/develop/libraries/libs-dev/libimg/xcf/composite_mmx.asm |
---|
0,0 → 1,821 |
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 mm5, [xcf._.mmx_00ff] |
movq mm4, mm5 |
psubw mm4, mm2 |
psubw mm3, mm5 |
pmullw mm3, mm4 |
psrlw mm3, 8 |
paddw mm3, mm5 |
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 |
/programs/develop/libraries/libs-dev/libimg/xcf/composite_sse.asm |
---|
0,0 → 1,1315 |
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 xmm5, xword[xcf._.xmm_00ff] |
movdqa xmm4, xmm5 |
psubw xmm4, xmm2 |
psubw xmm3, xmm5 |
pmullw xmm3, xmm4 |
psrlw xmm3, 8 |
paddw xmm3, xmm5 |
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 |
/programs/develop/libraries/libs-dev/libimg/xcf/xcf.asm |
---|
1,5 → 1,5 |
;;================================================================================================;; |
;;//// xcf.asm //// (c) dunkaist, 2011 ///////////////////////////////////////////////////////////;; |
;;//// xcf.asm //// (c) dunkaist, 2011-2012 //////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;; ;; |
;; This file is part of Common development libraries (Libs-Dev). ;; |
27,15 → 27,14 |
;; ;; |
;;================================================================================================;; |
include 'xcf.inc' |
;include '../../../../system/board/trunk/debug.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 equ 255 |
MAX_LAYERS = 255 |
DEBUG_STANDARD equ TRUE |
DEBUG_FBOUNDS equ FALSE |
;;================================================================================================;; |
proc img.is.xcf _data, _length ;//////////////////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
75,9 → 74,9 |
.is_not_xcf: |
pop edi |
ret |
endp |
;;================================================================================================;; |
proc img.decode.xcf _data, _length, _options ;////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
89,8 → 88,8 |
;< eax = 0 (error) or pointer to image ;; |
;;================================================================================================;; |
locals |
count rd 1 |
retvalue rd 1 ; 0 (error) or pointer to image |
layer_count rd 1 |
retvalue rd 1 |
endl |
push ebx esi edi |
149,7 → 148,8 |
mov edi, [ebx+Image.Palette] |
mov eax, 0xff000000 |
@@: stosd |
@@: |
stosd |
add eax, 0x00010101 |
jnc @b |
188,48 → 188,49 |
mov [eax+xcf_ext.opacity], 0xffffffff |
mov [eax+xcf_ext.type], edx |
stdcall parse_properties, ebx |
stdcall xcf._.parse_properties, ebx |
mov edi, esi |
mov eax, 0 |
xor eax, eax |
mov ecx, MAX_LAYERS |
mov [count], MAX_LAYERS-1 |
mov [layer_count], MAX_LAYERS-1 |
repne scasd |
sub [count], ecx |
sub [layer_count], ecx |
mov esi, edi |
mov ecx, 0 |
xor ecx, ecx |
.still: sub esi, 8 |
.still: |
sub esi, 8 |
lodsd |
bswap eax |
push ecx |
stdcall decode_layer, eax, [_data] |
stdcall xcf._.decode_layer, eax, [_data] |
pop ecx |
test eax, eax |
jz @f |
push ecx |
stdcall merge_down, eax, [retvalue], ecx |
stdcall xcf._.merge_down, eax, [retvalue], ecx |
pop ecx |
add ecx, 1 |
@@: dec [count] |
@@: |
dec [layer_count] |
jnz .still |
; jmp .quit |
cmp [ebx+Image.Type], Image.bpp8 |
jne .quit |
stdcall pack_8a, ebx |
stdcall xcf._.pack_8a, ebx |
jmp .quit |
.error: mov [retvalue], 0 |
.quit: pop edi esi ebx |
.error: |
mov [retvalue], 0 |
.quit: |
pop edi esi ebx |
mov eax, [retvalue] |
ret |
endp |
;;================================================================================================;; |
proc img.encode.xcf _img, _p_length, _options ;///////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
252,7 → 253,7 |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
proc parse_properties _img |
proc xcf._.parse_properties _img |
mov ebx, [_img] |
.begin: |
259,8 → 260,8 |
lodsd |
bswap eax |
mov ecx, (xcf_prop_table_end-xcf_prop_table_begin)/8 |
mov edi, xcf_prop_table_begin |
mov ecx, (xcf._.prop_table_end - xcf._.prop_table_begin)/8 |
mov edi, xcf._.prop_table_begin |
.still: |
cmp eax, [edi] |
270,16 → 271,16 |
add edi, 8 |
dec ecx |
jnz .still |
lodsd ; skip |
bswap eax ; uninteresting |
add esi, eax ; property |
lodsd |
bswap eax |
add esi, eax |
jmp .begin |
parse_prop_00: ; PROP_END |
.00: ; PROP_END |
lodsd |
ret |
parse_prop_01: ; PROP_COLORMAP |
.01: ; PROP_COLORMAP |
lodsd |
mov ecx, [ebx+Image.Extended] |
cmp [ecx+xcf_ext.type], XCF_BASETYPE_INDEXED |
286,7 → 287,7 |
je @f |
bswap eax |
add esi, eax |
jmp parse_properties.begin |
jmp xcf._.parse_properties.begin |
@@: |
lodsd |
bswap eax |
293,7 → 294,8 |
mov ecx, eax |
mov edi, [ebx+Image.Palette] |
@@: lodsd |
@@: |
lodsd |
sub esi, 1 |
bswap eax |
shr eax, 8 |
301,41 → 303,41 |
stosd |
dec ecx |
jnz @b |
jmp parse_properties.begin |
jmp xcf._.parse_properties.begin |
parse_prop_06: ; PROP_OPACITY |
.06: ; PROP_OPACITY |
lodsd |
lodsd |
bswap eax |
mov ecx, [ebx+Image.Extended] |
mov [ecx+xcf_ext.opacity], eax |
jmp parse_properties.begin |
jmp xcf._.parse_properties.begin |
parse_prop_07: ; PROP_MODE |
.07: ; PROP_MODE |
lodsd |
lodsd |
bswap eax |
mov ecx, [ebx+Image.Extended] |
mov [ecx+xcf_ext.layer_mode], eax |
jmp parse_properties.begin |
jmp xcf._.parse_properties.begin |
parse_prop_08: ; PROP_VISIBLE |
.08: ; PROP_VISIBLE |
lodsd |
lodsd |
bswap eax |
mov ecx, [ebx+Image.Extended] |
mov [ecx+xcf_ext.visible], eax |
jmp parse_properties.begin |
jmp xcf._.parse_properties.begin |
parse_prop_11: ; PROP_APPLY_MASK |
.11: ; PROP_APPLY_MASK |
lodsd |
lodsd |
bswap eax |
mov ecx, [ebx+Image.Extended] |
mov [ecx+xcf_ext.apply_mask], eax |
jmp parse_properties.begin |
jmp xcf._.parse_properties.begin |
parse_prop_15: ; PROP_OFFSETS |
.15: ; PROP_OFFSETS |
lodsd |
lodsd |
mov ecx, [ebx+Image.Extended] |
344,11 → 346,11 |
lodsd |
bswap eax |
mov [ecx+xcf_ext.offset_y], eax |
jmp parse_properties.begin |
jmp xcf._.parse_properties.begin |
endp |
proc decode_channel _channel_begin, _data |
proc xcf._.decode_channel _channel_begin, _data |
locals |
channel_width rd 1 |
channel_height rd 1 |
379,7 → 381,7 |
jz .error |
mov [ebx+Image.Extended], eax |
stdcall parse_properties, ebx |
stdcall xcf._.parse_properties, ebx |
lodsd |
bswap eax |
399,24 → 401,27 |
mov edi, [ebx+Image.Data] |
mov ecx, 0 |
@@: lodsd |
@@: |
lodsd |
test eax, eax |
jz .quit |
bswap eax |
add eax, [_data] |
stdcall decode_tile, eax, [channel_width], [channel_height], [total_bpl], [planes_todo], 1 |
stdcall xcf._.decode_tile, eax, [channel_width], [channel_height], [total_bpl], [planes_todo], 1 |
add ecx, 1 |
jmp @b |
.error: stdcall img.destroy, ebx |
.error: |
stdcall img.destroy, ebx |
mov ebx, 0 |
.quit: mov eax, ebx |
.quit: |
mov eax, ebx |
pop edi esi ebx |
ret |
endp |
proc decode_layer _layer_begin, _data |
proc xcf._.decode_layer _layer_begin, _data |
locals |
layer_width rd 1 |
layer_height rd 1 |
445,7 → 450,8 |
mov [color_step], 3 |
mov edx, Image.bpp32 |
shl [total_bpl], 1 |
@@: stdcall img.create, [layer_width], [layer_height], edx |
@@: |
stdcall img.create, [layer_width], [layer_height], edx |
mov ebx, eax |
test ebx, ebx |
jz .quit |
457,7 → 463,7 |
lodsd |
bswap eax |
add esi, eax |
stdcall parse_properties, ebx |
stdcall xcf._.parse_properties, ebx |
mov edx, [ebx+Image.Extended] |
or [edx+xcf_ext.visible], 0 |
jz .unvisible |
483,17 → 489,18 |
mov edi, [ebx+Image.Data] |
mov ecx, 0 |
@@: lodsd |
@@: |
lodsd |
test eax, eax |
jz @f |
bswap eax |
add eax, [_data] |
stdcall decode_tile, eax, [layer_width], [layer_height], [total_bpl], [planes_todo], 0 |
stdcall xcf._.decode_tile, eax, [layer_width], [layer_height], [total_bpl], [planes_todo], 0 |
add ecx, 1 |
jmp @b |
@@: |
stdcall apply_opacity, ebx, [color_step] |
stdcall xcf._.apply_opacity, ebx, [color_step] |
pop esi |
lodsd |
501,7 → 508,7 |
test eax, eax |
jz .quit |
stdcall decode_channel, eax, [_data] |
stdcall xcf._.decode_channel, eax, [_data] |
test eax, eax |
jz .error |
509,19 → 516,21 |
cmp [edx+xcf_ext.apply_mask], 0 |
je .quit |
stdcall apply_alpha_mask, ebx, eax, [color_step] |
stdcall xcf._.apply_alpha_mask, ebx, eax, [color_step] |
jmp .quit |
.unvisible: |
.error: stdcall img.destroy, ebx |
.error: |
stdcall img.destroy, ebx |
mov ebx, 0 |
.quit: mov eax, ebx |
.quit: |
mov eax, ebx |
pop edi esi ebx |
ret |
endp |
proc decode_tile _tile_data, _width, _height, _total_bpl, _bytes_pp, _is_channel |
proc xcf._.decode_tile _tile_data, _width, _height, _total_bpl, _bytes_pp, _is_channel |
locals |
tile_x rd 1 |
tile_y rd 1 |
595,7 → 604,7 |
cmp [_is_channel], 1 |
jne @f |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
jmp .quit |
@@: |
mov eax, [planes_todo] |
607,42 → 616,43 |
jz .p3 |
jmp .p4 |
.p1: |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
add edi, 1 |
stdcall fill_color, [tile_width], [tile_height], [_total_bpl], [_bytes_pp], [color_step] |
stdcall xcf._.fill_color, [tile_width], [tile_height], [_total_bpl], [_bytes_pp], [color_step] |
jmp .quit |
.p2: |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
add edi, 1 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
jmp .quit |
.p3: |
add edi, 2 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
sub edi, 1 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
sub edi, 1 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
add edi, 3 |
stdcall fill_color, [tile_width], [tile_height], [_total_bpl], [_bytes_pp], [color_step] |
stdcall xcf._.fill_color, [tile_width], [tile_height], [_total_bpl], [_bytes_pp], [color_step] |
jmp .quit |
.p4: |
add edi, 2 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
sub edi, 1 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
sub edi, 1 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
add edi, 3 |
stdcall decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
stdcall xcf._.decode_color, [tile_width], [tile_height], [color_step], [_total_bpl], [_bytes_pp] |
; jmp .quit |
.quit: pop edi esi edx ecx ebx |
.quit: |
pop edi esi edx ecx ebx |
ret |
endp |
proc fill_color _tile_width, _tile_height, _total_bpl, _bytes_pp, _color_step |
proc xcf._.fill_color _tile_width, _tile_height, _total_bpl, _bytes_pp, _color_step |
push ebx |
mov edx, [_color_step] |
mov ebx, [_total_bpl] |
652,20 → 662,22 |
mov ch, byte[_tile_height] |
mov al, 0xff |
.still: mov cl, byte[_tile_width] |
@@: stosb |
.line: |
mov cl, byte[_tile_width] |
@@: |
stosb |
add edi, edx |
dec cl |
jnz @b |
add edi, ebx |
dec ch |
jnz .still |
jnz .line |
pop ebx |
ret |
endp |
proc decode_color _tile_width, _tile_height, _color_step, _total_bpl, _bytes_pp |
proc xcf._.decode_color _tile_width, _tile_height, _color_step, _total_bpl, _bytes_pp |
locals |
level_width rd 1 |
level_height rd 1 |
682,7 → 694,8 |
mov ebx, [_tile_height] |
mov edx, [_tile_width] |
.decode:lodsb |
.decode: |
lodsb |
cmp al, 127 |
je .long_identical |
jb .short_identical |
701,13 → 714,15 |
mov cx, ax |
xchg cl, ch |
lodsb |
.step1: cmp cx, dx |
.step1: |
cmp cx, dx |
je .step2 |
jl .step3 |
xchg cx, dx |
sub dx, cx |
sub bx, 1 |
@@: stosb |
@@: |
stosb |
add edi, [_color_step] |
loop @b |
mov cx, dx |
716,7 → 731,8 |
jmp .step1 |
.step2: |
@@: stosb |
@@: |
stosb |
add edi, [_color_step] |
loop @b |
mov edx, [_tile_width] |
724,8 → 740,10 |
dec bx |
jz .quit |
jmp .decode |
.step3: sub dx, cx |
@@: stosb |
.step3: |
sub dx, cx |
@@: |
stosb |
add edi, [_color_step] |
loop @b |
jmp .decode |
742,13 → 760,15 |
mov ch, al |
lodsb |
mov cl, al |
.step4: cmp cx, dx |
.step4: |
cmp cx, dx |
je .step5 |
jl .step6 |
xchg cx, dx |
sub dx, cx |
sub bx, 1 |
@@: movsb |
@@: |
movsb |
add edi, [_color_step] |
loop @b |
mov cx, dx |
757,7 → 777,8 |
jmp .step4 |
.step5: |
@@: movsb |
@@: |
movsb |
add edi, [_color_step] |
loop @b |
mov edx, [_tile_width] |
766,18 → 787,21 |
jz .quit |
jmp .decode |
.step6: sub dx, cx |
@@: movsb |
.step6: |
sub dx, cx |
@@: |
movsb |
add edi, [_color_step] |
loop @b |
jmp .decode |
.quit: pop edi |
.quit: |
pop edi |
ret |
endp |
proc merge_down _img, _bottom, _layer_number |
proc xcf._.merge_down _img, _bottom, _layer_number |
locals |
copy_width rd 1 |
copy_height rd 1 |
878,7 → 902,8 |
cmp [edx+Image.Width], Image.bpp16 |
je @f |
shl eax, 1 |
@@: add esi, eax |
@@: |
add esi, eax |
mov eax, [ebx+Image.Width] |
imul eax, [bottom_y1] |
887,7 → 912,8 |
cmp [ebx+Image.Width], Image.bpp8 |
je @f |
shl eax, 1 |
@@: add edi, eax |
@@: |
add edi, eax |
mov eax, [edx+Image.Width] |
896,7 → 922,8 |
cmp [edx+Image.Width], Image.bpp16 |
je @f |
shl eax, 1 |
@@: mov [img_total_bpl], eax |
@@: |
mov [img_total_bpl], eax |
mov eax, [ebx+Image.Width] |
sub eax, [copy_width] |
904,7 → 931,8 |
cmp [ebx+Image.Width], Image.bpp8 |
je @f |
shl eax, 1 |
@@: mov [bottom_total_bpl], eax |
@@: |
mov [bottom_total_bpl], eax |
cmp [_layer_number], 0 |
jne .not_first |
911,10 → 939,12 |
mov ecx, [copy_width] |
imul ecx, [copy_height] |
cmp [ebx+Image.Type], Image.bpp8 |
je .bpp8 |
.bpp32: rep movsd |
je .bpp8a |
.bpp32: |
rep movsd |
jmp .done |
.bpp8: rep movsw |
.bpp8a: |
rep movsw |
jmp .done |
.not_first: |
937,8 → 967,8 |
@@: |
mov edx, 12 |
.type_defined: |
mov ecx, (composite_table_end-composite_table_begin)/8 |
mov edi, composite_table_begin |
mov ecx, (xcf._.composite_table.end - xcf._.composite_table.begin) / 8 |
mov edi, xcf._.composite_table.begin |
.still: |
cmp eax, [edi] |
969,9 → 999,10 |
cmp [ebx+Image.Type], Image.bpp8 |
jne @f |
stdcall merge_8a, [copy_width], [copy_height], [img_total_bpl], [bottom_total_bpl] |
stdcall xcf._.merge_8a, [copy_width], [copy_height], [img_total_bpl], [bottom_total_bpl] |
jmp .done |
@@: stdcall merge_32, [copy_width], [copy_height], [img_total_bpl], [bottom_total_bpl] |
@@: |
stdcall xcf._.merge_32, [copy_width], [copy_height], [img_total_bpl], [bottom_total_bpl] |
; jmp .done |
.done: |
stdcall img.destroy, [_img] |
980,14 → 1011,14 |
endp |
proc pack_8a _img |
proc xcf._.pack_8a _img |
mov ebx, [_img] |
mov esi, [ebx+Image.Data] |
mov edi, [ebx+Image.Data] |
mov edi, esi |
mov ecx, [ebx+Image.Width] |
mov edx, [ebx+Image.Height] |
imul ecx, edx |
@@: lodsw |
imul ecx, [ebx + Image.Height] |
@@: |
lodsw |
stosb |
dec ecx |
jnz @b |
995,7 → 1026,7 |
endp |
proc apply_opacity _img, _color_step |
proc xcf._.apply_opacity _img, _color_step |
push ebx |
1010,7 → 1041,8 |
mov ebx, [_color_step] |
add esi, ebx |
mov edi, esi |
@@: lodsb |
@@: |
lodsb |
mul dl |
shr ax, 8 |
stosb |
1019,12 → 1051,13 |
dec ecx |
jnz @b |
.quit: pop ebx |
.quit: |
pop ebx |
ret |
endp |
proc apply_alpha_mask _img, _mask, _color_step |
proc xcf._.apply_alpha_mask _img, _mask, _color_step |
push ebx |
1051,7 → 1084,15 |
endp |
proc pixel_rgb2hsv |
;;================================================================================================;; |
proc xcf._.rgb2hsv ;///////////////////////////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? convert color from RGB to HSV space ;; |
;;------------------------------------------------------------------------------------------------;; |
;> eax = color (0xAARRGGBB) ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = color (0xAAHHSSVV) ;; |
;;================================================================================================;; |
locals |
vsha rd 1 |
max rd 1 |
1074,19 → 1115,22 |
rol eax, 8 |
jmp .quit |
@@: cmp dl, cl |
@@: |
cmp dl, cl |
ja @f |
cmp dl, al |
ja @f |
mov byte[min], dl |
jmp .min_found |
@@: cmp cl, al |
@@: |
cmp cl, al |
ja @f |
cmp cl, dl |
ja @f |
mov byte[min], cl |
jmp .min_found |
@@: mov byte[min], al |
@@: |
mov byte[min], al |
; jmp .min_found |
.min_found: |
1099,7 → 1143,8 |
mov dx, cx |
mov cx, 0 |
jmp .max_found |
@@: cmp cl, al |
@@: |
cmp cl, al |
jb @f |
cmp cl, dl |
jb @f |
1108,7 → 1153,8 |
mov dx, ax |
mov cx, 85 |
jmp .max_found |
@@: mov byte[max], al |
@@: |
mov byte[max], al |
sub dx, cx |
mov cx, 171 |
; jmp .max_found |
1145,12 → 1191,21 |
@@: |
mov eax, [vsha] |
.quit: pop edx ecx ebx |
.quit: |
pop edx ecx ebx |
ret |
endp |
proc pixel_hsv2rgb |
;;================================================================================================;; |
proc xcf._.hsv2rgb ;///////////////////////////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? convert color from HSV to RGB space ;; |
;;------------------------------------------------------------------------------------------------;; |
;> eax = color (0xAAHHSSVV) ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = color (0xAARRGGBB) ;; |
;;================================================================================================;; |
locals |
vsha rd 1 |
f rb 1 |
1178,7 → 1233,8 |
sub eax, ebx |
jmp .ok |
@@: cmp eax, 86 |
@@: |
cmp eax, 86 |
ja @f |
sub eax, 44 |
lea eax, [eax*3] |
1187,7 → 1243,8 |
add al, 0xff |
jmp .ok |
@@: cmp eax, 129 |
@@: |
cmp eax, 129 |
ja @f |
sub eax, 87 |
lea eax, [eax*3] |
1194,7 → 1251,8 |
shl eax, 1 |
jmp .ok |
@@: cmp eax, 171 |
@@: |
cmp eax, 171 |
ja @f |
sub eax, 130 |
lea eax, [eax*3] |
1203,7 → 1261,8 |
add al, 0xff |
jmp .ok |
@@: cmp eax, 214 |
@@: |
cmp eax, 214 |
ja @f |
sub eax, 172 |
lea eax, [eax*3] |
1239,7 → 1298,8 |
mov al, 0 |
jmp .done |
@@: cmp al, 86 |
@@: |
cmp al, 86 |
jae @f |
mov eax, [vsha] |
shr eax, 8 |
1249,7 → 1309,8 |
mov al, 0 |
jmp .done |
@@: cmp al, 129 |
@@: |
cmp al, 129 |
jae @f |
mov eax, [vsha] |
shr eax, 8 |
1259,7 → 1320,8 |
mov al, byte[x] |
jmp .done |
@@: cmp al, 171 |
@@: |
cmp al, 171 |
jae @f |
mov eax, [vsha] |
shr eax, 8 |
1269,7 → 1331,8 |
mov al, byte[c] |
jmp .done |
@@: cmp al, 214 |
@@: |
cmp al, 214 |
jae @f |
mov eax, [vsha] |
shr eax, 8 |
1279,7 → 1342,8 |
mov al, byte[c] |
jmp .done |
@@: mov eax, [vsha] |
@@: |
mov eax, [vsha] |
shr eax, 8 |
mov ah, byte[c] |
shl eax, 8 |
1296,12 → 1360,21 |
add ah, bl |
add al, bl |
.quit: pop edx ecx ebx |
.quit: |
pop edx ecx ebx |
ret |
endp |
proc pixel_rgb2hsl |
;;================================================================================================;; |
proc xcf._.rgb2hsl ;///////////////////////////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? convert color from RGB to HSL space ;; |
;;------------------------------------------------------------------------------------------------;; |
;> eax = color (0xAARRGGBB) ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = color (0xAAHHSSLL) ;; |
;;================================================================================================;; |
; http://www.asmcommunity.net/board/index.php?topic=7425 |
; iblis: "I don't know what X-Filez is, but yes you may use it however you wish. That's why I made this post, to share." |
; so pixel_rgb2hsl procedure is based on code by Greg Hoyer (iblis). thanks! |
1339,15 → 1412,18 |
xchg esi, edi |
neg cl |
shl cl, 1 |
.cmp1: cmp edi, ebx |
.cmp1: |
cmp edi, ebx |
jb .cmp2 |
xchg edi, ebx |
neg cl |
.cmp2: cmp esi, ebx |
.cmp2: |
cmp esi, ebx |
ja .cmp3 |
xchg esi, ebx |
not cl |
.cmp3: neg ebx |
.cmp3: |
neg ebx |
add ebx, esi |
mov eax, edi |
add edi, esi |
1362,7 → 1438,8 |
jbe .csat |
neg edi |
add edi, 510 |
.csat: xor edx, edx |
.csat: |
xor edx, edx |
div edi |
pop edi |
shr edi, 1 |
1371,7 → 1448,8 |
add cl, 3 |
jnc .noneg |
neg ebx |
.noneg: shl cl, 2 |
.noneg: |
shl cl, 2 |
mov eax, 0x13135db9 |
shr eax, cl |
and eax, 7 |
1387,7 → 1465,8 |
div ebx |
shl eax, 16 |
or eax, edi |
.done: bswap eax |
.done: |
bswap eax |
shr eax, 8 |
mov bl, byte[bgra+3] |
1401,7 → 1480,15 |
endp |
proc pixel_hsl2rgb |
;;================================================================================================;; |
proc xcf._.hsl2rgb ;///////////////////////////////////////////////////////////////////////////;; |
;;------------------------------------------------------------------------------------------------;; |
;? convert color from HSL to RGB space ;; |
;;------------------------------------------------------------------------------------------------;; |
;> eax = color (0xAAHHSSLL) ;; |
;;------------------------------------------------------------------------------------------------;; |
;< eax = color (0xAARRGGBB) ;; |
;;================================================================================================;; |
; http://www.asmcommunity.net/board/index.php?topic=7425 |
; iblis: "I don't know what X-Filez is, but yes you may use it however you wish. That's why I made this post, to share." |
; so pixel_hsl2rgb procedure is based on code by Greg Hoyer (iblis). thanks! |
1439,7 → 1526,8 |
ja .lcase |
dec al |
xor ecx, ecx |
.lcase: add eax, edi |
.lcase: |
add eax, edi |
mul ebx |
or ecx, ecx |
jz .scase |
1450,7 → 1538,8 |
shl ecx, 8 |
sub ecx, edx |
add eax, ecx |
.scase: xor edx, edx |
.scase: |
xor edx, edx |
xor ecx, ecx |
dec cl |
mov edi, ecx |
1513,7 → 1602,8 |
jz .done |
ror eax, 8 |
xchg ah, al |
.done: and eax, 0x00ffffff |
.done: |
and eax, 0x00ffffff |
mov bl, byte[lsha+3] |
bswap eax |
1521,11 → 1611,15 |
ror eax, 8 |
pop edi esi ebx |
ret |
endp |
match =MMX,COMPOSITE_MODE{include 'composite_mmx.inc'} |
match =MMX, COMPOSITE_MODE{include 'composite_mmx.asm'} |
match =SSE, COMPOSITE_MODE{include 'composite_sse.asm'} |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
1533,41 → 1627,37 |
;;================================================================================================;; |
;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
;;================================================================================================;; |
xcf_prop_table_begin: |
dd 00, parse_prop_00 |
dd 01, parse_prop_01 |
dd 06, parse_prop_06 |
dd 07, parse_prop_07 |
dd 08, parse_prop_08 |
dd 11, parse_prop_11 |
dd 15, parse_prop_15 |
xcf_prop_table_end: |
xcf._.prop_table_begin: |
dd 00, xcf._.parse_properties.00 |
dd 01, xcf._.parse_properties.01 |
dd 06, xcf._.parse_properties.06 |
dd 07, xcf._.parse_properties.07 |
dd 08, xcf._.parse_properties.08 |
dd 11, xcf._.parse_properties.11 |
dd 15, xcf._.parse_properties.15 |
xcf._.prop_table_end: |
composite_table_begin: |
.p00 dd 00, composite_rgb_00, composite_gray_00, composite_indexed_00 ; Normal |
.p01 dd 01, composite_rgb_01, composite_gray_01, composite_gray_01 ; Dissolve : random dithering to discrete alpha |
;.p02 dd 02, composite_rgb_02, 0, composite_indexed_02 ; Behind : not selectable in the GIMP UI. not implemented |
.p03 dd 03, composite_rgb_03, composite_rgb_03, composite_indexed_00 ; Multiply |
.p04 dd 04, composite_rgb_04, composite_rgb_04, composite_indexed_00 ; Screen |
.p05 dd 05, composite_rgb_05, composite_rgb_05, composite_indexed_00 ; Overlay |
.p06 dd 06, composite_rgb_06, composite_rgb_06, composite_indexed_00 ; Difference |
.p07 dd 07, composite_rgb_07, composite_rgb_07, composite_indexed_00 ; Addition |
.p08 dd 08, composite_rgb_08, composite_rgb_08, composite_indexed_00 ; Subtract |
.p09 dd 09, composite_rgb_09, composite_rgb_09, composite_indexed_00 ; Darken Only |
.p10 dd 10, composite_rgb_10, composite_rgb_10, composite_indexed_00 ; Lighten Only |
.p11 dd 11, composite_rgb_11, composite_gray_00, composite_indexed_00 ; Hue (H of HSV) |
.p12 dd 12, composite_rgb_12, composite_gray_00, composite_indexed_00 ; Saturation (S of HSV) |
.p13 dd 13, composite_rgb_13, composite_gray_00, composite_indexed_00 ; Color (H and S of HSL) |
.p14 dd 14, composite_rgb_14, composite_gray_00, composite_indexed_00 ; Value (V of HSV) |
.p15 dd 15, composite_rgb_15, composite_rgb_15, composite_indexed_00 ; Divide |
.p16 dd 16, composite_rgb_16, composite_rgb_16, composite_indexed_00 ; Dodge |
.p17 dd 17, composite_rgb_17, composite_rgb_17, composite_indexed_00 ; Burn |
.p18 dd 18, composite_rgb_18, composite_rgb_18, composite_indexed_00 ; Hard Light |
.p19 dd 19, composite_rgb_05, composite_rgb_05, composite_indexed_00 ; Soft Light : XCF version >= 2 only ('soft light' == 'overlay') |
.p20 dd 20, composite_rgb_20, composite_rgb_20, composite_indexed_00 ; Grain Extract : XCF version >= 2 only |
.p21 dd 21, composite_rgb_21, composite_rgb_21, composite_indexed_00 ; Grain Merge : XCF version >= 2 only |
composite_table_end: |
random_a dd 1103515245 |
random_b dd 777 |
random_c dd 12345 |
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: |
/programs/develop/libraries/libs-dev/libimg/xcf/xcf.inc |
---|
1,5 → 1,5 |
;;================================================================================================;; |
;;//// xcf.inc //// (c) dunkaist, 2011 ///////////////////////////////////////////////////////////;; |
;;//// xcf.inc //// (c) dunkaist, 2011-2012 //////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;; ;; |
;; This file is part of Common development libraries (Libs-Dev). ;; |
17,6 → 17,10 |
;; ;; |
;;================================================================================================;; |
XCF_BASETYPE_RGB = 0 |
XCF_BASETYPE_GRAY = 1 |
XCF_BASETYPE_INDEXED = 2 |
struct xcf_header |
magic_string rb 9 |
version rd 1 |
26,10 → 30,6 |
base_type rd 1 |
ends |
XCF_BASETYPE_RGB equ 0 |
XCF_BASETYPE_GRAY equ 1 |
XCF_BASETYPE_INDEXED equ 2 |
struct xcf_ext |
visible rd 1 |
layer_mode rd 1 |