Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th September 2008, 03:59   #101  |  Link
sno0py
Registered User
 
Join Date: Sep 2005
Posts: 12
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!!
sno0py is offline   Reply With Quote
Old 7th September 2008, 04:17   #102  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
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.
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 7th September 2008, 04:29   #103  |  Link
sno0py
Registered User
 
Join Date: Sep 2005
Posts: 12
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 is offline   Reply With Quote
Old 7th September 2008, 07:35   #104  |  Link
sno0py
Registered User
 
Join Date: Sep 2005
Posts: 12
for the record... TGMC worked like a charm although this is the mcbob forum, i think i'm now a big fan of tgmc thx for the help, toof much appreciated
sno0py is offline   Reply With Quote
Old 7th September 2008, 07:50   #105  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
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)
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 7th September 2008, 16:31   #106  |  Link
sno0py
Registered User
 
Join Date: Sep 2005
Posts: 12
heh.. that's no problem.. progressive ftw!
sno0py is offline   Reply With Quote
Old 1st October 2008, 14:46   #107  |  Link
stanjr
Linux Encoder
 
Join Date: Feb 2004
Posts: 78
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:
Quote:
# 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:
Quote:
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
Quote:
LoadPlugin("[AviSynth Plugins Directory]/MT.dll")
SetMTmode(2,4)
be put in at the top of my encode.avs instead?
stanjr is offline   Reply With Quote
Old 14th November 2008, 21:07   #108  |  Link
stanjr
Linux Encoder
 
Join Date: Feb 2004
Posts: 78
MCBob code should be updated for MVTools V2! I'm not sure how to go about doing that myself, though....
stanjr is offline   Reply With Quote
Old 14th November 2008, 22:26   #109  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
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)


Code:
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)
}
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)

Last edited by thetoof; 14th November 2008 at 22:35.
thetoof is offline   Reply With Quote
Old 27th November 2008, 07:31   #110  |  Link
stanjr
Linux Encoder
 
Join Date: Feb 2004
Posts: 78
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. 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?

Last edited by stanjr; 27th November 2008 at 07:34.
stanjr is offline   Reply With Quote
Old 9th February 2009, 01:20   #111  |  Link
jase99
*nix
 
jase99's Avatar
 
Join Date: Feb 2008
Posts: 34
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:
Quote:
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:
Quote:
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:


MCBobmod:


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?

Last edited by jase99; 9th February 2009 at 19:16. Reason: Added modified MCBobmod script
jase99 is offline   Reply With Quote
Old 15th February 2009, 00:40   #112  |  Link
@Tron@
Registered User
 
Join Date: Nov 2008
Posts: 24
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!) ???
@Tron@ is offline   Reply With Quote
Old 15th February 2009, 15:39   #113  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
jase99,
links are broken, and please provide short source clip
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 15th February 2009, 17:13   #114  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
jase99. See if you can get it to work properly with the updated MVTools2 version that i've attached.
Attached Files
File Type: zip mcbob_u2.zip (15.7 KB, 313 views)
Terranigma is offline   Reply With Quote
Old 22nd February 2009, 00:09   #115  |  Link
jase99
*nix
 
jase99's Avatar
 
Join Date: Feb 2008
Posts: 34
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 (1 MB)

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

MCBob0.3u:
Quote:
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)
MCBobmod:
Quote:
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)
MCBob2:
Quote:
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)
jase99 is offline   Reply With Quote
Old 23rd February 2009, 08:13   #116  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
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.
Attached Files
File Type: zip mcbobmod_proper.zip (15.9 KB, 895 views)
Terranigma is offline   Reply With Quote
Old 23rd February 2009, 22:12   #117  |  Link
jase99
*nix
 
jase99's Avatar
 
Join Date: Feb 2008
Posts: 34
mcbobmod_proper.zip (containing function MCBob2 in MCBob_v03u3_MVT2.avsi) looks good to me

Quote:
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)
jase99 is offline   Reply With Quote
Old 6th April 2009, 08:49   #118  |  Link
Acid_Reign
Registered User
 
Acid_Reign's Avatar
 
Join Date: Jun 2007
Posts: 26
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).

Last edited by Acid_Reign; 6th April 2009 at 08:59.
Acid_Reign is offline   Reply With Quote
Old 14th April 2009, 06:59   #119  |  Link
Polacchini
Registered User
 
Join Date: Apr 2009
Posts: 1
Quote:
Originally Posted by Acid_Reign View Post
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), 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


Last edited by Polacchini; 14th April 2009 at 07:06. Reason: included post link
Polacchini is offline   Reply With Quote
Old 9th May 2009, 16:39   #120  |  Link
stanjr
Linux Encoder
 
Join Date: Feb 2004
Posts: 78
Quote:
Originally Posted by sno0py View Post

crop( 8, 0, -6, -2)
The reason you're getting that "slanty line thing" is because you're not cropping in multiples of 4.
stanjr is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:28.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.