VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Background: A while back I tried to mod DeSpot for VapourSynth to use svp, but got stuck when there was no svp1.Convert available, since it is in AviSynth I was wondering whether there are some SVP mods of AviSnyth scripts I'm not aware of that might be worth checking out.

    Looking at the old SVPflow motion interpolation (Avisynth + Vapoursynth, Linux, Mac?) thread over at doom9s, I saw that folks tried to use svp to speed up:but none of these seem to come to a working version.

    -> Are there examples of scripts where folks used svp to speed up mvtools2 stuff that are not just Interframe modifications and thus are not just used for frame interpolation?

    Cu Selur
    Last edited by Selur; 10th Jun 2022 at 05:37.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  2. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    I experimented writing and using this function, based on this thread: https://forum.doom9.org/showthread.php?t=175390

    Code:
    Function ReplaceFramesSVPFlow(clip Source, int N, int X)
    {
    # N is number of the 1st frame in Source that needs replacing.
    # X is total number of frames to replace
    #e.g. ReplaceFramesSVPFLow(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for SVPFlow interpolation
    
    start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
    end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point
    
    start+end
    AssumeFPS(1) #temporarily FPS=1 to use mflowfps
    
    super=SVSuper("{gpu:1}")
    vectors=SVAnalyse(super, "{}")
    SVSmoothFps(super, vectors, "{rate:{num:"+String(X+1)+", den:1}}", url="www.svp-team.com", mt=1).Subtitle("SVPFlow")
    
    AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
    Trim(1, framecount-1) #trim ends, leaving replacement frames
    
    Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
    }
    Quote Quote  
  3. Ah okay, that is similar to what I did when porting FillDrops to Vapoursynth (https://github.com/Selur/VapoursynthScriptsInHybrid/blob/master/filldrops.py).
    (Rephrased my question, in the above thread, since that is exactly the stuff I know works. )

    Cu Selur
    Last edited by Selur; 10th Jun 2022 at 05:54.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  4. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    I see. I used svp only for frame interpolation, so I cannot help here, sorry.
    Quote Quote  
  5. No problem, that's exactly why I was wondering if folks managed to use it for something else.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  6. Found one thing so far which I wrote myself:
    Code:
    function FastDegrain_svp( clip src, int "degrain", int "blksize", int "overlap", int "pel", int "thSAD", int "limit",Bool "gpu")
    {
        degrain = default( degrain,         2 ) # Degraining method (1 - 3)
        blksize = default( blksize,         8 ) # MAnalyse block size (4, 8, 16)
        overlap = default( overlap, blksize/2 ) # MVAnalyse block overlap (0 - none, 1 - 1/8 of block size in each direction, 2 - 1/4 of block size, 3 - 1/2 of block size.)
        pel     = default( pel,             1 ) # MVAnalyse pel (1, 2, 4)
        thSAD   = default( thSAD,         400 ) # MVDegrain thSAD
        limit   = default( limit,         255 ) # MVDegrain limit (0 - 255)
    
        # Create our Super clip for SVP MV search. Then, search for motion vectors.
        src8 = src.convertbits(8).converttoyv12()
    
        superSV = SVSuper(src8,"{gpu:" + (gpu?"1":"0") + ",pel:"+string(pel)+"}")
        v1 = (degrain>=1) ? superSV.SVAnalyse("{gpu:" + (gpu?"1":"0") + ",block:{w:"+string(blksize)+",overlap:"+string(overlap)+"},special:{delta:1}}"): NOP()
        v2 = (degrain>=2) ? superSV.SVAnalyse("{gpu:" + (gpu?"1":"0") + ",block:{w:"+string(blksize)+",overlap:"+string(overlap)+"},special:{delta:2}}") : NOP()
        v3 = (degrain>=3) ? superSV.SVAnalyse("{gpu:" + (gpu?"1":"0") + ",block:{w:"+string(blksize)+",overlap:"+string(overlap)+"},special:{delta:3}}") : NOP()
    
        bv1 = (degrain>=1) ? v1.SVConvert(isb=true) : NOP()
        bv2 = (degrain>=2) ? v2.SVConvert(isb=true) : NOP()
        bv3 = (degrain>=3) ? v3.SVConvert(isb=true) : NOP()
    
        fv1 = (degrain>=1) ? v1.SVConvert(isb=false) : NOP()
        fv2 = (degrain>=2) ? v2.SVConvert(isb=false) : NOP()
        fv3 = (degrain>=3) ? v3.SVConvert(isb=false) : NOP()
    
        # Degraining the video using MVDegrain using vectors calculated through SVP
        sourceSuper = src.MSuper(pel=pel, hpad=0, vpad=0)    
        src = (degrain==1) ? src.MDegrain1(sourceSuper, bv1, fv1,                           thSAD=thSAD, limit=limit) : src
        src = (degrain==2) ? src.MDegrain2(sourceSuper, bv1, fv1, bv2, fv2,              thSAD=thSAD, limit=limit) : src
        src = (degrain>=3) ? src.MDegrain3(sourceSuper, bv1, fv1, bv2, fv2, bv3, fv3, thSAD=thSAD, limit=limit) : src
    
        return src
    }
    see: https://forum.doom9.org/showthread.php?t=183476

    Totally forgot about that, but it's really sad that seems that there's not much interest in using svp(flow) instead of mvtools,...
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  7. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Is the speed improvement so evident when deinterlacing or denoising? Good testbenches can be QTGMC, a temporal denoise with high temporal radius and a cleaner like FixRipsp2 (this last enormously if applied twice)
    Quote Quote  
  8. Totally depends on the filters and system used on.
    For me using GPU filters it not always to get a specific step faster but to free processing power for other threads.
    As a side note, I posted a svp version of FixRips how themaster1 uses it over at: http://www.digitalfaq.com/forum/video-restore/12806-fixrips-grain-noise.html

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  9. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    As a side note, I posted a svp version of FixRips
    I will check and do a comparison with the MVTools version myself then. Thanks!
    Quote Quote  
  10. Nice!
    Let me know whether it works. Aside from testing that it really runs I hadn't any content for testing it's effectiveness.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  11. Here's another FixRipsSVP mod, which is more based on the original of
    Didée
    but with the a few additional options to cover the possible mods.
    Code:
    function FixRipsSVP(clip a, int "degrain", int "thSAD", bool "spotLess", bool "twoFold")
    {
        thSAD   = default( thSAD,         499 ) # MVDegrain thSAD
        degrain = default( degrain,          1 ) # which MVDegrain to use
        spotLess =  default( spotLess,          false) # whether to use SpotLess
        twoFold =  default( twoFold,          false) # whether Degrain sp2
        a
        Clense(reduceflicker=false).Merge(last,0.5).Clense(reduceflicker=false)
        mot=RemoveGrain(11,0).RemoveGrain(20,0).DepanEstimate(range=2)
        take2=a.DePanInterleave(mot,prev=2,next=2,subpixel=2)
        clean1 =  (spotLess) ? take2.SelectEvery(5,2) : NOP()
        clean1 = (!spotLess) ? take2.TMedian2().SelectEvery(5,2) : clean1
        search_params="gpu: 1, block:{w:4,overlap: 2}" # can't use blocksize 4, w:4 <> blocksize 8
        
        sup1 = clean1.MinBlur(1).RemoveGrain(11,0).RemoveGrain(11,0)
        sup1 = sup1.mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
        sup1 = sup1.SVSuper("{ pel: 2, gpu: 1, scale: { up: 0 } }")
        v21=sup1.SVAnalyse("{"+search_params+"}")
        fv21=v21.SVConvert(isb=false)
        bv21=v21.SVConvert(isb=true)
        v22=sup1.SVAnalyse("{"+search_params+", special: { delta: 2 } }")
        bv22=v22.SVConvert(isb=true)
        fv22=v22.SVConvert(isb=false)
       
        v23   = (twoFold && degrain>=3) ? sup1.SVAnalyse("{"+search_params+", special: { delta: 3 } }") : NOP()
        bv23 = (twoFold && degrain>=3) ? v23.SVConvert(isb=true) : NOP()
        fv23  = (twoFold && degrain>=3) ? v23.SVConvert(isb=false) : NOP()
        
        sup2 = a.MSuper(pel=2,levels=1,sharp=2)
        (twoFold && degrain == 3) ? a.mdegrain3(sup2,bv21,fv21,bv22,fv22,bv23,fv23,thSAD=thSAD) : NOP()
        (twoFold && degrain == 2) ? a.mdegrain2(sup2,bv21,fv21,bv22,fv22,thSAD=thSAD) : NOP()
            
        src = interleave(a.MCompensate(sup2,fv22),a.MCompensate(sup2,fv21),a,a.MCompensate(sup2,bv21),a.MCompensate(sup2,bv22))
        src = (spotLess) ? src.SpotLess(RadT=1,ThSAD=500000,ThSAD2=499000,pel=2,chroma=true,BlkSz=4,Olap=2,tm=false,glob=false,bBlur=0.0).SelectEvery(5,2) : src # to remove less  fine details BlkSz=4,Olap=2 et RADT=1 (If higher it creates artifacts)
        src = (!spotLess) ? src.TMedian2().SelectEvery(5,2) : src
        
        
        sup3 = src.SVSuper("{ pel: 2, gpu: 1, scale: { up: 0 } }")
        search_params="gpu: 1, block:{w:4,overlap:2}}" # can't use blocksize 4, w:4 <> blocksize 8
        v31=sup3.SVAnalyse("{"+search_params+"}")
        bv31=v31.SVConvert(isb=true)
        fv31=v31.SVConvert(isb=false)
        
        v32   = (degrain>=2) ? sup3.SVAnalyse("{"+search_params+", special: { delta: 2 } }") : NOP()
        bv32 = (degrain>=2) ? v32.SVConvert(isb=true) : NOP()
        fv32  = (degrain>=2) ? v32.SVConvert(isb=false) : NOP()
        
        v33   = (degrain>=3) ? sup3.SVAnalyse("{"+search_params+", special: { delta: 2 } }") : NOP()
        bv33 = (degrain>=3) ? v33.SVConvert(isb=true) : NOP()
        fv33  = (degrain>=3) ? v33.SVConvert(isb=false) : NOP()
    
       sup3 = last.msuper(pel=2,sharp=2)
       (degrain == 1) ? last.mdegrain1(sup3,bv31,fv31,thSAD=thSAD) : NOP()
       (degrain == 2) ? last.mdegrain2(sup3,bv31,fv31,bv32,fv32,thSAD=thSAD) : NOP()
       (degrain == 3) ? last.mdegrain3(sup3,bv31,fv31,bv32,fv32,bv33,fv33,thSAD=thSAD) : NOP()
    
        return last
    }
    
    
    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==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
         \    : (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)
    }
    
    Function SpotLess(clip c,int "RadT",int "ThSAD",int "ThSAD2",int "pel",bool "chroma", int "BlkSz",Int "Olap",bool "tm",Bool "glob",Float "bBlur") {
        myName = "SpotLess: "
        RadT     = Default(RadT,1)        # Temporal radius. (MCompensate arg)
        ThSAD    = Default(ThSAD,10000)   # SAD threshold at radius 1 (Default Nearly OFF).
        ThSAD2   = Default(ThSAD2,ThSAD)  # SAD threshold at radius RadT.
        Pel      = Default(pel,2)         # Default 2. 1, 2, or 4. Maybe set 1 for HD+. (1=precision to pixel, 2=precision to half pixel, 4=quarter pixel)
        Chroma   = Default(chroma,True)   # MAnalyse chroma arg. If set to true, use chroma in block matching.
        BlkSz    = Default(BlkSz,8)       # Default 8. MAnalyse BlkSize. Bigger blksz quicker and perhaps  better, esp for HD clips. Maybe also better where BIG noise.
        OLap     = Default(OLap, BlkSz/2) # Default half of BlkSz.
        Tm       = Default(tm,True)       # TrueMotion, Some folk swear MAnalyse(truemotion=false) is better.
        Glob     = Default(glob,True)     # Default True, Allow set MAnalyse(global) independently of TrueMotion.
        Bblur    = Default(bblur,0.0)     # Default OFF
        Assert(1 <= RadT,myName + " 1 <= RadT")
        Assert(0.0 <= bblur <= 1.58, myName + "0.0 <= bblur <= 1.58")
        Assert(pel==1 || pel==2 || pel==4, myName + "pel==1 || pel==2 || pel==4")
        pad      = max(BlkSz,8)
        sup      = (bBlur<=0.0  ? c   : c.blur(bblur)).MSuper(hpad=pad,vpad=pad,pel=pel,sharp=2)
        sup_rend = (bBlur<=0.0) ? sup : c.MSuper(hpad=pad,vpad=pad,pel=pel,sharp=2,levels=1) # Only 1 Level required where not MAnalyse-ing.
        MultiVec = sup.MAnalyse(multi=true, delta=RadT,blksize=BlkSz,overlap=OLap,chroma=Chroma,truemotion=Tm,global=Glob)
        c.MCompensate(sup_rend, MultiVec, tr=RadT, thSad=ThSAD, thSad2=ThSAD2)
        MedianBlurTemporal(radiusY=0,radiusU=0,radiusV=0,temporalradius=RadT)  # Temporal median blur only [not spatial]
        SelectEvery(RadT*2+1,RadT)                                             # Return middle frame
    }
    
    Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
    {# median of 5 clips from Helpers.avs by G-force
    
        chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
    
        #MEDIAN(i1,i3,i5)
        Interleave(input_1,input_3,input_5)
        chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
        m1 = selectevery(3,1)
    
        #MAX(MIN(i1,i3,i5),i2)
        m2  = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_Logic(input_5,"min",chroma=chroma).MT_Logic(input_2,"max",chroma=chroma)
    
        #MIN(MAX(i1,i3,i5),i4)
        m3  = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_Logic(input_5,"max",chroma=chroma).MT_Logic(input_4,"min",chroma=chroma)
    
        Interleave(m1,m2,m3)
        chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
        selectevery(3,1)
    
        chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
    
        Return(last)
    }
    
    function TMedian2(clip c) {
        Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) )
    }
    also included the helper functions.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!