hue-chroma: simplify no chroma condition, and use fabsf

parent 4b04f4e1
......@@ -44,6 +44,7 @@ property_double (lightness, _("Lightness"), 0.0)
#include "gegl-op.h"
#define EPSILON 1e-6f
#include <math.h>
static void
prepare (GeglOperation *operation)
......@@ -79,19 +80,18 @@ process (GeglOperation *op,
while (n_pixels--)
{
if ( ( abs(in_pixel[0]-in_pixel[1])>EPSILON)
&& ( abs(in_pixel[1]-in_pixel[2])>EPSILON ) )
if ((fabsf(in_pixel[1])>EPSILON))
{
out_pixel[0] = in_pixel[0] + lightness;
out_pixel[1] = in_pixel[1] + chroma;
out_pixel[2] = in_pixel[2] + hue;
}
else
{
{
out_pixel[0] = in_pixel[0] + lightness;
out_pixel[1] = in_pixel[1];
out_pixel[2] = in_pixel[2];
}
}
out_pixel[1] = CLAMP (out_pixel[1], 0, 300.0);
out_pixel[3] = in_pixel[3];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment