Page MenuHome

Adding bicubic sampling to the compositor.
Needs ReviewPublic

Authored by Jeroen Bakker (jbakker) on Jan 19 2015, 7:22 PM.

Details

Reviewers
None
Group Reviewers
Compositing
Summary

The compositor had already a pipeline for bicubic sampling, but it was attached to the bilinear methods as OpenCL has no bicubic sampling. This patch enables bicubic sampling on CPU. This does not make a visual difference between GPU and CPU as the effected operations are CPU only.

This will solve some differences between 2.63 and 2.64 (lenz distortion + mapUV)

Diff Detail

Event Timeline

Jeroen Bakker (jbakker) retitled this revision from to Adding bicubic sampling to the compositor..
Jeroen Bakker (jbakker) updated this object.

That's kind of changes where tests are needed before commit. Bicubic might introduce some fuzzyness into picture which artists might not want.

Would poke @venomgfx and @Sebastian Koenig (sebastian_k) to play with the patch first.

P.S. From code it seems fine, just needs some feedback on usage.

source/blender/compositor/operations/COM_ReadBufferOperation.cpp
87

Blender style is to indent case one more.

The fuzzy is because cubic never passes through the sampled values.

Adding the prefilter results in perfect crossing.

Updated patch to latest master (31e26bb83bd0a538c76fd8bb6ebce65027dde94c)
If arc still fails, I should use the arc tool.

I think it might be useful to recall a few references to maybe finally get some cubic B-Spline sampling in Blender:
Patch by Troy Sobotka: https://developer.blender.org/T30411
His visual demonstration: http://wiki.blender.org/index.php/User:Sobotka/Cubic_B-Spline_Scaling_Algorithm
My more technical rationale: http://lists.blender.org/pipermail/bf-committers/2011-August/033142.html
Some generic interpolation introduction: http://www.ipol.im/pub/art/2011/g_lmii

Again, cubic B-Spline interpolation requires the same arithmetic as Keys "bicubic" on sampling.
The downside being that in order to be a correctly implemented _interpolant_, the samples must be prefiltered (once), which is mostly an integration issue.
The prefilter is a first order IIR, i.e simple enough to be only bandwidth bound (two pass per dimension).
So for images which are only going to be resampled once, a small correctly windowed sinc (total 2 pass using separation instead of 5 (4 prefilter + sample)) might be more bandwidth efficient.