Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 12th October 2012, 06:24   #1  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
5 new interpolation kernels (via DitherTools)

They are made available through a simple function "firniture".

example usage:
Code:
firniture(720, 400, kernel="noalias4", gamma=false)
The different interpolation methods are selected via the kernel string. The available options are as follows.

"binomial5", "binomial7": A binomial windowed sinc filter with 5 or 7 taps. Should have the least ringing of any available interpolator, except perhaps "noaliasnoring4".

"maxflat5", "maxflat8": 5 or 8 tap interpolation that is maximally flat in the passband. In English, these filters have a sharp and relatively neutral look, but can have ringing and aliasing problems.

"noalias4": A 4 tap filter hand designed to be free of aliasing while having acceptable ringing and blurring characteristics. Not always a good choice, but sometimes very useful.

"noaliasnoring4": Derived from the "noalias4" kernel, but modified to have reduced ringing. Other attributes are slightly worse.

"wall7": A windowed sinc function intended to be an alternative to high-tap lanczos. [edit] removed because it wasn't actually any better.

taps: [edit] Thanks to Didée pointing out some oversights on my part (I threw the baby out with the bathwater when I found StrCmpi() to be 2.6 only) , this parameter is now mostly superfluous. It has been retained so that you can truncate the kernels to shorter taps then they would normally use

gamma: Set to true to turn on gamma correction for the y channel. Off by default.

Otherwise it may be used as any of avisynths internal resizing functions; However, due to the method in which dithertools utilizes custom coeficients, accuracy will decrease when resizing by more then a factor of two. Maximum accuracy is only technically achieved when resizing by an exact factor of two, either up or down. This is most likely to manifest when using the non-sinc derived kernels, but is not generally an issue.

Code:
function firniture(clip c, int width_, int height_, string "kernel", int "taps", bool "gamma")
{
	binomial5 = string("8 0 -589 0 11203 0 -93355 0 606836 1048576 606836 0 -93355 0 11203 0 -589 0 8")
	binomial7 = string("146 0 -20294 0 744006 0 -11528384 0 94148472 0 -487836876 0 2551884458 4294967296 2551884458 0 -487836876 0 94148472 0 -11528384 0 744006 0 -20294 0 146")

	maxflat5 = string("-259 1524 -487 -12192 17356 42672 -105427 -85344 559764 1048576 559764 -85344 -105427 42672 17356 -12192 -487 1524 -259")
	maxflat8 = string(" 2 -26  166 -573  912 412 1524 -589 -12192 17356 42672 -105427 -85344 606836 1048576 606836 -85344 -105427 42672 17356 -12192 -589 1524 412 912 -573 166 -26 2 ")

	noalias4 = string("-1 2 4 -6 -17 7 59 96 59 7 -17 -6 4 2 -1")
	noaliasnoring4 = string("-1 8  40  -114 -512 360  3245 5664 3245 360 -512 -114 40 8 -1")

	kernel_ = Default(kernel, "binomial7")
	taps = Default(taps, int(value(rightstr(kernel,1))))
	gamma = default(gamma, false) 

	in = c
	out = in.Dither_convert_8_to_16
	out = gamma ? out.Dither_y_gamma_to_linear : out
	out = out.Dither_resize16(width_, height_, 0, 0, 0, 0, kernel="impulse "+string(Eval(kernel_))+"", kovrspl=2, taps=taps)
	out = gamma ? out.Dither_y_linear_to_gamma : out
	out = out.DitherPost
	
return(out)
}

[edit] updated the no-alias kernels, removed wall7 (it wasn't useful).
[edit2] remembered to update the example usage so that it functions after the changes.

Last edited by *.mp4 guy; 10th December 2012 at 05:15.
*.mp4 guy is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.