Little Help

anyone can say what's is the error in this conversion of code:
[code]
pdest[y][x]= (porig[y][x] * factor) / 1000;
pdest[y][x+1]= (porig[y][x+1] * factor) / 1000;
pdest[y][x+2]= (porig[y][x+2] * factor) / 1000;

[/code]

converting c to assembley, the problem is in the assembley code

[code]
mov ebx, dword ptr [ebp+16] //porig
mov ecx, X //x
mov edx, Y //y
mov esi, dword ptr [ebx+4*edx] //point linha da img orig
mov al, byte ptr [esi+ecx] //porig [y][x] -> al

mul FACTOR
mov ecx, 1000
cdq
idiv ecx

mov ebx, dword ptr [ebp+20] //pdest
mov ecx, X //x
mov edx, Y //y
mov edi, dword ptr [ebx+4*edx] //point linha da img dest
mov byte ptr [edi+ecx], al //pdest[y][x]= (porig[y][x] * factor) / 1000


mov ebx, dword ptr [ebp+16] //porig
mov ecx, X //x
inc ecx //x+1
mov edx, Y //y
mov esi, dword ptr [ebx+4*edx] //point linha da img orig
mov al, byte ptr [esi+ecx] //porig [y][x+1] -> al

mul FACTOR
mov ecx, 1000
cdq
idiv ecx

mov ebx, dword ptr [ebp+20] //pdest
mov ecx, X //x
inc ecx //x+1
mov edx, Y //y
mov edi, dword ptr [ebx+4*edx] //point linha da img dest
mov byte ptr [edi+ecx], al //pdest[y][x+1]= (porig[y][x+1] * factor) / 1000


mov ebx, dword ptr [ebp+16] //porig
mov ecx, X //x
add ecx, 2 //x+2
mov edx, Y //y
mov esi, dword ptr [ebx+4*edx] //point linha da img orig
mov al, byte ptr [esi+ecx] //porig [y][x+2] -> al

mul FACTOR
mov ecx, 1000
cdq
idiv ecx

mov ebx, dword ptr [ebp+20] //pdest
mov ecx, X //x
add ecx, 2 //x+2
mov edx, Y //y
mov edi, dword ptr [ebx+4*edx] //point linha da img dest
mov byte ptr [edi+ecx], al //pdest[y][x+2]= (porig[y][x+2] * factor) / 1000

[/code]

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion