Board index » delphi » MMX how to???

MMX how to???


2005-10-03 08:37:42 PM
delphi131
Hi there,
I tried to convert these routines using MMX instructions, but I cannot do
it. My knowledge is not good enough. Can somebody help me??? The should run
as many times as possible in one secound...
PByteArray = ^TByteArray;
TByteArray = array[0..100000] of Byte;
procedure A(P1, P2, P3: PByteArray; Count: Integer);
var
I: Integer;
begiun
for I := 0 to Count do
P1[I] := Max(P2[I], P3[I]);
end;
procedure B(P1, P2, P3: PByteArray; Count: Integer);
function Correct(A, B: Byte): ShortInt;
begin
Result := A - B;
if Result>0 then
begin
if Result>3 then
Result := 3;
end else
if Result < -3 then
Result := -3;
end;
var
I: Integer;
begin
for I := 0 to Count do
P1[I] := P2[I] + Correct(P2[I], P3[I]);
end;
Best regards,
Brian Andersen
 
 

Re:MMX how to???

Quote
for I := 0 to Count do
Shouldn't that be:
for I := 0 to Count - 1 do
?
 

Re:MMX how to???

Hi,
yes it should. My mistake.
Best regards,
Brian Andersen
 

Re:MMX how to???

XXXX@XXXXX.COM writes:
function Correct(A, B: Byte): ShortInt;
Quote
begin
Result := A - B;
if Result>0 then
begin
if Result>3 then
Result := 3;
end else
if Result < -3 then
Result := -3;
end;
This contains redundant code. Use this:
function Correct(A, B: Byte): ShortInt;
begin
Result := A - B;
if Result>3 then
Result := 3 else
if Result < -3 then
Result := -3;
end;
Cheers,
Nicholas Sherlock
 

Re:MMX how to???

Thanks. You are right! How blink can one be *s*.
/Brian