Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 1950 → Rev 1951

/programs/media/zsea/plugins/scaling/b_filter.inc
0,0 → 1,1001
;---------------------------------------------------------------------
align 4
.check_filtering_24:
cmp [filtering],0
je .24_1
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_y_24 ;.24_1
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
lea eax,[eax*3]
cmp ebx,eax
pop eax
jae .last_x_24 ;.24_1
 
; mov ebx,[esp+4]
;; test ebx,ebx
;; jz .24_1
; inc ebx
; cmp bx,[new_size.y1]
; jae .last_y ;.24_1
 
; mov ebx,[esp]
;; test ebx,ebx
;; jz .24_1
; inc ebx
; cmp bx,[new_size.x1]
; jae .last_x ;.24_1
 
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[ecx+3]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
mov eax,[ecx]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[ecx+3]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
.24_1:
ret
;---------------------------------------------------------------------
align 4
.last_y_24:
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
lea eax,[eax*3]
cmp ebx,eax
pop eax
jae .last_x_y_24 ;.24_1
mov ebx,[esp+4]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.x1]
jae .last_x_y_24 ;.24_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[ecx+3]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
;---------------------------------------
ret
;---------------------------------------------------------------------
align 4
.last_x_24:
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_x_y_24 ;.24_1
mov ebx,[esp+8]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.y1]
jae .last_x_y_24 ;.24_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
mov eax,[ecx]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
ret
;---------------------------------------------------------------------
align 4
.last_x_y_24:
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
ret
;---------------------------------------------------------------------
align 4
.copy_RGB_to_RGB1:
mov eax,[B_sample]
mov [B_sample_1],eax
mov eax,[G_sample]
mov [G_sample_1],eax
mov eax,[R_sample]
mov [R_sample_1],eax
ret
;---------------------------------------
align 4
.mix_RGB:
xor ebx,ebx
mov bl,al
imul ebx,edx
add [B_sample],ebx
shr eax,8
xor ebx,ebx
mov bl,al
imul ebx,edx
add [G_sample],ebx
shr eax,8
xor ebx,ebx
mov bl,al
imul ebx,edx
add [R_sample],ebx
ret
;---------------------------------------
align 4
.mix_RGB_16:
xor ebx,ebx
mov bl,al
and bl,0x1F
imul ebx,edx
add [B_sample],ebx
shr eax,5
xor ebx,ebx
mov bl,al
cmp [resolution],16
jne @f
and bl,0x3F
shr eax,6
jmp .mix_RGB_16_G_sample
align 4
@@:
and bl,0x1F
shr eax,5
align 4
.mix_RGB_16_G_sample:
imul ebx,edx
add [G_sample],ebx
xor ebx,ebx
mov bl,al
and bl,0x1F
imul ebx,edx
add [R_sample],ebx
ret
;---------------------------------------
align 4
.clear_RGB:
xor ebx,ebx
mov [B_sample],ebx
mov [G_sample],ebx
mov [R_sample],ebx
ret
;---------------------------------------
align 4
.RGB_to_EAX:
mov eax,[R_sample]
shr eax,7
and eax,0xff
shl eax,8
mov ebx,[G_sample]
shr ebx,7
mov al,bl
shl eax,8
mov ebx,[B_sample]
shr ebx,7
mov al,bl
ret
;---------------------------------------
align 4
.RGB_to_EAX_16:
mov eax,[R_sample]
shr eax,7
and eax,0x1F
mov ebx,[G_sample]
shr ebx,7
cmp [resolution],16
jne @f
shl eax,6
and ebx,0x3F
jmp .RGB_to_EAX_16_G_sample
align 4
@@:
shl eax,5
and ebx,0x1F
align 4
.RGB_to_EAX_16_G_sample:
add eax,ebx
shl eax,5
mov ebx,[B_sample]
shr ebx,7
and ebx,0x1F
add eax,ebx
ret
;---------------------------------------
align 4
.RGB_to_EAX1:
mov eax,[R_sample_1]
shr eax,7
and eax,0xff
shl eax,8
mov ebx,[G_sample_1]
shr ebx,7
mov al,bl
shl eax,8
mov ebx,[B_sample_1]
shr ebx,7
mov al,bl
ret
;---------------------------------------
align 4
.RGB_to_EAX1_16:
mov eax,[R_sample_1]
shr eax,7
and eax,0x1F
mov ebx,[G_sample_1]
shr ebx,7
cmp [resolution],16
jne @f
shl eax,6
and ebx,0x3F
jmp .RGB_to_EAX1_16_G_sample
align 4
@@:
shl eax,5
and ebx,0x1F
align 4
.RGB_to_EAX1_16_G_sample:
add eax,ebx
shl eax,5
mov ebx,[B_sample_1]
shr ebx,7
and ebx,0x1F
add eax,ebx
ret
;---------------------------------------------------------------------
align 4
.check_filtering_32:
cmp [filtering],0
je .32_1
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_y_32 ;.24_1
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
shl eax,2
cmp ebx,eax
pop eax
jae .last_x_32 ;.24_1
 
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[ecx+4]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
mov eax,[ecx]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[ecx+4]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
.32_1:
ret
;---------------------------------------------------------------------
align 4
.last_y_32:
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
shl eax,2
cmp ebx,eax
pop eax
jae .last_x_y_32 ;.32_1
mov ebx,[esp+4]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.x1]
jae .last_x_y_32 ;.32_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[ecx+4]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
ret
;---------------------------------------------------------------------
align 4
.last_x_32:
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_x_y_32 ;.32_1
mov ebx,[esp+8]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.y1]
jae .last_x_y_32 ;.32_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
mov eax,[ecx]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
ret
;---------------------------------------------------------------------
align 4
.last_x_y_32:
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
ret
;---------------------------------------------------------------------
align 4
.check_filtering_16:
cmp [filtering],0
je .16_1
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_y_16 ;.24_1
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
shl eax,1
cmp ebx,eax
pop eax
jae .last_x_16 ;.24_1
 
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
xor eax,eax
mov ax,[ecx+2]
call .mix_RGB_16
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
xor eax,eax
mov ax,[ecx]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
xor eax,eax
mov ax,[ecx+2]
call .mix_RGB_16
call .RGB_to_EAX_16
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB_16
;----------------------------
call .RGB_to_EAX1_16
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB_16
call .RGB_to_EAX_16
.16_1:
ret
;---------------------------------------------------------------------
align 4
.last_y_16:
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
shl eax,1
cmp ebx,eax
pop eax
jae .last_x_y_16 ;.16_1
mov ebx,[esp+4]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.x1]
jae .last_x_y_16 ;.16_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
xor eax,eax
mov ax,[ecx+2]
call .mix_RGB_16
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
and eax,0xffff
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
mov eax,[background_color]
and eax,0xffff
call .mix_RGB_16
call .RGB_to_EAX_16
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB_16
;----------------------------
call .RGB_to_EAX1_16
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB_16
call .RGB_to_EAX_16
ret
;---------------------------------------------------------------------
align 4
.last_x_16:
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_x_y_16 ;.16_1
mov ebx,[esp+8]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.y1]
jae .last_x_y_16 ;.16_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
mov eax,[background_color]
and eax,0xffff
call .mix_RGB_16
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
xor eax,eax
mov ax,[ecx]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
mov eax,[background_color]
and eax,0xffff
call .mix_RGB_16
call .RGB_to_EAX_16
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB_16
;----------------------------
call .RGB_to_EAX1_16
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB_16
call .RGB_to_EAX_16
ret
;---------------------------------------------------------------------
align 4
.last_x_y_16:
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
mov eax,[background_color]
and eax,0xffff
call .mix_RGB_16
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
and eax,0xffff
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB_16
mov edx,[next_pixel_x]
mov eax,[background_color]
and eax,0xffff
call .mix_RGB_16
call .RGB_to_EAX_16
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB_16
;----------------------------
call .RGB_to_EAX1_16
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB_16
call .RGB_to_EAX_16
ret
;---------------------------------------------------------------------
align 4
.get_palette:
shl eax,2
add eax,[palette]
mov eax,[eax]
ret
;---------------------------------------------------------------------
align 4
.check_filtering_8:
xor eax,eax
mov al,[ecx]
call .get_palette
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_y_8
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
cmp ebx,eax
pop eax
jae .last_x_8
 
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
xor eax,eax
mov al,[ecx+1]
call .get_palette
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
xor eax,eax
mov al,[ecx]
call .get_palette
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
xor eax,eax
mov al,[ecx+1]
call .get_palette
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
.8_1:
ret
;---------------------------------------------------------------------
align 4
.last_y_8:
mov ebx,[temp_x1]
push eax
mov eax,[x]
dec eax
cmp ebx,eax
pop eax
jae .last_x_y_8 ;.8_1
mov ebx,[esp+4]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.x1]
jae .last_x_y_8 ;.8_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
xor eax,eax
mov al,[ecx+1]
call .get_palette
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
;---------------------------------------
ret
;---------------------------------------------------------------------
align 4
.last_x_8:
mov ebx,[temp_y1]
inc ebx
cmp ebx,[y]
jae .last_x_y_8 ;.8_1
mov ebx,[esp+8]
; test ebx,ebx
; jz .24_1
inc ebx
cmp bx,[new_size.y1]
jae .last_x_y_8 ;.8_1
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
add ecx,[size_x]
xor eax,eax
mov al,[ecx]
call .get_palette
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
 
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
ret
;---------------------------------------------------------------------
align 4
.last_x_y_8:
;----------------------------
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
call .mix_RGB
;----------------------------
call .copy_RGB_to_RGB1
;----------------------------
mov eax,[background_color]
call .clear_RGB
mov edx,128 ;100
sub edx,[next_pixel_x]
call .mix_RGB
mov edx,[next_pixel_x]
mov eax,[background_color]
 
call .mix_RGB
call .RGB_to_EAX
call .clear_RGB
mov edx,[next_pixel_y]
call .mix_RGB
;----------------------------
call .RGB_to_EAX1
;----------------------------
mov edx,128 ;100
sub edx,[next_pixel_y]
call .mix_RGB
call .RGB_to_EAX
ret
;---------------------------------------------------------------------
/programs/media/zsea/plugins/scaling/build.bat
0,0 → 1,3
@fasm -m 16384 scaling.asm scaling.obj
@kpack scaling.obj
@pause
/programs/media/zsea/plugins/scaling/build.sh
0,0 → 1,10
#!/bin/bash
# This script does for Linux the same as build.bat for DOS,
# it compiles the current KolibriOS applications
 
fasm -m 16384 scaling.asm scaling.obj
kpack scaling.obj
exit 0
 
 
 
/programs/media/zsea/plugins/scaling/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
;struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
;struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/programs/media/zsea/plugins/scaling/scaling.asm
0,0 → 1,481
;*****************************************************************************
; Scaling RAW image plugin - for zSea image viewer
; Copyright (c) 2009 - 2011, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
; Scaling 32b, 24b, 16b, 8b
 
format MS COFF
 
public EXPORTS
 
section '.flat' code readable align 16
 
include 'macros.inc'
include '../../../../macros.inc'
;---------------------------------------------------------------------
START:
pushad
mov [pointer],eax
test bx,bx
jnz @f
inc bx
@@:
ror ebx,16
test bx,bx
jnz @f
inc bx
@@:
rol ebx,16
mov [new_size],ebx
mov [start_coordinates],ecx
mov [scaling_mode],edx
mov [filtering],esi
mov [background_color],edi
mov eax,[eax+4]
mov [image_file],eax
 
mov esi,[eax+28]
add esi,eax
mov ebx,[eax+20]
add ebx,eax
mov [palette],ebx
mov ebx,[eax+12]
mov [resolution],ebx
cmp ebx,32
jne @f
mov ebp,dword START.32
jmp .1
@@:
cmp ebx,24
jne @f
mov ebp,dword START.24
jmp .1
@@:
cmp ebx,16
jne @f
mov ebp,dword START.16
jmp .1
@@:
cmp ebx,15
jne @f
inc ebx
mov ebp,dword START.16
jmp .1
@@:
cmp ebx,8
jne @f
mov ebp,dword START.8
@@:
.1:
shr ebx,3
mov [bytes_to_pixel],ebx
mov ebx,[eax+8]
mov [y],ebx
mov ebx,[eax+4]
mov [x],ebx
imul ebx,[bytes_to_pixel]
mov [size_x],ebx
mov eax,100
shl eax,12
mov ebx,[scaling_mode]
test ebx,ebx
jnz @f
inc ebx
@@:
xor edx,edx
div ebx
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]
mov ebx,[pointer]
mov eax,[raw_area]
mov [ebx+20],eax ; store RAW pointer
; movzx eax,word [new_size.x1]
; mov [ebx+24],esi ;eax
; movzx eax,word [new_size.y1]
; mov [ebx+28],eax
; mov eax,[size_x]
; mov [ebx+32],eax
; mov eax,[bytes_to_pixel]
; mov [ebx+36],eax
; mov eax,[x]
; mov [ebx+40],eax
; mov eax,[y]
; mov [ebx+44],eax
.exit:
popad
ret
;---------------------------------------------------------------------
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]
add esi,eax
xor eax,eax
mov ax,[start_coordinates.x]
imul eax,[bytes_to_pixel]
add esi,eax
xor eax,eax
dec eax
mov [temp_y],eax
xor ecx,ecx
align 4
.y_2:
xor ebx,ebx
;-------------------------
align 4
.x_2:
call ebp
inc ebx
cmp bx,[new_size.x1]
jb .x_2
;-------------------------
inc ecx
cmp cx,[new_size.y1]
jb .y_2
ret
;---------------------------------------------------------------------
align 4
.32:
push ecx ebx
call .calculate_pixel
mov eax,[ecx]
call .check_filtering_32
pop ebx ecx
cld
stosd
ret
;---------------------------------------------------------------------
align 4
.24:
push ecx ebx
call .calculate_pixel
mov eax,[ecx]
call .check_filtering_24
cld
stosw
shr eax,16
pop ebx ecx
cld
stosb
ret
;---------------------------------------------------------------------
align 4
.16:
push ecx ebx
call .calculate_pixel
xor eax,eax
mov ax,[ecx]
call .check_filtering_16
pop ebx ecx
cld
stosw
ret
;---------------------------------------------------------------------
align 4
.8:
push ecx ebx
call .calculate_pixel
cmp [filtering],0
jne @f
mov al,[ecx]
pop ebx ecx
cld
stosb
ret
@@:
call .check_filtering_8
cld
stosw
shr eax,16
pop ebx ecx
cld
stosb
ret
;---------------------------------------------------------------------
align 4
.calculate_pixel:
test ecx,ecx
jz .offset_x
;.offset_y:
mov eax,ecx
mov ecx,[temp_y]
cmp eax,ecx
jne .new_y
mov eax,[temp_y_offset]
mov ecx,eax
jmp .offset_x
;--------------------------------
align 4
.new_y:
mov [temp_y],eax
 
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
;--------------------------------
push ebx
mov ebx,eax
shr eax,12
and ebx,0xFFF
shl ebx,7 ;multiply 128
shr ebx,12
mov [next_pixel_y],ebx
pop ebx
;--------------------------------
jmp .ex_1
align 4
@@:
;--------------------------------
imul eax,dword [y]
mov bx,word [new_size.y1]
;--------------------------------
align 4
.y_div:
test ebx,ebx
jnz @f
inc ebx
align 4
@@:
xor edx,edx
div ebx
;--------------------------------
push eax
mov eax,edx
shl eax,7 ;multiply 128
xor edx,edx
div ebx
mov [next_pixel_y],eax
pop eax
;--------------------------------
align 4
.ex_1:
mov [temp_y1],eax
imul eax,[size_x]
 
mov [temp_y_offset],eax
mov ecx,eax
align 4
.offset_x:
test ebx,ebx
jz .finish
mov eax,[esp+4] ;ebx
mov edx,[esp+8]
test edx,edx
jz .continue
shl eax,3
add eax,[area_for_x]
mov edx,[eax+4]
mov [next_pixel_x],edx
mov eax,[eax]
jmp .ex_3
;--------------------------------
align 4
.continue:
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
;--------------------------------
mov ebx,eax
shr eax,12
and ebx,0xFFF
shl ebx,7 ;multiply 128
shr ebx,12
mov [next_pixel_x],ebx
;--------------------------------
jmp .ex_2
;--------------------------------
align 4
@@:
imul eax,dword [x]
mov bx,word [new_size.x1]
;--------------------------------
align 4
.x_div:
test ebx,ebx
jnz @f
inc ebx
align 4
@@:
xor edx,edx
div ebx
;--------------------------------
push eax
mov eax,edx
shl eax,7 ;multiply 128
xor edx,edx
div ebx
mov [next_pixel_x],eax
pop eax
;--------------------------------
align 4
.ex_2:
mov edx,[bytes_to_pixel]
mov ebx,eax
xor eax,eax
align 4
@@:
add eax,ebx
dec edx
jnz @r
mov ebx,[esp+4]
shl ebx,3
add ebx,[area_for_x]
mov [ebx],eax
mov edx,[next_pixel_x]
mov [ebx+4],edx
align 4
.ex_3:
mov [temp_x1],eax
add ecx,eax
align 4
.finish:
add ecx,esi
ret
;---------------------------------------------------------------------
align 4
.get_memory:
 
xor ecx,ecx
mov cx,[new_size.x1]
shl ecx,3
mcall 68,12
mov [area_for_x],eax
xor ecx,ecx
mov ebx,[new_size]
mov cx,bx
shr ebx,16
imul ecx,ebx ;[eax+8]
mov eax,[bytes_to_pixel]
cmp eax,1
jne @f
mov eax,3
@@:
imul ecx,eax
mcall 68,12
mov [raw_area],eax
mov edi,eax
ret
;---------------------------------------------------------------------
include 'b_filter.inc'
;---------------------------------------------------------------------
align 4
EXPORTS:
dd szStart, START
dd szVersion, 0x00010001
dd 0
 
szStart db 'START',0
szVersion db 'version',0
 
align 4
pointer dd 0
image_file dd 0
new_size:
.y1: dw 0
.x1: dw 0
 
x: dd 0
y: dd 0
 
size_x dd 0
bytes_to_pixel dd 0
 
start_coordinates:
.y dw 0
.x dw 0
 
scaling_mode dd 0
raw_area dd 0
scaling_delta dd 0
 
area_for_x dd 0
 
temp_y dd 0
temp_y_offset dd 0
 
resolution dd 0
 
filtering dd 0
 
next_pixel_y dd 0
next_pixel_x dd 0
 
temp_y1 dd 0
temp_x1 dd 0
 
B_sample dd 0
G_sample dd 0
R_sample dd 0
 
B_sample_1 dd 0
G_sample_1 dd 0
R_sample_1 dd 0
 
palette dd 0
 
background_color dd 0
/programs/media/zsea/plugins/scaling/scaling.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/media/zsea/plugins/scaling/.
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property