summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-05-11 19:17:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-05-11 19:18:29 +0000
commit781379e9c5a41a5b0db29a6d095c89029b6b85b7 (patch)
treeb06947273843597a79da461ee29caa8e05bd02d2
parentReleasing progress-linux version 0.1.44-1~dschinn1. (diff)
downloadbabl-781379e9c5a41a5b0db29a6d095c89029b6b85b7.zip
babl-781379e9c5a41a5b0db29a6d095c89029b6b85b7.tar.xz
Merging upstream version 0.1.46.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--INSTALL10
-rw-r--r--NEWS6
-rw-r--r--README43
-rw-r--r--babl/babl-version.h2
-rwxr-xr-xconfigure30
-rw-r--r--configure.ac2
-rw-r--r--docs/index-static.html.in12
-rw-r--r--extensions/Makefile.am6
-rw-r--r--extensions/Makefile.in88
-rw-r--r--extensions/cairo.c40
-rw-r--r--extensions/double.c291
-rw-r--r--extensions/fast-float.c20
-rw-r--r--extensions/float.c16
-rw-r--r--extensions/gegl-fixups.c41
-rw-r--r--extensions/gggl-table-lies.c52
-rw-r--r--extensions/gggl-table.c1
-rw-r--r--extensions/gggl.c51
-rw-r--r--extensions/gimp-8bit.c45
-rw-r--r--extensions/half.c (renamed from extensions/float-half.c)43
-rw-r--r--extensions/simple.c22
-rw-r--r--extensions/two-table.c11
-rw-r--r--extensions/u16.c (renamed from extensions/16bit.c)4
-rw-r--r--extensions/u32.c376
-rw-r--r--tools/babl_fish_path_fitness.c87
24 files changed, 1081 insertions, 218 deletions
diff --git a/INSTALL b/INSTALL
index e236cbe..934ff0a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
-babl 0.1.44
+babl 0.1.46
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.44.tar.bz2
- foo$ tar jxf babl-0.1.44.tar.gz
- foo$ cd babl-0.1.44
- foo/babl-0.1.44$ ./configure && make && sudo make install
+ foo$ wget ftp://ftp.gtk.org/pub/babl/0.1/babl-0.1.46.tar.bz2
+ foo$ tar jxf babl-0.1.46.tar.gz
+ foo$ cd babl-0.1.46
+ foo/babl-0.1.46$ ./configure && make && sudo make install
------------------------------------------------------------
diff --git a/NEWS b/NEWS
index 9af9184..0088a93 100644
--- a/NEWS
+++ b/NEWS
@@ -4,9 +4,13 @@ the news section both in the README and the webpage.
-->
+2018-04-10 babl-0.1.46 </dt><dd>
+added extensions with more coverage for u32, half and other utilit fast paths
+improving fast path coverage.
+ </dd><dt>
2018-02-18 babl-0.1.44 </dt><dd>
Fix bug in custom primaries/ICC fast paths, improve meson build<br/>
-
+ </dd><dt>
2018-01-23 babl-0.1.42 </dt><dd>
Fully initialize fishes when loading from cache. <br/>
</dd><dt>
diff --git a/README b/README
index 19294d3..62d82b3 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Babl-0.1.44
+Babl-0.1.46
Contents
@@ -8,7 +8,6 @@ Contents
• Documentation
• Usage
• Vocabulary
- • Shortcut Coverage
• Environment
• Extending
• Directory Overview
@@ -64,9 +63,12 @@ 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-04-10 babl-0.1.46
+ added extensions with more coverage for u32, half and other utilit
+ fast paths improving fast path coverage.
2018-02-18 babl-0.1.44
Fix bug in custom primaries/ICC fast paths, improve meson build
- 2018-01-23 babl-0.1.42
+2018-01-23 babl-0.1.42
Fully initialize fishes when loading from cache.
2018-01-16 babl-0.1.40
Added format "CIE XYZ alpha" color model and formats. New API
@@ -1641,6 +1643,19 @@ components
u8 Y
+cairo-ARGB32
+
+bytes/pixel
+ 4
+model
+ R'aG'aB'aA
+components
+
+ u8 B'a
+ u8 G'a
+ u8 R'a
+ u8 A
+
cairo-RGB24
bytes/pixel
@@ -1962,19 +1977,6 @@ components
float saturation
float lightness
-cairo-ARGB32
-
-bytes/pixel
- 4
-model
- R'aG'aB'aA
-components
-
- u8 B'a
- u8 G'a
- u8 R'a
- u8 A
-
cairo-A8
bytes/pixel
@@ -2148,13 +2150,6 @@ components
u8 yellow
u8 key
-Shortcut Coverage
-
-The diagram shown below visualizes the coverage of current shortcut
-conversions. Dots indicate a direct conversion is provided for, the
-height of the bar indicates the number of conversions steps needed in a
-chain of conversions.
-
Environment
Through the environment variable BABL_TOLERANCE you can control a speed
@@ -2286,4 +2281,4 @@ Ell
Félix Piédallu
Initial meson build
-/babl-0.1.44
+/babl-0.1.46
diff --git a/babl/babl-version.h b/babl/babl-version.h
index c218d1e..412f12b 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 44
+#define BABL_MICRO_VERSION 46
/** Get the version information on the babl library */
void babl_get_version (int *major,
diff --git a/configure b/configure
index 78d3726..61cf376 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.44.
+# Generated by GNU Autoconf 2.69 for babl 0.1.46.
#
#
# 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.44'
-PACKAGE_STRING='babl 0.1.44'
+PACKAGE_VERSION='0.1.46'
+PACKAGE_STRING='babl 0.1.46'
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.44 to adapt to many kinds of systems.
+\`configure' configures babl 0.1.46 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.44:";;
+ short | recursive ) echo "Configuration of babl 0.1.46:";;
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.44
+babl configure 0.1.46
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.44, which was
+It was created by babl $as_me 0.1.46, 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=44
+BABL_MICRO_VERSION=46
BABL_INTERFACE_AGE=1
-BABL_BINARY_AGE=144
-BABL_VERSION=0.1.44
-BABL_REAL_VERSION=0.1.44
+BABL_BINARY_AGE=146
+BABL_VERSION=0.1.46
+BABL_REAL_VERSION=0.1.46
BABL_API_VERSION=0.1
@@ -2333,7 +2333,7 @@ fi
-BABL_LIBRARY_VERSION="143:1:143"
+BABL_LIBRARY_VERSION="145:1:145"
BABL_CURRENT_MINUS_AGE=0
@@ -2965,7 +2965,7 @@ fi
# Define the identity of the package.
PACKAGE='babl'
- VERSION='0.1.44'
+ VERSION='0.1.46'
# 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.44, which was
+This file was extended by babl $as_me 0.1.46, 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.44
+babl config.status 0.1.46
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 9d3abdb..1cee024 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], [44])
+m4_define([babl_micro_version], [46])
m4_define([babl_real_version],
[babl_major_version.babl_minor_version.babl_micro_version])
m4_define([babl_version], [babl_real_version])
diff --git a/docs/index-static.html.in b/docs/index-static.html.in
index a84422d..b0a04bd 100644
--- a/docs/index-static.html.in
+++ b/docs/index-static.html.in
@@ -80,7 +80,6 @@
<li><a href='#Color-models'>&nbsp;&nbsp;&nbsp;&nbsp;Color models</a></li>
<li><a href='#Pixel-formats'>&nbsp;&nbsp;&nbsp;&nbsp;Pixel formats</a></li>-->
- <li><a href='#Shortcut_coverage'>&nbsp;&nbsp;Shortcut&nbsp;Coverage</a></li>
<li><a href='#Environment'>&nbsp;&nbsp;Environment</a></li>
<li><a href='#Extending'>&nbsp;&nbsp;Extending</a></li>
<li><a href='#DirectoryOverview'>&nbsp;&nbsp;Directory Overview</a></li>
@@ -311,15 +310,8 @@ lab_buffer = malloc (pixel_count * 3 * sizeof (float));
</li>
</ul>-->
- <a name='Shortcut_coverage'></a>
- <h3>Shortcut Coverage</h3>
- <p>The diagram shown below visualizes the coverage of current shortcut
- conversions. Dots indicate a direct conversion is provided for, the height
- of the bar indicates the number of conversions steps needed in a chain of
- conversions.
-
- <a name='Environment'></a>
- <h2>Environment</h2>
+ <a name='Environment'></a>
+ <h2>Environment</h2>
<p>Through the environment variable <tt>BABL_TOLERANCE</tt> you can control
a speed/performance trade off that by default is set very low (0.000001)
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index b103c93..a2a2943 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -15,10 +15,11 @@ AM_CPPFLAGS = \
extdir = $(libdir)/babl-@BABL_API_VERSION@
ext_LTLIBRARIES = \
- 16bit.la \
+ u16.la \
+ u32.la \
cairo.la \
CIE.la \
- float-half.la \
+ half.la \
gegl-fixups.la \
gggl-lies.la \
gggl-table.la \
@@ -26,6 +27,7 @@ ext_LTLIBRARIES = \
gggl.la \
gimp-8bit.la \
grey.la \
+ double.la \
float.la \
fast-float.la \
naive-CMYK.la \
diff --git a/extensions/Makefile.in b/extensions/Makefile.in
index 5ea5fe0..1dadb43 100644
--- a/extensions/Makefile.in
+++ b/extensions/Makefile.in
@@ -133,16 +133,13 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(extdir)"
LTLIBRARIES = $(ext_LTLIBRARIES)
-16bit_la_LIBADD =
-16bit_la_SOURCES = 16bit.c
-16bit_la_OBJECTS = 16bit.lo
+CIE_la_LIBADD =
+am_CIE_la_OBJECTS = CIE.lo
+CIE_la_OBJECTS = $(am_CIE_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
-CIE_la_LIBADD =
-am_CIE_la_OBJECTS = CIE.lo
-CIE_la_OBJECTS = $(am_CIE_la_OBJECTS)
HCY_la_LIBADD =
am_HCY_la_OBJECTS = HCY.lo
HCY_la_OBJECTS = $(am_HCY_la_OBJECTS)
@@ -155,12 +152,12 @@ HSV_la_OBJECTS = $(am_HSV_la_OBJECTS)
cairo_la_LIBADD =
am_cairo_la_OBJECTS = cairo.lo
cairo_la_OBJECTS = $(am_cairo_la_OBJECTS)
+double_la_LIBADD =
+double_la_SOURCES = double.c
+double_la_OBJECTS = double.lo
fast_float_la_LIBADD =
am_fast_float_la_OBJECTS = fast-float.lo
fast_float_la_OBJECTS = $(am_fast_float_la_OBJECTS)
-float_half_la_LIBADD =
-am_float_half_la_OBJECTS = float-half.lo
-float_half_la_OBJECTS = $(am_float_half_la_OBJECTS)
float_la_LIBADD =
am_float_la_OBJECTS = float.lo
float_la_OBJECTS = $(am_float_la_OBJECTS)
@@ -185,6 +182,9 @@ gimp_8bit_la_OBJECTS = $(am_gimp_8bit_la_OBJECTS)
grey_la_LIBADD =
am_grey_la_OBJECTS = grey.lo
grey_la_OBJECTS = $(am_grey_la_OBJECTS)
+half_la_LIBADD =
+half_la_SOURCES = half.c
+half_la_OBJECTS = half.lo
naive_CMYK_la_LIBADD =
am_naive_CMYK_la_OBJECTS = naive-CMYK.lo
naive_CMYK_la_OBJECTS = $(am_naive_CMYK_la_OBJECTS)
@@ -224,6 +224,12 @@ sse4_int8_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
two_table_la_LIBADD =
am_two_table_la_OBJECTS = two-table.lo
two_table_la_OBJECTS = $(am_two_table_la_OBJECTS)
+u16_la_LIBADD =
+u16_la_SOURCES = u16.c
+u16_la_OBJECTS = u16.lo
+u32_la_LIBADD =
+u32_la_SOURCES = u32.c
+u32_la_OBJECTS = u32.lo
ycbcr_la_LIBADD =
am_ycbcr_la_OBJECTS = ycbcr.lo
ycbcr_la_OBJECTS = $(am_ycbcr_la_OBJECTS)
@@ -261,29 +267,27 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = 16bit.c $(CIE_la_SOURCES) $(HCY_la_SOURCES) \
- $(HSL_la_SOURCES) $(HSV_la_SOURCES) $(cairo_la_SOURCES) \
- $(fast_float_la_SOURCES) $(float_half_la_SOURCES) \
- $(float_la_SOURCES) $(gegl_fixups_la_SOURCES) \
- $(gggl_lies_la_SOURCES) $(gggl_table_lies_la_SOURCES) \
- $(gggl_table_la_SOURCES) $(gggl_la_SOURCES) \
- $(gimp_8bit_la_SOURCES) $(grey_la_SOURCES) \
- $(naive_CMYK_la_SOURCES) $(simple_la_SOURCES) \
+SOURCES = $(CIE_la_SOURCES) $(HCY_la_SOURCES) $(HSL_la_SOURCES) \
+ $(HSV_la_SOURCES) $(cairo_la_SOURCES) double.c \
+ $(fast_float_la_SOURCES) $(float_la_SOURCES) \
+ $(gegl_fixups_la_SOURCES) $(gggl_lies_la_SOURCES) \
+ $(gggl_table_lies_la_SOURCES) $(gggl_table_la_SOURCES) \
+ $(gggl_la_SOURCES) $(gimp_8bit_la_SOURCES) $(grey_la_SOURCES) \
+ half.c $(naive_CMYK_la_SOURCES) $(simple_la_SOURCES) \
$(sse_half_la_SOURCES) $(sse2_float_la_SOURCES) \
$(sse2_int16_la_SOURCES) $(sse2_int8_la_SOURCES) \
- $(sse4_int8_la_SOURCES) $(two_table_la_SOURCES) \
+ $(sse4_int8_la_SOURCES) $(two_table_la_SOURCES) u16.c u32.c \
$(ycbcr_la_SOURCES)
-DIST_SOURCES = 16bit.c $(CIE_la_SOURCES) $(HCY_la_SOURCES) \
- $(HSL_la_SOURCES) $(HSV_la_SOURCES) $(cairo_la_SOURCES) \
- $(fast_float_la_SOURCES) $(float_half_la_SOURCES) \
- $(float_la_SOURCES) $(gegl_fixups_la_SOURCES) \
- $(gggl_lies_la_SOURCES) $(gggl_table_lies_la_SOURCES) \
- $(gggl_table_la_SOURCES) $(gggl_la_SOURCES) \
- $(gimp_8bit_la_SOURCES) $(grey_la_SOURCES) \
- $(naive_CMYK_la_SOURCES) $(simple_la_SOURCES) \
+DIST_SOURCES = $(CIE_la_SOURCES) $(HCY_la_SOURCES) $(HSL_la_SOURCES) \
+ $(HSV_la_SOURCES) $(cairo_la_SOURCES) double.c \
+ $(fast_float_la_SOURCES) $(float_la_SOURCES) \
+ $(gegl_fixups_la_SOURCES) $(gggl_lies_la_SOURCES) \
+ $(gggl_table_lies_la_SOURCES) $(gggl_table_la_SOURCES) \
+ $(gggl_la_SOURCES) $(gimp_8bit_la_SOURCES) $(grey_la_SOURCES) \
+ half.c $(naive_CMYK_la_SOURCES) $(simple_la_SOURCES) \
$(sse_half_la_SOURCES) $(sse2_float_la_SOURCES) \
$(sse2_int16_la_SOURCES) $(sse2_int8_la_SOURCES) \
- $(sse4_int8_la_SOURCES) $(two_table_la_SOURCES) \
+ $(sse4_int8_la_SOURCES) $(two_table_la_SOURCES) u16.c u32.c \
$(ycbcr_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
@@ -475,10 +479,11 @@ AM_CPPFLAGS = \
extdir = $(libdir)/babl-@BABL_API_VERSION@
ext_LTLIBRARIES = \
- 16bit.la \
+ u16.la \
+ u32.la \
cairo.la \
CIE.la \
- float-half.la \
+ half.la \
gegl-fixups.la \
gggl-lies.la \
gggl-table.la \
@@ -486,6 +491,7 @@ ext_LTLIBRARIES = \
gggl.la \
gimp-8bit.la \
grey.la \
+ double.la \
float.la \
fast-float.la \
naive-CMYK.la \
@@ -599,9 +605,6 @@ clean-extLTLIBRARIES:
rm -f $${locs}; \
}
-16bit.la: $(16bit_la_OBJECTS) $(16bit_la_DEPENDENCIES) $(EXTRA_16bit_la_DEPENDENCIES)
- $(AM_V_CCLD)$(LINK) -rpath $(extdir) $(16bit_la_OBJECTS) $(16bit_la_LIBADD) $(LIBS)
-
CIE.la: $(CIE_la_OBJECTS) $(CIE_la_DEPENDENCIES) $(EXTRA_CIE_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(CIE_la_OBJECTS) $(CIE_la_LIBADD) $(LIBS)
@@ -617,12 +620,12 @@ HSV.la: $(HSV_la_OBJECTS) $(HSV_la_DEPENDENCIES) $(EXTRA_HSV_la_DEPENDENCIES)
cairo.la: $(cairo_la_OBJECTS) $(cairo_la_DEPENDENCIES) $(EXTRA_cairo_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(cairo_la_OBJECTS) $(cairo_la_LIBADD) $(LIBS)
+double.la: $(double_la_OBJECTS) $(double_la_DEPENDENCIES) $(EXTRA_double_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) -rpath $(extdir) $(double_la_OBJECTS) $(double_la_LIBADD) $(LIBS)
+
fast-float.la: $(fast_float_la_OBJECTS) $(fast_float_la_DEPENDENCIES) $(EXTRA_fast_float_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(fast_float_la_OBJECTS) $(fast_float_la_LIBADD) $(LIBS)
-float-half.la: $(float_half_la_OBJECTS) $(float_half_la_DEPENDENCIES) $(EXTRA_float_half_la_DEPENDENCIES)
- $(AM_V_CCLD)$(LINK) -rpath $(extdir) $(float_half_la_OBJECTS) $(float_half_la_LIBADD) $(LIBS)
-
float.la: $(float_la_OBJECTS) $(float_la_DEPENDENCIES) $(EXTRA_float_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(float_la_OBJECTS) $(float_la_LIBADD) $(LIBS)
@@ -647,6 +650,9 @@ gimp-8bit.la: $(gimp_8bit_la_OBJECTS) $(gimp_8bit_la_DEPENDENCIES) $(EXTRA_gimp_
grey.la: $(grey_la_OBJECTS) $(grey_la_DEPENDENCIES) $(EXTRA_grey_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(grey_la_OBJECTS) $(grey_la_LIBADD) $(LIBS)
+half.la: $(half_la_OBJECTS) $(half_la_DEPENDENCIES) $(EXTRA_half_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) -rpath $(extdir) $(half_la_OBJECTS) $(half_la_LIBADD) $(LIBS)
+
naive-CMYK.la: $(naive_CMYK_la_OBJECTS) $(naive_CMYK_la_DEPENDENCIES) $(EXTRA_naive_CMYK_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(naive_CMYK_la_OBJECTS) $(naive_CMYK_la_LIBADD) $(LIBS)
@@ -671,6 +677,12 @@ sse4-int8.la: $(sse4_int8_la_OBJECTS) $(sse4_int8_la_DEPENDENCIES) $(EXTRA_sse4_
two-table.la: $(two_table_la_OBJECTS) $(two_table_la_DEPENDENCIES) $(EXTRA_two_table_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(two_table_la_OBJECTS) $(two_table_la_LIBADD) $(LIBS)
+u16.la: $(u16_la_OBJECTS) $(u16_la_DEPENDENCIES) $(EXTRA_u16_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) -rpath $(extdir) $(u16_la_OBJECTS) $(u16_la_LIBADD) $(LIBS)
+
+u32.la: $(u32_la_OBJECTS) $(u32_la_DEPENDENCIES) $(EXTRA_u32_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) -rpath $(extdir) $(u32_la_OBJECTS) $(u32_la_LIBADD) $(LIBS)
+
ycbcr.la: $(ycbcr_la_OBJECTS) $(ycbcr_la_DEPENDENCIES) $(EXTRA_ycbcr_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) -rpath $(extdir) $(ycbcr_la_OBJECTS) $(ycbcr_la_LIBADD) $(LIBS)
@@ -680,14 +692,13 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/16bit.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CIE.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HCY.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HSL.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HSV.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/double.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fast-float.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float-half.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gegl-fixups.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gggl-lies.Plo@am__quote@
@@ -696,6 +707,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gggl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimp-8bit.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grey.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/half.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/naive-CMYK.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sse2_float_la-sse2-float.Plo@am__quote@
@@ -704,6 +716,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sse4_int8_la-sse4-int8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sse_half_la-sse-half.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two-table.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u16.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/u32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ycbcr.Plo@am__quote@
.c.o:
diff --git a/extensions/cairo.c b/extensions/cairo.c
index 114194a..b296751 100644
--- a/extensions/cairo.c
+++ b/extensions/cairo.c
@@ -26,7 +26,7 @@
int init (void);
-static inline void
+static void
conv_rgba8_cairo24_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -44,7 +44,7 @@ conv_rgba8_cairo24_le (const Babl *conversion,unsigned char *src, unsigned char
}
}
-static inline void
+static void
conv_rgb8_cairo24_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -63,7 +63,7 @@ conv_rgb8_cairo24_le (const Babl *conversion,unsigned char *src, unsigned char *
}
#if 0
-static inline void
+static void
conv_rgbA8_premul_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -82,7 +82,7 @@ conv_rgbA8_premul_cairo32_le (const Babl *conversion,unsigned char *src, unsigne
}
#else
-static inline void
+static void
conv_rgbA8_premul_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -137,26 +137,24 @@ static void conv_cairo32_rgbAF_premul_le (const Babl *conversion,unsigned char *
}
}
-static inline void
-conv_rgbA8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
+static void
+conv_rgba8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
+ uint32_t *dsti = (void*) dst;
while (n--)
{
- unsigned char red = *src++;
- unsigned char green = *src++;
- unsigned char blue = *src++;
- unsigned char alpha = *src++;
-
+ unsigned char alpha = src[3];
#define div_255(a) ((((a)+128)+(((a)+128)>>8))>>8)
- *dst++ = div_255 (blue * alpha);
- *dst++ = div_255 (green * alpha);
- *dst++ = div_255 (red * alpha);
- *dst++ = alpha;
+ *dsti++ = (alpha << 24) +
+ (div_255 (src[0] * alpha) << 16) +
+ (div_255 (src[1] * alpha) << 8) +
+ (div_255 (src[2] * alpha));
+ src+=4;
}
}
-static inline void
+static void
conv_rgb8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -176,7 +174,7 @@ conv_rgb8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *
-static inline void
+static void
conv_yA8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -195,7 +193,7 @@ conv_yA8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *d
}
}
-static inline void
+static void
conv_yA16_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -212,7 +210,7 @@ conv_yA16_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *
}
}
-static inline void
+static void
conv_y8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -226,7 +224,7 @@ conv_y8_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *ds
}
}
-static inline void
+static void
conv_y16_cairo32_le (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -398,7 +396,7 @@ init (void)
conv_rgbA8_premul_cairo32_le, NULL);
babl_conversion_new (babl_format ("R'G'B'A u8"), f32, "linear",
- conv_rgbA8_cairo32_le, NULL);
+ conv_rgba8_cairo32_le, NULL);
babl_conversion_new (babl_format ("R'G'B' u8"), f32, "linear",
diff --git a/extensions/double.c b/extensions/double.c
new file mode 100644
index 0000000..98a3351
--- /dev/null
+++ b/extensions/double.c
@@ -0,0 +1,291 @@
+/* babl - dynamically extendable universal pixel conversion library.
+ * Copyright (C) 2012, Øyvind Kolås
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "babl-internal.h"
+#include "babl-cpuaccel.h"
+#include "extensions/util.h"
+#include "base/util.h"
+
+
+static void
+conv_rgbaD_linear_rgbAD_gamma (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ const Babl **trc = (void*)space->space.trc;
+
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ double alpha = fsrc[3];
+ *fdst++ = babl_trc_from_linear (trc[0], *fsrc++) * alpha;
+ *fdst++ = babl_trc_from_linear (trc[1], *fsrc++) * alpha;
+ *fdst++ = babl_trc_from_linear (trc[2], *fsrc++) * alpha;
+ *fdst++ = *fsrc++;
+ }
+}
+
+static void
+conv_rgbAD_linear_rgbAD_gamma (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ const Babl **trc = (void*)space->space.trc;
+
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ double alpha = fsrc[3];
+ if (alpha < BABL_ALPHA_THRESHOLD)
+ {
+ *fdst++ = 0.0;
+ *fdst++ = 0.0;
+ *fdst++ = 0.0;
+ *fdst++ = 0.0;
+ fsrc+=4;
+ }
+ else if (alpha >= 1.0)
+ {
+ *fdst++ = babl_trc_from_linear (trc[0], *fsrc++) * alpha;
+ *fdst++ = babl_trc_from_linear (trc[1], *fsrc++) * alpha;
+ *fdst++ = babl_trc_from_linear (trc[2], *fsrc++) * alpha;
+ *fdst++ = *fsrc++;
+ }
+ else
+ {
+ double alpha_recip = 1.0 / alpha;
+ *fdst++ = babl_trc_from_linear (trc[0], *fsrc++ * alpha_recip) * alpha;
+ *fdst++ = babl_trc_from_linear (trc[1], *fsrc++ * alpha_recip) * alpha;
+ *fdst++ = babl_trc_from_linear (trc[2], *fsrc++ * alpha_recip) * alpha;
+ *fdst++ = *fsrc++;
+ }
+ }
+}
+
+static void
+conv_rgbaD_linear_rgbaD_gamma (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ const Babl **trc = (void*)space->space.trc;
+
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ *fdst++ = babl_trc_from_linear (trc[0], *fsrc++);
+ *fdst++ = babl_trc_from_linear (trc[1], *fsrc++);
+ *fdst++ = babl_trc_from_linear (trc[2], *fsrc++);
+ *fdst++ = *fsrc++;
+ }
+}
+
+#define conv_rgbaD_linear_rgbD_linear conv_rgbaD_gamma_rgbD_gamma
+
+static void
+conv_rgbaD_linear_rgbD_linear (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ *fdst++ = *fsrc++;
+ *fdst++ = *fsrc++;
+ *fdst++ = *fsrc++;
+ fsrc++;
+ }
+}
+
+
+static void
+conv_rgbD_linear_rgbD_gamma (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ const Babl **trc = (void*)space->space.trc;
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ *fdst++ = babl_trc_from_linear (trc[0], *fsrc++);
+ *fdst++ = babl_trc_from_linear (trc[1], *fsrc++);
+ *fdst++ = babl_trc_from_linear (trc[2], *fsrc++);
+ }
+}
+
+
+static void
+conv_rgbaD_gamma_rgbaD_linear (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ const Babl **trc = (void*)space->space.trc;
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ *fdst++ = babl_trc_to_linear (trc[0], *fsrc++);
+ *fdst++ = babl_trc_to_linear (trc[1], *fsrc++);
+ *fdst++ = babl_trc_to_linear (trc[2], *fsrc++);
+ *fdst++ = *fsrc++;
+ }
+}
+
+static void
+conv_rgbD_gamma_rgbD_linear (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ const Babl **trc = (void*)space->space.trc;
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ *fdst++ = babl_trc_to_linear (trc[0], *fsrc++);
+ *fdst++ = babl_trc_to_linear (trc[1], *fsrc++);
+ *fdst++ = babl_trc_to_linear (trc[2], *fsrc++);
+ }
+}
+
+
+static void
+conv_rgbD_linear_rgbaD_linear (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ const Babl *space = babl_conversion_get_destination_space (conversion);
+ const Babl **trc = (void*)space->space.trc;
+ double *fsrc = (double *) src;
+ double *fdst = (double *) dst;
+ int n = samples;
+
+ while (n--)
+ {
+ *fdst++ = babl_trc_to_linear (trc[0], *fsrc++);
+ *fdst++ = babl_trc_to_linear (trc[1], *fsrc++);
+ *fdst++ = babl_trc_to_linear (trc[2], *fsrc++);
+ *fdst++ = 1.0;
+ }
+}
+
+
+#define conv_rgbD_gamma_rgbaD_gamma conv_rgbD_linear_rgbaD_linear
+
+#define o(src, dst) \
+ babl_conversion_new (src, dst, "linear", conv_ ## src ## _ ## dst, NULL)
+
+int init (void);
+
+int
+init (void)
+{
+ const Babl *rgbaD_linear = babl_format_new (
+ babl_model ("RGBA"),
+ babl_type ("double"),
+ babl_component ("R"),
+ babl_component ("G"),
+ babl_component ("B"),
+ babl_component ("A"),
+ NULL);
+ const Babl *rgbAD_linear = babl_format_new (
+ babl_model ("RaGaBaA"),
+ babl_type ("double"),
+ babl_component ("Ra"),
+ babl_component ("Ga"),
+ babl_component ("Ba"),
+ babl_component ("A"),
+ NULL);
+ const Babl *rgbaD_gamma = babl_format_new (
+ babl_model ("R'G'B'A"),
+ babl_type ("double"),
+ babl_component ("R'"),
+ babl_component ("G'"),
+ babl_component ("B'"),
+ babl_component ("A"),
+ NULL);
+ const Babl *rgbAD_gamma = babl_format_new (
+ babl_model ("R'aG'aB'aA"),
+ babl_type ("double"),
+ babl_component ("R'a"),
+ babl_component ("G'a"),
+ babl_component ("B'a"),
+ babl_component ("A"),
+ NULL);
+ const Babl *rgbD_linear = babl_format_new (
+ babl_model ("RGB"),
+ babl_type ("double"),
+ babl_component ("R"),
+ babl_component ("G"),
+ babl_component ("B"),
+ NULL);
+ const Babl *rgbD_gamma = babl_format_new (
+ babl_model ("R'G'B'"),
+ babl_type ("double"),
+ babl_component ("R'"),
+ babl_component ("G'"),
+ babl_component ("B'"),
+ NULL);
+
+ o (rgbAD_linear, rgbAD_gamma);
+ o (rgbaD_linear, rgbAD_gamma);
+ o (rgbaD_linear, rgbaD_gamma);
+ o (rgbaD_gamma, rgbaD_linear);
+ o (rgbD_linear, rgbD_gamma);
+ o (rgbD_gamma, rgbD_linear);
+ o (rgbaD_linear, rgbD_linear);
+ o (rgbaD_gamma, rgbD_gamma);
+
+
+ o (rgbD_linear, rgbaD_linear);
+ o (rgbD_gamma, rgbaD_gamma);
+ o (rgbaD_linear, rgbD_linear);
+ o (rgbaD_gamma, rgbD_gamma);
+
+ return 0;
+}
+
diff --git a/extensions/fast-float.c b/extensions/fast-float.c
index 328cbff..b0b7dba 100644
--- a/extensions/fast-float.c
+++ b/extensions/fast-float.c
@@ -26,8 +26,6 @@
#include "extensions/util.h"
#include "base/util.h"
-#define INLINE inline
-
#define LSHIFT 4
typedef float (* BablLookupFunction) (float value,
@@ -287,7 +285,7 @@ babl_lookup_free (BablLookup *lookup)
}
#endif
-static INLINE void
+static void
conv_rgbaF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -328,7 +326,7 @@ conv_rgbaF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src,
-static INLINE void
+static void
conv_rgbaF_linear_rgba8_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -364,7 +362,7 @@ conv_rgbaF_linear_rgba8_gamma (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbaF_linear_rgbA8_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -408,7 +406,7 @@ conv_rgbaF_linear_rgbA8_gamma (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_yaF_linear_rgbA8_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -492,7 +490,7 @@ conv_rgbaF_linear_rgbA8_gamma_cairo (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbAF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -532,7 +530,7 @@ conv_rgbAF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbaF_linear_rgbaF_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -550,7 +548,7 @@ conv_rgbaF_linear_rgbaF_gamma (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbF_linear_rgbF_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -568,7 +566,7 @@ conv_rgbF_linear_rgbF_gamma (const Babl *conversion,unsigned char *src,
}
-static INLINE void
+static void
conv_rgbaF_gamma_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -586,7 +584,7 @@ conv_rgbaF_gamma_rgbaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbF_gamma_rgbF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
diff --git a/extensions/float.c b/extensions/float.c
index e832e2e..d700b14 100644
--- a/extensions/float.c
+++ b/extensions/float.c
@@ -26,11 +26,7 @@
#include "extensions/util.h"
#include "base/util.h"
-
-#define INLINE inline
-
-
-static INLINE void
+static void
conv_rgbaF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -52,7 +48,7 @@ conv_rgbaF_linear_rgbAF_gamma (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbAF_linear_rgbAF_gamma (const Babl *conversion,
unsigned char *src,
unsigned char *dst,
@@ -94,7 +90,7 @@ conv_rgbAF_linear_rgbAF_gamma (const Babl *conversion,
}
}
-static INLINE void
+static void
conv_rgbaF_linear_rgbaF_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -115,7 +111,7 @@ conv_rgbaF_linear_rgbaF_gamma (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbF_linear_rgbF_gamma (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -135,7 +131,7 @@ conv_rgbF_linear_rgbF_gamma (const Babl *conversion,unsigned char *src,
}
-static INLINE void
+static void
conv_rgbaF_gamma_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -155,7 +151,7 @@ conv_rgbaF_gamma_rgbaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbF_gamma_rgbF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
diff --git a/extensions/gegl-fixups.c b/extensions/gegl-fixups.c
index e3bb836..1fbb2bd 100644
--- a/extensions/gegl-fixups.c
+++ b/extensions/gegl-fixups.c
@@ -49,8 +49,6 @@
#include "extensions/util.h"
-#define INLINE inline
-
/* lookup tables used in conversion */
static float table_8_F[1 << 8];
@@ -133,7 +131,7 @@ table_init (void)
}
/* function to find the index in table for a float */
-static unsigned int
+static inline unsigned int
gggl_float_to_index16 (float f)
{
union
@@ -145,7 +143,7 @@ gggl_float_to_index16 (float f)
return (u.s >> 15) & ((1 << 17)-1);
}
-static INLINE void
+static inline void
conv_F_8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -162,7 +160,7 @@ conv_F_8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long sa
}
-static INLINE void
+static inline void
conv_F_8g (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -179,7 +177,7 @@ conv_F_8g (const Babl *conversion,unsigned char *src, unsigned char *dst, long s
}
-static INLINE void __attribute__((unused))
+static inline void __attribute__((unused))
conv_8_F (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -195,7 +193,7 @@ conv_8_F (const Babl *conversion,unsigned char *src, unsigned char *dst, long sa
}
-static INLINE void
+static void
conv_rgbaF_rgb8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -222,7 +220,7 @@ conv_rgbaF_rgb8 (const Babl *conversion,unsigned char *src, unsigned char *dst,
}
-static INLINE void __attribute__((unused))
+static void __attribute__((unused))
conv_rgbaF_rgba8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -253,13 +251,13 @@ conv_rgbaF_rgba8 (const Babl *conversion,unsigned char *src, unsigned char *dst,
#define conv_rgbaF_rgbP8 conv_rgbaF_rgba8
-static INLINE void __attribute__((unused))
+static void __attribute__((unused))
conv_rgbF_rgb8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
conv_F_8g (conversion, src, dst, samples * 3);
}
-static INLINE void __attribute__((unused))
+static void __attribute__((unused))
conv_gaF_ga8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
conv_F_8 (conversion, src, dst, samples * 2);
@@ -270,7 +268,7 @@ conv_gaF_ga8 (const Babl *conversion,unsigned char *src, unsigned char *dst, lon
#define conv_gAF_gA8 conv_gaF_ga8
-static INLINE void
+static void
conv_rgba8_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -295,7 +293,7 @@ conv_rgba8_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst,
}
}
-static INLINE void
+static void
conv_rgb8_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -447,6 +445,22 @@ conv_rgbAF_lrgba8 (const Babl *conversion,unsigned char *srcc,
}
}
+static void
+conv_rgba8_rgb8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
+{
+ long n = samples - 1;
+
+ while (n--)
+ {
+ *(unsigned int *) dst = (*(unsigned int *) src);
+ src += 4;
+ dst += 3;
+ }
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+}
+
#define conv_rgb8_rgbAF conv_rgb8_rgbaF
#define conv_gamma_rgbaF_gamma_rgbAF conv_rgbaF_rgbAF
#define conv_gamma_rgbAF_gamma_rgbaF conv_rgbAF_rgbaF
@@ -531,10 +545,8 @@ init (void)
o (rgbaF, rgbAF);
o (rgbAF, rgbaF);
-
o (gamma_rgbaF, gamma_rgbAF);
o (gamma_rgbAF, gamma_rgbaF);
-
o (rgbAF, lrgba8);
o (rgb8, rgbaF);
o (rgb8, rgbAF);
@@ -542,6 +554,7 @@ init (void)
o (rgbaF, rgb8);
o (rgbAF, rgb8);
o (bgrA8, rgba8);
+ o (rgba8, rgb8);
return 0;
}
diff --git a/extensions/gggl-table-lies.c b/extensions/gggl-table-lies.c
index 6cce2ba..88da9b6 100644
--- a/extensions/gggl-table-lies.c
+++ b/extensions/gggl-table-lies.c
@@ -302,6 +302,38 @@ conv_ga16_gaF (const Babl *conversion,unsigned char *src, unsigned char *dst, lo
#define conv_gA16_gAF conv_ga16_gaF
#define conv_g16_gF conv_16_F
+static void
+conv_rgbafloat_linear_cairo32_le (const Babl *conversion,unsigned char *src_char,
+ unsigned char *dst,
+ long samples)
+{
+ long n = samples;
+ float *src = (float*)src_char;
+
+ while (n--)
+ {
+ float alpha = src[3] * 255;
+#define BABL_ALPHA_THRESHOLD 0.000000152590219
+
+ if (alpha < BABL_ALPHA_THRESHOLD)
+ {
+ *(int *)dst = 0;
+ }
+ else
+ {
+ if (alpha > 255) alpha = 255;
+#define div_255(a) ((((a)+128)+(((a)+128)>>8))>>8)
+ dst[0] = src[2] * alpha + 0.5f;
+ dst[1] = src[1] * alpha + 0.5f;
+ dst[2] = src[0] * alpha + 0.5f;
+ dst[3] = alpha + 0.5f;
+ }
+ src += 4;
+ dst += 4;
+ }
+}
+
+
int init (void);
int
@@ -428,6 +460,26 @@ init (void)
babl_component ("Y"),
NULL);
+ int testint = 23;
+ char *testchar = (char*) &testint;
+ int littleendian = (testchar[0] == 23);
+
+ if (littleendian)
+ {
+ const Babl *f32 = babl_format_new (
+ "name", "cairo-ARGB32",
+ babl_model ("R'aG'aB'aA"),
+ babl_type ("u8"),
+ babl_component ("B'a"),
+ babl_component ("G'a"),
+ babl_component ("R'a"),
+ babl_component ("A"),
+ NULL
+ );
+ babl_conversion_new (babl_format ("RGBA float"), f32, "linear",
+ conv_rgbafloat_linear_cairo32_le, NULL);
+ }
+
#define o(src, dst) \
babl_conversion_new (src, dst, "linear", conv_ ## src ## _ ## dst, NULL)
diff --git a/extensions/gggl-table.c b/extensions/gggl-table.c
index 0ce0353..37d68dc 100644
--- a/extensions/gggl-table.c
+++ b/extensions/gggl-table.c
@@ -164,6 +164,7 @@ conv_F_8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long sa
}
}
+
static void
conv_F_16 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
diff --git a/extensions/gggl.c b/extensions/gggl.c
index 625d730..200caa3 100644
--- a/extensions/gggl.c
+++ b/extensions/gggl.c
@@ -411,20 +411,15 @@ static void
conv_rgbF_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
+ float *fsrc = (void*) src;
+ float *fdst = (void*) dst;
while (n--)
{
- *(uint32_t *) dst = (*(uint32_t *) src);
- src += 4;
- dst += 4;
- *(uint32_t *) dst = (*(uint32_t *) src);
- src += 4;
- dst += 4;
- *(uint32_t *) dst = (*(uint32_t *) src);
- src += 4;
- dst += 4;
- *(float *) dst = 1.0;
- dst += 4;
+ *fdst++ = *fsrc++;
+ *fdst++ = *fsrc++;
+ *fdst++ = *fsrc++;
+ *fdst++ = 1.0f;
}
}
@@ -485,6 +480,37 @@ conv_gF_rgbF (const Babl *conversion,unsigned char *src, unsigned char *dst, lon
}
static void
+conv_g8_rgb8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
+{
+ long n = samples;
+
+ while (n--)
+ {
+ dst[0]=*src;
+ dst[1]=*src;
+ dst[2]=*src;
+ dst += 3;
+ src += 1;
+ }
+}
+#define conv_g8_rgbA8 conv_g8_rgba8
+static void
+conv_g8_rgba8 (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
+{
+ long n = samples;
+
+ while (n--)
+ {
+ dst[0]=*src;
+ dst[1]=*src;
+ dst[2]=*src;
+ dst[3]=255;
+ dst += 4;
+ src += 1;
+ }
+}
+
+static void
conv_gaF_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
@@ -1067,6 +1093,9 @@ init (void)
o (ga8, gaF);
o (gA8, gAF);
o (g8, gF);
+ o (g8, rgb8);
+ o (g8, rgba8);
+ o (g8, rgbA8);
o (gaF, ga16);
o (gAF, gA16);
o (gF, g16);
diff --git a/extensions/gimp-8bit.c b/extensions/gimp-8bit.c
index 3db0be7..a994298 100644
--- a/extensions/gimp-8bit.c
+++ b/extensions/gimp-8bit.c
@@ -27,8 +27,6 @@
#include "base/util.h"
#include "extensions/util.h"
-#define INLINE inline
-
/* lookup tables used in conversion */
@@ -69,7 +67,7 @@ tables_init (const Babl *space)
return j;
}
-static INLINE void
+static inline void
u8_linear_to_float_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -82,7 +80,7 @@ u8_linear_to_float_linear (const Babl *conversion,unsigned char *src,
}
-static INLINE void
+static void
u8_linear_to_float_linear_premul (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -102,7 +100,7 @@ u8_linear_to_float_linear_premul (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static inline void
u8_gamma_2_2_to_float_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -115,7 +113,7 @@ u8_gamma_2_2_to_float_linear (const Babl *conversion,unsigned char *src,
*d++ = lut_gamma_2_2[space_no][*src++];
}
-static INLINE void
+static void
conv_rgba8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -123,7 +121,7 @@ conv_rgba8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
u8_linear_to_float_linear (conversion, src, dst, samples * 4);
}
-static INLINE void
+static void
conv_rgba8_linear_ragabaaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -132,7 +130,7 @@ conv_rgba8_linear_ragabaaF_linear (const Babl *conversion,unsigned char *src,
}
-static INLINE void
+static void
conv_rgba8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -150,7 +148,7 @@ conv_rgba8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgb8_linear_rgbF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -158,7 +156,7 @@ conv_rgb8_linear_rgbF_linear (const Babl *conversion,unsigned char *src,
u8_linear_to_float_linear (conversion, src, dst, samples * 3);
}
-static INLINE void
+static void
conv_rgb8_gamma_2_2_rgbF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -166,7 +164,7 @@ conv_rgb8_gamma_2_2_rgbF_linear (const Babl *conversion,unsigned char *src,
u8_gamma_2_2_to_float_linear (conversion, src, dst, samples * 3);
}
-static INLINE void
+static void
conv_rgb8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -185,7 +183,7 @@ conv_rgb8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
#define conv_rgb8_linear_ragabaaF_linear conv_rgb8_linear_rgbaF_linear
-static INLINE void
+static void
conv_rgb8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -203,7 +201,7 @@ conv_rgb8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_ga8_linear_gaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -211,7 +209,7 @@ conv_ga8_linear_gaF_linear (const Babl *conversion,unsigned char *src,
u8_linear_to_float_linear (conversion, src, dst, samples * 2);
}
-static INLINE void
+static void
conv_ga8_gamma_2_2_gaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -227,7 +225,7 @@ conv_ga8_gamma_2_2_gaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_ga8_gamma_2_2_rgba8_gamma_2_2 (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -243,7 +241,7 @@ conv_ga8_gamma_2_2_rgba8_gamma_2_2 (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_ga8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -262,7 +260,7 @@ conv_ga8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_ga8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -282,7 +280,7 @@ conv_ga8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_g8_linear_gF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -290,7 +288,7 @@ conv_g8_linear_gF_linear (const Babl *conversion,unsigned char *src,
u8_linear_to_float_linear (conversion, src, dst, samples);
}
-static INLINE void
+static void
conv_g8_gamma_2_2_gF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -298,7 +296,7 @@ conv_g8_gamma_2_2_gF_linear (const Babl *conversion,unsigned char *src,
u8_gamma_2_2_to_float_linear (conversion, src, dst, samples);
}
-static INLINE void
+static void
conv_g8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -316,7 +314,8 @@ conv_g8_linear_rgbaF_linear (const Babl *conversion,unsigned char *src,
*d++ = 1.0;
}
}
-static INLINE void
+
+static void
conv_g8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -336,7 +335,7 @@ conv_g8_gamma_2_2_rgbaF_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbaF_linear_rgb8_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -360,7 +359,7 @@ conv_rgbaF_linear_rgb8_linear (const Babl *conversion,unsigned char *src,
}
}
-static INLINE void
+static void
conv_rgbaF_linear_rgba8_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
diff --git a/extensions/float-half.c b/extensions/half.c
index 2c09ba0..c45ea85 100644
--- a/extensions/float-half.c
+++ b/extensions/half.c
@@ -252,7 +252,9 @@ conv_rgbaHalf_rgbaF (const Babl *conversion,const uint16_t *src, float *dst, lon
conv_yHalf_yF (conversion, src, dst, samples * 4);
}
-static inline void
+#define conv_rgbAHalf_rgbAF conv_rgbaHalf_rgbaF
+
+static void
conv_yF_yHalf (const Babl *conversion,const float *src, uint16_t *dst, long samples)
{
singles2halfp (dst, src, samples);
@@ -276,6 +278,8 @@ conv_rgbaF_rgbaHalf (const Babl *conversion,const float *src, uint16_t *dst, lon
conv_yF_yHalf (conversion, src, dst, samples * 4);
}
+#define conv_rgbAF_rgbAHalf conv_rgbaF_rgbaHalf
+
static void singles2halfp2(void *target, const void *source, long numel)
{
uint16_t *hp = (uint16_t *) target; // Type pun output as an unsigned 16-bit int
@@ -331,7 +335,7 @@ static void singles2halfp2(void *target, const void *source, long numel)
}
}
-static inline void
+static void
conv2_yF_yHalf (const Babl *conversion,const float *src, uint16_t *dst, long samples)
{
singles2halfp2 (dst, src, samples);
@@ -369,6 +373,39 @@ init (void)
babl_component ("B"),
babl_component ("A"),
NULL);
+ const Babl *rgbAF_linear = babl_format_new (
+ babl_model ("RaGaBaA"),
+ babl_type ("float"),
+ babl_component ("Ra"),
+ babl_component ("Ga"),
+ babl_component ("Ba"),
+ babl_component ("A"),
+ NULL);
+ const Babl *rgbAHalf_linear = babl_format_new (
+ babl_model ("RaGaBaA"),
+ babl_type ("half"),
+ babl_component ("Ra"),
+ babl_component ("Ga"),
+ babl_component ("Ba"),
+ babl_component ("A"),
+ NULL);
+ const Babl *rgbAF_gamma = babl_format_new (
+ babl_model ("R'aG'aB'aA"),
+ babl_type ("float"),
+ babl_component ("R'a"),
+ babl_component ("G'a"),
+ babl_component ("B'a"),
+ babl_component ("A"),
+ NULL);
+ const Babl *rgbAHalf_gamma = babl_format_new (
+ babl_model ("R'aG'aB'aA"),
+ babl_type ("half"),
+ babl_component ("R'a"),
+ babl_component ("G'a"),
+ babl_component ("B'a"),
+ babl_component ("A"),
+ NULL);
+
const Babl *rgbaHalf_linear = babl_format_new (
babl_model ("RGBA"),
babl_type ("half"),
@@ -485,6 +522,8 @@ init (void)
babl_conversion_new (src ## _gamma, dst ## _gamma, "linear", conv2_ ## src ## _ ## dst, NULL); \
}
+ CONV(rgbAHalf, rgbAF);
+ CONV(rgbAF, rgbAHalf);
CONV(rgbaHalf, rgbaF);
CONV(rgbHalf, rgbF);
CONV(yaHalf, yaF);
diff --git a/extensions/simple.c b/extensions/simple.c
index 1d8e750..072568d 100644
--- a/extensions/simple.c
+++ b/extensions/simple.c
@@ -168,7 +168,7 @@ float_to_u32_x1 (const Babl *conversion,unsigned char *src_char, unsigned char *
long n = samples;
while (n--)
{
- float r = src[0];
+ double r = src[0];
dst[0] = (r >= 1.0f) ? 0xFFFFFFFF : ((r <= 0.0f) ? 0x0 : 0xFFFFFFFF * r + 0.5f);
@@ -176,17 +176,17 @@ float_to_u32_x1 (const Babl *conversion,unsigned char *src_char, unsigned char *
src += 1;
}
}
-static inline void
+static void
float_to_u32_x2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
float_to_u32_x1 (conversion, src_char, dst_char, samples * 2);
}
-static inline void
+static void
float_to_u32_x3 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
float_to_u32_x1 (conversion, src_char, dst_char, samples * 3);
}
-static inline void
+static void
float_to_u32_x4 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
float_to_u32_x1 (conversion, src_char, dst_char, samples * 4);
@@ -201,26 +201,26 @@ u32_to_float (const Babl *conversion,unsigned char *src_char, unsigned char *dst
long n = samples;
while (n--)
{
- dst[0] = src[0] / 4294967295.0f;
+ dst[0] = src[0] / 4294967295.0;
dst ++;
src ++;
}
}
-static inline void
+static void
u32_to_float_x4 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
u32_to_float (conversion, src_char, dst_char, samples * 4);
}
-static inline void
+static void
u32_to_float_x3 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
u32_to_float (conversion, src_char, dst_char, samples * 3);
}
-static inline void
+static void
u32_to_float_x2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
u32_to_float (conversion, src_char, dst_char, samples * 2);
@@ -241,20 +241,20 @@ u16_to_float (const Babl *conversion,unsigned char *src_char, unsigned char *dst
}
}
-static inline void
+static void
u16_to_float_x4 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
u16_to_float (conversion, src_char, dst_char, samples * 4);
}
-static inline void
+static void
u16_to_float_x3 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
u16_to_float (conversion, src_char, dst_char, samples * 3);
}
-static inline void
+static void
u16_to_float_x2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples)
{
u16_to_float (conversion, src_char, dst_char, samples * 2);
diff --git a/extensions/two-table.c b/extensions/two-table.c
index 4b263cc..880adff 100644
--- a/extensions/two-table.c
+++ b/extensions/two-table.c
@@ -205,6 +205,17 @@ init (void)
if (littleendian)
{
+ const Babl *f32 = babl_format_new (
+ "name", "cairo-ARGB32",
+ babl_model ("R'aG'aB'aA"),
+ babl_type ("u8"),
+ babl_component ("B'a"),
+ babl_component ("G'a"),
+ babl_component ("R'a"),
+ babl_component ("A"),
+ NULL
+ );
+
const Babl *f24 = babl_format_new (
"name", "cairo-RGB24",
babl_model ("R'G'B'"),
diff --git a/extensions/16bit.c b/extensions/u16.c
index f8cdd21..ad0a35a 100644
--- a/extensions/16bit.c
+++ b/extensions/u16.c
@@ -25,7 +25,7 @@
#include "base/util.h"
#include "extensions/util.h"
-static inline void
+static void
conv_rgbu16_rgbau16 (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
@@ -45,7 +45,7 @@ conv_rgbu16_rgbau16 (const Babl *conversion,unsigned char *src,
}
}
-static inline void
+static void
conv_yu16_yau16 (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
diff --git a/extensions/u32.c b/extensions/u32.c
new file mode 100644
index 0000000..5e378cb
--- /dev/null
+++ b/extensions/u32.c
@@ -0,0 +1,376 @@
+/* babl - dynamically extendable universal pixel conversion library.
+ * Copyright (C) 2018, Øyvind Kolås.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include <stdio.h>
+#include <stdint.h>
+
+#include "babl.h"
+
+#include "base/util.h"
+#include "extensions/util.h"
+
+static inline void
+conv_u32_u16 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ uint32_t *src32 = (uint32_t*) src;
+ uint16_t *dst16 = (uint16_t*) dst;
+ long n = samples;
+
+ while (n--)
+ {
+ *dst16++ = (*src32++)>>16;
+ }
+}
+
+static inline void
+conv_u16_u32 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ uint16_t *src16 = (uint16_t*) src;
+ uint32_t *dst32 = (uint32_t*) dst;
+ long n = samples;
+
+ while (n--)
+ {
+ *dst32++ = (*src16++) * 65536.99f;
+ }
+}
+
+
+static void
+conv_yau32_yau16 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ conv_u32_u16 (conversion, src, dst, samples * 2);
+}
+
+static void
+conv_rgbu32_rgbu16 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ conv_u32_u16 (conversion, src, dst, samples * 3);
+}
+
+static void
+conv_rgbu16_rgbu32 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ conv_u16_u32 (conversion, src, dst, samples * 3);
+}
+
+static void
+conv_yau16_yau32 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ conv_u16_u32 (conversion, src, dst, samples * 2);
+}
+
+
+static void
+conv_rgbau32_rgbau16 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ conv_u32_u16 (conversion, src, dst, samples * 4);
+}
+
+static void
+conv_rgbau16_rgbau32 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+
+
+{
+ conv_u16_u32 (conversion, src, dst, samples * 4);
+}
+
+
+static inline void
+conv_rgba32_rgb32 (const Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ uint32_t *src32 = (uint32_t*) src;
+ uint32_t *dst32 = (uint32_t*) dst;
+ long n = samples;
+
+ while (n--)
+ {
+ *dst32++ = (*src32++);
+ *dst32++ = (*src32++);
+ *dst32++ = (*src32++);
+ src32++;
+ }
+}
+
+static inline void
+conv_rgb32_rgba32 (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ uint32_t *src32 = (uint32_t*) src;
+ uint32_t *dst32 = (uint32_t*) dst;
+ long n = samples;
+
+ while (n--)
+ {
+ *dst32++ = (*src32++);
+ *dst32++ = (*src32++);
+ *dst32++ = (*src32++);
+ *dst32++ = 4294967295;
+ }
+}
+
+
+static inline void
+conv_yu32_yau32 (const Babl *conversion,unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ uint32_t *src32 = (uint32_t*) src;
+ uint32_t *dst32 = (uint32_t*) dst;
+ long n = samples;
+
+ while (n--)
+ {
+ *dst32++ = (*src32++);
+ *dst32++ = 4294967295;
+ }
+}
+
+
+
+int init (void);
+
+int
+init (void)
+{
+ babl_conversion_new (
+ babl_format ("R'G'B'A u32"),
+ babl_format ("R'G'B'A u16"),
+ "linear",
+ conv_rgbau32_rgbau16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("R'G'B' u32"),
+ babl_format ("R'G'B' u16"),
+ "linear",
+ conv_rgbu32_rgbu16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("RGB u32"),
+ babl_format ("RGB u16"),
+ "linear",
+ conv_rgbu32_rgbu16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("R'G'B' u16"),
+ babl_format ("R'G'B' u32"),
+ "linear",
+ conv_rgbu16_rgbu32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("RGB u16"),
+ babl_format ("RGB u32"),
+ "linear",
+ conv_rgbu16_rgbu32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("RGBA u32"),
+ babl_format ("RGBA u16"),
+ "linear",
+ conv_rgbau32_rgbau16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("RGBA u16"),
+ babl_format ("RGBA u32"),
+ "linear",
+ conv_rgbau16_rgbau32,
+ NULL);
+
+ babl_conversion_new (
+ babl_format ("RaGaBaA u32"),
+ babl_format ("RaGaBaA u16"),
+ "linear",
+ conv_rgbau32_rgbau16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("RaGaBaA u16"),
+ babl_format ("RaGaBaA u32"),
+ "linear",
+ conv_rgbau16_rgbau32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("RGBA u32"),
+ babl_format ("RGB u32"),
+ "linear",
+ conv_rgba32_rgb32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("RGB u32"),
+ babl_format ("RGBA u32"),
+ "linear",
+ conv_rgb32_rgba32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("R'G'B'A u32"),
+ babl_format ("R'G'B' u32"),
+ "linear",
+ conv_rgba32_rgb32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("R'G'B' u32"),
+ babl_format ("R'G'B'A u32"),
+ "linear",
+ conv_rgb32_rgba32,
+ NULL);
+
+ babl_conversion_new (
+ babl_format ("Y u32"),
+ babl_format ("Y u16"),
+ "linear",
+ conv_u32_u16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y' u32"),
+ babl_format ("Y' u16"),
+ "linear",
+ conv_u32_u16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y u16"),
+ babl_format ("Y u32"),
+ "linear",
+ conv_u16_u32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y' u16"),
+ babl_format ("Y' u32"),
+ "linear",
+ conv_u16_u32,
+ NULL);
+
+
+ babl_conversion_new (
+ babl_format ("YA u32"),
+ babl_format ("YA u16"),
+ "linear",
+ conv_yau32_yau16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("YaA u32"),
+ babl_format ("YaA u16"),
+ "linear",
+ conv_yau32_yau16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y'A u32"),
+ babl_format ("Y'A u16"),
+ "linear",
+ conv_yau32_yau16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y'aA u32"),
+ babl_format ("Y'aA u16"),
+ "linear",
+ conv_yau32_yau16,
+ NULL);
+ babl_conversion_new (
+ babl_format ("YA u16"),
+ babl_format ("YA u32"),
+ "linear",
+ conv_yau16_yau32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("YaA u16"),
+ babl_format ("YaA u32"),
+ "linear",
+ conv_yau16_yau32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y'A u16"),
+ babl_format ("Y'A u32"),
+ "linear",
+ conv_yau16_yau32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y'aA u16"),
+ babl_format ("Y'aA u32"),
+ "linear",
+ conv_yau16_yau32,
+ NULL);
+
+
+ babl_conversion_new (
+ babl_format ("Y u32"),
+ babl_format ("YA u32"),
+ "linear",
+ conv_yu32_yau32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y u32"),
+ babl_format ("YaA u32"),
+ "linear",
+ conv_yu32_yau32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y' u32"),
+ babl_format ("Y'A u32"),
+ "linear",
+ conv_yu32_yau32,
+ NULL);
+ babl_conversion_new (
+ babl_format ("Y' u32"),
+ babl_format ("Y'aA u32"),
+ "linear",
+ conv_yu32_yau32,
+ NULL);
+
+ return 0;
+}
diff --git a/tools/babl_fish_path_fitness.c b/tools/babl_fish_path_fitness.c
index 93e1287..d56ca05 100644
--- a/tools/babl_fish_path_fitness.c
+++ b/tools/babl_fish_path_fitness.c
@@ -11,26 +11,45 @@
#define random rand
#endif
-#define pixels 1024
int total_length = 0;
int total_cost = 0;
int total = 0;
int ok = 0;
-static double test[pixels * 4];
-
-static void
-test_init (void)
-{
- int i;
+static int qux = 0;
- for (i = 0; i < pixels * 4; i++)
- test [i] = (double) random () / RAND_MAX;
-}
+#define UTF8
-static int qux = 0;
+#ifdef UTF8
static char *utf8_bar[] = { " ", "·", "▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" };
+#define DIRECT " "
+#define SELF " "
+#define EMPTY " "
+#define SL ""
+#define NL "\n"
+
+#else
+
+
+static char *utf8_bar[] = { " ",
+ "<span class='direct'> </span>",
+ "<span class='path2'> </span>",
+ "<span class='path3'> </span>",
+ "<span class='path4'> </span>",
+ "<span class='path5'> </span>",
+ "<span class='path6'> </span>",
+ "<span class='path7'> </span>",
+ "<span class='path8'> </span>"};
+#define SL "<div>"
+#define SELF "<span class='self'> </span>"
+#define EMPTY "<span class='empty'> </span>"
+#define NL "</div>\n"
+
+#endif
+
+
+
/*
static char *utf8_bar[]= {"!","▁","▃","▅","▇","█","!","!","!"};
static char *utf8_bar[]={"·", "█", "▇", "▆", "▅", "▄", "▃", "▂", "▁", };
@@ -43,9 +62,8 @@ static int destination_each (Babl *babl,
Babl *source = userdata;
Babl *destination = babl;
- qux++;
if (qux % babl_formats_count () == qux / babl_formats_count ())
- printf (" ");
+ printf (SELF);
else
{
Babl *temp = babl_fish_path (source, destination);
@@ -60,10 +78,11 @@ static int destination_each (Babl *babl,
}
else
{
- printf (" ");
+ printf (EMPTY);
total++;
}
}
+ qux++;
return 0;
}
@@ -72,19 +91,51 @@ static int source_no = 0;
static int source_each (Babl *babl,
void *userdata)
{
+ printf (SL);
babl_format_class_for_each (destination_each, babl);
- printf ("──%2i %s\n", source_no++, babl->instance.name);
+#ifdef UTF8
+ printf ("──%2i %s%s", source_no++, babl->instance.name, NL);
+#else
+ printf ("<span>%2i:%s</span>%s", source_no++, babl->instance.name, NL);
+#endif
return 0;
}
int main (void)
{
babl_init ();
- test_init ();
babl_set_extender (babl_extension_quiet_log ());
+
+#ifndef UTF8
+ printf ("<html><head>\n");
+ printf ("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>\n");
+
+ printf ("<style>\n"
+
+".empty, .direct, .self, .path1, .path2, .path3, .path4, .path5 { float:left; width: 1em; height: 1em; }"
+"body { background: black; padding: 2em; line-height: 1em; }"
+".empty { background: black; }"
+".self { background: yellow; }"
+".direct { background: blue; }"
+".path1 { background: green; }"
+".path2 { background: #8ff; }"
+".path3 { background: #8f8; }"
+".path4 { background: #2f2; }"
+".path5 { background: #0a0; }"
+".path6 { background: #082; }"
+".path7 { background: #050; }"
+".path8 { background: #020; }"
+
+
+"</style>\n");
+ printf ("</head><body>\n");
+
+#endif
+
babl_format_class_for_each (source_each, NULL);
+#ifdef UTF8
{
int i;
@@ -112,7 +163,6 @@ int main (void)
}
printf ("\n");
-
/*
for (i = 0; i < babl_formats_count (); i++)
printf ("│");
@@ -140,6 +190,9 @@ int main (void)
printf ("total cost : %i\n", total_cost);
/*printf ("ok / total : %i %i %f\n", ok, total, (1.0*ok) / total);
*/
+#else
+ printf ("</body></html>\n");
+#endif
babl_exit ();