[gegl] buffer: tune cubic coefficients away from anomaly
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: tune cubic coefficients away from anomaly
- Date: Mon, 11 May 2020 22:22:59 +0000 (UTC)
commit c6b3632d579752a83c6479318ab3feb295505a40
Author: Øyvind Kolås <pippin gimp org>
Date: Tue May 12 00:14:32 2020 +0200
buffer: tune cubic coefficients away from anomaly
As reported in issue #167, the current coefficients of the cubic
resampler causes a sinuosidal grid anomaly when rotating some noise
patterns, to work around this we bring the sharpness/smoothness
trade-off for the cubic half way back to smooth which also
significantly reduces the strength of the anomaly.
The code for choosing behavior of the cubic resampler by choosing
cubic types via string never worked, as the strcmp were the inverse
of what they should have been. This commit reduces it to only rely
on computing the coefficent from the formula, and adds comments
what the different constants we have used mean.
gegl/buffer/gegl-sampler-cubic.c | 32 +++++++++-----------------------
1 file changed, 9 insertions(+), 23 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-cubic.c b/gegl/buffer/gegl-sampler-cubic.c
index 7b247b7a8..9beacd227 100644
--- a/gegl/buffer/gegl-sampler-cubic.c
+++ b/gegl/buffer/gegl-sampler-cubic.c
@@ -131,29 +131,15 @@ gegl_sampler_cubic_init (GeglSamplerCubic *self)
GEGL_SAMPLER (self)->level[0].context_rect.width = 5;
GEGL_SAMPLER (self)->level[0].context_rect.height = 5;
- self->b=1.0;
- self->c=0.0;
- self->type = g_strdup("cubic");
- if (strcmp (self->type, "cubic"))
- {
- /* cubic B-spline */
- self->b = 1.0;
- self->c = 0.0;
- }
- else if (strcmp (self->type, "catmullrom"))
- {
- /* Catmull-Rom spline */
- self->b = 0.0;
- self->c = 0.5;
- }
- else if (strcmp (self->type, "formula"))
- {
- /*
- * This ensures that the spline is a Keys spline. The c of
- * BC-splines is the alpha of Keys.
- */
- self->c = 0.5 * (1.0 - self->b);
- }
+ self->b=0.5; /* 0.0 = sharp, but with anomaly of issue #167
+ 1.0 = fuzzy cubic, without anomaly
+ 0.5 is a compromise against issue #145 */
+
+ /*
+ * This ensures that the spline is a Keys spline. The c of
+ * BC-splines is the alpha of Keys.
+ */
+ self->c = 0.5 * (1.0 - self->b);
}
static inline void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]