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
 
/programs/media/zsea/plugins/scaling/scaling.asm
38,20 → 38,28
;---------------------------------------------------------------------
START:
pushad
mov edi,dword [esp+56]
mov esi,dword [esp+52]
mov edx,dword [esp+48]
mov ecx,dword [esp+44]
mov ebx,dword [esp+40]
mov eax,dword [esp+36]
mov eax,dword [esp+60] ; eax - crop size
mov ebx,eax
and eax,0xffff
shr ebx,16
mov [crop_x],ebx
mov [crop_y],eax
mov edi,dword [esp+56] ; edi - background color
mov esi,dword [esp+52] ; esi - filtering
mov edx,dword [esp+48] ; edx - scaling mode
mov ecx,dword [esp+44] ; ecx - start_coordinates
mov ebx,dword [esp+40] ; ebx - new_size
mov eax,dword [esp+36] ; eax - convert data table
mov [pointer],eax
test bx,bx
jnz @f
inc bx
@@:
ror ebx,16
test bx,bx
jnz @f
inc bx
@@:
rol ebx,16
108,6 → 116,16
imul ebx,[bytes_to_pixel]
mov [size_x],ebx
mov eax,[crop_y]
test eax,eax
jz @f
mov [y],eax
@@:
mov eax,[crop_x]
test eax,eax
jz @f
mov [x],eax
@@:
mov eax,100
shl eax,12
mov ebx,[scaling_mode]
120,13 → 138,7
mov [scaling_delta],eax
call .get_memory
cmp [scaling_mode],0
jne @f
call .scaling
jmp .ret_ok
@@:
call .scaling_2
;---------------------------------------------------------------------
.ret_ok:
mcall 68,13,[area_for_x]
147,27 → 159,10
; mov [ebx+44],eax
.exit:
popad
ret 24
ret 28
;---------------------------------------------------------------------
align 4
.scaling:
xor ecx,ecx
.y:
xor ebx,ebx
;-------------------------
.x:
call ebp
inc ebx
cmp bx,[new_size.x1]
jb .x
;-------------------------
inc ecx
cmp cx,[new_size.y1]
jb .y
ret
;---------------------------------------------------------------------
align 4
.scaling_2:
xor eax,eax
mov ax,[start_coordinates.y]
imul eax,[size_x]
274,10 → 269,10
align 4
.new_y:
mov [temp_y],eax
 
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
;--------------------------------
push ebx
290,10 → 285,13
pop ebx
;--------------------------------
jmp .ex_1
;--------------------------------
align 4
@@:
imul eax,dword [y]
;--------------------------------
imul eax,dword [y]
align 4
@@:
mov bx,word [new_size.y1]
;--------------------------------
align 4
301,6 → 299,7
test ebx,ebx
jnz @f
inc ebx
;--------------------------------
align 4
@@:
xor edx,edx
356,6 → 355,9
align 4
@@:
imul eax,dword [x]
;--------------------------------
align 4
@@:
mov bx,word [new_size.x1]
;--------------------------------
align 4
404,7 → 406,6
;---------------------------------------------------------------------
align 4
.get_memory:
 
xor ecx,ecx
mov cx,[new_size.x1]
shl ecx,3
422,9 → 423,62
mov eax,3
@@:
imul ecx,eax
mov edx,ecx
add ecx,44
mov eax,[image_file]
add ecx,[eax+24] ;palette area size
mcall 68,12
mov [raw_area],eax
mov edi,eax
; create RAW header
push esi
mov esi,[image_file]
mov ecx,44/4
cld
rep movsd ;copy the 3 first dword for the structure of RAW
mov edi,[raw_area]
movzx eax,word [new_size.x1]
mov [edi+4],eax
movzx eax,word [new_size.y1]
mov [edi+8],eax
mov [edi+32],edx ;rgb area size
xor eax,eax
mov [edi+36],eax ;transparency area pointer
mov [edi+40],eax ;transparency area size
cmp [filtering],eax ;0 or 1
je @f
 
mov [edi+20],eax ;palette area pointer
mov [edi+24],eax ;palette area size
mov [edi+28],dword 44 ;rgb area pointer
cmp [edi+12],dword 8 ;overall depth of the pixel
ja .not_overall_depth_8
mov [edi+12],dword 24 ;overall depth of the pixel
mov [edi+16],word 8 ;channel depth of the pixel
.not_overall_depth_8:
add edi,44
jmp .end
@@:
mov eax,[edi+24]
add edi,44
test eax,eax ;palette area is present?
jz @f
sub esi,44
mov ecx,[esi+24]
shr ecx,2
add esi,[esi+20]
cld
rep movsd ;copy palette area
@@:
 
.end:
pop esi
ret
;---------------------------------------------------------------------
include 'b_filter.inc'
432,7 → 486,7
align 4
EXPORTS:
dd szStart, START
dd szVersion, 0x00010002
dd szVersion, 0x00010003
dd 0
 
szStart db 'START',0
448,6 → 502,9
x: dd 0
y: dd 0
 
crop_x dd 0
crop_y dd 0
 
size_x dd 0
bytes_to_pixel dd 0