View Full Version : nnedi3 resize
yup
26th April 2011, 10:42
IanB now with small remark all work
AVISource("tape12.avi")
AssumeTFF()
SeparateFields()
#ImageSource("TSW Charger V4.4.jpg", end=0) # RGB Format
ConvertToYV24() # No chroma subsampling
nnediresize_YUY2()
function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
v = c.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnleft()
v = v.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnright()
return v
}
function nnediresize_YUY2(clip c)
{
cy = c.ConvertToY8().FastishY8toYV12() # Fast extract Y, blank chroma
cu = c.UtoY8().FastishY8toYV12() # Fast extract U to Y, blank chroma
cv = c.VtoY8().FastishY8toYV12() # Fast extract V to Y, blank chroma
cy = nnediresize2x(cy,true,false,false) # Double height and double width
cu = nnedi3(cu,dh=true,Y=True,U=False,V=False,field=0) # Double height only
cv = nnedi3(cv,dh=true,Y=True,U=False,V=False,field=0) # Double height only
YtoUV(cu,cv,cy) # YV16 output
return ConvertToYUY2() # Lossless conversion to YUY2
}
function FastishY8toYV12(Clip C) {
UV = Blankclip(C, Width=C.Width()/2, Height=C.Height()/2, Color=$808080)
Return YtoUV(UV, UV, C)
}
I can use nnedi3 with YUY2 colorspace, also work with SEt 2.6 build.
yup.
IanB
26th April 2011, 14:40
@Yup,
Note there was an implicit assumption that the source was RGB to get benefit from the above discussion. With AVISource() the default colour space is YV12 with fallback to YUY2 and finally RGB. You need to be aware of the source native attributes to best choose your approach.
With a YV12 source and outputting YUY2 you want to be doing double nnedi3 (times 4) on the vertical chroma.
yup
27th April 2011, 06:06
IanB!
My source colorspace YUY2 (analog capture). What I need changing comparing to Imagesource input?
cu = nnedi3(cu,dh=true,Y=True,U=False,V=False,field=0) # Double height only
cv = nnedi3(cv,dh=true,Y=True,U=False,V=False,field=0) # Double height only
or
AVISource("tape12.avi")
AssumeTFF()
SeparateFields()
ConvertToYV16() # No chroma subsampling
nnediresize_YUY2()
function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
v = c.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnleft()
v = v.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnright()
return v
}
function nnediresize_YUY2(clip c)
{
cy = c.ConvertToY8().FastishY8toYV12() # Fast extract Y, blank chroma
cu = c.UtoY8().FastishY8toYV12() # Fast extract U to Y, blank chroma
cv = c.VtoY8().FastishY8toYV12() # Fast extract V to Y, blank chroma
cy = nnediresize2x(cy,true,false,false) # Double height and double width
cu = nnedi3(cu,dh=true,Y=True,U=False,V=False,field=0).turnleft().nnedi3(dh=true,Y=true,U=false,V=false,field=0).turnright() # Double size
cv = nnedi3(cv,dh=true,Y=True,U=False,V=False,field=0).turnleft().nnedi3(dh=true,Y=true,U=false,V=false,field=0).turnright() # Double size
YtoUV(cu,cv,cy) # YV16 output
return ConvertToYUY2() # Lossless conversion to YUY2
}
function FastishY8toYV12(Clip C) {
UV = Blankclip(C, Width=C.Width()/2, Height=C.Height()/2, Color=$808080)
Return YtoUV(UV, UV, C)
}
Adding turnleft and one more nnedi?
yup.
IanB
27th April 2011, 09:47
@yup,
Looks good, with YUY2 in and YUY2 out then the subsampling is constant so you just double all the heights and all the widths. you can use your nnediresize2x all 3 times.
I am not sure how much you need to dodge around the bugs.
Maybe you do not need to start with ConvertToYV16() as you have. I think UtoY8(). etc works with YUY2 directly.
You do need to put them back together again as YV16 then finally convert to YUY2.
With a fixed version of avisynth, you could skip the initial ConvertToYV16() and use ConvertToYV12() instead of FastishY8toYV12().
And probably via YV16 will be fastest with a fixed version.
:Moderators: Can you please slice these nnedi3 resize posts into a new thread. Apart from the initial bug report it has taken on a life of it's own.
yup
28th April 2011, 06:27
IanB!
Now script little shorter
AVISource("lebbuild.avi")#YUY2 source
AssumeTFF()
SeparateFields()
nnediresize_YUY2()
function nnediresize_YUY2(clip c)
{
cy = c.ConvertToYV12() # Fast extract Y, blank chroma
cu = c.UtoY().ConvertToYV12() # Fast extract U to Y, blank chroma
cv = c.VtoY().ConvertToYV12() # Fast extract V to Y, blank chroma
cy = nnedi3(cy,dh=true,Y=True,U=False,V=False,field=0).turnleft().nnedi3(dh=true,Y=true,U=false,V=false,field=0).turnright() # Double size
cu = nnedi3(cu,dh=true,Y=True,U=False,V=False,field=0).turnleft().nnedi3(dh=true,Y=true,U=false,V=false,field=0).turnright() # Double size
cv = nnedi3(cv,dh=true,Y=True,U=False,V=False,field=0).turnleft().nnedi3(dh=true,Y=true,U=false,V=false,field=0).turnright() # Double size
YtoUV(cu,cv,cy) # YV16 output
return ConvertToYUY2() # Lossless conversion to YUY2
}
Main reason for this script working with YUY2 colorspace, because in Avisynth 2.6 do not work standard function nnedi3_rpow2.
I use this for remove border in analog captured source
Crop(16,12,-16,-12)
nnediresize_YUY2()
Spline64Resize(720,576)
This script work with official 2.6 and SEt builds.
yup.
Boulotaur2024
28th April 2011, 09:25
... If its a split from another discussion it would be nice to introduce a bit more context : I dont really get the point of this function when a simple nnedi_rpow does the trick (?)
yup
29th April 2011, 06:16
@Boulotaur2024
It is useful only for YUY2 colorspace, because for YV12 and RGB24 work without problem Avisynth 2.6.
yup.
Hi all!
Last official Avisynth 2.6 Alpha 3 and Set build now work without problem with nnedi3_rpow2 for YUY2 colorspace.
yup.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.