Guest User

AnimeIVTC_helper

a guest
May 9th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # AnimeIVTC_helper by A.SONY
  2.  
  3. function AnimeIVTC_helper(clip input, bool "Fieldsorderconvert", bool "iaa", bool "aachroma") {
  4. foc = default ( Fieldsorderconvert,        true  )
  5. iaa = default ( iaa,        false  )
  6. chroma  = default ( aachroma,        false  )
  7.  
  8. Assert(!(!foc && !iaa), "why do you use AnimeIVTC_helper then?!")
  9.  
  10. return foc && !iaa ? input.convert_Fields_scan_order : !foc && iaa ? input.interlaced_aa(chroma=chroma) : \
  11. foc && iaa ? input.convert_Fields_scan_order.interlaced_aa(chroma=chroma) : nop()
  12. }
  13.  
  14.  
  15. #############################
  16.  
  17. # convert_Fields_scan_order
  18.  
  19.     FUNCTION convert_Fields_scan_order(clip c1) {
  20. sourcford = c1.getparity() ? 1 : 0
  21. originField = c1.SeparateFields()
  22. newoFields = originField.Trim(1,0)+blankclip(originField,length=1)
  23. return sourcford == 1 ? newoFields.Weave() : newoFields.Weave()
  24. }
  25.  
  26. # Unnoticeable Anti-aliasing for interlaced source
  27.  
  28.     FUNCTION interlaced_aa(clip c1, bool "chroma") {
  29. chroma  = default ( chroma,        false  )
  30. aai = VersionNumber() < 2.60 ? c1.ConvertToYV12(interlaced=true).DoubleWeave().SangNom2(order=0) : chroma && Isyuy2(c1) ? c1.ConvertToYV16.DoubleWeave().SangNom2(order=0,aac=48) : \
  31. !chroma ? c1.ConvertToY8.DoubleWeave().SangNom2(order=0) : c1.DoubleWeave().SangNom2(order=0,aac=48)
  32. newiaaluma = aai.interlaced60or50(bff=c1.getparity() ? false : true)
  33. return VersionNumber() < 2.60 ? YToUV(c1.utoy, c1.vtoy, Isyuy2(c1) ? newiaaluma.ConvertToYUY2 : newiaaluma) : Isyuy2(c1) && chroma ? newiaaluma.ConvertToYuy2 : !chroma ? YToUV(c1.utoy8, c1.vtoy8, newiaaluma) : newiaaluma
  34. }
  35.  
  36. # 60p or 50p progressive to interlaced
  37.  
  38.     FUNCTION interlaced60or50(clip c1, bool "BFF") {
  39. BFF = default ( BFF,        false  )
  40. Ifrate  = round(framerate(c1))==60 ? 1 : framerate(c1)==50 ? 2 : 3
  41. assert(ifrate!=3 && c1.IsFrameBased, "only Frame Based with 50 or ~60 fps is allowed.")
  42.  
  43. desiredoutputfieldorder = BFF ? c1.AssumeTFF() : c1.AssumeBFF() # opposite to the desired output field order
  44. outputfieldDoubleWeave = desiredoutputfieldorder.DoubleWeave()
  45. return outputfieldDoubleWeave.SelectEvery(4,1)
  46. }
Advertisement
Add Comment
Please, Sign In to add comment