Until now babl_fish_lut_process_maybe() was always returning 0, even
when a LUT existed, hence a LUT-based conversion happened.
This was bad, first because it was inefficient (the point of the LUT is
that we didn't have to process through usual conversion code paths). But
worse: when the source and destination buffers were the same, we would
end up getting wrong result (since we'd have the source converted
in-place, then re-converted, hence double conversion!).
This was the reason for issue #84 (see screenshot showing very wrong
colors because of double conversion).
static float timings[256] = {0,};
-static inline void _do_lut (uint32_t *lut,
+static inline int _do_lut (uint32_t *lut,
int source_bpp,
int dest_bpp,
const void *__restrict__ source,
src+=3;
}
}
+ else
+ {
+ return 0;
+ }
+ return 1;
}
}
if (lut)
{
- _do_lut (lut, source_bpp, dest_bpp, source, destination, n);
- BABL(babl)->fish_path.last_lut_use = babl_ticks ();
+ if (_do_lut (lut, source_bpp, dest_bpp, source, destination, n))
+ {
+ BABL(babl)->fish_path.last_lut_use = babl_ticks ();
+ return 1;
+ }
}
return 0;
}