DarkT
6th April 2007, 20:19
Hi, I wrote the following script - and it took me quite a while, and it's all super messy, because I dunno how to simplify it in the "avisynth" language...
Function ZeroCool(Clip Clp,Int"X", Int"Y", Int"Z", Float"a", Float"b", Float"c", Int"s")
{
X = default(X,0)
Y = default(Y,0)
Z = default(Z,0)
#defining the hqdn values
a = (x==1) ? 1.2 : (x==2) ? 2.1 : (x==3) ? 3.2 : 0
#defining the deblock values
b = (z==1) ? 18 : (z==2) ? 23 : (z==3) ? 25 : 0
c = (z==1) ? 1 : (z==2) ? 1 : (z==3) ? 3 : 0
#s stands for "situation" - 8 possible situation can hapen with 3 filters, the below line tries to identify
#which situation we're in (which of the 3 filters did the user want to use)
s = (x!=0) && (x < 4) ?
\(y!=0) && (y < 2) ? (z!=0) && (z < 4) ? 111 : 11
\: (z!=0) && (z < 4) ? 101 : 1
\: (y!=0) && (y < 2) ? (z!=0) && (z < 4) ? 110 : 10
\: (z!=0) && (z < 4) ? 100 : 0
#Here the script will execute the line of code according to the situation we're in
(s==0) ? Clp :
\(s==1) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a) :
\(s==10) ? Clp.LimitedSharpenFaster(Smode=4) :
\(s==11) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a).LimitedSharpenFaster(Smode=4) :
\(s==100) ? Clp.deblock(quant=b,aoffset=3,boffset=4) :
\(s==101) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a).deblock(quant=b,aoffset=3,boffset=4) :
\(s==110) ? Clp.LimitedSharpenFaster(Smode=4).deblock(quant=b,aoffset=3,boffset=4) :
\(s==111) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a).LimitedSharpenFaster(Smode=4).deblock(quant=b,aoffset=c,boffset=c+1)
\ : Clp
Return(Last)
}
Edit:
This script is incomplete and has bogous values for the filters... The main idea is to create a certain function for new people which would have let's say 7-10 usefull filters, and each filter has 3 working levels, each "harder" then the other - then you merely need to specify what you want working (let's say sharpen=2, deblock=1) and it uses custom values.
It was fun fiddling with the idea, that's why I wrote it :) - btw, how will it afect the speeds? Will it slow down the encoding proccess? The fact that it's all in a function with all of the lines and all...
Edit2:
This is a side project of mine, I'd like to attempt also having a similiar script for the IVTC and pre-ivtc filtering, since not everybody wants to learn to do these things, to sort of help people automate it... And coz' it's fun :).
Function ZeroCool(Clip Clp,Int"X", Int"Y", Int"Z", Float"a", Float"b", Float"c", Int"s")
{
X = default(X,0)
Y = default(Y,0)
Z = default(Z,0)
#defining the hqdn values
a = (x==1) ? 1.2 : (x==2) ? 2.1 : (x==3) ? 3.2 : 0
#defining the deblock values
b = (z==1) ? 18 : (z==2) ? 23 : (z==3) ? 25 : 0
c = (z==1) ? 1 : (z==2) ? 1 : (z==3) ? 3 : 0
#s stands for "situation" - 8 possible situation can hapen with 3 filters, the below line tries to identify
#which situation we're in (which of the 3 filters did the user want to use)
s = (x!=0) && (x < 4) ?
\(y!=0) && (y < 2) ? (z!=0) && (z < 4) ? 111 : 11
\: (z!=0) && (z < 4) ? 101 : 1
\: (y!=0) && (y < 2) ? (z!=0) && (z < 4) ? 110 : 10
\: (z!=0) && (z < 4) ? 100 : 0
#Here the script will execute the line of code according to the situation we're in
(s==0) ? Clp :
\(s==1) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a) :
\(s==10) ? Clp.LimitedSharpenFaster(Smode=4) :
\(s==11) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a).LimitedSharpenFaster(Smode=4) :
\(s==100) ? Clp.deblock(quant=b,aoffset=3,boffset=4) :
\(s==101) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a).deblock(quant=b,aoffset=3,boffset=4) :
\(s==110) ? Clp.LimitedSharpenFaster(Smode=4).deblock(quant=b,aoffset=3,boffset=4) :
\(s==111) ? Clp.hqdn3d(ls=a,cs=a,lt=a,ct=a).LimitedSharpenFaster(Smode=4).deblock(quant=b,aoffset=c,boffset=c+1)
\ : Clp
Return(Last)
}
Edit:
This script is incomplete and has bogous values for the filters... The main idea is to create a certain function for new people which would have let's say 7-10 usefull filters, and each filter has 3 working levels, each "harder" then the other - then you merely need to specify what you want working (let's say sharpen=2, deblock=1) and it uses custom values.
It was fun fiddling with the idea, that's why I wrote it :) - btw, how will it afect the speeds? Will it slow down the encoding proccess? The fact that it's all in a function with all of the lines and all...
Edit2:
This is a side project of mine, I'd like to attempt also having a similiar script for the IVTC and pre-ivtc filtering, since not everybody wants to learn to do these things, to sort of help people automate it... And coz' it's fun :).