[OpenJDK 2D-Dev] RFR: 8012229: [lcms] Improve performance of color conversion for images with alpha channel

Sergey Bylokhov serb at openjdk.java.net
Mon Mar 29 23:02:08 UTC 2021

The lcms 2.8 version added support for the cmsFLAGS_COPY_ALPHA flag:

which supports alpha channel transportation

For our usage, it means we can use TYPE_4BYTE_ABGR and TYPE_INT_ARGB directly as a source and destination.

Some numbers; converting new BufferedImage(3000, 3000, TYPE_INT_ARGB) from CS_sRGB to CS_CIEXYZ via op.filter(src, dst):
//before the fix
//Benchmark                  Mode  Cnt    Score    Error  Units
//ColorAlphaConv.testFilter  avgt    5  603,392 ± 12,932  ms/op

//after the fix
//Benchmark                  Mode  Cnt    Score   Error  Units
//ColorAlphaConv.testFilter  avgt    5  121,624 ± 0,906  ms/op

But still slower than kcms
//kcms jdk8u60
//Benchmark                  Mode  Cnt   Score   Error  Units
//ColorAlphaConv.testFilter  avgt    5  13,256 ± 0,169  ms/op


Commit messages:
 - Initial fix

Changes: https://git.openjdk.java.net/jdk/pull/3239/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3239&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8012229
  Stats: 208 lines in 5 files changed: 195 ins; 2 del; 11 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3239.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3239/head:pull/3239

PR: https://git.openjdk.java.net/jdk/pull/3239

More information about the 2d-dev mailing list