[gegl] color-reduction: speed up quantize_value by truncating with cast instead of calling floorf
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] color-reduction: speed up quantize_value by truncating with cast instead of calling floorf
- Date: Fri, 26 Feb 2021 15:34:48 +0000 (UTC)
commit 148a8e4627f4d276acf72218655891e601ecd656
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Feb 26 16:34:32 2021 +0100
color-reduction: speed up quantize_value by truncating with cast instead of calling floorf
operations/common/dither.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/operations/common/dither.c b/operations/common/dither.c
index cc66e9d7e..65a1b17cd 100644
--- a/operations/common/dither.c
+++ b/operations/common/dither.c
@@ -73,7 +73,7 @@ quantize_value (guint value,
guint n_levels)
{
float recip = 65535.0 / n_levels;
- return floorf (value / recip) * recip;
+ return (int)(value / recip) * recip;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]