I've read some articles which introduce fast third-order interpolation using GL_LINEAR.
- [1] http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter20.html
- [2] http://0xef.wordpress.com/2013/01/12/third-order-texture-filtering-using-linear-interpolation/
Because [1] contains lots of errata, I recommend reading [2] if you want to catch the formalism.
Both of them mention the restriction of this method. For filtered texture with GL_LINEAR, next relation holds only if 0 <= b/(a+b) <= 1
a*f(i, j) + b*f(i+1, j) = F(i+b/(a+b), j)
where f is original image data and F is linearly interpolated texture by OpenGL.
Here's the problem. [1] mentions that this method also can be applied to Catmull-Rom bicubic.
the method can also be adapted to interpolating filters such as Catmull-Rom splines
However, it's obvious that with Catmull-Rom weighting function which contains negative parts, the condition(0 <= b/(a+b) <= 1) cannot be fullfiled. In fact, I have tried to implement Catmull-Rom with same logic, it produces just blurry images.
Is there a special way to apply the method in [1] and [2] to Catmull-Rom interpolation? Or Do I have to fetch all 16 texels for Catmull-Rom?
I think that the paper by Sigg and Hadwiger is correct.
Catmull-Rom polynomial
p(t)
can be written aswhere
and
p0
,p1
,p2
,p3
are the sampled function values.For the B-spline, you group together the first two terms, namely
w0(t) * p0
andw1(t) * p1
and the second two terms, namelyw2(t) * p2
andw3(t) * p3
. For the Catmull-Rom spline, you group togetherw0(t) * p0
andw3(t) * p3
andw1(t) * p1
andw2(t) * p2
. It is easy to verify, even by a Matlab plot, that the conditionb/(a+b)
is satisfied for this choice. So, the idea can be used also in Catmull-Rom interpolation. However, for the Catmull-Rom case, it seems to me that there is no possible extension to the last step, since neither(w0(t) + w3(t))/(w0(t) + w1(t) + w2(t) + w3(t))
nor(w1(t) + w2(t))/(w0(t) + w1(t) + w2(t) + w3(t))
meet the condition you specified.