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

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th February 2007, 18:19   #101  |  Link
DeathTheSheep
<The VFW Sheep of Death>
 
DeathTheSheep's Avatar
 
Join Date: Dec 2004
Location: Deathly pasture of VFW
Posts: 1,149
The paper states that monotonically decreasing coefficient magnitutes with larger kernel lengths (tending to infinity!) gives less nth degree error.

So then what does "kernel" mean in this sense?
__________________
Recommended all-in-one stop for x264/GCC needs on Windows: Komisar x264 builds!
DeathTheSheep is offline   Reply With Quote
Old 28th February 2007, 22:37   #102  |  Link
Henrikx
Registered User
 
Henrikx's Avatar
 
Join Date: Aug 2005
Location: Germany
Posts: 306
Perhaps this is also interesting for you.
ResizeTest : Upsize/Downsize by Selur
http://gleitz.info/wiki/index.php/We...ize-Filter_%3F
(German)
Testpicture (Downsize)
http://www.heise.de/ct/ftp/testbilder/kameras_0621/
__________________
Henrikx
Henrikx is offline   Reply With Quote
Old 1st March 2007, 00:54   #103  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
Quote:
Originally Posted by DeathTheSheep View Post
So then what does "kernel" mean in this sense?
For each increase in length you add one extra cubic section on both sides of the kernel, an extra lobe so you will.
MfA is offline   Reply With Quote
Old 1st March 2007, 02:06   #104  |  Link
DeathTheSheep
<The VFW Sheep of Death>
 
DeathTheSheep's Avatar
 
Join Date: Dec 2004
Location: Deathly pasture of VFW
Posts: 1,149
Henrikx: Wow, these tests (especially upsizing the 'O') have managed to reaffirm my preference towards high splines.

MfA: I see...! Is this how you found the coefficients for your spline64 experimental plugin?
__________________
Recommended all-in-one stop for x264/GCC needs on Windows: Komisar x264 builds!
DeathTheSheep is offline   Reply With Quote
Old 1st March 2007, 02:43   #105  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
No, it's Wilbert who said he found out how they were calculated ... as I said before, the ones in the splineX filters are not these ones.
MfA is offline   Reply With Quote
Old 1st March 2007, 02:45   #106  |  Link
DeathTheSheep
<The VFW Sheep of Death>
 
DeathTheSheep's Avatar
 
Join Date: Dec 2004
Location: Deathly pasture of VFW
Posts: 1,149
Ah, sorry--must have missed that
__________________
Recommended all-in-one stop for x264/GCC needs on Windows: Komisar x264 builds!
DeathTheSheep is offline   Reply With Quote
Old 1st March 2007, 21:54   #107  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
Quote:
No, it's Wilbert who said he found out how they were calculated ... as I said before, the ones in the splineX filters are not these ones.
That statement was a bit premature

My approach was to work backwards, see what conditions those polynomials satisfied and to recompute the weights of these polynomials.

As everyone can check (by differentiating the polynomials), for Spline16/36/64 the following conditions are satisfied (Spline_k^2):

wj(x) = aj* + bj*x + cj*x^2 + dj*x^3; x in [0,1] (for all x in [0,1] and j=0,..,k-1):
Code:
w0(0) = 0, w0(1) = 0, w1(0) = 0, w1(1) = 1, w2(0) = 1, w2(1) = 0, w3(0) = 0, w3(1) = 0  (a)

w0'(0) = -w3'(1), w0'(1) = -w3'(0), w1'(0) = -w2'(1), w1'(1) = -w2'(0)  (b)

w0''(0) = w3''(1), w0''(1) = w3''(0), w1''(0) = w2''(1), w1''(1) = w2''(0)  (c)
The equations above are for k=4 (Spline16), but the extension to arbitrary k is obvious.

As you can see these are 8 + 4 + 4 = 16 equations, and since we have 16 unknowns (aj,bj,cj,dj for j=0,1,2,3), the system should be solvable. At least that's what i thought yesterday, but i guess these equations are dependent, since i wasn't able to solve for the unknowns.

So we need some additional constraints, but i have no clue which ones. I guess i need to ask my colleagues on sci.math about this.

Two remarks about the constraints above:

1) As you can see the constraints don't connect all the equations. The constrains connect w0(x) and w3(x), and also w1(x) and w2(x), BUT strangely NOT w0(x) and w1(x). I think this is very bad, but i'm not sure what the consequences are.

2) The first derivative constraints: w0'(0) = -w3'(1). This is also very bad. The cubics have to be connected in a smooth way (which can be enforced by the constraints), but they are not. I bet that this causes the ringing that some people see.

Anyhow, on http://mathworld.wolfram.com/CubicSpline.html they give a correct derivation of cubic splines (they show how to solve for the bj coefficients). Solving for the remaining cj/dj coefficients shouldn't be that difficult. I will report about it very soon ...

Last edited by Wilbert; 1st March 2007 at 22:24.
Wilbert is offline   Reply With Quote
Old 2nd March 2007, 01:53   #108  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
The papers say making the sections C2 continuous is enough to get a unique solution (a non optimal one) and I'm inclined to believe them. I'm too lazy to actually do the math (they already give the solution, both for optimal kernels and C2 continuous ones ... I chose to just believe them on their word on those). I checked the continuity of the splineX kernels too though, since they aren't even C1 continuous I don't think this will get you anywhere as far as determining how the SplineX kernels were derived. I think I'll have to go back to my original statements, they are completely ad hoc.

Ringing is an integral part of any linear filter with negative taps, regardless of continuity.

Last edited by MfA; 2nd March 2007 at 03:21.
MfA is offline   Reply With Quote
Old 2nd March 2007, 07:18   #109  |  Link
twolfe18
Registered User
 
twolfe18's Avatar
 
Join Date: Feb 2007
Location: New Jersey
Posts: 86
i just jumped in on this thread like dspider, and i just wanted a bit more detail.

for me, i do mainly conversion of hdtv (mostly 1080i), and i usually downscale to 1024x576. i have noticed the ringing you talk about with lanczos and lanczos4, but do these hold an advantage at higher resolutions?

basically, what is the best hi-res downscaler?
twolfe18 is offline   Reply With Quote
Old 2nd March 2007, 08:27   #110  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,449
From earlier this thread...

http://forum.doom9.org/showthread.ph...474#post956474
http://forum.doom9.org/showthread.ph...735#post957735
and the most important of all,
http://forum.doom9.org/showthread.ph...801#post950801

Such issues are the same no matter what you resize, but the higher the output resolution, the less noticeable any artifacts are.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 3rd March 2007, 01:07   #111  |  Link
DeathTheSheep
<The VFW Sheep of Death>
 
DeathTheSheep's Avatar
 
Join Date: Dec 2004
Location: Deathly pasture of VFW
Posts: 1,149
I was thinking SplineX might be using coefficients chosen by visual trial and error, rather than mathematical nth degree derivative continuity ("optimal" method).

So either:
1. The developers simply don't know what they're doing
2. The developers genuinely thought their version produced better results
3. We're missing something-- perhaps there's a more complicated answer.

Either way, it would be very interesting to see how splineX's implementations match up with the mathematically optimal ones.
__________________
Recommended all-in-one stop for x264/GCC needs on Windows: Komisar x264 builds!
DeathTheSheep is offline   Reply With Quote
Old 3rd March 2007, 15:17   #112  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
Yes the splines are not smooth. Sorry for the confusion in assuming the spline segments were 2nd order smooth.

My current guess is the splines are chosen to most strongly match the segments of a particular, as yet undiscovered, truncated sinc function. Although not identical to the Blackman sinc function, they are surprisingly very close, one would have to suspect the rational for each is related.
IanB is offline   Reply With Quote
Old 4th March 2007, 01:03   #113  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
Quote:
3. We're missing something-- perhaps there's a more complicated answer.
I think it is this one. I added the Spline resizers given at mathworld to the package of foxyshadis. Usage:
Code:
Spline16WResize()/Spline36WResize()/Spline64WResize()
Some early observations:

1) Spline16WResize blurs like hell. Which makes me really curious about Spline16Resize, because it is so much better.

2) Spline36WResize / Spline36Resize have about the same quality.

3) Spline64WResize / Spline64Resize have about the same quality, but both are less sharp as Spline36WResize / Spline36Resize.

Tell me what you think about it:

http://www.savefile.com/files/530858

Last edited by Wilbert; 4th March 2007 at 01:05.
Wilbert is offline   Reply With Quote
Old 4th March 2007, 02:20   #114  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
thanks wilbert. checking them out now
Terranigma is offline   Reply With Quote
Old 4th March 2007, 14:51   #115  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,878
I'm just having a quick look at resample_functions.cpp, and I'm a little confused - shouldn't the number in the spline function correspond to the number of pixels in the window? For example, spline64filter considers values of value from -4 to 4, making an 8x8 window of 64 pixels - as I'd expect. But spline16wfilter also considers value from -4 to 4, which is still 64 pixels, not 16...

Spline36wfilter seems to be using a window size of 144... and so on. Sorry, I've probably missed something important earlier in the thread, but it's something of a pet subject for me.

David
wonkey_monkey is offline   Reply With Quote
Old 4th March 2007, 15:15   #116  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
Quote:
I'm just having a quick look at resample_functions.cpp, and I'm a little confused - shouldn't the number in the spline function correspond to the number of pixels in the window?
Yup.

Quote:
For example, spline64filter considers values of value from -4 to 4, making an 8x8 window of 64 pixels - as I'd expect.
I'm confused. I didn't notice it, but it only uses four equations and not eight! (As far as i can see, they are not symmetric around zero.)

IanB, foxyshadis what did you do with the other equations from this page? Thus w2,w3 for Spline16, w3,w4,w5 for Spline36, etc ...
Wilbert is offline   Reply With Quote
Old 4th March 2007, 18:26   #117  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,878
They are symmetrical, and that's why there are only four equations, because you use the absolute value of value to choose an equation.

In resample_functions.h all four functions return a value for support of 4 - shouldn't that be 2 for the spline16s and 3 for the spline36s?

David

PS:

Quote:
1) Spline16WResize blurs like hell. Which makes me really curious about Spline16Resize, because it is so much better.
I think I might know why that is - with the current equations, the spline shoots up to >1 at around 3.8 (it should go to, and stay at, 0 once it gets to 2).

Last edited by wonkey_monkey; 4th March 2007 at 19:01.
wonkey_monkey is offline   Reply With Quote
Old 4th March 2007, 18:54   #118  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
Quote:
They are symmetrical, and that's why there are only four equations, because you use the absolute value of value to choose an equation.
If you plot them you will see that they are not symmetrical, but perhaps i'm missing something.

Quote:
In resample_functions.h all four functions return a value for support of 4 - shouldn't that be 2 for the spline16s and 3 for the spline36s?
Yup, thanks! That solves the blurring problem of Spline16W!
Wilbert is offline   Reply With Quote
Old 4th March 2007, 19:04   #119  |  Link
DeathTheSheep
<The VFW Sheep of Death>
 
DeathTheSheep's Avatar
 
Join Date: Dec 2004
Location: Deathly pasture of VFW
Posts: 1,149
Here are some screens downsized 2:1 and then upsized again with pointresize:

Spline16:

Spline16w:


The visual evidence certainly does seem to support this conclusion
__________________
Recommended all-in-one stop for x264/GCC needs on Windows: Komisar x264 builds!

Last edited by DeathTheSheep; 4th March 2007 at 19:21.
DeathTheSheep is offline   Reply With Quote
Old 4th March 2007, 19:21   #120  |  Link
DeathTheSheep
<The VFW Sheep of Death>
 
DeathTheSheep's Avatar
 
Join Date: Dec 2004
Location: Deathly pasture of VFW
Posts: 1,149
Quote:
Spline64WResize / Spline64Resize have about the same quality, but both are less sharp as Spline36WResize / Spline36Resize.
I'm not so sure about that--to my eyes, Spline64Resize definitely does seem sharper than Spline36Resize, and resulting filesizes (encodings) are bigger with it, which is a pretty good indication of sharpness, too.

PS: Any chance for re-uploading the "fixed" package? Thanks!
__________________
Recommended all-in-one stop for x264/GCC needs on Windows: Komisar x264 builds!
DeathTheSheep is offline   Reply With Quote
Reply

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 20:04.


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