Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1958 → Rev 2163

/programs/media/zsea/plugins/convert/convert.asm
49,14 → 49,7
add esi,eax
mov edi,esi
mov ecx,[eax+32]
; xor ebx,ebx
; mov [raw_area],ebx
 
; mov ebx,[pointer]
; movzx eax,word [eax+18]
; mov [ebx+24],eax
; jmp .ret_ok
cmp [eax+16],word 16
je .16b
cmp [eax+12],dword 1
67,11 → 60,6
je .4b
;---------------------------------------------------------------------
.ret_ok:
; mov ebx,[pointer]
; mov eax,[raw_area]
; mov [ebx+20],eax ; store RAW pointer
; mov [ebx+24],ecx
 
mov ebx,[image_file]
cmp [ebx+18],word 2
jne @f
79,7 → 67,6
shr eax,1
mov [ebx+12],eax
@@:
popad
ret 4
;---------------------------------------------------------------------
90,7 → 77,6
mcall 68,20
mov [image_file],eax
 
mov ecx,[area_size]
mov eax,ecx
shr ecx,2
104,8 → 90,7
cld
rep movsd
mov ecx,[raw_area]
mcall 68,13
mcall 68,13,[raw_area]
mov eax,[image_file]
mov ebx,[pointer]
mov [ebx+4],eax
113,8 → 98,9
ret 4
;---------------------------------------------------------------------
.16b:
; eax - RAW image_file
cmp [eax+18],word 3
je @f ;.convert_16_in_8
je @f
cmp [eax+18],word 4
jne .16b_1
@@:
134,7 → 120,6
mov [eax+12],ebx
 
mov ebx,eax
; jmp .ret_ok
.convert_16_in_8: ; converting 16 bit sample to 8 bit
cld
158,11 → 143,13
@@:
dec ecx
jnz .convert_16_in_8
jmp .16b_end
;---------------------------------------------------------------------
.16b_1:
; eax - RAW image_file
cmp [eax+18],word 1
je @f ;.convert_16_in_8_1
je @f
cmp [eax+18],word 2
jne .16b_end
@@:
176,8 → 163,6
.convert_16_in_8_1:
cld
lodsw
; shr ax,8
; mov al,ah
stosb
dec ecx
jnz .convert_16_in_8_1
210,12 → 195,10
dec ecx
jnz .4b_1
jmp .less_8b ;.ret_ok
jmp .less_8b
;---------------------------------------------------------------------
.2b:
call .get_memory
; jmp .ret_ok
; shr ecx,1
mov edx,ebx
mov eax,ebx
shr ebx,2
259,7 → 242,7
dec ecx
jnz .2b_1
jmp .less_8b ;.ret_ok
jmp .less_8b
;---------------------------------------------------------------------
.1b:
call .get_memory
294,8 → 277,6
mov al,bl
shr al,7
; and al,1b
; shl eax,8
stosd
326,21 → 307,19
add edi,edx
dec ecx
jnz .1b_1
jmp .less_8b ;.ret_ok
 
jmp .less_8b
;---------------------------------------------------------------------
.get_memory:
; eax - RAW image_file
mov ebx,dword 8
mov [eax+16],bx
mov [eax+12],ebx
; mov esi,[eax+28]
; add esi,eax
; push ecx
mov ecx,[eax+4]
imul ecx,[eax+8]
push eax
mov [area_size],ecx
mcall 68,12
; pop ecx
mov [raw_area],eax
mov edi,eax
pop eax
365,11 → 344,33
imul ecx,[eax+8]
push eax ecx
lea ecx,[ecx*3]
mcall 68,12
mov edx,ecx
add ecx,44 ; header
mcall 68,12 ;get new RAW area
mov [raw_area],eax
mov edi,eax
push esi
mov esi,[image_file]
mov ecx,3
cld
rep movsd ;copy the 3 first dword for the structure of RAW
pop esi
sub edi,12
mov [edi+12],dword 24 ;overall depth of the pixel
mov [edi+16],word 8 ;channel depth of the pixel
xor eax,eax
mov [edi+20],eax ;palette area pointer
mov [edi+24],eax ;palette area size
mov [edi+28],dword 44 ;rgb area pointer
mov [edi+32],edx ;rgb area size
mov [edi+36],eax ;transparency area pointer
mov [edi+40],eax ;transparency area size
pop ecx eax
 
add edi,44
 
cmp [eax+12],dword 32
je .32b
cmp [eax+12],dword 16
385,12 → 386,10
mov [ebx+20],eax ; store RAW pointer
popad
ret 4
 
;---------------------------------------------------------------------
.32b:
cld
lodsd
stosw
shr eax,16
stosb
482,7 → 481,7
align 16
EXPORTS:
dd szStart, START
dd szVersion, 0x00010002
dd szVersion, 0x00010003
dd szConv_24b, Convert24b
dd 0