View Single Post
Old 19th September 2015, 23:15   #1  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
Interlaced VHS Cleaning with resize does not output correct interlaced video

I experiment with a script basically made by johnmeyer. I have added a crop and resize function, and I use autoadjust for Color and Levels, as well as a sharpen stage.

Principally it works fine but the result does not Output a correct interlaced TFF Video. There is something wrong with the fields.

Unfortunately I do not understand why it makes this field mess. It should output a TFF Video as is the Input. I think the various process stages are not in correct order. But how should it be?

Can anybody help me with this. I would appreciate it very much. Here is the VHS script:

Code:
#original Denoiser script for interlaced video using MDegrain2i2_by JMH

SetMemoryMax(1024)
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\mvtools2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\cnr2.dll")

SetMTMode(5,6)
#~ source=AVISource("E:\fs.avi").killaudio().AssumeTFF().waveform().Crop(12, 4, -12, -8)
source=qtinput("D:\videodata.mov", color=2, audio=0).ConvertToYV12.AssumeTFF().Crop(12, 0, -12, -8)  # Crops xx pixels L,T,R,B and resizes to 720x576ilaced:
SetMTMode(2)

#CHROMA RESTAURATION specially for analog source material
chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #for VHS/V8
#chroma=source.Cnr2("oxx",8,14,191,75,255,20,255,false) #for Laserdisc 

#Set overlap in line below to 0, 2, 4, 8. Higher number=better, but slower (BLOCKSIZE/OVERLAP/STRENGTH/DCT) / Increase thSAD Value for more degraining
#~ output=MDegrain2i2(source,4,0,400,0)             #For VHS, better results in shadows
#~ output=MDegrain2i2(source,8,2,300,0)             #For Hi8, good noise reduction
output=MDegrain2i2(chroma,8,4,300,0)               #Retains a little more detail, but slower
#output=MDegrain2i2(chroma,4,2,400,0)               #Better for retaining detail on flat surfaces, but slower still

#-CHOOSE OUTPUT to display compared view or only processed output
output=IResize(output,720,576)
#~ StackHorizontal(source,output)
#~ return output.Levels(16, 1, 235, 0, 255, coring=false)     #simple Level Adjust
return output.AutoAdjust(auto_balance=false, chroma_limit=1.05, auto_gain=true, gain_mode=0, chroma_process=100, gamma_limit=1.25, high_quality=false)  #Auto Color and Level
#~ return output

#-------------------------------

function MDegrain2i2(clip source, int "blksize", int "overlap", int "strength", int "dct")
{
  fields=source.SeparateFields() # separate by fields

  super = fields.MSuper(pel=2, sharp=1)
  backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
  forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
  backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
  forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)

  MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=strength) 
  
  #Optional sharpening steps
  unsharpmask(50,3,0)
  sharpen(0.1)

  Weave()
}

function IResize(clip Clip, int NewWidth, int NewHeight) 
{
  Clip
  SeparateFields() 
  Shift=(GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)
  E  = SelectEven().Spline36resize(NewWidth, NewHeight/2, 0,    Shift)
  O  = SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0,   -Shift)
  Ec = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0,  2*Shift)
  Oc = SelectOdd( ).Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift)
  Interleave(E, O)
  IsYV12() ? MergeChroma(Interleave(Ec, Oc)) : Last
  Weave()
}
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore

Last edited by papcom; 19th September 2015 at 23:18.
papcom is offline   Reply With Quote