Gadget
28-01-2003, 07:17 PM
I am trying to get an MMX routine working using ASM and dont quite know how to get the 4 words out of mm0 back into my destination bitmap...
This is my test routine:-
for iX := 0 to Image1.Picture.Bitmap.Height - 1 do
begin
pSrc := Image1.Picture.Bitmap.ScanLine[iX];
pDest := Image2.Picture.Bitmap.ScanLine[iX];
iY := 0;
while iY < Image1.Picture.Bitmap.Width - 1 do
begin
asm
push EAX
push EDX
push ECX
mov EAX, pSrc
mov EDX, pDest
db $0F,$6F,$00 /// movq mm0, [EAX]
db $0F,$FD,$02 /// paddw mm0, [EDX]
db $0F,$7F,$01 /// movq [ECX], mm0
{this is the point I need to get the 4 x words out of mm0 into the scanline using pDest[iY], at the moment its outputting it to ECX}
pop ECX
pop EDX
pop EAX
end;
Inc(iY,4);
pSrc := Pointer(Cardinal(pSrc) + 4);
pDest := Pointer(Cardinal(pDest) + 4);
end;
end;
Any ideas?
Thanks
This is my test routine:-
for iX := 0 to Image1.Picture.Bitmap.Height - 1 do
begin
pSrc := Image1.Picture.Bitmap.ScanLine[iX];
pDest := Image2.Picture.Bitmap.ScanLine[iX];
iY := 0;
while iY < Image1.Picture.Bitmap.Width - 1 do
begin
asm
push EAX
push EDX
push ECX
mov EAX, pSrc
mov EDX, pDest
db $0F,$6F,$00 /// movq mm0, [EAX]
db $0F,$FD,$02 /// paddw mm0, [EDX]
db $0F,$7F,$01 /// movq [ECX], mm0
{this is the point I need to get the 4 x words out of mm0 into the scanline using pDest[iY], at the moment its outputting it to ECX}
pop ECX
pop EDX
pop EAX
end;
Inc(iY,4);
pSrc := Pointer(Cardinal(pSrc) + 4);
pDest := Pointer(Cardinal(pDest) + 4);
end;
end;
Any ideas?
Thanks