diff --git a/programs/media/gifview/trunk/build_en.bat b/programs/media/gifview/trunk/build_en.bat
deleted file mode 100644
index dddd6e5fad..0000000000
--- a/programs/media/gifview/trunk/build_en.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@erase lang.inc
-@echo lang fix en >lang.inc
-@fasm gifview.asm gifview
-@erase lang.inc
-@pause
\ No newline at end of file
diff --git a/programs/media/gifview/trunk/build_ru.bat b/programs/media/gifview/trunk/build_ru.bat
deleted file mode 100644
index d47b2fb325..0000000000
--- a/programs/media/gifview/trunk/build_ru.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@erase lang.inc
-@echo lang fix ru >lang.inc
-@fasm gifview.asm gifview
-@erase lang.inc
-@pause
\ No newline at end of file
diff --git a/programs/media/gifview/trunk/gif_lite.inc b/programs/media/gifview/trunk/gif_lite.inc
deleted file mode 100644
index 29e69a8e77..0000000000
--- a/programs/media/gifview/trunk/gif_lite.inc
+++ /dev/null
@@ -1,485 +0,0 @@
-; GIF LITE v3.0 by Willow
-; Written in pure assembler by Ivushkin Andrey aka Willow
-; Modified by Diamond
-;
-; This include file will contain functions to handle GIF image format
-;
-; Created: August 15, 2004
-; Last changed: June 24, 2007
-
-; Requires kglobals.inc (iglobal/uglobal macro)
-; (program must 'include "kglobals.inc"' and say 'IncludeUGlobal'
-; somewhere in uninitialized data area).
-
-; Configuration: [changed from program which includes this file]
-; 1. The constant COLOR_ORDER: must be one of
-; PALETTE - for 8-bit image with palette (sysfunction 65)
-; MENUETOS - for MenuetOS and KolibriOS color order (sysfunction 7)
-; OTHER - for standard color order
-; 2. Define constant GIF_SUPPORT_INTERLACED if you want to support interlaced
-; GIFs.
-; 3. Single image mode vs multiple image mode:
-; if the program defines the variable 'gif_img_count' of type dword
-; somewhere, ReadGIF will enter multiple image mode: gif_img_count
-; will be initialized with image count, output format is GIF_list,
-; the function GetGIFinfo retrieves Nth image info. Otherwise, ReadGIF
-; uses single image mode: exit after end of first image, output is
-;
-
-if ~ (COLOR_ORDER in )
-; This message may not appear under MenuetOS, so watch...
- display 'Please define COLOR_ORDER: PALETTE, MENUETOS or OTHER',13,10
-end if
-
-if defined gif_img_count
-; virtual structure, used internally
-
-struct GIF_list
- NextImg rd 1
- Left rw 1
- Top rw 1
- Width rw 1
- Height rw 1
- Delay rd 1
- Displacement rd 1 ; 0 = not specified
- ; 1 = do not dispose
- ; 2 = restore to background color
- ; 3 = restore to previous
-if COLOR_ORDER eq PALETTE
- Image rd 1
-end if
-ends
-
-struct GIF_info
- Left rw 1
- Top rw 1
- Width rw 1
- Height rw 1
- Delay rd 1
- Displacement rd 1
-if COLOR_ORDER eq PALETTE
- Palette rd 1
-end if
-ends
-
-; ****************************************
-; FUNCTION GetGIFinfo - retrieve Nth image info
-; ****************************************
-; in:
-; esi - pointer to image list header
-; ecx - image_index (0...img_count-1)
-; edi - pointer to GIF_info structure to be filled
-
-; out:
-; eax - pointer to RAW data, or 0, if error
-
-GetGIFinfo:
- push esi ecx edi
- xor eax,eax
- jecxz .eloop
- .lp:
- mov esi,[esi]
- test esi,esi
- jz .error
- loop .lp
- .eloop:
- lodsd
- movsd
- movsd
- movsd
- movsd
-if COLOR_ORDER eq PALETTE
- lodsd
- mov [edi],esi
-else
- mov eax,esi
-end if
- .error:
- pop edi ecx esi
- ret
-
-end if
-
-_null fix 0x1000
-
-; ****************************************
-; FUNCTION ReadGIF - unpacks GIF image
-; ****************************************
-; in:
-; esi - pointer to GIF file in memory
-; edi - pointer to output image list
-
-; out:
-; eax - 0, all OK;
-; eax - 1, invalid signature;
-; eax >=8, unsupported image attributes
-;
-
-ReadGIF:
- push esi edi
- mov [.cur_info],edi
- xor eax,eax
- mov [.globalColor],eax
-if defined gif_img_count
- mov [gif_img_count],eax
- mov [.anim_delay],eax
- mov [.anim_disp],eax
-end if
- inc eax
- cmp dword[esi],'GIF8'
- jne .ex ; signature
- mov ecx,[esi+0xa]
- add esi,0xd
- mov edi,esi
- test cl,cl
- jns .nextblock
- mov [.globalColor],esi
- call .Gif_skipmap
- .nextblock:
- cmp byte[edi],0x21
- jne .noextblock
- inc edi
-if defined gif_img_count
- cmp byte[edi],0xf9 ; Graphic Control Ext
- jne .no_gc
- movzx eax,word [edi+3]
- mov [.anim_delay],eax
- mov al,[edi+2]
- shr al,2
- and eax,7
- mov [.anim_disp],eax
- add edi,7
- jmp .nextblock
- .no_gc:
-end if
- inc edi
- .block_skip:
- movzx eax,byte[edi]
- lea edi,[edi+eax+1]
- test eax,eax
- jnz .block_skip
- jmp .nextblock
- .noextblock:
- mov al,8
- cmp byte[edi],0x2c ; image beginning
- jne .ex
-if defined gif_img_count
- inc [gif_img_count]
-end if
- inc edi
- mov esi,[.cur_info]
-if defined gif_img_count
- add esi,4
-end if
- xchg esi,edi
-if defined GIF_SUPPORT_INTERLACED
- movzx ecx,word[esi+4]
- mov [.width],ecx
- movzx eax,word[esi+6]
- imul eax,ecx
-if ~(COLOR_ORDER eq PALETTE)
- lea eax,[eax*3]
-end if
- mov [.img_end],eax
- inc eax
- mov [.row_end],eax
- and [.pass],0
- test byte[esi+8],40h
- jz @f
-if ~(COLOR_ORDER eq PALETTE)
- lea ecx,[ecx*3]
-end if
- mov [.row_end],ecx
-@@:
-end if
-if defined gif_img_count
- movsd
- movsd
- mov eax,[.anim_delay]
- stosd
- mov eax,[.anim_disp]
- stosd
-else
- movzx eax,word[esi+4]
- stosd
- movzx eax,word[esi+6]
- stosd
- add esi,8
-end if
- push edi
- mov ecx,[esi]
- inc esi
- test cl,cl
- js .uselocal
- push [.globalColor]
- mov edi,esi
- jmp .setPal
- .uselocal:
- call .Gif_skipmap
- push esi
- .setPal:
- movzx ecx,byte[edi]
- inc ecx
- mov [.codesize],ecx
- dec ecx
-if ~(COLOR_ORDER eq PALETTE)
- pop [.Palette]
-end if
- lea esi,[edi+1]
- mov edi,.gif_workarea
- xor eax,eax
- lodsb ; eax - block_count
- add eax,esi
- mov [.block_ofs],eax
- mov [.bit_count],8
- mov eax,1
- shl eax,cl
- mov [.CC],eax
- mov ecx,eax
- inc eax
- mov [.EOI],eax
- mov eax, _null shl 16
- .filltable:
- stosd
- inc eax
- loop .filltable
-if COLOR_ORDER eq PALETTE
- pop eax
- pop edi
- push edi
- scasd
- push esi
- mov esi,eax
- mov ecx,[.CC]
-@@:
- lodsd
- dec esi
- bswap eax
- shr eax,8
- stosd
- loop @b
- pop esi
- pop eax
- mov [eax],edi
-else
- pop edi
-end if
-if defined GIF_SUPPORT_INTERLACED
- mov [.img_start],edi
- add [.img_end],edi
- add [.row_end],edi
-end if
- .reinit:
- mov edx,[.EOI]
- inc edx
- push [.codesize]
- pop [.compsize]
- call .Gif_get_sym
- cmp eax,[.CC]
- je .reinit
- call .Gif_output
- .cycle:
- movzx ebx,ax
- call .Gif_get_sym
- cmp eax,edx
- jae .notintable
- cmp eax,[.CC]
- je .reinit
- cmp eax,[.EOI]
- je .end
- call .Gif_output
- .add:
- mov dword [.gif_workarea+edx*4],ebx
- cmp edx,0xFFF
- jae .cycle
- inc edx
- bsr ebx,edx
- cmp ebx,[.compsize]
- jne .noinc
- inc [.compsize]
- .noinc:
- jmp .cycle
- .notintable:
- push eax
- mov eax,ebx
- call .Gif_output
- push ebx
- movzx eax,bx
- call .Gif_output
- pop ebx eax
- jmp .add
- .end:
-if defined GIF_SUPPORT_INTERLACED
- mov edi,[.img_end]
-end if
-if defined gif_img_count
- mov eax,[.cur_info]
- mov [eax],edi
- mov [.cur_info],edi
- add esi,2
- xchg esi,edi
- .nxt:
- cmp byte[edi],0
- jnz .continue
- inc edi
- jmp .nxt
- .continue:
- cmp byte[edi],0x3b
- jne .nextblock
- xchg esi,edi
- and dword [eax],0
-end if
- xor eax,eax
- .ex:
- pop edi esi
- ret
-
-.Gif_skipmap:
-; in: ecx - image descriptor, esi - pointer to colormap
-; out: edi - pointer to area after colormap
-
- and ecx,111b
- inc ecx ; color map size
- mov ebx,1
- shl ebx,cl
- lea ebx,[ebx*2+ebx]
- lea edi,[esi+ebx]
- ret
-
-.Gif_get_sym:
- mov ecx,[.compsize]
- push ecx
- xor eax,eax
- .shift:
- ror byte[esi],1
- rcr eax,1
- dec [.bit_count]
- jnz .loop1
- inc esi
- cmp esi,[.block_ofs]
- jb .noblock
- push eax
- xor eax,eax
- lodsb
- test eax,eax
- jnz .nextbl
- mov eax,[.EOI]
- sub esi,2
- add esp,8
- jmp .exx
- .nextbl:
- add eax,esi
- mov [.block_ofs],eax
- pop eax
- .noblock:
- mov [.bit_count],8
- .loop1:
- loop .shift
- pop ecx
- rol eax,cl
- .exx:
- xor ecx,ecx
- ret
-
-.Gif_output:
- push esi eax edx
- mov edx,.gif_workarea
- .next:
- push word[edx+eax*4]
- mov ax,word[edx+eax*4+2]
- inc ecx
- cmp ax,_null
- jnz .next
- shl ebx,16
- mov bx,[esp]
- .loop2:
- pop ax
-
- if COLOR_ORDER eq PALETTE
- stosb
- else
- lea esi,[eax+eax*2]
- add esi,[.Palette]
-
- if COLOR_ORDER eq MENUETOS
- mov esi,[esi]
- bswap esi
- shr esi,8
- mov [edi],esi
- add edi,3
- else
- movsb
- movsb
- movsb
- end if
- end if
-
-if defined GIF_SUPPORT_INTERLACED
- cmp edi,[.row_end]
- jb .norowend
- mov eax,[.width]
-if ~(COLOR_ORDER eq PALETTE)
- lea eax,[eax*3]
-end if
- push eax
- sub edi,eax
- add eax,eax
- cmp [.pass],3
- jz @f
- add eax,eax
- cmp [.pass],2
- jz @f
- add eax,eax
-@@:
- add edi,eax
- pop eax
- cmp edi,[.img_end]
- jb .nextrow
- mov edi,[.img_start]
- inc [.pass]
- add edi,eax
- cmp [.pass],3
- jz @f
- add edi,eax
- cmp [.pass],2
- jz @f
- add edi,eax
- add edi,eax
-@@:
-.nextrow:
- add eax,edi
- mov [.row_end],eax
- xor eax,eax
-.norowend:
-end if
-
- loop .loop2
- pop edx eax esi
- ret
-
-uglobal
-align 4
- ReadGIF.globalColor rd 1
- ReadGIF.cur_info rd 1 ; image table pointer
- ReadGIF.codesize rd 1
- ReadGIF.compsize rd 1
- ReadGIF.bit_count rd 1
- ReadGIF.CC rd 1
- ReadGIF.EOI rd 1
-if ~(COLOR_ORDER eq PALETTE)
- ReadGIF.Palette rd 1
-end if
- ReadGIF.block_ofs rd 1
-if defined GIF_SUPPORT_INTERLACED
- ReadGIF.row_end rd 1
- ReadGIF.img_end rd 1
- ReadGIF.img_start rd 1
- ReadGIF.pass rd 1
- ReadGIF.width rd 1
-end if
-if defined gif_img_count
- ReadGIF.anim_delay rd 1
- ReadGIF.anim_disp rd 1
-end if
- ReadGIF.gif_workarea rb 16*1024
-endg
diff --git a/programs/media/gifview/trunk/gifview.asm b/programs/media/gifview/trunk/gifview.asm
deleted file mode 100644
index d1c0e7aa38..0000000000
--- a/programs/media/gifview/trunk/gifview.asm
+++ /dev/null
@@ -1,293 +0,0 @@
-; GIF VIEWER FOR MENUET v1.0
-; Written in pure assembler by Ivushkin Andrey aka Willow
-;
-; Uses GIF_LITE 2.0
-;
-; Created: August 31, 2004
-; Last changed: August 25, 2006
-;
-; COMPILE WITH FASM
-
-appname equ 'GIF VIEWER'
-
-; input line dimensions
-INP_X equ 5 shl 16+680
-INP_Y equ 5 shl 16+16
-INP_XY equ 10 shl 16+10
-
-use32
-
- org 0x0
-
- db 'MENUET01'
- dd 0x01
- dd START
- dd I_END
- dd 0x400000
- dd 0x400000
- dd filename ;0x0
- dd 0x0
-
-include 'lang.inc'
-include '..\..\..\macros.inc' ; decrease code size (optional)
-
-COLOR_ORDER equ PALETTE
-GIF_SUPPORT_INTERLACED = 1
-include 'gif_lite.inc'
-
-START:
- cmp [filename],byte 0
- jne openfile2
-; jmp openfile2
-openfile:
- xor eax,eax
- mov [entered], eax
- mov [gif_img_count],eax
- mov esi,fn_input
- mov edi,filename
- mov ecx,[inp_pos]
- rep movsb
- stosb
-openfile2:
- mov ebx,file_info
- mov eax,70
- mcall
- cmp eax,6
- je temp
- test eax,eax
- jnz ok2
-temp:
-; cmp ebx,64
-; jbe ok2
-
- xor eax,eax
- mov [entered], eax
- mov esi,filename
- mov edi,fn_input
- mov ecx,256/4 ;[filename_len]
- rep movsd
-
- mov edi,fn_input
- mov ecx,256
- repne scasb
- sub edi,fn_input
- mov [inp_pos],edi
-
-; test eax,eax
-; jnz .ok2
-; cmp ebx,64
-; jbe .ok2
- mov esi,workarea
- mov edi,Image
- call ReadGIF
- test eax,eax
- jz .ok
- and [gif_img_count], 0
- .ok:
- ok2:
- and dword[img_index],0
-
- mov ebx,3
- mov ecx,sc
- mov edx,sizeof.system_colors
- mov eax,48
- mcall
-
-red:
-
-; *********************************************
-; ******* ОПРЕДЕЛЕНИЕ И ОТРИСОВКА ОКНА *******
-; *********************************************
-
-draw_window:
-
- mov ebx,1
- mov eax,12
- mcall
-
- xor eax,eax
- mov ebx,50*65536+700
- mov ecx,50*65536+500
- mov edx,[sc.work]
- or edx,0x33000000
- mov edi,title
- mcall
-
- call draw_input
-
- xor ecx,ecx
- call draw_subimage
- cmp [gif_img_count],1
- jz @f
-
- mov ecx,[img_index]
- call draw_subimage
-@@:
-
- mov ebx,2
- mov eax,12
- mcall
-
-still:
- cmp [gif_img_count], 1
- jbe .infinite
- mov ebx, [cur_anim_delay]
- test ebx, ebx
- jz .infinite
- mov eax, 23
- mcall
- jmp @f
-.infinite:
- mov eax, 10
- mcall
-@@:
- dec eax
- jz red
- dec eax
- jz key
- dec eax
- jz button
- mov eax,[gif_img_count]
- cmp eax,1
- je still
- inc [img_index]
- cmp eax,[img_index]
- jne redsub
- and [img_index],0
- redsub:
- mov ecx,[img_index]
- call draw_subimage
- jmp still
-
- key:
- mov eax,2
- mcall
- cmp ah,13
- je is_input
- jmp still
-
- button:
- mcall 17
- cmp ah,1
- jnz wait_input
-
- _close:
- or eax,-1
- mcall
-
- is_input: ; simple input line with backspace feature
- inc [entered] ; sorry - no cursor
- wait_input:
- call draw_input
- mov eax,10
- mcall
- cmp al,2
- jne still
- mov edi,[inp_pos]
-; mov eax,2
- mcall
- shr eax,8
- cmp al,27
- je still
- cmp al,13
- je openfile
- cmp al,8
- je backsp
- mov [fn_input+edi],al
- inc [inp_pos]
- jmp wait_input
- backsp:
- test edi,edi
- jz wait_input
- dec [inp_pos]
- jmp wait_input
-; jmp still
-
-;****************************************
-;******* DRAW CONTENTS OF INPUT LINE ****
-;****************************************
-draw_input:
- mov esi,0xe0e0e0
- cmp [entered],0
- jne highlight
- mov esi,0x00aabbcc
- highlight:
- mov ecx,INP_Y
- mov edx,2
- mov ebx,INP_X
- mov eax,8
- mcall
- mov ecx,0x00107a30
- mov edx,fn_input
- mov esi,[inp_pos]
- mov ebx,INP_XY
- mov eax,4
- mcall
- ret
-
-draw_subimage:
- cmp [gif_img_count],0
- jz .enddraw
- mov esi,Image
- mov edi,gif_inf
- call GetGIFinfo
- test eax,eax
- jz .enddraw
- mov ecx, dword [edi+GIF_info.Width-2]
- mov cx, [edi+GIF_info.Height]
- mov ebx,eax
- mov eax, [edi+GIF_info.Delay]
- mov [cur_anim_delay],eax
- mov edx, dword [edi+GIF_info.Left-2]
- mov dx, [edi+GIF_info.Top]
- add edx,5 shl 16 +25
- mov esi, 8
- mov edi, [edi+GIF_info.Palette]
- xor ebp, ebp
- mov eax, 65
- mcall
- .enddraw:
- ret
-
-; Здесь находятся данные программы:
-
-title db appname,0 ; строка заголовка
-
-inp_pos dd inp_end-fn_input
-fn_input:
-; db '/hd/1/gif/smileys/sm100000.gif'
- db '/sys/meos.gif'
-; db '/hd/1/1/tex256.gif',0
-; db '/rd/1/tex256.gif'
-inp_end:
- rb 256-(inp_end-fn_input)
-
-file_info:
- dd 0
- dd 0
- dd 0
- dd 0x100000;0x200000
- dd workarea;0x100000
-I_END: ; конец программы
-filename:
-; db '/hd/1/gif/smileys/sm112000.gif',0
-; db '/hd/1/gif/test.gif',0
-; db '/hd/1/gif/explode1.gif',0
-; db '/hd/1/gif/tapeta.gif',0
-; db '/hd/1/gif/meos.gif',0
- rb 257
-;filename_len dd 0
-
-entered rd 1
-sc system_colors
-
-gif_img_count rd 1
-cur_anim_delay rd 1
-img_index rd 1
-gif_inf GIF_info
-
-IncludeUGlobals
-
-workarea rb 0x100000
-
-Image:
diff --git a/programs/media/jpegview/trunk/build_en.bat b/programs/media/jpegview/trunk/build_en.bat
deleted file mode 100644
index 8d33ac1e1b..0000000000
--- a/programs/media/jpegview/trunk/build_en.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@erase lang.inc
-@echo lang fix en >lang.inc
-@fasm jpegview.asm jpegview
-@erase lang.inc
-@pause
\ No newline at end of file
diff --git a/programs/media/jpegview/trunk/build_ru.bat b/programs/media/jpegview/trunk/build_ru.bat
deleted file mode 100644
index 2cf6968185..0000000000
--- a/programs/media/jpegview/trunk/build_ru.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-@erase lang.inc
-@echo lang fix ru >lang.inc
-@fasm jpegview.asm jpegview
-@erase lang.inc
-@kpack jpegview
-@pause
\ No newline at end of file
diff --git a/programs/media/jpegview/trunk/filelib.asm b/programs/media/jpegview/trunk/filelib.asm
deleted file mode 100644
index 281abd3ffc..0000000000
--- a/programs/media/jpegview/trunk/filelib.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-file_handler:
- .operation=0
- .position=4
- .reserved=8
- .n_bytes=12
- .bufer=16
- .name=20
- .st_size=20+1024
-
-open: ;esi=name_string
- ;retorna eax
- pushad
- mov ecx,file_handler.st_size
- call mallocz
- mov [esp+28],edi
- push edi
- mov ecx,1024
- add edi,file_handler.name
- call movedata
- pop edi
-; test if file exists
- lea ebx,[edi+file_handler.operation]
- mov byte[ebx],5
- mov dword[ebx+16],fileattr
- mov eax,70
- int 0x40
- cmp eax,2
- jz .virtual
- test eax,eax
- jnz close.b
-@@:
- clc
- popad
- ret
-.virtual:
- mov byte [fileattr], 0x10
- jmp @b
-
-close:
- pushad
- .b:
- mov edi,[esp+28]
- call free
- popad
- xor eax,eax
- ret
-
-
-read: ;(f,bufer,nbytes) eax,edi,ecx ncr
- ;retorna bytes leidos en ecx
- pushad
- lea ebx, [eax+file_handler.operation]
- mov byte [ebx], 0
- mov [ebx+12], ecx
- mov [ebx+16], edi
- mov eax, 70
- int 0x40
- cmp ebx, -1
- sbb ebx, -1
- mov eax, [esp+28]
- add [eax+file_handler.position], ebx
- mov [esp+24], ebx
- popad
- ret
-
-ftell: mov edx,[eax+file_handler.position]
- ret
-lseek: ;eax=file edx=pos
- mov [eax+file_handler.position],edx
- ret
-skip: ;eax=file edx=bytes to skip
- add [eax+file_handler.position],edx
- ret
-
-
-
-
diff --git a/programs/media/jpegview/trunk/jpegdat.asm b/programs/media/jpegview/trunk/jpegdat.asm
deleted file mode 100644
index 50c1e946b6..0000000000
--- a/programs/media/jpegview/trunk/jpegdat.asm
+++ /dev/null
@@ -1,22 +0,0 @@
-modes:
-dd mcu100,color100,8,8 ;monocromo
-dd mcu111,color111,8,8
-dd mcu211,color211,16,8
-dd mcu411,color411,16,16
-
-zigzag:
-db 0,0, 4+1,0, 32,1, 64,1, 36,2, 8+1,0, 12+1,0, 40,4
-db 68,2, 96,1, 128,1, 100,2, 72,4, 44,8, 16+1,0, 20+1,0
-db 48,16, 76,8, 104,4, 132,2, 160,1, 192,1, 164,2, 136,4
-db 108,8, 80,16, 52,32, 24+1,0, 28+1,0, 56,64, 84,32, 112,16
-db 140,8, 168,4, 196,2, 224,1, 228,2, 200,4, 172,8, 144,16
-db 116,32, 88,64, 60,128, 92,128, 120,64, 148,32, 176,16, 204,8
-db 232,4, 236,8, 208,16, 180,32, 152,64, 124,128, 156,128, 184,64
-db 212,32, 240,16, 244,32, 216,64, 188,128, 220,128, 248,64, 252,128
-
-k:
-dd 1.41421,1.84776,1.08239,-2.6131
-k2:
-dd 0.3535534,0.49039264,0.46193953,0.415734806
-dd 0.3535534,0.277785116,0.191341716,0.0975451609
-
diff --git a/programs/media/jpegview/trunk/jpeglib.asm b/programs/media/jpegview/trunk/jpeglib.asm
deleted file mode 100644
index dbf6c088ee..0000000000
--- a/programs/media/jpegview/trunk/jpeglib.asm
+++ /dev/null
@@ -1,1181 +0,0 @@
-;405 412 586
-;
-;
-bufer_size=1024*16+2
-fichero=4
-mcu_ptr=8
-color_ptr=12
-estado=16
-color_c=17
-nbits=color_c
-idct=20
-tmp_bits=24
-actable=28
-matriz_limit=32
-sourcebits=36
-sourcebits_index=40
-sourcebits_limit=44
-qt_ptrs=48
-ht_dc_ptrs=64
-ht_ac_ptrs=80
-matrices=96
-tmp_bufer=100
-x_org=104
-y_org=108
-x_mcu=112
-y_mcu=116
-x_size=120
-y_size=124
-x_org2=128
-y_org2=132
-x_mcu2=136
-y_mcu2=140
-x_size2=144
-y_size2=148
-q_ptr=152
-dc=164
-position=204
-draw_ptr=208
-struct_size=212
-
-jpeg_info: ;fichero en eax
- ;retorna ebp
- xor ebp,ebp
- pushad
- mov ebp,esp
- mov ecx,6
- sub esp,ecx
- mov edi,esp
- call read
- pop dx
- cmp dx,0d8ffh
- je .l1
- mov esp,ebp
- popad
- ret
- .l1: push eax
- mov ecx,struct_size
- call mallocz
- mov [edi],ebp
- mov ebp,edi
- pop dword [ebp+fichero]
- pop ax
- pop cx
- jmp .l3
- .l2: mov ebx,[ebp+tmp_bufer]
- add ebx,[ebx-4]
- mov cx,[ebx-2]
- mov ax,[ebx-4]
- .l3: push .l2
- xchg cl,ch
- add cx,2
- cmp ch,3
- jnc .l4
- cmp al,0ffh
- jne eoi
- cmp ah,0dbh
- je dqt
- cmp ah,0c4h
- je dht
- cmp ah,0c0h
- je sof0
- cmp ah,0dah
- je sos
- cmp ah,0c2h
- je eoi
- cmp ah,0c9h
- je eoi
- cmp ah,0d9h
- je eoi
- .l4: lea edx,[ecx-4]
- xor ecx,ecx
- mov eax,[ebp+fichero]
- call skip
- mov ecx,4
- call READ
- cmp ecx,[edi-4]
- jne eoi
- ret
-
-eoi:
- mov esp,[ebp]
-; do not close file - this will be done by caller
- and dword [ebp+fichero], 0
- call jpeg_close
- popad
- xor ebp,ebp
- ret
-
-jpeg_close:
- test ebp,ebp
- jz .l2
- pushad
- mov eax,[ebp+fichero]
- call close
- mov edi,[ebp+sourcebits]
- call free
- lea esi,[ebp+qt_ptrs]
- mov ecx,14
- .l1: mov edi,[esi]
- add esi,4
- call free
- loop .l1
- mov edi,ebp
- call free
- popad
- .l2: ret
-
-dqt: call READ
- mov esi,edi
- lea eax,[edi+ecx]
- push eax
- .l1: xor eax,eax
- lodsb
- cmp al,4
- jnc eoi
- lea ebx,[ebp+qt_ptrs+eax*4]
- test dword [ebx],-1
- jnz eoi
- mov ecx,64
- xor eax,eax
- sub esp,128
- mov edi,esp
- .l2: lodsb
- stosw
- loop .l2
- mov ecx,256
- call malloc
- mov [ebx],edi
- mov eax,esi
- mov esi,esp
- pushad
- mov ebp,zigzag
- fninit
- mov cl,64
- xor eax,eax
- .l3: fild word[esi]
- mov al,[ebp]
- and al,-2
- add ebp,2
- add esi,2
- mov ebx,eax
- and ebx,28
- fmul dword [ebx+k2]
- mov ebx,eax
- shr ebx,3
- and ebx,4+8+16
- fmul dword [ebx+k2]
- fstp dword [edi+eax]
- dec cl
- jnz .l3
- popad
- mov esi,eax
- add esp,128
- mov eax,[esp]
- sub eax,esi
- jc eoi
- cmp eax,4
- ja .l1
- jne eoi
- pop eax
- ret
-
-sof0: call READ
- cmp byte [edi],8
- jne eoi ;precision
- mov ax,[edi+1]
- xchg al,ah
- mov [ebp+y_size],ax
- mov ax,[edi+3]
- xchg al,ah
- mov [ebp+x_size],ax
- mov al,[edi+5] ;ncomponentes
- mov cl,al
- mov [ebp+color_c],al
- mov edx,modes
- dec al
- jz .l1
- dec al
- dec al
- jnz eoi
- mov al,[edi+10]
- mov ah,[edi+13]
- cmp ax,1111h
- jne eoi
- mov al,[edi+7]
- add edx,16
- cmp al,11h
- je .l1
- add edx,16
- cmp al,21h
- je .l1
- add edx,16
- cmp al,22h
- jne eoi
- .l1: lea ebx,[ebp+q_ptr]
- lea esi,[ebp+qt_ptrs]
- mov [ebp+mcu_ptr],edx
- .l2: movzx eax,byte [edi+8]
- add edi,3
- cmp al,4
- jnc eoi
- lea eax,[eax*4+esi]
- mov [ebx],eax
- add ebx,16
- dec cl
- jnz .l2
- ret
-
-READ: mov eax,[ebp+fichero]
- mov edi,[ebp+tmp_bufer]
- movzx ecx,cx
- call mresize
- mov [ebp+tmp_bufer],edi
- jmp read
-
-dht: call READ
- mov esi,edi
- lea eax,[edi+ecx]
- push eax
- .l1: lodsb
- mov edi,esi
- mov ebx,3+16
- and bl,al
- cmp bl,al
- jne eoi
- shr bl,2
- and al,3
- or bl,al
- lea ebx,[ebp+ht_dc_ptrs+ebx*4]
- test dword [ebx],-1
- jnz eoi
- mov cl,15
- mov al,[edi]
- .l2: inc edi ;calcular numero de codigos
- add al,[edi]
- jc eoi
- dec cl
- jnz .l2
- movzx ecx,al
- lea ecx,[ecx*4+2]
- call malloc
- mov [ebx],edi
- call arbol_hf
- mov eax,[esp]
- sub eax,ebx
- jc eoi
- mov esi,ebx
- cmp eax,4
- ja .l1
- jne eoi
- pop eax
- ret
-
-arbol_hf: ;esi=ht edi=memoria para el arbol
- ;retorna en ebx el final de ht
- ;codigos: bits 0-3=nbits del siguiente numero
- ; bits 4-7=numero de zeros
- ; bits 8-14=longitud de este codigo o error si =127
- ; bit 15=codigo/puntero
- push ebp
- lea ebx,[edi-2]
- add ebx,[ebx-2]
- mov word [ebx],-1 ;codigo de error si encontrado
- push ebx
- push esi
- lea ebx,[esi+16]
- mov ebp,esp
- xor ecx,ecx
- push edi
- push ecx
- add edi,2
- mov dx,1
- add dh,[esi]
- jz .l3
- jmp .l2
- .l1: push edi
- push ecx
- add edi,2
- .l2: inc cl
- cmp cl,dl
- jc .l1
- mov al,[ebx]
- inc ebx
- mov ah,128 ;marca de codigo
- or ah,dl
- cmp edi,[ebp+4]
- jnc .l5
- stosw
- cmp esp,ebp
- jnc .l5
- pop ecx
- pop esi
- lea eax,[edi-2]
- sub eax,esi
- mov [esi],ax
- dec dh
- jnz .l2 ;ncodigos
- mov esi,[ebp]
- .l3: inc esi
- inc dl
- cmp dl,17
- jnc .l4
- add dh,[esi]
- jz .l3
- mov [ebp],esi
- jmp .l2
- .l4: lea esp,[ebp+8]
- pop ebp
- ret
- .l5: mov ebp,[ebp+8]
- jmp eoi
-
-sos: sub ecx,4 ;a continuacion vienen los datos de la imagen
- call READ
- mov eax,[ebp+fichero]
- call ftell
- mov [ebp+position],edx
- mov esi,edi
- lea edi,[ebp+q_ptr]
- lodsb ;numero de componentes
- sub [ebp+color_c],al
- jnz eoi
- mov dh,al
- .l1: mov ebx,[edi]
- mov eax,[ebx]
- stosd
- lodsw
- mov cl,ah
- and eax,0f00h
- and ecx,0f0h
- shr eax,6
- shr ecx,2
- lea ebx,[ebp+ht_ac_ptrs+eax]
- mov eax,[ebx]
- lea ebx,[ebp+ht_dc_ptrs+ecx]
- mov ecx,[ebx]
- test eax,eax
- jz eoi
- test ecx,ecx
- jz eoi
- stosd
- mov eax,ecx
- stosd
- add edi,4
- dec dh
- jnz .l1
- mov edx,[ebp+mcu_ptr]
- cmp edx,modes
- jne .l2
- lea esi,[ebp+q_ptr]
- lea edi,[ebp+q_ptr+32]
- movsd
- movsd
- movsd
- .l2:
- mov esi,edx
- push dword [esi]
- pop dword [ebp+mcu_ptr]
- push dword [esi+4]
- pop dword[ebp+color_ptr]
- push dword [esi+12]
- pop dword [ebp+y_mcu]
- push dword [esi+8]
- pop dword [ebp+x_mcu]
- mov ecx,64*18
- call malloc
- mov [ebp+matrices],edi
- mov ecx,bufer_size
- call malloc
- mov [ebp+sourcebits],edi
- mov esp,[ebp]
- mov [esp+8],ebp
- popad
- ret
-
-jpeg_display:
- test ebp,ebp
- jnz .inicio
- ret
- .inicio:
- pushad
- mov [ebp],esp
- mov eax,[ebp+fichero]
- mov edx,[ebp+position]
- call lseek
- mov edi,[ebp+sourcebits]
- add edi,bufer_size
- mov [ebp+sourcebits_index],edi
- sub edi,2
- mov [ebp+sourcebits_limit],edi
- mov edi,[ebp+matrices]
- mov [ebp+matriz_limit],edi
- xor eax,eax
- mov [esp+8],eax
- mov [ebp+estado],eax
- mov [ebp+tmp_bits],eax
- mov [ebp+dc],eax
- mov [ebp+dc+16],eax
- mov [ebp+dc+32],eax
-
- mov eax,[ebp+y_mcu]
- mov ecx,[ebp+y_org]
- sub ecx,eax
- mov [ebp+y_org2],ecx
- mov [ebp+y_mcu2],eax
- push dword [ebp+y_size]
- pop dword [ebp+y_size2]
- .l3: push dword [ebp+x_org]
- pop dword [ebp+x_org2]
- push dword [ebp+x_mcu]
- pop dword [ebp+x_mcu2]
- push dword [ebp+x_size]
- pop dword [ebp+x_size2]
- mov eax,[ebp+y_mcu2]
- add [ebp+y_org2],eax
- sub [ebp+y_size2],eax
- jnc .l4
- add eax,[ebp+y_size2]
- jnz .cont
- mov [esp+8],ebp
- popad
- ret
- .cont:
- mov dword [ebp+y_size2],0
- mov [ebp+y_mcu2],eax
- .l4:
- mov eax,[ebp+x_mcu2]
- sub [ebp+x_size2],eax
- jnc .l5
- add eax,[ebp+x_size2]
- jz .l3
- mov dword [ebp+x_size2],0
- mov [ebp+x_mcu2],eax
- call dword [ebp+mcu_ptr]
- mov eax,[ebp+x_mcu]
- mov ecx,[ebp+x_mcu2]
- mov edx,[ebp+y_mcu2]
- call recortar
- jmp .l6
- .l5:
- call dword [ebp+mcu_ptr]
- mov ecx,[ebp+x_mcu2]
- mov edx,[ebp+y_mcu2]
- .l6:
- mov eax,[ebp+x_org2]
- mov ebx,[ebp+y_org2]
- call dword [ebp+draw_ptr]
- add [ebp+x_org2],ecx
- mov ax,[ebp+estado]
- test al,15
- jz .l4
- cmp ah,8
- jnc .l4
- xor edx,edx
- mov [ebp+tmp_bits],edx
- mov [ebp+dc],edx
- mov [ebp+dc+16],edx
- mov [ebp+dc+32],edx
- add dword [ebp+sourcebits_index],2
- and word [ebp+estado],0c0h
- test al,32
- jz .l4
- jmp .l3
-
-color100:
- push edi
- .l1: lodsw
- mov dl,ah
- mov ah,al
- stosw
- mov ah,dl
- stosb
- mov al,dl
- stosb
- stosw
- dec cl
- jnz .l1
- pop edi
- ret
-
-color111:
- push edi
- .l1: lodsw
- mov bx,[esi+62]
- mov dx,[esi+126]
- xchg ah,bh
- xchg ah,dl
- xchg ah,bl
- stosw
- mov ax,bx
- stosw
- mov ax,dx
- stosw
- dec cl
- jnz .l1
- pop edi
- mov ecx,64*3
- jmp ybr_bgr
-
-color411:
- push ebp
- push edi
- lea ebp,[esi+ecx*8]
- .l1: push ecx
- mov ax,[esi]
- mov cx,[ebp]
- mov dx,[ebp+64]
- add ebp,2
- xchg ch,dl
- mov bx,ax
- mov ah,cl
- mov bl,ch
- mov [edi],ax
- mov [edi+2],bx
- mov [edi+4],cx
- mov ax,[esi+8]
- mov bh,ah
- mov ah,cl
- mov [edi+48],ax
- mov [edi+48+2],bx
- mov [edi+48+4],cx
- mov ax,[esi+2]
- mov bx,ax
- mov ah,dl
- mov bl,dh
- mov [edi+6],ax
- mov [edi+2+6],bx
- mov [edi+4+6],dx
- mov ax,[esi+8+2]
- mov bh,ah
- mov ah,dl
- mov [edi+48+6],ax
- mov [edi+48+2+6],bx
- mov [edi+48+4+6],dx
- pop ecx
- add edi,12
- dec ecx
- add esi,4
- test cl,1
- jnz .l1
- add esi,64-8
- test cl,2
- jnz .l1
- sub esi,128-16
- add edi,48
- test cl,15
- jnz .l1
- add esi,64
- test cl,cl
- jnz .l1
- pop edi
- pop ebp
- mov ecx,64*4*3
- jmp ybr_bgr
-
-color211:
- push ebp
- push edi
- lea ebp,[esi+ecx*4]
- .l1: push ecx
- mov ax,[esi]
- mov cx,[ebp]
- mov dx,[ebp+64]
- add ebp,2
- xchg ch,dl
- mov bx,ax
- mov ah,cl
- mov bl,ch
- mov [edi],ax
- mov [edi+2],bx
- mov [edi+4],cx
- mov ax,[esi+2]
- mov bx,ax
- mov ah,dl
- mov bl,dh
- mov [edi+6],ax
- mov [edi+2+6],bx
- mov [edi+4+6],dx
- pop ecx
- add edi,12
- dec cl
- add esi,4
- test cl,1
- jnz .l1
- add esi,64-8
- test cl,2
- jnz .l1
- sub esi,128-8
- test cl,cl
- jnz .l1
- pop edi
- pop ebp
- mov ecx,64*3*2
- jmp ybr_bgr
-
-
-mcu411: lea ebx,[ebp+q_ptr]
- call hufdecode
- lea ebx,[ebp+q_ptr]
- call hufdecode
-mcu211: lea ebx,[ebp+q_ptr]
- call hufdecode
-mcu111: lea ebx,[ebp+q_ptr]
- call hufdecode
- lea ebx,[ebp+q_ptr+16]
- call hufdecode
-mcu100: lea ebx,[ebp+q_ptr+32]
- call hufdecode
- mov esi,[ebp+matrices]
- mov dword [ebp+matriz_limit],esi
- mov ecx,32
- lea edi,[esi+64*6]
- jmp dword [ebp+color_ptr]
-
-cargar_bits: ;edx=bits,cl=nbits,
- ;bp=data struct
- ;cr: cl,edx,eax,si
- ;ncr bx,bp,di,ch
-
- mov esi,[ebp+sourcebits_index]
- cmp esi,[ebp+sourcebits_limit]
- jnc .l6
- movzx eax,byte [esi]
- inc esi
- add cl,8
- cmp al,-1
- je .l2
- mov ah,al
- lodsb
- add cl,8
- cmp al,-1
- je .l2
- .l1: ror eax,cl
- or edx,eax
- mov [ebp+sourcebits_index],esi
- ret
- .l2: lodsb
- test al,al
- jnz .l3
- mov al,-1
- call .l1
- cmp cl,16
- jc cargar_bits
- ret
- .l3: sub esi,2
- sub cl,8
- sub al,0d0h
- cmp al,8
- jc .l4
- sub al,9
- mov al,63
- jz .l4
- mov al,127
- .l4: inc al
- or [ebp+estado],al
- movzx eax,ah
- jmp .l1
- .l5: mov [ebp+sourcebits_limit],edi
- mov word [edi],0d9ffh
- popad
- jmp cargar_bits
- .l6: ;read file
- pushad
- mov ecx,bufer_size-2
- mov edx,[ebp+sourcebits_limit]
- mov edi,[ebp+sourcebits]
- mov ax,[edx]
- sub edx,edi
- stosw
- sub esi,edx
- mov [ebp+sourcebits_index],esi
- cmp edx,ecx
- jne .l5
- mov eax,[ebp+fichero]
- call read
- lea ecx,[edi+ecx-2]
- mov [ebp+sourcebits_limit],ecx
- popad
- jmp cargar_bits
-
-
-hufdecode: ;si->dctable [bp+20]->actable di->outbufer edx->bits cl->bits en edx
-
-
- ;[bp+24]->sourcebits
- ;[bp+22]=outbufer+128
- ;[bx] q ptr para aa&n
- ;[bx+2] a ptr
- ;[bx+4] d ptr
- ;[bx+8] dc componente
- fninit
- push dword [ebx]
- mov cl,[ebp+nbits]
- mov edx,[ebp+tmp_bits]
- cmp cl,16
- jnc .l1
- call cargar_bits
- .l1: mov eax,[ebx+4]
- mov esi,[ebx+8]
- mov [ebp+actable],eax
- movzx eax,word [esi]
- add esi,2
- .l2: add edx,edx
- jnc .l3
- add esi,eax
- .l3: lodsw
- test ax,ax
- jns .l2
- ;codigo encontrado
- and ax,7f0fh
- mov edi,[ebp+matriz_limit] ;arrays
- sub cl,ah
- jns .l4
- fldz
- .error:
- xor ecx,ecx
- or byte [ebp+estado],32
- jmp .l12
- .l4: cmp cl,al
- jnc .l5
- push eax
- call cargar_bits
- pop eax
- .l5: sub cl,al
- mov ch,cl
- mov cl,al
- mov eax,edx
- shl edx,cl
- sar eax,17
- xor ax,8000h
- xor cl,15
- sar ax,cl
- mov cl,ch
- mov ch,2
- add ax,8000h ;incrementar si negativo
- adc ax,8000h
- add [ebx+12],ax
- fild word [ebx+12]
- push ecx
- mov ecx,64
- xor eax,eax
- add [ebp+matriz_limit],ecx
- rep stosd
- pop ecx
- sub edi,64*4
- mov ebx,[esp]
- fmul dword [ebx]
- .l6: cmp cl,16
- jnc .l7
- call cargar_bits
- .l7: mov esi,[ebp+actable]
- movzx eax,word[esi]
- add esi,2
- .l8: add edx,edx
- jnc .l9
- add esi,eax
- .l9: lodsw
- test ax,ax
- jns .l8
- ;codigo encontrado
- and ah,127
- xor ebx,ebx
- sub cl,ah
- js .error
- or bl,al
- jz .l12
- and al,0f0h
- shr al,3
- add ch,al
- js .error
- and bl,0fh
- jz .l11
- cmp cl,bl
- jnc .l10
- call cargar_bits
- .l10: sub cl,bl
- xchg bl,cl
- mov eax,edx
- shl edx,cl
- sar eax,17
- xor cl,15
- xor ax,8000h
- sar ax,cl
- add ax,8000h ;incrementar si negativo
- adc ax,8000h
- mov cl,bl
- mov bl,ch
- mov [ebp+tmp_bits],ax
- mov ax,[ebx+zigzag]
- mov ebx,[esp]
- fild word [ebp+tmp_bits]
- or [ebp+idct],ax
- and eax,11111100b
- fmul dword [ebx+eax]
- fstp dword [edi+eax]
- .l11: add ch,2
- jns .l6
- .l12: mov [ebp+nbits],cl
- mov [ebp+tmp_bits],edx
- xor ebx,ebx
- add esp,4
- xchg ebx,[ebp+idct]
- cmp ch,2
- je idctf1
- fstp dword [edi]
- test bh,0feh
- jnz idctf3
-idctf2a: test bh,1
- mov esi,edi
- jz .l1
- test bl,1
- jnz idctf3
- push idctf2b
- jmp idctf3b
- .l1: call idctf3a
- mov cl,4
- call limit
- mov eax,[edi-8]
- mov edx,[edi-4]
- mov cl,7
- .l2: mov [edi],eax
- mov [edi+4],edx
- add edi,8
- dec cl
- jnz .l2
- ret
-
-idctf1: fistp word[edi+64]
- mov ax,128
- add ax,[edi+64]
- jz .l2
- test ah,ah
- jz .l1
- mov al,-1
- js .l2
- .l1: mov ah,al
- stosw
- stosw
- mov eax,[edi-4]
- mov ecx,15
- rep stosd
- .l2: ret
-
-idctf3: mov bl,8
- mov esi,edi
- .l1: rcr bh,1
- jc .l3
- mov eax,[esi]
- test eax,eax
- jz .l4
- mov cl,7
- .l2: add esi,32
- mov [esi],eax
- dec cl
- jnz .l2
- sub esi,32*7-4
- dec bl
- jnz .l1
- jmp .l5
- .l3: call idctf3b
- .l4: add esi,4
- dec bl
- jnz .l1
- .l5: mov esi,edi
- mov cl,8
- .l6: call idctf3a
- add esi,32
- add edi,16
- dec cl
- jnz .l6
- sub edi,128
- mov esi,edi
- mov cl,32
-limit: mov dx,[esi]
- mov bx,[esi+2]
- add esi,4
- add dx,128
- add bx,128
- test dh,dh
- mov ax,dx
- jz .l1
- mov al,0
- js .l1
- mov al,-1
- .l1: test bh,bh
- mov ah,bl
- jz .l2
- mov ah,0
- js .l2
- mov ah,-1
- .l2: stosw
- dec cl
- jnz limit
- ret
-
-idctf2b:
- mov dl,8
- .l1: fld dword[esi]
- add esi,32
- mov ax,128
- fistp word [edi]
- add ax,[edi]
- test ah,ah
- jz .l2
- mov al,0
- js .l2
- mov al,-1
- .l2: mov ah,al
- stosw
- stosw
- stosw
- stosw
- dec dl
- jnz .l1
- ret
-
-idctf3a: ;si(d float),di(w int) ncr
-fld dword[esi+1*4] ;f1 ;t21=f1+f7
-fld st0
-fld dword[esi+7*4] ;f7
-fadd st2,st0
-fsubp st1,st0 ;t22=f1-f7
-fld dword[esi+5*4]
-fld st0 ;f5 ;t23=f5+f3
-fld dword[esi+3*4] ;f3
-fadd st2,st0
-fsubp st1,st0 ;t20=f5-f3
-fld st0
-fadd st0,st3 ;t25=(t20+t22)*k2
-fmul dword[k+4] ;k2 ;t25,t20,t23,t22,t21
-fld st4 ;t7=t21+t23
-fadd st0,st3 ;t7,t25,t20,t23,t22,t21
-fld dword[k+12] ;k4 ;t6=k4*t20+t25-t7
-fmulp st3,st0
-fsub st2,st0
-fld st1
-faddp st3,st0 ;t7,t25,t6,t23,t22,t21
-fld st5 ;t5=(t21-t23)*k1-t6
-fsub st0,st4
-fmul dword[k] ;k1
-fsub st0,st3
-fstp st6 ;t7,t25,t6,t23,t22,t5
-fstp st3 ;t25,t6,t7,t22,t5
-fxch st3
-fmul dword[k+8] ;k3 ;t4=k3*t22-t25+t5
-fadd st0,st4 ;t22*k3+t5,t6,t7,t25,t5
-fsubrp st3,st0 ;t6,t7,t4,t5
-fld dword[esi] ;f0 ;t10=f0+f4
-fst st5 ;f0,t4,t5,t6,t7,f0
-fld dword[esi+4*4] ;f4
-fsub st6,st0 ;t11=f0-f4
-faddp st1,st0
-fld st0 ;t10,t10,t6,t7,t4,t5,t11
-fld dword[esi+2*4] ;f2 ;t13=f2+f6
-fadd dword[esi+6*4] ;f6 ;t13,t10,t10,t6,t7,t4,t5,t11
-fadd st2,st0 ;t13,t10,t0,t6,t7,t4,t5,t11 ;t0=t10+t13
-fsubp st1,st0 ;t3,t0,t6,t7,t4,t5,t11 ;t3=t10-t13
-fld st0 ;p3=t3-t4
-fsub st0,st5
-fistp word [edi+3*2] ;p3
-fadd st0,st4 ;p4=t3+t4
-fld dword[esi+2*4] ;f2
-fstp st5
-fistp word [edi+4*2] ;p4 ;t0,t6,t7,f2,t5,t11
-fld st0 ;p0=t0+t7
-fsub st0,st3
-fistp word [edi+7*2] ;p7
-fadd st0,st2 ;p7=t0-t7
-fistp word [edi] ;p0 ;t6,t7,f2,t5,t11
-fld st2 ;f2 ;f2,t6,t7,f2,t5,t11 ;t12=(f2-f6)*k1-t13
-fld dword[esi+6*4] ;f6
-fadd st4,st0 ;f6,f2,t6,t7,t13,t5,t11
-fsubp st1,st0
-fmul dword[k] ;k1
-fsub st0,st3
-fst st3 ;t12,t6,t7,t12,t5,t11
-fadd st0,st5 ;t1=t11+t12
-fst st2 ;t1,t6,t1,t12,t5,t11
-fadd st0,st1 ;p1=t1+t6
-fistp word [edi+2] ;p1 ;t6,t1,t12,t5,t11
-fsubp st1,st0 ;p6=t1-t6
-fistp word [edi+6*2] ;p6 ;t12,t5,t11
-fsubp st2,st0 ;t2=t11-t12 ;t5,t2
-fld st0
-fadd st0,st2 ;p2=t2+t5
-fistp word [edi+2*2] ;p2
-fsubp st1,st0 ;p5=t2-t5 ;t5,t2
-fistp word [edi+5*2]
-ret ;p5
-
-
-
-
-idctf3b: ;si ncr
-fld dword[esi+1*32]
-fld st0 ;f1 ;t21=f1+f7
-fld dword[esi+7*32]
-fadd st2,st0 ;f7
-fsubp st1,st0 ;t22=f1-f7
-fld dword[esi+5*32]
-fld st0 ;f5 ;t23=f5+f3
-fld dword[esi+3*32] ;f3
-fadd st2,st0
-fsubp st1,st0
-fld st0 ;t20=f5-f3
-fadd st0,st3 ;t25=(t20+t22)*k2
-fmul dword[k+4] ;k2 ;t25,t20,t23,t22,t21
-fld st4 ;t7=t21+t23
-fadd st0,st3 ;t7,t25,t20,t23,t22,t21
-fld dword[k+12] ;k4 ;t6=k4*t20+t25-t7
-fmulp st3,st0
-fsub st2,st0
-fld st1
-faddp st3,st0 ;t7,t25,t6,t23,t22,t21
-fld st5 ;t5=(t21-t23)*k1-t6
-fsub st0,st4
-fmul dword[k] ;k1
-fsub st0,st3
-fstp st6 ;t7,t25,t6,t23,t22,t5
-fstp st3
-fxch st3 ;t25,t6,t7,t22,t5
-fmul dword[k+8] ;k3 ;t4=k3*t22-t25+t5
-fadd st0,st4 ;t22*k3+t5,t6,t7,t25,t5
-fsubrp st3,st0 ;t6,t7,t4,t5
-fld dword[esi] ;f0 ;t10=f0+f4
-fst st5 ;f0,t4,t5,t6,t7,f0
-fld dword[esi+4*32] ;f4
-fsub st6,st0 ;t11=f0-f4
-faddp st1,st0
-fld st0 ;t10,t10,t6,t7,t4,t5,t11
-fld dword[esi+2*32] ;f2 ;t13=f2+f6
-fadd dword[esi+6*32] ;f6 ;t13,t10,t10,t6,t7,t4,t5,t11
-fadd st2,st0 ;t13,t10,t0,t6,t7,t4,t5,t11 ;t0=t10+t13
-fsubp st1,st0 ;t3,t0,t6,t7,t4,t5,t11 ;t3=t10-t13
-fld st0 ;p3=t3-t4
-fsub st0,st5
-fstp dword[esi+3*32] ;p3
-fadd st0,st4 ;p4=t3+t4
-fld dword[esi+2*32] ;f2
-fstp st5
-fstp dword[esi+4*32] ;p4 ;t0,t6,t7,f2,t5,t11
-fld st0
-fsub st0,st3 ;p0=t0+t7
-fstp dword[esi+7*32] ;p7
-fadd st0,st2 ;p7=t0-t7
-fstp dword[esi] ;p0 ;t6,t7,f2,t5,t11
-fld st2 ;f2 ;f2,t6,t7,f2,t5,t11 ;t12=(f2-f6)*k1-t13
-fld dword[esi+6*32] ;f6
-fadd st4,st0 ;f6,f2,t6,t7,t13,t5,t11
-fsubp st1,st0
-fmul dword[k] ;k1
-fsub st0,st3
-fst st3 ;t12,t6,t7,t12,t5,t11
-fadd st0,st5 ;t1=t11+t12
-fst st2 ;t1,t6,t1,t12,t5,t11
-fadd st0,st1 ;p1=t1+t6
-fstp dword[esi+1*32] ;p1 ;t6,t1,t12,t5,t11
-fsubp st1,st0 ;p6=t1-t6
-fstp dword[esi+6*32] ;p6 ;t12,t5,t11
-fsubp st2,st0
-fld st0 ;t2=t11-t12 ;t5,t2
-fadd st0,st2 ;p2=t2+t5
-fstp dword[esi+2*32] ;p2
-fsubp st1,st0 ;p5=t2-t5 ;t5,t2
-fstp dword[esi+5*32]
-ret ;p5
-
-ybr_bgr: ;edi=bmp ecx=n_BYTES
- ;retorna edi+=ecx
- pushad
- mov esi,edi
- add edi,ecx
- push edi
- mov edi,[colortabla]
- .l1: lodsw
- movzx ebx,ah
- movzx ebp,al
- movzx eax,al
- movzx ecx,byte[esi]
- lea ebx,[ebx*4+edi+1024]
- lea ecx,[ecx*4+edi]
- add eax,[ebx] ;cb ;solo se usan 16 bits
- mov edx,[ebx+2] ;pero el codigo de 32 bits es mas rapido
- mov ebx,[ecx] ;cr
- add eax,[ecx+2]
- add ebx,ebp ;b
- add edx,ebp ;r
- test ah,ah
- jz .l2
- mov al,0
- js .l2
- mov al,-1
- .l2: test dh,dh
- jz .l3
- mov dl,0
- js .l3
- mov dl,-1
- .l3: test bh,bh
- mov dh,al
- jz .l4
- mov bl,0
- js .l4
- mov bl,-1
- .l4: mov [esi-2],dx
- mov [esi],bl
- inc esi
- cmp esi,[esp]
- jc .l1
- pop edi
- popad
- ret
-
-recortar: ;edi=bufer eax=ancho en pixels (ecx,edx)tamaдo deseado
- pushad
- dec edx
- jz .l2
- lea ebx,[ecx*3]
- lea eax,[eax*3]
- lea esi,[edi+eax]
- add edi,ebx
- sub eax,ebx
- .l1: mov ecx,ebx
- call movedata
- add esi,eax
- dec edx
- jnz .l1
- .l2: popad
- ret
-
-;R = Y + 1.402 *(Cr-128)
-;G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128)
-;B = Y + 1.772 *(Cb-128)
-
-colortabla: dd 0
-
-colorprecalc: ;prepara la tabla para convertir ycb a rgb
- mov ecx,1024*2
- call malloc
- mov [colortabla],edi
- fninit
- fld dword [.k+4]
- fld dword [.k]
- mov dl,0
- call .l1
- fld dword [.k+12]
- fld dword[.k+8]
- .l1: mov cx,-128
- .l2: mov [edi],ecx
- inc ecx
- fild word[edi]
- fld st0
- fmul st0,st2
- fistp word[edi]
- fmul st0,st2
- fistp word[edi+2]
- add edi,4
- inc dl
- jnz .l2
- ret
-
- .k: dd 1.402,-0.71414,-0.34414,+1.772
diff --git a/programs/media/jpegview/trunk/jpegview.asm b/programs/media/jpegview/trunk/jpegview.asm
deleted file mode 100644
index 7de1d07696..0000000000
--- a/programs/media/jpegview/trunk/jpegview.asm
+++ /dev/null
@@ -1,747 +0,0 @@
-; IMGVIEW.ASM
-;
-; This program displays jpeg images. The window can be resized.
-;
-; Version 0.0 END OF 2003
-; Octavio Vega
-; Version 0.1 7th March 2004
-; Mike Hibbett ( very small part! )
-; Version 0.11 7th April 2004
-; Ville Turjanmaa ( 'set_as_bgr' function )
-; Version 0.12 29th May 2004
-; Ivan Poddubny (correct "set_as_bgr"+parameters+boot+...)
-; Version 0.12 30 de mayo 2004
-; Octavio Vega
-; bugs correction and slideshow
-; version 0.13 3 de junio 2004
-; Octavio Vega
-; unos retoques
-; version 0.14 10th August 2004
-; Mike Hibbett Added setting default colours
-; version 0.15 24th August 2006
-; diamond (rewritten to function 70)
-; version 0.16 19th May 2007
-; Mario79
-; 1) correction for changed function 15,
-; 2) use monochrome background if free memory there are less than 2 MB
-; 3) use COL0 - COL9 boot parameter
-; 0=black,1=white,2=green,3=lilas,4=grey
-; 5=light-blue,6=blue,7=salad,8=pink,9=yellow
-; version 0.17 17th June 2007
-; diamond (background definition now uses shared memory)
-; version 0.18 9th August 2007
-; Mario79
-; Open file with parameter in patch:
-; Size of parameter - 4 bytes. Parameter starts with the character "\",
-; the unused characters are filled by a blank (ASCII 20h).
-; '\T /hd0/1/1.jpg' - set background, mode: tile
-; '\S /hd0/1/1.jpg' - set background, mode: stretch
-
- memsize=20000h
- org 0
- PARAMS = memsize - 1024
-
-appname equ 'Jpegview '
-version equ '0.18'
-
-use32
-
- db 'MENUET01' ; 8 byte id
- dd 0x01 ; header version
- dd START ; start of code
- dd I_END ; size of image
- dd memsize ; memory for app
- dd memsize - 1024 ; esp
- dd PARAMS , 0x0 ; I_Param , I_Icon
-
-stack_size=4096 + 1024
-
-include '..\..\..\macros.inc'
-
-START: ; start of execution
- mcall 68,11 ; initialize heap
-
- cmp [PARAMS], byte 0
- jne check_parameters
-
- ; Calculate the 'free' memory available
- ; to the application, and create the malloc block from it
- .l1:
- mov ecx,memsize-fin-stack_size
- mov edi,fin
- call add_mem
-
- call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr
- call draw_window
- call read_string.rs_done
-
-still:
- push still
- mov ebx,100 ;1 second
- mov eax,23 ; wait here for event
- mcall
- cmp eax,1 ; redraw request ?
- je draw_window
- cmp eax,2 ; key in buffer ?
- je read_string
- cmp eax,3 ; button in buffer ?
- je button
- jmp display_next
-
-button: ; BUTTON
- mov eax,17
- mcall
- cmp ah,3
- je set_as_bgr2
- cmp ah,2
- je slideshow
- cmp ah,1 ; CLOSE PROGRAM
- jne close_program.exit
-close_program:
- mov eax,-1
- mcall
- .exit:
- ret
-
- ; Put a 'chunk' of the image on the window
-put_image:
- pushad
-
- lea ebp,[edx+eax+7]
- cmp [winxs],bp
- jc .l1
- lea ebp,[ecx+ebx+20+2+17]
- cmp [winys],bp
- jc .l1
-
- add eax,2 ; offset for boarder
- add ebx,2 ; offset for title bar
- push ax ; pox
- push bx ; pos
- push cx ; size
- push dx ; size
- pop ecx
- pop edx
- mov ebx,edi
- mov eax,7
-
- mcall ; Put image function
-.l1:
- popad
- ret
-
-
-
-;******************************************************************************
-
-check_parameters:
- cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler
- je boot_set_background
- cmp [PARAMS], word "CO"
- jne @f
- cmp [PARAMS+2], byte "L"
- je boot_set_background
-@@:
- cmp byte [PARAMS], "\"
- jne @f
- cmp [PARAMS+1], byte "S"
- jne .tile
- mov [drawing_mode],2
- jmp @f
-.tile:
- cmp [PARAMS+1], byte "T"
- jne @f
- mov [drawing_mode],1
-@@:
- cmp byte [PARAMS], 1
- jz ipc_service
- mov edi, name_string ; clear string with file name
- mov al, 0
- mov ecx, 100
- rep stosb
-
- mov ecx, 100 ; calculate length of parameter string
- mov edi, PARAMS
- repne scasb
-
- sub edi, PARAMS
- mov ecx, edi
- mov esi, PARAMS ; copy parameters to file name
- mov edi, name_string
- cmp byte [PARAMS], "\"
- jne @f
- add esi,4
- sub ecx,4
-@@:
- cld
- rep movsb
-
- cmp byte [PARAMS], "\"
- je boot_set_background.1
-
- jmp START.l1 ; return to beggining of the progra
-;******************************************************************************
-boot_set_background:
- mov [drawing_mode],2
-.1:
- mcall 18,16
- cmp eax,1024*2
- jb set_mono
- mov ecx,memsize-fin-stack_size ; size
- mov edi,fin ; pointer
- call add_mem ; mark memory from fin to 0x100000-1024 as free
- call colorprecalc ; calculate colors
- mov esi,name_string
- call open
- test eax,eax
- jz close_program
- call jpeg_info
- mov dword [jpeg_st],ebp
- call set_as_bgr2 ; set wallpaper
- jmp close_program ; close the program right now
-
-;******************************************************************************
-set_mono:
- mov eax, 15
- mov ebx, 1
- mov ecx, 1
- mov edx, 1
- mcall
-
- cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler
- jne @f
-.green:
- mov ecx,mono+6
- jmp .set
-@@:
-; cmp [PARAMS], word "CO" ; received BOOT parameter -> goto handler
-; jne .green
- xor ecx,ecx
- mov cl,[PARAMS+3]
- sub cl,0x30
- cmp ecx,0
- jb .green
- cmp ecx,9
- ja .green
- imul ecx,3
- add ecx,mono
-.set:
- mcall 15,5, ,0,3
-
- ; Stretch the image to fit
- mov eax, 15
- mov ebx, 4
- mov ecx, 1
- mcall
-
- mov eax, 15
- mov ebx, 3
- mcall
- jmp close_program
-
-mono:
- db 0,0,0 ; black
- db 255,255,255 ; white
- db 128,128,0 ; green
- db 240,202,166 ; lilas
- db 192,192,192 ; grey
- db 255,255,0 ; light-blue
- db 255,0,0 ; blue
- db 192,220,192 ; salad
- db 255,0,255 ; pink
- db 0,255,255 ; yellow
-;******************************************************************************
-
-set_as_bgr2:
- mov ebp,dword[jpeg_st]
- test ebp,ebp
- jz .end
-
- mov eax, 15
- mov ebx, 1
- mov ecx, [ebp + x_size]
- mov edx, [ebp + y_size]
- mcall
-
- mov ebx, 6
- mcall
- test eax, eax
- jz .end
- mov [ipc_mem_out], eax
-
- mov dword [ebp+draw_ptr],put_chunk_to_mem
- call jpeg_display
-
- mov eax, 15
- mov ebx, 7
- mov ecx, [ipc_mem_out]
- mcall
-
- ; Stretch the image to fit
- mov eax, 15
- mov ebx, 4
- mov ecx, [drawing_mode] ;2
- mcall
-
- mov eax, 15
- mov ebx, 3
- mcall
-
-
- .end:
- ret
-
-;******************************************************************************
-
-ipc_service:
- mov esi, PARAMS+1
- xor eax, eax
- xor ecx, ecx
-@@:
- lodsb
- test al, al
- jz @f
- lea ecx, [ecx*5]
- lea ecx, [ecx*2+eax-'0']
- jmp @b
-@@:
- add ecx, 16
- mov edx, ecx
- mcall 68, 12
- test eax, eax
- jnz @f
-.exit:
- mcall -1
-@@:
- mov ecx, eax
- and dword [ecx], 0
- mov dword [ecx+4], 8
- mov [ipc_mem], ecx
- mcall 60, 1
- mcall 40, 1 shl 6
- mcall 23, 500 ; wait up to 5 seconds for IPC message
- test eax, eax
- jz .exit
-; we got message with JPEG data, now decode it
- mov eax, [ecx+12]
- mov [ipc_mem_size], eax
-; init JPEG decoder
- mov ecx,memsize-fin-stack_size ; size
- mov edi,fin ; pointer
- call add_mem ; mark memory from fin to 0x100000-1024 as free
- call colorprecalc ; calculate colors
-; hook file functions
- mov ecx, 4
- call malloc
- and dword [edi], 0
- lea eax, [edi-file_handler.position]
- mov byte [read], 0xE9
- mov dword [read+1], read_from_mem - (read+5)
-; decode
- call jpeg_info
- mov dword [jpeg_st],ebp
- test ebp,ebp
- jz .end
-
- mov eax, [ebp + x_size]
- mul dword [ebp + y_size]
- lea eax, [eax*3+8]
- mov ecx, eax
- mcall 68, 12
- test eax, eax
- jz .end
- add eax, 8
- mov [ipc_mem_out], eax
- mov ebx, [ebp + x_size]
- mov [eax-8], ebx
- mov ebx, [ebp + y_size]
- mov [eax-4], ebx
-
- mov dword [ebp+draw_ptr],put_chunk_to_mem
- call jpeg_display
-
-; IPC response
- mov esi, [ebp + x_size]
- imul esi, [ebp + y_size]
- lea esi, [esi*3+8]
- mov edx, [ipc_mem_out]
- sub edx, 8
-.response:
- mov ecx, [ipc_mem]
- mov ecx, [ecx+8]
- mcall 60,2
-
- jmp close_program ; close the program right now
-
-.end:
- mov esi, 8
- mov edx, x_pointer ; points to 2 null dwords
- jmp .response
-
-read_from_mem:
-; in: eax=handle, ecx=size, edi=pointer to buffer
-; out: ecx=number of read bytes, buffer filled
- pushad
- mov esi, [ipc_mem]
- add esi, 16
- add esi, [eax+file_handler.position]
- add ecx, [eax+file_handler.position]
- cmp ecx, [ipc_mem_size]
- jb @f
- mov ecx, [ipc_mem_size]
-@@:
- sub ecx, [eax+file_handler.position]
- add [eax+file_handler.position], ecx
- rep movsb
- popad
- ret
-
-;******************************************************************************
-
-put_chunk_to_mem:
-; in: (eax,ebx) = start coordinates of chunk
-; (ecx,edx) = sizes of chunk
-; edi -> chunk data
- push esi edi edx
- mov esi, edi
- mov edi, ebx
- imul edi, [ebp + x_size]
- add edi, eax
- lea edi, [edi*3]
- add edi, [ipc_mem_out]
-@@:
- push ecx edi
- lea ecx, [ecx*3]
- rep movsb
- pop edi ecx
- add edi, [ebp + x_size]
- add edi, [ebp + x_size]
- add edi, [ebp + x_size]
- dec edx
- jnz @b
- pop edx edi esi
- ret
-
-;******************************************************************************
-
-
-
-; *********************************************
-; ******* WINDOW DEFINITIONS AND DRAW ********
-; *********************************************
-
-
-draw_window:
-
- mov eax,48
- mov ebx,3
- mov ecx,sc
- mov edx,sizeof.system_colors
- mcall
-
- mov eax,12
- mov ebx,1
- mcall
-
- ; Draw the window to the appropriate size - it may have
- ; been resized by the user
- cmp [winxs], 0
- jne dw_001
-
- ; Give the screen some inital defaults
- mov [winxs], 400
- mov [winys], 300
- mov ax, 100
- mov [winxo], ax
- mov [winyo], ax
- jmp dw_002
-
-dw_001:
- mov eax, 9
- mov ebx, memsize - 1024
- mov ecx, -1
- mcall
- mov eax, [ebx + 34]
- mov [winxo], ax
- mov eax, [ebx + 38]
- mov [winyo], ax
- mov eax, [ebx + 42]
- mov [winxs], ax
- mov eax, [ebx + 46]
- mov [winys], ax
-
-dw_002:
- mov ebx, dword [winxo-2]
- mov bx, [winxs]
- mov ecx, dword [winyo-2]
- mov cx, [winys]
-
- xor eax,eax ; DRAW WINDOW
- mov edx,[sc.work]
- or edx,0x33000000
- mov edi,title ; WINDOW LABEL
- mcall
-
-
- mov eax,8 ; BUTTON 2: slideshow
- mov ebx,57
- mov cx, [winys]
- sub cx, 39
- shl ecx, 16
- add ecx, 12
- mov esi, [sc.work_button]
- mov edx,2
- mcall
-
- mov eax,4 ; Button text
- movzx ebx, word [winys]
- add ebx, 3 shl 16 - 36
- mov ecx,[sc.work_button_text]
- mov edx,setname
- mov esi,setnamelen-setname
- mcall
-
-
- mov eax,8 ; BUTTON 3: set as background
- mov bx, [winxs]
- sub bx, 65
- shl ebx, 16
- mov bx,55
- mov cx, [winys]
- sub cx, 39
- shl ecx, 16
- add ecx, 12
- mov esi, [sc.work_button]
- mov edx,3
- mcall
-
- mov eax,4 ; Button text
- movzx ebx, word [winxs]
- sub ebx, 63
- shl ebx,16
- mov bx, word [winys]
- sub bx,36
- mov ecx,[sc.work_button_text]
- mov edx,setbgr
- mov esi,setbgrlen-setbgr
- mcall
- call print_strings
- call load_image
- mov eax,12 ; function 12:tell os about windowdraw
- mov ebx,2 ; 2, end of draw
- mcall
-
- ret
-
-
-
- ; Read in the image file name.
-read_string:
- movzx edi,byte[name_string.cursor]
- add edi,name_string
- mov eax,2
- mcall ; Get the key value
- shr eax,8
- cmp eax,13 ; Return key ends input
- je .rs_done
- cmp eax,8
- jnz .nobsl
- cmp edi,name_string
- je .exit
- dec edi
- mov [edi],byte 0;'_'
- dec byte[name_string.cursor]
- jmp print_strings
-.exit: ret
-.nobsl:
- cmp eax,31
- jbe .exit
- cmp eax,97
- jb .keyok
- sub eax,32
-.keyok:
- mov ah,0
- stosw
- cmp edi,name_string.end
- jnc print_strings
- inc byte[name_string.cursor]
- jmp print_strings
-.rs_done:
- call print_strings
- mov esi,name_string
- call open
- test eax,eax
- jz .exit
- call jpeg_info
- test ebp,ebp
- jz close
- xchg [jpeg_st],ebp
- call jpeg_close
-
-load_image:
-
- mov eax,13 ; clear picture area
- movzx ebx, word [winxs]
- add ebx, 1 shl 16 -10
- movzx ecx, word [winys]
- sub ecx, 40
- add ecx, 1 shl 16
-
- mov edx,[sc.work]
- mcall
- mov ebp,[jpeg_st]
- test ebp,ebp
- jz .exit
- mov dword [ebp+draw_ptr],put_image
- jmp jpeg_display
- .exit: ret
-
-print_strings:
- pusha
- mov eax,13 ; clear text area
- movzx ebx, word [winxs]
- add ebx, 59 shl 16 -125
- mov cx, [winys]
- sub cx, 39
- shl ecx, 16
- add ecx, 12
- mov edx,0xffffff
- mcall
-
- mov eax,4 ;
- movzx ebx, word [winys]
- add ebx, 61 shl 16 - 37
- mov ecx,0x000000
- mov edx,name_string
- mov esi,60
- mcall
- popa
- ret
-
-slideshow:
- cmp [file_dir], 0
- jnz .exit
- cmp [jpeg_st], 0
- jz .exit
- mov esi, name_string
- movzx ecx, byte [name_string.cursor]
-.l1:
- cmp byte [esi+ecx], '/'
- jz .l2
- loop .l1
-.exit:
- ret
-.l2:
- mov byte [esi+ecx], 0
- call open
- mov byte [esi+ecx], '/'
- test eax, eax
- jz .exit
- test byte [fileattr], 0x10
- jz .exit
- mov [file_dir], eax
- inc ecx
- mov [name_string.cursor], cl
-display_next:
- mov ebx, [file_dir]
- test ebx, ebx
- jnz @f
- ret
-@@:
- mov byte [ebx], 1
- mov byte [ebx+12], 1
- mov dword [ebx+16], dirinfo
- mov eax, 70
- mcall
- mov eax, [file_dir]
- inc dword [eax+4]
- cmp ebx, 1
- jz @f
- mov eax, [file_dir]
- and [file_dir], 0
- jmp close
-@@:
- movzx edi, byte [name_string.cursor]
- add edi, name_string
- lea esi, [dirinfo+32+40]
-@@:
- lodsb
- stosb
- test al, al
- jnz @b
- mov ecx, name_string.end
- sub ecx, edi
- rep stosb
- call print_strings
- mov esi,name_string
- call open
- test eax,eax
- jz display_next
- call jpeg_info
- test ebp,ebp
- jnz .l6
- call close
- jmp display_next
- .l6:
- mov dword[ebp+draw_ptr],put_image
- push ebp
- xchg [jpeg_st],ebp
- call jpeg_close
- pop ebp
- jmp jpeg_display
-
-
-include 'filelib.asm'
-include 'memlib.asm'
-include 'jpeglib.asm'
-
-
-; DATA AREA
-
-wcolor dd 0x000000
-drawing_mode dd 2
-title db appname,version,0
-setname db 'SLIDESHOW'
-setnamelen:
-
-setbgr db ' BGR '
-setbgrlen:
-
-x_pointer dd 0
-x_offset dd 0
-x_numofbytes dd 0
-x_numofb2 dd 0
-x_counter dd 0
-winxo dw 0
-winyo dw 0
-winxs dw 0
-winys dw 0
-jpeg_st dd 0
-file_dir dd 0
-name_string: db '/sys/jpegview.jpg',0
-rb 256
- .end:
- .cursor: db 19
- .cursor2: db 0
-
-align 4
-
-rgb16: db 0,4,8,13,17,21,25,29,34,38,42,46,50,55,59,63
-rgb4: db 0,21,42,63
-
-include 'jpegdat.asm'
-
-align 4
-
-iniciomemoria:
- dd -(iniciomemoria+4),-(iniciomemoria+4),(iniciomemoria+4),.l1,0
-.l1 dd 0
-
-I_END:
-sc system_colors
-ipc_mem dd ?
-ipc_mem_size dd ?
-ipc_mem_out dd ?
-fileattr: rb 40
-dirinfo: rb 32+304
-fin:
diff --git a/programs/media/jpegview/trunk/memlib.asm b/programs/media/jpegview/trunk/memlib.asm
deleted file mode 100644
index d6da26931f..0000000000
--- a/programs/media/jpegview/trunk/memlib.asm
+++ /dev/null
@@ -1,210 +0,0 @@
-
-movedata:
- push eax
- xor eax,eax
- sub eax,edi
- and eax,3
- xchg ecx,eax
- sub eax,ecx
- jle .l1
- rep movsb
- mov ecx,eax
- shr ecx,2
- rep movsd
- and eax,3
- .l1: add ecx,eax
- rep movsb
- pop eax
- ret
-
-mallocz:
- call malloc
- pushad
- add ecx,3
- xor eax,eax
- shr ecx,2
- rep stosd
- popad
- ret
-
- mresize1: popad
- xor edi,edi
- stc
- mresize2: ret
-mresize: ; puntero en di ncr retorna nuevo puntero en di
- test edi,edi
- jz malloc
- cmp ecx,[edi-4]
- je mresize2
- call free
-malloc:
- mov edi,ecx
- jecxz mresize2
- pushad
- mov esi,iniciomemoria+4
- lea ebx,[ecx+3]
- and ebx,-4 ;redondeo a 4
- .l1: mov edi,esi
- add esi,[esi]
- jc mresize1
- lodsd
- cmp eax,ebx
- jc .l1
- cmp esi,[iniciomemoria+8]
- jc .l2
- jne mresize1
- lea edx,[ebx+esi+4]
- cmp edx,[iniciomemoria+12]
- jnc mresize1
- mov [iniciomemoria+8],edx
- .l2: pop dword [esi-4]
- push esi
- sub eax,ebx
- je .l3
- sub eax,4
- mov [esi+ebx],eax
- jz .l3
- ;fragmentar
- add ebx,4
- add [edi],ebx
- mov eax,[esi]
- sub eax,ebx
- mov [esi+ebx],eax
- popad
- ret
- .l3: lodsd
- add eax,4
- add [edi],eax
- popad
- ret
-
-realloc: test edi,edi
- jz malloc
- jecxz free
- pushad
- pop esi
- mov eax,[edi-4]
- call malloc
- push edi
- cmp ecx,eax
- jc .l1
- mov ecx,eax
- .l1: push esi
- call movedata
- pop edi
- call free
- popad
- .l2: ret
-free: ;puntero en di
- ;no se comprueban los punteros
- ;retorna di=0 , ncr
- test edi,edi
- jz realloc.l2
- pushad
- pop edi
- mov ebp,[edi-4]
- dec ebp
- and ebp,-4 ;redondeo a 4,dx=dx-4
- xor edx,edx
- push edx
- mov edx,iniciomemoria+4
- mov esi,edx
- ;buscar puntero libre anterior
- .l1: mov ebx,esi
- lodsd
- add esi,eax
- cmp esi,edi
- jc .l1
- ;enlazar
- mov ecx,esi
- sub ecx,edi
- sub eax,ecx
- sub ecx,4
- mov [ebx],eax
- ;fusionar con el anterior
- cmp eax,[ebx-4]
- jne .l2
- cmp ebx,edx
- je .l2 ;no fusionar con el primero
- mov edi,ebx
- add eax,4
- add ecx,eax
- add ebp,eax
- .l2: mov ebx,ebp ;fusionar con bloques de tamaдo 0
- .l3: add ebx,4
- test dword [edi+ebx],-1
- jz .l3
- cmp ebx,ecx
- jne .l4
- ;fusionar con el siguiente
- add ebx,[esi-4]
- add ecx,[esi]
- add ebx,4
- add ecx,4
- cmp esi,[edx+4]
- jne .l4
- mov [edx+4],edi
- .l4: mov [edi-4],ebx
- mov [edi],ecx
- popad
- ret
-
-add_mem: ;edi,ecx ;el ultimo bloque libre debe ser >8 bytes para poder fragmentarlo
- cmp ecx,64
- jc .l1
- add ecx,edi
- add edi,3
- and edi,-4
- and ecx,-4
- mov eax,ecx
- sub ecx,edi ;redondeo
- xchg eax,[iniciomemoria+12]
- cmp edi,eax
- jna .l1
- lea esi,[edi+4]
- mov edx,esi
- xchg esi,[iniciomemoria+8]
- neg edx
- mov [edi],edx
- mov [edi+4],edx
- lea edx,[edi-4]
- sub edi,esi
- mov [esi],edi
- sub eax,4
- sub eax,esi
- mov [esi-4],eax
- add esi,eax
- sub edx,esi
- mov [esi],edx
- .l1: ret
-
-check_mem: ;busqueda de errores en la memoria
- ;retorna edx nbloques o 0 si error,ecx memoria libre
- ;ncr: ebp,ebx,eax
- mov edi,iniciomemoria
- mov esi,edi
- xor edx,edx
- mov ecx,[edi]
- neg ecx ;el primer bloque no cuenta
- .l1: add ecx,[edi]
- add edi,4
- add edi,[edi]
- .l2: inc edx
- add esi,[esi]
- jc .l4
- add esi,7
- jc .l3
- and esi,-4
- cmp esi,edi
- jc .l2
- je .l1
- jmp .l4
- .l3: test edi,edi
- jnz .l4
- add ecx,[iniciomemoria+12]
- ret
- .l4: xor edx,edx
- stc
- ret
-
-