View difference between Paste ID: Fnmg63HK and NMusp5Qb
SHOW: | | - or go back to the newest paste.
1-
# AnimeIVTC_helper by A.SONY
1+
# AnimeIVTC_helper by A.SONY v1.1
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-
sourcford = c1.getparity() ? 1 : 0
20+
21
originField = c1.SeparateFields()
22
newoFields = originField.Trim(1,0)+blankclip(originField,length=1)
23-
return sourcford == 1 ? newoFields.Weave() : newoFields.Weave()
23+
return 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
}