Upscaling Xvid using Avisynth

Posted by admin on Mar 16, 2012 in HTPC, MediaPortal |

I knew that ffdshow could use avisynth for complex scaling and sharpening but only recently had the time to play around with it. I’m pretty happy with the results.

This tutorial was the basis of my experimentation –
http://www.homecinema-hd.com/ffdshow-video-avisynth_en.html

There are a number of software versions of all the associated plugins so these are the ones I used.

Downloaded the standard avisynth 2.6 from SF
googled “avisynth 2.6 MT download” for the Multithreaded version of avisynth –
http://forum.doom9.org/showthread.php?t=148782 and overwrite the avisynth DLL in the windows system directory
googled “LimitedSharpenFaster” for home page –
http://avisynth.org/mediawiki/LimitedSharpen
and downloaded prerequisites masktools-v2.0a48.zip, RemoveGrain.rar and LimitedSharpenFaster.avsi which is in masktools.

Then installed the following script in ffdshow.

SetMemoryMax(512)
SetMTMode(3,4)
ffdshow_source()
SetMTMode(2)
dispWidth = 1920
dispHeight = 1080
mWidth = float(last.width)
mHeight = float(last.height)
ratio = (mWidth/mHeight)
newHeight= round((dispWidth/ratio)/2)*2
newHeight > dispHeight ? Eval("""
newHeight=dispHeight
newWidth=round((newHeight*ratio)/2)*2
""") : Eval("""
newWidth=dispWidth
""")
LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=45)
spline64resize(newWidth,newHeight)
SetMTMode(1)
GetMTMode(false) > 0 ? distributor() : last

Note that LimitedSharpenFaster is placed before the resize because this did not work when placed after it during testing.

The following screen shot shows a comparison with a Kung Fu Panda trailer although its a bit hard to see the difference, the detail is discernable. Kung Fu Panda

A similar improvement can be gained using ffdshow alone by using the built-in resize & aspect filter and resizing to 1920 x 1080. On the settings tab, set the Luma method to spline and the Chroma method to bicubic. Then adjust the Luma and Chroma sharpen settings to around 0.75.

In my opinion, the avisynth sharpening seems slightly warmer and brighter but that’s a subjective personal preference.

This soon to be moot because most dowloaded movies and TV will be in H.264 codec anyway.

Update:
I added an additional filter that provides temporal filtering so the filters in the script now look like this.

FluxSmoothST()
LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=45)
spline64resize(newWidth,newHeight)

Leave a Reply

XHTML: You can use these tags:' <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Copyright © 2008-2017 Brinsmead Data Services All rights reserved.