View difference between Paste ID: WsKz6UU3 and Fnmg63HK
SHOW: | | - or go back to the newest paste.
1-
# AnimeIVTC_helper by A.SONY v1.1
1+
# AnimeIVTC_helper by A.SONY v1.2
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) {
20+
    FUNCTION convert_Fields_scan_order(clip c1, bool "fast") {
21-
originField = c1.SeparateFields()
21+
fast     = default ( fast, true)
22-
newoFields = originField.Trim(1,0)+blankclip(originField,length=1)
22+
originField = !fast ? c1.SeparateFields() : nop()
23-
return newoFields.Weave()
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-
aai = VersionNumber() < 2.60 ? c1.ConvertToYV12(interlaced=true).DoubleWeave().SangNom2(order=0) : chroma && Isyuy2(c1) ? c1.ConvertToYV16.DoubleWeave().SangNom2(order=0,aac=48) : \
30+
31-
!chroma ? c1.ConvertToY8.DoubleWeave().SangNom2(order=0) : c1.DoubleWeave().SangNom2(order=0,aac=48)
31+
32-
newiaaluma = aai.interlaced60or50(bff=c1.getparity() ? false : true)
32+
aai = VersionNumber() < 2.60 ? c1.ConvertToYV12(interlaced=true).DoubleWeave().SangNom2(order=0) : chroma && Isyuy2(c1) ? c1.ConvertToYV16().DoubleWeave().SangNom2(order=0,aac=48) : \
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
33+
!chroma ? c1.ConvertToY8().DoubleWeave().SangNom2(order=0) : c1.DoubleWeave().SangNom2(order=0,aac=48)
34
newiaaluma = aai.maa2(mask=0,maskt=0,ss=3,ss_h=1,chroma=chroma).interlaced60or50(bff=!(c1.getparity()))
35
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
36
}
37
38
# 60p or 50p progressive to interlaced
39
40
    FUNCTION interlaced60or50(clip c1, bool "BFF") {
41
BFF	= default ( BFF,        false  )
42
Ifrate 	= round(framerate(c1))==60 ? 1 : framerate(c1)==50 ? 2 : 3
43
assert(ifrate!=3 && c1.IsFrameBased, "only Frame Based with 50 or ~60 fps is allowed.") 
44
45
desiredoutputfieldorder = BFF ? c1.AssumeTFF() : c1.AssumeBFF() # opposite to the desired output field order
46
outputfieldDoubleWeave = desiredoutputfieldorder.DoubleWeave()
47
return outputfieldDoubleWeave.SelectEvery(4,1)
48
}