Advertisement
Guest User

Untitled

a guest
Mar 10th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.70 KB | None | 0 0
  1. # Function Stab()
  2. #
  3. function Stab(clip clp, int "range", int "dxmax", int "dymax", float "trust", float "pixaspect", \
  4. float "zoommax", int "mirror")
  5. {
  6. range = default(range, 1)
  7. dxmax = default(dxmax, 4)
  8. dymax = default(dymax, 3)
  9. trust = default(trust, 0.0)
  10. zoommax = default(zoommax, 1.0)
  11. mirror = default(mirror, 0)
  12.  
  13. pixaspect = default(pixaspect, 1.094) # PAL 720x576
  14. # pixaspect = default(pixaspect, 1.0) # PAL 768x576 (640x480)
  15.  
  16. temp = clp.TemporalSoften(7, 255, 255, 25, 2)
  17. inter = Interleave(temp.Repair(clp.TemporalSoften(1, 255, 255, 25, 2)), clp)
  18.  
  19. # DePanEstimate(clip, int range, float trust, int winx, int winy, int dxmax, int dymax, \
  20. # float zoommax, bool improve, float stab, float pixaspect, bool info, \
  21. # string log, bool debug, bool show, bool fftw)
  22. #
  23. mdata = DePanEstimate(inter, \
  24. dxmax = dxmax, \
  25. dymax = dymax, \
  26. pixaspect = pixaspect, \
  27. zoommax = zoommax, \
  28. improve = true, \
  29. range = range, \
  30. trust = trust)
  31.  
  32. # DePan(clip, clip data, float offset, int subpixel, float pixaspect, bool matchfields, \
  33. # int mirror, int blur, bool info, string inputlog)
  34. #
  35. DePan(inter, \
  36. data = mdata, \
  37. pixaspect = pixaspect, \
  38. subpixel = 2, \
  39. mirror = mirror, \
  40. matchfields = true, \
  41. blur = 100, \
  42. offset = -1)
  43.  
  44. return (SelectEvery(2, 0))
  45. }
  46.  
  47.  
  48.  
  49. # Function Stab2()
  50. #
  51. function Stab2(clip clp, int "range", int "dxmax", int "dymax", float "trust", \
  52. float "pixaspect", float "zoommax", float "rotmax", float "cutoff", \
  53. bool "rot", int "mirror", bool "addzoom")
  54. {
  55. range = default(range, 2)
  56. dxmax = default(dxmax, 4) # 4 : 3
  57. dymax = default(dymax, 3) # 4 : 3
  58. trust = default(trust, 2.0)
  59.  
  60. pixaspect = default(pixaspect, 1.094) # PAL 720x576
  61. # pixaspect = default(pixaspect, 1.0) # PAL 768x576
  62.  
  63. addzoom = default(addzoom, true)
  64. zoommax = default(zoommax, 1.05)
  65. cutoff = default(cutoff, 0.1)
  66. rot = default(rot, true)
  67. rotmax = default(rotmax, 0.5)
  68. mirror = default(mirror, 15)
  69.  
  70.  
  71. # Global Motion Stabilization
  72. # ?????????? ???????????? ???????????
  73. #
  74. # DePanEstimate(clip, int range, float trust, int winx, int winy, int dxmax, int dymax, \
  75. # float zoommax, bool improve, float stab, float pixaspect, bool info, \
  76. # string log, bool debug, bool show, bool fftw)
  77. #
  78. mdata = DePanEstimate(clp, \
  79. dxmax = dxmax, \
  80. dymax = dymax, \
  81. pixaspect = pixaspect, \
  82. zoommax = zoommax, \
  83. improve = true, \
  84. range = range, \
  85. trust = trust)
  86.  
  87. # function DePanStabilize(clip, clip data, float cutoff, float damping, bool addzoom, \
  88. # int prev, int next, int mirror, int blur, int dxmax, int dymax, \
  89. # float zoommax, float rotmax, int subpixel, float pixaspect, \
  90. # int fitlast, float tzoom, bool info, string inputlog)
  91. #
  92. return (DepanStabilize(clp, \
  93. data = mdata, \
  94. dxmax = dxmax, \
  95. dymax = dymax, \
  96. prev = range, \
  97. next = range, \
  98. pixaspect = pixaspect, \
  99. subpixel = 2, \
  100. cutoff = cutoff, \
  101. initzoom = 1.0, \
  102. tzoom = 3.0, \
  103. addzoom = addzoom, \
  104. zoommax = zoommax, \
  105. rotmax = rotmax, \
  106. mirror = mirror, \
  107. blur = 100, \
  108. fitlast = 0, \
  109. damping = 0.9, \
  110. info = false))
  111. }
  112.  
  113. # Function Stab3()
  114. #
  115. function Stab3(clip clp, int "range", int "dxmax", int "dymax", float "pixaspect", \
  116. float "zoommax", float "rotmax", float "cutoff", \
  117. bool "rot", int "mirror", bool "addzoom")
  118. {
  119. # Constants
  120. # MSuper()
  121. #
  122. blkh = 8 ## Change this constant, must be 4, 8, 16, 32
  123. blkv = 8 ## Change this constant, must be 4, 8, 16, 32
  124. pel = 4
  125. chroma = true
  126. isse = true
  127.  
  128. # Constants
  129. # MAnalyse()
  130. #
  131. blkh2 = blkh * 2 # Must be 4, 8, 16, 32
  132. blkv2 = blkv * 2 # Must be 4, 8, 16, 32
  133. (blkh2 > 32) ? 32 : blkh2
  134. (blkv2 > 32) ? 32 : blkv2
  135. overlap = blkh2 / 2
  136. overlapV = blkv2 / 2
  137. lambda = 100 * blkh2 * blkv2 / 64
  138. lsad = 400 * blkh2 * blkv2 / 64
  139.  
  140.  
  141. # Default variables values
  142. #
  143. dxmax = default(dxmax, 4) # 4 : 3
  144. dymax = default(dymax, 3) # 4 : 3
  145. range = default(range, 2)
  146.  
  147. pixaspect = default(pixaspect, 1.094) # PAL 720x576
  148. # pixaspect = default(pixaspect, 1.0) # PAL 768x576
  149.  
  150. zoommax = default(zoommax, 1.05)
  151. rotmax = default(rotmax, 0.5)
  152. cutoff = default(cutoff, 0.1)
  153. rot = default(rot, true)
  154. mirror = default(mirror, 15)
  155. addzoom = default(addzoom, true)
  156.  
  157.  
  158. # Global Motion stabilization
  159. # ?????????? ???????????? ???????????
  160. #
  161. # function FFT3DFilter(clip, float "sigma", float "beta", int "plane", int "bw", int "bh", int "bt", int "ow", int "oh", \
  162. # float "ratio", float "sharpen", float "scutoff", float "svr", float "smin", float "smax", bool "measure", \
  163. # bool "interlaced", int "wintype", int "pframe", int "px", int "py", bool "pshow", float "pcutoff", \
  164. # float "pfactor", float "sigma2", float "sigma3", float "sigma4", float "degrid", float "dehalo", \
  165. # float "hr", float "ht", int "ncpu")
  166. #
  167. prefiltered = FFT3DFilter(clp, \
  168. sigma = 3, \
  169. plane = 4, \
  170. bt = 4, \
  171. sharpen = 0.75, \
  172. interlaced = false, \
  173. dehalo = 1.0, \
  174. ncpu = 2)
  175.  
  176. # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
  177. # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
  178. #
  179. prefilteredSuper = MSuper(prefiltered, \
  180. hpad = blkh, \
  181. vpad = blkv, \
  182. pel = pel, \
  183. levels = 1, \
  184. chroma = chroma, \
  185. sharp = 2, \
  186. rfilter = 4, \
  187. isse = isse, \
  188. planar = false)
  189.  
  190. # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
  191. # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
  192. # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
  193. # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
  194. # int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
  195. #
  196. vectors = MAnalyse(prefilteredSuper, \
  197. blksize = blkh2, \
  198. blksizeV = blkv2, \
  199. overlap = overlap, \
  200. overlapV = overlapV, \
  201. isb = false, \
  202. chroma = chroma, \
  203. delta = 1, \
  204. truemotion = false, \
  205. global = true, \
  206. dct = 5, \
  207. search = 5, \
  208. searchparam = 8, \
  209. plevel = 0, \
  210. divide = 0, \
  211. pnew = 25, \
  212. lsad = lsad, \
  213. lambda = lambda, \
  214. badSAD = 400, \
  215. temporal = true, \
  216. isse = isse)
  217.  
  218. # function MDepan(clip, clip vectors, clip "mask", bool "zoom", bool "rot", float "pixaspect", float "error", bool "info", \
  219. # string "log", float "wrong", float "zerow", int "range", int "thSCD1", int "thSCD2", bool "isse", bool planar)
  220. #
  221. globalmotion = MDepan(prefiltered, \
  222. vectors, \
  223. pixaspect = pixaspect, \
  224. range = range, \
  225. zoom = addzoom, \
  226. rot = rot, \
  227. error = 80.0, \
  228. wrong = 3.0, \
  229. zerow = 0.05, \
  230. thSCD1 = 625, \
  231. thSCD2 = 160, \
  232. isse = isse, \
  233. info = false, \
  234. planar = false)
  235.  
  236. # function DePanStabilize(clip, clip data, float cutoff, float damping, bool addzoom, \
  237. # int prev, int next, int mirror, int blur, int dxmax, int dymax, \
  238. # float zoommax, float rotmax, int subpixel, float pixaspect, \
  239. # int fitlast, float tzoom, bool info, string inputlog)
  240. #
  241. return (DepanStabilize(clp, \
  242. data = globalmotion, \
  243. dxmax = dxmax, \
  244. dymax = dymax, \
  245. prev = range, \
  246. next = range, \
  247. pixaspect = pixaspect, \
  248. subpixel = 2, \
  249. rotmax = rotmax, \
  250. initzoom = 1.0, \
  251. tzoom = 3.0, \
  252. addzoom = addzoom, \
  253. zoommax = zoommax, \
  254. mirror = mirror, \
  255. blur = 300, \
  256. cutoff = cutoff, \
  257. damping = 0.9, \
  258. fitlast = 0, \
  259. info = false))
  260. }
  261.  
  262. # Function Stab4()
  263. #
  264. function Stab4(clip clp, int "range", int "dxmax", int "dymax", float "pixaspect", \
  265. float "zoommax", float "rotmax", float "cutoff", \
  266. bool "rot", int "mirror", bool "addzoom")
  267. {
  268. # Constants
  269. # MSuper()
  270. #
  271. blkh = 8 ## Change this constant, must be 4, 8, 16, 32
  272. blkv = 8 ## Change this constant, must be 4, 8, 16, 32
  273. pel = 4
  274. chroma = true
  275. isse = true
  276. sharp = 2
  277. rfilter = 2
  278.  
  279. # Constants
  280. # MAnalyse()
  281. #
  282. blkh2 = blkh * 2 # Must be 4, 8, 16, 32
  283. blkv2 = blkv * 2 # Must be 4, 8, 16, 32
  284. (blkh2 > 32) ? 32 : blkh2
  285. (blkv2 > 32) ? 32 : blkv2
  286. overlap2 = blkh2 / 2
  287. overlapV2 = blkv2 / 2
  288. lambda = 100 * blkv2 * blkh2 / 64
  289. lsad = 400 * blkv2 * blkh2 / 64
  290. dct = 5
  291. search = 5
  292. searchparam = 8
  293. pnew = 25
  294. truemotion = false
  295.  
  296. # Constants
  297. # MRecalculate()
  298. #
  299. blkhR = blkh # Must be 4, 8, 16, 32
  300. blkvR = blkv # Must be 4, 8, 16, 32
  301. overlapR = blkhR / 2
  302. overlapVR = blkvR / 2
  303. lambdaRecalc = 100 * blkvR * blkhR / 64
  304.  
  305.  
  306. # Default variables values
  307. #
  308. dxmax = default(dxmax, 4) # 4 : 3
  309. dymax = default(dymax, 3) # 4 : 3
  310. range = default(range, 2)
  311.  
  312. pixaspect = default(pixaspect, 1.094) # PAL 720x576
  313. # pixaspect = default(pixaspect, 1.0) # PAL 768x576
  314.  
  315. zoommax = default(zoommax, 1.05)
  316. rotmax = default(rotmax, 0.5)
  317. cutoff = default(cutoff, 0.1)
  318. rot = default(rot, true)
  319. mirror = default(mirror, 15)
  320. addzoom = default(addzoom, true)
  321.  
  322.  
  323. # Global Motion Stabilization
  324. # ?????????? ???????????? ???????????
  325. #
  326. # function FFT3DFilter(clip, float "sigma", float "beta", int "plane", int "bw", int "bh", int "bt", int "ow", int "oh", \
  327. # float "ratio", float "sharpen", float "scutoff", float "svr", float "smin", float "smax", bool "measure", \
  328. # bool "interlaced", int "wintype", int "pframe", int "px", int "py", bool "pshow", float "pcutoff", \
  329. # float "pfactor", float "sigma2", float "sigma3", float "sigma4", float "degrid", float "dehalo", \
  330. # float "hr", float "ht", int "ncpu")
  331. #
  332. prefiltered = FFT3DFilter(clp, \
  333. sigma = 3, \
  334. plane = 4, \
  335. bt = 4, \
  336. sharpen = 0.75, \
  337. interlaced = false, \
  338. dehalo = 1.0, \
  339. ncpu = 2)
  340.  
  341. # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
  342. # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
  343. #
  344. prefiltered2 = MSuper(clp, \
  345. hpad = blkh, \
  346. vpad = blkv, \
  347. pel = pel, \
  348. levels = 0, \
  349. chroma = chroma, \
  350. sharp = sharp, \
  351. rfilter = rfilter, \
  352. isse = isse, \
  353. planar = false)
  354.  
  355. # function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
  356. # int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
  357. #
  358. prefilteredSuper = MSuper(prefiltered, \
  359. hpad = blkh, \
  360. vpad = blkv, \
  361. pel = pel, \
  362. levels = 1, \
  363. chroma = chroma, \
  364. sharp = sharp, \
  365. rfilter = rfilter, \
  366. isse = isse, \
  367. planar = false)
  368.  
  369. # function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
  370. # int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
  371. # int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
  372. # int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
  373. # int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
  374. #
  375. vectors = MAnalyse(prefiltered2, \
  376. blksize = blkh2, \
  377. blksizeV = blkv2, \
  378. overlap = overlap2, \
  379. overlapV = overlapV2, \
  380. isb = false, \
  381. chroma = chroma, \
  382. delta = 1, \
  383. temporal = true, \
  384. search = search, \
  385. searchparam = searchparam, \
  386. dct = dct, \
  387. plevel = 0, \
  388. pnew = pnew, \
  389. lambda = lambda, \
  390. lsad = lsad, \
  391. truemotion = truemotion, \
  392. global = true, \
  393. divide = 0, \
  394. badSAD = 400, \
  395. isse = isse)
  396.  
  397. # function MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \
  398. # int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \
  399. # int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \
  400. # int "sadx264", bool "isse")
  401. #
  402. vectorsRecalc = MRecalculate(prefilteredSuper, \
  403. vectors, \
  404. blksize = blkhR, \
  405. blksizeV = blkvR, \
  406. overlap = overlapR, \
  407. overlapV = overlapVR, \
  408. search = search, \
  409. searchparam = searchparam, \
  410. dct = dct, \
  411. lambda = lambdaRecalc, \
  412. pnew = pnew, \
  413. truemotion = truemotion, \
  414. thsad = 100)
  415.  
  416. # function MDepan(clip, clip vectors, clip "mask", bool "zoom", bool "rot", float "pixaspect", float "error", bool "info", \
  417. # string "log", float "wrong", float "zerow", int "range", int "thSCD1", int "thSCD2", bool "isse", bool planar)
  418. #
  419. globalmotion = MDepan(prefiltered, \
  420. vectorsRecalc, \
  421. zoom = addzoom, \
  422. rot = rot, \
  423. pixaspect = pixaspect, \
  424. error = 80.0, \
  425. info = false, \
  426. wrong = 3.0, \
  427. zerow = 0.05, \
  428. range = range, \
  429. thSCD1 = 625, \
  430. thSCD2 = 160, \
  431. isse = isse, \
  432. planar = false)
  433.  
  434. # function DePanStabilize(clip, clip data, float cutoff, float damping, bool addzoom, \
  435. # int prev, int next, int mirror, int blur, int dxmax, int dymax, \
  436. # float zoommax, float rotmax, int subpixel, float pixaspect, \
  437. # int fitlast, float tzoom, bool info, string inputlog)
  438. #
  439. return (DepanStabilize(clp, \
  440. data = globalmotion, \
  441. dxmax = dxmax, \
  442. dymax = dymax, \
  443. prev = range, \
  444. next = range, \
  445. pixaspect = pixaspect, \
  446. subpixel = 2, \
  447. initzoom = 1.0, \
  448. tzoom = 3.0, \
  449. addzoom = addzoom, \
  450. zoommax = zoommax, \
  451. mirror = mirror, \
  452. rotmax = rotmax, \
  453. blur = 300, \
  454. cutoff = cutoff, \
  455. damping = 0.9, \
  456. fitlast = 0, \
  457. info = false))
  458.  
  459. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement