View Single Post
Old 10th March 2004, 17:07   #1  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
new deblocker script: funkydeblock

a recent thread got me thinking of deblocking, so i made one based on blindPP and high/lowpass separating (what's a generic word for that?).

it gives VERY similar results to blindPP(quant=x,cpu=4) but can eliminate some bitrate pumping effects as well, an delivers a not-insignificant compressibility gain (not as much as removedirt, but hey, we can't all be geniuses)

this is of most use on HEAVILY compressed source material, otherwise regular blindPP or mpeg2dec3's "cpu=4" will be enough.

Code:
function gauss (clip c,int "radius") {

radius=default(radius,1)

radius=radius*4
c.bilinearresize(4*(c.width/radius),4*(c.height/radius)).bicubicresize(c.width,c.height,1,0)

}

function funkydeblock (clip c,int "quant",int "th",int "radius", bool "deblock",bool "depump"){

quant=default(quant,4)
th=default(th,3)
radius=default(radius,4)
deblock=default(deblock,true)
depump=default(depump,true)

blurd = c.gauss(4)

highpass=subtract(blurd,c)
deblocked=(deblock==true) ? highpass.blindpp(quant=floor(quant),cpu=4) : highpass

nopump=subtract(blurd,deblocked)
pump=subtract(blurd.temporalsoften(radius,th,th,2*th,2),deblocked)

(depump==true) ? pump : nopump

}
the first little function is useful as well - it'll use blurry-bicubic resizing to give a gaussian-like blur at whatever radius you tell it.


okay... usage:

funkydeblock(clip c,int "quant",int "th",int "radius", bool "deblock",bool "depump")

quant: the quant param usually fed into blindPP. default 4. tis actually is very conservative due to the fact it's only used on the highpassed clip, so even quant=31 gives a good picture.

th: temporalsoften threshold. only active when depumping is on. default 3. this param controls how sensitive to pumping the filter is. keep it low, unless you're seeing large jumps at I frames. increase only as much as you have to, or dim moving objects will start vanishing.

radius: the number of frames before and after currentframe used in temporalsoften. default 4. this is intended to smear GOP changes, so pumping doesn't show as much.

deblock: turn deblocking on/off (only depumping is used). default true

depump: turn depumping on/off (only deblocking is used). default true
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote