hello_hello
7th November 2017, 20:50
I'm using Eval in order to prevent Avisynth from processing some slow tasks unless it needs to (or so I thought). The first part of the function looks like this (not exact, but simplified to demonstrate the problem), and the line I'm fussed about is the one highlighted in blue.
function Test(clip c, int "OutWidth", int "OutHeight", int "CL", int "CT", int "CR", int "CB", bool "Auto", int "Cthresh", int "Cstart", int "Csample", val "PicDAR", int "Mod", val "InDAR", bool "Borders", bool "FrostyBorders", bool "Resize", bool "HResize", bool "CleanBorders", int "Preview", val "Bcolor", bool "Info")
{
Resize = default(Resize, true)
HResize = default(HResize, true)
OutWidth = (HResize == false) ? (0) : default(OutWidth, 0)
OutHeight = (HResize == false) ? (0) : default(OutHeight, 0)
CL = default(CL, 0)
CT = default(CT, 0)
CR = default(CR, 0)
CB = default(CB, 0)
Float_CL = float(CL)
Float_CT = float(CT)
Float_CR = float(CR)
Float_CB = float(CB)
Auto = default(Auto, false)
Cthresh = default(Cthresh, 30)
Cstart = default(Cstart, 250)
Csample = default(Csample, 5)
PicDAR = default(PicDAR, float(0))
Mod = default(Mod, 4)
Float_Mod = float(Mod)
InDAR = default(InDAR, float(c.width) / float(c.height))
Borders = default(Borders, false)
FrostyBorders = default(FrostyBorders, false)
Bordered = (Borders == true) || (FrostyBorders == true) ? true : false
CleanBorders = default(CleanBorders, false)
Preview = default(Preview, 0)
Bcolor = default(Bcolor, $000000)
Info = default(Info, false)
ACpreview = (Preview == 2) ? (0) : (Preview)
(Auto == true) && (ACpreview == 1) ? \
Eval("""
Grey_Source = c.Greyscale()
return Grey_Source
""") : \
(Auto == true) ? \
Eval("""
Grey_Source = c.Greyscale()
FFS = Grey_Source
""") : \
Eval("""
FFS = c.crop(CL, CT, CR, CB)
""")
}
Using the above (incomplete) function, if I add the following to a script, I get a b/w version of the clip, as I had expected.
Test(Auto=true, Preview=1)
My question is, why doesn't Avisynth stop at the return line as it does for the above function when I add a little more to it? The following function will result in an "I don't know what FFS means" error. I've added two extra lines. Would that be expected behaviour?
function Test(clip c, int "OutWidth", int "OutHeight", int "CL", int "CT", int "CR", int "CB", bool "Auto", int "Cthresh", int "Cstart", int "Csample", val "PicDAR", int "Mod", val "InDAR", bool "Borders", bool "FrostyBorders", bool "Resize", bool "HResize", bool "CleanBorders", int "Preview", val "Bcolor", bool "Info")
{
Resize = default(Resize, true)
HResize = default(HResize, true)
OutWidth = (HResize == false) ? (0) : default(OutWidth, 0)
OutHeight = (HResize == false) ? (0) : default(OutHeight, 0)
CL = default(CL, 0)
CT = default(CT, 0)
CR = default(CR, 0)
CB = default(CB, 0)
Float_CL = float(CL)
Float_CT = float(CT)
Float_CR = float(CR)
Float_CB = float(CB)
Auto = default(Auto, false)
Cthresh = default(Cthresh, 30)
Cstart = default(Cstart, 250)
Csample = default(Csample, 5)
PicDAR = default(PicDAR, float(0))
Mod = default(Mod, 4)
Float_Mod = float(Mod)
InDAR = default(InDAR, float(c.width) / float(c.height))
Borders = default(Borders, false)
FrostyBorders = default(FrostyBorders, false)
Bordered = (Borders == true) || (FrostyBorders == true) ? true : false
CleanBorders = default(CleanBorders, false)
Preview = default(Preview, 0)
Bcolor = default(Bcolor, $000000)
Info = default(Info, false)
ACpreview = (Preview == 2) ? (0) : (Preview)
(Auto == true) && (ACpreview == 1) ? \
Eval("""
Grey_Source = c.Greyscale()
return Grey_Source
""") : \
(Auto == true) ? \
Eval("""
Grey_Source = c.Greyscale()
FFS = Grey_Source
""") : \
Eval("""
FFS = c.crop(CL, CT, CR, CB)
""")
Blah_Blah = FFS
return c
}
For the second version of the function, the following returns the source clip.
Test()
Thanks.
function Test(clip c, int "OutWidth", int "OutHeight", int "CL", int "CT", int "CR", int "CB", bool "Auto", int "Cthresh", int "Cstart", int "Csample", val "PicDAR", int "Mod", val "InDAR", bool "Borders", bool "FrostyBorders", bool "Resize", bool "HResize", bool "CleanBorders", int "Preview", val "Bcolor", bool "Info")
{
Resize = default(Resize, true)
HResize = default(HResize, true)
OutWidth = (HResize == false) ? (0) : default(OutWidth, 0)
OutHeight = (HResize == false) ? (0) : default(OutHeight, 0)
CL = default(CL, 0)
CT = default(CT, 0)
CR = default(CR, 0)
CB = default(CB, 0)
Float_CL = float(CL)
Float_CT = float(CT)
Float_CR = float(CR)
Float_CB = float(CB)
Auto = default(Auto, false)
Cthresh = default(Cthresh, 30)
Cstart = default(Cstart, 250)
Csample = default(Csample, 5)
PicDAR = default(PicDAR, float(0))
Mod = default(Mod, 4)
Float_Mod = float(Mod)
InDAR = default(InDAR, float(c.width) / float(c.height))
Borders = default(Borders, false)
FrostyBorders = default(FrostyBorders, false)
Bordered = (Borders == true) || (FrostyBorders == true) ? true : false
CleanBorders = default(CleanBorders, false)
Preview = default(Preview, 0)
Bcolor = default(Bcolor, $000000)
Info = default(Info, false)
ACpreview = (Preview == 2) ? (0) : (Preview)
(Auto == true) && (ACpreview == 1) ? \
Eval("""
Grey_Source = c.Greyscale()
return Grey_Source
""") : \
(Auto == true) ? \
Eval("""
Grey_Source = c.Greyscale()
FFS = Grey_Source
""") : \
Eval("""
FFS = c.crop(CL, CT, CR, CB)
""")
}
Using the above (incomplete) function, if I add the following to a script, I get a b/w version of the clip, as I had expected.
Test(Auto=true, Preview=1)
My question is, why doesn't Avisynth stop at the return line as it does for the above function when I add a little more to it? The following function will result in an "I don't know what FFS means" error. I've added two extra lines. Would that be expected behaviour?
function Test(clip c, int "OutWidth", int "OutHeight", int "CL", int "CT", int "CR", int "CB", bool "Auto", int "Cthresh", int "Cstart", int "Csample", val "PicDAR", int "Mod", val "InDAR", bool "Borders", bool "FrostyBorders", bool "Resize", bool "HResize", bool "CleanBorders", int "Preview", val "Bcolor", bool "Info")
{
Resize = default(Resize, true)
HResize = default(HResize, true)
OutWidth = (HResize == false) ? (0) : default(OutWidth, 0)
OutHeight = (HResize == false) ? (0) : default(OutHeight, 0)
CL = default(CL, 0)
CT = default(CT, 0)
CR = default(CR, 0)
CB = default(CB, 0)
Float_CL = float(CL)
Float_CT = float(CT)
Float_CR = float(CR)
Float_CB = float(CB)
Auto = default(Auto, false)
Cthresh = default(Cthresh, 30)
Cstart = default(Cstart, 250)
Csample = default(Csample, 5)
PicDAR = default(PicDAR, float(0))
Mod = default(Mod, 4)
Float_Mod = float(Mod)
InDAR = default(InDAR, float(c.width) / float(c.height))
Borders = default(Borders, false)
FrostyBorders = default(FrostyBorders, false)
Bordered = (Borders == true) || (FrostyBorders == true) ? true : false
CleanBorders = default(CleanBorders, false)
Preview = default(Preview, 0)
Bcolor = default(Bcolor, $000000)
Info = default(Info, false)
ACpreview = (Preview == 2) ? (0) : (Preview)
(Auto == true) && (ACpreview == 1) ? \
Eval("""
Grey_Source = c.Greyscale()
return Grey_Source
""") : \
(Auto == true) ? \
Eval("""
Grey_Source = c.Greyscale()
FFS = Grey_Source
""") : \
Eval("""
FFS = c.crop(CL, CT, CR, CB)
""")
Blah_Blah = FFS
return c
}
For the second version of the function, the following returns the source clip.
Test()
Thanks.