Thank you in advance for your help. I have a problem when applying the median filtering to an image, the problem is that I only apply the filter halfway up and halfway down I put the black image, but I can not find what my error is.
I hope you can help me, this is my code.
.mmx
.model flat, stdcall
.stack 100h
;Prototipos de las funciones
ExitProcess PROTO, :DWORD
CreateFileA PROTO, :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WriteFile PROTO, :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
ReadFile PROTO, :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
.data
nombre db "nueva16.raw",0
nombre1 db "nueva16bin.raw",0
handle dd ?
handle1 dd ?
textoLeido dw 655 dup(?)
r1 dw 655 dup(?)
r2 dw 655 dup(?)
r3 dw 655 dup(?)
resto dw 428370 dup(?)
umbral db 8 dup(0)
valor db 8 dup(255)
texto dd ?
mascara dw 1,1,1,1
mascara1 dw 2,1,1,1
mascara2 dw 1
paquete dw 4 dup(0)
paquete1 dw 6 dup(0)
auxiliar dd 1 dup(0)
auxiliar2 dd 1 dup(0)
imagenProcesada dw 429025 dup(?)
n dw 9
m dw 649
emms
siguiente:
mov eax,0
mov eax,DWORD PTR textoLeido[edi]
mov DWORD PTR [ebx],eax
mov eax,DWORD PTR textoLeido[edi+4]
mov DWORD PTR [ebx+4],eax
mov eax,DWORD PTR textoLeido[edi+655]
mov DWORD PTR [ebx+6],eax
mov eax,DWORD PTR textoLeido[edi+659]
mov DWORD PTR [ebx+10],eax
mov eax,DWORD PTR textoLeido[edi+1310]
mov DWORD PTR [ebx+12],eax
mov eax,DWORD PTR textoLeido[edi+1314]
mov DWORD PTR [ebx+16],eax
movq mm0,QWORD PTR paquete
PMADDWD mm0,QWORD PTR mascara
movq mm1,QWORD PTR paquete1
PMADDWD mm1,QWORD PTR mascara1
PADDD mm0,mm1
movq QWORD PTR auxiliar,mm0
mov ax,WORD PTR auxiliar
add ax,WORD PTR auxiliar2
add ax,[ebx+16]
mov dx,0
div n
mov imagenProcesada[esi],ax
mov eax,edi
mov dx,0
div m
cmp dx,0
jne noIncrementesEn3
add edi,2
noIncrementesEn3:
inc edi
inc esi
cmp edi,427711 ;427818
je salir
jmp siguiente
salir:
call escribirArchivo
emms
INVOKE ExitProcess,0
main ENDP
creaArchivo proc
push 0
push 20H
push 2
push 0
push 3
push 0C0000000h
push offset nombre1
call CreateFileA
mov handle1,eax
ret
creaArchivo endp
abrirArchivo proc
push 0
push 20H
push 3
push 0
push 3
push 0C0000000h
push offset nombre
call CreateFileA
mov handle,eax
ret
abrirArchivo endp
escribirArchivo proc
call creaArchivo
push 0
push 0
push 429025 ; 426409;Numero de caracteres a escribir
push offset imagenProcesada
push handle1
call WriteFile
ret
escribirArchivo endp
leerArchivo proc
call abrirArchivo
push 0
push 0
push 262144
push offset textoLeido
push handle
call ReadFile
ret
leerArchivo endp
END