Fwd: GIMP Levels operation fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,  I sent this simple fix to mitch, however I'm too impatient to
wait for mitch to check his inbox,
So I'm now passing it onto this mailing list.
Basically it fixes over/underflow in the Levels op; with the attached
image, the bug gives the appearance of a triangle wave repeating
gradient, instead of a readjusted single gradient for the channel
being adjusted.


---------- Forwarded message ----------
From: David Gowers <00ai99@xxxxxxxxx>
Date: Jan 31, 2008 5:45 PM
Subject: GIMP Levels operation
To: Michael Natterer <mitch@xxxxxxxx>


I've just found a bug in the Levels op -- if the selected low/hi input
endpoints of a channel are
(low -> more than the lowest non-empty histogram entry; or high ->less
than the highest non-empty histogram entry for the channel)
then underflow/overflow happens.
Adjusting any of the input range sliders to fall into that range will
show this behaviour up.
Using the channels dialog to disable all but one channel also helps. I
would say you have simply forgotten to clip the input values before
mapping them to output values. *pokes around* indeed, I've attached a
very short patch that performs correct clipping. With this patch, GEGL
levels op matches old levels behaviour in all tests I could contrive.

Attachment: testimage.png
Description: PNG image

Index: app/gegl/gimpoperationlevels.c
===================================================================
--- app/gegl/gimpoperationlevels.c	(revision 24754)
+++ app/gegl/gimpoperationlevels.c	(working copy)
@@ -87,6 +87,8 @@
   else
     value = (value - low_input);
 
+  value = CLAMP (value, 0.0, 1.0 );
+
   if (gamma != 0.0)
     {
       if (value >= 0.0)
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux