Advertisement
tp7

Untitled

tp7
Jan 7th, 2014
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. # Practically Didйe's madness:
  3.  
  4.  
  5. ###############DeblockMT########################
  6.  
  7.  
  8.  
  9.  
  10. function myDeblock(last)
  11. {
  12. o=last
  13. fft   = o.fft3dfilter(sigma=16,sigma2=6,sigma3=1,sigma4=0,bw=12,bh=12,ow=6,oh=6,bt=5,plane=4,ncpu=2)
  14. fftD  = mt_makediff(o,fft,U=3,V=3)
  15. rg11D = mt_makediff(fft,fft.removegrain(20),U=3,V=3).mt_lut("x 128 - 1.49 * 128 +",U=3,V=3)
  16. DD    = mt_lutxy(fftD,rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
  17. #DD  = rg11D.repair(fftD,1) # try: 14,13,12,1  # note: "1", not "11" !
  18. fin   = fft.mt_adddiff(DD,U=3,V=3)
  19. return (fin)
  20. }
  21.  
  22. ###############MCDeblockMT########################
  23.  
  24.  
  25. function MCDeblockMT(last)
  26. {
  27. o=last
  28. vectors = o.MVAnalyse(isb = false, lambda = 1000)
  29. compensation = o.MVCompensate(vectors, mode = 0)
  30. compensation.pre()
  31. return (last)
  32. }
  33.  
  34.  
  35. function Pre(last)
  36. {
  37. o=last
  38. fft   = o.fft3dfilter(sigma=16,sigma2=6,sigma3=1,sigma4=0,bw=12,bh=12,ow=6,oh=6,bt=5,plane=4,ncpu=2)
  39. fftD  = mt_makediff(o,fft,U=3,V=3)
  40. rg11D = mt_makediff(fft,fft.removegrain(20),U=3,V=3).mt_lut("x 128 - 1.49 * 128 +",U=3,V=3)
  41. DD    = mt_lutxy(fftD,rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
  42. #DD  = rg11D.repair(fftD,1) # try: 14,13,12,1  # note: "1", not "11" !
  43. fin   = fft.mt_adddiff(DD,U=3,V=3)
  44. return (last)
  45. }
  46.  
  47.  
  48. #################Soothe###################
  49.  
  50.  
  51. ####Igual que deblockMT pero con compensacion temporal y sharpener de soothe, ejecutar como a continuacion:
  52. #Soothe(last,fin,keep=0)
  53.  
  54.  
  55.  
  56. function fin(last)
  57. {
  58. o     = last
  59. fft   = o.fft3dfilter(sigma=16,sigma2=6,sigma3=1,sigma4=0,bw=12,bh=12,ow=6,oh=6,bt=5,plane=4,ncpu=2)
  60. fftD  = mt_makediff(o,fft,U=3,V=3)
  61. rg11D = mt_makediff(fft,fft.removegrain(20),U=3,V=3).mt_lut("x 128 - 1.49 * 128 +",U=3,V=3)
  62. DD    = mt_lutxy(fftD,rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
  63. #DD  = rg11D.repair(fftD,1) # try: 14,13,12,1  # note: "1", not "11" !
  64. fin   = fft.mt_adddiff(DD,U=3,V=3)
  65. return fin
  66. }
  67.  
  68.  
  69. function Soothe(clip sharp, clip orig, int "keep")
  70. {
  71. Assert(sharp.width == orig.width && sharp.height == orig.height,
  72.  \  "Soothe: clip dimensions must match!")
  73. keep  = default(keep, 24)
  74. keep  = (keep>100) ? 100 : (keep<0) ? 0 : keep
  75. KP    = string(keep)
  76. diff  = mt_makediff(orig,sharp)
  77. diff2 = diff.temporalsoften(1,255,0,32,2)
  78. diff3 = mt_lutxy(diff,diff2,  "x 128 - y 128 - * 0 < x 128 - 100 / "  + KP
  79.  \                           + " * 128 + x 128 - abs y 128 - abs > x " + KP
  80.  \                           + " * y 100 " + KP + " - * + 100 / x ? ?")
  81. return( mt_makediff(orig,diff3,chroma="copy first") )
  82. }
  83.  
  84.  
  85. #################SootheCl###################
  86.  
  87.  
  88.  
  89.  
  90. ####Introduce una nueva variante (Clense) respecto a Soothe y preserva el chroma. Usar como a continuacion:
  91. #SootheCl(last,fin2,keep=0,chroma=true)
  92. # Clense necesita RemoveGrain.dll (a secas) o el paquete RemoveGrain1.0b
  93.  
  94.  
  95. function fin2(last)
  96. {
  97. o     = last
  98. fft   = o.fft3dfilter(sigma=16,sigma2=6,sigma3=1,sigma4=0,bw=12,bh=12,ow=6,oh=6,bt=5,plane=4,ncpu=2)
  99. fftD  = mt_makediff(o,fft,U=3,V=3)
  100. rg11D = mt_makediff(fft,fft.removegrain(20),U=3,V=3).mt_lut("x 128 - 1.49 * 128 +",U=3,V=3)
  101. DD    = mt_lutxy(fftD,rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
  102. #DD  = rg11D.repair(fftD,1) # try: 14,13,12,1  # note: "1", not "11" !
  103. fin   = fft.mt_adddiff(DD,U=3,V=3)
  104. return fin
  105. }
  106.  
  107.  
  108.  
  109. function SootheCl(clip sharp, clip orig, int "keep", bool "chroma")
  110. {
  111. Assert(sharp.width == orig.width && sharp.height == orig.height,
  112.  \  "Soothe: clip dimensions must match!")
  113. chroma= default(chroma,false)
  114. keep  = default(keep, 24)
  115. keep  = (keep>100) ? 100 : (keep<0) ? 0 : keep
  116. uv = chroma ? 3 : 2
  117. KP    = string(keep)
  118. diff  = mt_makediff(orig,sharp,U=uv,V=uv)
  119. diff2 = diff.clense(reduceflicker=false)
  120. diff3 = mt_lutxy(diff,diff2,  "x 128 - y 128 - * 0 < x 128 - 100 / "  + KP
  121.  \                           + " * 128 + x 128 - abs y 128 - abs > x " + KP
  122.  \                           + " * y 100 " + KP + " - * + 100 / x ? ?",U=uv,V=uv)
  123. return( mt_makediff(orig,diff3,U=uv,V=uv) )
  124. }
  125.  
  126.  
  127. ##################MCSoothe###################
  128.  
  129.  
  130. ##Realmente un motion compensated Clense. Usar: MCSoothe()
  131. ##Normalmente mejor acompaсado con un previo Deblock_QED para el blocking estatico (o a traves de un denoiser tipo dfttest)
  132. # Clense necesita RemoveGrain.dll (a secas) o RemoveGrainSSE3.dll/RemoveGrainSSE2.dll de RemoveGrain1.0b.zip
  133.  
  134. function MCsoothe(last)
  135. {
  136. o     = last
  137. fft   = o.fft3dfilter(sigma=16,sigma2=6,sigma3=1,sigma4=0,bw=12,bh=12,ow=6,oh=6,bt=5,plane=4,ncpu=2)
  138. fftD  = mt_makediff(o,fft,U=3,V=3)
  139. rg11D = mt_makediff(fft,fft.removegrain(20),U=3,V=3).mt_lut("x 128 - 1.49 * 128 +",U=3,V=3)
  140. DD    = mt_lutxy(fftD,rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
  141. #DD  = rg11D.repair(fftD,1) # try: 14,13,12,1  # note: "1", not "11" !
  142. fin   = fft.mt_adddiff(DD,U=3,V=3)
  143.  
  144. fftsup=fft.MSuper()
  145. bv = fftsup.MAnalyse(isb=true,blksize=16,overlap=8,truemotion=false)
  146. fv = fftsup.Manalyse(isb=false,blksize=16,overlap=8,truemotion=false)
  147. finD=mt_makediff(o,fin,U=3,V=3)
  148. osup=o.MSuper()
  149. interleave(o.MCompensate(osup,fv,thSCD1=255,thSCD2=255),fin,o.MCompensate(osup,bv,thSCD1=255,thSCD2=255))
  150. raw=Clense(reduceflicker=false).selectevery(3,1)
  151. rawD=mt_makediff(raw,fin,U=3,V=3)
  152. rawDD=mt_lutxy(rawD,finD,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
  153. fin3=fin.mt_adddiff(rawDD,U=3,V=3)
  154. return fin3
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement