Log in

View Full Version : Get BlockKiller work in MT?


matfra
14th August 2012, 02:46
Hi,
I found a fonction call BlockKiller on this thread. Its working very well to remove block and smooth shadow.
I made a ASVI of it, with all the function needed.
I cannot have it work in Mt mode. Its really slow by itself. Can someone help me to tweak it please.

BlockKiller ()


function BlockKiller(clip source)
{
y=source.greyscale()
y=y.ChannelBlockKiller()
u=source.utoy()
u=u.ChannelBlockKiller()
v=source.vtoy()
v=v.ChannelBlockKiller()

return ytouv(u, v, y)
}

function ChannelBlockKiller(clip source)
{
source
""" spline36resize(source.width*16,source.height*16)
gradfunkmirror()
gradfunkmirror()
gradfunkmirror()
spline36resize(source.width*8,source.height*8)
gradfunkmirror()
gradfunkmirror()
gradfunkmirror() """
spline36resize(source.width*4,source.height*4)
gradfunkmirror()
gradfunkmirror()
gradfunkmirror()
spline36resize(source.width*2,source.height*2)
gradfunkmirror()
gradfunkmirror()
gradfunkmirror()
spline36resize(source.width,source.height)
gradfunkmirror()
gradfunkmirror()
gradfunkmirror()

return last
}
# Border processing fix for GrandFun by MugFunky and Alain2
# Edit by Soulhunter: Changed strength from int -> float

Function GradFunkMirror( clip c, float "strength" )
{
strength = default( strength, 1.1)
w = c.width()
h = c.height()
vflip = c.FlipVertical()
hflip = c.FlipHorizontal()

stackhorizontal( hflip.crop( w-16, 0, 16, h ).addborders( 0, 16, 0, 16 ),
\ stackvertical( vflip.crop( 0, h-16, w, 16 ), c, vflip.crop( 0, 0, w, 16 ) ),
\ hflip.crop( 0, 0, 16, h ).addborders( 0, 16, 0, 16 ) )
gradfun2db( strength )
crop( 16, 16, -16, -16 )

Return last
}

Jawed
1st September 2012, 17:21
Seems like you found something I wrote.

I failed to get it to work multi-threaded, so if anyone has an answer I'd be interested.

By the way, here is the version I now use:

function BlockKiller(clip source, int "Scaling", int "ScalingUV")
{
Scaling = default(Scaling,4) # 4 is not too arduous
ScalingUV = default(ScalingUV,Scaling) # 4 is not too arduous

y=source.greyscale()
y=y.ChannelBlockKiller(Scaling)
u=source.utoy()
u=u.ChannelBlockKiller(ScalingUV)
v=source.vtoy()
v=v.ChannelBlockKiller(ScalingUV)

return ytouv(u, v, y)
}

function ChannelBlockKiller(clip source, int "Scaling")
{
Scaling = default(Scaling,4) # 4 is not too arduous
source
(Scaling >= 16) ? spline36resize(source.width*16,source.height*16).gradfunkmirror().gradfunkmirror().gradfunkmirror() : last
(Scaling >= 8) ? spline36resize(source.width*8,source.height*8).gradfunkmirror().gradfunkmirror().gradfunkmirror() : last
(Scaling >= 4) ? spline36resize(source.width*4,source.height*4).gradfunkmirror().gradfunkmirror().gradfunkmirror() : last
(Scaling >= 2) ? spline36resize(source.width*2,source.height*2).gradfunkmirror().gradfunkmirror().gradfunkmirror() : last
(Scaling >= 1) ? spline36resize(source.width,source.height).gradfunkmirror().gradfunkmirror().gradfunkmirror() : last
last

return last
}

I added parameters to control luma and chroma separately.

Makes experimentation much easier.

Truthfully, I use this filter very rarely, because it's so strong. Stuff gets very blurry very fast! So low settings are usually better.

If you want to try to make it faster one thing you can do is change the resizer to something faster than spline36resize.

One thing you should do is to use setmemorymax with a large value, because BlockKiller uses huge amounts of memory.