View Full Version : Bicubicresize() and Bob() should default to Catrom, not Mitchell-Netravali
Katie Boundary
4th October 2022, 14:17
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 (https://imagemagick.org/Usage/filter/#lagrange), 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.
hello_hello
4th October 2022, 16:03
Create a couple of wrapper functions with whatever defaults you prefer and use those.
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) }
wonkey_monkey
4th October 2022, 17:51
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
StainlessS
4th October 2022, 19:25
And here Katie CatromResize() as discussed in Katie PM.
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
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.
hello_hello
5th October 2022, 03:36
Resize8 (https://forum.doom9.org/showthread.php?t=183057) has a Catmull-Rom kernel, converted to BicubicResize(b=0, c=0.5)
Resize8(640,480, kernel="Catmull-Rom")
DTL
5th October 2022, 10:37
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)).
Katie Boundary
5th October 2022, 17:11
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.
wonkey_monkey
5th October 2022, 21:11
Yes StainlessS, how dare you try and be helpful. Shame on you!
Sunspark
5th October 2022, 22:23
I really like Mitchell-Netravali with the values b = 1/3, c = 1/3.
StainlessS
6th October 2022, 10:09
how dare you
Yeah, you'd think I'd have learnt by now.
Katie Boundary
7th October 2022, 17:15
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.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.