StainlessS
19th January 2012, 21:48
Here an example from Avisynth docs,
Advanced Conditional Filtering Part II
global sep="."
global combedthreshold=25
Function IsMoving() {
global b = (diff < 1.0) ? false : true
}
Function CombingInfo(clip c) {
file = "interlace.log"
global clip = c
c = WriteFile(c, file, "a", "sep", "b")
c = FrameEvaluate(c, "global a = IsCombed(clip, combedthreshold)")
c = FrameEvaluate(c, "IsMoving")
c = FrameEvaluate(c, "global diff = 0.50*YDifferenceFromPrevious(clip) + 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")
return c
}
v=Avisource("F.AVI")
CombingInfo(v)
The above works OK.
And here, the example following which is supposed to just get rid of the globals (EDIT: diff, a, and b).
global sep="."
global combedthreshold=25
Function IsMoving(float diff) {
return (diff >= 1.0)
}
Function CombingInfo(clip c) {
file = "interlace.log"
c = WriteFile(c, file, "a", "sep", "b")
c = FrameEvaluate(c,"
diff = 0.50*YDifferenceFromPrevious() + 0.25*UDifferenceFromPrevious() + 0.25*VDifferenceFromPrevious()
b = IsMoving(diff)
a = IsCombed(combedthreshold)
")
return c
}
v=Avisource("F.AVI")
CombingInfo(v)
This second example produces this:
I don't know what "a" means.I don't know what "b" means
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.true
Which is identical to the first output but with the addtional "I dont know" line.
Question is, is there a way to eradicate the "I dont know" line (EDIT: & why is it there?).
What I'm trying to do is experimental, something like this:-
Function ChooseClip(float df) {
return df>0.5?7:df>0.25?6:df>0.125?5:df>0.0625?4:df>0.03125?3:df>0.015625?2:df>0.0078125?1:0
}
Function MakeClopCmd(clip c,string File) {
c = WriteFile(c, File, "Ix", """ "," """, "current_frame", append=false)
c = FrameEvaluate(c,"
df=YDifferenceFromPrevious()
Ix=ChooseClip(df)
")
return c
}
v=Avisource("F.AVI")
MakeClopCmd(v,"Clop.txt")
Idea of which is to choose a clip based on a conditional, in this case eg, variable Deblock_DeBlock()'s based on YDifferenceFromPrevious, via ClipClop() Filter.
Thanx in advance. :)
Advanced Conditional Filtering Part II
global sep="."
global combedthreshold=25
Function IsMoving() {
global b = (diff < 1.0) ? false : true
}
Function CombingInfo(clip c) {
file = "interlace.log"
global clip = c
c = WriteFile(c, file, "a", "sep", "b")
c = FrameEvaluate(c, "global a = IsCombed(clip, combedthreshold)")
c = FrameEvaluate(c, "IsMoving")
c = FrameEvaluate(c, "global diff = 0.50*YDifferenceFromPrevious(clip) + 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")
return c
}
v=Avisource("F.AVI")
CombingInfo(v)
The above works OK.
And here, the example following which is supposed to just get rid of the globals (EDIT: diff, a, and b).
global sep="."
global combedthreshold=25
Function IsMoving(float diff) {
return (diff >= 1.0)
}
Function CombingInfo(clip c) {
file = "interlace.log"
c = WriteFile(c, file, "a", "sep", "b")
c = FrameEvaluate(c,"
diff = 0.50*YDifferenceFromPrevious() + 0.25*UDifferenceFromPrevious() + 0.25*VDifferenceFromPrevious()
b = IsMoving(diff)
a = IsCombed(combedthreshold)
")
return c
}
v=Avisource("F.AVI")
CombingInfo(v)
This second example produces this:
I don't know what "a" means.I don't know what "b" means
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.false
false.true
Which is identical to the first output but with the addtional "I dont know" line.
Question is, is there a way to eradicate the "I dont know" line (EDIT: & why is it there?).
What I'm trying to do is experimental, something like this:-
Function ChooseClip(float df) {
return df>0.5?7:df>0.25?6:df>0.125?5:df>0.0625?4:df>0.03125?3:df>0.015625?2:df>0.0078125?1:0
}
Function MakeClopCmd(clip c,string File) {
c = WriteFile(c, File, "Ix", """ "," """, "current_frame", append=false)
c = FrameEvaluate(c,"
df=YDifferenceFromPrevious()
Ix=ChooseClip(df)
")
return c
}
v=Avisource("F.AVI")
MakeClopCmd(v,"Clop.txt")
Idea of which is to choose a clip based on a conditional, in this case eg, variable Deblock_DeBlock()'s based on YDifferenceFromPrevious, via ClipClop() Filter.
Thanx in advance. :)