PDA

View Full Version : Downsizing: Input = x264, Output = x264


nakTT
5th September 2009, 09:25
I heard that some filters (Lancoz, Bicubic and all) are good for upsizing and some are for downsizing but I don't know which is which because some of my friend tell me one thing and some of them tell me the other. Perhaps some of you experts here can help me with this. (forgive me for my English)

:thanks:

J_Darnley
5th September 2009, 09:41
It is based on opinions, with some facts. The usual order of sharpness is said to be: lanczos > spline > bicubic > bilinear.

Selur
5th September 2009, 09:42
Choosing the right Resizer is mostly a choice of personal taste.
Over in the german doom9 we did some small tests some time ago for upsizing:
http://img295.imageshack.us/img295/3108/resizersjd0.png
using:
small = blankclip(width=16,height=16,pixel_type="YUY2",color=$000000).addborders(8,8,8,8,color=$FFFFFF)
\ .subtitle("o",x=11,y=4,size=20)
\ .levels(16,1.0,235,0,255,false).levels(0,1.0,255,40,192,false)

b1 = small.BilinearResize(128,128) #Bilinear (Soft)
b2 = small.BicubicResize(128,128,0.0,0.75) # Bicubic(Sharp)
b3 = small.BicubicResize(128,128,0.0,0.5) # Bicubic(Neutral)
b4 = small.BicubicResize(128,128,0.0,1) # Bicubic(Soft)
b5 = small.LanczosResize(128,128) # LanczosResize(Sharp)
b6 = small.Lanczos4Resize(128,128) # Lanczos4Resize(Sharp)
b7 = small.SimpleResize(128,128) #SimpleResize (Soft)
b8 = small.GaussResize(128,128) #GaussResize (Neutral)
b9 = small.PointResize(128,128) # Point (Sharp)
b10 = small.Spline16Resize(128,128) # Spline16 (Neutral)
b11 = small.Spline16Resize(128,128) # Spline36 (Neutral)
b12 = small.GaussResize(128,128, p=75) #GaussResize (Sharp)

Y = StackVertical(StackHorizontal(StackHorizontal(b1, StackHorizontal(b2,b3)),StackHorizontal(b4, StackHorizontal(b5,b6))),StackHorizontal(StackHorizontal(b7, StackHorizontal(b8,b9)),StackHorizontal(b10, StackHorizontal(b11,b12))))


small2 = blankclip(width=16,height=16,pixel_type="YUY2",color=$000000).addborders(8,8,8,8,color=$FFFFFF)
\ .subtitle("x",x=11,y=4,size=20)
\ .levels(16,1.0,235,0,255,false).levels(0,1.0,255,40,192,false)

b21 = small2.BilinearResize(128,128) #Bilinear (Soft)
b22 = small2.BicubicResize(128,128,0.0,0.75) # BiCubic (Sharp)
b23 = small2.BicubicResize(128,128,0.0,0.5) # BiCubic (Neutral)
b24 = small2.BicubicResize(128,128,0.0,1) # BiCubic (Soft)
b25 = small2.LanczosResize(128,128) # LanczosResize (Sharp)
b26 = small2.Lanczos4Resize(128,128) # Lanczos4Resize (Sharp)
b27 = small2.SimpleResize(128,128) #SimpleResize (Soft)
b28 = small2.GaussResize(128,128) #GaussResize (Neutral)
b29 = small2.PointResize(128,128) # Point (Sharp)
b210 = small2.Spline16Resize(128,128) # Spline16 (Neutral)
b211 = small2.Spline16Resize(128,128) # Spline36 (Neutral)
b212 = small2.GaussResize(128,128, p=75) #GaussResize (Sharp)

X = StackVertical(StackHorizontal(StackHorizontal(b21, StackHorizontal(b22,b23)),StackHorizontal(b24, StackHorizontal(b25,b26))),StackHorizontal(StackHorizontal(b27, StackHorizontal(b28,b29)),StackHorizontal(b210, StackHorizontal(b211,b212))))

return StackVertical(X,Y)

and
http://img106.imageshack.us/img106/2262/resizersdi9.png
using:
small=blankclip(length=1,width=16,height=16,pixel_type="YUY2",color=$0000FF).AddBorders(8,8,8,8,color=$FF0000)
\ .subtitle("o",x=11,y=4,size=20,text_color=$00FF00,halo_color=$FFFFFF)

b1 = small.BilinearResize(128,128).meInfo("Bilinear (Soft)")
b2 = small.BicubicResize(128,128,0.0,0.75).meInfo("Bicubic(Sharp)")
b3 = small.BicubicResize(128,128,0.0,0.5).meInfo("Bicubic(Neutral)")
b4 = small.BicubicResize(128,128,0.333,0.333).meInfo("Bicubic(Soft)")
b5 = small.LanczosResize(128,128).meInfo("LanczosResize(Sharp)")
b6 = small.Lanczos4Resize(128,128).meInfo("Lanczos4Resize(Sharp)")
b7 = small.SimpleResize(128,128).meInfo("SimpleResize(Soft)")
b8 = small.GaussResize(128,128).meInfo("GaussResize(Neutral)")
b9 = small.PointResize(128,128).meInfo("Point (Sharp)")
b10 = small.Spline16Resize(128,128).meInfo("Spline16(Neutral)")
b11 = small.Spline16Resize(128,128).meInfo("Spline36(Neutral)")
b12 = small.GaussResize(128,128,p=75).meInfo("GaussResize(Sharp)")

small=blankclip(length=1,width=16,height=16,pixel_type="YUY2",color=$0000FF).AddBorders(8,8,8,8,color=$FF0000)
\ .subtitle("x",x=11,y=4,size=20,text_color=$00FF00,halo_color=$FFFFFF)

b21 = small.BilinearResize(128,128).meInfo("Bilinear (Soft)")
b22 = small.BicubicResize(128,128,0.0,0.75).meInfo("Bicubic(Sharp)")
b23 = small.BicubicResize(128,128,0.0,0.5).meInfo("Bicubic(Neutral)")
b24 = small.BicubicResize(128,128,0.333,0.333).meInfo("Bicubic(Soft)")
b25 = small.LanczosResize(128,128).meInfo("LanczosResize(Sharp)")
b26 = small.Lanczos4Resize(128,128).meInfo("Lanczos4Resize(Sharp)")
b27 = small.SimpleResize(128,128).meInfo("SimpleResize(Soft)")
b28 = small.GaussResize(128,128).meInfo("GaussResize(Neutral)")
b29 = small.PointResize(128,128).meInfo("Point (Sharp)")
b210 = small.Spline16Resize(128,128).meInfo("Spline16(Neutral)")
b211 = small.Spline16Resize(128,128).meInfo("Spline36(Neutral)")
b212 = small.GaussResize(128,128,p=75).meInfo("GaussResize(Sharp)")


StackVertical(StackVertical(StackHorizontal(b1,b2,b3,b4,b5,b6),StackHorizontal(b7,b8,b9,b10,b11,b12)),StackVertical(StackHorizontal(b21,b22,b23,b24,b25,b26),StackHorizontal(b27,b28,b29,b210,b211,b212)))

function meInfo(clip a, string b){
return a.AddBorders(8,8,8,8,color=$FFFFFF).Subtitle(b,align=8,font="kroeger 08_53",size=12,text_color=$000000,halo_color=$FFFFFF)
}

we also did a small comparison for downsizing with:
big = ImageSource("Test.png", end=1).convertToYuY2()


b1 = big.BilinearResize(320,240).meInfo("Bilinear (Soft)")
b2 = big.BicubicResize(320,240,0.0,0.75).meInfo("Bicubic(Sharp)")
b3 = big.BicubicResize(320,240,0.0,0.5).meInfo("Bicubic(Neutral)")
b4 = big.BicubicResize(320,240,0.333,0.333).meInfo("Bicubic(Soft)")
b5 = big.LanczosResize(320,240).meInfo("LanczosResize(Sharp)")
b6 = big.Lanczos4Resize(320,240).meInfo("Lanczos4Resize(Sharp)")
b7 = big.SimpleResize(320,240).meInfo("SimpleResize(Soft)")
b8 = big.GaussResize(320,240).meInfo("GaussResize(Neutral)")
b9 = big.PointResize(320,240).meInfo("Point (Sharp)")
b10 = big.Spline16Resize(320,240).meInfo("Spline16(Neutral)")
b11 = big.Spline16Resize(320,240).meInfo("Spline36(Neutral)")
b12 = big.GaussResize(320,240,p=75).meInfo("GaussResize(Sharp)")

StackHorizontal(StackVertical(b1,b2,b3),StackVertical(b4,b5,b6),StackVertical(b7,b8,b9),StackVertical(b10,b11,b12))

function meInfo(clip a, string b){
return a.AddBorders(8,8,8,8,color=$FFFFFF).Subtitle(b,align=8,font="kroeger 08_53",size=12,text_color=$000000,halo_color=$FFFFFF)
} but the input and output images aren't online anymore, but with the script you can do your own comparision.

Cu Selur

Dark Shikari
5th September 2009, 09:46
What in the world does this have to do with x264?

nakTT
5th September 2009, 09:59
Choosing the right Resizer is mostly a choice of personal taste.
Over in the german doom9 we did some small tests some time ago for upsizing:

we also did a small comparison for downsizing with:

but the input and output images aren't online anymore, but with the script you can do your own comparision.

Cu Selur
Selur,

Thank you so much for the info. Any idea how can I use the script to do my own very simple comparison? (Noob here :D)

:thanks:



What in the world does this have to do with x264?
Forgive me for my ignorance. Its because of the input and output is in x264 so I thought it might be different for x264 than others even if it is just a slightest one.

foxyshadis
5th September 2009, 11:41
I'm just going to move this to the newbs forum, seems to fit here.

The effect on x264 will be small, but if you want to see it, just make 3-5 similar avisynth scripts from your source, and encode them all with x264 --crf 21. You'll see a size difference in each, the blurrier ones are smaller, the sharper ones are larger. If you encode to a constant size, the blurrier ones are smoother, and the sharper ones have more noise and blocking. You get the most detail with lanczos or spline, when downsizing, but you have to pay a size or noise penalty.