PDA

View Full Version : Where is mvbobmod available?


nnezz
18th December 2008, 02:34
I have interlaced, top field first, camcorder footage that I need to de-interlace.

mvbobmod (with nnedi) has been recommended in several threads here and also elsewhere on the web, but I haven't been able to find the complete script anywhere.

Will anyone be kind enough to share the mvbobmod script, and perhaps an example of how to use it (if it needs special input for plain old de-interlacing)?

A mention of any required dlls would be awesome too.

---
I already have McBob3u working, but it's a bit slow, even when using MT (3 fps). MvBobMod should speed things up a little, but still give good quality, from what the web says.

Nightshiver
18th December 2008, 04:16
Here:

function MvBobMod(clip c,int "Type",int "Lambda",float "ml",float "gamma", bool "showmask")
{
# "Type" declares the kind of interpolation applied to no compensated moving areas:
# 0 -> kernel from tdeint : function tdeintTMMbob
# 1 -> Bicubic from Yadif : function yadifmodBob
# 2 -> NNEDI from yadif : function YadifModNnedi
# 3 -> NNEDI from tdeint : function TdeintTMMnnedi

Type = Default(Type, 3)
Showmask = Default (Showmask,false)
Lambda = Default(lambda,2000)
ml = Default(ml,15)
idx = rand()
# threshold for correcting failed compensated motion
correctTh = 50
gamma = Default(gamma,8.0)
Assert(type >= 0 && type <= 3 , "type = "+ String (type) + " is not valid ")
#determine clip Fieldorder
Order = (c.GetParity == True) ? 1 : 0
Input = IsYV12(c) ? c : ConvertToYv12(c,interlaced=true)

# create a motion adaptive bobbed clip

Bobbed =(Type == 0) ? Input.tdeintTMMbob():
\(Type == 1) ? Input.yadifmodbob() :
\(Type == 2) ? Input.YadifModNnedi():
\Input. TdeintTMMnnedi()

# create motion vectors
mvf = Bobbed.MvAnalyse( isB = False,Chroma = True, idx = idx, TrueMotion = true, Sharp = 2, Lambda = Lambda, Overlap = 4)
mvb = Bobbed.MvAnalyse( isB = True, Chroma = True, idx = idx, TrueMotion = true, Sharp = 2, Lambda = Lambda, Overlap = 4)

# create the motion compensated clip that are passed through to the output
MoCompFWD = bobbed.MvCompensate(mvf, idx = idx)
MoCompBWD = bobbed.MvCompensate(mvb, idx = idx)

# create clips for mismatch detection
AnalyseBobCurr = Bobbed.BicubicResize(Input.Width * 2, Input.Height).MedianBlur().BicubicResize(Input.Width, Input.Height)
AnalyseCompFWD = MoCompFWD .BicubicResize(Input.Width * 2, Input.Height).MedianBlur().BicubicResize(Input.Width, Input.Height)
AnalyseCompBWD = MoCompBWD .BicubicResize(Input.Width * 2, Input.Height).MedianBlur().BicubicResize(Input.Width, Input.Height)

# detect mismatches of mvtools and replace them with motion adaptive bobbed areas
MoCompCorrected = Corrector(AnalyseBobCurr, Bobbed, AnalyseCompFWD, AnalyseCompBWD, MoCompFWD, MoCompBWD, Mode = 0, Th = CorrectTh)

MOmask = mt_average(MVMask(bobbed,mvf,ml=ml,kind=0,gamma = gamma,Ysc=255),MVMask(bobbed,mvb,ml=ml,kind=0,gamma = gamma,Ysc=255))

# Select the Interpolated Fields
Compensated_Even = MoCompCorrected.SelectEven().SeparateFields().SelectOdd()
Compensated_Odd = MoCompCorrected.SelectOdd() .SeparateFields().SelectEven()

# Select the Original Fields
Original_Even = Input.SeparateFields().SelectEven()
Original_Odd = Input.SeparateFields().SelectOdd()

# Merge them
Output_Even = Interleave(Original_Even, Compensated_Even).Weave()
Output_Odd = Interleave(Original_Odd , Compensated_Odd ).Weave()
Output = Interleave(Output_Even, Output_Odd)

outputCorrected = mt_Merge(output,bobbed,Momask ,U = 3, V = 3)
#outputCorrected = overlay(output,bobbed,,mask=Momask,opacity=1.0)

# Assign the correct Fieldorder to the Output in Order to allow correct processing for following filters
Output = (order == 1) ? Output.AssumeTFF() : Output.AssumeBFF()

Return showmask == false ? outputCorrected.vinverse() : overlay(Momask,bobbed,mask=Momask)
\.subtitle("mask\ngreen => motion compensation\nvisible => spatial interpolation",lsp=10)
\.subtitle("ml = " + string(ml),y=70)
\.subtitle("gamma = " + string(gamma),y=90)
}

The link: http://www.pate15.de/entrelacement/mvbobMod.avs

nnezz
18th December 2008, 10:20
Thank you!