Skip to content

Instantly share code, notes, and snippets.

@valexey
Created April 24, 2013 16:43
Show Gist options
  • Save valexey/5453596 to your computer and use it in GitHub Desktop.
Save valexey/5453596 to your computer and use it in GitHub Desktop.
PROCEDURE Blur2DArray*;
VAR
time : LONGINT;
f, n : INTEGER;
x, y : INTEGER;
color : INTEGER;
a, b : POINTER TO Plane;
BEGIN
NEW(a);
NEW(b);
time := Kernel.Time();
FOR f:=1 TO Frames DO
FOR n:=1 TO N DO
FOR y:=1 TO H-2 DO
FOR x:=1 TO W-2 DO
FOR color:=0 TO 2 DO
b[x*3+color,y] := SHORT(SHORT((a[x*3+color,y+1]+a[x*3+color,y-1]+a[(x-1)*3,y]+a[(x+1)*3,y]) DIV 4));
END
END
END;
FOR y:=1 TO H-2 DO
FOR x:=1 TO W-2 DO
FOR color:=0 TO 2 DO
a[x*3+color,y] := SHORT(SHORT((b[x*3+color,y+1]+b[x*3+color,y-1]+b[(x-1)*3,y]+b[(x+1)*3,y]) DIV 4));
END
END
END
END
END;
Out.Real((Kernel.Time() - time)/1000)
END Blur2DArray;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment