View Full Version : Pixel Smooth
list
26th January 2011, 15:49
Hi, this is my first plugin :helpful: . A simple but realy fast filter :p (SSE optimized) . Similar to Blur(.5,.5).
11985
Usage:
Loadplugin("pixelsmooth v0.1.dll")
ConvertToYV12() #YV12 only
PixelSmooth() #no arguments
or you can use PixelSmooth() PixelSmooth() 2, 3... times for larger smooth , it's even fast.
How does it work?
Each pixel takes the average between the two vertical and two horizontal neighbours (in luma field)
new pixel = P
source pixel = S
P(x,y) = S(x,y) /2 + ( S(x-1,y) + S(x+1,y) + S(x,y-1) + S(x,y+1) ) /8
Gavino
26th January 2011, 16:48
What advantages does this have over a simple Blur(1.0)?
list
26th January 2011, 17:19
What advantages does this have over a simple Blur(1.0)?
OK, with a isolated pixel, Blur(1,0) will smooth the 2 horizontal neighbours.
Blur (1,1) smooth 8 neghbours (producing a 3x3 grain)
PixelSmooth() smooths 4 neighbours (2 vertical and 2 horizontal).
also pixelsmooth() is about 2x faster than blur(1,1) (fewer operations?)
Motenai Yoda
26th January 2011, 17:52
blur(1,1) => p[i,j]=((p[i-1,j-1]+p[i+1,j-1]+p[i-1,j+1]+p[i+1,j+1])+2*(p[i,j-1]+p[i-1,j]+p[i+1,j]+p[i,j+1])+4*p[i,j])/16.0
pixelsmooth() => p[i,j]=(p[i,j-1]+p[i-1,j]+p[i+1,j]+p[i,j+1]+2*p[i,j])/8.0
list
26th January 2011, 18:09
pixelsmooth() => p[i,j]=(p[i,j-1]+p[i-1,j]+p[i+1,j]+p[i,j+1]+2*p[i,j])/8.0
pixelsmooth() => p[i,j]=(p[i,j-1]+p[i-1,j]+p[i+1,j]+p[i,j+1]+4*p[i,j])/8.0
Right, that's the result.:rolleyes:
Gavino
26th January 2011, 18:14
Blur (1,1) smooth 8 neghbours (producing a 3x3 grain)
PixelSmooth() smooths 4 neighbours (2 vertical and 2 horizontal).
Might that not lead to artefacts because of the non-isotropic nature of the filter (ie it blurs in horizontal and vertical directions, but not diagonally)?
blur(1,1) => p[i,j]=((p[i-1,j-1]+p[i+1,j-1]+p[i-1,j+1]+p[i+1,j+1])+2*(p[i,j-1]+p[i-1,j]+p[i+1,j]+p[i,j+1])+4*p[i,j])/16.0
pixelsmooth() => p[i,j]=(p[i,j-1]+p[i-1,j]+p[i+1,j]+p[i,j+1]+2*p[i,j])/8.0
(That 2 should be a 4)
Instead of Blur(1.0) (or Blur(1,1)), I should have compared it to Blur(0.5), which has a kernel of (approx)
1/8 * [0.2 0.8 0.2
0.8 4 0.8
0.2 0.8 0.2]
list
26th January 2011, 18:24
pixelSmooth does not multiply, it's just average of averages. That's why it works faster (though without arguments ^^)
Motenai Yoda
26th January 2011, 18:31
it's faster than removegrain(11,0,0) (identical to blur(1,1)) or than removegrain(12,0,0)?
I've mismatch cozP(x,y) = S(x,y) /2 + ( S(x-1,y) + S(x+1,y) + S(x,y-1) + S(x,y+1) ) /8
list
26th January 2011, 18:49
it's faster than removegrain(11,0,0) (identical to blur(1,1)) or than removegrain(12,0,0)?
Though they all are very fast:
removegrain(11,0,0) is faster than blur(1,1)
pixelsmooth() seems to be a bit faster or equal to removegrain(11,0,0)
and removegrain(12,0,0) is even 1,5x faster than pixelSmooth() but it seems to work horizontally (don't know how they work)
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.