mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-24 23:56:49 +03:00
libimg:
new image type: grayscale (Image.bpp9) tiff fixes for grayscale+alpha images xcf regression bug fixed (screen mode blending, r2388) git-svn-id: svn://kolibrios.org@2733 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
084abd8134
commit
185caf04b2
@ -104,7 +104,7 @@ img.decode.bmp.length_rest equ length_rest
|
||||
jnz .error
|
||||
; convert images with <= 8 bpp to 8bpp, other - to 32 bpp
|
||||
.normal:
|
||||
m2m eax, Image.bpp8
|
||||
m2m eax, Image.bpp8i
|
||||
cmp byte [ebx + 14], 8 ; bit count
|
||||
jbe @f
|
||||
mov al, Image.bpp32
|
||||
@ -124,7 +124,7 @@ img.decode.bmp.length_rest equ length_rest
|
||||
pushd [ebx + 4] ;[ebx + bmp.InfoHeader.Width]
|
||||
jmp .create
|
||||
.old1:
|
||||
m2m eax, Image.bpp8
|
||||
m2m eax, Image.bpp8i
|
||||
cmp byte [ebx + 10], 8 ; bit count
|
||||
jbe @f
|
||||
mov al, Image.bpp32
|
||||
|
@ -209,7 +209,7 @@ img.decode.gif.cur_color_table_size_child equ ebp + 4 + 4 + 4*3 + 4
|
||||
xor ecx, ecx
|
||||
@@:
|
||||
push eax
|
||||
mov [eax + Image.Type], Image.bpp8
|
||||
mov [eax + Image.Type], Image.bpp8i
|
||||
|
||||
add ecx, sizeof.gif.Image
|
||||
invoke mem.alloc, ecx
|
||||
@ -306,7 +306,7 @@ img.decode.gif.cur_color_table_size_child equ ebp + 4 + 4 + 4*3 + 4
|
||||
jnz .noprevdata
|
||||
push 1
|
||||
pop eax
|
||||
cmp [edx + Image.Type], Image.bpp8
|
||||
cmp [edx + Image.Type], Image.bpp8i
|
||||
jz @f
|
||||
mov al, 3
|
||||
@@:
|
||||
@ -1259,7 +1259,7 @@ proc img.decode.gif._.dispose ;/////////////////////////////////////////////////
|
||||
; don't dispose - set prev_img and related vars to current image
|
||||
mov eax, [edx + Image.Data]
|
||||
mov [prev_img_data], eax
|
||||
cmp [edx + Image.Type], Image.bpp8
|
||||
cmp [edx + Image.Type], Image.bpp8i
|
||||
jnz @f
|
||||
mov eax, [max_color]
|
||||
inc eax
|
||||
|
@ -205,7 +205,7 @@ img.decode.ico._.decode_icon_mask:
|
||||
mov ebx, [eax + Image.Height]
|
||||
mov ecx, [eax + Image.Width]
|
||||
; for now, BMP code produces only 8 and 32 bpp images
|
||||
cmp [eax + Image.Type], Image.bpp8
|
||||
cmp [eax + Image.Type], Image.bpp8i
|
||||
jz .bpp8
|
||||
.bpp32:
|
||||
mov edx, [esp+16] ; get background color
|
||||
|
@ -473,8 +473,8 @@ img.decode.jpg:
|
||||
jnz .end2
|
||||
; image type: 8 bpp for grayscale JPEGs, 24 bpp for normal,
|
||||
; 32 bpp for Adobe YCCK
|
||||
push Image.bpp8
|
||||
pop eax ; Image.bpp8 = 1
|
||||
push Image.bpp8i
|
||||
pop eax ; Image.bpp8i = 1
|
||||
cmp edi, eax
|
||||
jz @f
|
||||
inc eax ; Image.bpp24 = 2
|
||||
|
@ -228,13 +228,13 @@ proc img._.do_rgb ;/////////////////////////////////////////////////////////////
|
||||
jmp dword [.handlers + (eax-1)*4]
|
||||
|
||||
align 16
|
||||
.bpp8:
|
||||
; 8 BPP -> 24 BPP
|
||||
.bpp8i:
|
||||
; 8 BPP WITH PALETTE -> 24 BPP
|
||||
push ebx
|
||||
mov ebx, [esi + Image.Palette]
|
||||
mov esi, [esi + Image.Data]
|
||||
sub ecx, 1
|
||||
jz .bpp8.last
|
||||
jz .bpp8i.last
|
||||
@@:
|
||||
movzx eax, byte [esi]
|
||||
add esi, 1
|
||||
@ -243,7 +243,7 @@ align 16
|
||||
add edi, 3
|
||||
sub ecx, 1
|
||||
jnz @b
|
||||
.bpp8.last:
|
||||
.bpp8i.last:
|
||||
movzx eax, byte [esi]
|
||||
mov eax, [ebx + eax*4]
|
||||
mov [edi], ax
|
||||
@ -252,6 +252,32 @@ align 16
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
align 16
|
||||
.bpp8g:
|
||||
; 8 BPP GRAYSCALE -> 24 BPP
|
||||
mov esi, [esi + Image.Data]
|
||||
@@:
|
||||
lodsb
|
||||
mov ah, al
|
||||
stosb
|
||||
stosw
|
||||
dec ecx
|
||||
jnz @b
|
||||
ret
|
||||
;
|
||||
;align 16
|
||||
;.bpp8a: ; considered application layer, may be changed in the future
|
||||
;; 8a BPP -> 24 BPP
|
||||
; mov esi, [esi + Image.Data]
|
||||
;@@:
|
||||
; lodsw
|
||||
; mov ah, al
|
||||
; stosb
|
||||
; stosw
|
||||
; dec ecx
|
||||
; jnz @b
|
||||
; ret
|
||||
|
||||
; 15 BPP -> 24 BPP
|
||||
.bpp15.intel:
|
||||
push ebx ebp
|
||||
@ -972,9 +998,9 @@ endl
|
||||
jnz .next_line_horz1x
|
||||
jmp .exit
|
||||
|
||||
.bpp8_horz:
|
||||
.bpp8ig_horz:
|
||||
dec edi
|
||||
.next_line_horz8:
|
||||
.next_line_horz8ig:
|
||||
push ecx esi edi
|
||||
|
||||
mov ecx, [scanline_len]
|
||||
@ -992,7 +1018,7 @@ endl
|
||||
add esi, [scanline_len]
|
||||
add edi, [scanline_len]
|
||||
dec ecx
|
||||
jnz .next_line_horz8
|
||||
jnz .next_line_horz8ig
|
||||
jmp .exit
|
||||
|
||||
.bpp24_horz:
|
||||
@ -1180,8 +1206,10 @@ endl
|
||||
|
||||
cmp [ebx + Image.Type], Image.bpp1
|
||||
jz .rotate_ccw1
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
jz .rotate_ccw8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
jz .rotate_ccw8ig
|
||||
cmp [ebx + Image.Type], Image.bpp8g
|
||||
jz .rotate_ccw8ig
|
||||
cmp [ebx + Image.Type], Image.bpp24
|
||||
jz .rotate_ccw24
|
||||
cmp [ebx + Image.Type], Image.bpp32
|
||||
@ -1273,8 +1301,8 @@ endl
|
||||
pop ecx
|
||||
jmp .next_column_ccw_low
|
||||
|
||||
.rotate_ccw8:
|
||||
.next_column_ccw_low8:
|
||||
.rotate_ccw8ig:
|
||||
.next_column_ccw_low8ig:
|
||||
dec ecx
|
||||
js .exchange_dims
|
||||
push ecx
|
||||
@ -1319,7 +1347,7 @@ endl
|
||||
rep movsb
|
||||
|
||||
pop ecx
|
||||
jmp .next_column_ccw_low8
|
||||
jmp .next_column_ccw_low8ig
|
||||
|
||||
.rotate_ccw24:
|
||||
.next_column_ccw_low24:
|
||||
@ -1472,8 +1500,10 @@ endl
|
||||
|
||||
cmp [ebx + Image.Type], Image.bpp1
|
||||
jz .rotate_cw1
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
jz .rotate_cw8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
jz .rotate_cw8ig
|
||||
cmp [ebx + Image.Type], Image.bpp8g
|
||||
jz .rotate_cw8ig
|
||||
cmp [ebx + Image.Type], Image.bpp24
|
||||
jz .rotate_cw24
|
||||
cmp [ebx + Image.Type], Image.bpp32
|
||||
@ -1570,8 +1600,8 @@ endl
|
||||
pop ecx
|
||||
jmp .next_column_cw_low
|
||||
|
||||
.rotate_cw8:
|
||||
.next_column_cw_low8:
|
||||
.rotate_cw8ig:
|
||||
.next_column_cw_low8ig:
|
||||
dec ecx
|
||||
js .exchange_dims
|
||||
push ecx
|
||||
@ -1618,7 +1648,7 @@ endl
|
||||
rep movsb
|
||||
|
||||
pop ecx
|
||||
jmp .next_column_cw_low8
|
||||
jmp .next_column_cw_low8ig
|
||||
|
||||
.rotate_cw24:
|
||||
.next_column_cw_low24:
|
||||
@ -1889,7 +1919,7 @@ img.formats_table:
|
||||
.pcx dd LIBIMG_FORMAT_ID_PCX, img.is.pcx, img.decode.pcx, img.encode.pcx, 0
|
||||
.xcf dd LIBIMG_FORMAT_ID_XCF, img.is.xcf, img.decode.xcf, img.encode.xcf, 0
|
||||
.tiff dd LIBIMG_FORMAT_ID_TIFF, img.is.tiff, img.decode.tiff, img.encode.tiff,0
|
||||
.pnm dd LIBIMG_FORMAT_ID_PNM, img.is.pnm, img.decode.pnm, img.encode.pnm, 1 + (1 SHL Image.bpp1) + (1 SHL Image.bpp8) + (1 SHL Image.bpp24)
|
||||
.pnm dd LIBIMG_FORMAT_ID_PNM, img.is.pnm, img.decode.pnm, img.encode.pnm, 1 + (1 SHL Image.bpp1) + (1 SHL Image.bpp8g) + (1 SHL Image.bpp24)
|
||||
.wbmp dd LIBIMG_FORMAT_ID_WBMP, img.is.wbmp, img.decode.wbmp, img.encode.wbmp,0
|
||||
.z80 dd LIBIMG_FORMAT_ID_Z80, img.is.z80, img.decode.z80, img.encode.z80, 0 ;this must be the last entry as there are no signatures in z80 screens at all
|
||||
dd 0
|
||||
@ -1989,8 +2019,12 @@ proc img._.resize_data _img, _width, _height ;//////////////////////////////////
|
||||
jae .error
|
||||
cmp [ebx + Image.Type], Image.bpp1
|
||||
jz .bpp1
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
jz .bpp8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
jz .bpp8i
|
||||
cmp [ebx + Image.Type], Image.bpp8g
|
||||
jz .bpp8g
|
||||
cmp [ebx + Image.Type], Image.bpp8a
|
||||
jz .bpp8a
|
||||
cmp [ebx + Image.Type], Image.bpp24
|
||||
jz .bpp24
|
||||
.bpp32:
|
||||
@ -1999,8 +2033,12 @@ proc img._.resize_data _img, _width, _height ;//////////////////////////////////
|
||||
.bpp24:
|
||||
lea eax, [eax*3]
|
||||
jmp @f
|
||||
.bpp8:
|
||||
.bpp8i:
|
||||
add eax, 256*4 ; for palette
|
||||
.bpp8g:
|
||||
jmp @f
|
||||
.bpp8a:
|
||||
shl eax, 1
|
||||
jmp @f
|
||||
.bpp1:
|
||||
mov eax, [_width]
|
||||
@ -2040,7 +2078,7 @@ proc img._.resize_data _img, _width, _height ;//////////////////////////////////
|
||||
pop [ebx + Image.Width]
|
||||
push [_height]
|
||||
pop [ebx + Image.Height]
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
jnz @f
|
||||
lea esi, [eax + esi - 256*4]
|
||||
mov [ebx + Image.Palette], esi
|
||||
@ -2070,8 +2108,12 @@ img._.get_scanline_len: ;///////////////////////////////////////////////////////
|
||||
;;================================================================================================;;
|
||||
cmp [ebx + Image.Type], Image.bpp1
|
||||
jz .bpp1.1
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
jz .bpp8.1
|
||||
cmp [ebx + Image.Type], Image.bpp8g
|
||||
jz .bpp8.1
|
||||
cmp [ebx + Image.Type], Image.bpp8a
|
||||
jz .bpp8a.1
|
||||
cmp [ebx + Image.Type], Image.bpp24
|
||||
jz .bpp24.1
|
||||
add eax, eax
|
||||
@ -2085,6 +2127,9 @@ img._.get_scanline_len: ;///////////////////////////////////////////////////////
|
||||
.bpp1.1:
|
||||
add eax, 7
|
||||
shr eax, 3
|
||||
jmp .quit
|
||||
.bpp8a.1:
|
||||
shl eax, 1
|
||||
.bpp8.1:
|
||||
.quit:
|
||||
ret
|
||||
@ -2099,22 +2144,26 @@ img._.get_scanline_len: ;///////////////////////////////////////////////////////
|
||||
;;================================================================================================;;
|
||||
|
||||
align 4
|
||||
type2bpp dd 8, 24, 32, 15, 16, 1
|
||||
type2bpp dd 8, 24, 32, 15, 16, 1, 9 ;,16
|
||||
img._.do_rgb.handlers:
|
||||
dd img._.do_rgb.bpp8
|
||||
dd img._.do_rgb.bpp8i
|
||||
dd img._.do_rgb.bpp24
|
||||
dd img._.do_rgb.bpp32
|
||||
dd img._.do_rgb.bpp15.amd ; can be overwritten in lib_init
|
||||
dd img._.do_rgb.bpp16.amd ; can be overwritten in lib_init
|
||||
dd img._.do_rgb.bpp1
|
||||
dd img._.do_rgb.bpp8g
|
||||
; dd img._.do_rgb.bpp8a
|
||||
|
||||
img.flip.layer.handlers_horz:
|
||||
dd img.flip.layer.bpp8_horz
|
||||
dd img.flip.layer.bpp8ig_horz
|
||||
dd img.flip.layer.bpp24_horz
|
||||
dd img.flip.layer.bpp32_horz
|
||||
dd img.flip.layer.bpp1x_horz
|
||||
dd img.flip.layer.bpp1x_horz
|
||||
dd img.flip.layer.bpp1_horz
|
||||
dd img.flip.layer.bpp8ig_horz
|
||||
; dd img.flip.layer.bpp8a_horz
|
||||
|
||||
;;================================================================================================;;
|
||||
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||
|
@ -69,13 +69,15 @@ ends
|
||||
|
||||
; values for Image.Type
|
||||
; must be consecutive to allow fast switch on Image.Type in support functions
|
||||
Image.bpp8 = 1
|
||||
Image.bpp8i = 1 ; indexed
|
||||
Image.bpp24 = 2
|
||||
Image.bpp32 = 3
|
||||
Image.bpp15 = 4
|
||||
Image.bpp16 = 5
|
||||
Image.bpp1 = 6
|
||||
Image.bpp4 = 7
|
||||
Image.bpp8g = 7 ; grayscale
|
||||
Image.bpp8a = 8 ; grayscale with alpha channel; application layer only!!! kernel doesn't handle this image type, libimg can only create and destroy such images
|
||||
;Image.bpp4 = 9
|
||||
|
||||
; bits in Image.Flags
|
||||
Image.IsAnimated = 1
|
||||
|
@ -157,7 +157,7 @@ endl
|
||||
|
||||
.indexed:
|
||||
|
||||
stdcall img.create, eax, ebx, Image.bpp8
|
||||
stdcall img.create, eax, ebx, Image.bpp8i
|
||||
mov [retvalue], eax
|
||||
test eax, eax
|
||||
jz .quit
|
||||
|
@ -239,7 +239,7 @@ end virtual
|
||||
mov al, Image.bpp32
|
||||
cmp [.color_type], 6
|
||||
jz @f
|
||||
mov al, Image.bpp8
|
||||
mov al, Image.bpp8i
|
||||
@@:
|
||||
stdcall img.create, [.width], [.height], eax
|
||||
test eax, eax
|
||||
|
@ -1,17 +1,10 @@
|
||||
.pgm:
|
||||
stdcall img.create, [width], [height], Image.bpp8
|
||||
stdcall img.create, [width], [height], Image.bpp8g
|
||||
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]
|
||||
|
@ -204,7 +204,7 @@ endl
|
||||
mov eax, [ebx + Image.Type]
|
||||
cmp eax, Image.bpp1
|
||||
je .pbm
|
||||
cmp eax, Image.bpp8
|
||||
cmp eax, Image.bpp8g
|
||||
je .pgm
|
||||
cmp eax, Image.bpp24
|
||||
je .ppm
|
||||
|
@ -18,7 +18,6 @@
|
||||
;;================================================================================================;;
|
||||
|
||||
include 'tiff.inc'
|
||||
;include '../../../../../system/board/trunk/debug.inc'
|
||||
|
||||
;;================================================================================================;;
|
||||
proc img.is.tiff _data, _length ;/////////////////////////////////////////////////////////////////;;
|
||||
@ -185,7 +184,7 @@ endl
|
||||
|
||||
mov ecx, [edx + Image.Type]
|
||||
dec ecx
|
||||
jz .bpp8
|
||||
jz .bpp8i
|
||||
dec ecx
|
||||
jz .bpp24
|
||||
dec ecx
|
||||
@ -196,7 +195,9 @@ endl
|
||||
dec ecx
|
||||
jz .bpp1
|
||||
dec ecx
|
||||
jz .bpp4
|
||||
jz .bpp8g
|
||||
dec ecx
|
||||
jz .bpp8a
|
||||
;error report!!
|
||||
|
||||
.bpp1:
|
||||
@ -216,10 +217,7 @@ endl
|
||||
.bpp4:
|
||||
jmp .common
|
||||
|
||||
.bpp8:
|
||||
cmp [ebx + tiff_extra.palette], 0
|
||||
je .bpp8.grayscale
|
||||
|
||||
.bpp8i:
|
||||
mov esi, [ebx + tiff_extra.palette]
|
||||
mov ah, 2
|
||||
.bpp8.channel:
|
||||
@ -238,13 +236,10 @@ endl
|
||||
dec ah
|
||||
jns .bpp8.channel
|
||||
jmp .common
|
||||
.bpp8.grayscale:
|
||||
mov edi, [edx + Image.Palette]
|
||||
mov eax, 0xff000000
|
||||
@@:
|
||||
stosd
|
||||
add eax, 0x00010101
|
||||
jnc @b
|
||||
.bpp8g:
|
||||
jmp .common
|
||||
|
||||
.bpp8a:
|
||||
jmp .common
|
||||
|
||||
.bpp16:
|
||||
@ -346,8 +341,9 @@ endl
|
||||
|
||||
|
||||
.decoded:
|
||||
.check1:
|
||||
cmp [ebx + tiff_extra.samples_per_pixel], 3
|
||||
jne .pop_quit
|
||||
jne .check2
|
||||
mov eax, [retvalue]
|
||||
mov esi, [eax + Image.Data]
|
||||
mov edi, [eax + Image.Data]
|
||||
@ -360,7 +356,26 @@ endl
|
||||
add edi, 2
|
||||
dec ecx
|
||||
jnz @b
|
||||
|
||||
jmp .pop_quit
|
||||
.check2:
|
||||
mov ebx, [retvalue]
|
||||
cmp [ebx + Image.Type], Image.bpp8a
|
||||
jne .pop_quit
|
||||
stdcall tiff._.pack_8a, ebx
|
||||
mov [ebx + Image.Type], Image.bpp8g
|
||||
; mov eax, [ebx + Image.Width]
|
||||
; imul eax, [ebx + Image.Height]
|
||||
; mov ecx, eax
|
||||
; add ecx, [ebx + Image.Data]
|
||||
; mov [ebx + Image.Palette], ecx
|
||||
; add eax, 256*4
|
||||
; stdcall [mem.realloc], [ebx + Image.Data], eax
|
||||
; mov edi, [ebx + Image.Palette]
|
||||
; mov eax, 0xff000000
|
||||
; @@:
|
||||
; stosd
|
||||
; add eax, 0x00010101
|
||||
; jnc @b
|
||||
|
||||
.pop_quit:
|
||||
pop esi
|
||||
@ -386,13 +401,13 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
add edx, 8
|
||||
dec ecx
|
||||
jnz .tag
|
||||
.tag_default: ; unknown/unsupported/uninteresting/unimportant
|
||||
.tag_default: ; unknown/unsupported/uninteresting/unimportant
|
||||
lodsw
|
||||
lodsd
|
||||
lodsd
|
||||
jmp .quit ; just skip it
|
||||
jmp .quit ; just skip it
|
||||
|
||||
.tag_100:
|
||||
.tag_100: ; ImageWidth
|
||||
cmp ax, TIFF.IFDE_TYPE.SHORT
|
||||
jne @f
|
||||
lodsd
|
||||
@ -411,7 +426,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
@@:
|
||||
jmp .quit
|
||||
|
||||
.tag_101:
|
||||
.tag_101: ; ImageHeight
|
||||
cmp ax, TIFF.IFDE_TYPE.SHORT
|
||||
jne @f
|
||||
lodsd
|
||||
@ -430,7 +445,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
@@:
|
||||
jmp .quit
|
||||
|
||||
.tag_102:
|
||||
.tag_102: ; BitsPerSample
|
||||
lodsd_
|
||||
imul eax, TIFF.IFDE_TYPE_LENGTH.SHORT
|
||||
cmp eax, 4
|
||||
@ -451,7 +466,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
mov [ebx + tiff_extra.bits_per_sample], eax
|
||||
jmp .quit
|
||||
|
||||
.tag_103:
|
||||
.tag_103: ; Compression
|
||||
cmp ax, TIFF.IFDE_TYPE.SHORT
|
||||
jne @f
|
||||
lodsd
|
||||
@ -463,7 +478,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
@@:
|
||||
jmp .quit
|
||||
|
||||
.tag_106:
|
||||
.tag_106: ; PhotometricInterpretation
|
||||
cmp ax, TIFF.IFDE_TYPE.SHORT
|
||||
jne @f
|
||||
lodsd
|
||||
@ -476,7 +491,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
|
||||
jmp .quit
|
||||
|
||||
.tag_111:
|
||||
.tag_111: ; StripOffsets
|
||||
cmp ax, TIFF.IFDE_TYPE.SHORT
|
||||
jne @f
|
||||
mov [ebx + tiff_extra.strip_offsets_length], TIFF.IFDE_TYPE_LENGTH.SHORT
|
||||
@ -498,7 +513,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
mov [ebx + tiff_extra.strip_offsets], eax
|
||||
jmp .quit
|
||||
|
||||
.tag_115:
|
||||
.tag_115: ; SamplesPerPixel
|
||||
lodsd_
|
||||
imul eax, TIFF.IFDE_TYPE_LENGTH.SHORT
|
||||
cmp eax, 4
|
||||
@ -514,7 +529,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
movzx eax, word[eax]
|
||||
jmp .quit
|
||||
|
||||
.tag_116:
|
||||
.tag_116: ; RowsPerStrip
|
||||
cmp ax, TIFF.IFDE_TYPE.SHORT
|
||||
jne @f
|
||||
lodsd
|
||||
@ -529,7 +544,7 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
mov [ebx + tiff_extra.rows_per_strip], eax
|
||||
jmp .quit
|
||||
|
||||
.tag_117:
|
||||
.tag_117: ; StripByteCounts
|
||||
cmp ax, TIFF.IFDE_TYPE.SHORT
|
||||
jne @f
|
||||
mov [ebx + tiff_extra.strip_byte_counts_length], TIFF.IFDE_TYPE_LENGTH.SHORT
|
||||
@ -550,12 +565,17 @@ proc tiff._.parse_IFDE _data, _endianness
|
||||
mov [ebx + tiff_extra.strip_byte_counts], eax
|
||||
jmp .quit
|
||||
|
||||
.tag_140:
|
||||
.tag_140: ; ColorMap
|
||||
lodsd
|
||||
lodsd_
|
||||
add eax, [_data]
|
||||
mov [ebx + tiff_extra.palette], eax
|
||||
jmp .quit
|
||||
.tag_152: ; ExtraSamples
|
||||
mov [ebx + tiff_extra.extra_samples], esi
|
||||
mov ecx, [ebx + tiff_extra.extra_samples_number]
|
||||
rep lodsw ; ignored
|
||||
jmp .quit
|
||||
|
||||
.quit:
|
||||
pop edi edx ebx
|
||||
@ -567,42 +587,51 @@ proc tiff._.define_image_type
|
||||
|
||||
xor eax, eax
|
||||
|
||||
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.RGB
|
||||
jne .not_full_color
|
||||
mov eax, -3
|
||||
add eax, [ebx + tiff_extra.samples_per_pixel]
|
||||
mov [ebx + tiff_extra.extra_samples_number], eax
|
||||
dec eax
|
||||
jns @f
|
||||
mov eax, Image.bpp24
|
||||
jmp .quit
|
||||
@@:
|
||||
dec eax
|
||||
jns @f
|
||||
mov eax, Image.bpp32
|
||||
; mov [ebx + tiff_extra.extra_samples_number], 0
|
||||
jmp .quit
|
||||
@@:
|
||||
.not_full_color: ; grayscale, indexed, bilevel
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 1
|
||||
jg .not_bilevel
|
||||
mov eax, Image.bpp1
|
||||
jmp .quit
|
||||
.not_bilevel:
|
||||
.not_bilevel: ; grayscale, indexed
|
||||
cmp [ebx + tiff_extra.palette], 0
|
||||
je .without_palette
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 4
|
||||
jne @f
|
||||
mov eax, Image.bpp4
|
||||
; mov eax, Image.bpp4
|
||||
jmp .quit
|
||||
@@:
|
||||
cmp [ebx + tiff_extra.bits_per_sample], 8
|
||||
jne @f
|
||||
mov eax, Image.bpp8
|
||||
mov eax, Image.bpp8i
|
||||
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
|
||||
.without_palette: ; grayscale
|
||||
mov eax, -1
|
||||
add eax, [ebx + tiff_extra.samples_per_pixel]
|
||||
mov [ebx + tiff_extra.extra_samples_number], eax
|
||||
dec eax
|
||||
jns @f
|
||||
mov eax, Image.bpp8g
|
||||
jmp .quit
|
||||
@@:
|
||||
mov eax, Image.bpp8a
|
||||
jmp .quit
|
||||
.quit:
|
||||
ret
|
||||
@ -830,6 +859,20 @@ proc tiff._.get_dword _endianness
|
||||
endp
|
||||
|
||||
|
||||
proc tiff._.pack_8a _img
|
||||
mov ebx, [_img]
|
||||
mov esi, [ebx + Image.Data]
|
||||
mov edi, esi
|
||||
mov ecx, [ebx + Image.Width]
|
||||
imul ecx, [ebx + Image.Height]
|
||||
@@:
|
||||
lodsw
|
||||
stosb
|
||||
dec ecx
|
||||
jnz @b
|
||||
ret
|
||||
endp
|
||||
|
||||
;;================================================================================================;;
|
||||
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||
;;================================================================================================;;
|
||||
@ -848,6 +891,7 @@ tiff.IFDE_tag_table.begin:
|
||||
.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
|
||||
.tag_152: dd 0x0152, tiff._.parse_IFDE.tag_152 ; extra samples
|
||||
tiff.IFDE_tag_table.end:
|
||||
|
||||
include 'huffman.asm' ; huffman trees for ccitt1d compression method
|
||||
|
@ -38,6 +38,8 @@ struct tiff_extra
|
||||
strip_byte_counts_length rd 1
|
||||
palette rd 1 ; SHORT
|
||||
palette_size rd 1 ; in colors, not samples
|
||||
extra_samples rd 1 ; pointer to array of SHORTs
|
||||
extra_samples_number rd 1
|
||||
ends
|
||||
|
||||
|
||||
|
@ -387,13 +387,15 @@ proc xcf._.composite_rgb_04 ; Screen
|
||||
|
||||
punpcklbw mm2, mm0
|
||||
punpcklbw mm3, mm0
|
||||
movq mm5, [xcf._.mmx_00ff]
|
||||
movq mm4, mm5
|
||||
movq mm4, [xcf._.mmx_00ff]
|
||||
movq mm5, mm4
|
||||
psubw mm5, mm3
|
||||
movq mm3, mm4
|
||||
psubw mm4, mm2
|
||||
psubw mm3, mm5
|
||||
pmullw mm3, mm4
|
||||
psrlw mm3, 8
|
||||
paddw mm3, mm5
|
||||
pmullw mm4, mm5
|
||||
psrlw mm4, 8
|
||||
psubw mm3, mm4
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
|
@ -583,13 +583,14 @@ proc xcf._.composite_rgb_04 ; Screen
|
||||
|
||||
punpcklbw xmm2, xmm0
|
||||
punpcklbw xmm3, xmm0
|
||||
movdqu xmm5, xword[xcf._.xmm_00ff]
|
||||
movdqa xmm4, xmm5
|
||||
movdqu xmm4, xword[xcf._.xmm_00ff]
|
||||
movdqa xmm5, xmm4
|
||||
psubw xmm5, xmm3
|
||||
movdqa xmm3, xmm4
|
||||
psubw xmm4, xmm2
|
||||
psubw xmm3, xmm5
|
||||
pmullw xmm3, xmm4
|
||||
psrlw xmm3, 8
|
||||
paddw xmm3, xmm5
|
||||
pmullw xmm4, xmm5
|
||||
psrlw xmm4, 8
|
||||
psubw xmm3, xmm4
|
||||
ret
|
||||
endp
|
||||
|
||||
|
@ -130,7 +130,7 @@ endl
|
||||
|
||||
.process_grayscale:
|
||||
|
||||
stdcall img.create, ebx, edx, Image.bpp8
|
||||
stdcall img.create, ebx, edx, Image.bpp8i
|
||||
mov [retvalue], eax
|
||||
test eax, eax
|
||||
jz .error
|
||||
@ -160,7 +160,7 @@ endl
|
||||
|
||||
.process_indexed:
|
||||
|
||||
stdcall img.create, ebx, edx, Image.bpp8
|
||||
stdcall img.create, ebx, edx, Image.bpp8i
|
||||
mov [retvalue], eax
|
||||
test eax, eax
|
||||
jz .error
|
||||
@ -217,7 +217,7 @@ endl
|
||||
dec [layer_count]
|
||||
jnz .still
|
||||
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
jne .quit
|
||||
stdcall xcf._.pack_8a, ebx
|
||||
jmp .quit
|
||||
@ -372,7 +372,7 @@ endl
|
||||
bswap eax
|
||||
add esi, eax
|
||||
|
||||
stdcall img.create, [channel_width], [channel_height], Image.bpp8
|
||||
stdcall img.create, [channel_width], [channel_height], Image.bpp8i
|
||||
mov ebx, eax
|
||||
test ebx, ebx
|
||||
jz .quit
|
||||
@ -443,7 +443,7 @@ endl
|
||||
mov [layer_height], eax
|
||||
lodsd
|
||||
bswap eax
|
||||
mov edx, Image.bpp16
|
||||
mov edx, Image.bpp8a
|
||||
mov [color_step], 1
|
||||
cmp eax, 2
|
||||
jge @f
|
||||
@ -899,7 +899,7 @@ endl
|
||||
imul eax, [img_y1]
|
||||
add eax, [img_x1]
|
||||
shl eax, 1
|
||||
cmp [edx + Image.Width], Image.bpp16
|
||||
cmp [edx + Image.Width], Image.bpp8a
|
||||
je @f
|
||||
shl eax, 1
|
||||
@@:
|
||||
@ -909,7 +909,7 @@ endl
|
||||
imul eax, [bottom_y1]
|
||||
add eax, [bottom_x1]
|
||||
shl eax, 1
|
||||
cmp [ebx + Image.Width], Image.bpp8
|
||||
cmp [ebx + Image.Width], Image.bpp8i
|
||||
je @f
|
||||
shl eax, 1
|
||||
@@:
|
||||
@ -919,7 +919,7 @@ endl
|
||||
mov eax, [edx + Image.Width]
|
||||
sub eax, [copy_width]
|
||||
shl eax, 1
|
||||
cmp [edx + Image.Width], Image.bpp16
|
||||
cmp [edx + Image.Width], Image.bpp8a
|
||||
je @f
|
||||
shl eax, 1
|
||||
@@:
|
||||
@ -928,7 +928,7 @@ endl
|
||||
mov eax, [ebx + Image.Width]
|
||||
sub eax, [copy_width]
|
||||
shl eax, 1
|
||||
cmp [ebx + Image.Width], Image.bpp8
|
||||
cmp [ebx + Image.Width], Image.bpp8i
|
||||
je @f
|
||||
shl eax, 1
|
||||
@@:
|
||||
@ -938,7 +938,7 @@ endl
|
||||
jne .not_first
|
||||
mov ecx, [copy_width]
|
||||
imul ecx, [copy_height]
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
je .bpp8a
|
||||
.bpp32:
|
||||
rep movsd
|
||||
@ -997,7 +997,7 @@ endl
|
||||
@@:
|
||||
|
||||
|
||||
cmp [ebx + Image.Type], Image.bpp8
|
||||
cmp [ebx + Image.Type], Image.bpp8i
|
||||
jne @f
|
||||
stdcall xcf._.merge_8a, [copy_width], [copy_height], [img_total_bpl], [bottom_total_bpl]
|
||||
jmp .done
|
||||
|
@ -71,7 +71,7 @@ endl
|
||||
xor eax,eax
|
||||
pushad
|
||||
cld ;paranoia
|
||||
stdcall img.create,256,192,Image.bpp8
|
||||
stdcall img.create,256,192,Image.bpp8i
|
||||
test eax,eax
|
||||
jz img.decode.z80.locret ;test if allocation failed
|
||||
mov [frame1],eax
|
||||
@ -101,7 +101,7 @@ endl
|
||||
.decode_z80_with_blinking:
|
||||
or ebx,0xFFFF0000 ;use DualStos
|
||||
mov ecx,eax ;eax still points to the first frame
|
||||
stdcall img.create,256,192,Image.bpp8
|
||||
stdcall img.create,256,192,Image.bpp8i
|
||||
test eax,eax
|
||||
jz img.decode.z80.failed
|
||||
mov [eax+Image.Previous],ecx
|
||||
|
Loading…
Reference in New Issue
Block a user