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 14th April 2021, 17:16   #1  |  Link
NLPguy
Registered User
 
Join Date: Feb 2015
Posts: 20
AviSynth+ 64bits Problem??

Hi folks,


I was using AviSynth 2.6mt and I decided to switch it to AviSynth + 64bits.

Knowing that DirectShowSource would not work I switched to LSmashVideoSource in the Script below.


Code:
#Import("M:\temp2\source script2 Dr Paulo Pirej.avs")
# Plugins: - RemoveGrain
# - MaskTools2
# - Depan + DepanEstimate
# - MVTools2

SetMemoryMax(512)
SetMTMode(3)

LoadPlugin("M:\Temp2\RemoveGrain.dll")
LoadPlugin("M:\Temp2\MaskTools2-25.dll")
LoadPlugin("M:\Temp2\Depan.dll")
LoadPlugin("M:\Temp2\DepanEstimate.dll")
LoadPlugin("M:\Temp2\MVTools2.dll")
LoadPlugin("M:\Temp2\LSMASHSource.dll")
#LoadPlugin("M:\Temp2\RgTools.dll")

#mpeg2source("M:\Marcelo 27.5.20\1\01\01-1.d2v")
#mpeg2source("M:\Marcelo 999255703 - Fazer\01 ok 19m.d2v")
#DirectShowSource("M:\Flavio Itapema 4.11.20 Fazer\02 FI 4capt PanLG.mp4", fps = 25, ConvertFPS = True )
a = LSmashAudioSource("M:\Flavio Itapema 4.11.20 Fazer\02 FI 4capt PanLG.mp4")
v = LSmashVideoSource("M:\Flavio Itapema 4.11.20 Fazer\02 FI 4capt PanLG.mp4")
AudioDub(v,a)
#DirectShowSource("M:\Luis Tonini 14.1.20 - Fazer\01 V14ES10 e.mp4")
#DirectShowSource("E:\Tereza Soares 13.8.20 - Fazer\01 TS 8capt V17JVCES10.mp4", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia ou MP4 da Aple
#DirectShowSource("M:\Neogrid 5-10-17\090 4capt V13SVSDV.avi", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia
#AVISource("E:\Cleiton\Super 8mm\03\03 ok.avi") 
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi", audio=true)
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi") # DV AVI
#AVISource("M:\Pedro 31-7-18\25 8capt V15ES10SDV.avi", audio=true)


SetMTMode(2)
#ConvertToYV12()
#ConvertToyv411()
#Crop(0,20,-0,-30,true)
#bob(0,0.5)

AssumeTFF()
SeparateFields()

a=last

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=take2.TMedian2().selectevery(5,2)

sup1 = clean1.minblur(1).removegrain(11,0).removegrain(11,0)
\ .mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\ .msuper(pel=2,sharp=0)
sup2 = a.msuper(pel=2,levels=1,sharp=2)
#bv23=sup1.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
#fv23=sup1.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)

#a.mdegrain3(sup2,bv21,fv21,bv22,fv22,bv23,fv23,thSAD=499) # << this is the "2-fold" variant

interleave(a.mcompensate(sup2,fv22),a.mcompensate(sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
TMedian2().selectevery(5,2)

sup3 = last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)

last.mdegrain3(sup3,bv31,fv31,bv32,fv32,bv33,fv33,thSAD=499) # valor Original thSAD=499
LSFMod(strength=60)
Interleave() 
Weave()

#stackvertical(a,last) # Alterado por mim.
return(last)


#--------------------------------------------------------------
# Helper functions

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)
}

# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
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) ) }




So this error appeared:










So I decided to insert the RgToos v1.0 32bits in the above script and this error showed up:








Because of that, I decided to insert the RgToos v1.0 64bits in the script above and it happened:








Please... Do you guys knows how to solve this problem?



Thank you in advance!!
NLPguy is offline   Reply With Quote
Old 15th April 2021, 03:22   #2  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
You should use x64 plugins on Avisynth+ x64 (although there's a way to use 32bit plugins using mp_pipeline) and vice versa.

RemoveGrain is now part of RgTools.dll
Download RgTools x64 from pinterf's repository . I suggest you update all of required plugins as well (mvtools2, masktools2, depan, depanestimate etc), you can find the updated plugins in the same repository.

For LSFmod, you need to download avsi script and import it to the script
(see real_finder's repository, you'll need to download and import Zs_RF_Shared.avsi as well from the same repository).

Remove (comment out) all of the occurrences of SetMemoryMax, SetMTMode in your script.

PHP Code:
#Import("D:\App\AVS\plugins64+\source script2 Dr Paulo Pirej.avs")
# Plugins: - RemoveGrain
# - MaskTools2
# - Depan + DepanEstimate
# - MVTools2

#SetMemoryMax(512)
#SetMTMode(3)

#LoadPlugin("D:\App\AVS\plugins64+\RemoveGrain.dll")
LoadPlugin("D:\App\AVS\plugins64+\MaskTools2.dll")
LoadPlugin("D:\App\AVS\plugins64+\Depan.dll")
LoadPlugin("D:\App\AVS\plugins64+\DepanEstimate.dll")
LoadPlugin("D:\App\AVS\plugins64+\MVTools2.dll")
LoadPlugin("D:\App\AVS\plugins64+\LSMASHSource.dll")
LoadPlugin("D:\App\AVS\plugins64+\RgTools.dll")
Import("D:\App\AVS\avsi\Zs_RF_Shared.avsi")
Import("D:\App\AVS\avsi\LSFMod.avsi")

#mpeg2source("M:\Marcelo 27.5.20\1\01\01-1.d2v")
#mpeg2source("M:\Marcelo 999255703 - Fazer\01 ok 19m.d2v")
#DirectShowSource("M:\Flavio Itapema 4.11.20 Fazer\02 FI 4capt PanLG.mp4", fps = 25, ConvertFPS = True )
LSmashAudioSource("D:\App\youtubedl\Video.mp4")
LSmashVideoSource("D:\App\youtubedl\Video.mp4")
AudioDub(v,a)
#DirectShowSource("M:\Luis Tonini 14.1.20 - Fazer\01 V14ES10 e.mp4")
#DirectShowSource("E:\Tereza Soares 13.8.20 - Fazer\01 TS 8capt V17JVCES10.mp4", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia ou MP4 da Aple
#DirectShowSource("M:\Neogrid 5-10-17\090 4capt V13SVSDV.avi", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia
#AVISource("E:\Cleiton\Super 8mm\03\03 ok.avi") 
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi", audio=true)
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi") # DV AVI
#AVISource("M:\Pedro 31-7-18\25 8capt V15ES10SDV.avi", audio=true)


#SetMTMode(2)
#ConvertToYV12()
#ConvertToyv411()
#Crop(0,20,-0,-30,true)
#bob(0,0.5)

AssumeTFF()
SeparateFields()

a=last

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=take2.TMedian2().selectevery(5,2)

sup1 clean1.minblur(1).removegrain(11,0).removegrain(11,0)
\ .
mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\ .
msuper(pel=2,sharp=0)
sup2 a.msuper(pel=2,levels=1,sharp=2)
#bv23=sup1.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv22=sup1.manalyse(isb=truetruemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=truetruemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
#fv23=sup1.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)

#a.mdegrain3(sup2,bv21,fv21,bv22,fv22,bv23,fv23,thSAD=499) # << this is the "2-fold" variant

interleave(a.mcompensate(sup2,fv22),a.mcompensate(sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
TMedian2().selectevery(5,2)

sup3 last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=truetruemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=truetruemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=truetruemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)

last.mdegrain3(sup3,bv31,fv31,bv32,fv32,bv33,fv33,thSAD=499# valor Original thSAD=499
LSFMod(strength=60)
Interleave() 
Weave()

#stackvertical(a,last) # Alterado por mim.
return(last)


#--------------------------------------------------------------
# Helper functions

function MinBlur(clip clpint rint "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? uv
rg4 
= (uv==3) ? : -1
rg11 
= (uv==3) ? 11 : -1
rg20 
= (uv==3) ? 20 : -1
medf 
= (uv==3) ? : -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)
}

# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1"clip "input_2"clip "input_3"clip "input_4"clip "input_5"string "chroma")
{
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) {
Median2c.selectevery(1,-2), c.selectevery(1,-1), cc.selectevery(1,1), c.selectevery(1,2) ) } 
I don't know what you want to achieve with this script, but the script I pasted above works (at least it doesn't throw any error).
patul is offline   Reply With Quote
Old 15th April 2021, 05:19   #3  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,532
plus to what patul said, you should also use x64 of virtualdub2 not the old virtualdubMOD since it's x86-32 only
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 16th April 2021, 06:01   #4  |  Link
NLPguy
Registered User
 
Join Date: Feb 2015
Posts: 20
Quote:
Originally Posted by patul View Post
You should use x64 plugins on Avisynth+ x64 (although there's a way to use 32bit plugins using mp_pipeline) and vice versa.

RemoveGrain is now part of RgTools.dll
Download RgTools x64 from pinterf's repository . I suggest you update all of required plugins as well (mvtools2, masktools2, depan, depanestimate etc), you can find the updated plugins in the same repository.

For LSFmod, you need to download avsi script and import it to the script
(see real_finder's repository, you'll need to download and import Zs_RF_Shared.avsi as well from the same repository).

Remove (comment out) all of the occurrences of SetMemoryMax, SetMTMode in your script.

PHP Code:
#Import("D:\App\AVS\plugins64+\source script2 Dr Paulo Pirej.avs")
# Plugins: - RemoveGrain
# - MaskTools2
# - Depan + DepanEstimate
# - MVTools2

#SetMemoryMax(512)
#SetMTMode(3)

#LoadPlugin("D:\App\AVS\plugins64+\RemoveGrain.dll")
LoadPlugin("D:\App\AVS\plugins64+\MaskTools2.dll")
LoadPlugin("D:\App\AVS\plugins64+\Depan.dll")
LoadPlugin("D:\App\AVS\plugins64+\DepanEstimate.dll")
LoadPlugin("D:\App\AVS\plugins64+\MVTools2.dll")
LoadPlugin("D:\App\AVS\plugins64+\LSMASHSource.dll")
LoadPlugin("D:\App\AVS\plugins64+\RgTools.dll")
Import("D:\App\AVS\avsi\Zs_RF_Shared.avsi")
Import("D:\App\AVS\avsi\LSFMod.avsi")

#mpeg2source("M:\Marcelo 27.5.20\1\01\01-1.d2v")
#mpeg2source("M:\Marcelo 999255703 - Fazer\01 ok 19m.d2v")
#DirectShowSource("M:\Flavio Itapema 4.11.20 Fazer\02 FI 4capt PanLG.mp4", fps = 25, ConvertFPS = True )
LSmashAudioSource("D:\App\youtubedl\Video.mp4")
LSmashVideoSource("D:\App\youtubedl\Video.mp4")
AudioDub(v,a)
#DirectShowSource("M:\Luis Tonini 14.1.20 - Fazer\01 V14ES10 e.mp4")
#DirectShowSource("E:\Tereza Soares 13.8.20 - Fazer\01 TS 8capt V17JVCES10.mp4", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia ou MP4 da Aple
#DirectShowSource("M:\Neogrid 5-10-17\090 4capt V13SVSDV.avi", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia
#AVISource("E:\Cleiton\Super 8mm\03\03 ok.avi") 
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi", audio=true)
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi") # DV AVI
#AVISource("M:\Pedro 31-7-18\25 8capt V15ES10SDV.avi", audio=true)


#SetMTMode(2)
#ConvertToYV12()
#ConvertToyv411()
#Crop(0,20,-0,-30,true)
#bob(0,0.5)

AssumeTFF()
SeparateFields()

a=last

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=take2.TMedian2().selectevery(5,2)

sup1 clean1.minblur(1).removegrain(11,0).removegrain(11,0)
\ .
mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\ .
msuper(pel=2,sharp=0)
sup2 a.msuper(pel=2,levels=1,sharp=2)
#bv23=sup1.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv22=sup1.manalyse(isb=truetruemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=truetruemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
#fv23=sup1.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)

#a.mdegrain3(sup2,bv21,fv21,bv22,fv22,bv23,fv23,thSAD=499) # << this is the "2-fold" variant

interleave(a.mcompensate(sup2,fv22),a.mcompensate(sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
TMedian2().selectevery(5,2)

sup3 last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=truetruemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=truetruemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=truetruemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)

last.mdegrain3(sup3,bv31,fv31,bv32,fv32,bv33,fv33,thSAD=499# valor Original thSAD=499
LSFMod(strength=60)
Interleave() 
Weave()

#stackvertical(a,last) # Alterado por mim.
return(last)


#--------------------------------------------------------------
# Helper functions

function MinBlur(clip clpint rint "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? uv
rg4 
= (uv==3) ? : -1
rg11 
= (uv==3) ? 11 : -1
rg20 
= (uv==3) ? 20 : -1
medf 
= (uv==3) ? : -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)
}

# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1"clip "input_2"clip "input_3"clip "input_4"clip "input_5"string "chroma")
{
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) {
Median2c.selectevery(1,-2), c.selectevery(1,-1), cc.selectevery(1,1), c.selectevery(1,2) ) } 
I don't know what you want to achieve with this script, but the script I pasted above works (at least it doesn't throw any error).



Thank you very much patul!!

You helped me a lot with your script and important information.

I've run the script, but in SetFilterMTMode I couldn't get past 3 FPS.

It ran on 2.6 MT at 17 FPS on average.

I was unable to search for script examples with AviSynth + 64bits setting MTMode.

I also don't know if I'm using Virtualdub 2 correctly. Because when I clicked on “Save as” it didn't run the script.

I had to use the preview of the 2 screens. I will post the changed script.


Code:

Code:
#Import("D:\App\AVS\plugins64+\source script2 Dr Paulo Pirej.avs")
# Plugins: - RemoveGrain
# - MaskTools2
# - Depan + DepanEstimate
# - MVTools2

SetMemoryMax(1024)
SetFilterMTMode("MT_SERIALIZED", 3)

#LoadPlugin("D:\App\AVS\plugins64+\RemoveGrain.dll")
LoadPlugin("M:\Temp2\MaskTools2.dll")
LoadPlugin("M:\Temp2\Depan.dll")
LoadPlugin("M:\Temp2\DepanEstimate.dll")
LoadPlugin("M:\Temp2\MVTools2.dll")
LoadPlugin("M:\Temp2\LSMASHSource.dll")
LoadPlugin("M:\Temp2\RgTools.dll")
Import("M:\Temp2\Zs_RF_Shared.avsi")
Import("M:\Temp2\LSFMod.avsi")

#mpeg2source("M:\Marcelo 27.5.20\1\01\01-1.d2v")
#mpeg2source("M:\Marcelo 999255703 - Fazer\01 ok 19m.d2v")
#DirectShowSource("M:\Flavio Itapema 4.11.20 Fazer\02 FI 4capt PanLG.mp4", fps = 25, ConvertFPS = True )
a = LSmashAudioSource("E:\Tiago 8.9.20 - Fazer\02 TI 3capt V20LG.mp4")
v = LSmashVideoSource("E:\Tiago 8.9.20 - Fazer\02 TI 3capt V20LG.mp4")
AudioDub(v,a)
#DirectShowSource("M:\Luis Tonini 14.1.20 - Fazer\01 V14ES10 e.mp4")
#DirectShowSource("E:\Tereza Soares 13.8.20 - Fazer\01 TS 8capt V17JVCES10.mp4", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia ou MP4 da Aple
#DirectShowSource("M:\Neogrid 5-10-17\090 4capt V13SVSDV.avi", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia
#AVISource("E:\Cleiton\Super 8mm\03\03 ok.avi") 
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi", audio=true)
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi") # DV AVI
#AVISource("M:\Pedro 31-7-18\25 8capt V15ES10SDV.avi", audio=true)


SetFilterMTMode("DEFAULT_MT_MODE", 2)
#ConvertToYV12()
#ConvertToyv411()
#Crop(0,20,-0,-30,true)
#bob(0,0.5)

AssumeTFF()
SeparateFields()

a=last

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=take2.TMedian2().selectevery(5,2)

sup1 = clean1.minblur(1).removegrain(11,0).removegrain(11,0)
\ .mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\ .msuper(pel=2,sharp=0)
sup2 = a.msuper(pel=2,levels=1,sharp=2)
#bv23=sup1.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv22=sup1.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
#fv23=sup1.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)

#a.mdegrain3(sup2,bv21,fv21,bv22,fv22,bv23,fv23,thSAD=499) # << this is the "2-fold" variant

interleave(a.mcompensate(sup2,fv22),a.mcompensate(sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
TMedian2().selectevery(5,2)

sup3 = last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true, truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)

last.mdegrain3(sup3,bv31,fv31,bv32,fv32,bv33,fv33,thSAD=499) # valor Original thSAD=499
LSFMod(strength=60)
Interleave() 
Weave()

#stackvertical(a,last) # Alterado por mim.
#Prefetch(4)
return(last)


#--------------------------------------------------------------
# Helper functions

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)
}

# median of 5 clips from Helpers.avs by G-force
Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
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) ) } 
Prefetch(4)
NLPguy is offline   Reply With Quote
Old 16th April 2021, 07:25   #5  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
I see you have used Prefetch there, although it is commented out, I assume you have read something.

In case you haven't read the wiki, please see here

There're a lot of details there, and probably will need sometime to digest (at least for me). SetFilterMTMode alone isn't enough, you need to call Prefetch(X), x is the number of threads to be used, I read somewhere, pinterf suggested the number of x in relation to number of CPU core, but I can't remember the exact formula. I tried your script with Prefetch(8) on my laptop with i7-7700HQ on avg 5fps with 720p video and 11.9fps for 480i video.

Another thing is to set the filter MT mode correctly, on aforementioned wiki page, there's a link to "known" MT modes for several filters. Probably you can take a look at it as well.

Last edited by patul; 16th April 2021 at 07:35.
patul is offline   Reply With Quote
Old 16th April 2021, 11:20   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,228
Also see here:- http://avisynth.nl/index.php/AviSynt....28MT.29_Notes
I had problem locating latest SetMTMode.avsi [for Plugins],
here is the one I'm using:- https://www.mediafire.com/file/7a3p8...MTMode.7z/file
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 16th April 2021, 12:48   #7  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 889
I think in avisynth+ plugins internally set their MT status. Unless one decides to degrade it why use setMtMode at all?
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 16th April 2021, 13:05   #8  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,532
Quote:
Originally Posted by vcmohan View Post
I think in avisynth+ plugins internally set their MT status. Unless one decides to degrade it why use setMtMode at all?
true, but for old plugins setMtMode is needed, so unless all plugins are updated setMtMode still needed

edit: also seems not all uptodate plugins set their MT status (like Stephen R. Savage/sekrit-twc plugins like Avsresize and EdgeFixer)

StainlessS, what about MtModes.avsi or plugins/avsplus/MtModes.avsi (both should be same)
__________________
See My Avisynth Stuff

Last edited by real.finder; 16th April 2021 at 13:23.
real.finder is offline   Reply With Quote
Old 16th April 2021, 13:29   #9  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
Turned out I was looking in the wrong place. I was looking for MtModes.avsi sometime ago and I couldn't find it in your /AVS-Stuff, I ended up using the one linked in the wiki. Thanks real.finder for keeping everything updated & tidy.
patul is offline   Reply With Quote
Old 16th April 2021, 13:37   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,228
Thanks RF, I probably looked there but was looking for SetMtModes.avsi
__________________
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 ???
StainlessS 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 12:28.


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