Little CMS fast float plugin

Plugin Logo


What it does this piece of software?

Little CMS floating point plug-in accelerates 8 bit and floating point color transforms, and adds some other features:

  • Adds support for internal Photoshop 1.15 fixed point format
  • Adds a new formatter to obtain dither on 8 bit for certain color spaces (Gray, RGB and CMYK)

How does it work?

The speedup is accomplished by implementing new interpolation kernels, adding optimizations and re-arranging memory layouts. Additionally, it can use SIMD instructions if present.

What have I to do in order to integrate the plug-in in my code?

The code is already present in the LittleCMS distribution. The simplest way is to add the following include:

    #include "lcms2_fast_float.h"

And then, In the initialization part of your program add this line:

    cmsPlugin(cmsFastFloatExtensions());

You need also to add the source files into your project. Fine-tuning which transforms are using the plug-in is also possible by means of contexts.

The use case

If you are already using the LittleCMS color engine in your commercial applications, and want a boost on throughput, this plug-in is for you. Open-source projects under GPL3 can also benefit by using the plug-in for free. The idea is to do all the development using the free engine under MIT license and in the case you need more speed for floating-point color transforms, then just add the the plug-in code and two lines of code to activate it.

Floating point transformations are using generic code in the free engine, with this plug-in all floating point interpolations are redirected to optimized code that greatly improves the performance in terms of speed.

The requirements of the GPL3 license is, among others, to release your project’s source code. This can be a problem for commercial use, then an alternate commercial license is available at a reasonable fee of 150€. This will help to mantain the development of the engine and the web hosting.

  • This quote is for company, you are allowed to use the plug-in in as many products you wish, as long as those are created by same manufacturer.

  • License includes perpetual free upgrades to future versions

  • Please contact us for more information at sales {at} littlecms {dot} com

Throughput improvements

If you have downloaded the lcms2 package you already have the source code. There is a demo program that prints some statistics. See below an interpretation of the results. Testing has been done in several computers, from a high-performance gaming machine to an average one, mac, mac-mini and a humble mini-pc running debian. Results below are from a mid-to-low end PC.

8 bit profiles

8 bits is what normal screens are, so this kind of transforms are mainly used for display.

The simplest mode is matrix-shaper. The transform goes across a set of curves, then a 3x3 matrix and then across another set of curves.
Many so-called “color managed” software components are limited to this mode. It works on RGB or gray scale, plus a optional alpha channel.
Then comes CLUT. CLUT is when the transform goes across a 3D look up table using tri-linear or tethrahedral interpolation. This one is not so easy. With this mode sophisticated image editors or viewers can do things like “soft-proofing”, handle viewing conditions or perform emulations.

Whilst the gain on CLUT profiles is moderate, on matrix-shaper the boost is huge. Please note the gain in matrix-shaper is so big that makes CLUT increase to seem small. Make no mistake, it is 20% faster! Values in MegaBytes/Second. Higher is better.

8 bits


16 bit profiles

Although the goal of this plug-in is not 16 bits, we have also a special kernel for 16 bits in the plug-in. This is tetrahedral plus tone curves in both sides.

16 bits

Floating point

And here we have the true point of the plug-in. Modern image processing often use linear spaces, which need floating point to avoid posterization. Also this data class allows extended range for unbounded mode, highlights and drop-shadows.

16 bits

Detecting special cases.

Special cases arose continuosly. Just imagine you want to display an image and use both, the embedded profile and the monitor profile to do color management. Many times, people are using sRGB profile (or some variant with same primaries) for embedding, and also, have the monitor tagged as sRGB. With the plug-in, this situation is detected and speed increases accordly. Sometimes common sense is the best optimization. Linear sRGB to sRGB is also optimized, for example, as this color conversion would not need any change on primaries but only a tone curve on gamma.

8 bits special cases

On floating point the gain on special cases is such big that goes out of scale. Blue bars are so small that are unnoticeable. Not the case of responsiveness of software using this optimization. A completly different user experience.

floating point special cases

Dither

Certain operations on image data like color conversion are best done using 16 bits precision, specially when lookup tables and interpolation are involved. ICC profiles typically use 16 bit of precision, as do the transformation engines using those profiles. Although true 16 bit pipelines are being developed, and some are already available as host software, most of today hardware is limited to 8 bit precision, causing the result of color conversions to be truncated. This truncation to 8 bits can cause visible and objectionable “banding”, “contouring”, or “posterization” to occur in prints (large areas of “flat” color with abrupt “jumps” in between, where the input shows only smoothly varying gradients). Using true 16 bits pipelines, the problem does not occur. In order to minimize this effect a mechanism of error diffusion or “dither” has been implemented in the plug-in. To enable this feature, any of those format specifiers should be used for output only.

  • TYPE_GRAY_8_DITHER
  • TYPE_RGB_8_DITHER
  • TYPE_RGBA_8_DITHER
  • TYPE_BGR_8_DITHER
  • TYPE_ABGR_8_DITHER
  • TYPE_CMYK_8_DITHER
  • TYPE_KYMC_8_DITHER

Licensing details

If Licensee has purchased a license for the Software, subject to the terms and conditions of the Agreement, LittleCMS grants Licensee, a limited, non-exclusive, non-transferable license to install or include the Software in your own software and use that copy of the Software only in accordance with the agreement.

  • Licensee may use the Software to operate in conjunction with other commercial software.
  • Licensee is allowed to remove any LittleCMS copyright notices, logos or brand related texts.
  • Licensee is allowed to modify the Software without contributing back to the Open Source project.
  • Licensee are granted these rights for one (1) software company, including development and testing setups.

Again,

  • This quote is for company, you are allowed to use the plug-in in as many products you wish, as long as those are created by same manufacturer.
  • License includes perpetual free upgrades to future versions

Restrictions

Licensee may not:

  • Sell or distribute the plug-in completely standalone, it may only be distributed or sold together with Licensee commercial software.
  • Compete with the Open Source version of the plug-in, for example by creating a new Open Source branch using the commercial version.
  • Market the plug-in separately from Licensee-owned products or services as their own creation.

What do you get

After payment, we will send a signed licence to you by snail-mail.

Contact

Please contact us for more information at sales {at} littlecms {dot} com