[babl] extensions: u32<->float conversions in simple extension
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] extensions: u32<->float conversions in simple extension
- Date: Sat, 7 Apr 2018 15:08:32 +0000 (UTC)
commit c00621ea91a2afe02a6e85f0b7bd9932346805ee
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Apr 7 17:01:08 2018 +0200
extensions: u32<->float conversions in simple extension
They were using 'float' rather than 'double' data types for intermediate values
the lack of precision made the conversions be discarded by babl.
extensions/simple.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/extensions/simple.c b/extensions/simple.c
index 1d8e750..9bd5d82 100644
--- a/extensions/simple.c
+++ b/extensions/simple.c
@@ -168,7 +168,7 @@ float_to_u32_x1 (const Babl *conversion,unsigned char *src_char, unsigned char *
long n = samples;
while (n--)
{
- float r = src[0];
+ double r = src[0];
dst[0] = (r >= 1.0f) ? 0xFFFFFFFF : ((r <= 0.0f) ? 0x0 : 0xFFFFFFFF * r + 0.5f);
@@ -201,7 +201,7 @@ u32_to_float (const Babl *conversion,unsigned char *src_char, unsigned char *dst
long n = samples;
while (n--)
{
- dst[0] = src[0] / 4294967295.0f;
+ dst[0] = src[0] / 4294967295.0;
dst ++;
src ++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]