View Single Post
Old 13th September 2015, 18:09   #1  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
Request for help to convert some Avisynth functions

I'm trying to make the switch from Avisynth 2.6 to Vapoursynth as Avisynth has become very unstable ever since I got an i7. I'm currently trying to get the hang of the syntax and convert the stuff I always use to process videos.

I'm having some difficulties in converting the predenoiser helper functions that I use. Could someone please take a look at them and show some magic? There could be some native alternatives in Vapoursynth that I don't know of so feel free to customize if needed

Code:
function Prefilter (clip c, int "th", bool "chromamotion")
{
chromamotion = default(chromamotion, true)
output = Flux5framesT(c,th=th,chromamotion=chromamotion)
return output
}

function Flux5framesT(clip c, int "th", int "thC", bool "chromamotion")
{
chromamotion = default(chromamotion, true)
th  = default(th, 2)
thC = default(thC, chromamotion ? th : 0)
med = chromamotion ? ytouv(c.utoy8().median5t(), c.vtoy8().median5t(), c.median5t()) : c.median5t().mergechroma(c)
avg = c.temporalsoften(2, th, thC, 24, 2)
output = interleave(c, med, avg).clense(grey=!chromamotion).selectevery(3,1)
return output
}

function median5t(clip src)
{
function min(clip a, clip b) {return mt_logic(a, b, mode="min")}
function max(clip a, clip b) {return mt_logic(a, b, mode="max")}
src
last + trim(framecount()-1,-1).loop(5)
bcmin = min(SelectEvery(2, -1), SelectEvery(2, 0))
bcmax = max(SelectEvery(2, -1), SelectEvery(2, 0))
demin = bcmin.SelectEvery(1, 1)
demax = bcmax.SelectEvery(1, 1)
x = max(bcmin, demin)
y = min(bcmax, demax)
a = SelectEvery(2, -2)
f = SelectEvery(2, 3)
Interleave(a, x, y, f).Clense(grey=true).SelectEvery(4, 1, 2)
trim(0,length=src.framecount())
}
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote