View Full Version : MCBob


Didée
12th April 2007, 09:55
Well, since the thread is there now, I reserve this "toplevel" post to possibly add a general survey. (Not too soon - somewhen later this year...)

Fizick
12th April 2007, 15:38
mcbob was firstly posted here:
http://forum.doom9.org/showthread.php?p=891383#post891383

Wilbert
12th April 2007, 18:53
I am sure, the very post in such thread must be be created by Didee, so this thread is not appropriate.
Morsa, please delete it!

If Didee doesn't do it, other people are allowed to. There is no need to delete anything.

Anyway, v0.3c is the latest i could find and is posted below. Are there any posts discussing mcbob? If so, please point me to them, then i will add them as references.


# MCBob v0.3:
#
# Another approach to motion compensated bobbing, build by Didée.
#
# ( Between-all-chairs version with some quick hacks )
# ( v0.3c: as stated above, but worse ;-) )
#
# Features:
#
# - No residual combing, due to STT (Shape Transposition Technology)
# - Works without thresholds (with adaptive thresholds instead of fixed ones)
# - Motion Search between fields of same parity, for maximum flicker/bob reduction in motion areas
# - Motion Masking adaptive to local complexity, for maximum flicker/bob reduction in static areas
# - spatial Interpolation overweights spatio-temporal interpolation
# ( in areas where the information obtained from temporal neighbors in itself was only spatially
# interpolated, use a mix of spatial and spatio-temporal interpolation )
# - error correction for temporal interpolation is fully self adaptive
#
# Prerequisites:
#
# - MVTools, preferably v1.4.13 (or newer)
# - MaskTools v2.0
# - EEDI2
# - RemoveGrain/Repair package
# - ReduceFlicker (if temp-NR for ME is used)
# - MedianBlur by tsp

http://home.arcor.de/dhanselmann/_stuff/MCBob_v03c.avs

Wilbert
12th April 2007, 18:53
function MCBob(clip clp, float "EdiPre", int "EdiPost", int "blocksize", int "MEdepth", float "sharpness", int "mtnmode", float "mtnth1", float "mtnth2", float "errth1", float "errth2", float "MEspatNR", float "MEtempNR")
{
EdiPre = default( EdiPre, 1.0 ) # What bob to start with: 0.0 = dumbbob, 1.0 = EEdiBob, inbetween = mix of both
EdiPost = default( EdiPost, 1 ) # 0 = no EEDI PP / 1 = Framesized EEdi PP / Average two Fieldbased EEdi PP's
bs = default( blocksize, 16 ) # Blocksize for motion search
me = default( MEdepth, 2 ) # Search effort of motion search
sharpness = (EdiPost==2)
\ ? default( sharpness, 0.7 )
\ : default( sharpness, 1.0 ) # use slight sharpening before STT routine

mtnmode = default( mtnmode, 0 ) # 0 = use only same-parity motion check, 1|2 use an additional
# inter-parity check: 1 = on vertical edges / 2 = not on horizontal edges
mtnth1 = default( mtnth1, 0.20 ) # below this %age of local min/max is static
mtnth2 = default( mtnth2, 0.40 ) # above this %age of local min/max is motion
errth1 = default( errth1, 0.40 ) # similar for error detection
errth2 = default( errth2, 0.60 ) # of motion interpolation errors
MEspatNR = default( MEspatNR, 0.00 ) # amount of spatial NR (for motion search only)
MEtempNR = default( MEtempNR, 0.00 ) # amount of temporal NR (for motion search only)

order = (clp.GetParity == True) ? 0 : 1
ORDR = (order==0) ? "TFF" : "BFF"

ox = clp.width()
oy = clp.height()
ERTH1 = string(errth1)
ERTH2 = string(errth2)
MNTH1 = string(mtnth1)
MNTH2 = string(mtnth2)
SSTR = string(sharpness)
idx_1 = 10
idx_2 = (MEspatNR==0.0 && MEtempNR==0.0) ? idx_1 : idx_1+2
idx_3 = idx_2 + 2


# Create basic operations that we will work with
# ==============================================

# Basic Field & Bob clips
# -----------------------
flatbob = clp.Bob(1,0)
normbob = clp.Bob(0.0,0.5)
ofields = clp.SeparateFields()
oweave = clp.DoubleWeave()
edibobbed = clp.EEDIbob()
bobbed = (EdiPre == 0.0) ? normbob
\ : (EdiPre == 1.0) ? edibobbed
\ : normbob.merge(edibobbed,EdiPre)


# Mask to check if motion compensation has delivered only the neighbor's spatial interpolated part
# ------------------------------------------------------------------------------------------------
black = Blankclip(ofields).mt_lut("0").Trim(1,1).Loop(Framecount(clp))
white = Blankclip(ofields).mt_lut("255").Trim(1,1).Loop(Framecount(clp))
interpol = Interleave(black,white,white,black).AssumeFieldbased().AssumeParity(ORDR).Weave()


# Vertical Edge mask, needed for more safe motion masking
# -------------------------------------------------------
Vedge = bobbed.mt_Edge("1 0 -1 2 0 -2 1 0 -1",0,255,0,255,U=1,V=1)
Vedge2 = Vedge.mt_Inpand(mode="vertical").mt_Inpand(mode="vertical").mt_Expand(mode="vertical").mt_Expand(mode="vertical")
Vedge = mt_Lutxy(Vedge,Vedge2,yexpr="y 2 - 2 * x > x y 2 - 2 * ?") #.mt_Expand()

Hedge = bobbed.mt_Edge("1 2 1 0 0 0 -1 -2 -1",0,255,0,255,U=1,V=1)
Hedge = Hedge.mt_logic(Hedge.temporalsoften(1,255,0,255,2),"max")


# If requested, do flicker reduction before searching motion vectors
# -------------------------------------------------------------------
(MEspatNR==0.0) ? bobbed : bobbed.Merge(bobbed.minblur(2,uv=3),MEspatNR)
(MEtempNR==0.0) ? last : last.Merge(reduceflicker(2),MEtempNR)
srch=last


# Perform Motion Search
# ---------------------
lmbda = 128
pnw = 40
bw_vec2 = srch.SelectEven().MVAnalyse(isb=true, truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1)
fw_vec2 = srch.SelectEven().MVAnalyse(isb=false,truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1)
bw_vec3 = srch.SelectOdd() .MVAnalyse(isb=true, truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1+1)
fw_vec3 = srch.SelectOdd() .MVAnalyse(isb=false,truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1+1)


# Create RAW motion interpolation
# -------------------------------
alt_1 = bobbed.SelectEven().MVFlowInter(bw_vec2,fw_vec2,time=50.0,thSCD1=64*18,thSCD2=227,idx=idx_2)
alt_2 = bobbed.SelectOdd() .MVFlowInter(bw_vec3,fw_vec3,time=50.0,thSCD1=64*18,thSCD2=227,idx=idx_2+1).DuplicateFrame(0)
alt = Interleave(alt_2,alt_1)


# Create motion interpolation of "nothing new" mask
# -------------------------------------------------
interpol_1 = interpol.SelectEven().MVFlowInter(bw_vec2,fw_vec2,time=50.0,thSCD1=64*8,thSCD2=127,idx=idx_3)
interpol_2 = interpol.SelectOdd() .MVFlowInter(bw_vec3,fw_vec3,time=50.0,thSCD1=64*8,thSCD2=127,idx=idx_3+1).DuplicateFrame(0)
interpol_comp= Interleave(interpol_2,interpol_1)
nothing_new = mt_lutxy(interpol,interpol_comp,"x y * 255 / 255 / 1 2 / ^ 160 *")


# Error check of motion interpolation
# ===================================
# Errors that are neutralized by errors in direct vertical neighborhood are not considered, because bob-typical.
# Remaining error is checked against [min,max] of local error to decide if it's valid or not.
#
# Build error mask, neutralize vertical-only errors
# ---------------------------------------------------
altD = mt_Makediff(bobbed,alt,U=3,V=3)
altDmin = altD.mt_Inpand(mode="vertical",U=3,V=3)
altDmin = altDmin.mt_Deflate().mt_Merge(altDmin,Vedge,U=4,V=4)
altDmax = altD.mt_Expand(mode="vertical",U=3,V=3)
altDmax = altDmax.mt_Inflate().mt_Merge(altDmax,Vedge,U=4,V=4)
altDmm = mt_Lutxy(altDmax.mt_Expand(mode="horizontal",U=3,V=3),altDmin.mt_Inpand(mode="horizontal",U=3,V=3),"x y -",U=3,V=3)
altDmm = altDmm.mt_Inflate().mt_Merge(altDmm,Vedge,U=4,V=4)
altD1 = altD .mt_Lutxy(altDmin,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
altD1 = altD1.mt_Lutxy(altDmax,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
altD2 = altD.Repair(altD1,1)


# Build correction mask by combining: error mask + "nothing new" mask + a scenechange mask
# ---------------------------------------------------------------------------------------------
corrmask = mt_Lutxy(altD2,altDmm,"x 128 - abs 2 - y 2 + / "+ERTH1+" - "+ERTH2+" "+ERTH1+" - / 255 *",U=3,V=3).mt_Expand(U=3,V=3)
sc = corrmask.BilinearResize(64,64)
sc = mt_LutF(sc,sc,mode="average",expr="x 255 0.6 * > 255 0 ?").PointResize(ox,oy)
corrmask = corrmask.mt_Logic(nothing_new,"max",U=2,V=2)
corrmask = corrmask.mt_Logic(sc,"max",U=2,V=2)


# Create a first bob from motion interpolation, not yet error corrected ...
# -------------------------------------------------------------------------
# ***( temporarily changed ... yet unsure what works best )***

Interleave(bobbed,alt).AssumeParity(ORDR)
SeparateFields().SelectEvery(8,0,3,5,6).Weave()
naked= last
naked2 = last.vinverse(1.6) # flatbob #

naked_mm = naked.mt_Edge("min/max",0,255,0,255,U=1,V=1)
edibb_mm = edibobbed.mt_Edge("min/max",0,255,0,255,U=1,V=1).mt_Expand(mode="vertical")
check2 = mt_LutXY(naked_mm,edibb_mm,"x y / 3 - 5 3 - / 255 *")
corrmask = corrmask.mt_Logic(check2,"max",U=2,V=2)


# ... and build a motion mask from this one.
# ------------------------------------------
# ***( temporarily changed ... tickertapes might suffer. )***

stc = bobbed .removegrain(2)# oweave.removegrain(11)
mm = stc.mt_Edge("min/max",0,255,0,255,U=3,V=3)
# mm = mm .mt_Logic(mm.DuplicateFrame(0),"max",U=3,V=3).mt_Logic(mm.DeleteFrame(0),"max",U=3,V=3)
# max = stc.mt_expand(U=3,V=3)
# max = max.mt_logic(max.Duplicateframe(0),"max",U=3,V=3).mt_logic(max.Duplicateframe(0).Duplicateframe(0),"max",U=3,V=3)
# min = stc.mt_inpand(U=3,V=3)
# min = min.mt_logic(min.Duplicateframe(0),"min",U=3,V=3).mt_logic(min.Duplicateframe(0).Duplicateframe(0),"min",U=3,V=3)
# mm = mt_LutXY(max,min,"x y -",U=3,V=3)
diff2prev1 = mt_LutXY(stc,stc.DuplicateFrame(0),"x y - abs",U=3,V=3)
diff2prev2 = mt_LutXY(stc,stc.DuplicateFrame(0).DuplicateFrame(0),"x y - abs",U=3,V=3)

diff2prev12 = (mtnmode==0) ? diff2prev2 :
\ (mtnmode==1) ? diff2prev2 .mt_Merge(diff2prev1,Vedge,U=2,V=2)
\ : diff2prev1 .mt_Merge(diff2prev2,Hedge,U=2,V=2)

motn = diff2prev12.mt_Logic(diff2prev12.DeleteFrame(0),"max",U=3,V=3).mt_Logic(diff2prev12.DeleteFrame(0).DeleteFrame(0),"max",U=3,V=3)
notstatic = mt_LutXY(motn,mm,"x 1 - y 1 + / "+MNTH1+" - "+MNTH2+" "+MNTH1+" - / 255 *",U=3,V=3).mt_Expand(U=3,V=3).mt_Inpand(U=3,V=3)
# notstatic = notstatic.mt_Logic(notstatic.RemoveGrain(4),"max",U=3,V=3).mt_Expand(U=3,V=3).mt_Inpand(U=3,V=3)


# Now do the error correction of the "naked" MC-bob
# -------------------------------------------------
naked .mt_Merge(edibobbed,corrmask,luma=false,U=3,V=3) .Vinverse(2.7-sharpness)
repaired = last


# If requested, sharpen the corrected MC-bob up a little
# ( pre-sharpen for EdiPost = 0 | 1 )
# ------------------------------------------------------
shrpbase = last#.MinBlur(1,1).Merge(RemoveGrain(12,-1),0.23)
shrp = mt_LutXY(shrpbase,shrpbase.RemoveGrain(11,-1),"x x y - abs 16 / 1 1 x y - abs 1 4 / ^ + / ^ 16 * "+SSTR+" * x y - x y - abs 1.3 + / * 1 x y - abs 16 / 1 4 / ^ + / +",U=2,V=2)
# \ .Repair(repaired,1,0)
shrpD = mt_Makediff(shrpbase,shrp)

(sharpness==0.0 || EdiPost==2) ? last : last .mt_Makediff(MergeLuma(shrpD.MinBlur(1,uv=1),shrpD.RemoveGrain(12,-1),0.24),U=2,V=2)


# If requested, do additional PP via EEDI2
# ----------------------------------------
oweave.mt_merge(last,notstatic,luma=false,U=3,V=3)
AssumeTFF()
edisingle = eedi2().LanczosResize(ox,oy,0,-0.5,ox,2*oy+0.001,taps=3)
edidouble = merge(SeparateFields().SelectEven().eedi2(field=1),SeparateFields().SelectOdd().EEDI2(field=0),0.5)
edidoubleD = mt_makediff(last,edidouble,U=3,V=3)
(EdiPost==1) ? edisingle : \
(EdiPost==2) ? edidouble : last

# ( post-sharpen for EdiPost = 2 )
# ------------------------------------------------------
edidoubleshrpD = mt_makediff(edidouble,sharpness==1.0?edidouble.removegrain(20):edidouble.removegrain(20).merge(edidouble,1.0-sharpness),U=3,V=3)
edidoubleshrpD = edidoubleshrpD.repair(edidoubleD,13)
(EdiPost==2) ? edidouble.mt_adddiff(edidoubleshrpD,U=3,V=3) : last


# STT (Shape Transposition Technology) Routine:
# =============================================
# Simply weaving the corrected output with the original fields is bad, because the risk of
# creating unwanted residual combing is too high.
# Instead, the vertical "shape" is taken off the corrected output, and transposed
# onto the fixed "poles" of the original fields' scanlines. Et Voila.
# ----------------------------------------------------------------------------------------
synthbob = last.AssumeParity(ORDR).SeparateFields().SelectEvery(4,0,3).Weave().Bob(1,0)
mapped_new = flatbob.mt_makediff(mt_makediff(synthbob,last,U=3,V=3),U=3,V=3)
newfields = mapped_new.AssumeParity(ORDR).SeparateFields().SelectEvery(4,1,2)
mappedbob = Interleave(ofields,newfields).SelectEvery(4,0,1,3,2).AssumeParity(ORDR).Weave()


# Finally, for static areas use just original fields
# --------------------------------------------------
mappedbob
#bobbed

oweave.mt_merge(last,notstatic.mt_inpand(Y=2,U=2,V=2),luma=false,U=3,V=3)


# Lastly, set correct parity for the bobbed clip
# ----------------------------------------------
(order==0) ? AssumeTFF() : AssumeBFF()

return(last)
}

# ===============================================

############################
# Helper functions below #
############################


## Function EEDIbob, courtesty of scharfis_brain:

# slow, but accurate EEDI-bob, always dumb ;)
# altering maxd changes the search radius for connecting diagonal lines

Function EEDIbob(clip Input, int "maxd")
{
#GetParity(Input) ? Input.SeparateFields().EEDI2(Field = 3, maxd = maxd, pp = 0, estr = 0, dstr = 0, mthresh = 0, vthresh = 0, lthresh = 0) : Input.SeparateFields().EEDI2(Field = 2, maxd = maxd, pp = 0, estr = 0, dstr = 0, mthresh = 0, vthresh = 0, lthresh = 0)
GetParity(Input) ? Input.SeparateFields().EEDI2(Field = 3, maxd = maxd) : Input.SeparateFields().EEDI2(Field = 2, maxd = maxd)

AssumeFrameBased()
GetParity(Input) ? AssumeTFF() : AssumeBFF()
}


# Helper to simplify script
function AssumeParity(clip clp, string "order")
{
order == "TFF" ? clp.assumeTFF() : clp.assumeBFF()
return(last)
}

# Kill Combing Function
function Vinverse(clip clp, float "sstr", int "amnt", int "uv")
{
uv = default(uv,3)
sstr = default(sstr,2.7)
amnt = default(amnt,255)
uv2 = (uv==2) ? 1 : uv
STR = string(sstr)
AMN = string(amnt)
vblur = clp.mt_convolution("1","50 99 50",U=uv,V=uv)
vblurD = mt_makediff(clp,vblur,U=uv2,V=uv2)
Vshrp = mt_lutxy(vblur,vblur.mt_convolution("1","1 4 6 4 1",U=uv2,V=uv2),expr="x x y - "+STR+" * +",U=uv2,V=uv2)
VshrpD = mt_makediff(Vshrp,vblur,U=uv2,V=uv2)
VlimD = mt_lutxy(VshrpD,VblurD,expr="x 128 - y 128 - * 0 < x 128 - abs y 128 - abs < x y ? 128 - 0.25 * 128 + x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
mt_adddiff(Vblur,VlimD,U=uv,V=uv)
(amnt>254) ? last : (amnt==0) ? clp : mt_lutxy(clp,last,expr="x "+AMN+" + y < x "+AMN+" + x "+AMN+" - y > x "+AMN+" - y ? ?",U=uv,V=uv)
return(last)
}

# Nifty Gauss/Median combination
function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r==1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}

zambelli
13th April 2007, 05:47
Though it's in a language I can't read, I've often found this page very useful in collecting all the necessary plugins for MCBob:
http://www.avisynth.info/?MCBob
It'd be nice to see a similar list of links in this thread's top post.

morsa
13th April 2007, 06:34
Is there any way to delete my first post without deleting the whole thread?
Any administrator out there?

Revgen
12th October 2007, 02:41
Just bought a QX6850 Quad-Core CPU with 4 gigs of DDR-2 RAM. I decided to use NNEDI+mcbob on a 1 hour 44 minute basketball game capped with Huffyuv and encode it to Lagarith. I trimmed each section of the video into 4 parts and assigned each part to each core. It took a total of about 16 hours to complete, so basically I got a combined total of about 5-6FPS. That's faster than what mvbob ran on my Athlon X2 4600+. Anyhoo, it's great to finally be able to use the best bobber on the planet at pretty reasonable speeds.

Adub
14th October 2007, 03:00
Lucky bastard.

Adub
14th October 2007, 03:06
NNEDI + MCBOB
# MCBob v0.3:
# nnedi and nnedibob was made possible by tritical and the fellow Doom9 community who contributed CPU cycles.
# Another approach to motion compensated bobbing, build by Didée.
#
# ( Between-all-chairs version with some quick hacks )
# ( v0.3c: as stated above, but worse ;-) )
# ( v0.3u (unofficial): use new nnEDI interpolater by tritical, modded by Terranigma)
# Features:
#
# - No residual combing, due to STT (Shape Transposition Technology)
# - Works without thresholds (with adaptive thresholds instead of fixed ones)
# - Motion Search between fields of same parity, for maximum flicker/bob reduction in motion areas
# - Motion Masking adaptive to local complexity, for maximum flicker/bob reduction in static areas
# - spatial Interpolation overweights spatio-temporal interpolation
# ( in areas where the information obtained from temporal neighbors in itself was only spatially
# interpolated, use a mix of spatial and spatio-temporal interpolation )
# - error correction for temporal interpolation is fully self adaptive
#
# Prerequisites:
#
# - MVTools, preferably v1.4.13 (or newer)
# - MaskTools v2.0
# - nnEDI 1.3 +
# - RemoveGrain/Repair package
# - ReduceFlicker (if temp-NR for ME is used)
# - MedianBlur by tsp

Adub
14th October 2007, 03:06
Cont.

function MCBob(clip clp, float "EdiPre", int "EdiPost", int "blocksize", int "MEdepth", float "sharpness", int "mtnmode", float "mtnth1", float "mtnth2", float "errth1", float "errth2", float "MEspatNR", float "MEtempNR")
{
EdiPre = default( EdiPre, 1.0 ) # What bob to start with: 0.0 = dumbbob, 1.0 = nnEdiBob, inbetween = mix of both
EdiPost = default( EdiPost, 2 ) # 0 = no nnEDI PP / 1 = Framesized nnEdi PP / Average two Fieldbased nnEdi PP's
bs = default( blocksize, 16 ) # Blocksize for motion search
me = default( MEdepth, 2 ) # Search effort of motion search
sharpness = (EdiPost==2)
\ ? default( sharpness, 0.7 )
\ : default( sharpness, 1.0 ) # use slight sharpening before STT routine

mtnmode = default( mtnmode, 1 ) # 0 = use only same-parity motion check, 1|2 use an additional
# inter-parity check: 1 = on vertical edges / 2 = not on horizontal edges
mtnth1 = default( mtnth1, 0.20 ) # below this %age of local min/max is static
mtnth2 = default( mtnth2, 0.40 ) # above this %age of local min/max is motion
errth1 = default( errth1, 0.40 ) # similar for error detection
errth2 = default( errth2, 0.60 ) # of motion interpolation errors
MEspatNR = default( MEspatNR, 0.00 ) # amount of spatial NR (for motion search only)
MEtempNR = default( MEtempNR, 0.00 ) # amount of temporal NR (for motion search only)

order = (clp.GetParity == True) ? 0 : 1
ORDR = (order==0) ? "TFF" : "BFF"

ox = clp.width()
oy = clp.height()
ERTH1 = string(errth1)
ERTH2 = string(errth2)
MNTH1 = string(mtnth1)
MNTH2 = string(mtnth2)
SSTR = string(sharpness)
idx_1 = 10
idx_2 = (MEspatNR==0.0 && MEtempNR==0.0) ? idx_1 : idx_1+2
idx_3 = idx_2 + 2


# Create basic operations that we will work with
# ==============================================

# Basic Field & Bob clips
# -----------------------
flatbob = clp.Bob(1,0)
normbob = clp.Bob(0.0,0.5)
ofields = clp.SeparateFields()
oweave = clp.DoubleWeave()
nnedibobbed = clp.nnEDIbob()
bobbed = (EdiPre == 0.0) ? normbob
\ : (EdiPre == 1.0) ? nnedibobbed
\ : normbob.merge(nnedibobbed,EdiPre)


# Mask to check if motion compensation has delivered only the neighbor's spatial interpolated part
# ------------------------------------------------------------------------------------------------
black = Blankclip(ofields).mt_lut("0").Trim(1,1).Loop(Framecount(clp))
white = Blankclip(ofields).mt_lut("255").Trim(1,1).Loop(Framecount(clp))
interpol = Interleave(black,white,white,black).AssumeFieldbased().AssumeParity(ORDR).Weave()


# Vertical Edge mask, needed for more safe motion masking
# -------------------------------------------------------
Vedge = bobbed.mt_Edge("1 0 -1 2 0 -2 1 0 -1",0,255,0,255,U=1,V=1)
Vedge2 = Vedge.mt_Inpand(mode="vertical").mt_Inpand(mode="vertical").mt_Expand(mode="vertical").mt_Expand(mode="vertical")
Vedge = mt_Lutxy(Vedge,Vedge2,yexpr="y 2 - 2 * x > x y 2 - 2 * ?") #.mt_Expand()

Hedge = bobbed.mt_Edge("1 2 1 0 0 0 -1 -2 -1",0,255,0,255,U=1,V=1)
Hedge = Hedge.mt_logic(Hedge.temporalsoften(1,255,0,255,2),"max")


# If requested, do flicker reduction before searching motion vectors
# -------------------------------------------------------------------
(MEspatNR==0.0) ? bobbed : bobbed.Merge(bobbed.minblur(2,uv=3),MEspatNR)
(MEtempNR==0.0) ? last : last.Merge(reduceflicker(2),MEtempNR)
srch=last


# Perform Motion Search
# ---------------------
lmbda = 128
pnw = 40
bw_vec2 = srch.SelectEven().MVAnalyse(isb=true, truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1)
fw_vec2 = srch.SelectEven().MVAnalyse(isb=false,truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1)
bw_vec3 = srch.SelectOdd() .MVAnalyse(isb=true, truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1+1)
fw_vec3 = srch.SelectOdd() .MVAnalyse(isb=false,truemotion=false,delta=1,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1+1)


# Create RAW motion interpolation
# -------------------------------
alt_1 = bobbed.SelectEven().MVFlowInter(bw_vec2,fw_vec2,time=50.0,thSCD1=64*18,thSCD2=227,idx=idx_2)
alt_2 = bobbed.SelectOdd() .MVFlowInter(bw_vec3,fw_vec3,time=50.0,thSCD1=64*18,thSCD2=227,idx=idx_2+1).DuplicateFrame(0)
alt = Interleave(alt_2,alt_1)


# Create motion interpolation of "nothing new" mask
# -------------------------------------------------
interpol_1 = interpol.SelectEven().MVFlowInter(bw_vec2,fw_vec2,time=50.0,thSCD1=64*8,thSCD2=127,idx=idx_3)
interpol_2 = interpol.SelectOdd() .MVFlowInter(bw_vec3,fw_vec3,time=50.0,thSCD1=64*8,thSCD2=127,idx=idx_3+1).DuplicateFrame(0)
interpol_comp= Interleave(interpol_2,interpol_1)
nothing_new = mt_lutxy(interpol,interpol_comp,"x y * 255 / 255 / 1 2 / ^ 160 *")


# Error check of motion interpolation
# ===================================
# Errors that are neutralized by errors in direct vertical neighborhood are not considered, because bob-typical.
# Remaining error is checked against [min,max] of local error to decide if it's valid or not.
#
# Build error mask, neutralize vertical-only errors
# ---------------------------------------------------
altD = mt_Makediff(bobbed,alt,U=3,V=3)
altDmin = altD.mt_Inpand(mode="vertical",U=3,V=3)
altDmin = altDmin.mt_Deflate().mt_Merge(altDmin,Vedge,U=4,V=4)
altDmax = altD.mt_Expand(mode="vertical",U=3,V=3)
altDmax = altDmax.mt_Inflate().mt_Merge(altDmax,Vedge,U=4,V=4)
altDmm = mt_Lutxy(altDmax.mt_Expand(mode="horizontal",U=3,V=3),altDmin.mt_Inpand(mode="horizontal",U=3,V=3),"x y -",U=3,V=3)
altDmm = altDmm.mt_Inflate().mt_Merge(altDmm,Vedge,U=4,V=4)
altD1 = altD .mt_Lutxy(altDmin,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
altD1 = altD1.mt_Lutxy(altDmax,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
altD2 = altD.Repair(altD1,1)


# Build correction mask by combining: error mask + "nothing new" mask + a scenechange mask
# ---------------------------------------------------------------------------------------------
corrmask = mt_Lutxy(altD2,altDmm,"x 128 - abs 2 - y 2 + / "+ERTH1+" - "+ERTH2+" "+ERTH1+" - / 255 *",U=3,V=3).mt_Expand(U=3,V=3)
sc = corrmask.BilinearResize(64,64)
sc = mt_LutF(sc,sc,mode="average",expr="x 255 0.6 * > 255 0 ?").PointResize(ox,oy)
corrmask = corrmask.mt_Logic(nothing_new,"max",U=2,V=2)
corrmask = corrmask.mt_Logic(sc,"max",U=2,V=2)


# Create a first bob from motion interpolation, not yet error corrected ...
# -------------------------------------------------------------------------
# ***( temporarily changed ... yet unsure what works best )***

Interleave(bobbed,alt).AssumeParity(ORDR)
SeparateFields().SelectEvery(8,0,3,5,6).Weave()
naked= last
naked2 = last.vinverseD(1.6) # flatbob #

naked_mm = naked.mt_Edge("min/max",0,255,0,255,U=1,V=1)
edibb_mm = nnedibobbed.mt_Edge("min/max",0,255,0,255,U=1,V=1).mt_Expand(mode="vertical")
check2 = mt_LutXY(naked_mm,edibb_mm,"x y / 3 - 5 3 - / 255 *")
corrmask = corrmask.mt_Logic(check2,"max",U=2,V=2)


# ... and build a motion mask from this one.
# ------------------------------------------
# ***( temporarily changed ... tickertapes might suffer. )***

stc = bobbed .removegrain(2)# oweave.removegrain(11)
mm = stc.mt_Edge("min/max",0,255,0,255,U=3,V=3)
# mm = mm .mt_Logic(mm.DuplicateFrame(0),"max",U=3,V=3).mt_Logic(mm.DeleteFrame(0),"max",U=3,V=3)
# max = stc.mt_expand(U=3,V=3)
# max = max.mt_logic(max.Duplicateframe(0),"max",U=3,V=3).mt_logic(max.Duplicateframe(0).Duplicateframe(0),"max",U=3,V=3)
# min = stc.mt_inpand(U=3,V=3)
# min = min.mt_logic(min.Duplicateframe(0),"min",U=3,V=3).mt_logic(min.Duplicateframe(0).Duplicateframe(0),"min",U=3,V=3)
# mm = mt_LutXY(max,min,"x y -",U=3,V=3)
diff2prev1 = mt_LutXY(stc,stc.DuplicateFrame(0),"x y - abs",U=3,V=3)
diff2prev2 = mt_LutXY(stc,stc.DuplicateFrame(0).DuplicateFrame(0),"x y - abs",U=3,V=3)

diff2prev12 = (mtnmode==0) ? diff2prev2 :
\ (mtnmode==1) ? diff2prev2 .mt_Merge(diff2prev1,Vedge,U=2,V=2)
\ : diff2prev1 .mt_Merge(diff2prev2,Hedge,U=2,V=2)

motn = diff2prev12.mt_Logic(diff2prev12.DeleteFrame(0),"max",U=3,V=3).mt_Logic(diff2prev12.DeleteFrame(0).DeleteFrame(0),"max",U=3,V=3)
notstatic = mt_LutXY(motn,mm,"x 1 - y 1 + / "+MNTH1+" - "+MNTH2+" "+MNTH1+" - / 255 *",U=3,V=3).mt_Expand(U=3,V=3).mt_Inpand(U=3,V=3)
# notstatic = notstatic.mt_Logic(notstatic.RemoveGrain(4),"max",U=3,V=3).mt_Expand(U=3,V=3).mt_Inpand(U=3,V=3)


# Now do the error correction of the "naked" MC-bob
# -------------------------------------------------
naked .mt_Merge(nnedibobbed,corrmask,luma=false,U=3,V=3) .VinverseD(2.7-sharpness)
repaired = last


# If requested, sharpen the corrected MC-bob up a little
# ( pre-sharpen for EdiPost = 0 | 1 )
# ------------------------------------------------------
shrpbase = last#.MinBlur(1,1).Merge(RemoveGrain(12,-1),0.23)
shrp = mt_LutXY(shrpbase,shrpbase.RemoveGrain(11,-1),"x x y - abs 16 / 1 1 x y - abs 1 4 / ^ + / ^ 16 * "+SSTR+" * x y - x y - abs 1.3 + / * 1 x y - abs 16 / 1 4 / ^ + / +",U=2,V=2)
# \ .Repair(repaired,1,0)
shrpD = mt_Makediff(shrpbase,shrp)

(sharpness==0.0 || EdiPost==2) ? last : last .mt_Makediff(MergeLuma(shrpD.MinBlur(1,uv=1),shrpD.RemoveGrain(12,-1),0.24),U=2,V=2)


# If requested, do additional PP via nnEDI2
# ----------------------------------------
oweave.mt_merge(last,notstatic,luma=false,U=3,V=3)
AssumeTFF()
edisingle = nnedi(dh=true,field=1).LanczosResize(ox,oy,0,-0.5,ox,2*oy+0.001,taps=3)
edidouble = merge(nnedi(field=1),nnedi(field=0),0.5)
edidoubleD = mt_makediff(last,edidouble,U=3,V=3)
(EdiPost==1) ? edisingle : \
(EdiPost==2) ? edidouble : last

# ( post-sharpen for EdiPost = 2 )
# ------------------------------------------------------
edidoubleshrpD = mt_makediff(edidouble,sharpness==1.0?edidouble.removegrain(20):edidouble.removegrain(20).merge(edidouble,1.0-sharpness),U=3,V=3)
edidoubleshrpD = edidoubleshrpD.repair(edidoubleD,13)
(EdiPost==2) ? edidouble.mt_adddiff(edidoubleshrpD,U=3,V=3) : last


# STT (Shape Transposition Technology) Routine:
# =============================================
# Simply weaving the corrected output with the original fields is bad, because the risk of
# creating unwanted residual combing is too high.
# Instead, the vertical "shape" is taken off the corrected output, and transposed
# onto the fixed "poles" of the original fields' scanlines. Et Voila.
# ----------------------------------------------------------------------------------------
synthbob = last.AssumeParity(ORDR).SeparateFields().SelectEvery(4,0,3).Weave().Bob(1,0)
mapped_new = flatbob.mt_makediff(mt_makediff(synthbob,last,U=3,V=3),U=3,V=3)
newfields = mapped_new.AssumeParity(ORDR).SeparateFields().SelectEvery(4,1,2)
mappedbob = Interleave(ofields,newfields).SelectEvery(4,0,1,3,2).AssumeParity(ORDR).Weave()


# Finally, for static areas use just original fields
# --------------------------------------------------
mappedbob
#bobbed

oweave.mt_merge(last,notstatic.mt_inpand(Y=2,U=2,V=2),luma=false,U=3,V=3)


# Lastly, set correct parity for the bobbed clip
# ----------------------------------------------
(order==0) ? AssumeTFF() : AssumeBFF()

return(last)
}

# ===============================================

############################
# Helper functions below #
############################


## Function nnEDIbob, courtesty of tritical:

# slow, but accurate nnEDI-bob, always dumb ;)

Function nnEDIbob(clip Input)
{
Input.nnedi(field=-2)
}


# Helper to simplify script
function AssumeParity(clip clp, string "order")
{
order == "TFF" ? clp.assumeTFF() : clp.assumeBFF()
return(last)
}

# Kill Combing Function
function VinverseD(clip clp, float "sstr", int "amnt", int "uv")
{
uv = default(uv,3)
sstr = default(sstr,2.7)
amnt = default(amnt,255)
uv2 = (uv==2) ? 1 : uv
STR = string(sstr)
AMN = string(amnt)
vblur = clp.mt_convolution("1","50 99 50",U=uv,V=uv)
vblurD = mt_makediff(clp,vblur,U=uv2,V=uv2)
Vshrp = mt_lutxy(vblur,vblur.mt_convolution("1","1 4 6 4 1",U=uv2,V=uv2),expr="x x y - "+STR+" * +",U=uv2,V=uv2)
VshrpD = mt_makediff(Vshrp,vblur,U=uv2,V=uv2)
VlimD = mt_lutxy(VshrpD,VblurD,expr="x 128 - y 128 - * 0 < x 128 - abs y 128 - abs < x y ? 128 - 0.25 * 128 + x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
mt_adddiff(Vblur,VlimD,U=uv,V=uv)
(amnt>254) ? last : (amnt==0) ? clp : mt_lutxy(clp,last,expr="x "+AMN+" + y < x "+AMN+" + x "+AMN+" - y > x "+AMN+" - y ? ?",U=uv,V=uv)
return(last)
}

# Nifty Gauss/Median combination
function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r==1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}

henryho_hk
14th October 2007, 14:47
One silly question. Do I precede mcbob() with assumetff() and assumebff() for such sources respectively?

Didée
14th October 2007, 16:26
For mpeg sources loaded with DGDecode, there is (usually) no need to specify field order. Field order is flagged in the source stream, and DGDecode passes the flag through to Avisynth.

For other types of sources, you should always specify the correct field order manually. E.g. AviSource will always flag the stream as being BFF, regardless whether it's actually TFF or BFF.

Revgen
15th October 2007, 07:39
Lucky bastard.

Ah! But wait until Didee releases MCBob 2.0

I won't be so lucky anymore. ;)

Adub
16th October 2007, 19:22
Is he even working on 2.0? I didn't realize he was.

Revgen
16th October 2007, 21:05
Is he even working on 2.0? I didn't realize he was.

I was joking.

I don't know if he is or not.

Adub
16th October 2007, 21:54
Damn, and you got my hopes all up and dancing the two step.

Revgen
16th October 2007, 23:03
Damn, and you got my hopes all up and dancing the two step.

You'd want MCBob 2.0? :confused:

IMO, it would be too slow for anybody if it was made.

Well, maybe not for David Hermann and his special cluster computing avisynth plugin.

Too each his own I guess.

zambelli
17th October 2007, 01:11
Is the main advantage of NNEDI over EEDI2 performance speed?

Revgen
17th October 2007, 02:08
Is the main advantage of NNEDI over EEDI2 performance speed?

Nope. NNEDI is better quality (in most cases) than EEDI2 and slower. Especially on aliasing. The original MCBob used EEDI2.

You can check the NNEDI thread here. http://forum.doom9.org/showthread.php?t=129953

wonkey_monkey
17th October 2007, 22:03
You'd want MCBob 2.0? :confused:

IMO, it would be too slow for anybody if it was made.

Well, maybe not for David Hermann* and his special cluster computing avisynth plugin.

*Horman, but thanks for remembering AVISynth :) I haven't been able to get much higher than 15fps, even with 30 computers in the cluster. I think network file access is bottlenecking.

But, back on topic, who's to say mcbob 2.0 couldn't be faster and better? If some of the external plugins and functions could be rewritten to implement only the functionality that mcbob requires, that could happen.

For instance, as I understand it, mcbob currently uses EEDI/NNEDI (in "post", as opposed to "pre") on the whole image before masking in those sections it needs to use. If there was an EEDI/NNEDI that could understand the mask, it could be applied to only a fraction of the image.

David

rec
13th November 2007, 02:05
Hi, This is my first post - hope I'm in the right place.

I want to use MCBob, but I can't figure out how to apply it to a given clip. Could somebody gently take me through the steps?

I work daily with simple AVISynth scripts, but nothing as complex as MCBob.

Thanks!

Adub
13th November 2007, 04:17
save the script as extension ".avsi"

put it in your plugins folder. Then call like so:

MCBob()

OR

MCBob().SelectEven()

rec
13th November 2007, 10:44
Thanks, got it working.

Next question: As the filter stands, it deinterlaces 60i to 30P. Is it possible to change it to go from 60i to 60P?

Also, can you use it with multi core processors?

themostestultimategenius
13th November 2007, 10:50
MCBob()
Deinterlaces it to 60P.

foxyshadis
13th November 2007, 10:58
Also, can you use it with multi core processors?

As long as you have the latest versions of mvtools and MT avisynth, yes.

Terka
13th November 2007, 15:07
what is the speedup using mcbob on dualcore machines?
and what about 4core?

rec
13th November 2007, 19:33
I'm running mcbob on a quad core 6600 overclocked to 3.2ghz.
Unfortunately, only one core gets utilized. I'm using avisynth 2.5.7.0 and mvtools 1.8.4.2. Deinterlacing a 60i HDV picture @ 1440 x 1080 takes 2 seconds per frame. And looks great, btw.

Sure would like to use all four cores. If anybody has any ideas, please speak up!

Revgen
13th November 2007, 19:54
I'm running mcbob on a quad core 6600 overclocked to 3.2ghz.
Unfortunately, only one core gets utilized. I'm using avisynth 2.5.7.0 and mvtools 1.8.4.2. Deinterlacing a 60i HDV picture @ 1440 x 1080 takes 2 seconds per frame. And looks great, btw.

Sure would like to use all four cores. If anybody has any ideas, please speak up!

Make sure to put threads=4 in the NNEDI() section of the script. Also make sure you have the latest MT and SetMT version of Avisynth. And lastly make sure you have the latest multi-threading enabled version of MVTools. Make sure that SetMT is above the source line too. For example:

SetMT(mode=2, threads=4)
Avisource("Mydrive:\Myfolder\mysourcevideo.avi")

If that doesn't work, then you'll just have to use trim() and process 4 separate segments of the video and assign each segment to one core via taskmanager. Make sure all 4 segments are encoded losslessly so you can encode them to xvid, H.264 or another codec later.

2Bdecided
30th November 2007, 13:44
Are there any suggested parameters or modifications to mcbob that will improve speed, but not damage quality on a noisy (S-VHS) source?

Cheers,
David.

g_aleph_r
29th December 2007, 09:37
mcbob is amazing but I have some issues on horizontal lines: they shutter
If I put selecteven it is fine but I would like to keep all the 50 fps.
I am using mcbob() without further configuration is there an option that could work for me?:helpful:

foxyshadis
29th December 2007, 11:38
Can you post an example of the video? MCBob should bob less than other bobbers (if that's the case, that's probably the best you can hope for), if it doesn't it could make for a good test case.

g_aleph_r
2nd January 2008, 09:03
it's a little difficult for me to post a part of the file. Anyway the problem is mainly the watermark of the channel and the graphic of the show.
I solved (almost) using tdeint and mcbobbed stream as clip2, it doesn't like flash but it is not so ugly.

some dude
9th January 2008, 03:41
I don't know about getting rid of the watermark, but to keep your 50 fps without using selecteven you could try


complementparity
MCBob()


I'm not sure if this would fix your "shuttering" lines, but I'm not sure what you ment by that in the first place.

badshah
26th January 2008, 11:51
MCBob_v03u is giving me speed of 0.5fps on my c2d with 1gb ram. can anyone help me ? :confused:

themostestultimategenius
26th January 2008, 16:39
^ Try using MT AviSynth.

Adub
26th January 2008, 22:34
Just make sure you are using the most up to date versions of Masktools and MVtools, as they used to have problem when using MT in Avisynth.

Oh, and even if you do use MT, your fps still wont be stellar.

Kumo
12th March 2008, 20:05
i'm trying to deinterlace an old anime ntsc r1 (usa) dvd.dgindex reports it as interlaced.here is a sample:
http://rapidshare.com/files/97003811/VTS_01_1cut.demuxed.m2v.html
i'm trying different deinterlacer,am i right using mcbob like thatDGDecode_Mpeg2Source("H:\Kimagure Orange Road Movie 1\VTS_01_1.d2v",info=3)
colormatrix(hints=true,interlaced=true)
mcbob().selecteven.tdecimate(mode=1,hybrid=1)to convert it to 24p?
should i use a different deinterlacer?

MadRat
13th March 2008, 00:09
If you're interested in trying something other than mcbob you could look at this thread: http://forum.doom9.org/showthread.php?t=135688

SPiKA
15th May 2008, 22:03
Is there a way to use mcbob just in a section of the encode? Because I'm getting "Framerate doesn't match" error when using trim...

And another question... I know that mcbob doubles the framerate, but how can I get original framerate (29.97fps) back?

Terranigma
15th May 2008, 22:30
Is there a way to use mcbob just in a section of the encode? Because I'm getting "Framerate doesn't match" error when using trim...

And another question... I know that mcbob doubles the framerate, but how can I get original framerate (29.97fps) back?

Maybe you're getting that error, because you need to discard half of the frames mcbob creates?

To get the original rate, use either selecteven() or selectevery(2,0) after mcbob. :)

SPiKA
15th May 2008, 23:49
That worked... thanks!

Comatose
18th May 2008, 12:32
Maybe you're getting that error, because you need to discard half of the frames mcbob creates?

To get the original rate, use either selecteven() or selectevery(2,0) after mcbob. :)
Is this really safe? Are they all dupes?

themostestultimategenius
18th May 2008, 13:59
If your use MCBob on a progressive source then yes, you'll end up with dupes.

Adub
18th May 2008, 21:51
But why the hell would you use MCBob on a PROGRESSIVE clip?!!!

Malow
19th May 2008, 00:50
what "part" of mcbob cannot work with yuy2?

Didée
19th May 2008, 01:38
At the time when it was written: definetly MaskTools, not sure about MVTools and RemoveGrain/Repair. Today: none.

So, if you want MCBob to process YUY2 input, all you need to do is to add a "ConvertInterleaved2Planar()" to every clip argument that goes into any function filter of RemoveGrain, Repair, or any MaskTools filter, add "planar=true" to all RemoveGrain/Repair calls, and an immediate "ConvertPlanar2Interleaved()" afterwards all of these, in case the result is processed by a filter that is not RemoveGrain, Repair, or a MaskTools filter. And ideally, all these conversions/additions should be made conditionally, since they shouldn't be made for regular YV12 input ...

It's probably less than 100 places that need to be altered, and it shouldn't take much more than 100^100 swearings until it's really up & running.

I wish much fun when doing that. :)

thetoof
19th May 2008, 01:51
Is this really safe? Are they all dupes?
They are not dupes. By doing that, you reduce the temporal resolution by half (similar to half-framerate conversion with mvflowfps). So, the movement may look choppy

But why the hell would you use MCBob on a PROGRESSIVE clip?!!!
QTF... MCBob is meant for pure interlaced only, as it doesn't even knows that progressive frames could exist in the source clip.

what "part" of mcbob cannot work with yuy2?
Masktools2
The filters have a set of common parameters, that mainly concern what processing to do on each plane. They all work only in YV12 (though with Avisynth 2.6, support for all planar formats will be available).

Terranigma
19th May 2008, 02:11
QTF... MCBob is meant for pure interlaced only, as it doesn't even knows that progressive frames could exist in the source clip.

Not true. The results of mcbob, is most of the times, better than that of any other bobber/deinterlacer, and if you know how to use functions to either give it guidance, (such as by configuring tdeint to detect interlaced frames and then use mcbob as an external deinterlacer with selectevery(2,0)) or manually select frames for deinterlacing, then it can be used in the exact same manner as any other interlace detecting deinterlacer/bobber.

It may have been constructed for true interlaced material, but it can be used for progressive material (that has a bit of interlacing) as well. :P

Didée
19th May 2008, 02:12
@ thetoof: Everything correct .... almost.


.
VI) Changelog

Alpha 34 :

added : support for interleaved2planar hack, enabling 422 support


@ Terranigma:

No. If MCBob hits progressive (or telecined) sections, then there's no benefit over filters dedicated for that respective kind of content. On such input, all internal motion compensations necessarily are wrong (because of the way of motion interpolation that is used). Most of that damage might be hidden because it's (hopefully) caught by the error correction, but probably not everything. So, there's nothing-at-all to benefit to begin with, plus a possible chance to get some unnecessary artifacts.

So, on progressive or telecined sequences, MCBob will never be better than dedicated filters. It can only be worse.
Perhaps it's somehing of the edi-postprocessing / sharpening / something else that might look nice at times nonetheless ... but to get that, you don't need to apply MCBob.

thetoof
19th May 2008, 02:13
I just read the whole thread and felt like adding a few things

i'm trying to deinterlace an old anime ntsc r1 (usa) dvd.dgindex reports it as interlaced
Check out the link in my signature + the other posts I made in this (http://forum.doom9.org/showthread.php?t=137240) thread; I think it may interest you. (It explains why DGindex reports anime as "interlaced" when it's actually telecined.

Is there a way to use mcbob just in a section of the encode? Because I'm getting "Framerate doesn't match" error when using trim...
And another question... I know that mcbob doubles the framerate, but how can I get original framerate (29.97fps) back?
If the reason you want to do this is because you have a clip with telecined and interlaced sections, I gave a suggestion on how to do handle it here (http://forum.doom9.org/showthread.php?p=1139170#post1139170).

Comatose
24th May 2008, 01:14
They are not dupes. By doing that, you reduce the temporal resolution by half (similar to half-framerate conversion with mvflowfps).
So uh, what would be the (in most cases) best way to reduce the framerate to something sane like 29.97 or 23.976 fps?

thetoof
24th May 2008, 07:39
Well, to go back to 29.97, cut your temporal resolution by half (selecteven() or selectodd()) and, to convert to 23.976, you have a few options, one being a motion compensated framerate conversion.
If you want to process an interlaced section of a telecined clip, use something like this:
raw=mpeg2source("yourd2v.d2v")

# IVTC the telecided portion of your source
a=raw.telecide().Decimate().trim(0,x) # Use your prefered IVTC method, as long as you add .trim(0,x) at the end, where x is the last frame before the credits. Be sure to check what is the number of that frame after ivtc.

#Bob the interlaced section to 60p
source=raw.mcbob() #or any other deinterlacer you want

#Get the motion vectors (these settings are... hum.. insane :p so change them if you want)
backward_vec = source.MVAnalyse(isb = true, pel=4, idx=1,search=3, overlap=6)
forward_vec = source.MVAnalyse(isb = false, pel=4, idx=1,search=3, overlap=6)

#Convert the fps of the interlaced section
b=source.MVFlowFps(backward_vec, forward_vec, num=24000, den=1001, ml=100, idx=1).trim(first frame of the credits,last frame of the credits) #Be sure to check those numbers after the framerate conversion

#and, if you have something after, ivtc it
c=raw.telecide().Decimate().trim(frame after the interlaced section,0)
a+b+c
A trick to get the correct frame # is by adding return a/b/c at the end of the script.
If you source is always interlaced (which is extremely rare for anime, if that's what you're dealing with), you can use the portion of the script from "bob" to "convert".

Anime is most likely 24 fps with bad telecining. AnimeIVTC() + documentation will soon be ready, so I'd recommend that you take a look at these. My signature will be updated when it's done, so it won't lead to the obsolete post#23.

edit: you can also use MVFlowBlur after the framerate conversion to generate a motion blur that'll make your movements look less choppy.

Inventive Software
27th May 2008, 18:27
I use MCBob with NNEDI posted on the first page I think by Wilbert, and I've had to change the RemoveGrain functions on line 222 of the combined comments + script, under the "EdiPost = 2" section, because the mode specified was out of range and the AVS file wouldn't load in VirtualDub. 20 was the number in the script, I changed it to 2. Would that work as intended?

Didée
27th May 2008, 18:45
No, that'll not do the intended operation. (20) performs a full 3x3 convolution blur, which in its negotiation gives a sharpen operation. (2) is a median-like clamping operation, clamping the center pixel to not exceed the 2nd-extremest neighbors. In the given context this will result in very weak sharpening, probably almost null.

Obviously you're using a *very* outdated version of RemoveGrain. What's the point in not updating to the "v10pre2" (July 2005) version?

Inventive Software
28th May 2008, 00:12
Because my searching skills are obviously lacking. :p Thank you Didée, I shall try again tomorrow. :)

Inventive Software
28th May 2008, 03:05
I got some (not much, but enough of an increase that makes it worthwhile on an AMD Turion64 X2) speed from using MT 0.7 properly with AviSynth 2.5.7, and a fully working MCBob, and the results are, if I may say so, rather impressive. They put into the shade the Bob() that comes with AviSynth. No shimmering to speak of. On an onboard lap at Istanbul Park taken from the F1 2005 Review DVD I had to wait around 2 hours at an average 0.69 FPS to MCBob that lap to a HuffYUV file. I now intend to try compression techniques with x264 and see what I can get.

I have one general question about encoding sports footage, specifically F1. Is it more ideal to encode it interlaced and (if using ffdshow) Kernel bob deinterlace on playback, or Bob / MCBob the source before encoding? Bobbing in general gives double the framerate, but I can't fault MCBob's amazing quality. Oh the dilemma! :D

radar
31st May 2008, 03:12
hi
im trying to use mcbob,but im getting a error "no function named mt_lut.ive read all the posts and tried the corrections sujested.
this is my script:

loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mvtools.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RemoveGrain.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\EEDI2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mt_masktools-25.dll")
import("C:\Program Files\AviSynth 2.5\mcbob\MCBob_v03c.avsi")
MCBob()


please help.thanks

radar
31st May 2008, 10:58
i got mcbob to work,but the video is slow.the sound is fine.

my script:

loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RepairSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mvtools.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RemoveGrainSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\EEDI2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mt_masktools-25.dll")
import("C:\Program Files\AviSynth 2.5\mcbob\MCBob_v03c.avsi")
MCBob()

the video is nice and not glitchy just slow

LaTo
31st May 2008, 11:14
i got mcbob to work,but the video is slow.the sound is fine.

the video is nice and not glitchy just slow

it's normal, MCbob is slow... you need re-encoding for normal playback or a new pc

radar
31st May 2008, 11:20
i mean after its done its encoding i play it.the video is slower than the sound but the sound is the correct spd.

K0zi
31st May 2008, 18:37
Add SelectEven() or SelectOdd() at the end of your script.

thetoof
31st May 2008, 23:00
Adding selecteven/odd won't change the playback speed... only the amount of frames displayed in 1 second(59.94-->29.97).

and radar, what you are describing isn't possible with mcbob(), as it only bobs the video to 60p, which has no influence on lenght nor playback speed. What is the codec of the encoded stream? If you did a lossless rendering pass in uncompressed YV12 or Lagarith, it's possible that your computer can't read it fast enough... Try changing the process priority of your media player to "high".

radar
31st May 2008, 23:46
hi thetoof
i tried changing the process priority of the player,didnt work.how can i find what codec i used???

my system is:

intel core 2 duo E6850
4 gigs of ram
nvidia geforce 8800 gts 512

thetoof
1st June 2008, 01:32
Well, what did you use to encode your file after processing it with mcbob?
Also, could you upload a small 5mb sample to see if we can reproduce your issue?

radar
1st June 2008, 01:39
im using dvd rb and cce 270.
i will upload a clip.

what upload host should i use.thanks

Didée
1st June 2008, 02:14
No need to upload anything. CCE expects input that is DVD compliant. After bobbing, you have 50fps (PAL) or 59.94fps (NTSC), which is NOT compliant with DVD specs (only 23.976 / 25 / 29.97 fps are allowed). CCE silently assumes a compliant framerate, which is why the video then is running at half speed.

In this case you either have to use SelectEven() after MCBob, or you could just use a simple same-rate deinterlacer instead.

radar
1st June 2008, 02:23
hi Didée
ok i will try SelectEven()


this is the clip:http://rapidshare.com/files/119202564/VTS_01_1.VOB

i tried SelectEven() and it corrected the slow vid.thank you very much Didée.
can i now sharpen the image.this is the clip after the mcbob.
http://rapidshare.com/files/119205728/VTS_01_1.VOB (5392 KB).

thetoof
1st June 2008, 03:55
can i now sharpen the image
Off topic. Look here (http://avisynth.org/mediawiki/External_filters#Sharpeners).

radar
1st June 2008, 04:15
can i incorperate the sharpening in with mcbob script.
how would you write the script

thetoof
1st June 2008, 05:18
whateversource("yourfile")
mcbob()
any other filter you want() #like limitedsharpenfaster()

radar
2nd June 2008, 02:32
ok i got this script,looks good but slow.
dose the script look ok.


loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RepairSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mvtools.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RemoveGrainSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\EEDI2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mt_masktools-25.dll")
import("C:\Program Files\AviSynth 2.5\mcbob\MCBob_v03c.avsi")
MCBob()
SelectEven()
loadplugin("C:\Program Files\AviSynth 2.5\seesaw\degrainmedian.dll")
import("C:\Program Files\AviSynth 2.5\seesaw\SeeSaw.avsi")
backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
a=last.MVDegrain1(backward_vec2,forward_vec2,thSAD=400,idx=1)

b = a.DeGrainMedian(mode=1)
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=9, Spower=9, Szp=16)

2Bdecided
3rd June 2008, 11:06
radar,

If you are encoding for DVD, why are you deinterlacing?

Cheers,
David.

radar
3rd June 2008, 11:58
its an old fight tape and it has interlacing.this gets gid of it.
im not sure if thats what you are asking.

2Bdecided
3rd June 2008, 13:45
I assumed the source was interlaced, because you are using mcbob - not much point using it otherwise!

However, you can encode interlaced content onto DVD just fine - if you deinterlace it, you will remove half the temporal resolution, creating a stuttery look, like the "fake-film" effect used on some TV shows.

If that's what you want, fine. However, if you just want to make a good DVD of an interlaced source, you are wasting your time deinterlacing.

Cheers,
David.

radar
3rd June 2008, 19:56
how can i make a good dvd copy with out deinterlacing.could you explain it to me ,thanks

Revgen
4th June 2008, 02:38
The only way you can make a DVD without deinterlacing is to make it 29.97fps or 23.976fps. DVD's don't support any framerate over 29.97.

radar
4th June 2008, 12:04
hi Revgen
how would you do that?

2Bdecided
4th June 2008, 14:21
radar,

If you want to do certain processing of your footage (e.g. denoising, sharpening, etc) then you do need to deinterlace, but you need to keep that at double rate, and then re-interlace at the end.

You can use this line of code to reinterlace double rate footage:

separatefields().selectevery(4,0,3).weave()

If it doesn't work, your field order is set incorrectly. In your script, you don't have an AVISOURCE statement, and you don't set your field order at all - maybe you're using it with someone that inserts these automatically, or maybe you cut them out of the part you pasted. Anyway, your previous script would change to this:

loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RepairSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mvtools.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RemoveGrainSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\EEDI2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mt_masktools-25.dll")
import("C:\Program Files\AviSynth 2.5\mcbob\MCBob_v03c.avsi")
MCBob()

loadplugin("C:\Program Files\AviSynth 2.5\seesaw\degrainmedian.dll")
import("C:\Program Files\AviSynth 2.5\seesaw\SeeSaw.avsi")
backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
a=last.MVDegrain1(backward_vec2,forward_vec2,thSAD=400,idx=1)

b = a.DeGrainMedian(mode=1)
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=9, Spower=9, Szp=16)

separatefields().selectevery(4,0,3).weave()


Hope this helps.

Looking at your clip, it looks pretty good as it is - maybe I'm not so critical after all!

Cheers,
David.

radar
5th June 2008, 09:21
2Bdecided
i changed my script with yours and ran it in dvd rb with cce.the clip played alright,but it seems to be interlaced.the script that i posted deinterlaced the clip.

loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RepairSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mvtools.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\RemoveGrainSSE2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\EEDI2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\mcbob\mt_masktools-25.dll")
import("C:\Program Files\AviSynth 2.5\mcbob\MCBob_v03c.avsi")
MCBob()
SelectEven()
loadplugin("C:\Program Files\AviSynth 2.5\seesaw\degrainmedian.dll")
import("C:\Program Files\AviSynth 2.5\seesaw\SeeSaw.avsi")
backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
a=last.MVDegrain1(backward_vec2,forward_vec2,thSAD=400,idx=1)

b = a.DeGrainMedian(mode=1)
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=9, Spower=9, Szp=16)

2Bdecided
5th June 2008, 12:52
If you really want to deinterlace, you do that. It's pointless for DVD, but don't let me stop you. I was just showing you how to process interlaced content through progressive-only filters, and get back to interlaced at the end. If that's not what you want, don't worry.

Cheers,
David.

radar
5th June 2008, 23:12
2Bdecided
if i use your script and put on a dvd,would you still see the interlacing lines.i see them on my computer monitor.

2Bdecided
6th June 2008, 10:08
Then your DVD playback software is not deinterlacing automatically. Most does, as many commercial DVDs are interlaced!

DVD on CRT TV: native interlaced
DVD on LCD/Plasma TV: deinterlaced by the TV
DVD on PC: deinterlaced by the software or graphics card

Remember that interlaced footage contains 60 separate images per second. Progressive footage on DVD can contain a maximum of 30, so if you insist on doing the deinterlacing yourself, you are throwing half the images away to put it onto DVD. Some people would rather do this than trust the deinterlacing in a TV or PC - I think they're mad. If you're that worried about subsequent deinterlacing, don't use DVD.

Cheers,
David.

radar
6th June 2008, 10:20
i didnt know that,thanks for the info.im going to put it on a dvd and try it

thetoof
15th June 2008, 17:48
Do you have the latest removegrain (http://home.pages.at/kassandro/RemoveGrain/RemoveGrain.zip)?

thetoof
15th June 2008, 18:43
Oh, sorry... I thought it was the latest version (I took it from http://www.removegrain.de.tf/) but it seems like the official is not the most up to date.
Get the 1.0b from the wiki : http://avisynth.org/mediawiki/Removegrain

mikeytown2
2nd July 2008, 10:16
could a slight speed improvement be achieved by using the dll version of vinverse (http://forum.doom9.org/showthread.php?p=896352#post896352)?

halsboss
9th August 2008, 01:37
Have I got this right, McBob() does double-framerate deinterlacing like TDEINT(mode=1,order=1) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF

Darn it, which RemoveGrain for McBob ? My hard disk says I have 2 RARs ... RemoveGrain-1.0.rar and RemoveGrain-Prerelease-1.0.rar and I don't know where I sourced them.

foxyshadis
9th August 2008, 02:30
Fairly sure it's prerelease that's newest. Check the dates on the files inside, or just download the latest to be sure. (Doesn't help that kassandro keeps three versions in three places.)

halsboss
9th August 2008, 02:41
Thanks, the dates/times look the same to me. As far as I can tell, the latest versions as of today are :

# - McBob v0.3c (NNEDI + MCBOB)
# http://forum.doom9.org/showthread.php?p=1055263#post1055263
# - MVTools, preferably v1.4.13 (or newer)
# http://avisynth.org.ru/mvtools/mvtools.html
# eg http://avisynth.org.ru/mvtools/mvtools-v1.9.5.7.zip
# - MaskTools v2.0 (MT_Masktools)
# http://manao4.free.fr/?M=D
# eg http://manao4.free.fr/masktools-v2.0a35.zip
# - nnEDI 1.3 +
# http://bengal.missouri.edu/~kes25c/
# eg http://bengal.missouri.edu/~kes25c/nnedi_v1.3.zip
# - RemoveGrain/Repair package
# http://avisynth.org/mediawiki/RemoveGrain
# http://home.arcor.de/kassandro/prerelease/
# eg http://home.arcor.de/kassandro/prerelease/RemoveGrain-1.0.rar
# - ReduceFlicker (if temp-NR for ME is used)
# http://home.arcor.de/kassandro/ReduceFlicker/
# eg http://home.arcor.de/kassandro/ReduceFlicker/ReduceFlicker.zip
# - ReduceFlicker requires AvsRecursion.dll in the \windows\system32 folder unfortunately
# http://www.avsrecursion.de.tf/
# eg http://home.arcor.de/kassandro/AvsRecursion/AvsRecursion.zip
# - MedianBlur by tsp
# http://avisynth.org/tsp/
# eg http://www.avisynth.org/tsp/medianblur084.zip

Unfortunately not all these are mentioned in WarpEnterprises or the "new plugins" sticky or the Wiki.

halsboss
9th August 2008, 04:36
I got some (not much, but enough of an increase that makes it worthwhile on an AMD Turion64 X2) speed from using MT 0.7 properly with AviSynth 2.5.7, and a fully working MCBob, and the results are, if I may say so, rather impressive. They put into the shade the Bob() that comes with AviSynth. No shimmering to speak of. On an onboard lap at Istanbul Park taken from the F1 2005 Review DVD I had to wait around 2 hours at an average 0.69 FPS to MCBob that lap to a HuffYUV file. I now intend to try compression techniques with x264 and see what I can get.


Thanks for the info. Can you please share your script showing the placement and use of the MT statements ?

Also, what did you use to convert to Huffy 1st ? (I can't figure out how to use lossless properly for HC -> DVD and thought this might be a workaround ).

Adub
9th August 2008, 06:04
The "RemoveGrain-1.0.rar" is the newest one actually. It includes a fix for the SSE3 bug, as well as some greater speed when using the SSE3 version. For more info, read Kassandro's forum. I posted a link in the Avisynth wiki, so everyone should use the one labeled with "SSE3 fix" next to it.

halsboss
9th August 2008, 13:36
Oh joy, in http://forum.doom9.org/showthread.php?p=1168632#post1168632 Revgen seems to be flagging interest in investigating a speedup arising from josey_wells great work.

Adub
9th August 2008, 18:56
Yes, josey_wells has been working on threading and a few other items inside of the MVtools package.

Avenger007
10th August 2008, 02:38
The "RemoveGrain-1.0.rar" is the newest one actually. It includes a fix for the SSE3 bug, as well as some greater speed when using the SSE3 version. For more info, read Kassandro's forum. I posted a link in the Avisynth wiki, so everyone should use the one labeled with "SSE3 fix" next to it.
I'm not so sure that all bugs are fixed in RemoveGrainSSE3.dll.
I tried it with DirectShowSource and it gave different results (Huffyuv file size) with the same script, but SSE2 consistently gave the same results.
However, both SSE2 and SSE3 gave consistent results with AVISource.

Adub
10th August 2008, 03:44
I don't know if size is an accurate measure. The bugs I was speaking of where related to crashes and unstable encodes, which I haven't experienced once with the new version.

Avenger007
10th August 2008, 03:59
I had crashes with MeGUI when using DirectShowSource and SSE3; but mencoder would still run in the background. Now with the new MeGUI version and updates I no longer have those crashes.
The file size of the huffyuv files should be the same because it's the same script (no MT) and the same source and I'm using a single core processor. Thus RemoveGrainSSE3 seems to exhibit some kind of non-deterministic behavior when used with DirectShowSource.

zambelli
19th August 2008, 06:20
Unfortunately not all these are mentioned in WarpEnterprises or the "new plugins" sticky or the Wiki.
Nice summary! Perhaps Didee can add it to the top post.

sno0py
7th September 2008, 02:59
I'm having a bit of trouble with some MCBob... I've got it working, and everything looks fine in the previews, but what comes out on the other end of the encoder looks like it got hit by a flamethrower. Everything is blocked to hell, and the colors are all messed up. I also get this wierd sort of 'slanted line' thing going on... slanted lines that are actually generated by mcbob, and not in the source. I can post pics if it'd help, but I was wondering if this is perhaps a problem that's been seen before.

Again, I'll post screenshots and pc specs if that'd help. I'm hoping it's just a dumb setting i forgot, but let me know.

THANKS!! :)

thetoof
7th September 2008, 03:17
Maybe you simply don't have enough memory to run MCBob + encoder.
Try using a higher Setmemorymax() and doing a lossless rendering pass by loading your script in virtualdub and selecting "fast recompress" with Lagarith or another lossless codec. Then, throw the resulting avi to the encoder of your choice.
If it doesn't solve your issue... I've got no idea what it could be (maybe getting the latest versions of all your plugins would do something, but I assumed it was already done)

You can also give a shot to TempGaussMC_beta1 or 2 for high quality smart-bobbing.

sno0py
7th September 2008, 03:29
Hmm... I have 2GB o ram to throw around, but that is a possibility. Also, I've never heard of this 'TempGaussMC_Beta1 or 2 .... they better than MVBob? mvbob WORKS, but not WELL.... To be honest, too, I think I'd rather choose the path of least resistance, and try the TGMC instead of trying to debug mcbob if it's going to work just as well...

Just for the record, though:
CoreDuo E6750 2.67GHz
2.0GB DDR2 800
eVGA nVidia 7900 GT KO
74GB 10k WD Raptor
X-Fi Champion
but just Reglur XP pro.. not 64bit..... yet....

AVS settings:
global MeGUI_darx = 4
global MeGUI_dary = 3
DGDecode_mpeg2source("H:\intro.d2v",cpu=6,cpu2="xxxxxx",info=3)
ColorMatrix(hints=true,interlaced=true)

McBob()

crop( 8, 0, -6, -2)

Convolution3D(0,6,8,6,8,4,0)
Lanczos4Resize(720,480) # Lanczos4 (Sharp)
Limitedsharpen(ss_x=1.0,ss_y=1.0,smode=3,strength=15)
Undot() # Minimal Noise

megui settings:
program --pass 2 --bitrate 1657 --stats ".stats" --deadzone-inter 18 --deadzone-intra 10 --ref 5 --mixed-refs --no-fast-pskip --bframes 3 --b-pyramid --b-rdo --bime --weightb --direct auto --filter -1,-1 --subme 7 --partitions all --8x8dct --ratetol 2.0 --me umh --merange 32 --threads auto --thread-input --cqm "jvt" --progress --no-psnr --no-ssim --output "output" "input"

sno0py
7th September 2008, 06:35
for the record... TGMC worked like a charm :) although this is the mcbob forum, i think i'm now a big fan of tgmc :D thx for the help, toof :D much appreciated :)

thetoof
7th September 2008, 06:50
np, although there is a big difference between them (just so you know)
If you plan to re-interlace afterwards (making the bobbing a mere step to make your footage progressive if some filters you want to apply can't work with interlaced material), MCBob() keeps the original fields intact, while TGMC does not (though it has, most of the time, a better visual quality)

sno0py
7th September 2008, 15:31
heh.. that's no problem.. progressive ftw! :)

stanjr
1st October 2008, 13:46
From what I've read here it seems that I should load all the plugins for MCBob() to work. For example, I made this be my MCBob.avsi and stored it in my AviSynth plugins folder:# MCBob v0.3:
# nnedi and nnedibob was made possible by tritical and the fellow Doom9 community who contributed CPU cycles.
# Another approach to motion compensated bobbing, build by Didée.
#
# ( Between-all-chairs version with some quick hacks )
# ( v0.3c: as stated above, but worse ;-) )
# ( v0.3u (unofficial): use new nnEDI interpolater by tritical, modded by Terranigma)
# Features:
#
# - No residual combing, due to STT (Shape Transposition Technology)
# - Works without thresholds (with adaptive thresholds instead of fixed ones)
# - Motion Search between fields of same parity, for maximum flicker/bob reduction in motion areas
# - Motion Masking adaptive to local complexity, for maximum flicker/bob reduction in static areas
# - spatial Interpolation overweights spatio-temporal interpolation
# ( in areas where the information obtained from temporal neighbors in itself was only spatially
# interpolated, use a mix of spatial and spatio-temporal interpolation )
# - error correction for temporal interpolation is fully self adaptive
#
# Prerequisites:
#
# - MVTools, preferably v1.4.13 (or newer)
# - MaskTools v2.0
# - nnEDI 1.3 +
# - RemoveGrain/Repair package
# - ReduceFlicker (if temp-NR for ME is used)
# - MedianBlur by tsp
LoadPlugin("[AviSynth Plugins Directory]/MT.dll")
SetMTmode(2,4)
LoadPlugin("[AviSynth Plugins Directory]/DenoiseSharpen.dll")
LoadPlugin("[AviSynth Plugins Directory]/medianblur.dll")
LoadPlugin("[AviSynth Plugins Directory]/mt_masktools-26.dll")
LoadPlugin("[AviSynth Plugins Directory]/mvtools.dll")
LoadPlugin("[AviSynth Plugins Directory]/nnedi.dll")
LoadPlugin("[AviSynth Plugins Directory]/RemoveGrainSSE3.dll")
LoadPlugin("[AviSynth Plugins Directory]/RepairSSE3.dll")
LoadPlugin("[AviSynth Plugins Directory]/RSharpenSSE3.dll")
[MCBob code pasted here]Then, I call MCBob() in a script named, for example, encode.avs like this:LoadPlugin("[AviSynth Plugins Directory]/DGDecode.dll")
DGDecode_mpeg2source("[...]/encode.d2v")
MCBob(sharpness=1.0).SelectEven()
crop(2,2,-2,-2)Am I loading the plugins correcty? Is loading them even necessary? Am I dealing with the multithreading correctly? Calling MCBob() this way is giving me about 0.5 fps during encoding on a quad core machine. I know I shouldn't expect too much, but I was wondering how to tell if I was truly running everything in the correct manner. Should the line LoadPlugin("[AviSynth Plugins Directory]/MT.dll")
SetMTmode(2,4)be put in at the top of my encode.avs instead?

stanjr
14th November 2008, 21:07
MCBob code should be updated for MVTools V2! I'm not sure how to go about doing that myself, though....

thetoof
14th November 2008, 22:26
MCbobmod will be included in the next requirements.7z of animeivtc. (mvtools2)
edit: actually, it looks like I had already done it.
Call it as MCBobmod(settings) and the only external difference is the new "mt" parameter (default=false) false=MVTools2 true=MVtools 1.9.x (multithreaded by josey_wells)



function MCBobmod(clip clp, float "EdiPre", int "EdiPost", int "blocksize", int "MEdepth", float "sharpness", int "mtnmode", float "mtnth1", float "mtnth2", float "errth1", float "errth2", float "MEspatNR", float "MEtempNR", bool "mt")
{
EdiPre = default( EdiPre, 1.0 ) # What bob to start with: 0.0 = dumbbob, 1.0 = nnEdiBob, inbetween = mix of both
EdiPost = default( EdiPost, 2 ) # 0 = no nnEDI PP / 1 = Framesized nnEdi PP / Average two Fieldbased nnEdi PP's
bs = default( blocksize, 16 ) # Blocksize for motion search
me = default( MEdepth, 2 ) # Search effort of motion search
sharpness = (EdiPost==2)
\ ? default( sharpness, 0.7 )
\ : default( sharpness, 1.0 ) # use slight sharpening before STT routine

mtnmode = default( mtnmode, 1 ) # 0 = use only same-parity motion check, 1|2 use an additional
# inter-parity check: 1 = on vertical edges / 2 = not on horizontal edges
mtnth1 = default( mtnth1, 0.20 ) # below this %age of local min/max is static
mtnth2 = default( mtnth2, 0.40 ) # above this %age of local min/max is motion
errth1 = default( errth1, 0.40 ) # similar for error detection
errth2 = default( errth2, 0.60 ) # of motion interpolation errors
MEspatNR = default( MEspatNR, 0.00 ) # amount of spatial NR (for motion search only)
MEtempNR = default( MEtempNR, 0.00 ) # amount of temporal NR (for motion search only)

order = (clp.GetParity == True) ? 0 : 1
ORDR = (order==0) ? "TFF" : "BFF"

ox = clp.width()
oy = clp.height()
ERTH1 = string(errth1)
ERTH2 = string(errth2)
MNTH1 = string(mtnth1)
MNTH2 = string(mtnth2)
SSTR = string(sharpness)
idx_1 = 10
idx_2 = (MEspatNR==0.0 && MEtempNR==0.0) ? idx_1 : idx_1+2
idx_3 = idx_2 + 2
mt = default(mt, false)
st = mt ? false : true


# Create basic operations that we will work with
# ==============================================

# Basic Field & Bob clips
# -----------------------
flatbob = clp.Bob(1,0)
normbob = clp.Bob(0.0,0.5)
ofields = clp.SeparateFields()
oweave = clp.DoubleWeave()
nnedibobbed = clp.nnEDIbob()
bobbed = (EdiPre == 0.0) ? normbob
\ : (EdiPre == 1.0) ? nnedibobbed
\ : normbob.merge(nnedibobbed,EdiPre)


# Mask to check if motion compensation has delivered only the neighbor's spatial interpolated part
# ------------------------------------------------------------------------------------------------
black = Blankclip(ofields).mt_lut("0").Trim(1,1).Loop(Framecount(clp))
white = Blankclip(ofields).mt_lut("255").Trim(1,1).Loop(Framecount(clp))
interpol = Interleave(black,white,white,black).AssumeFieldbased().AssumeParity(ORDR).Weave()


# Vertical Edge mask, needed for more safe motion masking
# -------------------------------------------------------
Vedge = bobbed.mt_Edge("1 0 -1 2 0 -2 1 0 -1",0,255,0,255,U=1,V=1)
Vedge2 = Vedge.mt_Inpand(mode="vertical").mt_Inpand(mode="vertical").mt_Expand(mode="vertical").mt_Expand(mode="vertical")
Vedge = mt_Lutxy(Vedge,Vedge2,yexpr="y 2 - 2 * x > x y 2 - 2 * ?") #.mt_Expand()

Hedge = bobbed.mt_Edge("1 2 1 0 0 0 -1 -2 -1",0,255,0,255,U=1,V=1)
Hedge = Hedge.mt_logic(Hedge.temporalsoften(1,255,0,255,2),"max")


# If requested, do flicker reduction before searching motion vectors
# -------------------------------------------------------------------
(MEspatNR==0.0) ? bobbed : bobbed.Merge(bobbed.minblur(2,uv=3),MEspatNR)
(MEtempNR==0.0) ? last : last.Merge(reduceflicker(2),MEtempNR)
srch=last


# Perform Motion Search
# ---------------------
lmbda = 128
pnw = 40
srch_even= srch.SelectEven()
srch_odd= srch.SelectOdd()

srch_even_super= st ? srch_even.mvsuper(pel=2, sharp=2) : nop()
srch_odd_super = st ? srch_odd. mvsuper(pel=2, sharp=2) : nop()

srch_even_vecs = mt ? srch_even.MVAnalyseMulti(refframes=1, truemotion=false,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1) : nop()
srch_odd_vecs = mt ? srch_odd. MVAnalyseMulti(refframes=1, truemotion=false,lambda=lmbda,pel=2,searchparam=me,sharp=2,blksize=bs,overlap=1*bs/2,pnew=pnw,idx=idx_1+1) : nop()

bw_vec2 = mt ? srch_even_vecs.mvmultiextract(0) : srch_even_super.MVAnalyse(isb=true, truemotion=false,delta=1,lambda=lmbda,searchparam=me,blksize=bs,overlap=1*bs/2,pnew=pnw)
fw_vec2 = mt ? srch_even_vecs.mvmultiextract(1) : srch_even_super. MVAnalyse(isb=false,truemotion=false,delta=1,lambda=lmbda,searchparam=me,blksize=bs,overlap=1*bs/2,pnew=pnw)

bw_vec3 = mt ? srch_odd_vecs.mvmultiextract(0) : srch_odd_super.MVAnalyse(isb=true, truemotion=false,delta=1,lambda=lmbda,searchparam=me,blksize=bs,overlap=1*bs/2,pnew=pnw)
fw_vec3 = mt ? srch_odd_vecs.mvmultiextract(1) : srch_odd_super.MVAnalyse(isb=false,truemotion=false,delta=1,lambda=lmbda,searchparam=me,blksize=bs,overlap=1*bs/2,pnew=pnw)


# Create RAW motion interpolation
# -------------------------------
bobbed_even= bobbed.SelectEven()
bobbed_odd= bobbed.SelectOdd()

bobbed_even_super= st ? bobbed_even.mvsuper(pel=2, sharp=2, levels=1) : nop()
bobbed_odd_super = st ? bobbed_odd. mvsuper(pel=2, sharp=2, levels=1) : nop()

alt_1 = st ? bobbed_even.MVFlowInter(bobbed_even_super,bw_vec2,fw_vec2,time=50.0,thSCD1=64*18,thSCD2=227) : bobbed_even.MVFlowInter(bw_vec2,fw_vec2,time=50.0,thSCD1=64*18,thSCD2=227,idx=idx_2)
alt_2 = st ? bobbed_odd. MVFlowInter(bobbed_odd_super,bw_vec3,fw_vec3,time=50.0,thSCD1=64*18,thSCD2=227) : bobbed_odd .MVFlowInter(bw_vec3,fw_vec3,time=50.0,thSCD1=64*18,thSCD2=227,idx=idx_2+1).DuplicateFrame(0)
alt = Interleave(alt_2,alt_1)


# Create motion interpolation of "nothing new" mask
# -------------------------------------------------
interpol_even= interpol.SelectEven()
interpol_odd= interpol.SelectOdd()

interpol_even_super= st ? interpol_even.mvsuper(pel=2, sharp=2, levels=1) : nop()
interpol_odd_super = st ? interpol_odd. mvsuper(pel=2, sharp=2, levels=1) : nop()

interpol_1 = st ? interpol_even.MVFlowInter(interpol_even_super,bw_vec2,fw_vec2,time=50.0,thSCD1=64*8,thSCD2=127) : interpol_even.MVFlowInter(bw_vec2,fw_vec2,time=50.0,thSCD1=64*8,thSCD2=127,idx=idx_3)
interpol_2 = st ? interpol_odd .MVFlowInter(interpol_odd_super,bw_vec2,fw_vec2,time=50.0,thSCD1=64*8,thSCD2=127) : interpol_odd .MVFlowInter(bw_vec3,fw_vec3,time=50.0,thSCD1=64*8,thSCD2=127,idx=idx_3+1).DuplicateFrame(0)
interpol_comp= Interleave(interpol_2,interpol_1)
nothing_new = mt_lutxy(interpol,interpol_comp,"x y * 255 / 255 / 1 2 / ^ 160 *")


# Error check of motion interpolation
# ===================================
# Errors that are neutralized by errors in direct vertical neighborhood are not considered, because bob-typical.
# Remaining error is checked against [min,max] of local error to decide if it's valid or not.
#
# Build error mask, neutralize vertical-only errors
# ---------------------------------------------------
altD = mt_Makediff(bobbed,alt,U=3,V=3)
altDmin = altD.mt_Inpand(mode="vertical",U=3,V=3)
altDmin = altDmin.mt_Deflate().mt_Merge(altDmin,Vedge,U=4,V=4)
altDmax = altD.mt_Expand(mode="vertical",U=3,V=3)
altDmax = altDmax.mt_Inflate().mt_Merge(altDmax,Vedge,U=4,V=4)
altDmm = mt_Lutxy(altDmax.mt_Expand(mode="horizontal",U=3,V=3),altDmin.mt_Inpand(mode="horizontal",U=3,V=3),"x y -",U=3,V=3)
altDmm = altDmm.mt_Inflate().mt_Merge(altDmm,Vedge,U=4,V=4)
altD1 = altD .mt_Lutxy(altDmin,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
altD1 = altD1.mt_Lutxy(altDmax,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
altD2 = altD.Repair(altD1,1)


# Build correction mask by combining: error mask + "nothing new" mask + a scenechange mask
# ---------------------------------------------------------------------------------------------
corrmask = mt_Lutxy(altD2,altDmm,"x 128 - abs 2 - y 2 + / "+ERTH1+" - "+ERTH2+" "+ERTH1+" - / 255 *",U=3,V=3).mt_Expand(U=3,V=3)
sc = corrmask.BilinearResize(64,64)
sc = mt_LutF(sc,sc,mode="average",expr="x 255 0.6 * > 255 0 ?").PointResize(ox,oy)
corrmask = corrmask.mt_Logic(nothing_new,"max",U=2,V=2)
corrmask = corrmask.mt_Logic(sc,"max",U=2,V=2)


# Create a first bob from motion interpolation, not yet error corrected ...
# -------------------------------------------------------------------------
# ***( temporarily changed ... yet unsure what works best )***

Interleave(bobbed,alt).AssumeParity(ORDR)
SeparateFields().SelectEvery(8,0,3,5,6).Weave()
naked= last
naked2 = last.vinverseD(1.6) # flatbob #

naked_mm = naked.mt_Edge("min/max",0,255,0,255,U=1,V=1)
edibb_mm = nnedibobbed.mt_Edge("min/max",0,255,0,255,U=1,V=1).mt_Expand(mode="vertical")
check2 = mt_LutXY(naked_mm,edibb_mm,"x y / 3 - 5 3 - / 255 *")
corrmask = corrmask.mt_Logic(check2,"max",U=2,V=2)


# ... and build a motion mask from this one.
# ------------------------------------------
# ***( temporarily changed ... tickertapes might suffer. )***

stc = bobbed .removegrain(2)# oweave.removegrain(11)
mm = stc.mt_Edge("min/max",0,255,0,255,U=3,V=3)
# mm = mm .mt_Logic(mm.DuplicateFrame(0),"max",U=3,V=3).mt_Logic(mm.DeleteFrame(0),"max",U=3,V=3)
# max = stc.mt_expand(U=3,V=3)
# max = max.mt_logic(max.Duplicateframe(0),"max",U=3,V=3).mt_logic(max.Duplicateframe(0).Duplicateframe(0),"max",U=3,V=3)
# min = stc.mt_inpand(U=3,V=3)
# min = min.mt_logic(min.Duplicateframe(0),"min",U=3,V=3).mt_logic(min.Duplicateframe(0).Duplicateframe(0),"min",U=3,V=3)
# mm = mt_LutXY(max,min,"x y -",U=3,V=3)
diff2prev1 = mt_LutXY(stc,stc.DuplicateFrame(0),"x y - abs",U=3,V=3)
diff2prev2 = mt_LutXY(stc,stc.DuplicateFrame(0).DuplicateFrame(0),"x y - abs",U=3,V=3)

diff2prev12 = (mtnmode==0) ? diff2prev2 :
\ (mtnmode==1) ? diff2prev2 .mt_Merge(diff2prev1,Vedge,U=2,V=2)
\ : diff2prev1 .mt_Merge(diff2prev2,Hedge,U=2,V=2)

motn = diff2prev12.mt_Logic(diff2prev12.DeleteFrame(0),"max",U=3,V=3).mt_Logic(diff2prev12.DeleteFrame(0).DeleteFrame(0),"max",U=3,V=3)
notstatic = mt_LutXY(motn,mm,"x 1 - y 1 + / "+MNTH1+" - "+MNTH2+" "+MNTH1+" - / 255 *",U=3,V=3).mt_Expand(U=3,V=3).mt_Inpand(U=3,V=3)
# notstatic = notstatic.mt_Logic(notstatic.RemoveGrain(4),"max",U=3,V=3).mt_Expand(U=3,V=3).mt_Inpand(U=3,V=3)


# Now do the error correction of the "naked" MC-bob
# -------------------------------------------------
naked .mt_Merge(nnedibobbed,corrmask,luma=false,U=3,V=3) .VinverseD(2.7-sharpness)
repaired = last


# If requested, sharpen the corrected MC-bob up a little
# ( pre-sharpen for EdiPost = 0 | 1 )
# ------------------------------------------------------
shrpbase = last#.MinBlur(1,1).Merge(RemoveGrain(12,-1),0.23)
shrp = mt_LutXY(shrpbase,shrpbase.RemoveGrain(11,-1),"x x y - abs 16 / 1 1 x y - abs 1 4 / ^ + / ^ 16 * "+SSTR+" * x y - x y - abs 1.3 + / * 1 x y - abs 16 / 1 4 / ^ + / +",U=2,V=2)
# \ .Repair(repaired,1,0)
shrpD = mt_Makediff(shrpbase,shrp)

(sharpness==0.0 || EdiPost==2) ? last : last .mt_Makediff(MergeLuma(shrpD.MinBlur(1,uv=1),shrpD.RemoveGrain(12,-1),0.24),U=2,V=2)


# If requested, do additional PP via nnEDI2
# ----------------------------------------
oweave.mt_merge(last,notstatic,luma=false,U=3,V=3)
AssumeTFF()
edisingle = nnedi(dh=true,field=1).LanczosResize(ox,oy,0,-0.5,ox,2*oy+0.001,taps=3)
edidouble = merge(nnedi(field=1),nnedi(field=0),0.5)
edidoubleD = mt_makediff(last,edidouble,U=3,V=3)
(EdiPost==1) ? edisingle : \
(EdiPost==2) ? edidouble : last

# ( post-sharpen for EdiPost = 2 )
# ------------------------------------------------------
edidoubleshrpD = mt_makediff(edidouble,sharpness==1.0?edidouble.removegrain(20):edidouble.removegrain(20).merge(edidouble,1.0-sharpness),U=3,V=3)
edidoubleshrpD = edidoubleshrpD.repair(edidoubleD,13)
(EdiPost==2) ? edidouble.mt_adddiff(edidoubleshrpD,U=3,V=3) : last


# STT (Shape Transposition Technology) Routine:
# =============================================
# Simply weaving the corrected output with the original fields is bad, because the risk of
# creating unwanted residual combing is too high.
# Instead, the vertical "shape" is taken off the corrected output, and transposed
# onto the fixed "poles" of the original fields' scanlines. Et Voila.
# ----------------------------------------------------------------------------------------
synthbob = last.AssumeParity(ORDR).SeparateFields().SelectEvery(4,0,3).Weave().Bob(1,0)
mapped_new = flatbob.mt_makediff(mt_makediff(synthbob,last,U=3,V=3),U=3,V=3)
newfields = mapped_new.AssumeParity(ORDR).SeparateFields().SelectEvery(4,1,2)
mappedbob = Interleave(ofields,newfields).SelectEvery(4,0,1,3,2).AssumeParity(ORDR).Weave()


# Finally, for static areas use just original fields
# --------------------------------------------------
mappedbob
#bobbed

oweave.mt_merge(last,notstatic.mt_inpand(Y=2,U=2,V=2),luma=false,U=3,V=3)


# Lastly, set correct parity for the bobbed clip
# ----------------------------------------------
(order==0) ? AssumeTFF() : AssumeBFF()

return(last)
}

# ===============================================

############################
# Helper functions below #
############################


## Function nnEDIbob, courtesty of tritical:

# slow, but accurate nnEDI-bob, always dumb ;)

Function nnEDIbob(clip Input)
{
Input.nnedi(field=-2)
}


# Helper to simplify script
function AssumeParity(clip clp, string "order")
{
order == "TFF" ? clp.assumeTFF() : clp.assumeBFF()
return(last)
}

# Kill Combing Function
function VinverseD(clip clp, float "sstr", int "amnt", int "uv")
{
uv = default(uv,3)
sstr = default(sstr,2.7)
amnt = default(amnt,255)
uv2 = (uv==2) ? 1 : uv
STR = string(sstr)
AMN = string(amnt)
vblur = clp.mt_convolution("1","50 99 50",U=uv,V=uv)
vblurD = mt_makediff(clp,vblur,U=uv2,V=uv2)
Vshrp = mt_lutxy(vblur,vblur.mt_convolution("1","1 4 6 4 1",U=uv2,V=uv2),expr="x x y - "+STR+" * +",U=uv2,V=uv2)
VshrpD = mt_makediff(Vshrp,vblur,U=uv2,V=uv2)
VlimD = mt_lutxy(VshrpD,VblurD,expr="x 128 - y 128 - * 0 < x 128 - abs y 128 - abs < x y ? 128 - 0.25 * 128 + x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
mt_adddiff(Vblur,VlimD,U=uv,V=uv)
(amnt>254) ? last : (amnt==0) ? clp : mt_lutxy(clp,last,expr="x "+AMN+" + y < x "+AMN+" + x "+AMN+" - y > x "+AMN+" - y ? ?",U=uv,V=uv)
return(last)
}

# Nifty Gauss/Median combination
function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r==1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}

stanjr
27th November 2008, 07:31
How would one go about using the timecodes.txt and hybrid.vfrstats from the following

Telecide(order=1,guide=1)
Decimate(mode=4,threshold=2.0,timecodes="hybrid timecodes.txt",vfrstats="hybrid.vfrstats")

...to tell what to send to MCBob when trying to create a VFR encode? From what I've been reading about VFR encoding, those are the lines recommended by the help files that come with Decomb521VFR (http://webpages.charter.net/falconx/decombvfrmod.html). If that's possible, would that be the easiest way to IVTC the telecined parts and deinterlace the interlaced parts of a video that has mostly telecine, but also has interlaced video parts? Am I thinking about this all wrong? What are some suggestions?

What would happen if I just MCBobbed the whole thing? Would another level of hell open up for me? :)

jase99
9th February 2009, 01:20
Hi thetoof,

I tried MCBobmod() and found the results to be worse on horizontally scrolling credits. I'm using MVTools 2.3.1 so I needed to replace all MV* calls with M* in your updated script because the V has been removed. I'll show an example. I've trimmed, cropped and zoomed 2x the problem.

Here's the script I'm using for MCBob version 0.3u:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnEDI1.3\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_MastkTools2.0a36\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MVTools1.11.4.5\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\RemoveGrainSSE3.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\MCBob\MCBob0.3u.avs")
MPEG2Source("VTS04_PGC01.d2v")
MCBob(sharpness=1.0)
SelectEven()
Trim(131221,131221)
Crop(150,480,-280,-4)
PointResize(last.width*2,last.height*2)


Here's the script I'm using for MCBobmod:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnEDI1.3\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_MastkTools2.0a36\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MVTools2.3.1\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\RemoveGrainSSE3.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\MCBob\MCBobmod.avs")
MPEG2Source("VTS04_PGC01.d2v")
MCBobmod(sharpness=1.0)
SelectEven()
Trim(131221,131221)
Crop(150,480,-280,-4)
PointResize(last.width*2,last.height*2)

Here's the results:

MCBob 0.3u:
http://hdimage.org/images/by56gkg13smzzmqu7br6_testold.png

MCBobmod:
http://hdimage.org/images/425p10r2ywa1nvhreprk_testnew.png

This is the modified version of MCBobmod I used [calls to MV* replaced with M*, e.g., MVSuper() becomes MSuper()]: http://pastebin.com/fd43560d I tried to paste it here but the post was too long.

Could this be a problem with mvtools2 or the modified script?

@Tron@
15th February 2009, 00:40
No news about the update MCBob?? Waiting for update under mvtools2 because a lot of changes have happened and whether there were any ideas about the speed of the script (it has no - slow!) ???

Fizick
15th February 2009, 15:39
jase99,
links are broken, and please provide short source clip

Terranigma
15th February 2009, 17:13
jase99. See if you can get it to work properly with the updated MVTools2 version that i've attached.

jase99
22nd February 2009, 00:09
Apologies for the delay in replying and also for the images which are now broken due to the hosting site playing up.

mcbob_u2.zip (containing function MCBob2 in MCBob_v03u2_MVT2.avsi) is certainly better but also does not produce a result as clean as mcbob0.3u.

I have demuxed the small clip from the original MPEG-2 video and uploaded to mediafire (http://www.mediafire.com/?l2mmmi0nzjg) (1 MB)

Here are the revised scripts I am now using based on the demuxed clip and the results they produce:

MCBob0.3u:LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnEDI1.3\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools2.0a36\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MVTools1.11.4.5\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\RemoveGrainSSE3.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\MCBob\MCBob0.3u.avs")
MPEG2Source("Clip.demuxed.d2v")
MCBob(sharpness=1.0)
SelectEven()
Trim(34,34)
Crop(150,480,-280,-4)
PointResize(last.width*2,last.height*2)
http://img16.imageshack.us/img16/5802/mcbob.png

MCBobmod:LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnEDI1.3\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools2.0a36\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MVTools2.3.1\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\RemoveGrainSSE3.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\MCBob\MCBobmod.avs")
MPEG2Source("Clip.demuxed.d2v")
MCBobmod(sharpness=1.0)
SelectEven()
Trim(34,34)
Crop(150,480,-280,-4)
PointResize(last.width*2,last.height*2)
http://img16.imageshack.us/img16/1359/mcbobmod.png

MCBob2:LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnEDI1.3\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools2.0a36\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MVTools2.3.1\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\RemoveGrainSSE3.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\MCBob\MCBob_v03u2_MVT2.avsi")
MPEG2Source("Clip.demuxed.d2v")
MCBob2(sharpness=1.0)
SelectEven()
Trim(34,34)
Crop(150,480,-280,-4)
PointResize(last.width*2,last.height*2)
http://img25.imageshack.us/img25/2125/mcbob2.png

Terranigma
23rd February 2009, 08:13
I'm sorry for the delay as well, but I honestly haven't seen your post until today. :/
Well anyways, i've checked your source clip using your code and have revised the script . Should be perfect now. :devil:

jase99
23rd February 2009, 22:12
mcbobmod_proper.zip (containing function MCBob2 in MCBob_v03u3_MVT2.avsi) looks good to me :thanks:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnEDI1.3\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools2.0a36\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MVTools2.3.1\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain1.0-2\RemoveGrainSSE3.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\MCBob\MCBob_v03u3_MVT2.avsi")
MPEG2Source("Clip.demuxed.d2v")
MCBob2(sharpness=1.0)
SelectEven()
Trim(34,34)
Crop(150,480,-280,-4)
PointResize(last.width*2,last.height*2)
http://img4.imageshack.us/img4/6318/mcbob2proper.png

Acid_Reign
6th April 2009, 07:49
I am getting a “Divide by Zero” error any time I try to feed MCBob2 a YUY2 clip. It works fine with YV12. I am using all of the latest filters, exactly as jase99 has above (with the exception of MVTools, which is 2.4.1, but switching to 2.3.1 produces the same error).

Polacchini
14th April 2009, 05:59
I am getting a “Divide by Zero” error any time I try to feed MCBob2 a YUY2 clip. It works fine with YV12. I am using all of the latest filters, exactly as jase99 has above (with the exception of MVTools, which is 2.4.1, but switching to 2.3.1 produces the same error).

Yup, I've also tried to mod the MCBob script so it could take YUY2 video (as to Didée's instructions at post #46 (http://forum.doom9.org/showpost.php?p=1139184&postcount=46)), but it would crash as soon as mt_lut is called.

Has anyone ever successfully fed a YUY2 clip into mcbob?

Any kind of help is much appreciated :)

:thanks:

stanjr
9th May 2009, 15:39
crop( 8, 0, -6, -2)

The reason you're getting that "slanty line thing" is because you're not cropping in multiples of 4.

Undead Sega
9th May 2009, 20:08
Is MCBob0.3u the latest version of this filter?

ajp_anton
23rd May 2009, 00:15
Don't you need
converttoyv12(interlaced=true)
?

Terranigma
23rd May 2009, 15:58
Is MCBob0.3u the latest version of this filter?

Yes, for mvtools1.
If you want to use the mvtools2 version, then grab this (http://forum.doom9.org/showthread.php?p=1253486#post1253486) one.

Undead Sega
25th May 2009, 14:14
ahh i see, well then may i ask, what are the differences between MCBob0.3u from MCBob0.3c (which is the one i am using sometimes cause of its incredible speed and i asume was the last one prior to this)?

Didée
25th May 2009, 15:19
Good Q. The latest version that _I_ did was 0.3c. Then from some point, the talk was always about 0.3u ... can't tell if that's truly a modification, or just a typo that somehow popped up and persisted ...

Terranigma
25th May 2009, 16:25
Good Q. The latest version that _I_ did was 0.3c. Then from some point, the talk was always about 0.3u ... can't tell if that's truly a modification, or just a typo that somehow popped up and persisted ...

It's the mod that used nnedi for interpolating instead of eedi2. Do you not recall this (http://forum.doom9.org/showthread.php?t=129953&highlight=mcbob&page=3) thread ?

Undead Sega
25th May 2009, 16:39
It's the mod that used nnedi for interpolating instead of eedi2. Do you not recall this (http://forum.doom9.org/showthread.php?t=129953&highlight=mcbob&page=3) thread ?

but wait, isnt that basically NNEDI+MCBob_v03c?? because thats the one ive been using since over a year ago.

i think ive even made a post saying 'hey, wouldnt it be great if MCBob was combined with NNEDI, because its a better interpolator or AA?' and someone said, sure because its been done already, and i was given the link and script and so on, and i must say speed is awesome, like 0.15fps :D

i always use YadidMod now, because it gives me great results but i can see in the tiny places that the quality doesnt match MCBob, but its Anti-Aliasing seems far superior than MCBob's though, and both uses NNEDI.

Terranigma
25th May 2009, 17:16
but wait, isnt that basically NNEDI+MCBob_v03c?? because thats the one ive been using since over a year ago.

i think ive even made a post saying 'hey, wouldnt it be great if MCBob was combined with NNEDI, because its a better interpolator or AA?' and someone said, sure because its been done already, and i was given the link and script and so on, and i must say speed is awesome, like 0.15fps :D


Yes, which was probably linked to my post or probably a repost of my original post.

Undead Sega
25th May 2009, 19:00
probably, but it doesnt matter, what matters is, what is the difference between the two?

and what kind of Motion Compensation does MCBob perform?

is there any chance for a GPU to carry out such an instruction to and for video?

Fizick
25th May 2009, 20:11
it is THE QUESTION after long-long discussiion :)

thetoof
26th May 2009, 03:26
Good Q. The latest version that _I_ did was 0.3c. Then from some point, the talk was always about 0.3u ... can't tell if that's truly a modification, or just a typo that somehow popped up and persisted ... I recall reading somewhere that the "u" was because mcbob+nnedi is an unofficial version, since you were not the one who released it.

Undead Sega, the difference is that nnedi's interpolation is more accurate than eedi2's. However, as it was said here and there, more accurate does not always mean better depending on the source. (See TGMC's edimode)

To have mcbob ported to GPU, MVtools and all the other filters involved would have to be ported too.

shoopdabloop
26th May 2009, 04:04
will there ever be a mostly-MT version of MCBob? so basically, will there ever be a fully-MT MVTools?

Sagekilla
26th May 2009, 14:20
If you've been keeping up with MVTools development, the latest version (2.0) works perfectly fine with MT.

stanjr
2nd June 2009, 17:05
Not true. The results of mcbob, is most of the times, better than that of any other bobber/deinterlacer, and if you know how to use functions to either give it guidance, (such as by configuring tdeint to detect interlaced frames and then use mcbob as an external deinterlacer with selectevery(2,0)) or manually select frames for deinterlacing, then it can be used in the exact same manner as any other interlace detecting deinterlacer/bobber.

It may have been constructed for true interlaced material, but it can be used for progressive material (that has a bit of interlacing) as well. :P
How do you do this?

I'm trying to use TFM on a hybrid clip (telecined and interlaced sections), using the clip2 parameter of TFM to replace the interlaced sections with deinterlaced sections.

Like this:
MPEG2Source("my.d2v")
TFM(PP=4,slow=2,clip2=MCBob2(sharpness=1.0).SelectEven())

...but some interlaced frames are still getting through! I've set PP=4 due to the TFM readme stating that 1 < PP < 5 when using the clip2 parameter to be able to use a deinterlacer besides it's internal ones.

If I use just:
MPEG2Source("my.d2v")
MCBob2(sharpness=1.0).SelectEven()

...all frames get deinterlaced correctly. But of course, the telecined parts are handled incorrectly. Is TFM broken, or am I doing something wrong?

The ultimate goal is to create a VFR encode, with the telecined parts dealt with correctly, and the interlaced parts dealt with with MCBob2. Does anybody know how to do this?

NOTE: I've tried a d2v created by ignoring pulldown flags AND by honoring them. I've also tried PP=1 through 6.

2Bdecided
2nd June 2009, 17:33
MCBob2?!

(btw, to answer your question, you'll probably have to provide a problematic section of your source for people to test with - unless it's some syntax error that someone can spot immediately)

Cheers,
David.

stanjr
2nd June 2009, 18:28
MCBob2 = mcbobmod_proper (I renamed it that way for myself). So that there's no misinterpretation, I've attached my MCBob2.avsi. Here (http://www.sendspace.com/file/3h3osg) is a sample problematic file. It's the first minute of a video I'm trying to encode. Maybe you guys can help me out with it. The first frame that I notice that shouldn't be interlaced when using this (but is):

LoadPlugin("C:\Program Files\dgmpgdec154\DGDecode.dll")
MPEG2Source("my.d2v")
TFM(PP=4,slow=2,clip2=MCBob2(sharpness=1.0).SelectEven())

...is frame 324.

It isn't interlaced when using this:

LoadPlugin("C:\Program Files\dgmpgdec154\DGDecode.dll")
MPEG2Source("my.d2v")
MCBob2(sharpness=1.0).SelectEven())

...but of course the telecined section is dealt with improperly.

stanjr
2nd June 2009, 19:59
I think I've figured this out on my own. In creating a VFR encode per this guide (http://avisynth.org/mediawiki/VFR), I had to reduce the "mi" parameter from its default for tfm() in the first-pass VFR script, to be:

TFM(mi=60,PP=2,slow=2,output="tfm.txt")
TDecimate(mode=4,output="stats.txt")

...and making the second-pass VFR script be:

TFM(mi=60,PP=2,slow=2,clip2=MCBob2(sharpness=1.0).SelectEven())
TDecimate(mode=5,hybrid=2,dupthresh=1.0,input="stats.txt",tfmin="tfm.txt",mkvout="timecodes.txt")

This seems to be correct anyway. Does anyone see anything fishy or have any tips to add?

jase99
6th July 2009, 03:37
Does anyone see anything fishy or have any tips to add?I see nothing fishy. TFM only deinterlaces (pulling in frames from clip2 in your case) frames which it detects are interlaced based on the values of mi and cthresh.

Terka
15th July 2009, 09:46
in mcbob,
would it be helpfull to use part of TGMC
t1 = clip.temporalsoften(1,255,255,28,2)
t2 = clip.temporalsoften(2,255,255,28,2)
t1.merge(t2,0.357).merge(clip,0.125)
return(last) ...
to help mvtools for better vector search?

Didée
15th July 2009, 18:41
Rather not. At best, it would help only very little. And most probably, it would do more harm than good.

Keep in mind that the "motion system" of MCBob is quite different to that of TGMC. TGMC searches motion between directly-adjacent fields (i.e. even<->odd), so the bob-flicker is present between those fields, hence should be eliminated before doing the ME.
MCBob searches motion between every other field (i.e. even<->even + odd<->odd), so there (theoretically) is no bob-flicker that could disturb the search.
MCBob has some waaay more severe problems than this one ...



General note:

The contestants MCBob & TGMC are pretty much optimized in respect to their methodology-of-processing. Surely they're not perfect ... but they're close, as far as the basic methodology allows.


I'm getting tired of being faced with "I don't quite understand the whole thing, but what about [put random obscure idea here] .. ?!?", and then having to explain why pigs don't fly.


If anyone has ideas that s/he thinks that would bring a worthwhile improvement, then:

MAKE IT, and SHOW THE PROOF.


Until then, I'll resort to short "nope"-style answers, when indicated.


Seriously, I'd rather invest into improving the underlying tools, namely MVTools. There current uniform-and-flat SAD concept is (too) simplistic, motion coherence is either too strict or too loose with not much in-between, reckognition of mid- or even long-range motion is not good, same for motion interpolation, and whatnotelse.
Think about SAD (or SSD, or whatever) weighted by local complexity, instead of just uniformly-flat. Think about block-coherence weighted by similarity-of-content (yay, requires multipass ME, that's true). Think about cross-linking forward/backward search for motion interpolation (what? this: instead of independently searching the "best" vectors forward and backward [which might not agree upon each other], search the almost-best vectors that *do* agree).

And and and ... there is so much idle potential in the motion department ... TAHT is way more fruitful to be explored, compared to naively poking-in-the-blue with AS scripts.

No point in crying for gasoline with higher and even higher octane index. A stronger engine is what is needed.

Cyber-Mav
25th July 2009, 22:04
can MCbob be made to work with megui?

Terka
10th August 2009, 08:57
and using the temporalsoften technique for mvbobmod?

dansrfe
12th September 2009, 16:58
Can someone please list the required .avs file and dll and syntax to use this. The information is kind of scattered all over the place.
Thanks.

Didée
12th September 2009, 17:44
Did you look at posts #2 and #3 in this thread? There's a list of the needed plugins, and the required avs file to import.

dansrfe
12th September 2009, 22:19
I couldn't find the list of plugins :(

canuckerfan
12th September 2009, 23:17
I couldn't find the list of plugins :(

# Prerequisites:
#
# - MVTools, preferably v1.4.13 (or newer)
# - MaskTools v2.0
# - EEDI2
# - RemoveGrain/Repair package
# - ReduceFlicker (if temp-NR for ME is used)
# - MedianBlur by tsp

Arshad07
17th September 2009, 01:01
Getting some error here,

Script:

LoadPlugin("D:\Encode\MaskTools.dll")
LoadPlugin("D:\Encode\medianblur084\medianblur.dll")
LoadPlugin("D:\Encode\ReduceFlicker\ReduceFlicker.dll")
LoadPlugin("D:\Encode\ReduceFlicker\ReduceFlickerSSE2.dll")
LoadPlugin("D:\Encode\ReduceFlicker\ReduceFlickerSSE3.dll")
LoadPlugin("D:\Encode\EEDI2v092\EEDI2\EEDI2.dll")
Import("D:\Encode\plugins\plugins\MCBob.avsi")
LoadPlugin("D:\Encode\mvtools2.dll")
Import("D:\Encode\YLevels_mt.avsi")
DGDecode_mpeg2source("D:\x\C.d2v", cpu=4, info=3)
ColorMatrix(hints=true, interlaced=true, threads=0)
Load_Stdcall_Plugin("C:\Program Files (x86)\megui\tools\yadif\yadif.dll")
MCBob().SelectEven()
SRestore(frate=25)
crop( 2, 64, 0, -64)
Spline64Resize(640,352)

The rest of the plugins are all in the Avisynth folder.

Error: http://i26.tinypic.com/34o23jd.jpg

canuckerfan
17th September 2009, 01:08
^you sure you have MVTools 1.x loaded? I think MCBob needs the 1.x branch in order to work. you can find it here: http://avisynth.org.ru/mvtools/mvtools.html

ps: why are you calling selecteven() in between your bobber and srestore? srestore is supposed to be fed with a bobbed clip.

Arshad07
17th September 2009, 01:14
^you sure you have MVTools 1.x loaded? I think MCBob needs the 1.x branch in order to work. you can find it here: http://avisynth.org.ru/mvtools/mvtools.html

ps: why are you calling selecteven() in between your bobber and srestore? srestore is supposed to be fed with a bobbed clip.

Cheers Matey! :rolleyes: Works like a charm! I thought it requires 'latest' version of mvtools.

Revgen
22nd November 2009, 01:37
I've modified Terranigma's mcbobmodpropper script and replaced NNEDI with EEDI3 and NNEDI2.

This script is super slow and eats up memory in no time. I'd recommend this only for testing until Tritical updates EEDI3 to be more efficient. Just a reminder, mcbobmodpropper and derivatives use mvtools 2.x.

http://www.sendspace.com/file/xe15op

cy
22nd December 2009, 11:04
I have here this pal dvd, which is interlaced and i figured i'd give MCBob (with default parameters) a try.
It's slow, but it's good. Very good.
There's some combing left here and there, but Vinverse (another great script) takes care of that real good.

As a 'cut and paste' avisynth scripter, i surely appreciate these great scripts.
Thanks Didée!

Didée
22nd December 2009, 12:40
> There's some combing left here and there,

Could you show an example of combing being left? Because, basically there should not be any combing left ever, since MCBo is already using Vinverse internally.

What sometimes may happen is that MCBob considers an area as being static (and thus just weaves the fields), when in fact it's not static. Though usually it's in areas with subpixel-motion, resulting in some aliasing, rather than combing.

You probably could improve with some parameter adjustments - MCBob's defaults might be a bit too generous at times. See here (http://forum.doom9.org/showthread.php?p=1347744#post1347744) to get some ideas.

cy
22nd December 2009, 14:55
I've prepared a small package with a couple of screenshots @ x2 enlargement in AvsP (source, source.mcbob, source.mcbob.vinverse) and a sample of the source of the two scenes they were taken from.
Look closely at the piano teacher (the woman in white coat and white blouse).
Mind you, i'm not complaining or anything :-)
I'm sure some things can be tweaked in MCBob, but running Vinverse after it seemed an easy solution to me.
Download here (http://users.edpnet.be/cy/mcob_combing.rar).

Didée
22nd December 2009, 19:31
That source is progressive with phase shift. You don't want to use MCBob on that. Not at all. You want to use source.TFM() there. Better quality, less artifacts, and a billion times faster.

(edit - removed comment about source1 - both sources are of same type.)

cy
22nd December 2009, 20:09
I would have sworn it was interlaced.
What on earth is "progressive with phase shift"?
And what is the purpose of it?
Another weapon in the movie industries fight against quality?

Edit: And how do you tell the difference?
What do i look for?

Edit2: Just tried a TMF() and it doesn't look better to me.
On the contrary, there are many scenes that have residual combing, worse than i ever saw with MCBob on this source.
Some scenes look alright though, and maybe slightly better than the MCBob ones, but overal it's worse imo.

screenie here (http://users.edpnet.be/cy/screenies.rar)

Edit3: After some more pixel peeping...there's definately more combing left with TMF than with MCBob, most of the time.
There is however less aliasing in certain straight lines. I guess because there's no bobbing and eedi2 (or nnedi2) involved. Not sure what to think of this all though. The TMF thing is of course much faster.
Still haven't figured out what this phase shifting thing is. I do know however, it should be forbidden by law. As should interlacing.

Edit4: Am i correct in thinking the stream was progressive to begin with, then split up into fields and then weaved again, but 1 field "temporally" shifted. Like, frame 1= field1 and field3, frame2=field2 and field4...
Is this correct?
If so, then what is the purpose of it? To make our lives more miserable?

Didée
22nd December 2009, 23:26
Harrr, seems I have to start with Adam and Eve? Yaba-daba-doooo .....


In a progressive frame, two fields do form the full frame.

Progressive / phase shift means that the two fields that belong to one progressive frame are not present in one frame, but in two different frames.


Progressive:

a b c d e
A B C D E


Progressive/phase shift:

a b c d e
B C D E F


On your samples, try

mpeg2source("source1.d2v")
doubleweave().selectodd()

All interlacing is gone, since this gets the two belonging-together fields from two frames, and puts them together in one frame.

This case is "hard" or "constant" phase shift. The usual case is "dynamic" phase shift, where the distribution of fields is changing over time. Sometimes they're shifted, sometimes they're not, sometimes they're shifted the other way round ... For these cases of dynamic phase shift, it is pretty unreasonable to put everything together manually. For this, filters like TFM or Telecide do the job, they search automatically for those fields that fit together.


After putting together the fields, residual combing still may be present. Par ex, your samples do so. The reason is (mostly) an encoding issue, due to the fact that the fields which belong together were not encoded together (i.e. progressive), but independently (i.e. interlaced). (In mpeg-2 world, interlaced encoding is always less effective and more erroneous than progressive encoding.)


Hence, try this on your samples:

mpeg2source("source1.d2v")
doubleweave().selectodd()
Vinverse()


In practice, you normally would swap doubleweave/selectodd with TFM or Telecide, in order to avoid checking the whole source manually for changes of the phase shift. I can't tell if you need to tweak parameters for TFM/Telecide, or if their defaults are sufficient and following them with Vinverse is enough. Just try and see.

cy
23rd December 2009, 00:08
Alright..got it.
And thank you for your patience to explain things to me (and others) which i know are very basic to you.
For the average guy, this stuff is difficult you know.
It seems, all i ever do is try to fix my shoddy dvd's.

SubOne
6th January 2010, 13:41
I read through this entire thread, and I am confused beyond all recognition. All I want to do is convert 60i footage to 60p. (Or maybe 120p). Which version should I download? I have a Core 2 Duo overclocked to 4 GHz and 4GB RAM. I have time on my hand, looking for the best possible quality, but it shouldn't take an hour for a second of footage or so.

So, yes, I would be grateful if someone could direct a relative newbies like us in the right direction. 60i to 60p, what do I download (which version) for the Plugin folder, and what is the final Avisynth script like (after AVISource)?

BTW, I have downloaded all the prerequisites in the "latest" mod, i.e. v03u4, so I believe I am set to download the right version/mod and a simple script.

thetoof
6th January 2010, 19:34
If you want quality and flicker-free output, check http://avisynth.org/mediawiki/TempGaussMC (newest versions near the end of the discussion thread)

Revgen
6th January 2010, 21:53
^Some people don't want denoising. Even with Didee's noise-reduction recommendations, it still removes noise.

thetoof
6th January 2010, 22:46
Granted, but he only asked for quality bobbing and mentioned being a "relative newbie", which means he was most likely unaware of tgmc. Being the newest hq bobber, I felt it was worth posting about it.

SubOne - As for MCBob usage if you want to use it in the end, put all the requirements .dll in the plugins folder of avisynth (program files), as well as the .avs scripts renamed to .avsi for autoload and call it this way:

xxxsource
mcbob()

that's it

SubOne
7th January 2010, 06:11
Granted, but he only asked for quality bobbing and mentioned being a "relative newbie", which means he was most likely unaware of tgmc. Being the newest hq bobber, I felt it was worth posting about it.

SubOne - As for MCBob usage if you want to use it in the end, put all the requirements .dll in the plugins folder of avisynth (program files), as well as the .avs scripts renamed to .avsi for autoload and call it this way:

xxxsource
mcbob()

that's it

Thanks, that's what I did! I was wondering how to get 120p though. Or will Mflow on Mvtools on 60p do that better?

Will try TGMC, but am not looking for denoising of any sort.

thetoof
7th January 2010, 06:28
sure TGMC denoises a bit, but it is not a denoiser; it's a high quality bobber - probably the most stable around, the price being losing some noise/grain.

Why do you need 120fps?? 60 is already quite fluid.

Read these 2 posts about bobbing vs framerate conversion http://forum.doom9.org/showthread.php?p=1358568#post1358568

It's in the same thread as tgmc btw.

2Bdecided
7th January 2010, 14:26
An ideal bobber has got to do something with noise though.

If it works really well on the picture content (i.e. restoring all the "missing" spatial and temporal information), but leaves the noise as it is, then the noise will have half the spatial or temporal resolution of the image!

So you've either got to add noise to make it match, or remove noise to make it go away.

IMO. YMMV! ...but don't argue until you've thought it through - this is a deceptively complex point. It's one of the reasons why dumb bob looks so soft - the perceived resolution of any noise is decreased dramatically (as well as the wanted image, of course!).

Cheers,
David.

SubOne
7th January 2010, 20:00
sure TGMC denoises a bit, but it is not a denoiser; it's a high quality bobber - probably the most stable around, the price being losing some noise/grain.

Why do you need 120fps?? 60 is already quite fluid.

Read these 2 posts about bobbing vs framerate conversion http://forum.doom9.org/showthread.php?p=1358568#post1358568

It's in the same thread as tgmc btw.

I was actually going for a super slow motion. But of course, interpolation has nothing to do with bobbing, but I was wondering if it was a part of these mods.

Anyway, I tried a vast variety of bobbers, and I am impressed with TGMC beta 1 mod 2. Though it is still very slow as I am working with full HD 1080p lossless content. I have put Edimode=NNEDI2, Smode=0 and Sharpness=0, which speeds up considerably, but still, 5 hours for a 3.5 minute clip is painfully slow. Any suggestions? Or is this the best I can do? As I said, I don't want to compromise on quality too much.

On a side note, if I were to interpolate this 60p footage to 120p, would you suggest Mflowfps?

Didée
7th January 2010, 21:11
Don't ask me for handling of full-HD content - my rig does a panic shutdown when faced with such. :D

Perhaps one thing - with 1080i footage, you might want to try blocksize=32, maybe with overlap=8. This might suffice, and should be a bit faster. Also, as mentioned several times, use small temporal radii, like TGMC(1,1,1,...) or even (1,1,0,...)

In respect to doing Interlaced -> TGMC -> SloMo(MFlowFPS), some days ago I used the following small mod within TGMC as a quick shortcut:
[...]

# apply sharpness limiting (SLmode 3|4), or has "draft" been requested?
stage3 = (draft==2) ? t .subtitle("Draft 2")
\ : (draft==1) ? t1 .subtitle("Draft 1")
\ : (SLmode==3) ? ( (SLrad<2) ? stage2.repair(edi,1) : stage2.repair(stage2.repair(edi,12),1) )
\ : (SLmode==4) ? stage2.mt_clamp(pmax,pmin,Sovs,Sovs,U=3,V=3)
\ : stage2

# factor = 4 # => 1/4 speed
#---------------------------------
# sup33=stage3.MSuper(pel=_pel,sharp=_shrp)
# stage3 = stage3.MFlowFPS(sup33,bvec1,fvec1,num=factor*FramerateNumerator(edi),den=FramerateDenominator(edi)).assumefps(Framerate(edi))

# if "border" was active, crop it back again
(border) ? stage3.crop(0,4,-0,-4)
\ : stage3

[...]

Didée
7th January 2010, 21:18
{explaining the noise/bob dilemma}
I thought it through, but won't argue ... since I'm completely with you here. That post made my day. Thank you! :)

SubOne
8th January 2010, 10:32
Thanks a lot Didee. blocksize=32 works like a charm, though small radii leaves weird artifacts of sorts. Perhaps because there's quite a bit of motion in some places. Speed is fine. Painfully slow, but the timing is perfect with my sleep pattern. :)

wqcr
8th April 2010, 14:39
Hi,
I have packed all the needed stuff to work with MCBob to single ZIP file. Useful for total newbies, just unpack everything to your Avisynth plugin directory and call MCBob from your script. I also added NNEDI version - function MCBobNNEDI(). (Maybe someone did this already, in this case, just ignore or delete my post) :)

Link (http://dl.dropbox.com/u/861828/other/mcbob_plugins.zip)

PS: Thank you very much for this deinterlacer!

Terka
13th April 2010, 19:38
Hi,
correct me if im wrong when reading the mcbob script


alt_1 = MFlowInter(bobbed_Clip,bw_vec2,fw_vec2,time=50.0,thSCD1=64*18,thSCD2=227)
looks like wrong. probably should be

alt_1 = bobbed.MFlowInter(srch_super ,bw_vec2,fw_vec2,time=50.0,thSCD1=64*18,thSCD2=227)
am i correct and is this a bug, or i am mistaken?

Terranigma
28th April 2010, 00:37
Well today, I decided to update my unofficial mcbob script again to include more interpolator types other than nnedi2, so now it includes all 3 versions of the nnedi interpolator (nnedi, nnedi2, nnedi3) + EEDI2, which is controlled by "EDIType".

Usage: "MCBobU"
EEDI2 = EDIType 1
NNEDI = EDIType 2
NNEDI2 = EDIType 3
NNEDI3 = EDIType 4

Also added the "maxd" parameter for EEDI2, and nsize/qual for NNEDI2/3

Download (http://www.zshare.net/download/754581419c33ba78/)


nnedi3 can be downloaded here (http://bengal.missouri.edu/~kes25c/nnedi3.dll)

Terranigma
3rd May 2010, 07:00
Well here we go again. This will be my last update for this script in a while (until there's some drastic changes such as a MVTools3?). This time, I changed the way selecting interpolators work. It's now handled by a string; the same way as it functions in TempGaussMC, e.g. EdiMode="nnedi2" instead of EDIType=3. Also cleaned up the script a bit. Read the script in a text editor to see what's been altered.

The main purpose for updating this script is to support tritical's new nnedi3 (beta) interpolator, and any additional parameters that may arise, and last night, tritical updated his nnedi3 filter with a new adjustable parameter.. nns (which i've added to the script). You can check out tritical's post about the change here (http://forum.doom9.org/showthread.php?p=1396771#post1396771), and can alternatively download the mcbob script with the latest change here (http://www.zshare.net/download/7566822791516601/).

ajp_anton
23rd August 2010, 19:33
Why does the script still use the function VinverseD when vinverse.dll is included in the package?
I got ~10% speed increase just by removing those "D"'s from the script, and I can't see any difference in the output.

Didée
23rd August 2010, 20:48
Because I don't care anymore about this dinosaur. MCBob contains some nice technical tidbits, but the concept as a whole is flawed.

ajp_anton
23rd August 2010, 21:41
I was talking about the scripts posted by Terranigma. And MCBob still gives me the best results on some videos.

Terranigma
24th August 2010, 00:24
I was talking about the scripts posted by Terranigma. And MCBob still gives me the best results on some videos.

There's subtleties--although minute at best--that made me keep the slower Vinverse in use for MCBob. Mainly it has to do with borders specifically. I don't know what specific changes tritical (porter of Vinverse.dll) employed to get an extra boost out of Vinverse (other than porting it to an avisynth filter dll), but sometimes, depending on the source, the top border gets blurred a bit.

Here's an example:

Vinverse by Didée:
http://a.imageshack.us/img839/8807/vinversedide.png

Vinverse by tritical:
http://a.imageshack.us/img214/5654/vinversetritical.png

Also, by default (iirc), the original version of Vinverse is a tad bit stronger than Vinverse.dll

Livesms
4th February 2012, 18:18
Any updates for McBob since Terranigma posted MCBobUv5.7zip ?

real.finder
2nd July 2020, 05:13
update u7 https://raw.githubusercontent.com/realfinder/AVS-Stuff/Community/avs%202.5%20and%20up/MCBob.avsi

HBD and new things