Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Function Stab()
- #
- function Stab(clip clp, int "range", int "dxmax", int "dymax", float "trust", float "pixaspect", \
- float "zoommax", int "mirror")
- {
- range = default(range, 1)
- dxmax = default(dxmax, 4)
- dymax = default(dymax, 3)
- trust = default(trust, 0.0)
- zoommax = default(zoommax, 1.0)
- mirror = default(mirror, 0)
- pixaspect = default(pixaspect, 1.094) # PAL 720x576
- # pixaspect = default(pixaspect, 1.0) # PAL 768x576 (640x480)
- temp = clp.TemporalSoften(7, 255, 255, 25, 2)
- inter = Interleave(temp.Repair(clp.TemporalSoften(1, 255, 255, 25, 2)), clp)
- # DePanEstimate(clip, int range, float trust, int winx, int winy, int dxmax, int dymax, \
- # float zoommax, bool improve, float stab, float pixaspect, bool info, \
- # string log, bool debug, bool show, bool fftw)
- #
- mdata = DePanEstimate(inter, \
- dxmax = dxmax, \
- dymax = dymax, \
- pixaspect = pixaspect, \
- zoommax = zoommax, \
- improve = true, \
- range = range, \
- trust = trust)
- # DePan(clip, clip data, float offset, int subpixel, float pixaspect, bool matchfields, \
- # int mirror, int blur, bool info, string inputlog)
- #
- DePan(inter, \
- data = mdata, \
- pixaspect = pixaspect, \
- subpixel = 2, \
- mirror = mirror, \
- matchfields = true, \
- blur = 100, \
- offset = -1)
- return (SelectEvery(2, 0))
- }
- # Function Stab2()
- #
- function Stab2(clip clp, int "range", int "dxmax", int "dymax", float "trust", \
- float "pixaspect", float "zoommax", float "rotmax", float "cutoff", \
- bool "rot", int "mirror", bool "addzoom")
- {
- range = default(range, 2)
- dxmax = default(dxmax, 4) # 4 : 3
- dymax = default(dymax, 3) # 4 : 3
- trust = default(trust, 2.0)
- pixaspect = default(pixaspect, 1.094) # PAL 720x576
- # pixaspect = default(pixaspect, 1.0) # PAL 768x576
- addzoom = default(addzoom, true)
- zoommax = default(zoommax, 1.05)
- cutoff = default(cutoff, 0.1)
- rot = default(rot, true)
- rotmax = default(rotmax, 0.5)
- mirror = default(mirror, 15)
- # Global Motion Stabilization
- # ?????????? ???????????? ???????????
- #
- # DePanEstimate(clip, int range, float trust, int winx, int winy, int dxmax, int dymax, \
- # float zoommax, bool improve, float stab, float pixaspect, bool info, \
- # string log, bool debug, bool show, bool fftw)
- #
- mdata = DePanEstimate(clp, \
- dxmax = dxmax, \
- dymax = dymax, \
- pixaspect = pixaspect, \
- zoommax = zoommax, \
- improve = true, \
- range = range, \
- trust = trust)
- # function DePanStabilize(clip, clip data, float cutoff, float damping, bool addzoom, \
- # int prev, int next, int mirror, int blur, int dxmax, int dymax, \
- # float zoommax, float rotmax, int subpixel, float pixaspect, \
- # int fitlast, float tzoom, bool info, string inputlog)
- #
- return (DepanStabilize(clp, \
- data = mdata, \
- dxmax = dxmax, \
- dymax = dymax, \
- prev = range, \
- next = range, \
- pixaspect = pixaspect, \
- subpixel = 2, \
- cutoff = cutoff, \
- initzoom = 1.0, \
- tzoom = 3.0, \
- addzoom = addzoom, \
- zoommax = zoommax, \
- rotmax = rotmax, \
- mirror = mirror, \
- blur = 100, \
- fitlast = 0, \
- damping = 0.9, \
- info = false))
- }
- # Function Stab3()
- #
- function Stab3(clip clp, int "range", int "dxmax", int "dymax", float "pixaspect", \
- float "zoommax", float "rotmax", float "cutoff", \
- bool "rot", int "mirror", bool "addzoom")
- {
- # Constants
- # MSuper()
- #
- blkh = 8 ## Change this constant, must be 4, 8, 16, 32
- blkv = 8 ## Change this constant, must be 4, 8, 16, 32
- pel = 4
- chroma = true
- isse = true
- # Constants
- # MAnalyse()
- #
- blkh2 = blkh * 2 # Must be 4, 8, 16, 32
- blkv2 = blkv * 2 # Must be 4, 8, 16, 32
- (blkh2 > 32) ? 32 : blkh2
- (blkv2 > 32) ? 32 : blkv2
- overlap = blkh2 / 2
- overlapV = blkv2 / 2
- lambda = 100 * blkh2 * blkv2 / 64
- lsad = 400 * blkh2 * blkv2 / 64
- # Default variables values
- #
- dxmax = default(dxmax, 4) # 4 : 3
- dymax = default(dymax, 3) # 4 : 3
- range = default(range, 2)
- pixaspect = default(pixaspect, 1.094) # PAL 720x576
- # pixaspect = default(pixaspect, 1.0) # PAL 768x576
- zoommax = default(zoommax, 1.05)
- rotmax = default(rotmax, 0.5)
- cutoff = default(cutoff, 0.1)
- rot = default(rot, true)
- mirror = default(mirror, 15)
- addzoom = default(addzoom, true)
- # Global Motion stabilization
- # ?????????? ???????????? ???????????
- #
- # function FFT3DFilter(clip, float "sigma", float "beta", int "plane", int "bw", int "bh", int "bt", int "ow", int "oh", \
- # float "ratio", float "sharpen", float "scutoff", float "svr", float "smin", float "smax", bool "measure", \
- # bool "interlaced", int "wintype", int "pframe", int "px", int "py", bool "pshow", float "pcutoff", \
- # float "pfactor", float "sigma2", float "sigma3", float "sigma4", float "degrid", float "dehalo", \
- # float "hr", float "ht", int "ncpu")
- #
- prefiltered = FFT3DFilter(clp, \
- sigma = 3, \
- plane = 4, \
- bt = 4, \
- sharpen = 0.75, \
- interlaced = false, \
- dehalo = 1.0, \
- ncpu = 2)
- # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
- # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
- #
- prefilteredSuper = MSuper(prefiltered, \
- hpad = blkh, \
- vpad = blkv, \
- pel = pel, \
- levels = 1, \
- chroma = chroma, \
- sharp = 2, \
- rfilter = 4, \
- isse = isse, \
- planar = false)
- # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
- # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
- # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
- # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
- # int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
- #
- vectors = MAnalyse(prefilteredSuper, \
- blksize = blkh2, \
- blksizeV = blkv2, \
- overlap = overlap, \
- overlapV = overlapV, \
- isb = false, \
- chroma = chroma, \
- delta = 1, \
- truemotion = false, \
- global = true, \
- dct = 5, \
- search = 5, \
- searchparam = 8, \
- plevel = 0, \
- divide = 0, \
- pnew = 25, \
- lsad = lsad, \
- lambda = lambda, \
- badSAD = 400, \
- temporal = true, \
- isse = isse)
- # function MDepan(clip, clip vectors, clip "mask", bool "zoom", bool "rot", float "pixaspect", float "error", bool "info", \
- # string "log", float "wrong", float "zerow", int "range", int "thSCD1", int "thSCD2", bool "isse", bool planar)
- #
- globalmotion = MDepan(prefiltered, \
- vectors, \
- pixaspect = pixaspect, \
- range = range, \
- zoom = addzoom, \
- rot = rot, \
- error = 80.0, \
- wrong = 3.0, \
- zerow = 0.05, \
- thSCD1 = 625, \
- thSCD2 = 160, \
- isse = isse, \
- info = false, \
- planar = false)
- # function DePanStabilize(clip, clip data, float cutoff, float damping, bool addzoom, \
- # int prev, int next, int mirror, int blur, int dxmax, int dymax, \
- # float zoommax, float rotmax, int subpixel, float pixaspect, \
- # int fitlast, float tzoom, bool info, string inputlog)
- #
- return (DepanStabilize(clp, \
- data = globalmotion, \
- dxmax = dxmax, \
- dymax = dymax, \
- prev = range, \
- next = range, \
- pixaspect = pixaspect, \
- subpixel = 2, \
- rotmax = rotmax, \
- initzoom = 1.0, \
- tzoom = 3.0, \
- addzoom = addzoom, \
- zoommax = zoommax, \
- mirror = mirror, \
- blur = 300, \
- cutoff = cutoff, \
- damping = 0.9, \
- fitlast = 0, \
- info = false))
- }
- # Function Stab4()
- #
- function Stab4(clip clp, int "range", int "dxmax", int "dymax", float "pixaspect", \
- float "zoommax", float "rotmax", float "cutoff", \
- bool "rot", int "mirror", bool "addzoom")
- {
- # Constants
- # MSuper()
- #
- blkh = 8 ## Change this constant, must be 4, 8, 16, 32
- blkv = 8 ## Change this constant, must be 4, 8, 16, 32
- pel = 4
- chroma = true
- isse = true
- sharp = 2
- rfilter = 2
- # Constants
- # MAnalyse()
- #
- blkh2 = blkh * 2 # Must be 4, 8, 16, 32
- blkv2 = blkv * 2 # Must be 4, 8, 16, 32
- (blkh2 > 32) ? 32 : blkh2
- (blkv2 > 32) ? 32 : blkv2
- overlap2 = blkh2 / 2
- overlapV2 = blkv2 / 2
- lambda = 100 * blkv2 * blkh2 / 64
- lsad = 400 * blkv2 * blkh2 / 64
- dct = 5
- search = 5
- searchparam = 8
- pnew = 25
- truemotion = false
- # Constants
- # MRecalculate()
- #
- blkhR = blkh # Must be 4, 8, 16, 32
- blkvR = blkv # Must be 4, 8, 16, 32
- overlapR = blkhR / 2
- overlapVR = blkvR / 2
- lambdaRecalc = 100 * blkvR * blkhR / 64
- # Default variables values
- #
- dxmax = default(dxmax, 4) # 4 : 3
- dymax = default(dymax, 3) # 4 : 3
- range = default(range, 2)
- pixaspect = default(pixaspect, 1.094) # PAL 720x576
- # pixaspect = default(pixaspect, 1.0) # PAL 768x576
- zoommax = default(zoommax, 1.05)
- rotmax = default(rotmax, 0.5)
- cutoff = default(cutoff, 0.1)
- rot = default(rot, true)
- mirror = default(mirror, 15)
- addzoom = default(addzoom, true)
- # Global Motion Stabilization
- # ?????????? ???????????? ???????????
- #
- # function FFT3DFilter(clip, float "sigma", float "beta", int "plane", int "bw", int "bh", int "bt", int "ow", int "oh", \
- # float "ratio", float "sharpen", float "scutoff", float "svr", float "smin", float "smax", bool "measure", \
- # bool "interlaced", int "wintype", int "pframe", int "px", int "py", bool "pshow", float "pcutoff", \
- # float "pfactor", float "sigma2", float "sigma3", float "sigma4", float "degrid", float "dehalo", \
- # float "hr", float "ht", int "ncpu")
- #
- prefiltered = FFT3DFilter(clp, \
- sigma = 3, \
- plane = 4, \
- bt = 4, \
- sharpen = 0.75, \
- interlaced = false, \
- dehalo = 1.0, \
- ncpu = 2)
- # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
- # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
- #
- prefiltered2 = MSuper(clp, \
- hpad = blkh, \
- vpad = blkv, \
- pel = pel, \
- levels = 0, \
- chroma = chroma, \
- sharp = sharp, \
- rfilter = rfilter, \
- isse = isse, \
- planar = false)
- # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
- # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
- #
- prefilteredSuper = MSuper(prefiltered, \
- hpad = blkh, \
- vpad = blkv, \
- pel = pel, \
- levels = 1, \
- chroma = chroma, \
- sharp = sharp, \
- rfilter = rfilter, \
- isse = isse, \
- planar = false)
- # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
- # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
- # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
- # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
- # int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
- #
- vectors = MAnalyse(prefiltered2, \
- blksize = blkh2, \
- blksizeV = blkv2, \
- overlap = overlap2, \
- overlapV = overlapV2, \
- isb = false, \
- chroma = chroma, \
- delta = 1, \
- temporal = true, \
- search = search, \
- searchparam = searchparam, \
- dct = dct, \
- plevel = 0, \
- pnew = pnew, \
- lambda = lambda, \
- lsad = lsad, \
- truemotion = truemotion, \
- global = true, \
- divide = 0, \
- badSAD = 400, \
- isse = isse)
- # function MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \
- # int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \
- # int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \
- # int "sadx264", bool "isse")
- #
- vectorsRecalc = MRecalculate(prefilteredSuper, \
- vectors, \
- blksize = blkhR, \
- blksizeV = blkvR, \
- overlap = overlapR, \
- overlapV = overlapVR, \
- search = search, \
- searchparam = searchparam, \
- dct = dct, \
- lambda = lambdaRecalc, \
- pnew = pnew, \
- truemotion = truemotion, \
- thsad = 100)
- # function MDepan(clip, clip vectors, clip "mask", bool "zoom", bool "rot", float "pixaspect", float "error", bool "info", \
- # string "log", float "wrong", float "zerow", int "range", int "thSCD1", int "thSCD2", bool "isse", bool planar)
- #
- globalmotion = MDepan(prefiltered, \
- vectorsRecalc, \
- zoom = addzoom, \
- rot = rot, \
- pixaspect = pixaspect, \
- error = 80.0, \
- info = false, \
- wrong = 3.0, \
- zerow = 0.05, \
- range = range, \
- thSCD1 = 625, \
- thSCD2 = 160, \
- isse = isse, \
- planar = false)
- # function DePanStabilize(clip, clip data, float cutoff, float damping, bool addzoom, \
- # int prev, int next, int mirror, int blur, int dxmax, int dymax, \
- # float zoommax, float rotmax, int subpixel, float pixaspect, \
- # int fitlast, float tzoom, bool info, string inputlog)
- #
- return (DepanStabilize(clp, \
- data = globalmotion, \
- dxmax = dxmax, \
- dymax = dymax, \
- prev = range, \
- next = range, \
- pixaspect = pixaspect, \
- subpixel = 2, \
- initzoom = 1.0, \
- tzoom = 3.0, \
- addzoom = addzoom, \
- zoommax = zoommax, \
- mirror = mirror, \
- rotmax = rotmax, \
- blur = 300, \
- cutoff = cutoff, \
- damping = 0.9, \
- fitlast = 0, \
- info = false))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement