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. |
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#21 | Link |
Registered User
Join Date: Jan 2010
Posts: 709
|
Nope just leave it cfr as is, since I don't like how most tdecimate vfr looks, and "true" vfr as dedup ones doesn't even play on a lot of devices/players
I tried it and work well, I'm looking forward to Orum's plug too
__________________
powered by Google Translator |
![]() |
![]() |
![]() |
#22 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Post #1 of Many.
Duplicity2() v2.13 (see post #1 for docs) Code:
Function Duplicity2(clip c,"Mode",Float "ThG",Float "ThB", Int "ThP",Float "IgP",Int "ThK", \ Int "MaxDupLen",Int "LagMax",Int "MaxInterp", \ int "BlkW",int "BlkH",int "OLapX",Int "OLapY", \ Int "X",Int "Y",Int"W",Int "H",Float "CW",Bool "ChromaI",Bool "AltScan", \ Int "SPad", Int "SSharp", Int "SRFilter", [* MSuper *] \ Int "ABlkSize", Int "AOverlap", Int "ASearch",Int "ADct", [* MAnalyse *] \ Int "RBlkSize", Int "ROverlap", Int "RthSAD", [* MRecalculate *] \ Float "Iml", Bool "IBlend", Int "IthSCD1", Int "IthSCD2", [* MFlowInter *] \ Int "OthSCD1",Int "OthSCD2", [* Duplicates Detection Override *] \ String "OverRide",String "Frames",Bool "Ranges",Bool "FrameAsRange", \ Bool "Show",Bool "Verb",Bool "ShowBlk",Bool "Dim",Bool "ShowDot", \ Bool "InterpFast",String "DBase" \ ){ Function D2_Hit_Marker(int W, Int H, Bool "Hit", Int "BW", Int "BH",Int "PW",Int "PH",Bool "YV12",Bool "Mod2") { Hit=Default(hit,False) BW=Max(Default(BW,W/8),1) BH=Max(Default(BH,H/8),1) BW2=(W>4)?BW*2:BW BH2=(H>4)?BH*2:BH PW=Max(Default(PW,BW/8),1) PH=Max(Default(PH,BH/8),1) is26 = VersionNumber>=2.6 YV12=(!is26) ? True : Default(YV12,False) Mod2=Default(Mod2,True) Mod = (YV12||Mod2) ? 2 : 1 CanvasW=(W+Mod-1)/Mod*Mod CanvasH=(H+Mod-1)/Mod*Mod Rpn= RT_String("x %d < x %d >= | y %d < | y %d >= | x %d < x %d >= | & y %d < y %d >= | & ",BW,W-BW,BH,H-BH,BW2,W-BW2,BH2,H-BH2) Rpn= (Hit) ? Rpn + RT_String("x %d < x %d >= | y %d < | y %d >= | | ",PW,W-PW,PH,H-PH) : Rpn Rpn= Rpn + RT_String("x %d < y %d < & & 255 0 ?",W,H) Blankclip(width=CanvasW,height=CanvasH,Length=1,pixel_type=YV12?"YV12":"Y8").Killaudio return mt_lutspa(relative = false,yExpr=Rpn, chroma = "-128") } c myName="Duplicity2: " VER=2.13 Assert(RT_Version() >= 1.99911,RT_String("%sNeed RT_Stats v2.00Beta11(%s)",myName,RT_VersionString)) IsAvsPlus=(FindStr(UCase(versionString),"AVISYNTH+")!=0) HasGScript=RT_FunctionExist("GScript") HasGRunt =RT_FunctionExist("GScriptClip") HasMvTools=RT_FunctionExist("MSuper") HasMaskTools=RT_FunctionExist("MT_Lutxy") HasRemoveGrain=RT_FunctionExist("RemoveGrain") HasCallCmd = RT_FunctionExist("CallCmd") IsAvs26=VersionNumber>=2.6 ### Mode = Default(Mode,0) ThG=Default(ThG,1.0) ThB=Default(ThB,ThG*2.0) ThP=Default(ThP,64) IgP=Default(IgP,0.0) ThK=Default(ThK,7) MaxDupLen=default(MaxDupLen,9) LagMax=default(LagMax,MaxDupLen) MaxInterp = Default(MaxInterp,9) BlkW=Default(BlkW,64) BlkH=Default(BlkH,BlkW) OLapX=Default(OLapX,BlkW/2) OLapY=Default(OLapY,BlkH/2) X=default(X,0) Y=default(Y,0) W=default(W,0) H=default(H,0) CW=Default(CW,0.0) ChromaI=Default(ChromaI,False) AltScan=Default(AltScan,False) SPad = Default(SPad,16) SSharp = Default(SSharp,1) SRFilter= Default(SRFilter,4) ABlkSize = Default(ABlkSize,16) AOverlap= Default(AOverlap,4) ASearch = Default(ASearch,3) ADct = Default(ADct,0) RBlkSize = Default(RBlkSize,8) ROverlap= Default(ROverlap,2) RthSAD = Default(RthSAD,100) Iml = Default(Iml,200.0) IBlend = Default(IBlend,True) IthSCD1 = Default(IthSCD1,400) IthSCD2= Default(IthSCD2,130) OthSCD1 = Default(OthSCD1,400) OthSCD2 = Default(OthSCD2,130) Override=Default(OverRide,"") Frames=Default(Frames,"Frames.txt") Ranges=Default(Ranges,True) FrameAsRange=Default(FrameAsRange,False) Show=Default(Show,True) Verb=Default(Verb,True) Showblk=Default(ShowBlk,true) Dim=Default(Dim,true) ShowDot=Show?Default(ShowDot,False):False InterpFast=Default(InterpFast,True) DBase=Default(DBase,"") #### Assert(0 <= Mode <= 2,RT_String("%s0 <= Mode(%d) <= 2",myName,Mode)) Assert(1 <= MaxDupLen,RT_String("%s1 <= MaxDupLen(%d)",myName,MaxDupLen)) Assert(1 <= LagMax,RT_String("%s1 <= LagMax(%d)",myName,LagMax)) Assert(0 <= MaxInterp <= 9,RT_String("%s0 <= MaxInterp(%d) <= 9",myName,MaxInterp)) Assert(IsAvsPlus || HasGScript,RT_String("%sNeed either GScript or AVS+",myName)) Assert(HasGRunt,RT_String("%sNeed GRunt:-https://forum.doom9.org/showthread.php?t=139337 ",myName)) Assert(HasMVTools,RT_String("%sNeed MvTools2:-http://forum.doom9.org/showthread.php?t=131033",myName)) Assert(HasMaskTools,RT_String("%sNeed MaskTools",myName)) Assert(Mode!=2 || MaxInterp==0 || HasRemoveGrain,RT_String("%sNeed RemoveGrain",myName)) Assert(IsYV12||(IsAvs26&&(IsY8||IsYV16||IsYV24)),RT_String("%sOnly Standard v2.6 Planar Supported (excepting YV411)",myname)) MaxInterp=Min(MaxInterp,MaxDupLen) W = (W > 0) ? (W + X) - Width : W H = (H > 0) ? (H + Y) - Height : H # Make -ve relative width,height X = (X+3) / 4 * 4 Y = (Y+3) / 4 * 4 # Round UP (inwards) Mod 4 W = (W-3) / 4 * 4 H = (H-3) / 4 * 4 # Round DOWN(inwards) Mod 4 W = Width - X + W H = Height - Y + H # +ve width,height DC=Crop(X,Y,W,H) BlkW=Min(DC.Width,BlkW) BlkH=Min(DC.Height,BlkH) (Show && !ShowDot && DIM && Mode==0 && (W!=Width || H!=Height)) ? levels(16,1.0,235,16+48,235-48,Coring=False).Overlay(DC,x=X,y=Y) : Last DB=(DBase=="") ? RT_GetFullPathName("~@@@_"+RT_LocalTimeString+".DB") : RT_GetFullPathName(DBase) FuncS=""" Function EndOfSceneClip(clip c,Int "thSCD1",Int "thSCD2") { # All Luma Samples set 255 at EOS thSCD1=Default(thSCD1,400) thSCD2=Default(thSCD2,130) sup=c.MSuper(pel=1,sharp=0,rfilter=2,hpad=16, vpad=16) bv=sup.MAnalyse(isb=true, delta=1,blksize=16) Return c.MSCDetection(bv,thSCD1=thSCD1,thSCD2=thSCD2) } ### Function ChrIsNul(String S) {return RT_Ord(S)== 0} Function ChrIsHash(String S) {return RT_Ord(S)==35} Function ChrIsStar(String S) {return RT_Ord(S)==42} Function ChrIsComma(String S) {return RT_Ord(S)==44} Function ChrIsHyphen(String S) {return RT_Ord(S)==45} Function ChrIsDigit(String S) {C=RT_Ord(S) return C>=48&&C<=57} Function ChrEatWhite(String S) {i=1 C=RT_Ord(S,i) While(C==32||C>=8&&C<=13) {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S} Function ChrEatDigits(String S) {i=1 C=RT_Ord(S,i) While(C>=48&&C<=57) {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S} ### Function Fn@@@(clip c,clip dc,String DB,Int Mode,Float ThG,Float ThB,Int ThP,Float IgP,Int ThK, \ Int MaxDupLen, Int LagMax,Int MaxInterp, \ Int BlkW,Int BlkH,Int OLapX,Int OLapY,Int X,Int Y,Float CW,Bool ChromaI,Bool Altscan, \ Int OthSCD1,Int OthSCD2,String Frames,Bool Ranges,Bool FrameAsRange, \ Bool Show,Bool Verb,Bool ShowBlk,Bool ShowDot,Bool InterpFast \) { c n=current_frame FC=c.FrameCount Stat=RT_DBaseGetField(DB,n,FLD_STAT@@@) if(Stat == 0) { # In here if unvisited if(RT_FrameDifference(dc,dc,n=n,n2=n-1,ChromaWeight=CW,chromai=ChromaI) > ThG) { # dif to prev # Uniq_KOverride OR Unique Stat=(ThK>0 && RT_YPlaneMinMaxDifference(dc,n=n,Threshold=0.2)<ThK)?FLG_UK@@@:FLG_UU@@@ RT_DBaseSetField(DB,n,FLD_STAT@@@,Stat) Global nDone@@@=nDone@@@+1 if(nDone@@@==FC) { RT_DBaseSetId(DB,1,FC) } } else { # MUST scan backwards to find frame that is Unique to its predecessor(we're not necessarily a dupe of that frame) StartU = -1 for(i=n-1,0,-1) { # Exit with i==-1 (should NEVER HAPPEN, frame 0 is Unique) if(RT_DBaseGetField(DB,i,FLD_STAT@@@)==0) { # Stat Unknown if(RT_FrameDifference(dc,dc,n=i,n2=i-1,ChromaWeight=CW,chromai=ChromaI) > ThG) { StartU=i # Set Unique/Uniq_KOverride Stat RT_DBaseSetField(DB,StartU,FLD_STAT@@@,(ThK>0&&RT_YPlaneMinMaxDifference(dc,n=i,Threshold=0.2)<ThK)?FLG_UK@@@:FLG_UU@@@) Global nDone@@@=nDone@@@+1 if(nDone@@@==FC) { RT_DBaseSetId(DB,1,FC) } i = -1 # Break, Exit with i==-2 } } Else { StartU=i i = -2 } # Break, Exit with i==-3 } # Assert(i!=-1,myName@@@+"Uniq Not Found backwards") EndU = FC for(i=n+1,FC-1) { # Exit with i==FC (should NEVER HAPPEN, last frame is Unique) if(RT_DBaseGetField(DB,i,FLD_STAT@@@)==0) { # Stat Unknown if(RT_FrameDifference(dc,dc,n=i,n2=i-1,ChromaWeight=CW,chromai=ChromaI) > ThG) { EndU=i # Set Unique/Uniq_KOverride Stat RT_DBaseSetField(DB,EndU,FLD_STAT@@@,(ThK>0 && RT_YPlaneMinMaxDifference(dc,n=i,Threshold=0.2)<ThK)?FLG_UK@@@:FLG_UU@@@) Global nDone@@@=nDone@@@+1 if(nDone@@@==FC) { RT_DBaseSetId(DB,1,FC) } i = FC # Break, Exit with i==FC=+1 } } Else { EndU=i i = FC+1 } # Break, Exit with i==FC+2 } # Assert(i > FC,myName@@@+"Uniq Not Found forwards") Anchor=StartU for(i=StartU+1,EndU-1) { Count=1 Stat=0 if(ThK>0 && RT_YPlaneMinMaxDifference(dc,n=i,Threshold=0.2)<ThK) { Anchor=Max(Anchor,i-LagMax) RT_DBaseSetField(DB,i,0,FLG_NUK@@@,StartU,EndU,Anchor,0) # Count Field NOT SET for(j=i+1,EndU-1) { Anchor=j-1 if(RT_YPlaneMinMaxDifference(dc,n=j,Threshold=0.2)<ThK) { Count=Count+1 RT_DBaseSetField(DB,j,0,FLG_NUK@@@,StartU,EndU,Anchor,j-i) # Count Field NOT SET } else { j=EndU } } } Else { Anchor=Max(Anchor,i-LagMax) if((RT_FrameMovement(dc,dc,n=i,n2=Anchor,ChromaWeight=CW,AltScan=AltSCan, \ ChromaI=ChromaI,BlkW=BlkW,BlkH=BlkH,OLapX=OLapX,OLapY=OLApY,BlkTh=ThB)>ThB) || \(RT_LumaPixelsDifferent(dc,dc,n=i,n2=Anchor,Thresh=ThP)>IgP) || \(RT_FrameDifference(dc,dc,n=i,n2=Anchor,ChromaWeight=CW,chromai=ChromaI)> ThG) \) { # Start of LoMotion SubSequence RT_DBaseSetField(DB,i,0,FLG_LM@@@,StartU,EndU,Anchor,0) # Count Field NOT SET for(j=i+1,EndU-1) { Anchor=j-1 if( \ ( \ (RT_FrameMovement(dc,dc,n=j,n2=Anchor,ChromaWeight=CW,AltScan=AltSCan, \ ChromaI=ChromaI,BlkW=BlkW,BlkH=BlkH,OLapX=OLapX,OLapY=OLApY,BlkTh=ThB)>ThB) || \ (RT_LumaPixelsDifferent(dc,dc,n=j,n2=Anchor,Thresh=ThP)>IgP) || \ (RT_FrameDifference(dc,dc,n=j,n2=Anchor,ChromaWeight=CW,chromai=ChromaI)>ThG) \ ) && (ThK<=0 || RT_YPlaneMinMaxDifference(dc,n=j,Threshold=0.2)>=ThK) \ ) { Count=Count+1 RT_DBaseSetField(DB,j,0,FLG_LM@@@,StartU,EndU,Anchor,j-i) # Count Field NOT SET } Else { j=EndU } } } Else { # Start of Dupe SubSequence RemAnchor=Anchor # Remember Anchor at start of dupe run for(j=i+1,EndU-1) { Anchor=Max(Anchor,j-LagMax) if( \ (RT_FrameMovement(dc,dc,n=j,n2=Anchor,ChromaWeight=CW,AltScan=AltSCan, \ ChromaI=ChromaI,BlkW=BlkW,BlkH=BlkH,OLapX=OLapX,OLapY=OLApY,BlkTh=ThB)<=ThB) && \ (RT_LumaPixelsDifferent(dc,dc,n=j,n2=Anchor,Thresh=ThP)<=IgP) && \ (RT_FrameDifference(dc,dc,n=j,n2=Anchor,ChromaWeight=CW,chromai=ChromaI) <= ThG) && \ (ThK<=0 || RT_YPlaneMinMaxDifference(dc,n=j,Threshold=0.2)>=ThK) \ ) { Count=Count+1 } Else { j=EndU } } Anchor=RemAnchor # restore duprun anchor if(Count>MaxDupLen) {Stat=FLG_DS@@@} # MaxDupLen OverRide Else { if(Mode!=1 && i+Count==EndU && OthSCD2 < 255 && OthSCD1 < 8*8*255) { Tmp_c = c.Trim(i-1,-1) + c.Trim(i+Count,-1) Stat=(EndOfSceneClip(Tmp_c,OthSCD1,OthSCD2).RT_AverageLuma(n=0,w=1,h=1).Int != 0)?FLG_DE@@@:FLG_DUP@@@ } Else {Stat=FLG_DUP@@@}
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 17th November 2018 at 15:22. Reason: Update |
![]() |
![]() |
![]() |
#23 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Post #2 of Many.
Code:
if(Stat==FLG_DUP@@@) { if(Frames!="") { if(!Ranges) { for(j=0,Count-1) { RT_WriteFile(Frames,"%d",i+j,Append=True) }} Else if(Count>1) { RT_WriteFile(Frames,"%d,%d",i,i+Count-1,Append=True)} Else if(!FrameAsRange) { RT_WriteFile(Frames,"%d",i,Append=True)} Else if(i==0 && Count==1) { RT_WriteFile(Frames,"%d,-1",i,Append=True)} Else { RT_WriteFile(Frames,"%d,%d",i,i,Append=True)} } if(Show) { Global nDupeSeq@@@=nDupeSeq@@@+1 if(Count > DupeLenMax@@@) {Global DupeLenMax@@@=Count Global DupePosMax@@@=i} Global nDupes@@@=nDupes@@@+Count } } } for(j=i,i+Count-1) { Anchor=Max(Anchor,j-LagMax) RT_DBaseSetField(DB,j,0,Stat,StartU,EndU,Anchor,j-i) # Count Field NOT SET } } RT_DBaseSetField(DB,i,FLD_COUNT@@@,Count) # set SubSequence Start count field } i=i+Count-1 # Last K frame (next time for/next incr to i+1) } # end for i seqLen=(EndU-StartU-1) Global nDone@@@=nDone@@@+seqLen if(nDone@@@==FC) { RT_DBaseSetId(DB,1,FC) } if(Show) { Global nSeq@@@=nSeq@@@+1 if(seqLen>MaxSeqLen@@@) { Global MaxSeqLen@@@=seqLen Global MaxSeqPos@@@=StartU+1 } } Stat=RT_DBaseGetField(DB,n,FLD_STAT@@@) # Get Status of 1st SubSequence } # End, If(pG > ThG) } # End Stat==0 ### if(Show || (Mode>0 && Stat==FLG_DUP@@@)) { Index=RT_DBaseGetField(DB,n,FLD_INDEX@@@) SStart=n-Index # Start of Current SubSequence Count=RT_DBaseGetField(DB,SStart,FLD_COUNT@@@) # Count stored only in first Record of Sub Sequence if(Mode == 1 && Stat==FLG_DUP@@@) { # Mode==1, Exact Dupe c.Trim(SStart-1,-1) ShowDot?RT_Subtitle(DotE@@@):NOP } Else if(Mode==2 && Stat==FLG_DUP@@@) { # Mode==2, Interpolate/Blend if(Count > MaxInterp) { # Blend Morph Weight = (Index + 1).Float / (Count+1) Merge(c.Trim(SStart-1,-1),c.Trim(SStart+Count,-1), Weight) ShowDot?RT_Subtitle(DotB@@@):NOP } else if(InterpFast) { # Interpolate if (Count==1) { I10@@@ } Else if (Count==2) { Index==0?I20@@@:I21@@@ } Else if (Count==3) { Index==0?I30@@@:(Index==1)?I31@@@:I32@@@ } Else if (Count==4) { Index==0?I40@@@:(Index==1)?I41@@@:(Index==2)?I42@@@:I43@@@ } Else if (Count==5) { Index==0?I50@@@:(Index==1)?I51@@@:(Index==2)?I52@@@:(Index==3)?I53@@@:I54@@@ } Else if (Count==6) { Index==0?I60@@@:(Index==1)?I61@@@:(Index==2)?I62@@@:(Index==3)?I63@@@:(Index==4)?I64@@@:I65@@@ } Else if (Count==7) { Index==0?I70@@@:(Index==1)?I71@@@:(Index==2)?I72@@@:(Index==3)?I73@@@:(Index==4)?I74@@@: \(Index==5)?I75@@@:I76@@@ } Else if (Count==8) { Index==0?I80@@@:(Index==1)?I81@@@:(Index==2)?I82@@@:(Index==3)?I83@@@:(Index==4)?I84@@@: \ (Index==5)?I85@@@:(Index==6)?I86@@@:I87@@@ } Else if (Count==9) { Index==0?I90@@@:(Index==1)?I91@@@:(Index==2)?I92@@@:(Index==3)?I93@@@:(Index==4)?I94@@@: \ (Index==5)?I95@@@:(Index==6)?I96@@@:(Index==7)?I97@@@:I98@@@ } ShowDot?RT_Subtitle(DotI@@@):NOP } Else { fillMax=3 LS=Max(SStart-fillMax,0) RS=SStart+Count # Range limit for trim (cannot eg trim prior frame 0) LCnt=SStart-LS RCnt=Min(FC-RS,fillMax) Tmp_c = c.Trim(LS,-LCnt) + c.Trim(RS,-RCnt) # Dupes trimmed out, with ideally two frames before & two after. Prefilt=Tmp_c.RemoveGrain(22) Super=Tmp_c.MSuper(hpad=SPad@@@,vpad=SPad@@@,levels=1,sharp=SSharp@@@,rfilter=SRFilter@@@) Superfilt=Prefilt.MSuper(hpad=SPad@@@,vpad=SPad@@@,sharp=SSharp@@@,rfilter=SRFilter@@@) bv=Superfilt.MAnalyse(isb=true ,blksize=ABlkSize@@@,overlap=AOverLap@@@,search=ASearch@@@,delta=1,dct=ADct@@@) fv=Superfilt.MAnalyse(isb=False ,blksize=ABlkSize@@@,overlap=AOverLap@@@,search=ASearch@@@,delta=1,dct=ADct@@@) if(RBlkSize@@@>0) { bv=Super.MRecalculate(bv,blksize=RBlkSize@@@,overlap=ROverLap@@@,thSAD=RthSAD@@@) fv=Super.MRecalculate(fv,blksize=RBlkSize@@@,overlap=ROverLap@@@,thSAD=RthSAD@@@) } Tmp_I=Tmp_c.MFlowInter(Super,bv,fv,time=100.0*(Index+1)/(Count+1),ml=Iml@@@,blend=IBlend@@@,thSCD1=IthSCD1@@@,thSCD2=IthSCD2@@@) Tmp_I.Trim(LCnt-1,-1) # NO SHIFT, fixed frame @ LCnt-1 ie same as Left PreDupe frame ShowDot?RT_Subtitle(DotI@@@):NOP } # End, Count > MaxInterp } Else If(Mode==0 && Stat==FLG_DUP@@@ && ShowDot) { ShowDot?RT_Subtitle(DotD@@@):NOP } if(Show&&!ShowDot) { pG = RT_FrameDifference(dc,dc,n=n,n2=n-1,ChromaWeight=CW,chromai=ChromaI) # dif to prev pB = RT_FrameMovement(dc,dc,n=n,n2=n-1,ChromaWeight=CW,AltScan=AltSCan,ChromaI=ChromaI, \ BlkW=BlkW,BlkH=BlkH,OLapX=OLapX,OLapY=OLApY,BlkTh=ThB,Prefix="p@@@") pP = RT_LumaPixelsDifferent(dc,dc,n=n,n2=n-1,Thresh=ThP) kG = RT_YPlaneMinMaxDifference(dc,n=n,Threshold=0.2) if(Stat<=FLG_UU@@@&&Stat>=FLG_OO@@@) { # Unique-ish (Anchor not tested) if (ShowBlk && pB>0.0) { if(pB>ThB) { Overlay(HitMrk@@@, x=X+p@@@XOFF,y=Y+p@@@YOFF,Mask=HitMsk@@@, Mode="Blend",output=OutCS@@@) } Else { Overlay(MissMrk@@@,x=X+p@@@XOFF,y=Y+p@@@YOFF,Mask=MissMsk@@@,Mode="Blend",output=OutCS@@@) } } if(Stat==FLG_OO@@@) { RT_Subtitle(FmtOO@@@,n,pG,pB,pP*100.0/255.0,kG) } # 1 User Override FLG_OO@@@ Else if(Stat==FLG_UK@@@) { RT_Subtitle(FmtUK@@@,n,pG,pB,pP*100.0/255.0,kG) } # 2 K Override Else if(Stat==FLG_UU@@@) { RT_Subtitle(FmtUU@@@,n,(pB>ThB)?45:76,(pP>igP)?45:76,pG,pB,pP*100.0/255.0,kG) } # 3 Unique } Else { StartU=RT_DBaseGetField(DB,n,FLD_START@@@) EndU=RT_DBaseGetField(DB,n,FLD_END@@@) Anchor=RT_DBaseGetField(DB,n,FLD_ANCHOR@@@) UIndex=n-StartU # LoMo Index relative StartU (1 relative) UCount=EndU-StartU-1 # Total LoMo sequence count aG=RT_FrameDifference(dc,dc,n=n,n2=Anchor,ChromaWeight=CW,chromai=ChromaI) aB=RT_FrameMovement(dc,dc,n=n,n2=Anchor,ChromaWeight=CW,AltScan=AltSCan,ChromaI=ChromaI, \ BlkW=BlkW,BlkH=BlkH,OLapX=OLapX,OLapY=OLApY,BlkTh=ThB,Prefix="a@@@") aP=RT_LumaPixelsDifferent(dc,dc,n=n,n2=Anchor,Thresh=ThP) if (ShowBlk && aB>0.0) { if(aB>ThB) { Overlay(HitMrk@@@, x=X+a@@@XOFF,y=Y+a@@@YOFF,Mask=HitMsk@@@, Mode="Blend",output=OutCS@@@) } Else { Overlay(MissMrk@@@,x=X+a@@@XOFF,y=Y+a@@@YOFF,Mask=MissMsk@@@,Mode="Blend",output=OutCS@@@) } } if(Stat==FLG_LM@@@) { # LoMo GCol=(aG>ThG)?33:76 BCol=(aB>ThB)?33:76 PCol=(aP>IgP)?33:76 RT_Subtitle(FmtLM@@@,n,GCol,BCol,PCol,UIndex,UCount,Index+1,Count,StartU,EndU, \ pG,pB,pP*100.0/255.0,GCol==33?33:45,aG,BCol==33?33:45,aB,PCol==33?33:45,aP*100.0/255.0,kG,Anchor,n-Anchor) } Else if(Stat==FLG_DUP@@@) { # Dupe ch=Mode==2?(Count>MaxInterp?66:73):68 RT_Subtitle(FmtDUP@@@,n,UIndex,UCount,ch,Index+1,Count,StartU,EndU,pG,pB,pP*100.0/255.0,aG,aB,aP*100.0/255.0,kG,Anchor,n-Anchor) } Else if(Stat==FLG_DE@@@) { # Dupe_EndOfScene_Override FLG_DE@@@ RT_Subtitle(FmtDE@@@,n,UIndex,UCount,Index+1,Count,StartU,EndU,pG,pB,pP*100.0/255.0,aG,aB,aP*100.0/255.0,kG,Anchor,n-Anchor) } Else if(Stat==FLG_NUK@@@) { # Dupe_KOverride FLG_NUK@@@ RT_Subtitle(FmtNUK@@@,n,UIndex,UCount,Index+1,Count,StartU,EndU,pG,pB,pP*100.0/255.0,aG,aB,aP*100.0/255.0,kG,Anchor,n-Anchor) } Else if(Stat==FLG_DS@@@) { # Dupe_MaxDupLen_Override FLG_DS@@@ RT_Subtitle(FmtDS@@@,n,UIndex,UCount,Index+1,Count,StartU,EndU,pG,pB,pP*100.0/255.0,aG,aB,aP*100.0/255.0,kG,Anchor,n-Anchor) } Else { Assert(False,RT_String("%s[%d] Error Unknwn Stat(%d)",myName@@@,n,Stat)) } } if(Verb) { EstFps=(nDone@@@-nDupes@@@)*FrameRate/nDone@@@ RT_SubTitle(vFmt@@@, \ Mode,ThG,ThB,ThP,IgP*100.0/255.0,ThK,MaxDupLen,MaxInterp,LagMax,nSeq@@@,MaxSeqLen@@@,MaxSeqPos@@@, \ nDupes@@@,DupeLenMax@@@,DupePosMax@@@,nDupeSeq@@@,nDone@@@*100.0/FC,EstFPS,Align=1) } } } # End, if(Show || (Mode>0 && Stat==FLG_DUP@@@)) Return Last }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 17th November 2018 at 15:24. Reason: Update |
![]() |
![]() |
![]() |
#24 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Post #3 of many.
Code:
if(Frames!="") { Frames=RT_GetFullPathName(Frames) RT_FileDelete(Frames) RT_WriteFile(Frames,"###\n# Duplicate frames file. [ Generated by Duplicity2() ]\n###\n\n") } RT_DBaseAlloc(DB,FrameCount,"iiiiii") ### DBase Fields:- Global FLD_STAT@@@ = 0 # Holds Status FLGS Global FLD_START@@@ = 1 # Unique Start Frame Global FLD_END@@@ = 2 # Unique End Frame Global FLD_ANCHOR@@@ = 3 # Anchor Frame Global FLD_INDEX@@@ = 4 # Index into Count (0 Relative, 0->Count-1) Global FLD_COUNT@@@ = 5 # Sequence Frame Count ### Status Flags in Field FLD_STAT@@@ Global FLG_OO@@@ = 1 # User Override Global FLG_UK@@@ = 2 # K Override Global FLG_UU@@@ = 3 # Unique Frame Global FLG_NUK@@@ = 4 # Non Unique Sequence K Override Global FLG_LM@@@ = 5 # LoMotion Frame Global FLG_DS@@@ = 6 # Static Sequence [detected as duplicates but Longer than MaxDupLen] Global FLG_DE@@@ = 7 # Duplicate Sequence is followed by Scene Change (will NOT occar when Mode==1) Global FLG_DUP@@@ = 8 # Duplicate Sequence ### RT_DBaseSetField(DB,0,FLD_STAT@@@,FLG_OO@@@) RT_DBaseSetField(DB,FrameCount-1,FLD_STAT@@@,FLG_OO@@@) # Set first and Last Frames to Override Frame RT_DBaseSetId(DB,0,VER) Global nDone@@@=2 # Start and End frames already done Global nDupes@@@=0 Global nDupeSeq@@@=0 Global DupeLenMax@@@=0 Global DupePosMax@@@=0 Global nSeq@@@=0 Global MaxSeqLen@@@=0 Global MaxSeqPos@@@=0 if(OverRide!="") { if(ChrIsStar(Override)) { OverRide=MidStr(OverRide,2) } else { Assert(Exist(OverRide),RT_String("%sOverRide File does not exist",myName)) OverRide=RT_ReadTxtFromFile(Override) } LINES=RT_TxtQueryLines(OverRide) for(i=0,LINES-1) { SS=ChrEatWhite(RT_TxtGetLine(Override,i)) S=SS if(!ChrIsNul(S) && !ChrIsHash(S)) { if(ChrIsDigit(S)) { StartF = S.RT_NumberValue EndF=StartF S=S.ChrEatDigits.ChrEatWhite if(ChrIsComma(S)){S=S.MidStr(2).ChrEatWhite} IsNeg = ChrIsHyphen(S) if(IsNeg){S=S.MidStr(2).ChrEatWhite} if(ChrIsDigit(S)) { EndF=S.RT_NumberValue S=S.ChrEatDigits if(EndF==0) {EndF=FrameCount-1 } Else if(IsNeg) {EndF=StartF+(EndF)-1} Assert(StartF<=EndF,RT_String("%sOverRide: Error@Line_%d, StartFrame(%d) > EndFrame(%d)\n%s",myName,i+1,StartF,EndF,SS)) } Else if(IsNeg) {Assert(False,RT_String("%sOverRide: Error@Line_%d, Expecting End Frame\n%s",myName,i+1,SS))} Assert(EndF<FrameCount,RT_String("%sOverRide: Error@Line_%d, EndFrame(%d) Out Of Clip\n%s",myName,i+1,EndF,SS)) RT_DebugF("OverRiding Range %d,%d",StartF,EndF,name=myName) for(n=StartF,EndF) { if(n!=0 && n!= FrameCount-1) { RT_DBaseSetField(DB,n,FLD_STAT@@@,FLG_OO@@@) Global nDone@@@=nDone@@@+1 } } } S=ChrEatWhite(S) if(ChrIsHash(S)) {S=""} Assert(ChrIsNul(S),RT_String("%sOverride: Error@Line_%d, *** NON-PARSE ***\n'%s'",myName,i+1,SS)) } } } #### Global myName@@@ = myName if(Mode==2 && MaxInterp>0) { if(InterpFast) { Prefilt = c.RemoveGrain(22) Super = c.MSuper(hpad=SPad,vpad=SPad,levels=1,sharp=SSharp,rfilter=SRFilter) # One level is enough for MRecalculate Superfilt= Prefilt.MSuper(hpad=SPad,vpad=SPad,sharp=SSharp,rfilter=SRFilter) # All levels for MAnalyse For(i=1, MaxInterp) { Eval(RT_String("bv=Superfilt.MAnalyse(isb=true ,blksize=ABlkSize,overlap=AOverLap,search=ASearch,delta=%d,dct=ADct)",i+1)) Eval(RT_String("fv=Superfilt.MAnalyse(isb=false,blksize=ABlkSize,overlap=AOverLap,search=ASearch,delta=%d,dct=ADct)",i+1)) if(RBlkSize>0) { Eval(RT_String("bv=Super.MRecalculate(bv,blksize=RBlkSize,overlap=ROverLap,thSAD=RthSAD)")) Eval(RT_String("fv=Super.MRecalculate(fv,blksize=RBlkSize,overlap=ROverLap,thSAD=RthSAD)")) } for(j=1,i) { Eval(RT_String("Global I%d%d@@@=c.MFlowInter(Super,bv,fv,time=100.0*%d/%d," + \ "ml=Iml,blend=IBlend,thSCD1=IthSCD1,thSCD2=IthSCD2).SelectEvery(1,%d).Trim(0,-c.FrameCount)", i,j-1, j,i+1,-j)) } } } Else { Global SPad@@@=SPad Global SSharp@@@=SSharp Global SRFilter@@@=SRFilter Global ABlkSize@@@=ABlkSize Global AOverLap@@@=AOverLap Global ASearch@@@=ASearch Global ADct@@@=ADct Global RBlkSize@@@=RBlkSize Global ROverLap@@@=ROverLap Global RthSAD@@@=RthSAD Global Iml@@@=Iml Global IBlend@@@=IBlend Global IthSCD1@@@=IthSCD1 Global IthSCD2@@@=IthSCD2 } } ### Global HitMsk@@@ = D2_Hit_Marker(BlkW,BlkH,true) Global HitMrk@@@ = HitMsk@@@.BlankClip(Color=$FFCC00,pixel_type="YV12") Global MissMsk@@@ = D2_Hit_Marker(BlkW,BlkH,false) Global MissMrk@@@ = MissMsk@@@.BlankClip(Color=$00FF00,pixel_type="YV12") Global OutCS@@@=IsYV12?"YV12":IsY8?"Y8":IsYV16?"YV16":"YV24" #### Global FmtOO@@@="%d] \a!O\aLKSE\a-:\aLGBP:ULD\a- \npG=%9.6f : pB=%9.6f : pP%%=%9.6f\n{K=%d}" Global FmtUK@@@="%d] \aLO\a!K\aLS\a-:\aLGBP\a-:\aLULD\a-\n\a!pG=%9.6f\a- : pB=%9.6f : pP%%=%9.6f\n{K=%d}" Global FmtUU@@@="%d] \aLOKSE\a-:\a!G\a%cB\a%cP\a-:U\aLLD\a- \n\a!pG=%9.6f\a- : pB=%9.6f : pP%%=%9.6f\n{K=%d}" Global FmtLM@@@="%d] \aLOKSE\a-:\a%cG\a%cB\a%cP\a-:\aLU\a-L\aLD\a- {%d/%d:L%d/%d:uS=%d:uE=%d}\npG=%9.6f : pB=%9.6f : pP%%=%9.6f\n" \ + "\a%caG=%9.6f : \a%caB=%9.6f\a- : \a%caP%%=%9.6f\a-\n{K=%d : a=%d : Lag=%d}" Global FmtDUP@@@="%d] \aLOKSE\a-:\aLGBP\a-:\aLUL\a-D\aL\a- {%d/%d:%c%d/%d:uS=%d:uE=%d}\npG=%9.6f :" + \ " pB=%9.6f : pP%%=%9.6f\naG=%9.6f : aB=%9.6f : aP%%=%9.6f\n{K=%d : a=%d : Lag=%d}" Global FmtDE@@@="%d] \aLOKS\a!E\a-:\aLGBP\a-:\aLULD\a- {%d/%d:E%d/%d:uS=%d:uE=%d}\npG=%9.6f : pB=%9.6f : pP%%=%9.6f\naG=%9.6f :" + \ " aB=%9.6f : aP%%=%9.6f\n{K=%d : a=%d : Lag=%d}" Global FmtNUK@@@="%d] \aLO\a!K\aLSE\a-:\aLGBP\a-:\aLULD\a- {%d/%d:K%d/%d:uS=%d:uE=%d}\npG=%9.6f : pB=%9.6f : pP%%=%9.6f\naG=%9.6f :" + \ " aB=%9.6f : aP%%=%9.6f\n{\a!K=%d\a- : a=%d : Lag=%d}" Global FmtDS@@@="%d] \aLOK\a!S\aLE\a-:GBP\a-:\aLULD\a- {%d/%d:S%d/%d:uS=%d:uE=%d}\npG=%9.6f : pB=%9.6f : pP%%=%9.6f\naG=%9.6f :" + \ " aB=%9.6f : aP%%=%9.6f\n{K=%d : a=%d : Lag=%d}" Global VFmt@@@="Md=%d:ThG=%.3f:ThB=%.3f:ThP=%d:IgP%%=%.3f\nThK=%d:MaxDupLen=%d:MaxInterp=%d:LagMax=%d\nNuSeq: Cnt=%d:LenMax=%d@%d\nDupe:" + \ " Cnt=%d:MaxLen=%d@%d:nSeq=%d\nComplete%%=%.3f:EstFPS=%.3f" Global DotD@@@="\a2*\a!D\a9*\n\a- D\n\a4*\a9D\a!*" Global DotE@@@="\a2*\a!E\a9*\n\a- E\n\a4*\a9E\a!*" Global DotI@@@="\a2*\a!I\a9*\n\a- I\n\a4*\a9I\a!*" Global DotB@@@="\a2*\a!B\a9*\n\a- B\n\a4*\a9B\a!*" ### IgP=IgP*255.0/100.0 # To range 0.0 -> 255.0 ARGS = "dc,DB,Mode,ThG,ThB,ThP,IgP,ThK,MaxDupLen,LagMax,MaxInterp,BlkW,BlkH,OLapX,OLapY,X,Y,CW,ChromaI,Altscan," + \ "OthSCD1,OthSCD2,Frames,Ranges,FrameAsRange,Show,Verb,ShowBlk,ShowDot,InterpFast" ScriptLine = "Fn@@@("+ARGS+")" Last.GScriptClip(ScriptLine, local=true, args=ARGS) """ GIFunc="DUPLICITY2" # Function Name, Supply unique name for your multi-instance function. GIName=GIFunc+"_InstanceNumber" # Name of the Instance number Global RT_IncrGlobal(GIName) # Increment Instance Global (init to 1 if not already exists) GID = GIFunc + "_" + String(Eval(GIName)) InstS = RT_StrReplace(FuncS,"@@@","_"+GID) # Write current instance Debug GScript File to current directory (line numbers will correspond to error messages) # RT_WriteFile("DEBUG_"+GID+".TXT","%s",InstS) HasGScript ? GScript(InstS) : Eval(InstS,"GS_EVAL") # Use GSCript if installed (loaded plugs override builtin) # if UnNamed DBase && CallCmd available, Auto delete DBase file on clip closure. (DBase=="" && HasCallCmd) ? CallCmd(close=RT_String("""CMD /C chcp 1252 && del "%s" """,DB), hide=true, Synchronous=7) : NOP Return Last }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 17th November 2018 at 14:51. Reason: Update |
![]() |
![]() |
![]() |
#25 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Post #4 of Many.
Client Code:
Import(".\Duplicity2.Avsi") ###### FN = "D:\G.AVI" DBase = "D:\G_Det.DB" ThB=2.0 #FN = "D:\GTEST.AVI" DBase = "D:\GTEST_Det.DB" ThB=2.0 #FN = "D:\HAR.AVI" DBase = "D:\HAR_Det.DB" ThB=2.5 #FN = "D:\DeDupTest.AVI" DBase = "D:\DeDupTest_Det.DB" ThB=2.0 ###### Avisource(FN) SRC=Last ### Mode=2 # 0=Write Frames only : 1=Replace Dupes with Exact Dupes : 2= Interpolate/Blend Duplicates. ThG=1.0 # Primary Frame Global Detect ThP=64 # Pixel Count Detect MaxDupLen=9 # Max detected, if more then is considered static sequence not duplicate) MaxInterp=9 # Max Interpolated frames when Mode=2 (More than MaxInterp & less or equal to MaxDupLen then uses Blend mode) InterpFast=true Show=True ShowDot=False ShowBlk=true VERB=False ### TITLE=False STACK=True STACK4=False ### Result=SRC.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP,MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ Show=False,InterpFast=InterpFast,DBase=(STACK4||!SHOW)?DBase:"") Metrics=SRC.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP,MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ Show=True,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,InterpFast=InterpFast,DBase=(STACK4||!SHOW)?"":DBase) Dif=Subtract(Result,SRC) SRC = (TITLE) ? SRC.TSub("Src") : SRC Result = (TITLE) ? Result.TSub("Result") : Result Metrics = (TITLE) ? Metrics.TSub("Metrics") : Metrics Dif = (TITLE) ? Dif.TSub("Dif(Result,Src)") : Dif LFT=StackVertical((STACK4||!SHOW)?Result:Metrics,SRC) RGT=StackVertical(Metrics,Dif) STK4=StackHorizontal(LFT,RGT) (STACK4) ? STK4 : (STACK) ? LFT : (Show)?Metrics:Result Return Last # Stack Overhead Subtitle Text, with optional FrameNumber shown. Function TSub(clip c,string Tit,Bool "ShowFrameNo",Int "Col"){ c.BlankClip(height=20,Color=Default(Col,0)) (Default(ShowFrameNo,False))?ScriptClip("""Subtitle(String(current_frame,"%.f] """+Tit+""""))"""):Subtitle(Tit) Return StackVertical(c).AudioDubEx(c) }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 17th November 2018 at 15:25. Reason: Update |
![]() |
![]() |
![]() |
#26 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Post #5 of 6.
Post removed. NOW SPARE
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 4th November 2018 at 14:41. |
![]() |
![]() |
![]() |
#27 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Post #6 of 6.
Post removed. NOW SPARE
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 4th November 2018 at 14:42. |
![]() |
![]() |
![]() |
#28 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Update, Thread Renamed, to Duplicity2, see first post.
Posts #22 to 27 updated to current script.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 27th September 2018 at 21:44. |
![]() |
![]() |
![]() |
#29 | Link | ||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
Anybody wanna test this out, my eyes dont see any difference (crap eyes).
Duplicity2_v2.02_Beta LINK REMOVED Have implemented FillDrops modes. Code:
Function Duplicity2(clip c,"Mode"=0,Float "ThG"=1.0,Float "ThB"=ThG, Int "ThP"=64,Float "IgP"=0.0,Int "ThK"=7, \ Int "MaxDupLen"=9,Int "LagMax"=MaxDupLen,Int "MaxInterp"=Min(9,MaxDupLen), \ int "BlkW"=64,int "BlkH"=BlkW,int "OLapX"=BlkW/2,Int "OLapY=BlkH/2", \ Int "X"=0,Int "Y"=0,Int"W"=0,Int "H"=0,Float "CW"=0.0,Bool "ChromaI"=False,Bool "AltScan"=False, \ Int "SPad"=16, Int "SSharp"=1, Int "SRFilter"=4, [* MSuper *] \ Int "ABlkSize"=16, Int "AOverlap"=4, Int "ASearch"=3,Int "ADct"=0, [* MAnalyse *] \ Int "RBlkSize"=8, Int "ROverlap"=2, Int "RthSAD"=100, [* MRecalculate *] \ Float "Iml"=200.0, Bool "IBlend"=True, Int "IthSCD1"=400, Int "IthSCD2"=130, [* MFlowInter *] \ Int "OthSCD1"=400,Int "OthSCD2"=130, [* Dupe Detect Override @ Scene Change *] \ String "OverRide"="",String "Frames"="Frames.txt",Bool "Ranges"=True,Bool "FrameAsRange"=False, \ Bool "Show"=True,Bool "Verb"=True,Bool "ShowBlk"=True,Bool "Dim"=True,Bool "ShowDot"=False, \ Int "FillDrops"=0 \ ) ... FillDrops, Default 0 (OFF). [Valid only for Mode=2, Interpolate] 0) Standard precalculated Interpolation clips mode. (Fastest) 1) Standard Interpolated clip mode, except for N_Dupes==1, where Precalculated FillDrops clip method. 2) FillDrops Interpolated mode, except for N_Dupes==1, where Precalculated FillDrops clip. 3) Pure FillDrops mode where all Interpolation clips created during frameserving. (Slowest). https://forum.doom9.org/showthread.p...78#post1409378 Quote:
Quote:
For the stuff about extra data from additional frames where occlusions occur, because in the filldrop original method the n-1 frame is the frame that n is a duplicate of, and so part of the extra data (where occlusions) comes from n-1 (dupe) and so is no better than using n, the only extra info comes from n+2. For our Filldrops mode=3, all dupes are trimmed out (no matter what length, 0-9) and interpolation using frames either side of dupe sequence, so we expect even better than original FillDrops method. We can only pre-create Interpolated FillDrops clips (created before framesering starts) where number of consecutive dupes==1. N_dupes==1 pre-calc clip used for FillDrops modes 1 and 2 (exactly same as in FillDrops script), but for FillDrops mode==3, then duplicates are trimmed out (for identical to FillDrops mode with delta=1, the frame of which the single dupe is a copy, is not trimmed out and so takes some small part in result, whereas for FillDrops mode=3, all dupes trimmed out and so play NO PART in result). Code:
# FillDrops Mode==2 and longer than single dupe (For single dupe, fix with precalc clip I10@@@ above) # OR, FillDrops==3 and all length dupes interpolated Slow FillDrops method # NOTE, FillDrops mode uses DELTA=1, and NO SHIFT, fillMax=3 LS=Max(SStart-fillMax,0) RS=SStart+Count # Range limit for trim (cannot eg trim prior frame 0) LCnt=SStart-LS RCnt=Min(c.FrameCount-RS,fillMax) Tmp_c = c.Trim(LS,-LCnt) + c.Trim(RS,-RCnt) # Dupes trimmed out, with ideally two frames before & two after. Prefilt=Tmp_c.RemoveGrain(22) Super=Tmp_c.MSuper(hpad=SPad@@@,vpad=SPad@@@,levels=1,sharp=SSharp@@@,rfilter=SRFilter@@@) Superfilt=Prefilt.MSuper(hpad=SPad@@@,vpad=SPad@@@,sharp=SSharp@@@,rfilter=SRFilter@@@) bv=Superfilt.MAnalyse(isb=true ,blksize=ABlkSize@@@,overlap=AOverLap@@@,search=ASearch@@@,delta=1,dct=ADct@@@) fv=Superfilt.MAnalyse(isb=False ,blksize=ABlkSize@@@,overlap=AOverLap@@@,search=ASearch@@@,delta=1,dct=ADct@@@) if(RBlkSize@@@>0) { bv=Super.MRecalculate(bv,blksize=RBlkSize@@@,overlap=ROverLap@@@,thSAD=RthSAD@@@) fv=Super.MRecalculate(fv,blksize=RBlkSize@@@,overlap=ROverLap@@@,thSAD=RthSAD@@@) } Tmp_I=Tmp_c.MFlowInter(Super,bv,fv,time=100.0*(Index+1)/(Count+1),ml=Iml@@@,blend=IBlend@@@,thSCD1=IthSCD1@@@,thSCD2=IthSCD2@@@) Tmp_I.Trim(LCnt-1,-1) # NO SHIFT, fixed frame @ LCnt-1 ie same as Left PreDupe frame @John Meyer, The N_Dupes==1, for both FillDrops modes=1 and 2, then should be (I think) identical result to your filldrops method. For N_Dupes > 1 and FillDrops mode=2, or any N_dupes>0 and FillDrops mode==3, then all dupes trimmed out and play no part in interpolation, so perhaps even better than original FillDrops where result affected by single dupe. Also John, any chance you could post all yiou know about the FillDrops weirdness, I have a clip where there seems to be 2 dropped frames(big jump) and then some time later (some times immediately after) there are two dupes, ALSO, sometimes single frame dropped, and single dupe some time later. Is there a maximum distance between drops, max number of dropped, max number of dupes etc, any info/rules that you may have observed, thanx. EDIT: Included in zip, shows difference (where Mode=2) between two Filldrops modes. Code:
#Import("Duplicity2.Avs") FN="d:\HAR.AVI" AviSource(FN) ######### Mode=2 # 0=Write Frames only : 1=Replace Dupes with Exact Dupes : 2= Interpolate/Blend Duplicates. MaxDupLen=9 # Max detected, if more then is considered static sequence not duplicate) MaxInterp=9 # Max Interpolated frames when Mode=2 (More than MaxInterp & less or equal to MaxDupLen then uses Blend mode) ThG=1.0 # Primary Frame Global Detect ThB=1.5 # Block Detect ThP=64 # Pixel Count Detect Show=True ShowDot=false ShowBlk=True VERB=True FillDropsA=1 # For A clip only FillDropsB=3 # For B clip only (return default if STACK4=False) ### STACK4=True ORG=Last A=ORG.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP, \ MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ CW=0.0,ChromaI=False,AltScan=False, \ Ranges=True,FrameAsRange=False, \ Show=Show,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,FillDrops=FillDropsA \ ) B=ORG.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP, \ MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ CW=0.0,ChromaI=False,AltScan=False, \ Ranges=True,FrameAsRange=False, \ Show=Show,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,FillDrops=FillDropsB \ ) D1=Subtract(A,B).Levels(125,1,127,0,255,coring=false) LFT=StackVertical(A,B) RGT=StackVertical(ORG,D1) Return STACK4?StackHorizontal(LFT,RGT):B
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 30th December 2018 at 13:20. |
||
![]() |
![]() |
![]() |
#30 | Link |
Registered User
Join Date: Apr 2016
Posts: 10
|
I am testing a clip full of exact duplicates (metric=0.00000), so detection is not a problem, but I still get some frames that are not interpolated (generally when there are 2 or more consecutives dups) even with MaxDupLen and MaxInterp = 9
Is it normal ? |
![]() |
![]() |
![]() |
#31 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
No idea, what do the metrics show at the dupes.
What is the length of the skipped seqs, ? (greater than MaxDupLen ?) Are they flagged as Low motion ? Post image of non detect dupe on PostImage.org, with show=true, Verb=True. Are you using most recent script ?
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 31st October 2018 at 01:32. |
![]() |
![]() |
![]() |
#32 | Link |
Registered User
Join Date: Apr 2016
Posts: 10
|
I think I get it, the frames are flagged as E=End+1
like it says in the script E=End+1 of current dupe sequence is change of scene, so if Mode=2 then Interpolation or Blending is skipped for that dupe sequence It's a big jump detected as a scene change. But now even when trying to switch OFF scene change detection with OthSCD1 and OthSCD2 the are stilled flagged as E What should we exactly do to avoid scene change detection ? OthSCD2=256 or OthSCD1=8*8*255 and no change at all. |
![]() |
![]() |
![]() |
#33 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
OK, I think I see what problem is, perhaps I should have labored it in docs a little more.
OthSCD2 >=255 will switch off End + 1 scene change detect (which would avoid any attempt to interpolate or count sequence as duplicates, might want to avoid any processing at all where possibility of of creating blends across scene change [also omit from any Frames file]). In addition to End + 1 scene change detect, the Interplator (MFlowInter) also has scene change detection args, which may need switching off also. Take special note of ALL below args Code:
Bool "IBlend"=True, Int "IthSCD1"=400, Int "IthSCD2"=130, [* MFlowInter *] Int "OthSCD1"=400,Int "OthSCD2"=130, [* Dupe Detect Override @ Scene Change *] Quote:
EDIT: Ignore most of above, me a bit confused. Post a sequence (PM if like), with about 5 frames prior to first in any enclosing low motion sequence, + 5 frames after end frame, also say which script you are using (v2.01 or v2.02) and provide client script. If you provide OthSCD2>=255 then it should not set E flag ie Code:
if(Count>MaxDupLen) {Stat=FLG_DS@@@} # MaxDupLen OverRide ### STATIC SCENE Else { if(Mode!=1 && i+Count==EndU && OthSCD2 < 255 && OthSCD1 < 8*8*255) { Tmp_c = c.Trim(i-1,-1) + c.Trim(i+Count,-1) ### IN HERE ONLY IF OthSCD2 < 255 ### BELOW ONLY PLACE WHERE stat set to FLG_DE@@@ Stat=(EndOfSceneClip(Tmp_c,OthSCD1,OthSCD2).RT_AverageLuma(n=0,w=1,h=1).Int != 0)?FLG_DE@@@:FLG_DUP@@@ } Else {Stat=FLG_DUP@@@} # ... }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 31st October 2018 at 03:37. |
|
![]() |
![]() |
![]() |
#34 | Link |
Registered User
Join Date: Apr 2016
Posts: 10
|
Ok, problem is solved. I was using V2.01 and still having the E flag no matter if OthSCD2 or IthSCD2 >=255
in V2.02 after changing mode!=1 to mode!=2 in the part of the script you provide it seems Ok now Code:
if(Count>MaxDupLen) {Stat=FLG_DS@@@} # MaxDupLen OverRide ### STATIC SCENE Else { if(Mode!=2 && i+Count==EndU && OthSCD2 < 255 && OthSCD1 < 8*8*255) { Tmp_c = c.Trim(i-1,-1) + c.Trim(i+Count,-1) ### IN HERE ONLY IF OthSCD2 < 255 ### BELOW ONLY PLACE WHERE stat set to FLG_DE@@@ Stat=(EndOfSceneClip(Tmp_c,OthSCD1,OthSCD2).RT_AverageLuma(n=0,w=1,h=1).Int != 0)?FLG_DE@@@:FLG_DUP@@@ } Else {Stat=FLG_DUP@@@} # ... } ![]() |
![]() |
![]() |
![]() |
#35 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
That will not be best fix, should defo not enter that code block if OthSCD2 >= 255,
That fix just kludge fix and will move problem to mode==1 (will not skip END+1 switch off if mode==1 [Replace With Exact Dupes mode]). Try replace with this, what does debugview show Code:
if(Count>MaxDupLen) {Stat=FLG_DS@@@} # MaxDupLen OverRide ### STATIC SCENE Else { if(Mode!=1 && i+Count==EndU && OthSCD2 < 255 && OthSCD1 < 8*8*255) { RT_DebugF("%d] OthSCD1=%d OthSCD2=%d",i,OthSCD1,OthSCD2) Tmp_c = c.Trim(i-1,-1) + c.Trim(i+Count,-1) ### IN HERE ONLY IF OthSCD2 < 255 ### BELOW ONLY PLACE WHERE stat set to FLG_DE@@@ Stat=(EndOfSceneClip(Tmp_c,OthSCD1,OthSCD2).RT_AverageLuma(n=0,w=1,h=1).Int != 0)?FLG_DE@@@:FLG_DUP@@@ RT_DebugF("%d] Stat=%d",i,Stat) } Else {Stat=FLG_DUP@@@} # ... }
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 31st October 2018 at 11:18. |
![]() |
![]() |
![]() |
#37 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
DebugView, by SysInternals (now owned by M$):- https://docs.microsoft.com/en-us/sys...oads/debugview
NOTE, some other software may also output to debugview. There is a massive number of free utilities from same site, and can download the whole lot as a single zip. (SysInternals Suite, a few lines below in the LHS pane) EDIT: I also like (amongst others from that site) AutoLogon, does what it says on the tin.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 1st November 2018 at 16:29. |
![]() |
![]() |
![]() |
#38 | Link | |
Registered User
Join Date: Apr 2016
Posts: 10
|
Well here is what Debugview shows
Quote:
After manually changing the default setting of OthSCD2 in the script there is no E flag and DebugView says logically nothing so here is the client part of the script Code:
Import("Duplicity2_v2.02_Beta.Avs") FN="server.vdr" AviSource(FN).ConvertToYV24(matrix="Rec601") ######### Mode=2 # 0=Write Frames only : 1=Replace Dupes with Exact Dupes : 2= Interpolate/Blend Duplicates. MaxDupLen=9 # Max detected, if more then is considered static sequence not duplicate) MaxInterp=9 # Max Interpolated frames when Mode=2 (More than MaxInterp & less or equal to MaxDupLen then uses Blend mode) ThG=1.0 # Primary Frame Global Detect ThB=1.5 # Block Detect ThP=64 # Pixel Count Detect OthSCD2=255 Show=true ShowDot=false ShowBlk=false VERB=false FillDropsA=1 # For A clip only FillDropsB=3 # For B clip only (return default if STACK4=False) ### STACK4=false ORG=Last A=ORG.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP, \ MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ CW=0.0,ChromaI=False,AltScan=False, \ Ranges=True,FrameAsRange=False, \ Show=Show,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,FillDrops=FillDropsA \ ) B=ORG.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP, \ MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ CW=0.0,ChromaI=False,AltScan=False, \ Ranges=True,FrameAsRange=False, \ Show=Show,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,FillDrops=FillDropsB \ ) D1=Subtract(A,B).Levels(125,1,127,0,255,coring=false) LFT=StackVertical(A,B) RGT=StackVertical(ORG,D1) Return STACK4?StackHorizontal(LFT,RGT):B |
|
![]() |
![]() |
![]() |
#39 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,654
|
OOoops, how embarrassing, I did not spot the fact that we did not call the functions wth OthSCD2, ie
Code:
Import("Duplicity2_v2.02_Beta.Avs") FN="server.vdr" AviSource(FN).ConvertToYV24(matrix="Rec601") ######### Mode=2 # 0=Write Frames only : 1=Replace Dupes with Exact Dupes : 2= Interpolate/Blend Duplicates. MaxDupLen=9 # Max detected, if more then is considered static sequence not duplicate) MaxInterp=9 # Max Interpolated frames when Mode=2 (More than MaxInterp & less or equal to MaxDupLen then uses Blend mode) ThG=1.0 # Primary Frame Global Detect ThB=1.5 # Block Detect ThP=64 # Pixel Count Detect OthSCD2=255 IthSCD2=255 Show=true ShowDot=false ShowBlk=false VERB=false FillDropsA=1 # For A clip only FillDropsB=3 # For B clip only (return default if STACK4=False) ### STACK4=false ORG=Last A=ORG.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP, \ MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ CW=0.0,ChromaI=False,AltScan=False, \ Ranges=True,FrameAsRange=False, \ Show=Show,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,FillDrops=FillDropsA,OthSCD2=OthSCD2,IthSCD2=IthSCD2 \ ) B=ORG.Duplicity2(Mode=Mode,ThG=ThG,ThB=ThB,ThP=ThP, \ MaxDupLen=MaxDupLen,MaxInterp=MaxInterp, \ CW=0.0,ChromaI=False,AltScan=False, \ Ranges=True,FrameAsRange=False, \ Show=Show,Verb=VERB,ShowBlk=ShowBlk,ShowDot=ShowDot,FillDrops=FillDropsB,OthSCD2=OthSCD2,IthSCD2=IthSCD2 \ ) D1=Subtract(A,B).Levels(125,1,127,0,255,coring=false) LFT=StackVertical(A,B) RGT=StackVertical(ORG,D1) Return STACK4?StackHorizontal(LFT,RGT):B ![]()
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 2nd November 2018 at 05:20. |
![]() |
![]() |
![]() |
#40 | Link |
Registered User
Join Date: Apr 2016
Posts: 10
|
Everything works like a charm now
![]() Also, does it change something if we save the main script as an AVSI file in the plugin directory and then make a final script in a classic way ? Code:
AviSource("videofile.avi") Duplicity2(mode=2, show=false, ShowBlk=false, OthSCD2=255, IthSCD2=255, FillDrops=3, IBlend=false) |
![]() |
![]() |
![]() |
Tags |
dedup, deduplicate, duplicates |
Thread Tools | Search this Thread |
Display Modes | |
|
|