[babl] docs: add separate pages for CMYK, ColorManagement and alpha



commit 0476f8b8fee2019c54d2302d6009dfa6d07f1dc5
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Jul 22 04:06:26 2019 +0200

    docs: add separate pages for CMYK, ColorManagement and alpha

 docs/CMYK-static.html            |  61 +++++++++++++++++++
 docs/CMYK.html                   |  87 ++++++++++++++++++++++++++
 docs/ColorManagement-static.html |  64 ++++++++++++++++++++
 docs/ColorManagement.html        |  90 +++++++++++++++++++++++++++
 docs/Makefile.am                 |  47 +++++++++++---
 docs/SymmetricAlpha-static.html  | 102 +++++++++++++++++++++++++++++++
 docs/SymmetricAlpha.html         | 128 +++++++++++++++++++++++++++++++++++++++
 docs/Vocabulary-static.html      | 107 ++++++++++++++++++++++++++++++++
 docs/index-static.html.in        |  47 +-------------
 docs/toc                         |  26 ++++++++
 tools/babl-html-dump.c           |   4 +-
 11 files changed, 707 insertions(+), 56 deletions(-)
---
diff --git a/docs/CMYK-static.html b/docs/CMYK-static.html
new file mode 100644
index 0000000..27cbe66
--- /dev/null
+++ b/docs/CMYK-static.html
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+
+<!-- The babl webpage is partially autogenerated
+-->
+<html>
+  <head>
+    <title>CMYK - babl</title>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
+    <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
+    <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
+    <style type='text/css'>
+       @import url(babl.css);
+    </style>
+  </head>
+  <body>
+
+    <div class='print'>
+      <div class='print_title'>
+        <h1>Babl-0.1.67</h1>
+      </div>
+    </div>
+<!--TOC-->
+
+    <div class='paper'>
+  <div class='content'>
+
+  <h2>CMYK</h2>
+
+  <p>CMYK handling is done using babl-spaces created with ICC profiles
+containing CMYK profiles. BablSpaces for these ICC profiles handle color conversions using lcms2 - or if 
compiled without lcms2 support a naive profile independent fallback.</p>
+  <p>When a babl space derived from a CMYK ICC profile is used to instantiate
+RGB formats, the resulting formats are using the default/NULL space for
+primaries and TRCs.</p>
+
+  <p>The CMYK formats that use lcms2 for color interchange with the rest of
+babl are the following, which are available for all data types, u8, u16, half
+and float:</p>
+  <dl>
+     <dt>CMYK</dt><dd>Cyan Magenta Yellow Key, with 0 being white and 1.0 full ink coverage.</dd>
+     <dt>CMYKA</dt><dd>as previous, with separate alpha channel</dd>
+     <dt>CaMaYaKaA</dt><dd>as previous but associated alpha</dd>
+     <dt>cmyk</dt><dd>inverted CMYK, where 0.0 is full ink coverage and 1.0 is none</dd>
+     <dt>cmykA</dt><dd>as previous, with separate alpha channel</dd>
+     <dt>camayakaA</dt><dd>as previous but associated alpha</dd>
+  </dl>
+
+
+  <a href='graphics/index.html'><img class='BablFish' alt='/babl-0.1.67' title='babl-0.1.67' 
src='graphics/babl-48x48.png'/></a>
+  </div>
+  </div>
+
+    <div class='graphic'>
+      <div class='print'>
+        <img src='graphics/babl-a4poster.png' alt=' '/>
+      </div>
+    </div>
+
+  </body>
+</html>
diff --git a/docs/CMYK.html b/docs/CMYK.html
new file mode 100644
index 0000000..6a8539a
--- /dev/null
+++ b/docs/CMYK.html
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+
+<!-- The babl webpage is partially autogenerated
+-->
+<html>
+  <head>
+    <title>CMYK - babl</title>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
+    <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
+    <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
+    <style type='text/css'>
+       @import url(babl.css);
+    </style>
+  </head>
+  <body>
+
+    <div class='print'>
+      <div class='print_title'>
+        <h1>Babl-0.1.67</h1>
+      </div>
+    </div>
+<!--TOC-->
+    <div class='toc'>
+      <div class='print'>
+         <h3>Contents</h3>
+      </div>
+      <ul>
+        <li><a href='index.html#Download'>&nbsp;&nbsp;Download</a></li>
+        <li><a href='index.html#Features'>&nbsp;&nbsp;Features</a></li>
+        <li><a href='ColorManagement.html'>&nbsp;&nbsp;Color Management</a></li>
+        <li><a href='SymmetricAlpha.html'>&nbsp;&nbsp;Symmetric-Alpha</a></li>
+        <li><a href='CMYK.html'>&nbsp;&nbsp;CMYK</a></li>
+        <!--<li><a href='#Background'>Background</a></li>-->
+        <li><a href='index.html#Usage'>&nbsp;&nbsp;Usage</a></li>
+        <li><a href='Vocabulary.html'>&nbsp;&nbsp;Vocabulary</a></li>
+        <!--<li><a href='index.html#Data-types'>&nbsp;&nbsp;&nbsp;&nbsp;Data types</a></li>
+        <li><a href='index.html#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='index.html#Environment'>&nbsp;&nbsp;Environment</a></li>
+        <li><a href='index.html#Extending'>&nbsp;&nbsp;Extending</a></li>
+        <li><a href='index.html#DirectoryOverview'>&nbsp;&nbsp;Directory Overview</a></li>
+        <li><a href='index.html#TODO'>&nbsp;&nbsp;Todo</a></li>
+
+        <li><a href='index.html#Copyright'>&nbsp;&nbsp;Copyright</a></li>
+        <li><a href='index.html#Authors'>&nbsp;&nbsp;Authors</a></li>
+      </ul>
+    </div>
+
+    <div class='paper'>
+  <div class='content'>
+
+  <h2>CMYK</h2>
+
+  <p>CMYK handling is done using babl-spaces created with ICC profiles
+containing CMYK profiles. BablSpaces for these ICC profiles handle color conversions using lcms2 - or if 
compiled without lcms2 support a naive profile independent fallback.</p>
+  <p>When a babl space derived from a CMYK ICC profile is used to instantiate
+RGB formats, the resulting formats are using the default/NULL space for
+primaries and TRCs.</p>
+
+  <p>The CMYK formats that use lcms2 for color interchange with the rest of
+babl are the following, which are available for all data types, u8, u16, half
+and float:</p>
+  <dl>
+     <dt>CMYK</dt><dd>Cyan Magenta Yellow Key, with 0 being white and 1.0 full ink coverage.</dd>
+     <dt>CMYKA</dt><dd>as previous, with separate alpha channel</dd>
+     <dt>CaMaYaKaA</dt><dd>as previous but associated alpha</dd>
+     <dt>cmyk</dt><dd>inverted CMYK, where 0.0 is full ink coverage and 1.0 is none</dd>
+     <dt>cmykA</dt><dd>as previous, with separate alpha channel</dd>
+     <dt>camayakaA</dt><dd>as previous but associated alpha</dd>
+  </dl>
+
+
+  <a href='graphics/index.html'><img class='BablFish' alt='/babl-0.1.67' title='babl-0.1.67' 
src='graphics/babl-48x48.png'/></a>
+  </div>
+  </div>
+
+    <div class='graphic'>
+      <div class='print'>
+        <img src='graphics/babl-a4poster.png' alt=' '/>
+      </div>
+    </div>
+
+  </body>
+</html>
diff --git a/docs/ColorManagement-static.html b/docs/ColorManagement-static.html
new file mode 100644
index 0000000..57c5516
--- /dev/null
+++ b/docs/ColorManagement-static.html
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+
+<!-- The babl webpage is partially autogenerated
+-->
+<html>
+  <head>
+    <title>babl color management</title>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
+    <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
+    <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
+    <style type='text/css'>
+       @import url(babl.css);
+    </style>
+
+  </head>
+  <body>
+
+<!--TOC-->
+
+
+    <div class='paper'>
+  <div class='content'>
+  <h2>Color Management</h2>
+
+  <p>By default the babl API is assuming data to be (unbounded) sRGB data, data
+  being sRGB defines the conversion to and from gray-scale as well as the gamma
+  - or Transfer Response Curve, TRC, used for converting between linear and
+  non-linear variants of the data.
+  </p>
+
+  <p>babl has API for creating a format for a specific space:
+  <tt>babl_format_with_space("R'G'B' u16", babl_space ("Rec2020"))</tt> creates
+  a 16 bit integer format for the Rec2020 color space. Babl knows internally
+  about "sRGB", "Rec2020", "Adobe", "Apple" and "ProPhoto" spaces, as they are
+  defined with constants on their wikipedia pages.
+  </p>
+
+  <p>Additional spaces can be loaded from monitor-class matrix+TRC ICC v2 and
+  v4 profiles. Using babl_icc_make_space (see babl.h for details). The space of
+  a babl format can also be queried with babl_format_get_space.
+  </p>
+
+  <p>The conversions babl does with ICC profiles are according to what is known
+  as the relative-colorimetric intent, monitor profiles containing both the
+  matrices used by babl and 3d CLUTs (color look up tables) sometimes also do
+  relative-colorimetric transfer for the "perceptual" intent CLUTs, but with
+  a more flexible and possibly higher accuracy conversions.</p>
+
+  <p>Handling of <a href='CMYK.html'>CMYK is in a separate document</a>.</p>
+
+  <a href='graphics/index.html'><img class='BablFish' alt='/babl-0.1.67' title='babl-0.1.67' 
src='graphics/babl-48x48.png'/></a>
+  </div>
+  </div>
+
+    <div class='graphic'>
+      <div class='print'>
+        <img src='graphics/babl-a4poster.png' alt=' '/>
+      </div>
+    </div>
+
+  </body>
+</html>
diff --git a/docs/ColorManagement.html b/docs/ColorManagement.html
new file mode 100644
index 0000000..5bb8482
--- /dev/null
+++ b/docs/ColorManagement.html
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+
+<!-- The babl webpage is partially autogenerated
+-->
+<html>
+  <head>
+    <title>babl color management</title>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
+    <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
+    <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
+    <style type='text/css'>
+       @import url(babl.css);
+    </style>
+
+  </head>
+  <body>
+
+<!--TOC-->
+    <div class='toc'>
+      <div class='print'>
+         <h3>Contents</h3>
+      </div>
+      <ul>
+        <li><a href='index.html#Download'>&nbsp;&nbsp;Download</a></li>
+        <li><a href='index.html#Features'>&nbsp;&nbsp;Features</a></li>
+        <li><a href='ColorManagement.html'>&nbsp;&nbsp;Color Management</a></li>
+        <li><a href='SymmetricAlpha.html'>&nbsp;&nbsp;Symmetric-Alpha</a></li>
+        <li><a href='CMYK.html'>&nbsp;&nbsp;CMYK</a></li>
+        <!--<li><a href='#Background'>Background</a></li>-->
+        <li><a href='index.html#Usage'>&nbsp;&nbsp;Usage</a></li>
+        <li><a href='Vocabulary.html'>&nbsp;&nbsp;Vocabulary</a></li>
+        <!--<li><a href='index.html#Data-types'>&nbsp;&nbsp;&nbsp;&nbsp;Data types</a></li>
+        <li><a href='index.html#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='index.html#Environment'>&nbsp;&nbsp;Environment</a></li>
+        <li><a href='index.html#Extending'>&nbsp;&nbsp;Extending</a></li>
+        <li><a href='index.html#DirectoryOverview'>&nbsp;&nbsp;Directory Overview</a></li>
+        <li><a href='index.html#TODO'>&nbsp;&nbsp;Todo</a></li>
+
+        <li><a href='index.html#Copyright'>&nbsp;&nbsp;Copyright</a></li>
+        <li><a href='index.html#Authors'>&nbsp;&nbsp;Authors</a></li>
+      </ul>
+    </div>
+
+
+    <div class='paper'>
+  <div class='content'>
+  <h2>Color Management</h2>
+
+  <p>By default the babl API is assuming data to be (unbounded) sRGB data, data
+  being sRGB defines the conversion to and from gray-scale as well as the gamma
+  - or Transfer Response Curve, TRC, used for converting between linear and
+  non-linear variants of the data.
+  </p>
+
+  <p>babl has API for creating a format for a specific space:
+  <tt>babl_format_with_space("R'G'B' u16", babl_space ("Rec2020"))</tt> creates
+  a 16 bit integer format for the Rec2020 color space. Babl knows internally
+  about "sRGB", "Rec2020", "Adobe", "Apple" and "ProPhoto" spaces, as they are
+  defined with constants on their wikipedia pages.
+  </p>
+
+  <p>Additional spaces can be loaded from monitor-class matrix+TRC ICC v2 and
+  v4 profiles. Using babl_icc_make_space (see babl.h for details). The space of
+  a babl format can also be queried with babl_format_get_space.
+  </p>
+
+  <p>The conversions babl does with ICC profiles are according to what is known
+  as the relative-colorimetric intent, monitor profiles containing both the
+  matrices used by babl and 3d CLUTs (color look up tables) sometimes also do
+  relative-colorimetric transfer for the "perceptual" intent CLUTs, but with
+  a more flexible and possibly higher accuracy conversions.</p>
+
+  <p>Handling of <a href='CMYK.html'>CMYK is in a separate document</a>.</p>
+
+  <a href='graphics/index.html'><img class='BablFish' alt='/babl-0.1.67' title='babl-0.1.67' 
src='graphics/babl-48x48.png'/></a>
+  </div>
+  </div>
+
+    <div class='graphic'>
+      <div class='print'>
+        <img src='graphics/babl-a4poster.png' alt=' '/>
+      </div>
+    </div>
+
+  </body>
+</html>
diff --git a/docs/Makefile.am b/docs/Makefile.am
index bea1654..4a0e2cc 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -13,16 +13,20 @@ DIST_SUBDIRS= graphics
 #
 #
 HTML_FILES = index-static.html         \
-            index.html         
+            index.html         \
+            CMYK.html          \
+            ColorManagement.html \
+            SymmetricAlpha.html \
+            Vocabulary.html
 
 EXTRA_DIST=                    \
        babl.css                \
        tools/xml_insert.sh     \
        tools/changelog2rss     \
        index-static.html.in    \
-       ColorManagement.html    \
-       CMYK.html       \
-       SymmetricAlpha.html     \
+       ColorManagement-static.html     \
+       CMYK-static.html        \
+       SymmetricAlpha-static.html      \
        COPYING                 \
        toc                     \
        COPYING.LESSER          \
@@ -35,8 +39,25 @@ DISTCLEANFILES = index-static.html $(BUILT_EXTRA_DIST)
 
 all: $(HTML_FILES)
 
+SymmetricAlpha.html: SymmetricAlpha-static.html toc
+       echo -n "HTML: $@"
+       cp $< $@ 
+       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ TOC $(top_srcdir)/docs/toc
+       echo " [OK]"
+
+CMYK.html: CMYK-static.html toc
+       echo -n "HTML: $@"
+       cp $< $@ 
+       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ TOC $(top_srcdir)/docs/toc
+       echo " [OK]"
+
+ColorManagement.html: ColorManagement-static.html toc
+       echo -n "HTML: $@"
+       cp $< $@ 
+       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ TOC $(top_srcdir)/docs/toc
+       echo " [OK]"
+
 index.html: index-static.html                    \
-           $(babl_html_dump)                    \
            $(top_srcdir)/AUTHORS                \
            $(top_srcdir)/TODO                   \
            $(top_srcdir)/NEWS                   \
@@ -44,14 +65,24 @@ index.html: index-static.html                    \
            Makefile.am
        echo -n "HTML: $@"
        cp $< $@ 
+       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ AUTHORS $(top_srcdir)/AUTHORS
+       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ TODO $(top_srcdir)/TODO
+       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ NEWS $(top_srcdir)/NEWS
+       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ TOC $(top_srcdir)/docs/toc
+       echo " [OK]"
+
+
+Vocabulary.html: Vocabulary-static.html                    \
+           $(babl_html_dump)                    \
+           toc                                  \
+           Makefile.am
+       echo -n "HTML: $@"
+       cp $< $@ 
        (which mktemp > /dev/null 2>&1 && TMPFILE=`mktemp` || TMPFILE="/tmp/babl_build_tempfile" ;\
        export BABL_PATH="$(top_builddir)/extensions:$(top_builddir)/extensions/.libs"; $(babl_html_dump) > 
$$TMPFILE;\
        $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ BablBase $$TMPFILE;\
        rm -f $$TMPFILE )
        echo -n "."
-       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ AUTHORS $(top_srcdir)/AUTHORS
-       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ TODO $(top_srcdir)/TODO
-       $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ NEWS $(top_srcdir)/NEWS
        $(SHELL) $(top_srcdir)/docs/tools/xml_insert.sh $@ TOC $(top_srcdir)/docs/toc
        echo " [OK]"
 
diff --git a/docs/SymmetricAlpha-static.html b/docs/SymmetricAlpha-static.html
new file mode 100644
index 0000000..4aca2d3
--- /dev/null
+++ b/docs/SymmetricAlpha-static.html
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+
+<!-- The babl webpage is partially autogenerated
+-->
+<html>
+  <head>
+    <title>Symmetric Alpha - babl</title>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
+    <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
+    <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
+    <style type='text/css'>
+       @import url(babl.css);
+    </style>
+  </head>
+  <body>
+
+    <div class='print'>
+      <div class='print_title'>
+        <h1>Babl-0.1.67</h1>
+      </div>
+    </div>
+<!--TOC-->
+
+    <div class='paper'>
+  <div class='content'>
+
+  <h2>Symmetric transformations for floating point alpha</h2>
+
+
+  <p> babl clamps the alpha used when going from separate alpha to associated
+alpha or from associated alpha to separate alpha to BABL_ALPHA_FLOOR. This
+replaces asymptotic behavior and direct precision loss of color precision when
+multiplying or dividing by alphas near 0.0 with a consistent symmetric
+transformation.</p>
+
+<p>Original intent of data as well as non-asymptotic precision loss is thus
+maintained when the processing chain might temporarily use the other alpha
+representation.</p>
+
+<pre>
+    #define BABL_ALPHA_FLOOR    (1.0/65536.0)
+    #define BABL_ALPHA_FLOOR_F  (1.0f/65536.0f)
+</pre>
+
+<p>The deviation from not clamping near 0.0 is within the quantization margin
+of 16bit integer alpha, thus no adaptations for any SIMD or and similar 8bit
+and 16bit extensions of pixel format conversions are needed.
+  </p>
+
+   <p>This is the clamping function in use:</p>
+<pre>
+static inline float
+babl_epsilon_for_zero_float (float value)
+{
+ if (value &lt;= BABL_ALPHA_FLOOR_F)
+ {
+   /* for performance one could directly retun BABL_ALPHA_FLOOR_F here
+      and dropping handling negative values consistently. */
+   if (value &gt;= 0.0f)
+     return BABL_ALPHA_FLOOR_F;
+   else if (value &gt;= -BABL_ALPHA_FLOOR_F)
+     return -BABL_ALPHA_FLOOR_F;
+ }
+ return value;  /* most common case, return input value */
+}
+</pre>
+<p>And an example use of this clamping function that is consistent with babls behavior:</p>
+<pre>
+static inline void
+associated_to_separate_rgba (const float *associated_rgba,
+                                   float *separate_rgba)
+{
+  float alpha = associated_rgba[3];
+  float clamped_alpha = babl_epsilon_for_zero_float (alpha);
+  float reciprocal_alpha = 1.0f / clamped_alpha;
+
+  separate_rgba[0] = associated_rgba[0] * reciprocal_alpha;
+  separate_rgba[1] = associated_rgba[1] * reciprocal_alpha;
+  separate_rgba[2] = associated_rgba[2] * reciprocal_alpha;
+  separate_rgba[3] = alpha;
+}
+</pre>
+
+
+<p>For more detils see <a 
href='https://gitlab.gnome.org/GNOME/babl/commit/a4d607843d3cab18745d547fc8a46dec51dcea5e'>the commit message 
of the most recent refinement</a> as well as <a 
href='https://www.patreon.com/posts/premultiplied-in-21014115'>blog post with further background</a>.</p>
+
+
+
+  <a href='graphics/index.html'><img class='BablFish' alt='/babl-0.1.67' title='babl-0.1.67' 
src='graphics/babl-48x48.png'/></a>
+  </div>
+  </div>
+
+    <div class='graphic'>
+      <div class='print'>
+        <img src='graphics/babl-a4poster.png' alt=' '/>
+      </div>
+    </div>
+
+  </body>
+</html>
diff --git a/docs/SymmetricAlpha.html b/docs/SymmetricAlpha.html
new file mode 100644
index 0000000..26ef6df
--- /dev/null
+++ b/docs/SymmetricAlpha.html
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+
+<!-- The babl webpage is partially autogenerated
+-->
+<html>
+  <head>
+    <title>Symmetric Alpha - babl</title>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
+    <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
+    <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
+    <style type='text/css'>
+       @import url(babl.css);
+    </style>
+  </head>
+  <body>
+
+    <div class='print'>
+      <div class='print_title'>
+        <h1>Babl-0.1.67</h1>
+      </div>
+    </div>
+<!--TOC-->
+    <div class='toc'>
+      <div class='print'>
+         <h3>Contents</h3>
+      </div>
+      <ul>
+        <li><a href='index.html#Download'>&nbsp;&nbsp;Download</a></li>
+        <li><a href='index.html#Features'>&nbsp;&nbsp;Features</a></li>
+        <li><a href='ColorManagement.html'>&nbsp;&nbsp;Color Management</a></li>
+        <li><a href='SymmetricAlpha.html'>&nbsp;&nbsp;Symmetric-Alpha</a></li>
+        <li><a href='CMYK.html'>&nbsp;&nbsp;CMYK</a></li>
+        <!--<li><a href='#Background'>Background</a></li>-->
+        <li><a href='index.html#Usage'>&nbsp;&nbsp;Usage</a></li>
+        <li><a href='Vocabulary.html'>&nbsp;&nbsp;Vocabulary</a></li>
+        <!--<li><a href='index.html#Data-types'>&nbsp;&nbsp;&nbsp;&nbsp;Data types</a></li>
+        <li><a href='index.html#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='index.html#Environment'>&nbsp;&nbsp;Environment</a></li>
+        <li><a href='index.html#Extending'>&nbsp;&nbsp;Extending</a></li>
+        <li><a href='index.html#DirectoryOverview'>&nbsp;&nbsp;Directory Overview</a></li>
+        <li><a href='index.html#TODO'>&nbsp;&nbsp;Todo</a></li>
+
+        <li><a href='index.html#Copyright'>&nbsp;&nbsp;Copyright</a></li>
+        <li><a href='index.html#Authors'>&nbsp;&nbsp;Authors</a></li>
+      </ul>
+    </div>
+
+    <div class='paper'>
+  <div class='content'>
+
+  <h2>Symmetric transformations for floating point alpha</h2>
+
+
+  <p> babl clamps the alpha used when going from separate alpha to associated
+alpha or from associated alpha to separate alpha to BABL_ALPHA_FLOOR. This
+replaces asymptotic behavior and direct precision loss of color precision when
+multiplying or dividing by alphas near 0.0 with a consistent symmetric
+transformation.</p>
+
+<p>Original intent of data as well as non-asymptotic precision loss is thus
+maintained when the processing chain might temporarily use the other alpha
+representation.</p>
+
+<pre>
+    #define BABL_ALPHA_FLOOR    (1.0/65536.0)
+    #define BABL_ALPHA_FLOOR_F  (1.0f/65536.0f)
+</pre>
+
+<p>The deviation from not clamping near 0.0 is within the quantization margin
+of 16bit integer alpha, thus no adaptations for any SIMD or and similar 8bit
+and 16bit extensions of pixel format conversions are needed.
+  </p>
+
+   <p>This is the clamping function in use:</p>
+<pre>
+static inline float
+babl_epsilon_for_zero_float (float value)
+{
+ if (value &lt;= BABL_ALPHA_FLOOR_F)
+ {
+   /* for performance one could directly retun BABL_ALPHA_FLOOR_F here
+      and dropping handling negative values consistently. */
+   if (value &gt;= 0.0f)
+     return BABL_ALPHA_FLOOR_F;
+   else if (value &gt;= -BABL_ALPHA_FLOOR_F)
+     return -BABL_ALPHA_FLOOR_F;
+ }
+ return value;  /* most common case, return input value */
+}
+</pre>
+<p>And an example use of this clamping function that is consistent with babls behavior:</p>
+<pre>
+static inline void
+associated_to_separate_rgba (const float *associated_rgba,
+                                   float *separate_rgba)
+{
+  float alpha = associated_rgba[3];
+  float clamped_alpha = babl_epsilon_for_zero_float (alpha);
+  float reciprocal_alpha = 1.0f / clamped_alpha;
+
+  separate_rgba[0] = associated_rgba[0] * reciprocal_alpha;
+  separate_rgba[1] = associated_rgba[1] * reciprocal_alpha;
+  separate_rgba[2] = associated_rgba[2] * reciprocal_alpha;
+  separate_rgba[3] = alpha;
+}
+</pre>
+
+
+<p>For more detils see <a 
href='https://gitlab.gnome.org/GNOME/babl/commit/a4d607843d3cab18745d547fc8a46dec51dcea5e'>the commit message 
of the most recent refinement</a> as well as <a 
href='https://www.patreon.com/posts/premultiplied-in-21014115'>blog post with further background</a>.</p>
+
+
+
+  <a href='graphics/index.html'><img class='BablFish' alt='/babl-0.1.67' title='babl-0.1.67' 
src='graphics/babl-48x48.png'/></a>
+  </div>
+  </div>
+
+    <div class='graphic'>
+      <div class='print'>
+        <img src='graphics/babl-a4poster.png' alt=' '/>
+      </div>
+    </div>
+
+  </body>
+</html>
diff --git a/docs/Vocabulary-static.html b/docs/Vocabulary-static.html
new file mode 100644
index 0000000..34b7b8c
--- /dev/null
+++ b/docs/Vocabulary-static.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+
+
+<!-- The babl webpage is partially autogenerated
+-->
+<html>
+  <head>
+    <title>babl-0.1.67</title>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
+
+    <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
+    <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
+    
+    <style type='text/css'>
+       @import url(babl.css);
+    </style>
+
+    <script type='text/javascript'>
+    function hide(id)
+    {
+      (document.getElementById(id)).style.display = "none";
+    }
+    function show(id)
+    {
+      (document.getElementById(id)).style.display = "block";
+    }
+    function get_visible (id)
+    {
+      var element = document.getElementById(id);
+
+      if (element &&
+          element.style.display &&
+          element.style.display != "none")
+         return true;
+      return false;
+    }
+    function set_visible (id, visible)
+    {
+      var element = document.getElementById(id);
+
+      if (element)
+        {
+          if (visible)
+              element.style.display = "block";
+          else
+              element.style.display = "none";
+        }
+    }
+    function toggle_visible (id)
+    {
+      if (get_visible(id))
+        set_visible(id, false);
+      else
+        set_visible(id,true);
+    }
+    </script>
+  </head>
+  <body>
+
+    <div class='print'>
+      <div class='print_title'>
+        <h1>Babl-0.1.67</h1>
+      </div>
+    </div>
+<!--TOC-->
+
+
+<div><a name='Babl'></a></div>
+    <div class='paper'>
+  <div class='content'>
+
+  <a name='Vocabulary'></a>
+  <h3 style='margin-bottom:0em;'>Vocabulary</h3>
+<!--BablBase-->
+
+<!--
+    <a name='Extensions'></a>
+    <h3>Extensions</h3>
+    <p>
+    At compile, load, and runtime; babl is extendable with:
+    </p>
+    <ul>
+      <li>data types.</li>
+      <li>color models.</li>
+      <li>pixel formats.</li>
+      <li>optimized conversion functions:
+      <dl>
+        <dt>SIMD instructions</dt>
+        <dd>MMX, SSE, Altivec ...</dd>
+        <dt>External libraries</dd>
+        <dd>liboil, hermes, libavcodec, lcms, ...</li>
+      </dl>
+      </li>
+    </ul>-->
+
+        <a href='graphics/index.html'><img class='BablFish' alt='/babl-0.1.67' title='babl-0.1.67' 
src='graphics/babl-48x48.png'/></a>
+      </div>
+    </div>
+    <div class='graphic'>
+      <div class='print'>
+        <img src='graphics/babl-a4poster.png' alt=' '/>
+      </div>
+    </div>
+
+  </body>
+</html>
diff --git a/docs/index-static.html.in b/docs/index-static.html.in
index 5ffe554..e5ad863 100644
--- a/docs/index-static.html.in
+++ b/docs/index-static.html.in
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 
-
 <!-- The babl webpage is partially autogenerated
 -->
 <html>
@@ -11,50 +10,10 @@
 
     <link rel="icon" href="graphics/babl-16x16.png" type="image/png" />
     <link rel="shortcut icon" href="graphics/babl-16x16.png" type="image/png" />
-    
+
     <style type='text/css'>
        @import url(babl.css);
     </style>
-
-    <script type='text/javascript'>
-    function hide(id)
-    {
-      (document.getElementById(id)).style.display = "none";
-    }
-    function show(id)
-    {
-      (document.getElementById(id)).style.display = "block";
-    }
-    function get_visible (id)
-    {
-      var element = document.getElementById(id);
-
-      if (element &&
-          element.style.display &&
-          element.style.display != "none")
-         return true;
-      return false;
-    }
-    function set_visible (id, visible)
-    {
-      var element = document.getElementById(id);
-
-      if (element)
-        {
-          if (visible)
-              element.style.display = "block";
-          else
-              element.style.display = "none";
-        }
-    }
-    function toggle_visible (id)
-    {
-      if (get_visible(id))
-        set_visible(id, false);
-      else
-        set_visible(id,true);
-    }
-    </script>
   </head>
   <body>
 
@@ -234,10 +193,6 @@ lab_buffer  = malloc (pixel_count * 3 * sizeof (float));
 
 
 
-  <a name='Vocabulary'></a>
-  <h3 style='margin-bottom:0em;'>Vocabulary</h3>
-<!--BablBase-->
-
 <!--
     <a name='Extensions'></a>
     <h3>Extensions</h3>
diff --git a/docs/toc b/docs/toc
new file mode 100644
index 0000000..484d963
--- /dev/null
+++ b/docs/toc
@@ -0,0 +1,26 @@
+    <div class='toc'>
+      <div class='print'>
+         <h3>Contents</h3>
+      </div>
+      <ul>
+        <li><a href='index.html#Download'>&nbsp;&nbsp;Download</a></li>
+        <li><a href='index.html#Features'>&nbsp;&nbsp;Features</a></li>
+        <li><a href='ColorManagement.html'>&nbsp;&nbsp;Color Management</a></li>
+        <li><a href='SymmetricAlpha.html'>&nbsp;&nbsp;Symmetric-Alpha</a></li>
+        <li><a href='CMYK.html'>&nbsp;&nbsp;CMYK</a></li>
+        <!--<li><a href='#Background'>Background</a></li>-->
+        <li><a href='index.html#Usage'>&nbsp;&nbsp;Usage</a></li>
+        <li><a href='Vocabulary.html'>&nbsp;&nbsp;Vocabulary</a></li>
+        <!--<li><a href='index.html#Data-types'>&nbsp;&nbsp;&nbsp;&nbsp;Data types</a></li>
+        <li><a href='index.html#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='index.html#Environment'>&nbsp;&nbsp;Environment</a></li>
+        <li><a href='index.html#Extending'>&nbsp;&nbsp;Extending</a></li>
+        <li><a href='index.html#DirectoryOverview'>&nbsp;&nbsp;Directory Overview</a></li>
+        <li><a href='index.html#TODO'>&nbsp;&nbsp;Todo</a></li>
+
+        <li><a href='index.html#Copyright'>&nbsp;&nbsp;Copyright</a></li>
+        <li><a href='index.html#Authors'>&nbsp;&nbsp;Authors</a></li>
+      </ul>
+    </div>
diff --git a/tools/babl-html-dump.c b/tools/babl-html-dump.c
index b685889..079b2d7 100644
--- a/tools/babl-html-dump.c
+++ b/tools/babl-html-dump.c
@@ -37,8 +37,8 @@ each_item (Babl *babl,
            void *user_data);
            
 static int 
- show_item (Babl *babl,
-            void *user_data);
+show_item (Babl *babl,
+           void *user_data);
 
 static int  
 hide_item (Babl *babl,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]