Advertisement
Guest User

AnimeIVTC_helper

a guest
Feb 11th, 2017
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # AnimeIVTC_helper by A.SONY v1.3
  2. # and put tcomb before IVTC filter the source has Rainbow and/or Dot Crawl Removal will help, and if it was yuy2 convert it to yv12 will help too, or convert it to y8 (luma only), because the chroma noise may destroy IVTC filter accuracy in some frames
  3.  
  4. function AnimeIVTC_helper(clip input, bool "Fieldsorderconvert", bool "iaa", bool "aachroma") {
  5. foc = default ( Fieldsorderconvert,        true  )
  6. iaa = default ( iaa,        false  )
  7. chroma  = default ( aachroma,        false  )
  8.  
  9. Assert(!(!foc && !iaa), "why do you use AnimeIVTC_helper then?!")
  10.  
  11. return foc && !iaa ? input.convert_Fields_scan_order : !foc && iaa ? input.interlaced_aa(chroma=chroma) : \
  12. foc && iaa ? input.convert_Fields_scan_order.interlaced_aa(chroma=chroma) : nop()
  13. }
  14.  
  15.  
  16. #############################
  17.  
  18. # convert_Fields_scan_order
  19.  
  20.     FUNCTION convert_Fields_scan_order(clip c1, bool "fast") {
  21. fast     = default ( fast, true)
  22. originField = !fast ? c1.SeparateFields() : nop()
  23. newoFields = !fast ? originField.Trim(1,0)+blankclip(originField,length=1) : nop()
  24. newoFields = fast ? c1.DoubleWeave().Selectodd() : newoFields.Weave()
  25. return newoFields
  26. }
  27.  
  28. # Unnoticeable Anti-aliasing for interlaced source
  29.  
  30.     FUNCTION interlaced_aa(clip c1, bool "chroma") {
  31. ssispmt   = Findstr(VersionString(), "AviSynth+") != 0 && Findstr(VersionString(), "r1576") == 0
  32. sislumaonly = ssispmt ? c1.isy() : VersionNumber() < 2.6 ? true : c1.isy8()
  33. chroma  = default ( chroma,        false  )
  34. aai = VersionNumber() < 2.60 ? c1.ConvertToYV12(interlaced=true).DoubleWeave().SangNom2(order=0) : chroma && Isyuy2(c1) ? c1.ConvertToYV16().DoubleWeave().SangNom2(order=0,aac=48) : \
  35. !chroma && !sislumaonly ? ssispmt ? c1.ConvertToY().DoubleWeave().SangNom2(order=0) : c1.ConvertToY8().DoubleWeave().SangNom2(order=0) : c1.DoubleWeave().SangNom2(order=0,aac=48)
  36. newiaaluma = aai.maa2(mask=0,maskt=0,ss=3,ss_h=1,chroma=chroma).interlaced60or50(bff=!(c1.getparity()))
  37. return VersionNumber() < 2.60 ? YToUV(c1.utoy(), c1.vtoy(), Isyuy2(c1) ? newiaaluma.ConvertToYUY2() : newiaaluma) : Isyuy2(c1) && chroma ? newiaaluma.ConvertToYuy2() : !chroma && !sislumaonly ? YToUV(ssispmt ? c1.ExtractU() : c1.utoy8(), ssispmt ? c1.ExtractV() : c1.vtoy8(), newiaaluma) : newiaaluma
  38. }
  39.  
  40. # 60p or 50p progressive to interlaced
  41.  
  42.     FUNCTION interlaced60or50(clip c1, bool "BFF") {
  43. BFF = default ( BFF,        false  )
  44. Ifrate  = round(framerate(c1))==60 ? 1 : framerate(c1)==50 ? 2 : 3
  45. assert(ifrate!=3 && c1.IsFrameBased, "only Frame Based with 50 or ~60 fps is allowed.")
  46.  
  47. desiredoutputfieldorder = BFF ? c1.AssumeTFF() : c1.AssumeBFF() # opposite to the desired output field order
  48. outputfieldDoubleWeave = desiredoutputfieldorder.DoubleWeave()
  49. return outputfieldDoubleWeave.SelectEvery(4,1)
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement