summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-05-11 19:06:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-05-11 19:06:29 +0000
commit43a66b09a6f1c3a2538932247445229931129153 (patch)
tree0b8e2ea0116c1fae0f3c921d9c5f687d23feb28b
parentReleasing progress-linux version 0.1.38-1~dschinn1. (diff)
downloadbabl-43a66b09a6f1c3a2538932247445229931129153.zip
babl-43a66b09a6f1c3a2538932247445229931129153.tar.xz
Merging upstream version 0.1.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--INSTALL10
-rw-r--r--Makefile.in12
-rw-r--r--NEWS10
-rw-r--r--README80
-rw-r--r--aclocal.m446
-rw-r--r--babl/Makefile.in4
-rw-r--r--babl/babl-cache.c12
-rw-r--r--babl/babl-conversion.c251
-rw-r--r--babl/babl-conversion.h9
-rw-r--r--babl/babl-fish-path.c343
-rw-r--r--babl/babl-fish-reference.c98
-rw-r--r--babl/babl-fish-simple.c5
-rw-r--r--babl/babl-fish.c1
-rw-r--r--babl/babl-fish.h21
-rw-r--r--babl/babl-format.c2
-rw-r--r--babl/babl-internal.h25
-rw-r--r--babl/babl-introspect.c6
-rw-r--r--babl/babl-model.c2
-rw-r--r--babl/babl-palette.c18
-rw-r--r--babl/babl-trc.c9
-rw-r--r--babl/babl-type.c2
-rw-r--r--babl/babl-version.h2
-rw-r--r--babl/babl.h9
-rw-r--r--babl/base/Makefile.in4
-rw-r--r--babl/base/util.h7
-rwxr-xr-xconfig.guess113
-rwxr-xr-xconfig.sub69
-rwxr-xr-xconfigure30
-rw-r--r--configure.ac2
-rwxr-xr-xdepcomp6
-rw-r--r--docs/Makefile.in4
-rw-r--r--docs/graphics/Makefile.in4
-rw-r--r--export-symbols2
-rw-r--r--extensions/CIE.c249
-rw-r--r--extensions/Makefile.in4
-rw-r--r--extensions/gggl.c7
-rw-r--r--extensions/sse2-float.c17
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/Makefile.in7
-rw-r--r--tests/palette.c2
-rw-r--r--tools/Makefile.in4
41 files changed, 870 insertions, 646 deletions
diff --git a/INSTALL b/INSTALL
index d2dc506..ca84018 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
-babl 0.1.38
+babl 0.1.40
Dynamic; any to any, pixel format conversion library.
@@ -12,10 +12,10 @@ From a released version the following is the expected method of
installation (or a variation on this theme):
------------------------------------------------------------
- foo$ wget ftp://ftp.gtk.org/pub/babl/0.1/babl-0.1.38.tar.bz2
- foo$ tar jxf babl-0.1.38.tar.gz
- foo$ cd babl-0.1.38
- foo/babl-0.1.38$ ./configure && make && sudo make install
+ foo$ wget ftp://ftp.gtk.org/pub/babl/0.1/babl-0.1.40.tar.bz2
+ foo$ tar jxf babl-0.1.40.tar.gz
+ foo$ cd babl-0.1.40
+ foo/babl-0.1.40$ ./configure && make && sudo make install
------------------------------------------------------------
diff --git a/Makefile.in b/Makefile.in
index 97334f6..a74e6d5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -666,7 +666,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
@@ -691,7 +691,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
- shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
@@ -709,7 +709,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
@@ -719,7 +719,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
diff --git a/NEWS b/NEWS
index fba23b6..253def8 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,16 @@ The NEWS file in the babl source tree is the source location for
the news section both in the README and the webpage.
-->
+
+2018-01-16 babl-0.1.40 </dt><dd>
+Added format "CIE XYZ alpha" color model and formats.
+New API babl_process_rows for reduced overhead in some scenarios; though bigger
+gains seen also for regular babl_process with reimplemented branch-free
+dispatch, and faster cbrt. Added meson build; being tested in parallel with
+auotmake, Improved reference conversions for formats skipping some of models
+components, Fixed gamma handling in indexed/palettized formats and improved
+gamma precision consistenct in sse2 conversions.<br/>
+ </dd><dt>
2017-11-15 babl-0.1.38 </dt><dd>
Added format "CIE L float", a couple of protections against division by 0.0
</dd><dt>
diff --git a/README b/README
index d213b53..eff3461 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Babl-0.1.38
+Babl-0.1.40
Contents
@@ -64,6 +64,15 @@ babl release. If there are significant improvements to babl when a GEGL
release is done a babl release is most often put out just prior to the
GEGL release.
+2018-01-16 babl-0.1.40
+ Added format "CIE XYZ alpha" color model and formats. New API
+ babl_process_rows for reduced overhead in some scenarios; though
+ bigger gains seen also for regular babl_process with reimplemented
+ branch-free dispatch, and faster cbrt. Added meson build; being
+ tested in parallel with auotmake, Improved reference conversions
+ for formats skipping some of models components, Fixed gamma
+ handling in indexed/palettized formats and improved gamma precision
+ consistenct in sse2 conversions.
2017-11-15 babl-0.1.38
Added format "CIE L float", a couple of protections against
division by 0.0
@@ -483,6 +492,23 @@ components
CIE H(ab)
A
+CIE XYZ
+
+components
+
+ CIE X
+ CIE Y
+ CIE Z
+
+CIE XYZ alpha
+
+components
+
+ CIE X
+ CIE Y
+ CIE Z
+ A
+
HCYA
components
@@ -1674,6 +1700,31 @@ components
double CIE H(ab)
double A
+CIE XYZ double
+
+bytes/pixel
+ 24
+model
+ CIE XYZ
+components
+
+ double CIE X
+ double CIE Y
+ double CIE Z
+
+CIE XYZ alpha double
+
+bytes/pixel
+ 32
+model
+ CIE XYZ alpha
+components
+
+ double CIE X
+ double CIE Y
+ double CIE Z
+ double A
+
CIE Lab float
bytes/pixel
@@ -1686,6 +1737,31 @@ components
float CIE a
float CIE b
+CIE XYZ float
+
+bytes/pixel
+ 12
+model
+ CIE XYZ
+components
+
+ float CIE X
+ float CIE Y
+ float CIE Z
+
+CIE XYZ alpha float
+
+bytes/pixel
+ 16
+model
+ CIE XYZ
+components
+
+ float CIE X
+ float CIE Y
+ float CIE Z
+ float A
+
CIE Lab alpha float
bytes/pixel
@@ -2204,4 +2280,4 @@ Massimo Valentini
Ell
fast paths
-/babl-0.1.38
+/babl-0.1.40
diff --git a/aclocal.m4 b/aclocal.m4
index a0c40b0..8897626 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.15'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -408,7 +408,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -605,7 +605,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -626,7 +626,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -648,7 +648,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -683,7 +683,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -733,7 +733,7 @@ rm -f confinc confmf
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -772,7 +772,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -801,7 +801,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -848,7 +848,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -867,7 +867,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -948,7 +948,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1008,7 +1008,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1036,7 +1036,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1055,7 +1055,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/babl/Makefile.in b/babl/Makefile.in
index 0c871d6..dbb85f3 100644
--- a/babl/Makefile.in
+++ b/babl/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/babl/babl-cache.c b/babl/babl-cache.c
index dcc76f4..75780b5 100644
--- a/babl/babl-cache.c
+++ b/babl/babl-cache.c
@@ -119,9 +119,6 @@ babl_fish_serialize (Babl *fish, char *dest, int n)
snprintf (d, n, "\tpixels=%li", fish->fish.pixels);
n -= strlen (d);d += strlen (d);
- snprintf (d, n, " processings=%i", fish->fish.processings);
- n -= strlen (d);d += strlen (d);
-
snprintf (d, n, " cost=%d", (int)fish->fish_path.cost);
n -= strlen (d);d += strlen (d);
@@ -145,8 +142,7 @@ static int compare_fish_pixels (const void *a, const void *b)
{
const Babl **fa = (void*)a;
const Babl **fb = (void*)b;
- return ((*fb)->fish.pixels - (*fa)->fish.pixels) +
- ((*fb)->fish.processings - (*fa)->fish.processings);
+ return ((*fb)->fish.pixels - (*fa)->fish.pixels);
}
static const char *cache_header (void)
@@ -240,7 +236,7 @@ void babl_init_db (void)
case '-': /* finalize */
if (babl)
{
- if (((babl->fish.pixels + babl->fish.processings) % 100) == (tim % 100))
+ if ((babl->fish.pixels) == (tim % 100))
{
/* 1% chance of individual cached conversions being dropped -
* making sure mis-measured conversions do not
@@ -309,10 +305,6 @@ void babl_init_db (void)
{
babl->fish.pixels = strtol (token2 + 7, NULL, 10);
}
- else if (!strncmp (token2, "processings=", 12))
- {
- babl->fish.processings = strtol (token2 + 12, NULL, 10);
- }
token2 = strtok_r (NULL, seps2, &tokp2);
}
}
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index 17dccf8..8add99a 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -34,6 +34,114 @@ static int model_is_rgba (const Babl *model)
return 0;
}
+
+static void
+babl_conversion_plane_process (BablConversion *conversion,
+ const void *source,
+ void *destination,
+ int src_pitch,
+ int dst_pitch,
+ long n,
+ void *user_data)
+{
+ conversion->function.plane ((void*)conversion, source, destination,
+ src_pitch, dst_pitch,
+ n,
+ user_data);
+}
+
+static void
+babl_conversion_planar_process (const Babl *babl,
+ const char *src,
+ char *dst,
+ long n,
+ void *user_data)
+{
+ BablConversion *conversion = (void*)babl;
+ const BablImage *source = (void*)src;
+ BablImage *destination = (void*)dst;
+#ifdef USE_ALLOCA
+ const char **src_data = alloca (sizeof (void *) * source->components);
+ char **dst_data = alloca (sizeof (void *) * destination->components);
+#else
+ const char *src_data[BABL_MAX_COMPONENTS];
+ char *dst_data[BABL_MAX_COMPONENTS];
+#endif
+
+ memcpy (src_data, source->data, sizeof (void *) * source->components);
+ memcpy (dst_data, destination->data, sizeof (void *) * destination->components);
+ conversion->function.planar ((void*)conversion,
+ source->components,
+ src_data,
+ source->pitch,
+ destination->components,
+ dst_data,
+ destination->pitch,
+ n,
+ user_data);
+}
+
+static void dispatch_plane (const Babl *babl,
+ const char *source,
+ char *destination,
+ long n,
+ void *user_data)
+{
+ const BablConversion *conversion = &babl->conversion;
+ const void *src_data = NULL;
+ void *dst_data = NULL;
+ int src_pitch = 0;
+ int dst_pitch = 0;
+
+ if (BABL_IS_BABL (source))
+ {
+ BablImage *img;
+
+ img = (BablImage *) source;
+ src_data = img->data[0];
+ src_pitch = img->pitch[0];
+ }
+ if (BABL_IS_BABL (destination))
+ {
+ BablImage *img = (BablImage *) destination;
+
+ dst_data = img->data[0];
+ dst_pitch = img->pitch[0];
+ }
+
+ if (!src_data)
+ src_data = source;
+ if (!src_pitch)
+ src_pitch = BABL (conversion->source)->type.bits / 8;
+ if (!dst_data)
+ dst_data = destination;
+ if (!dst_pitch)
+ dst_pitch = BABL (conversion->destination)->type.bits / 8;
+
+ babl_conversion_plane_process ((void*)conversion,
+ src_data, dst_data,
+ src_pitch, dst_pitch,
+ n, user_data);
+}
+
+static inline void
+babl_conversion_rig_dispatch (const Babl *babl)
+{
+ BablConversion *conversion = (BablConversion *) babl;
+ switch (BABL (conversion)->class_type)
+ {
+ case BABL_CONVERSION_PLANE:
+ conversion->dispatch = dispatch_plane;
+ break;
+ case BABL_CONVERSION_PLANAR:
+ conversion->dispatch = babl_conversion_planar_process;
+ break;
+ case BABL_CONVERSION_LINEAR:
+ conversion->dispatch = conversion->function.linear;
+ break;
+ }
+}
+
Babl *
_conversion_new (const char *name,
int id,
@@ -111,7 +219,6 @@ _conversion_new (const char *name,
babl->conversion.cost = 69L;
babl->conversion.pixels = 0;
- babl->conversion.processings = 0;
babl->conversion.data = user_data;
@@ -144,6 +251,7 @@ _conversion_new (const char *name,
babl->conversion.error = 0.0;
}
+ babl_conversion_rig_dispatch (babl);
return babl;
}
@@ -309,141 +417,6 @@ babl_conversion_new (const void *first_arg,
return babl;
}
-static void
-babl_conversion_linear_process (BablConversion *conversion,
- const void *source,
- void *destination,
- long n)
-{
- conversion->function.linear ((void*)conversion, source, destination, n, conversion->data);
-}
-
-static void
-babl_conversion_plane_process (BablConversion *conversion,
- const void *source,
- void *destination,
- int src_pitch,
- int dst_pitch,
- long n)
-{
- conversion->function.plane ((void*)conversion, source, destination,
- src_pitch, dst_pitch,
- n,
- conversion->data);
-}
-
-static void
-babl_conversion_planar_process (BablConversion *conversion,
- BablImage *source,
- BablImage *destination,
- long n)
-{
-#ifdef USE_ALLOCA
- const char **src_data = alloca (sizeof (void *) * source->components);
- char **dst_data = alloca (sizeof (void *) * destination->components);
-#else
- const char *src_data[BABL_MAX_COMPONENTS];
- char *dst_data[BABL_MAX_COMPONENTS];
-#endif
-
- memcpy (src_data, source->data, sizeof (void *) * source->components);
- memcpy (dst_data, destination->data, sizeof (void *) * destination->components);
- conversion->function.planar ((void*)conversion,
- source->components,
- src_data,
- source->pitch,
- destination->components,
- dst_data,
- destination->pitch,
- n,
- conversion->data);
-}
-
-long
-babl_conversion_process (const Babl *babl,
- const char *source,
- char *destination,
- long n)
-{
- BablConversion *conversion = (BablConversion *) babl;
-
- babl_assert (BABL_IS_BABL (conversion));
-
- switch (BABL (conversion)->class_type)
- {
- case BABL_CONVERSION_PLANE:
- {
- const void *src_data = NULL;
- void *dst_data = NULL;
- int src_pitch = 0;
- int dst_pitch = 0;
-
- if (BABL_IS_BABL (source))
- {
- BablImage *img;
-
- img = (BablImage *) source;
- src_data = img->data[0];
- src_pitch = img->pitch[0];
- }
- if (BABL_IS_BABL (destination))
- {
- BablImage *img = (BablImage *) destination;
-
- dst_data = img->data[0];
- dst_pitch = img->pitch[0];
- }
-
- if (!src_data)
- src_data = source;
- if (!src_pitch)
- src_pitch = BABL (conversion->source)->type.bits / 8;
- if (!dst_data)
- dst_data = destination;
- if (!dst_pitch)
- dst_pitch = BABL (conversion->destination)->type.bits / 8;
-
- babl_conversion_plane_process (conversion,
- src_data, dst_data,
- src_pitch, dst_pitch,
- n);
- }
- break;
-
- case BABL_CONVERSION_PLANAR:
- babl_assert (BABL_IS_BABL (source));
- babl_assert (BABL_IS_BABL (destination));
-
- babl_conversion_planar_process (conversion,
- (BablImage *) source,
- (BablImage *) destination,
- n);
- break;
-
- case BABL_CONVERSION_LINEAR:
- /* the assertions relied on a babl_malloc structure
- *
- * babl_assert (!BABL_IS_BABL (source));
- babl_assert (!BABL_IS_BABL (destination));*/
-
- babl_conversion_linear_process (conversion,
- source,
- destination,
- n);
- break;
-
- default:
- babl_log ("args=(%s, %p, %p, %li) unhandled conversion type: %s",
- conversion->instance.name, source, destination, n,
- babl_class_name (conversion->instance.class_type));
- return 0;
- break;
- }
-
- conversion->processings++;
- conversion->pixels += n;
- return n;
-}
long
babl_conversion_cost (BablConversion *conversion)
@@ -537,10 +510,6 @@ babl_conversion_error (BablConversion *conversion)
ref_destination_rgba_double,
test_pixels * 4);
- fish_rgba_to_source->fish.processings--;
- fish_reference->fish.processings--;
- fish_destination_to_rgba->fish.processings -= 2;
-
fish_rgba_to_source->fish.pixels -= test_pixels;
fish_reference->fish.pixels -= test_pixels;
fish_destination_to_rgba->fish.pixels -= 2 * test_pixels;
@@ -567,4 +536,6 @@ const Babl *babl_conversion_get_destination_space (const Babl *conversion)
return conversion->conversion.destination->format.space;
}
+
+
BABL_CLASS_IMPLEMENT (conversion)
diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h
index 1f8f8ab..023625a 100644
--- a/babl/babl-conversion.h
+++ b/babl/babl-conversion.h
@@ -42,6 +42,10 @@ _BablConversion {
BablInstance instance;
const Babl *source;
const Babl *destination;
+ void (*dispatch) (const Babl *babl, const char *src, char *dst, long n,
+ void *user_data);
+ void *data; /* user data */
+
long cost;
double error;
union
@@ -50,9 +54,10 @@ _BablConversion {
BablFuncPlane plane;
BablFuncPlanar planar;
} function;
- void *data; /* user data */
- int processings;
long pixels;
};
+
+
+
#endif
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 6a1e194..d387fa8 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -26,6 +26,8 @@
#define BABL_HARD_MAX_PATH_LENGTH 8
#define BABL_MAX_NAME_LEN 1024
+#define BABL_TEST_ITER 4
+
#ifndef MIN
#define MIN(a, b) (((a) > (b)) ? (b) : (a))
#endif
@@ -74,7 +76,7 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
double *path_error);
-static long
+static inline void
process_conversion_path (BablList *path,
const void *source_buffer,
int source_bpp,
@@ -99,6 +101,7 @@ _babl_fish_create_name (char *buf,
static int max_path_length (void);
static int debug_conversions = 0;
+int _babl_instrument = 0;
double _babl_legal_error (void)
{
@@ -120,6 +123,12 @@ double _babl_legal_error (void)
else
debug_conversions = 0;
+ env = getenv ("BABL_INSTRUMENT");
+ if (env && env[0] != '\0')
+ _babl_instrument = 1;
+ else
+ _babl_instrument = 0;
+
return error;
}
@@ -210,7 +219,7 @@ get_conversion_path (PathContext *pc,
double path_cost = 0.0;
double ref_cost = 0.0;
double path_error = 1.0;
-#if 0
+#if 1
int i;
for (i = 0; i < babl_list_size (pc->current_path); i++)
{
@@ -219,7 +228,8 @@ get_conversion_path (PathContext *pc,
if (path_error - 1.0 <= legal_error )
/* check this before the more accurate measurement of error -
- to bail earlier */
+ to bail earlier, this also leads to a stricter
+ discarding of bad fast paths */
#endif
{
FishPathInstrumentation fpi;
@@ -423,6 +433,37 @@ alias_conversion (Babl *babl,
return 0;
}
+static void
+babl_fish_prepare_bpp (Babl *babl)
+{
+ const Babl *babl_source = babl->fish.source;
+ const Babl *babl_dest = babl->fish.destination;
+
+ switch (babl_source->instance.class_type)
+ {
+ case BABL_FORMAT:
+ babl->fish_path.source_bpp = babl_source->format.bytes_per_pixel;
+ break;
+ case BABL_TYPE:
+ babl->fish_path.source_bpp = babl_source->type.bits / 8;
+ break;
+ default:
+ babl_log ("=eeek{%i}\n", babl_source->instance.class_type - BABL_MAGIC);
+ }
+
+ switch (babl_dest->instance.class_type)
+ {
+ case BABL_FORMAT:
+ babl->fish_path.dest_bpp = babl_dest->format.bytes_per_pixel;
+ break;
+ case BABL_TYPE:
+ babl->fish_path.dest_bpp = babl_dest->type.bits / 8;
+ break;
+ default:
+ babl_log ("-eeek{%i}\n", babl_dest->instance.class_type - BABL_MAGIC);
+ }
+}
+
static Babl *
babl_fish_path2 (const Babl *source,
@@ -504,7 +545,6 @@ babl_fish_path2 (const Babl *source,
strcpy (babl->instance.name, name);
babl->fish.source = source;
babl->fish.destination = destination;
- babl->fish.processings = 0;
babl->fish.pixels = 0;
babl->fish.error = BABL_MAX_COST_VALUE;
babl->fish_path.cost = BABL_MAX_COST_VALUE;
@@ -564,6 +604,8 @@ babl_fish_path2 (const Babl *source,
return NULL;
}
+ babl_fish_prepare_bpp (babl);
+ _babl_fish_rig_dispatch (babl);
/* Since there is not an already registered instance by the required
* name, inserting newly created class into database.
*/
@@ -606,76 +648,57 @@ babl_fish_path (const Babl *source,
return babl_fish_path2 (source, destination, 0.0);
}
-static long
-babl_fish_path_process (Babl *babl,
- const void *source,
- void *destination,
- long n)
-{
- const Babl *babl_source = babl->fish.source;
- const Babl *babl_dest = babl->fish.destination;
- int source_bpp = 0;
- int dest_bpp = 0;
-
- switch (babl_source->instance.class_type)
- {
- case BABL_FORMAT:
- source_bpp = babl_source->format.bytes_per_pixel;
- break;
- case BABL_TYPE:
- source_bpp = babl_source->type.bits / 8;
- break;
- default:
- babl_log ("=eeek{%i}\n", babl_source->instance.class_type - BABL_MAGIC);
- }
- switch (babl_dest->instance.class_type)
- {
- case BABL_FORMAT:
- dest_bpp = babl_dest->format.bytes_per_pixel;
- break;
- case BABL_TYPE:
- dest_bpp = babl_dest->type.bits / 8;
- break;
- default:
- babl_log ("-eeek{%i}\n", babl_dest->instance.class_type - BABL_MAGIC);
- }
+static void
+babl_fish_path_process (const Babl *babl,
+ const char *source,
+ char *destination,
+ long n,
+ void *data)
+{
+ process_conversion_path (babl->fish_path.conversion_list,
+ source,
+ babl->fish_path.source_bpp,
+ destination,
+ babl->fish_path.dest_bpp,
+ n);
+}
- return process_conversion_path (babl->fish_path.conversion_list,
- source,
- source_bpp,
- destination,
- dest_bpp,
- n);
+static void
+babl_fish_memcpy_process (const Babl *babl,
+ const char *source,
+ char *destination,
+ long n,
+ void *data)
+{
+ memcpy (destination, source, n * babl->fish.source->format.bytes_per_pixel);
}
-static long
-babl_fish_process (Babl *babl,
- const void *source,
- void *destination,
- long n)
+void
+_babl_fish_rig_dispatch (Babl *babl)
{
- long ret = 0;
+ babl->fish.data = (void*)&(babl->fish.data);
+
+ if (babl->fish.source == babl->fish.destination)
+ {
+ babl->fish.dispatch = babl_fish_memcpy_process;
+ return;
+ }
switch (babl->class_type)
{
case BABL_FISH_REFERENCE:
- if (babl->fish.source == babl->fish.destination)
- { /* XXX: we're assuming linear buffers */
- memcpy (destination, source, n * babl->fish.source->format.bytes_per_pixel);
- ret = n;
- }
- else
- {
- ret = babl_fish_reference_process (babl, source, destination, n);
- }
+ babl->fish.dispatch = babl_fish_reference_process;
break;
case BABL_FISH_SIMPLE:
if (BABL (babl->fish_simple.conversion)->class_type == BABL_CONVERSION_LINEAR)
{
- ret = babl_conversion_process (BABL (babl->fish_simple.conversion),
- source, destination, n);
+ /* lift out conversion from single step conversion and make it be the dispatch function
+ * itself
+ */
+ babl->fish.data = &babl->fish_simple.conversion->data;
+ babl->fish.dispatch = babl->fish_simple.conversion->dispatch;
}
else
{
@@ -684,49 +707,84 @@ babl_fish_process (Babl *babl,
break;
case BABL_FISH_PATH:
- ret = babl_fish_path_process (babl, source, destination, n);
+ if (babl_list_size(babl->fish_path.conversion_list) == 1)
+ {
+ BablConversion *conversion = (void*)babl_list_get_first(babl->fish_path.conversion_list);
+
+ /* do same short-circuit optimization as for simple fishes */
+ babl->fish.dispatch = conversion->dispatch;
+ babl->fish.data = &conversion->data;
+ }
+ else
+ {
+ babl->fish.dispatch = babl_fish_path_process;
+ }
+ break;
+
+ case BABL_CONVERSION:
+ case BABL_CONVERSION_LINEAR:
+ case BABL_CONVERSION_PLANE:
+ case BABL_CONVERSION_PLANAR:
+ babl_assert (0);
break;
default:
babl_log ("NYI");
- ret = -1;
break;
}
- return ret;
+}
+
+static long
+_babl_process (const Babl *cbabl,
+ const void *source,
+ void *destination,
+ long n)
+{
+ Babl *babl = (void*)cbabl;
+ babl->fish.dispatch (babl, source, destination, n, *babl->fish.data);
+ if (_babl_instrument)
+ babl->fish.pixels += n;
+ return n;
}
long
-babl_process (const Babl *cbabl,
+babl_process (const Babl *babl,
const void *source,
void *destination,
long n)
{
- Babl *babl = (Babl*)cbabl;
- babl_assert (babl);
- babl_assert (source);
- babl_assert (destination);
- babl_assert (BABL_IS_BABL (babl));
- if (n == 0)
+ return _babl_process ((void*)babl, source, destination, n);
+}
+
+long
+babl_process_rows (const Babl *fish,
+ const void *source,
+ int source_stride,
+ void *dest,
+ int dest_stride,
+ long n,
+ int rows)
+{
+ Babl *babl = (Babl*)fish;
+ const uint8_t *src = source;
+ uint8_t *dst = dest;
+ int row;
+
+ babl_assert (babl && BABL_IS_BABL (babl) && source && dest);
+
+ if (n <= 0)
return 0;
- babl_assert (n > 0);
- /* first check if it is a fish since that is our fast path */
- if (babl->class_type >= BABL_FISH &&
- babl->class_type <= BABL_FISH_PATH)
+ if (_babl_instrument)
+ babl->fish.pixels += n * rows;
+ for (row = 0; row < rows; row++)
{
- babl->fish.processings++;
- babl->fish.pixels +=
- babl_fish_process (babl, source, destination, n);
- return n;
- }
-
- /* matches all conversion classes */
- if (babl->class_type >= BABL_CONVERSION &&
- babl->class_type <= BABL_CONVERSION_PLANAR)
- return babl_conversion_process (babl, source, destination, n);
+ babl->fish.dispatch (babl, (void*)src, (void*)dst, n, *babl->fish.data);
- babl_fatal ("eek");
- return -1;
+ src += source_stride;
+ dst += dest_stride;
+ }
+ return n * rows;
}
#include <stdint.h>
@@ -739,7 +797,7 @@ static void inline *align_16 (unsigned char *ret)
return ret;
}
-static long
+static inline void
process_conversion_path (BablList *path,
const void *source_buffer,
int source_bpp,
@@ -760,13 +818,15 @@ process_conversion_path (BablList *path,
{
long j;
- void *temp_buffer = align_16 (alloca (MIN(n, MAX_BUFFER_SIZE) * sizeof (double) * 5 + 16));
+ void *temp_buffer = align_16 (alloca (MIN(n, MAX_BUFFER_SIZE) *
+ sizeof (double) * 5 + 16));
void *temp_buffer2 = NULL;
if (conversions > 2)
{
/* We'll need one more auxiliary buffer */
- temp_buffer2 = align_16 (alloca (MIN(n, MAX_BUFFER_SIZE) * sizeof (double) * 5 + 16));
+ temp_buffer2 = align_16 (alloca (MIN(n, MAX_BUFFER_SIZE) *
+ sizeof (double) * 5 + 16));
}
for (j = 0; j < n; j+= MAX_BUFFER_SIZE)
@@ -774,15 +834,13 @@ process_conversion_path (BablList *path,
long c = MIN (n - j, MAX_BUFFER_SIZE);
int i;
- /* this is where the loop unrolling should happen */
void *aux1_buffer = temp_buffer;
- void *aux2_buffer = NULL;
- void *swap_buffer = NULL;
- aux2_buffer = temp_buffer2;
+ void *aux2_buffer = temp_buffer2;
/* The first conversion goes from source_buffer to aux1_buffer */
babl_conversion_process (babl_list_get_first (path),
- (void*)(((unsigned char*)source_buffer) + (j * source_bpp)),
+ (void*)(((unsigned char*)source_buffer) +
+ (j * source_bpp)),
aux1_buffer,
c);
@@ -794,21 +852,22 @@ process_conversion_path (BablList *path,
aux1_buffer,
aux2_buffer,
c);
- /* Swap the auxiliary buffers */
- swap_buffer = aux1_buffer;
- aux1_buffer = aux2_buffer;
- aux2_buffer = swap_buffer;
+ {
+ /* Swap the auxiliary buffers */
+ void *swap_buffer = aux1_buffer;
+ aux1_buffer = aux2_buffer;
+ aux2_buffer = swap_buffer;
+ }
}
/* The last conversion goes from aux1_buffer to destination_buffer */
babl_conversion_process (babl_list_get_last (path),
aux1_buffer,
- (void*)((unsigned char*)destination_buffer + (j * dest_bpp)),
+ (void*)((unsigned char*)destination_buffer +
+ (j * dest_bpp)),
c);
}
}
-
- return n;
}
static void
@@ -823,44 +882,58 @@ init_path_instrumentation (FishPathInstrumentation *fpi,
if (!fpi->fmt_rgba_double)
{
- fpi->fmt_rgba_double = babl_format_with_space ("RGBA double",
- fmt_destination->format.space);
+ fpi->fmt_rgba_double =
+ babl_format_with_space ("RGBA double",
+ fmt_destination->format.space);
}
fpi->num_test_pixels = babl_get_num_path_test_pixels ();
- fpi->fish_rgba_to_source = babl_fish_reference (fpi->fmt_rgba_double,
- fmt_source);
- fpi->fish_reference = babl_fish_reference (fmt_source,
- fmt_destination);
- fpi->fish_destination_to_rgba = babl_fish_reference (fmt_destination,
- fpi->fmt_rgba_double);
-
- fpi->source = babl_calloc (fpi->num_test_pixels,
- fmt_source->format.bytes_per_pixel);
- fpi->destination = babl_calloc (fpi->num_test_pixels,
- fmt_destination->format.bytes_per_pixel);
- fpi->ref_destination = babl_calloc (fpi->num_test_pixels,
- fmt_destination->format.bytes_per_pixel);
- fpi->destination_rgba_double = babl_calloc (fpi->num_test_pixels,
- fpi->fmt_rgba_double->format.bytes_per_pixel);
- fpi->ref_destination_rgba_double = babl_calloc (fpi->num_test_pixels,
- fpi->fmt_rgba_double->format.bytes_per_pixel);
+ fpi->fish_rgba_to_source =
+ babl_fish_reference (fpi->fmt_rgba_double, fmt_source);
+
+ fpi->fish_reference =
+ babl_fish_reference (fmt_source, fmt_destination);
+
+ fpi->fish_destination_to_rgba =
+ babl_fish_reference (fmt_destination, fpi->fmt_rgba_double);
+
+ fpi->source =
+ babl_calloc (fpi->num_test_pixels,
+ fmt_source->format.bytes_per_pixel);
+
+ fpi->destination =
+ babl_calloc (fpi->num_test_pixels,
+ fmt_destination->format.bytes_per_pixel);
+
+ fpi->ref_destination =
+ babl_calloc (fpi->num_test_pixels,
+ fmt_destination->format.bytes_per_pixel);
+
+ fpi->destination_rgba_double =
+ babl_calloc (fpi->num_test_pixels,
+ fpi->fmt_rgba_double->format.bytes_per_pixel);
+
+ fpi->ref_destination_rgba_double =
+ babl_calloc (fpi->num_test_pixels,
+ fpi->fmt_rgba_double->format.bytes_per_pixel);
/* create sourcebuffer from testbuffer in the correct format */
- babl_process (fpi->fish_rgba_to_source,
- test_pixels, fpi->source, fpi->num_test_pixels);
+ _babl_process (fpi->fish_rgba_to_source,
+ test_pixels, fpi->source,fpi->num_test_pixels);
/* calculate the reference buffer of how it should be */
ticks_start = babl_ticks ();
- babl_process (fpi->fish_reference,
- fpi->source, fpi->ref_destination, fpi->num_test_pixels);
+ _babl_process (fpi->fish_reference,
+ fpi->source, fpi->ref_destination,
+ fpi->num_test_pixels);
ticks_end = babl_ticks ();
- fpi->reference_cost = ticks_end - ticks_start;
+ fpi->reference_cost = (ticks_end - ticks_start) * BABL_TEST_ITER;
/* transform the reference destination buffer to RGBA */
- babl_process (fpi->fish_destination_to_rgba,
- fpi->ref_destination, fpi->ref_destination_rgba_double, fpi->num_test_pixels);
+ _babl_process (fpi->fish_destination_to_rgba,
+ fpi->ref_destination, fpi->ref_destination_rgba_double,
+ fpi->num_test_pixels);
}
static void
@@ -916,7 +989,8 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
dest_bpp = babl_destination->type.bits / 8;
break;
default:
- babl_log ("-eeek{%i}\n", babl_destination->instance.class_type - BABL_MAGIC);
+ babl_log ("-eeek{%i}\n",
+ babl_destination->instance.class_type - BABL_MAGIC);
}
if (!fpi->init_instrumentation_done)
@@ -930,19 +1004,22 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
/* calculate this path's view of what the result should be */
ticks_start = babl_ticks ();
- process_conversion_path (path, fpi->source, source_bpp, fpi->destination, dest_bpp, fpi->num_test_pixels);
+ for (int i = 0; i < BABL_TEST_ITER; i ++)
+ process_conversion_path (path, fpi->source, source_bpp, fpi->destination,
+ dest_bpp, fpi->num_test_pixels);
ticks_end = babl_ticks ();
- *path_cost = ticks_end - ticks_start;
+ *path_cost = (ticks_end - ticks_start);
/* transform the reference and the actual destination buffers to RGBA
* for comparison with each other
*/
- babl_process (fpi->fish_destination_to_rgba,
- fpi->destination, fpi->destination_rgba_double, fpi->num_test_pixels);
+ _babl_process (fpi->fish_destination_to_rgba,
+ fpi->destination, fpi->destination_rgba_double,
+ fpi->num_test_pixels);
*path_error = babl_rel_avg_error (fpi->destination_rgba_double,
fpi->ref_destination_rgba_double,
- fpi->num_test_pixels * 4);
+ fpi->num_test_pixels * 4);
*ref_cost = fpi->reference_cost;
}
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index d97cca3..54ca110 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -115,6 +115,7 @@ babl_fish_reference (const Babl *source,
#ifndef HAVE_TLS
free (name);
#endif
+ _babl_fish_rig_dispatch (babl);
return babl;
}
@@ -124,7 +125,7 @@ babl_fish_reference (const Babl *source,
babl_assert (source->class_type == BABL_FORMAT);
babl_assert (destination->class_type == BABL_FORMAT);
- babl = babl_malloc (sizeof (BablFishReference) +
+ babl = babl_calloc (1, sizeof (BablFishReference) +
strlen (name) + 1);
babl->class_type = BABL_FISH_REFERENCE;
babl->instance.id = babl_fish_get_id (source, destination);
@@ -133,11 +134,11 @@ babl_fish_reference (const Babl *source,
babl->fish.source = source;
babl->fish.destination = destination;
- babl->fish.processings = 0;
babl->fish.pixels = 0;
babl->fish.error = 0.0; /* assuming the provided reference conversions for types
and models are as exact as possible
*/
+ _babl_fish_rig_dispatch (babl);
/* Since there is not an already registered instance by the required
* name, inserting newly created class into database.
@@ -153,7 +154,7 @@ babl_fish_reference (const Babl *source,
static void
convert_to_double (BablFormat *source_fmt,
const char *source_buf,
- char *source_double_buf,
+ char *double_buf,
int n)
{
int i;
@@ -171,36 +172,54 @@ convert_to_double (BablFormat *source_fmt,
(dst_img->type[0]->bits / 8) * source_fmt->model->components;
dst_img->stride[0] = 0;
-
- src_img->data[0] = (char *)source_buf;
src_img->type[0] = (BablType *) babl_type_from_id (BABL_DOUBLE);
src_img->pitch[0] = source_fmt->bytes_per_pixel;
src_img->stride[0] = 0;
{
- /* i is source position */
- for (i = 0; i < source_fmt->components; i++)
+ /* i is dest position */
+ for (i = 0; i < source_fmt->model->components; i++)
{
int j;
+ int found = 0;
+
+ dst_img->data[0] =
+ double_buf + (dst_img->type[0]->bits / 8) * i;
+
+ src_img->data[0] = (char *)source_buf;
- src_img->type[0] = source_fmt->type[i];
/* j is source position */
- for (j = 0; j < source_fmt->model->components; j++)
+ for (j = 0; j < source_fmt->components; j++)
{
- if (source_fmt->component[i] ==
- source_fmt->model->component[j])
- {
- dst_img->data[0] =
- source_double_buf + (dst_img->type[0]->bits / 8) * j;
+ src_img->type[0] = source_fmt->type[j];
- babl_process (assert_conversion_find (src_img->type[0],
- dst_img->type[0]),
- src_img, dst_img, n);
+ if (source_fmt->component[j] ==
+ source_fmt->model->component[i])
+ {
+ babl_conversion_process (assert_conversion_find (src_img->type[0], dst_img->type[0]),
+ (void*)src_img, (void*)dst_img, n);
+ found = 1;
break;
}
+
+ src_img->data[0] += src_img->type[0]->bits / 8;
}
- src_img->data[0] += src_img->type[0]->bits / 8;
+ if (!found)
+ {
+ char *dst_ptr = dst_img->data[0];
+ double value;
+
+ value = source_fmt->model->component[i]->instance.id == BABL_ALPHA ? 1.0 : 0.0;
+
+ for (j = 0; j < n; j++)
+ {
+ double *dst_component = (double *) dst_ptr;
+
+ *dst_component = value;
+ dst_ptr += dst_img->pitch[0];
+ }
+ }
}
}
babl_free (src_img);
@@ -247,9 +266,9 @@ convert_from_double (BablFormat *destination_fmt,
src_img->data[0] =
destination_double_buf + (src_img->type[0]->bits / 8) * j;
- babl_process (assert_conversion_find (src_img->type[0],
- dst_img->type[0]),
- src_img, dst_img, n);
+ babl_conversion_process (assert_conversion_find (src_img->type[0],
+ dst_img->type[0]),
+ (void*)src_img, (void*)dst_img, n);
break;
}
}
@@ -286,9 +305,9 @@ ncomponent_convert_to_double (BablFormat *source_fmt,
dst_img->data[0] = source_double_buf;
- babl_process (
+ babl_conversion_process (
assert_conversion_find (src_img->type[0], dst_img->type[0]),
- src_img, dst_img,
+ (void*)src_img, (void*)dst_img,
n * source_fmt->components);
babl_free (src_img);
babl_free (dst_img);
@@ -320,9 +339,9 @@ ncomponent_convert_from_double (BablFormat *destination_fmt,
dst_img->type[0] = destination_fmt->type[0];
src_img->data[0] = destination_double_buf;
- babl_process (
+ babl_conversion_process (
assert_conversion_find (src_img->type[0], dst_img->type[0]),
- src_img, dst_img,
+ (void*)src_img, (void*)dst_img,
n * destination_fmt->components);
dst_img->data[0] += dst_img->type[0]->bits / 8;
@@ -369,7 +388,7 @@ process_to_n_component (const Babl *babl,
return 0;
}
-static int
+static void
process_same_model (const Babl *babl,
const char *source,
char *destination,
@@ -419,14 +438,14 @@ process_same_model (const Babl *babl,
);
}
babl_free (double_buf);
- return 0;
}
-long
+void
babl_fish_reference_process (const Babl *babl,
const char *source,
char *destination,
- long n)
+ long n,
+ void *data)
{
void *source_double_buf;
void *rgba_double_buf;
@@ -440,11 +459,15 @@ babl_fish_reference_process (const Babl *babl,
(BABL (babl->fish.source)->format.space ==
BABL (babl->fish.destination)->format.space)
)
- return process_same_model (babl, source, destination, n);
+ {
+ process_same_model (babl, source, destination, n);
+ return;
+ }
if (babl_format_is_format_n (BABL (babl->fish.destination)))
{
- return process_to_n_component (babl, source, destination, n);
+ process_to_n_component (babl, source, destination, n);
+ return;
}
source_double_buf = babl_malloc (sizeof (double) * n *
@@ -477,14 +500,14 @@ babl_fish_reference_process (const Babl *babl,
);
if (conv->class_type == BABL_CONVERSION_PLANAR)
{
- babl_process (
+ babl_conversion_process (
conv,
- source_image, rgba_image,
+ (void*)source_image, (void*)rgba_image,
n);
}
else if (conv->class_type == BABL_CONVERSION_LINEAR)
{
- babl_process (
+ babl_conversion_process (
conv,
source_double_buf, rgba_double_buf,
n);
@@ -513,14 +536,14 @@ babl_fish_reference_process (const Babl *babl,
BABL (babl->fish.destination)->format.model);
if (conv->class_type == BABL_CONVERSION_PLANAR)
{
- babl_process (
+ babl_conversion_process (
conv,
- rgba_image, destination_image,
+ (void*)rgba_image, (void*)destination_image,
n);
}
else if (conv->class_type == BABL_CONVERSION_LINEAR)
{
- babl_process (
+ babl_conversion_process (
conv,
rgba_double_buf, destination_double_buf,
n);
@@ -542,5 +565,4 @@ babl_fish_reference_process (const Babl *babl,
babl_free (destination_double_buf);
babl_free (rgba_double_buf);
babl_free (source_double_buf);
- return n;
}
diff --git a/babl/babl-fish-simple.c b/babl/babl-fish-simple.c
index 36908aa..a6a3730 100644
--- a/babl/babl-fish-simple.c
+++ b/babl/babl-fish-simple.c
@@ -32,7 +32,6 @@ babl_fish_simple (BablConversion *conversion)
char *name;
babl_assert (BABL_IS_BABL (conversion));
-
name = create_name (conversion);
babl = babl_db_exist_by_name (babl_fish_db (), name);
if (babl)
@@ -43,7 +42,7 @@ babl_fish_simple (BablConversion *conversion)
return babl;
}
- babl = babl_malloc (sizeof (BablFishSimple) +
+ babl = babl_calloc (1, sizeof (BablFishSimple) +
strlen (name) + 1);
babl->class_type = BABL_FISH_SIMPLE;
babl->instance.id = babl_fish_get_id (conversion->source, conversion->destination);
@@ -52,13 +51,13 @@ babl_fish_simple (BablConversion *conversion)
babl->fish.source = conversion->source;
babl->fish.destination = conversion->destination;
- babl->fish.processings = 0;
babl->fish.pixels = 0;
babl->fish_simple.conversion = conversion;
babl->fish.error = 0.0;/* babl fish simple should only be used by bablfish
reference, and babl fish reference only requests clean
conversions */
+ _babl_fish_rig_dispatch (babl);
/* Since there is not an already registered instance by the required
* name, inserting newly created class into database.
*/
diff --git a/babl/babl-fish.c b/babl/babl-fish.c
index 749b075..8c73a2b 100644
--- a/babl/babl-fish.c
+++ b/babl/babl-fish.c
@@ -257,6 +257,7 @@ babl_fish (const void *source,
if (ffish.fish_path)
{
/* we have found suitable fish path in the database */
+ _babl_fish_rig_dispatch (ffish.fish_path);
return ffish.fish_path;
}
diff --git a/babl/babl-fish.h b/babl/babl-fish.h
index 54d670a..a26a032 100644
--- a/babl/babl-fish.h
+++ b/babl/babl-fish.h
@@ -31,20 +31,17 @@ typedef struct
BablInstance instance;
const Babl *source;
const Babl *destination;
-
+ void (*dispatch) (const Babl *babl, const char *src, char *dst, long n, void *data);
+ void **data; /* user data - only used for conversion redirect */
+ long pixels; /* number of pixels translates */
double error; /* the amount of noise introduced by the fish */
-
/* instrumentation */
- int processings; /* number of times the fish has been used */
- long pixels; /* number of pixels translates */
- long usecs; /* usecs spent within this fish */
} BablFish;
/* BablFishSimple is the simplest type of fish, wrapping a single
* conversion function, (note this might not be the optimal chosen
- * conversion even if it exists)
- *
- * TODO: exterminate
+ * conversion even if it exists), these fishes are used internally for
+ * instance in reference fishes.
*/
typedef struct
{
@@ -64,9 +61,11 @@ typedef struct
*/
typedef struct
{
- BablFish fish;
- double cost; /* number of ticks *10 + chain_length */
- BablList *conversion_list;
+ BablFish fish;
+ double cost; /* number of ticks *10 + chain_length */
+ int source_bpp;
+ int dest_bpp;
+ BablList *conversion_list;
} BablFishPath;
/* BablFishReference
diff --git a/babl/babl-format.c b/babl/babl-format.c
index 45c62b2..1db5f02 100644
--- a/babl/babl-format.c
+++ b/babl/babl-format.c
@@ -643,8 +643,6 @@ babl_format_loss (const Babl *babl)
loss = babl_rel_avg_error (clipped, test, test_pixels * 4);
- fish_to->fish.processings -= 2;
- fish_from->fish.processings -= 2;
fish_to->fish.pixels -= test_pixels * 2;
fish_from->fish.pixels -= test_pixels * 2;
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 3362563..415bc5e 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -66,10 +66,6 @@ Babl * babl_conversion_find (const void *source,
const void *destination);
double babl_conversion_error (BablConversion *conversion);
long babl_conversion_cost (BablConversion *conversion);
-long babl_conversion_process (const Babl *conversion,
- const char *source,
- char *destination,
- long n);
Babl * babl_extension_base (void);
@@ -79,10 +75,11 @@ void babl_set_extender (Babl *new_extender);
Babl * babl_extension_quiet_log (void);
void babl_extension_deinit (void);
-long babl_fish_reference_process (const Babl *babl,
+void babl_fish_reference_process (const Babl *babl,
const char *source,
char *destination,
- long n);
+ long n,
+ void *data); // data is ignored
Babl * babl_fish_reference (const Babl *source,
const Babl *destination);
@@ -486,4 +483,20 @@ void babl_space_to_xyz (const Babl *space, const double *rgb, double *xyz);
*/
void babl_space_from_xyz (const Babl *space, const double *xyz, double *rgb);
+extern int _babl_instrument;
+
+static inline void
+babl_conversion_process (const Babl *babl,
+ const char *source,
+ char *destination,
+ long n)
+{
+ BablConversion *conversion = (BablConversion *) babl;
+ if (_babl_instrument)
+ conversion->pixels += n;
+ conversion->dispatch (babl, source, destination, n, conversion->data);
+}
+
+void _babl_fish_rig_dispatch (Babl *babl);
+
#endif
diff --git a/babl/babl-introspect.c b/babl/babl-introspect.c
index 03cfef1..5d0cb9d 100644
--- a/babl/babl-introspect.c
+++ b/babl/babl-introspect.c
@@ -166,8 +166,7 @@ format_introspect (Babl *babl)
static void
conversion_introspect (Babl *babl)
{
- babl_log ("\t\tprocessings:%i pixels:%li",
- babl->conversion.processings, babl->conversion.pixels);
+ babl_log ("\t\tpixels:%li", babl->conversion.pixels);
if (BABL (babl->conversion.source)->class_type == BABL_FORMAT)
{
babl_log ("\t\terror: %f", babl_conversion_error (&babl->conversion));
@@ -177,8 +176,7 @@ conversion_introspect (Babl *babl)
static void
fish_introspect (Babl *babl)
{
- babl_log ("\t\tprocessings:%i pixels:%li",
- babl->fish.processings, babl->fish.pixels);
+ babl_log ("\t\tpixels:%li", babl->fish.pixels);
}
static void
diff --git a/babl/babl-model.c b/babl/babl-model.c
index d553aca..2156059 100644
--- a/babl/babl-model.c
+++ b/babl/babl-model.c
@@ -315,8 +315,6 @@ babl_model_is_symmetric (const Babl *cbabl)
babl_process (fish_to, clipped, destination, test_pixels);
babl_process (fish_from, destination, transformed, test_pixels);
- fish_to->fish.processings -= 2;
- fish_from->fish.processings -= 2;
fish_to->fish.pixels -= test_pixels * 2;
fish_from->fish.pixels -= test_pixels * 2;
diff --git a/babl/babl-palette.c b/babl/babl-palette.c
index fda96ae..7a06e7d 100644
--- a/babl/babl-palette.c
+++ b/babl/babl-palette.c
@@ -136,7 +136,7 @@ static BablPalette *make_pal (const Babl *format, const void *data, int count)
babl_process (babl_fish (format, babl_format ("RGBA double")),
data, pal->data_double, count);
- babl_process (babl_fish (format, babl_format ("RGBA u8")),
+ babl_process (babl_fish (format, babl_format ("R'G'B'A u8")),
data, pal->data_u8, count);
babl_palette_reset_hash (pal);
@@ -161,10 +161,10 @@ static BablPalette *default_palette (void)
memset (&pal, 0, sizeof (pal));
inited = 1;
pal.count = 16;
- pal.format = babl_format ("RGBA u8"); /* dynamically generated, so
- the default palette can
- not be fully static.
- */
+ pal.format = babl_format ("R'G'B'A u8"); /* dynamically generated, so
+ the default palette can
+ not be fully static.
+ */
pal.data = defpal_data;
pal.data_double = defpal_double;
pal.data_u8 = defpal_data;
@@ -576,7 +576,7 @@ const Babl *babl_new_palette (const char *name,
babl_conversion_new (
f_pal_u8,
- babl_format ("RGBA u8"),
+ babl_format ("R'G'B'A u8"),
"linear", pal_u8_to_rgba_u8,
"data", palptr,
NULL);
@@ -584,19 +584,19 @@ const Babl *babl_new_palette (const char *name,
babl_conversion_new (
f_pal_a_u8,
- babl_format ("RGBA u8"),
+ babl_format ("R'G'B'A u8"),
"linear", pala_u8_to_rgba_u8,
"data", palptr,
NULL);
babl_conversion_new (
- babl_format ("RGBA u8"),
+ babl_format ("R'G'B'A u8"),
f_pal_a_u8,
"linear", rgba_u8_to_pal_a,
"data", palptr,
NULL);
babl_conversion_new (
- babl_format ("RGBA u8"),
+ babl_format ("R'G'B'A u8"),
f_pal_u8,
"linear", rgba_u8_to_pal,
"data", palptr,
diff --git a/babl/babl-trc.c b/babl/babl-trc.c
index 0a00710..11f79a6 100644
--- a/babl/babl-trc.c
+++ b/babl/babl-trc.c
@@ -424,10 +424,11 @@ babl_trc_formula_srgb (double g, double a, double b, double c, double d)
int i;
float params[5]={g, a, b, c, d};
- if (fabs (g - 2.40) < 0.01 &&
- fabs (a - 26214) < 0.01 &&
- fabs (b - 0.947875) < 0.01 &&
- fabs (c - (-3417)) < 0.01)
+ if (fabs (g - 2.400) < 0.01 &&
+ fabs (a - 0.947) < 0.01 &&
+ fabs (b - 0.052) < 0.01 &&
+ fabs (c - 0.077) < 0.01 &&
+ fabs (d - 0.040) < 0.01)
return babl_trc ("sRGB");
snprintf (name, sizeof (name), "%.6f %.6f %.4f %.4f %.4f", g, a, b, c, d);
diff --git a/babl/babl-type.c b/babl/babl-type.c
index f99c9d1..86b1a3f 100644
--- a/babl/babl-type.c
+++ b/babl/babl-type.c
@@ -209,8 +209,6 @@ babl_type_is_symmetric (const Babl *babl)
babl_process (fish_to, clipped, destination, samples);
babl_process (fish_from, destination, transformed, samples);
- fish_from->fish.processings -= 2;
- fish_to->fish.processings -= 2;
fish_from->fish.pixels -= samples * 2;
fish_to->fish.pixels -= samples * 2;
diff --git a/babl/babl-version.h b/babl/babl-version.h
index ed4a665..7e5e690 100644
--- a/babl/babl-version.h
+++ b/babl/babl-version.h
@@ -34,7 +34,7 @@
#define BABL_MAJOR_VERSION 0
#define BABL_MINOR_VERSION 1
-#define BABL_MICRO_VERSION 38
+#define BABL_MICRO_VERSION 40
/** Get the version information on the babl library */
void babl_get_version (int *major,
diff --git a/babl/babl.h b/babl/babl.h
index a45de42..39cb097 100644
--- a/babl/babl.h
+++ b/babl/babl.h
@@ -226,6 +226,15 @@ long babl_process (const Babl *babl_fish,
long n);
+long babl_process_rows (const Babl *babl_fish,
+ const void *source,
+ int source_stride,
+ void *dest,
+ int dest_stride,
+ long n,
+ int rows);
+
+
/**
* babl_get_name:
*
diff --git a/babl/base/Makefile.in b/babl/base/Makefile.in
index 89aeca6..0b30261 100644
--- a/babl/base/Makefile.in
+++ b/babl/base/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/babl/base/util.h b/babl/base/util.h
index e273087..50bba74 100644
--- a/babl/base/util.h
+++ b/babl/base/util.h
@@ -81,7 +81,12 @@ static inline float
babl_linear_to_gamma_2_2f (float value)
{
if (value > 0.003130804954f)
- return 1.055f * babl_pow_1_24f (value) - 0.055f;
+ {
+ return 1.055f * babl_pow_1_24f (value) -
+ (0.055f -
+ 3.0f / (float) (1 << 24));
+ /* ^ offset the result such that 1 maps to 1 */
+ }
return 12.92f * value;
}
diff --git a/config.guess b/config.guess
index 2e9ad7f..31e01ef 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2016 Free Software Foundation, Inc.
+# Copyright 1992-2017 Free Software Foundation, Inc.
-timestamp='2016-10-02'
+timestamp='2017-11-07'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ timestamp='2016-10-02'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -27,7 +27,7 @@ timestamp='2016-10-02'
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches to <config-patches@gnu.org>.
@@ -39,7 +39,7 @@ Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
-Operation modes:
+Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2016 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -244,6 +244,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
+ *:MidnightBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-midnightbsd${UNAME_RELEASE}
+ exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@@ -259,6 +262,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
+ *:Redox:*:*)
+ echo ${UNAME_MACHINE}-unknown-redox
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@@ -315,15 +321,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exitcode=$?
trap '' 0
exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
@@ -485,13 +482,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
@@ -614,7 +611,7 @@ EOF
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
@@ -635,8 +632,8 @@ EOF
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/31?) HP_ARCH=m68000 ;;
+ 9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
@@ -749,7 +746,7 @@ EOF
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
@@ -758,7 +755,7 @@ EOF
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
@@ -837,10 +834,11 @@ EOF
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ UNAME_PROCESSOR=x86_64 ;;
+ i386)
+ UNAME_PROCESSOR=i586 ;;
esac
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@@ -854,10 +852,6 @@ EOF
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
@@ -873,27 +867,12 @@ EOF
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
@@ -1096,7 +1075,7 @@ EOF
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ i*86:*:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
@@ -1303,14 +1282,21 @@ EOF
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
+ fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
@@ -1334,15 +1320,18 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
+ NEO-*:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
+ NSR-*:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
+ NSX-*:NONSTOP_KERNEL:*:*)
+ echo nsx-tandem-nsk${UNAME_RELEASE}
+ exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
@@ -1414,16 +1403,28 @@ EOF
exit ;;
esac
+echo "$0: unable to guess system type" >&2
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}" in
+ mips:Linux | mips64:Linux)
+ # If we got here on MIPS GNU/Linux, output extra information.
+ cat >&2 <<EOF
+
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
+the system type. Please install a C compiler and try again.
+EOF
+ ;;
+esac
+
cat >&2 <<EOF
-$0: unable to guess system type
This script (version $timestamp), has failed to recognize the
-operating system you are using. If your script is old, overwrite
-config.guess and config.sub with the latest versions from:
+operating system you are using. If your script is old, overwrite *all*
+copies of config.guess and config.sub with the latest versions from:
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+ https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+ https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
@@ -1455,7 +1456,7 @@ EOF
exit 1
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'write-file-functions 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/config.sub b/config.sub
index dd2ca93..00f68b8 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2016 Free Software Foundation, Inc.
+# Copyright 1992-2017 Free Software Foundation, Inc.
-timestamp='2016-11-04'
+timestamp='2017-11-23'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ timestamp='2016-11-04'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -33,7 +33,7 @@ timestamp='2016-11-04'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@@ -57,7 +57,7 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
-Operation modes:
+Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2016 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -229,9 +229,6 @@ case $os in
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
-psos*)
os=-psos
;;
@@ -263,7 +260,7 @@ case $basic_machine in
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
- | i370 | i860 | i960 | ia64 \
+ | i370 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
@@ -315,7 +312,7 @@ case $basic_machine in
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
- | we32k \
+ | wasm32 \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
@@ -388,7 +385,7 @@ case $basic_machine in
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
+ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
@@ -446,6 +443,7 @@ case $basic_machine in
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
+ | wasm32-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@@ -641,7 +639,7 @@ case $basic_machine in
basic_machine=rs6000-bull
os=-bosx
;;
- dpx2* | dpx2*-bull)
+ dpx2*)
basic_machine=m68k-bull
os=-sysv3
;;
@@ -903,7 +901,7 @@ case $basic_machine in
basic_machine=v70-nec
os=-sysv
;;
- next | m*-next )
+ next | m*-next)
basic_machine=m68k-next
case $os in
-nextstep* )
@@ -948,6 +946,9 @@ case $basic_machine in
nsr-tandem)
basic_machine=nsr-tandem
;;
+ nsx-tandem)
+ basic_machine=nsx-tandem
+ ;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
@@ -1243,6 +1244,9 @@ case $basic_machine in
basic_machine=a29k-wrs
os=-vxworks
;;
+ wasm32)
+ basic_machine=wasm32-unknown
+ ;;
w65*)
basic_machine=w65-wdc
os=-none
@@ -1251,6 +1255,9 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
+ x64)
+ basic_machine=x86_64-pc
+ ;;
xbox)
basic_machine=i686-pc
os=-mingw32
@@ -1358,8 +1365,8 @@ esac
if [ x"$os" != x"" ]
then
case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
+ # First match some system type aliases that might get confused
+ # with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
@@ -1379,9 +1386,9 @@ case $os in
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
- # First accept the basic system types.
+ # Now accept the basic system types.
# The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
+ # Each alternative MUST end in a * to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
@@ -1397,7 +1404,7 @@ case $os in
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
+ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
@@ -1409,7 +1416,7 @@ case $os in
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
- | -onefs* | -tirtos* | -phoenix* | -fuchsia*)
+ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1484,7 +1491,7 @@ case $os in
-nova*)
os=-rtmk-nova
;;
- -ns2 )
+ -ns2)
os=-nextstep2
;;
-nsk*)
@@ -1539,6 +1546,19 @@ case $os in
-dicos*)
os=-dicos
;;
+ -pikeos*)
+ # Until real need of OS specific support for
+ # particular features comes up, bare metal
+ # configurations are quite functional.
+ case $basic_machine in
+ arm*)
+ os=-eabi
+ ;;
+ *)
+ os=-elf
+ ;;
+ esac
+ ;;
-nacl*)
;;
-ios)
@@ -1638,6 +1658,9 @@ case $basic_machine in
sparc-* | *-sun)
os=-sunos4.1.1
;;
+ pru-*)
+ os=-elf
+ ;;
*-be)
os=-beos
;;
@@ -1683,7 +1706,7 @@ case $basic_machine in
m88k-omron*)
os=-luna
;;
- *-next )
+ *-next)
os=-nextstep
;;
*-sequent)
@@ -1818,7 +1841,7 @@ echo $basic_machine$os
exit
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'write-file-functions 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/configure b/configure
index bd885c5..8a5bf7a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for babl 0.1.38.
+# Generated by GNU Autoconf 2.69 for babl 0.1.40.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='babl'
PACKAGE_TARNAME='babl'
-PACKAGE_VERSION='0.1.38'
-PACKAGE_STRING='babl 0.1.38'
+PACKAGE_VERSION='0.1.40'
+PACKAGE_STRING='babl 0.1.40'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1381,7 +1381,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures babl 0.1.38 to adapt to many kinds of systems.
+\`configure' configures babl 0.1.40 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1453,7 +1453,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of babl 0.1.38:";;
+ short | recursive ) echo "Configuration of babl 0.1.40:";;
esac
cat <<\_ACEOF
@@ -1573,7 +1573,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-babl configure 0.1.38
+babl configure 0.1.40
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1938,7 +1938,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by babl $as_me 0.1.38, which was
+It was created by babl $as_me 0.1.40, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2294,11 +2294,11 @@ ac_config_headers="$ac_config_headers config.h"
BABL_MAJOR_VERSION=0
BABL_MINOR_VERSION=1
-BABL_MICRO_VERSION=38
+BABL_MICRO_VERSION=40
BABL_INTERFACE_AGE=1
-BABL_BINARY_AGE=138
-BABL_VERSION=0.1.38
-BABL_REAL_VERSION=0.1.38
+BABL_BINARY_AGE=140
+BABL_VERSION=0.1.40
+BABL_REAL_VERSION=0.1.40
BABL_API_VERSION=0.1
@@ -2333,7 +2333,7 @@ fi
-BABL_LIBRARY_VERSION="137:1:137"
+BABL_LIBRARY_VERSION="139:1:139"
BABL_CURRENT_MINUS_AGE=0
@@ -2965,7 +2965,7 @@ fi
# Define the identity of the package.
PACKAGE='babl'
- VERSION='0.1.38'
+ VERSION='0.1.40'
# Some tools Automake needs.
@@ -14864,7 +14864,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by babl $as_me 0.1.38, which was
+This file was extended by babl $as_me 0.1.40, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14930,7 +14930,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-babl config.status 0.1.38
+babl config.status 0.1.40
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index c1fd10f..bbb7fa2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ AC_PREREQ(2.54)
m4_define([babl_major_version], [0])
m4_define([babl_minor_version], [1])
-m4_define([babl_micro_version], [38])
+m4_define([babl_micro_version], [40])
m4_define([babl_real_version],
[babl_major_version.babl_minor_version.babl_micro_version])
m4_define([babl_version], [babl_real_version])
diff --git a/depcomp b/depcomp
index fc98710..b39f98f 100755
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2013-05-30.07; # UTC
+scriptversion=2016-01-11.22; # UTC
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -786,6 +786,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
diff --git a/docs/Makefile.in b/docs/Makefile.in
index 94efe66..b0c90de 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/docs/graphics/Makefile.in b/docs/graphics/Makefile.in
index 93fe732..9b94145 100644
--- a/docs/graphics/Makefile.in
+++ b/docs/graphics/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/export-symbols b/export-symbols
index f85fec9..301acce 100644
--- a/export-symbols
+++ b/export-symbols
@@ -36,7 +36,7 @@ babl_new_palette
babl_palette_reset
babl_palette_set_palette
babl_process
-babl_process
+babl_process_rows
babl_sampling
babl_set_user_data
babl_space
diff --git a/extensions/CIE.c b/extensions/CIE.c
index 658fd2a..b6fa513 100644
--- a/extensions/CIE.c
+++ b/extensions/CIE.c
@@ -80,9 +80,9 @@ components (void)
babl_component_new ("CIE b", "chroma", NULL);
babl_component_new ("CIE C(ab)", "chroma", NULL);
babl_component_new ("CIE H(ab)", "chroma", NULL);
- /* babl_component_new ("CIE X", NULL);
+ babl_component_new ("CIE X", NULL);
babl_component_new ("CIE Y", NULL);
- babl_component_new ("CIE Z", NULL);*/
+ babl_component_new ("CIE Z", NULL);
}
static void
@@ -117,12 +117,21 @@ models (void)
babl_component ("CIE H(ab)"),
babl_component ("A"),
NULL);
- /*babl_model_new (
+
+ babl_model_new (
"name", "CIE XYZ",
babl_component ("CIE X"),
babl_component ("CIE Y"),
babl_component ("CIE Z"),
- NULL);*/
+ NULL);
+
+ babl_model_new (
+ "name", "CIE XYZ alpha",
+ babl_component ("CIE X"),
+ babl_component ("CIE Y"),
+ babl_component ("CIE Z"),
+ babl_component ("A"),
+ NULL);
}
static void rgbcie_init (void);
@@ -218,7 +227,7 @@ LAB_to_XYZ (double L,
}
static void
-rgba_to_lab (const Babl *conversion,char *src,
+rgba_to_xyz (const Babl *conversion,char *src,
char *dst,
long n)
{
@@ -228,12 +237,72 @@ rgba_to_lab (const Babl *conversion,char *src,
double RGB[3] = {((double *) src)[0],
((double *) src)[1],
((double *) src)[2] };
- double XYZ[3], L, a, b;
+ babl_space_to_xyz (space, RGB, (double*)dst);
- //convert RGB to XYZ
- babl_space_to_xyz (space, RGB, XYZ);
+ src += sizeof (double) * 4;
+ dst += sizeof (double) * 3;
+ }
+}
- //convert XYZ to Lab
+static void
+xyz_to_rgba (const Babl *conversion,char *src,
+ char *dst,
+ long n)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ while (n--)
+ {
+ babl_space_from_xyz (space, (double*)src, (double*) dst);
+ ((double *) dst)[3] = 1.0;
+ src += sizeof (double) * 3;
+ dst += sizeof (double) * 4;
+ }
+}
+
+static void
+rgba_to_xyza (const Babl *conversion,char *src,
+ char *dst,
+ long n)
+{
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ while (n--)
+ {
+ babl_space_to_xyz (space, (double*)src, (double*)dst);
+ ((double *) dst)[3] = ((double *) src)[3];
+
+ src += sizeof (double) * 4;
+ dst += sizeof (double) * 4;
+ }
+}
+
+static void
+xyza_to_rgba (const Babl *conversion,char *src,
+ char *dst,
+ long n)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ while (n--)
+ {
+ babl_space_from_xyz (space, (double*)src, (double*) dst);
+ ((double *) dst)[3] = ((double *) src)[3];
+
+ src += sizeof (double) * 4;
+ dst += sizeof (double) * 4;
+ }
+}
+
+
+static void
+rgba_to_lab (const Babl *conversion,char *src,
+ char *dst,
+ long n)
+{
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ while (n--)
+ {
+ double XYZ[3], L, a, b;
+
+ babl_space_to_xyz (space, (double*)src, XYZ);
XYZ_to_LAB (XYZ[0], XYZ[1], XYZ[2], &L, &a, &b);
((double *) dst)[0] = L;
@@ -245,6 +314,8 @@ rgba_to_lab (const Babl *conversion,char *src,
}
}
+
+
static void
lab_to_rgba (const Babl *conversion,char *src,
char *dst,
@@ -258,7 +329,7 @@ lab_to_rgba (const Babl *conversion,char *src,
double b = ((double *) src)[2];
double X, Y, Z, R, G, B;
-
+
//convert Lab to XYZ
LAB_to_XYZ (L, a, b, &X, &Y, &Z);
@@ -290,14 +361,11 @@ rgba_to_laba (const Babl *conversion,char *src,
const Babl *space = babl_conversion_get_source_space (conversion);
while (n--)
{
- double RGB[3] = {((double *) src)[0],
- ((double *) src)[1],
- ((double *) src)[2] };
double alpha = ((double *) src)[3];
double XYZ[3], L, a, b;
//convert RGB to XYZ
- babl_space_to_xyz (space, RGB, XYZ);
+ babl_space_to_xyz (space, (double*)src, XYZ);
//convert XYZ to Lab
XYZ_to_LAB (XYZ[0], XYZ[1], XYZ[2], &L, &a, &b);
@@ -325,26 +393,16 @@ laba_to_rgba (const Babl *conversion,char *src,
double b = ((double *) src)[2];
double alpha = ((double *) src)[3];
- double X, Y, Z, R, G, B;
+ double X, Y, Z;
//convert Lab to XYZ
LAB_to_XYZ (L, a, b, &X, &Y, &Z);
- //convert XYZ to RGB
- //XYZ_to_RGB (X, Y, Z, &R, &G, &B);
-
{
+ //convert XYZ to RGB
double XYZ[3] = {X,Y,Z};
- double RGB[3];
- babl_space_from_xyz (space, XYZ, RGB);
- R = RGB[0];
- G = RGB[1];
- B = RGB[2];
+ babl_space_from_xyz (space, XYZ, (double*)dst);
}
-
- ((double *) dst)[0] = R;
- ((double *) dst)[1] = G;
- ((double *) dst)[2] = B;
((double *) dst)[3] = alpha;
src += sizeof (double) * 4;
@@ -385,13 +443,10 @@ rgba_to_lchab (const Babl *conversion,char *src,
while (n--)
{
- double RGB[3] = {((double *) src)[0],
- ((double *) src)[1],
- ((double *) src)[2] };
double XYZ[3], L, a, b, C, H;
//convert RGB to XYZ
- babl_space_to_xyz (space, RGB, XYZ);
+ babl_space_to_xyz (space, (double *)src, XYZ);
//convert XYZ to Lab
XYZ_to_LAB (XYZ[0], XYZ[1], XYZ[2], &L, &a, &b);
@@ -421,7 +476,7 @@ lchab_to_rgba (const Babl *conversion,char *src,
double L = ((double *) src)[0];
double C = ((double *) src)[1];
double H = ((double *) src)[2];
- double a, b, X, Y, Z, R, G, B;
+ double a, b, X, Y, Z;
//Convert LCH(ab) to Lab
CHab_to_ab (C, H, &a, &b);
@@ -432,17 +487,9 @@ lchab_to_rgba (const Babl *conversion,char *src,
//Convert XYZ to RGB
{
double XYZ[3] = {X,Y,Z};
- double RGB[3];
- babl_space_from_xyz (space, XYZ, RGB);
- R = RGB[0];
- G = RGB[1];
- B = RGB[2];
+ babl_space_from_xyz (space, XYZ, (double*)dst);
}
-
- ((double *) dst)[0] = R;
- ((double *) dst)[1] = G;
- ((double *) dst)[2] = B;
((double *) dst)[3] = 1.0;
src += sizeof (double) * 3;
@@ -459,14 +506,11 @@ rgba_to_lchaba (const Babl *conversion,char *src,
while (n--)
{
- double RGB[3] = {((double *) src)[0],
- ((double *) src)[1],
- ((double *) src)[2] };
double alpha = ((double *) src)[3];
double XYZ[3], L, a, b, C, H;
//convert RGB to XYZ
- babl_space_to_xyz (space, RGB, XYZ);
+ babl_space_to_xyz (space, (double*)src, XYZ);
//convert XYZ to Lab
XYZ_to_LAB (XYZ[0], XYZ[1], XYZ[2], &L, &a, &b);
@@ -496,7 +540,7 @@ lchaba_to_rgba (const Babl *conversion,char *src,
double C = ((double *) src)[1];
double H = ((double *) src)[2];
double alpha = ((double *) src)[3];
- double a, b, X, Y, Z, R, G, B;
+ double a, b, X, Y, Z;
//Convert LCH(ab) to Lab
CHab_to_ab (C, H, &a, &b);
@@ -507,16 +551,8 @@ lchaba_to_rgba (const Babl *conversion,char *src,
//Convert XYZ to RGB
{
double XYZ[3] = {X,Y,Z};
- double RGB[3];
- babl_space_from_xyz (space, XYZ, RGB);
- R = RGB[0];
- G = RGB[1];
- B = RGB[2];
+ babl_space_from_xyz (space, XYZ, (double*)dst);
}
-
- ((double *) dst)[0] = R;
- ((double *) dst)[1] = G;
- ((double *) dst)[2] = B;
((double *) dst)[3] = alpha;
src += sizeof (double) * 4;
@@ -529,61 +565,28 @@ lchaba_to_rgba (const Babl *conversion,char *src,
/******** begin floating point RGB/CIE color space conversions ********/
-/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrtf.c */
-/*
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- * Debugged and optimized by Bruce D. Evans.
- */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
+/* origin: http://www.hackersdelight.org/hdcodetxt/acbrt.c.txt
+ * permissions: http://www.hackersdelight.org/permissions.htm
*/
/* _cbrtf(x)
* Return cube root of x
*/
-#include <math.h>
#include <stdint.h>
-static const unsigned
-B1 = 709958130, /* B1 = (127-127.0/3-0.03306235651)*2**23 */
-B2 = 642849266; /* B2 = (127-127.0/3-24/3-0.03306235651)*2**23 */
-
-static inline float _cbrtf(float x)
+static inline float
+_cbrtf (float x)
{
- float r,T;
- union {float f; uint32_t i;} u = {x};
- uint32_t hx = u.i & 0x7fffffff;
-
- if (hx >= 0x7f800000) /* cbrt(NaN,INF) is itself */
- return x + x;
-
- /* rough cbrt to 5 bits */
- if (hx < 0x00800000) { /* zero or subnormal? */
- if (hx == 0)
- return x; /* cbrt(+-0) is itself */
- u.f = x*0x1p24f;
- hx = u.i & 0x7fffffff;
- hx = hx/3 + B2;
- } else
- hx = hx/3 + B1;
- u.i &= 0x80000000;
- u.i |= hx;
-
- T = u.f;
- r = T*T*T;
- T = T*((float)x+x+r)/(x+r+r);
-
- r = T*T*T;
- T = T*((float)x+x+r)/(x+r+r);
-
- return T;
+ union { float f; uint32_t i; } u = { x };
+
+ u.i = u.i / 4 + u.i / 16;
+ u.i = u.i + u.i / 16;
+ u.i = u.i + u.i / 256;
+ u.i = 0x2a5137a0 + u.i;
+ u.f = 0.33333333f * (2.0f * u.f + x / (u.f * u.f));
+ u.f = 0.33333333f * (2.0f * u.f + x / (u.f * u.f));
+
+ return u.f;
}
static inline float
@@ -713,10 +716,7 @@ rgbaf_to_Lf (const Babl *conversion,float *src,
float b = src[2];
float yr = m_1_0 * r + m_1_1 * g + m_1_2 * b;
-
- float fy = yr > LAB_EPSILON ? _cbrtf (yr) : (LAB_KAPPA * yr + 16.0f) / 116.0f;
-
- float L = 116.0f * fy - 16.0f;
+ float L = yr > LAB_EPSILON ? 116.0f * _cbrtf (yr) - 16 : LAB_KAPPA * yr;
dst[0] = L;
@@ -1190,18 +1190,30 @@ conversions (void)
"linear", Lchabaf_to_Labaf,
NULL
);
- /*babl_conversion_new (
+ babl_conversion_new (
babl_model ("RGBA"),
babl_model ("CIE XYZ"),
- "linear", RGB_to_XYZ,
+ "linear", rgba_to_xyz,
NULL
);
babl_conversion_new (
babl_model ("CIE XYZ"),
babl_model ("RGBA"),
- "linear", XYZ_to_RGB,
+ "linear", xyz_to_rgba,
+ NULL
+ );
+ babl_conversion_new (
+ babl_model ("RGBA"),
+ babl_model ("CIE XYZ alpha"),
+ "linear", rgba_to_xyza,
NULL
- );*/
+ );
+ babl_conversion_new (
+ babl_model ("CIE XYZ alpha"),
+ babl_model ("RGBA"),
+ "linear", xyza_to_rgba,
+ NULL
+ );
rgbcie_init ();
}
@@ -1218,8 +1230,8 @@ formats (void)
babl_component ("CIE a"),
babl_component ("CIE b"),
NULL);
-
- /*babl_format_new (
+
+ babl_format_new (
"name", "CIE XYZ float",
babl_model ("CIE XYZ"),
@@ -1227,7 +1239,18 @@ formats (void)
babl_component ("CIE X"),
babl_component ("CIE Y"),
babl_component ("CIE Z"),
- NULL);*/
+ NULL);
+
+ babl_format_new (
+ "name", "CIE XYZ alpha float",
+ babl_model ("CIE XYZ"),
+
+ babl_type ("float"),
+ babl_component ("CIE X"),
+ babl_component ("CIE Y"),
+ babl_component ("CIE Z"),
+ babl_component ("A"),
+ NULL);
babl_format_new (
"name", "CIE Lab alpha float",
diff --git a/extensions/Makefile.in b/extensions/Makefile.in
index 104f9ba..5ea5fe0 100644
--- a/extensions/Makefile.in
+++ b/extensions/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/extensions/gggl.c b/extensions/gggl.c
index cf83988..625d730 100644
--- a/extensions/gggl.c
+++ b/extensions/gggl.c
@@ -543,7 +543,12 @@ conv_rgbaF_rgb16 (const Babl *conversion,unsigned char *src, unsigned char *dst,
for (c = 0; c < 3; c++)
{
- *(unsigned short *) dst = lrint ((*(float *) src) * 65535.0);
+ if ((*(float *) src) >= 1.0)
+ *(unsigned short *) dst = 65535;
+ else if ((*(float *) src) <=0)
+ *(unsigned short *) dst = 0;
+ else
+ *(unsigned short *) dst = lrint ((*(float *) src) * 65535.0);
dst += 2;
src += 4;
}
diff --git a/extensions/sse2-float.c b/extensions/sse2-float.c
index 223f85c..800ac97 100644
--- a/extensions/sse2-float.c
+++ b/extensions/sse2-float.c
@@ -304,7 +304,10 @@ sse_pow_24 (__v4sf x)
static inline __v4sf
linear_to_gamma_2_2_sse2 (__v4sf x)
{
- __v4sf curve = sse_pow_1_24 (x) * splat4f (1.055f) - splat4f (0.055f);
+ __v4sf curve = sse_pow_1_24 (x) * splat4f (1.055f) -
+ splat4f (0.055f -
+ 3.0f / (float) (1 << 24));
+ /* ^ offset the result such that 1 maps to 1 */
__v4sf line = x * splat4f (12.92f);
__v4sf mask = _mm_cmpgt_ps (x, splat4f (0.003130804954f));
return _mm_or_ps (_mm_and_ps (mask, curve), _mm_andnot_ps (mask, line));
@@ -429,7 +432,8 @@ conv_yaF_linear_yaF_gamma (const Babl *conversion,const float *src, float *dst,
while (samples--)
{
- *dst++ = babl_linear_to_gamma_2_2 (*src++);
+ float y = *src++;
+ *dst++ = linear_to_gamma_2_2_sse2 (splat4f (y))[0];
*dst++ = *src++;
}
}
@@ -463,7 +467,8 @@ conv_yaF_gamma_yaF_linear (const Babl *conversion,const float *src, float *dst,
while (samples--)
{
- *dst++ = babl_gamma_2_2_to_linear (*src++);
+ float y = *src++;
+ *dst++ = gamma_2_2_to_linear_sse2 (splat4f (y))[0];
*dst++ = *src++;
}
}
@@ -500,7 +505,8 @@ conv_yF_linear_yF_gamma (const Babl *conversion,const float *src, float *dst, lo
while (samples--)
{
- *dst++ = babl_linear_to_gamma_2_2 (*src++);
+ float y = *src++;
+ *dst++ = linear_to_gamma_2_2_sse2 (splat4f (y))[0];
}
}
@@ -536,7 +542,8 @@ conv_yF_gamma_yF_linear (const Babl *conversion,const float *src, float *dst, lo
while (samples--)
{
- *dst++ = babl_gamma_2_2_to_linear (*src++);
+ float y = *src++;
+ *dst++ = gamma_2_2_to_linear_sse2 (splat4f (y))[0];
}
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 59bb296..98f4ae2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -34,13 +34,7 @@ TESTS = \
TESTS_ENVIRONMENT = LD_LIBRARY_PATH=$(top_builddir)/babl:$LD_LIBRARY_PATH GI_TYPELIB_PATH=$(top_builddir)/babl BABL_PATH=$(top_builddir)/extensions/.libs
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/babl
-if OS_UNIX
-AM_LDFLAGS = -lpthread -no-install
-else
-
-AM_LDFLAGS = -no-install
-endif
-
+AM_LDFLAGS = $(THREAD_LIB) -no-install
LDADD = $(top_builddir)/babl/libbabl-@BABL_API_VERSION@.la \
$(MATH_LIB) $(THREAD_LIB)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 9b68b9e..e52ebe7 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -710,8 +710,7 @@ C_TESTS = \
TESTS_ENVIRONMENT = LD_LIBRARY_PATH=$(top_builddir)/babl:$LD_LIBRARY_PATH GI_TYPELIB_PATH=$(top_builddir)/babl BABL_PATH=$(top_builddir)/extensions/.libs
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/babl
-@OS_UNIX_FALSE@AM_LDFLAGS = -no-install
-@OS_UNIX_TRUE@AM_LDFLAGS = -lpthread -no-install
+AM_LDFLAGS = $(THREAD_LIB) -no-install
LDADD = $(top_builddir)/babl/libbabl-@BABL_API_VERSION@.la \
$(MATH_LIB) $(THREAD_LIB)
diff --git a/tests/palette.c b/tests/palette.c
index 8519262..ce21cf6 100644
--- a/tests/palette.c
+++ b/tests/palette.c
@@ -40,7 +40,7 @@ main (int argc,
assert (palA);
CHECK_CONV("pal to rgba", unsigned char,
- palA, babl_format("RGBA u8"),
+ palA, babl_format("R'G'B'A u8"),
in, out);
}
if(0){
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 2a189c4..4d049be 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,