Guest

Untitled

By: a guest on Apr 16th, 2011  |  syntax: None  |  size: 3.09 KB  |  hits: 169  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\tivtc.dll")
  2. LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
  3. LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\fieldhint.dll")
  4.  
  5.  
  6. DGDecode_Mpeg2Source("M:\TEMP\Andromeda Stories\Andromeda.d2v")
  7.  
  8.  
  9. FieldHint(ovr="M:\TEMP\Andromeda Stories\Andromeda.d2v.fh.txt")
  10.  
  11.  
  12. TDecimate(mode=1,cycle=5,ovr="M:\TEMP\Andromeda Stories\Andromeda.d2v.dec.txt")
  13.  
  14.  
  15. # now we are going to normalise the fuzzy right border.
  16. # the filtering uses masking and the pre-made masks always limit it to just one column.
  17. # imask3.bmp limits to column 718, imask4.bmp limits to column 717.
  18. # (they are black images of 16x480 resolution with a white line in the appropiate place).
  19.  
  20.  
  21. fm3 = imagesource(file  = "M:\TEMP\terra e\imask3.bmp").converttoyv12(matrix="PC.601").mt_binarize()
  22. fm4 = imagesource(file  = "M:\TEMP\terra e\imask4.bmp").converttoyv12(matrix="PC.601").mt_binarize()
  23.  
  24.  
  25.  
  26. prefixcol = last
  27. workcol = crop(704,0,0,0)
  28.  
  29.  
  30. mt_merge(workcol,workcol.tweak(cont=1.250,sat=1.0),fm3, luma = true)
  31. mt_merge(last,workcol.tweak(cont=1.029,sat=1.74),fm4, luma = true)
  32.  
  33.  
  34. fixcol = last
  35. stackhorizontal(prefixcol.crop(0,0,-16,0),fixcol)
  36.  
  37.  
  38. # following line is useful to determine the values for tweak and check the effect
  39. #
  40.  
  41. #return interleave(prefixcol.crop(704,0,0,0).pointresize(200,height).subtitle("before"),last.crop(704,0,0,0).pointresize(200,height))
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. # Now we are going to mess with the look.
  50. #
  51. # The DVD has very very rough grain/noise/dirt/artifacts in the brightest areas.
  52. # Apparently this is caused by scanning the film from a negative.
  53. # In bright parts, the negative is black and very little light arrives to the sensor there.
  54. # Thus the scanner's sensor's noise floor manifests and you end up with this heavy noise
  55. # in bright areas. Normaly we don't want degraining, but in this case teh noise has questionable
  56. # effect on the look of the video (possibly because the noise was turned into artifacts
  57. # by the mpeg2 compression?) and it also dramatically increases the bitrate needed for encoding.
  58. #
  59. # For this reason, we are going to selectively filter the bright areas with mdegrain2.
  60. # A mask is used, one that weights the strength of the degraining based on brightness of a pixel.
  61. # The curve is non-linear to protect the dark parts and make the effect stronger in bright ones.
  62.  
  63.  
  64.  
  65. source = last
  66.  
  67. prefilt = FFT3Dgpu(sigma=3,bw=32,bh=32,bt=3,ow=16,oh=16,plane=4,precision=1) # this affects only the motion search, preventing misdecissions due to noise.
  68.  
  69. superfilt = prefilt.MSuper(pel=2, sharp=1)
  70. super = MSuper(pel=2, sharp=1)
  71. backward_vec2 = MAnalyse(superfilt, isb = true, delta = 2, overlap=4)
  72. backward_vec1 = MAnalyse(superfilt, isb = true, delta = 1, overlap=4)
  73. forward_vec1 = MAnalyse(superfilt, isb = false, delta = 1, overlap=4)
  74. forward_vec2 = MAnalyse(superfilt, isb = false, delta = 2, overlap=4)
  75.  
  76. degrain = source.MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=100)
  77.  
  78.  
  79. mask = source.mt_lut("x 3.10 ^ 42000 /").blur(0.3)
  80. mt_merge(source,degrain,mask,luma=true)
  81.  
  82.  
  83.  
  84.  
  85.  
  86. Crop(4,0,-2,-2)