forked from KolibriOS/kolibrios
libimg:
add new image types (Image.bpp2i, Image.bpp4i); update to_rgb, flip, rotate functions decode .bpp2i and .bpp4i tiff images disable memory limit for decoded images git-svn-id: svn://kolibrios.org@3503 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5e88b2cdeb
commit
ccaf3a054b
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009, (c) dunkaist, 2011-2012 ///////;;
|
;;//// libimg.inc //// (c) mike.dld, 2007-2008, (c) diamond, 2009, (c) dunkaist, 2011-2013 ///////;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; This file is part of Common development libraries (Libs-Dev). ;;
|
;; This file is part of Common development libraries (Libs-Dev). ;;
|
||||||
@ -101,9 +101,9 @@ Image.bpp15 = 4
|
|||||||
Image.bpp16 = 5
|
Image.bpp16 = 5
|
||||||
Image.bpp1 = 6
|
Image.bpp1 = 6
|
||||||
Image.bpp8g = 7 ; grayscale
|
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.bpp2i = 8
|
||||||
;Image.bpp2 = 9
|
Image.bpp4i = 9
|
||||||
;Image.bpp4 = 10
|
Image.bpp8a = 10 ; grayscale with alpha channel; application layer only!!! kernel doesn't handle this image type, libimg can only create and destroy such images
|
||||||
|
|
||||||
; bits in Image.Flags
|
; bits in Image.Flags
|
||||||
Image.IsAnimated = 1
|
Image.IsAnimated = 1
|
||||||
|
@ -125,7 +125,7 @@ endl
|
|||||||
rep stosb
|
rep stosb
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jnz @b
|
jnz @b
|
||||||
stdcall pcx._.scanline_unpack, [width], [cur_scanline], [num_planes]
|
stdcall pcx._.scanline_unpack, [width], [bp_plane], [cur_scanline], [num_planes]
|
||||||
dec [height]
|
dec [height]
|
||||||
jnz .24bit.scanline
|
jnz .24bit.scanline
|
||||||
jmp .quit
|
jmp .quit
|
||||||
@ -244,7 +244,7 @@ proc pcx._.get_byte
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
proc pcx._.scanline_unpack _width, _scanline, _num_planes
|
proc pcx._.scanline_unpack _width, _bp_plane, _scanline, _num_planes
|
||||||
push esi
|
push esi
|
||||||
|
|
||||||
mov esi, [_scanline]
|
mov esi, [_scanline]
|
||||||
@ -262,8 +262,8 @@ proc pcx._.scanline_unpack _width, _scanline, _num_planes
|
|||||||
add edi, [_num_planes]
|
add edi, [_num_planes]
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz @b
|
jnz @b
|
||||||
bt dword[_width], 0
|
add esi, [_bp_plane]
|
||||||
adc esi, 0
|
sub esi, [_width]
|
||||||
dec ebx
|
dec ebx
|
||||||
jns .plane
|
jns .plane
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;;//// tiff.asm //// (c) dunkaist, 2011-2012 /////////////////////////////////////////////////////;;
|
;;//// tiff.asm //// (c) dunkaist, 2011-2013 /////////////////////////////////////////////////////;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; This file is part of Common development libraries (Libs-Dev). ;;
|
;; This file is part of Common development libraries (Libs-Dev). ;;
|
||||||
@ -207,10 +207,10 @@ endl
|
|||||||
je .bpp8g
|
je .bpp8g
|
||||||
cmp ecx, Image.bpp8a
|
cmp ecx, Image.bpp8a
|
||||||
je .bpp8a
|
je .bpp8a
|
||||||
; cmp ecx, Image.bpp2
|
cmp ecx, Image.bpp2i
|
||||||
; je .bpp2
|
je .bpp2i
|
||||||
; cmp ecx, Image.bpp4
|
cmp ecx, Image.bpp4i
|
||||||
; je .bpp4
|
je .bpp4i
|
||||||
jmp .quit
|
jmp .quit
|
||||||
;error report!!
|
;error report!!
|
||||||
|
|
||||||
@ -220,38 +220,24 @@ endl
|
|||||||
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.BLACK_IS_ZERO
|
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.BLACK_IS_ZERO
|
||||||
jne .bpp1.white_is_zero
|
jne .bpp1.white_is_zero
|
||||||
.bpp1.black_is_zero:
|
.bpp1.black_is_zero:
|
||||||
mov [edi], dword 0x00000000
|
mov [edi], dword 0xff000000
|
||||||
mov [edi + 4], dword 0x00ffffff
|
mov [edi + 4], dword 0xffffffff
|
||||||
jmp .common
|
jmp .common
|
||||||
.bpp1.white_is_zero:
|
.bpp1.white_is_zero:
|
||||||
mov [edi], dword 0x00ffffff
|
mov [edi], dword 0xffffffff
|
||||||
mov [edi + 4], dword 0x00000000
|
mov [edi + 4], dword 0xff000000
|
||||||
jmp .common
|
jmp .common
|
||||||
|
|
||||||
.bpp2:
|
.bpp2i:
|
||||||
|
stdcall tiff._.get_palette, 1 SHL 2, [_endianness]
|
||||||
jmp .common
|
jmp .common
|
||||||
|
|
||||||
.bpp4:
|
.bpp4i:
|
||||||
|
stdcall tiff._.get_palette, 1 SHL 4, [_endianness]
|
||||||
jmp .common
|
jmp .common
|
||||||
|
|
||||||
.bpp8i:
|
.bpp8i:
|
||||||
mov esi, [ebx + tiff_extra.palette]
|
stdcall tiff._.get_palette, 1 SHL 8, [_endianness]
|
||||||
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
|
jmp .common
|
||||||
.bpp8g:
|
.bpp8g:
|
||||||
jmp .common
|
jmp .common
|
||||||
@ -634,9 +620,6 @@ proc tiff._.parse_IFDE _data, _endianness
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
lodsw_
|
lodsw_
|
||||||
mov [ebx + tiff_extra.planar_configuration], eax
|
mov [ebx + tiff_extra.planar_configuration], eax
|
||||||
;debug_print 'planar_configuration: '
|
|
||||||
;debug_print_dec eax
|
|
||||||
;newline
|
|
||||||
lodsw
|
lodsw
|
||||||
@@:
|
@@:
|
||||||
jmp .quit
|
jmp .quit
|
||||||
@ -676,7 +659,7 @@ proc tiff._.define_image_type
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
|
||||||
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.RGB
|
cmp [ebx + tiff_extra.photometric], TIFF.PHOTOMETRIC.RGB
|
||||||
jne .not_full_color
|
jne .palette_bilevel_grayscale
|
||||||
mov eax, -3
|
mov eax, -3
|
||||||
add eax, [ebx + tiff_extra.samples_per_pixel]
|
add eax, [ebx + tiff_extra.samples_per_pixel]
|
||||||
mov [ebx + tiff_extra.extra_samples_number], eax
|
mov [ebx + tiff_extra.extra_samples_number], eax
|
||||||
@ -691,17 +674,17 @@ proc tiff._.define_image_type
|
|||||||
; mov [ebx + tiff_extra.extra_samples_number], 0
|
; mov [ebx + tiff_extra.extra_samples_number], 0
|
||||||
jmp .quit
|
jmp .quit
|
||||||
@@:
|
@@:
|
||||||
.not_full_color: ; grayscale, indexed, bilevel
|
.palette_bilevel_grayscale:
|
||||||
cmp [ebx + tiff_extra.bits_per_sample], 1
|
|
||||||
jg .not_bilevel
|
|
||||||
mov eax, Image.bpp1
|
|
||||||
jmp .quit
|
|
||||||
.not_bilevel: ; grayscale, indexed
|
|
||||||
cmp [ebx + tiff_extra.palette], 0
|
cmp [ebx + tiff_extra.palette], 0
|
||||||
je .without_palette
|
je .bilevel_grayscale
|
||||||
|
cmp [ebx + tiff_extra.bits_per_sample], 2
|
||||||
|
jg @f
|
||||||
|
mov eax, Image.bpp2i
|
||||||
|
jmp .quit
|
||||||
|
@@:
|
||||||
cmp [ebx + tiff_extra.bits_per_sample], 4
|
cmp [ebx + tiff_extra.bits_per_sample], 4
|
||||||
jne @f
|
jg @f
|
||||||
; mov eax, Image.bpp4
|
mov eax, Image.bpp4i
|
||||||
jmp .quit
|
jmp .quit
|
||||||
@@:
|
@@:
|
||||||
cmp [ebx + tiff_extra.bits_per_sample], 8
|
cmp [ebx + tiff_extra.bits_per_sample], 8
|
||||||
@ -710,12 +693,16 @@ proc tiff._.define_image_type
|
|||||||
jmp .quit
|
jmp .quit
|
||||||
@@:
|
@@:
|
||||||
jmp .quit
|
jmp .quit
|
||||||
.without_palette: ; grayscale
|
.bilevel_grayscale:
|
||||||
mov eax, -1
|
cmp [ebx + tiff_extra.bits_per_sample], 1
|
||||||
add eax, [ebx + tiff_extra.samples_per_pixel]
|
jg .grayscale
|
||||||
mov [ebx + tiff_extra.extra_samples_number], eax
|
mov eax, Image.bpp1
|
||||||
dec eax
|
jmp .quit
|
||||||
jns @f
|
.grayscale:
|
||||||
|
cmp [ebx + tiff_extra.bits_per_sample], 8
|
||||||
|
jne .quit
|
||||||
|
cmp [ebx + tiff_extra.samples_per_pixel], 1
|
||||||
|
jne @f
|
||||||
mov eax, Image.bpp8g
|
mov eax, Image.bpp8g
|
||||||
jmp .quit
|
jmp .quit
|
||||||
@@:
|
@@:
|
||||||
@ -1260,6 +1247,28 @@ endl
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
|
proc tiff._.get_palette _num_colors, _endianness
|
||||||
|
mov esi, [ebx + tiff_extra.palette]
|
||||||
|
push ebx
|
||||||
|
mov ebx, 2
|
||||||
|
.bpp2.channel:
|
||||||
|
mov edi, ebx
|
||||||
|
add edi, [edx + Image.Palette]
|
||||||
|
mov ecx, [_num_colors]
|
||||||
|
@@:
|
||||||
|
lodsw_
|
||||||
|
shr eax, 8
|
||||||
|
stosb
|
||||||
|
add edi, 3
|
||||||
|
dec ecx
|
||||||
|
jnz @b
|
||||||
|
dec ebx
|
||||||
|
jns .bpp2.channel
|
||||||
|
pop ebx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
|
Loading…
Reference in New Issue
Block a user