docs: update alpha docs
authorØyvind Kolås <pippin@gimp.org>
Sun, 18 Aug 2019 13:28:52 +0000 (15:28 +0200)
committerØyvind Kolås <pippin@gimp.org>
Sun, 18 Aug 2019 13:30:07 +0000 (15:30 +0200)
docs/Glossary-static.html
docs/SymmetricAlpha-static.html [deleted file]
docs/UnifiedAlpha-static.html [new file with mode: 0644]
docs/index-static.html.in
docs/meson.build
docs/toc

index 7d7364d550dd9488f18d0c5cebdfe4fdd1ffc880..7f91b7769b64b2310d4737d5ddfc9764e6dadebf 100644 (file)
@@ -39,7 +39,7 @@ keep the vocabulary small.</p>
 own associated alpha. This representation is useful for avoiding color from
 empty pixels bleeding into surroundings. It is also able to represent emittance
 in addition to opacity.
-Babl uses <a href='SymmetricAlpha'>Symmetric alpha transformations</a> between <a href='#separate_alpha'>separate alpha</a> and associated alpha.</dd>
+Babl uses <a href='UnifiedAlpha'>Unified alpha transformations</a> between <a href='#separate_alpha'>separate alpha</a> and associated alpha.</dd>
 
 
     <dt><a name='BablFish' href='#BablFish'>BablFish</a></dt>
@@ -72,16 +72,13 @@ relevant spaces - the ICC profile for the space.</dt>
     <dt><a name='luminance' href='#luminance'>Luminance</a></dt>
     <dd>The photometric measure of luminious intensity of per unit area of light. The luminance in babl is proportional to luminance - though it doesn't use the SI unit of candela per square meter.</dd>
 
-    <dt><a name='non_associated_alpha' href='#non_associated_alpha'>Non-associated alpha</a></dt>
-    <dd>deprecated term, see separate alpha</dd>
-
     <dt><a name='premultiplied_alpha' href='#premultiplied_alpha'>Premultiplied alpha</a></dt>
     <dd>deprecated term, see associated alpha</dd>
 
-    <dt><a name='separate_alpha' href='#separate_alpha'>Separate alpha</a></dt>
-    <dd>This representation of pixels has alpha as a fully separate component,
+    <dt><a name='straight_alpha' href='#straight_alpha'>Straight alpha</a></dt>
+    <dd>Straight or separate alpha has alpha as a fully separate component,
 that can be adjusted without affecting the color.
-Babl uses <a href='SymmetricAlpha'>Symmetric alpha transformations</a> between separate and <a href='#associated_alpha'>associated alpha</a>.</dd>
+Babl uses <a href='Unifiedlpha'>symetric alpha transformations</a> between straight and <a href='#associated_alpha'>associated alpha</a>.</dd>
 
     <dt><a name='trc' href='#trc'>TRC</a></dt>
 
diff --git a/docs/SymmetricAlpha-static.html b/docs/SymmetricAlpha-static.html
deleted file mode 100644 (file)
index 959f0db..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?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</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 &amp;&amp;
-     value &gt;= -BABL_ALPHA_FLOOR_F)
-   return BABL_ALPHA_FLOOR_F;
- else
-   return 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' title='babl' 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/UnifiedAlpha-static.html b/docs/UnifiedAlpha-static.html
new file mode 100644 (file)
index 0000000..9b94806
--- /dev/null
@@ -0,0 +1,110 @@
+<?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>Unified 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</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 &amp;&amp;
+     value &gt;= -BABL_ALPHA_FLOOR_F)
+   return BABL_ALPHA_FLOOR_F;
+ else
+   return 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 reciprocal_alpha = 1.0f / babl_epsilon_for_zero_float (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;
+}
+
+
+static inline void
+separate_to_associated_rgba (const float *separate_rgba,
+                                   float *associated_rgba)
+{
+  float alpha = associated_rgba[3];
+  float limited_alpha = babl_epsilon_for_zero_float (alpha);
+
+  associated_rgba[0] = separate_rgba[0] * limited_alpha;
+  associated_rgba[1] = separate_rgba[1] * limited_alpha;
+  associated_rgba[2] = separate_rgba[2] * limited_alpha;
+  associated_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' title='babl' 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>
index df131f1a1aaf3f1eff3fbe0f0ff22df9920ae5ec..92a9c9ba24e8e4e1eb3d61ed075918fcb644f1eb 100644 (file)
@@ -55,7 +55,7 @@
       <li>Runtime profiling/validating and code-path optimizing with persistence of profiling data across runs, with caching of results.</li>
         <li>Can load <a href='ColorManagement.html'>Color Spaces</a> from ICC v2 and v4 profiles containing RGB matrix + TRC and with lcms2 dependency also <a
 href='CMYK.html'>CMYK</a> profiles.</li>
-      <li>Uses <a href='SymmetricAlpha.html'>Symmetric Alpha</a> conversions for conversions between separate and associate alpha, avoiding loss of color fidelity due to asymptotic behavior near alpha 0.0 in floating point.</li>
+      <li>Uses <a href='UnifiedAlpha.html'>Unified Alpha</a> conversions for conversions between separate and associate alpha, avoiding loss of color fidelity due to asymptotic behavior when dividing by 0.0 in floating point.</li>
       <li>Portable self contained C code working on win32, linux, bsds and mac
 on 32bit and 64bit systems.</li>
       <li>Stable, small API, with singleton objects returned.</li>
index d085b805f89b86700c771d37bf0f37b81fa3194d..01b6c3093aa7be5282a343cdb63bb43a9b6be270 100644 (file)
@@ -130,12 +130,12 @@ ColorManagement_html = custom_target('ColorManagement.html',
   build_by_default: true,
 )
 
-SymmetricAlpha_html = custom_target('SymmetricAlpha.html',
+UnifiedAlpha_html = custom_target('UnifiedAlpha.html',
   input : [
-    'SymmetricAlpha-static.html',
+    'UnifiedAlpha-static.html',
     'toc',
   ],
-  output: [ 'SymmetricAlpha.html', ],
+  output: [ 'UnifiedAlpha.html', ],
   command: [
     env_bin,
     'cp', '@INPUT0@', '@OUTPUT@',
@@ -144,7 +144,6 @@ SymmetricAlpha_html = custom_target('SymmetricAlpha.html',
   build_by_default: true,
 )
 
-
 run_target('push_web',
   command: [
     'scp', index_html, index_static_html, babl_css, scptarget,
index ec3685a1bce041c9774f9283f2a75750739523ac..ffbf61d8747ff1dee9e91bd061cc022280934f20 100644 (file)
--- a/docs/toc
+++ b/docs/toc
@@ -8,7 +8,7 @@
         <li><a href='Reference.html'>&nbsp;&nbsp;Reference</a></li>
         <li><a href='Glossary.html'>&nbsp;&nbsp;Glossary</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='UnifiedAlpha.html'>&nbsp;&nbsp;Unified-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>