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 Development
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 4th October 2022, 14:17   #1  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Bicubicresize() and Bob() should default to Catrom, not Mitchell-Netravali

Catrom is the One True Cubic, a claim that I base on the following two facts:

1) It's the only cubic that preserves linear gradients (it follows the b+2c=1 rule) and also always passes through the original control points/samples (is a "no-op")

2) Spline16, Lagrange-2, Lanczos-2, etc. are all approximations of Catrom and not any other cubic

EDIT: in PSNR tests, it also kicks Mitchell-Netravali's ass all up and down the sidewalk every day of the week and twice on Sundays.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.

Last edited by Katie Boundary; 5th October 2022 at 17:14.
Katie Boundary is offline   Reply With Quote
Old 4th October 2022, 16:03   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Create a couple of wrapper functions with whatever defaults you prefer and use those.

Code:
function KatieBicubic(clip Source, int target_width, int target_height, \
float "src_left", float "src_top", float "src_width", float "src_height", float "B", float "C")  {

B = default(B, 0)
C = default(C, 0.5)

BicubicResize(Source, target_width, target_height, \
src_left=src_left, src_top=src_top, src_width=src_width, src_height=src_height, b=B, c=C)  }
hello_hello is offline   Reply With Quote
Old 4th October 2022, 17:51   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Quote:
Originally Posted by Katie Boundary View Post
Bicubicresize() and Bob() should default to Catrom, not Mitchell-Netravali
It's already been suggested but was rejected for the sake of backwards compatability: http://forum.doom9.net/showthread.php?p=1849921
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 4th October 2022, 19:25   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
And here Katie CatromResize() as discussed in Katie PM.
Code:
Function CatromResize(clip a, int w, int h, float "src_left", float "src_top", float "src_width", float "src_height") {
    src_left   = Default(src_left  ,0.0) # Should provide defaults for optionals, otherwise are UNDEFINED
    src_top    = Default(src_top   ,0.0) #   Ditto : (If client specifies src_top then use it, otherwise default to 0.0)
    src_width  = Default(src_width ,0.0) #   Ditto
    src_height = Default(src_height,0.0) #   Ditto
    BicubicResize(a, w, h, 0, 0.5, src_left, src_top, src_width, src_height)
}

And here slightly more Advanced implementation
Code:
Function CatromResize(clip a, int w, int h, float "src_left", float "src_top", float "src_width", float "src_height") {
    BicubicResize(a, w, h, 0, 0.5, src_left, src_top, src_width, src_height)
}
As we know that BicubicResize() uses defaults of 0.0 for its undefined optional coords (src_left/top/width/height), we can just pass on args (client supplied or Undefined) to
BicubicResize and have it supply its defaults instead [EDIT: when are undefined].
Either we supply 0.0 default, or BicubicResize does, dont really matter which does it,
only need to supply our own defaults if we require different defaults than used by BicubicResize.

Note, HH moved args b,c, to end of arg KatieBicubic() list.

EDIT: Removed "c=" and "b=" from "c=0" and "b=0.5" [leaving the above in blue]
Otherwise need supply all of the src left/src_top etc together with names.
Once you supply a named argument in a function call, all following supplied args (if any) MUST also be supplied named.

UNTESTED,

EDIT: Katie, use one of above. PM script functions bugged due to red line above.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th October 2022 at 20:19.
StainlessS is offline   Reply With Quote
Old 5th October 2022, 03:36   #5  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Resize8 has a Catmull-Rom kernel, converted to BicubicResize(b=0, c=0.5)

Resize8(640,480, kernel="Catmull-Rom")

Last edited by hello_hello; 5th October 2022 at 03:43.
hello_hello is offline   Reply With Quote
Old 5th October 2022, 10:37   #6  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,075
Lanczos are sinc weighted by sinc and may be very 'long' in taps. It is from DSP-theory of signals processing. Bicubic is fixed number of samples kernel and not based on sinc. Lanczos2 uses same number of taps also may looks close to some bicubic b,c but the curve still not the equal I think because bicubic is based on different basis function (x^n, not sin(x)).
DTL is offline   Reply With Quote
Old 5th October 2022, 17:11   #7  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Quote:
Originally Posted by StainlessS View Post
And here Katie CatromResize() as discussed in Katie PM.
This is a discussion of what AVIsynth default behavior should be. It has nothing to do with the creation of custom AVSI files. In our PM conversations, I was merely using Catrom as an example to better understand how AVSI scripting works in general.

Also, your inbox is full.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Old 5th October 2022, 21:11   #8  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Yes StainlessS, how dare you try and be helpful. Shame on you!
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 5th October 2022, 22:23   #9  |  Link
Sunspark
Registered User
 
Join Date: Nov 2015
Posts: 473
I really like Mitchell-Netravali with the values b = 1/3, c = 1/3.
Sunspark is offline   Reply With Quote
Old 6th October 2022, 10:09   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
how dare you
Yeah, you'd think I'd have learnt by now.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 7th October 2022, 17:15   #11  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,056
Quote:
Originally Posted by StainlessS View Post
Yeah, you'd think I'd have learnt by now.
I'm not criticizing or complaining. I'm clarifying the purpose of the thread so that discussions can be properly contained.
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Reply


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 02:13.


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