After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688892 - add other samplers that properly downsample and warp
add other samplers that properly downsample and warp
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: operations
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2012-11-22 20:02 UTC by Nicolas Robidoux
Modified: 2016-05-07 15:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nicolas Robidoux 2012-11-22 20:02:40 UTC
I am putting this enhancement request here so I can point freedomcoders to it, to get some funding to program it.

Right now, only one GEGL sampler is Jacobian-adaptive, which means that only one sampler properly reduces as well as enlarge, and has the internal machinery to deal with general affine transformations and non-affine warps. This sampler is called "LoHalo", and no-one has never seen halo come out of its use, however if is pretty jaggy when enlarging, and it does not suppress moire quite enough when reducing, as well as being on the soft side in this situation.

I propose to remedy this situation as follows:

0) Rename the LoHalo sampler NoHalo. In practical terms, the current LoHalo truly is halo free. My naming it LoHalo was being a perfectionist: In theory, it can let a minuscule amount of halo through.

Recycling the same skeleton, add three samplers:

1) The new LoHalo, which will be sigmoidized EWA (Elliptical Weighted Averaging) with the Robidoux bicubic for upsampling, blended with non-sigmoidized EWA Robidoux for downsampling.
You can obtain this filter with recent ImageMagick with this command when enlarging:
The upsampling component:
convert {input} -colorspace RGB +sigmoidal-contrast 6.5 -distort Resize {size specification, for example, 200%} -sigmoidal-contrast 6.5 -colorspace sRGB {output}
The downsampling component:
convert {input} -colorspace RGB +sigmoidal-contrast 6.5 -distort Resize {size specification, for example, 50%} -sigmoidal-contrast 6.5 -colorspace sRGB {output}

I'll do this one first because I have all the formulas figured out.

2) The new LoJaggy, which will be EWA LanczosSharp (the new version, discussed here: http://www.imagemagick.org/Usage/filter/nicolas/, which is almost identical to the one named LanczosSharp in ImageMagick, also used by the MadVR video renderer) all around (meaning upsampling and downsampling and everything in between).

With ImageMagick:
convert {input} -colorspace RGB -filter Lanczos -define filter:blur=.9891028367558475 -distort Resize {size specification} -colorspace sRGB {output}

3) The new LoBlur, which will be standard tensor Lanczos 3 for upsampling, blended with EWA Lanczos Radius 3 for downsampling.

With ImageMagick:
The upsampling component:
convert {input} -colorspace RGB -filter Lanczos -resize {size spec.} -colorspace sRGB {output}
The downsampling component (with very very recent ImageMagick; otherwise see http://www.imagemagick.org/Usage/filter/nicolas/):
conver {input} -colorspace RGB -filter LanczosRadius -distort Resize {size spec.} -colorspace sRGB {output}

Part of the fun of doing this is actually using recent research work on fast polynomial approximations of complex and expensive functions like the kernel of Lanczos 3 and Jinc-windowed Jinc 3, which hopefully makes the use of Look Up Tables pointless. 2) and 3) require that I run fairly careful computations with a modified version of the Boost C++ Minimax code to get cheap and accurate approximations of the key functions. ImageMagick contains outdated (and not quite suitable for GEGL) versions of such approximations. I'll make sure that other projects that could benefit from this work will get the new formulas as well.
Comment 1 Nicolas Robidoux 2012-11-22 21:16:41 UTC
Typo in the ImageMagick code for the new LoHalo:
The downsampling component:
convert {input} -colorspace RGB -distort Resize {size specification, for example, 50%} -colorspace sRGB {output}
Comment 2 Nicolas Robidoux 2012-11-22 21:18:29 UTC
Other typo: freedomsponsors (not freedomcoders).
Comment 4 Bruno Baumgärtner 2012-12-11 11:45:45 UTC
Hi everyone. I need this bug/feature so much that I'm willing to pay 25.00 bucks for it.
This offer is registered at FreedomSponsors (http://www.freedomsponsors.org/core/issue/78/add-other-samplers-that-properly-reduce-downsample-and-warp-images).
Once you solve it (according to the acceptance criteria described there), just create a FreedomSponsors account and mark it as resolved (oh, you'll need a Paypal account too)
I'll then check it out and will gladly pay up!

If anyone else would like to throw in a few bucks to elevate the priority on this issue, you should check out FreedomSponsors!
Comment 5 Piter Dias 2013-01-03 00:30:05 UTC
Hi everyone. I need this bug/feature so much that I'm willing to pay 20.00 bucks for it.
This offer is registered at FreedomSponsors (http://www.freedomsponsors.org/core/issue/78/add-other-samplers-that-properly-reduce-downsample-and-warp-images).
Once you solve it (according to the acceptance criteria described there), just create a FreedomSponsors account and mark it as resolved (oh, you'll need a Paypal account too)
I'll then check it out and will gladly pay up!

If anyone else would like to throw in a few bucks to elevate the priority on this issue, you should check out FreedomSponsors!
Comment 6 Øyvind Kolås (pippin) 2016-05-07 15:41:10 UTC
Closing this bug since both cubic and linear are now jacobian adaptive as well as nohalo and lohalo being in git master.